CVS commit: src/sys/dev/i2c
Module Name:src Committed By: thorpej Date: Thu Jan 9 04:04:01 UTC 2020 Modified Files: src/sys/dev/i2c: ihidev.c ihidev.h Log Message: Re-enable the intr / mask / softint / unmask dance now that the x86 interrupt issue is fixed. Verified working by ryoon@ (thanks!). To generate a diff of this commit: cvs rdiff -u -r1.11 -r1.12 src/sys/dev/i2c/ihidev.c cvs rdiff -u -r1.3 -r1.4 src/sys/dev/i2c/ihidev.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/i2c/ihidev.c diff -u src/sys/dev/i2c/ihidev.c:1.11 src/sys/dev/i2c/ihidev.c:1.12 --- src/sys/dev/i2c/ihidev.c:1.11 Wed Dec 25 01:19:56 2019 +++ src/sys/dev/i2c/ihidev.c Thu Jan 9 04:04:01 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: ihidev.c,v 1.11 2019/12/25 01:19:56 thorpej Exp $ */ +/* $NetBSD: ihidev.c,v 1.12 2020/01/09 04:04:01 thorpej Exp $ */ /* $OpenBSD ihidev.c,v 1.13 2017/04/08 02:57:23 deraadt Exp $ */ /*- @@ -54,7 +54,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: ihidev.c,v 1.11 2019/12/25 01:19:56 thorpej Exp $"); +__KERNEL_RCSID(0, "$NetBSD: ihidev.c,v 1.12 2020/01/09 04:04:01 thorpej Exp $"); #include #include @@ -71,6 +71,7 @@ __KERNEL_RCSID(0, "$NetBSD: ihidev.c,v 1 # include "acpica.h" #endif #if NACPICA > 0 +#include #include #endif @@ -109,10 +110,14 @@ static int ihidev_detach(device_t, int); CFATTACH_DECL_NEW(ihidev, sizeof(struct ihidev_softc), ihidev_match, ihidev_attach, ihidev_detach, NULL); +static bool ihiddev_intr_init(struct ihidev_softc *); +static void ihiddev_intr_fini(struct ihidev_softc *); + static bool ihidev_suspend(device_t, const pmf_qual_t *); static bool ihidev_resume(device_t, const pmf_qual_t *); static int ihidev_hid_command(struct ihidev_softc *, int, void *, bool); static int ihidev_intr(void *); +static void ihidev_softintr(void *); static int ihidev_reset(struct ihidev_softc *, bool); static int ihidev_hid_desc_parse(struct ihidev_softc *); @@ -200,20 +205,9 @@ ihidev_attach(device_t parent, device_t repsz)); } sc->sc_ibuf = kmem_zalloc(sc->sc_isize, KM_SLEEP); -#if NACPICA > 0 - { - char buf[100]; - - sc->sc_ih = acpi_intr_establish(self, sc->sc_phandle, IPL_TTY, - false, ihidev_intr, sc, device_xname(self)); - if (sc->sc_ih == NULL) { - aprint_error_dev(self, "can't establish interrupt\n"); - return; - } - aprint_normal_dev(self, "interrupting at %s\n", - acpi_intr_string(sc->sc_ih, buf, sizeof(buf))); + if (! ihiddev_intr_init(sc)) { + return; } -#endif iha.iaa = ia; iha.parent = sc; @@ -260,10 +254,7 @@ ihidev_detach(device_t self, int flags) struct ihidev_softc *sc = device_private(self); mutex_enter(&sc->sc_intr_lock); -#if NACPICA > 0 - if (sc->sc_ih != NULL) - acpi_intr_disestablish(sc->sc_ih); -#endif + ihiddev_intr_fini(sc); if (ihidev_hid_command(sc, I2C_HID_CMD_SET_POWER, &I2C_HID_POWER_OFF, true)) aprint_error_dev(sc->sc_dev, "failed to power down\n"); @@ -649,31 +640,131 @@ ihidev_hid_desc_parse(struct ihidev_soft return (0); } +static bool +ihiddev_intr_init(struct ihidev_softc *sc) +{ +#if NACPICA > 0 + ACPI_HANDLE hdl = (void *)(uintptr_t)sc->sc_phandle; + struct acpi_resources res; + ACPI_STATUS rv; + char buf[100]; + + rv = acpi_resource_parse(sc->sc_dev, hdl, "_CRS", &res, + &acpi_resource_parse_ops_quiet); + if (ACPI_FAILURE(rv)) { + aprint_error_dev(sc->sc_dev, "can't parse '_CRS'\n"); + return false; + } + + const struct acpi_irq * const irq = acpi_res_irq(&res, 0); + if (irq == NULL) { + aprint_error_dev(sc->sc_dev, "no IRQ resource\n"); + acpi_resource_cleanup(&res); + return false; + } + + sc->sc_intr_type = + irq->ar_type == ACPI_EDGE_SENSITIVE ? IST_EDGE : IST_LEVEL; + + acpi_resource_cleanup(&res); + + sc->sc_ih = acpi_intr_establish(sc->sc_dev, sc->sc_phandle, IPL_TTY, + false, ihidev_intr, sc, device_xname(sc->sc_dev)); + if (sc->sc_ih == NULL) { + aprint_error_dev(sc->sc_dev, "can't establish interrupt\n"); + return false; + } + aprint_normal_dev(sc->sc_dev, "interrupting at %s\n", + acpi_intr_string(sc->sc_ih, buf, sizeof(buf))); + + sc->sc_sih = softint_establish(SOFTINT_SERIAL, ihidev_softintr, sc); + if (sc->sc_sih == NULL) { + aprint_error_dev(sc->sc_dev, + "can't establish soft interrupt\n"); + return false; + } + + return true; +#else + aprint_error_dev(sc->sc_dev, "can't establish interrupt\n"); + return false; +#endif +} + +static void +ihiddev_intr_fini(struct ihidev_softc *sc) +{ +#if NACPICA > 0 + if (sc->sc_ih != NULL) { + acpi_intr_disestablish(sc->sc_ih); + } + if (sc->sc_sih != NULL) { + softint_disestablish(sc->sc_sih); + } +#endif +} + +static void +ihidev_intr_mask(struct ihidev_softc * const sc) +{ + + if (sc->sc_intr_type == IST_LEVEL) { +#if NACPICA > 0 + acpi_intr_mask(sc->sc_ih); +#endif + } +} + +static void +ihidev_intr_unmask(struct ihidev_softc * const sc) +{ + + if (sc->sc_intr_type == IST_LEVEL) { +#
CVS commit: src/sys/dev/pci
Module Name:src Committed By: yamaguchi Date: Thu Jan 9 02:55:42 UTC 2020 Modified Files: src/sys/dev/pci: if_ixl.c Log Message: ixl(4) supports in-chip statistic counters per VSI To generate a diff of this commit: cvs rdiff -u -r1.17 -r1.18 src/sys/dev/pci/if_ixl.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/pci/if_ixl.c diff -u src/sys/dev/pci/if_ixl.c:1.17 src/sys/dev/pci/if_ixl.c:1.18 --- src/sys/dev/pci/if_ixl.c:1.17 Thu Jan 9 02:43:45 2020 +++ src/sys/dev/pci/if_ixl.c Thu Jan 9 02:55:41 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: if_ixl.c,v 1.17 2020/01/09 02:43:45 yamaguchi Exp $ */ +/* $NetBSD: if_ixl.c,v 1.18 2020/01/09 02:55:41 yamaguchi Exp $ */ /* * Copyright (c) 2013-2015, Intel Corporation @@ -559,6 +559,26 @@ struct ixl_stats_counters { uint64_t isc_link_xoff_rx_offset; struct evcnt isc_link_xoff_tx; uint64_t isc_link_xoff_tx_offset; + struct evcnt isc_vsi_rx_discards; + uint64_t isc_vsi_rx_discards_offset; + struct evcnt isc_vsi_rx_bytes; + uint64_t isc_vsi_rx_bytes_offset; + struct evcnt isc_vsi_rx_unicast; + uint64_t isc_vsi_rx_unicast_offset; + struct evcnt isc_vsi_rx_multicast; + uint64_t isc_vsi_rx_multicast_offset; + struct evcnt isc_vsi_rx_broadcast; + uint64_t isc_vsi_rx_broadcast_offset; + struct evcnt isc_vsi_tx_errors; + uint64_t isc_vsi_tx_errors_offset; + struct evcnt isc_vsi_tx_bytes; + uint64_t isc_vsi_tx_bytes_offset; + struct evcnt isc_vsi_tx_unicast; + uint64_t isc_vsi_tx_unicast_offset; + struct evcnt isc_vsi_tx_multicast; + uint64_t isc_vsi_tx_multicast_offset; + struct evcnt isc_vsi_tx_broadcast; + uint64_t isc_vsi_tx_broadcast_offset; }; /* @@ -623,6 +643,7 @@ struct ixl_softc { uint16_t sc_uplink_seid; /* le */ uint16_t sc_downlink_seid; /* le */ uint16_t sc_vsi_number; /* le */ + uint16_t sc_vsi_stat_counter_idx; uint16_t sc_seid; unsigned int sc_base_queue; @@ -4168,6 +4189,7 @@ ixl_get_vsi(struct ixl_softc *sc) struct ixl_aq_desc iaq; struct ixl_aq_vsi_param *param; struct ixl_aq_vsi_reply *reply; + struct ixl_aq_vsi_data *data; int rv; /* grumble, vsi info isn't "known" at compile time */ @@ -4207,6 +4229,8 @@ ixl_get_vsi(struct ixl_softc *sc) reply = (struct ixl_aq_vsi_reply *)iaq.iaq_param; sc->sc_vsi_number = reply->vsi_number; + data = IXL_DMA_KVA(vsi); + sc->sc_vsi_stat_counter_idx = le16toh(data->stat_counter_idx); return 0; } @@ -5639,6 +5663,17 @@ ixl_setup_stats(struct ixl_softc *sc) evcnt_attach_dynamic(&isc->isc_rx_broadcast, EVCNT_TYPE_MISC, NULL, device_xname(sc->sc_dev), "Rx broadcast / port"); + evcnt_attach_dynamic(&isc->isc_vsi_rx_bytes, EVCNT_TYPE_MISC, + NULL, device_xname(sc->sc_dev), "Rx bytes / vsi"); + evcnt_attach_dynamic(&isc->isc_vsi_rx_discards, EVCNT_TYPE_MISC, + NULL, device_xname(sc->sc_dev), "Rx discard / vsi"); + evcnt_attach_dynamic(&isc->isc_vsi_rx_unicast, EVCNT_TYPE_MISC, + NULL, device_xname(sc->sc_dev), "Rx unicast / vsi"); + evcnt_attach_dynamic(&isc->isc_vsi_rx_multicast, EVCNT_TYPE_MISC, + NULL, device_xname(sc->sc_dev), "Rx multicast / vsi"); + evcnt_attach_dynamic(&isc->isc_vsi_rx_broadcast, EVCNT_TYPE_MISC, + NULL, device_xname(sc->sc_dev), "Rx broadcast / vsi"); + evcnt_attach_dynamic(&isc->isc_tx_size_64, EVCNT_TYPE_MISC, NULL, device_xname(sc->sc_dev), "Tx size 64"); evcnt_attach_dynamic(&isc->isc_tx_size_127, EVCNT_TYPE_MISC, @@ -5666,6 +5701,17 @@ ixl_setup_stats(struct ixl_softc *sc) evcnt_attach_dynamic(&isc->isc_tx_broadcast, EVCNT_TYPE_MISC, NULL, device_xname(sc->sc_dev), "Tx broadcast / port"); + evcnt_attach_dynamic(&isc->isc_vsi_tx_bytes, EVCNT_TYPE_MISC, + NULL, device_xname(sc->sc_dev), "Tx bytes / vsi"); + evcnt_attach_dynamic(&isc->isc_vsi_tx_errors, EVCNT_TYPE_MISC, + NULL, device_xname(sc->sc_dev), "Tx errors / vsi"); + evcnt_attach_dynamic(&isc->isc_vsi_tx_unicast, EVCNT_TYPE_MISC, + NULL, device_xname(sc->sc_dev), "Tx unicast / vsi"); + evcnt_attach_dynamic(&isc->isc_vsi_tx_multicast, EVCNT_TYPE_MISC, + NULL, device_xname(sc->sc_dev), "Tx multicast / vsi"); + evcnt_attach_dynamic(&isc->isc_vsi_tx_broadcast, EVCNT_TYPE_MISC, + NULL, device_xname(sc->sc_dev), "Tx broadcast / vsi"); + sc->sc_stats_intval = IXL_STATS_INTERVAL_MSEC; callout_init(&sc->sc_stats_callout, CALLOUT_MPSAFE); callout_setfunc(&sc->sc_stats_callout, ixl_stats_callout, sc); @@ -5737,6 +5783,16 @@ ixl_teardown_stats(struct ixl_softc *sc) evcnt_detach(&isc->isc_tx_size_1023); evcnt_detach(&isc->isc_tx_size_1522); evcnt_detach(&isc->isc_tx_size_big); + evcnt_detach(&isc->isc_vsi_rx_discards); + evcnt_detach(&isc->isc_vsi_rx_bytes); + evcnt_detach(&isc->isc_vsi_rx_unicast); + evcnt_detach(&isc->isc_vsi_rx_multicast); + evcnt_detach(&isc->isc_vsi_rx_broadcast); + evcnt_detach(&isc->isc_vsi_tx_errors); + evcnt_detach(&isc->isc_vsi_tx_bytes); + evcnt_
CVS commit: src/sys/dev/pci
Module Name:src Committed By: yamaguchi Date: Thu Jan 9 02:43:45 UTC 2020 Modified Files: src/sys/dev/pci: if_ixl.c Log Message: ixl(4) supports in-chip statistic counters per port To generate a diff of this commit: cvs rdiff -u -r1.16 -r1.17 src/sys/dev/pci/if_ixl.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/pci/if_ixl.c diff -u src/sys/dev/pci/if_ixl.c:1.16 src/sys/dev/pci/if_ixl.c:1.17 --- src/sys/dev/pci/if_ixl.c:1.16 Wed Jan 8 09:12:11 2020 +++ src/sys/dev/pci/if_ixl.c Thu Jan 9 02:43:45 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: if_ixl.c,v 1.16 2020/01/08 09:12:11 yamaguchi Exp $ */ +/* $NetBSD: if_ixl.c,v 1.17 2020/01/09 02:43:45 yamaguchi Exp $ */ /* * Copyright (c) 2013-2015, Intel Corporation @@ -485,6 +485,82 @@ struct ixl_product { unsigned int product_id; }; +struct ixl_stats_counters { + bool isc_has_offset; + struct evcnt isc_crc_errors; + uint64_t isc_crc_errors_offset; + struct evcnt isc_illegal_bytes; + uint64_t isc_illegal_bytes_offset; + struct evcnt isc_rx_bytes; + uint64_t isc_rx_bytes_offset; + struct evcnt isc_rx_discards; + uint64_t isc_rx_discards_offset; + struct evcnt isc_rx_unicast; + uint64_t isc_rx_unicast_offset; + struct evcnt isc_rx_multicast; + uint64_t isc_rx_multicast_offset; + struct evcnt isc_rx_broadcast; + uint64_t isc_rx_broadcast_offset; + struct evcnt isc_rx_size_64; + uint64_t isc_rx_size_64_offset; + struct evcnt isc_rx_size_127; + uint64_t isc_rx_size_127_offset; + struct evcnt isc_rx_size_255; + uint64_t isc_rx_size_255_offset; + struct evcnt isc_rx_size_511; + uint64_t isc_rx_size_511_offset; + struct evcnt isc_rx_size_1023; + uint64_t isc_rx_size_1023_offset; + struct evcnt isc_rx_size_1522; + uint64_t isc_rx_size_1522_offset; + struct evcnt isc_rx_size_big; + uint64_t isc_rx_size_big_offset; + struct evcnt isc_rx_undersize; + uint64_t isc_rx_undersize_offset; + struct evcnt isc_rx_oversize; + uint64_t isc_rx_oversize_offset; + struct evcnt isc_rx_fragments; + uint64_t isc_rx_fragments_offset; + struct evcnt isc_rx_jabber; + uint64_t isc_rx_jabber_offset; + struct evcnt isc_tx_bytes; + uint64_t isc_tx_bytes_offset; + struct evcnt isc_tx_dropped_link_down; + uint64_t isc_tx_dropped_link_down_offset; + struct evcnt isc_tx_unicast; + uint64_t isc_tx_unicast_offset; + struct evcnt isc_tx_multicast; + uint64_t isc_tx_multicast_offset; + struct evcnt isc_tx_broadcast; + uint64_t isc_tx_broadcast_offset; + struct evcnt isc_tx_size_64; + uint64_t isc_tx_size_64_offset; + struct evcnt isc_tx_size_127; + uint64_t isc_tx_size_127_offset; + struct evcnt isc_tx_size_255; + uint64_t isc_tx_size_255_offset; + struct evcnt isc_tx_size_511; + uint64_t isc_tx_size_511_offset; + struct evcnt isc_tx_size_1023; + uint64_t isc_tx_size_1023_offset; + struct evcnt isc_tx_size_1522; + uint64_t isc_tx_size_1522_offset; + struct evcnt isc_tx_size_big; + uint64_t isc_tx_size_big_offset; + struct evcnt isc_mac_local_faults; + uint64_t isc_mac_local_faults_offset; + struct evcnt isc_mac_remote_faults; + uint64_t isc_mac_remote_faults_offset; + struct evcnt isc_link_xon_rx; + uint64_t isc_link_xon_rx_offset; + struct evcnt isc_link_xon_tx; + uint64_t isc_link_xon_tx_offset; + struct evcnt isc_link_xoff_rx; + uint64_t isc_link_xoff_rx_offset; + struct evcnt isc_link_xoff_tx; + uint64_t isc_link_xoff_tx_offset; +}; + /* * Locking notes: * + a field in ixl_tx_ring is protected by txr_lock (a spin mutex), and @@ -508,9 +584,15 @@ struct ixl_softc { bool sc_attached; bool sc_dead; bool sc_rxctl_atq; + uint32_t sc_port; struct sysctllog *sc_sysctllog; struct workqueue *sc_workq; struct workqueue *sc_workq_txrx; + int sc_stats_intval; + callout_t sc_stats_callout; + struct ixl_work sc_stats_task; + struct ixl_stats_counters + sc_stats_counters; uint8_t sc_enaddr[ETHER_ADDR_LEN]; struct ifmedia sc_media; uint64_t sc_media_status; @@ -613,6 +695,9 @@ do { \ #define DDPRINTF(sc, fmt, args...) __nothing #endif #define IXL_NOMSIX false +#ifndef IXL_STATS_INTERVAL_MSEC +#define IXL_STATS_INTERVAL_MSEC 1 +#endif static enum i40e_mac_type ixl_mactype(pci_product_id_t); @@ -742,6 +827,8 @@ static int ixl_setup_interrupts(struct i static void ixl_teardown_interrupts(struct ixl_softc *); static int ixl_setup_stats(struct ixl_softc *); static void ixl_teardown_stats(struct ixl_softc *); +static void ixl_stats_callout(void *); +static void ixl_stats_update(void *); static int ixl_setup_sysctls(struct ixl_softc *); static void ixl_teardown_sysctls(struct ixl_softc *); static int ixl_queue_pairs_alloc(struct ixl_softc *); @@ -973,7 +1060,8 @@ ixl_attach(device_t parent, device_t sel port = ixl_rd(sc, I40E_PFGEN_PORTNUM); port &= I40E_PFGEN_PORTNUM_PORT_NUM_MASK; port >>= I40E_PFGEN_PORTNUM_PORT_NUM_SHIFT; - aprint_no
CVS commit: src/sys/arch/aarch64/aarch64
Module Name:src Committed By: ryo Date: Thu Jan 9 01:38:34 UTC 2020 Modified Files: src/sys/arch/aarch64/aarch64: fault.c pmap.c Log Message: fix behaviour mmap()/mprotect() when passed only PROT_EXEC. when mmap()/mprotect() with only PROT_EXEC, syscall will be successful, but the page actually hadn't been mapped. it should be mapped with PROT_READ|PROT_EXEC implicitly. (r-x) To generate a diff of this commit: cvs rdiff -u -r1.10 -r1.11 src/sys/arch/aarch64/aarch64/fault.c cvs rdiff -u -r1.60 -r1.61 src/sys/arch/aarch64/aarch64/pmap.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/fault.c diff -u src/sys/arch/aarch64/aarch64/fault.c:1.10 src/sys/arch/aarch64/aarch64/fault.c:1.11 --- src/sys/arch/aarch64/aarch64/fault.c:1.10 Mon Jun 10 05:56:15 2019 +++ src/sys/arch/aarch64/aarch64/fault.c Thu Jan 9 01:38:34 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: fault.c,v 1.10 2019/06/10 05:56:15 ryo Exp $ */ +/* $NetBSD: fault.c,v 1.11 2020/01/09 01:38:34 ryo Exp $ */ /* * Copyright (c) 2017 Ryo Shimizu @@ -27,7 +27,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: fault.c,v 1.10 2019/06/10 05:56:15 ryo Exp $"); +__KERNEL_RCSID(0, "$NetBSD: fault.c,v 1.11 2020/01/09 01:38:34 ryo Exp $"); #include "opt_compat_netbsd32.h" #include "opt_ddb.h" @@ -170,7 +170,7 @@ data_abort_handler(struct trapframe *tf, } if ((eclass == ESR_EC_INSN_ABT_EL0) || (eclass == ESR_EC_INSN_ABT_EL1)) - ftype = VM_PROT_READ | VM_PROT_EXECUTE; + ftype = VM_PROT_EXECUTE; else if (__SHIFTOUT(esr, ESR_ISS_DATAABORT_CM)) ftype = VM_PROT_READ; else Index: src/sys/arch/aarch64/aarch64/pmap.c diff -u src/sys/arch/aarch64/aarch64/pmap.c:1.60 src/sys/arch/aarch64/aarch64/pmap.c:1.61 --- src/sys/arch/aarch64/aarch64/pmap.c:1.60 Mon Dec 30 16:03:48 2019 +++ src/sys/arch/aarch64/aarch64/pmap.c Thu Jan 9 01:38:34 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: pmap.c,v 1.60 2019/12/30 16:03:48 skrll Exp $ */ +/* $NetBSD: pmap.c,v 1.61 2020/01/09 01:38:34 ryo Exp $ */ /* * Copyright (c) 2017 Ryo Shimizu @@ -27,7 +27,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.60 2019/12/30 16:03:48 skrll Exp $"); +__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.61 2020/01/09 01:38:34 ryo Exp $"); #include "opt_arm_debug.h" #include "opt_ddb.h" @@ -1232,6 +1232,10 @@ pmap_protect(struct pmap *pm, vaddr_t sv KASSERT_PM_ADDR(pm, sva); KASSERT(!IN_KSEG_ADDR(sva)); + /* PROT_EXEC requires implicit PROT_READ */ + if (prot & VM_PROT_EXECUTE) + prot |= VM_PROT_READ; + if ((prot & VM_PROT_READ) == VM_PROT_NONE) { PMAP_COUNT(protect_remove_fallback); pmap_remove(pm, sva, eva); @@ -2139,6 +2143,10 @@ pmap_fault_fixup(struct pmap *pm, vaddr_ /* ignore except read/write */ accessprot &= (VM_PROT_READ|VM_PROT_WRITE|VM_PROT_EXECUTE); + /* PROT_EXEC requires implicit PROT_READ */ + if (accessprot & VM_PROT_EXECUTE) + accessprot |= VM_PROT_READ; + /* no permission to read/write/execute for this page */ if ((pmap_prot & accessprot) != accessprot) { UVMHIST_LOG(pmaphist, "no permission to access", 0, 0, 0, 0);
CVS commit: src/sys/arch/amd64
Module Name:src Committed By: manu Date: Thu Jan 9 00:42:24 UTC 2020 Modified Files: src/sys/arch/amd64/amd64: locore.S machdep.c src/sys/arch/amd64/conf: GENERIC files.amd64 kern.ldscript Log Message: Rollback multiboot2 for amd64, as requested by core To generate a diff of this commit: cvs rdiff -u -r1.197 -r1.198 src/sys/arch/amd64/amd64/locore.S cvs rdiff -u -r1.344 -r1.345 src/sys/arch/amd64/amd64/machdep.c cvs rdiff -u -r1.553 -r1.554 src/sys/arch/amd64/conf/GENERIC cvs rdiff -u -r1.114 -r1.115 src/sys/arch/amd64/conf/files.amd64 cvs rdiff -u -r1.30 -r1.31 src/sys/arch/amd64/conf/kern.ldscript 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/amd64/locore.S diff -u src/sys/arch/amd64/amd64/locore.S:1.197 src/sys/arch/amd64/amd64/locore.S:1.198 --- src/sys/arch/amd64/amd64/locore.S:1.197 Wed Jan 8 20:59:18 2020 +++ src/sys/arch/amd64/amd64/locore.S Thu Jan 9 00:42:24 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: locore.S,v 1.197 2020/01/08 20:59:18 skrll Exp $ */ +/* $NetBSD: locore.S,v 1.198 2020/01/09 00:42:24 manu Exp $ */ /* * Copyright-o-rama! @@ -158,7 +158,6 @@ #include "opt_compat_netbsd.h" #include "opt_compat_netbsd32.h" -#include "opt_multiboot.h" #include "opt_xen.h" #include "opt_svs.h" @@ -178,13 +177,6 @@ #include #include -#ifndef XENPV -#include -#endif - -#define CODE_SEGMENT 0x08 -#define DATA_SEGMENT 0x10 - #if NLAPIC > 0 #include #endif @@ -432,50 +424,6 @@ END(farjmp64) .space 512 tmpstk: -.section multiboot,"a" -#if defined(MULTIBOOT) - .align 8 - .globl Multiboot2_Header -_C_LABEL(Multiboot2_Header): - .int MULTIBOOT2_HEADER_MAGIC - .int MULTIBOOT2_ARCHITECTURE_I386 - .int Multiboot2_Header_end - Multiboot2_Header - .int -(MULTIBOOT2_HEADER_MAGIC + MULTIBOOT2_ARCHITECTURE_I386 \ - + (Multiboot2_Header_end - Multiboot2_Header)) - - .int 1 /* MULTIBOOT_HEADER_TAG_INFORMATION_REQUEST */ - .int 12 /* sizeof(multiboot_header_tag_information_request) */ - /* + sizeof(uint32_t) * requests */ - .int 4 /* MULTIBOOT_TAG_TYPE_BASIC_MEMINFO */ - .align 8 - - .int 3 /* MULTIBOOT_HEADER_TAG_ENTRY_ADDRESS */ - .int 16 /* sizeof(struct multiboot_tag_efi64) */ - .quad (multiboot2_entry - KERNBASE) - .align 8 - - .int 9 /* MULTIBOOT_HEADER_TAG_ENTRY_ADDRESS_EFI64 */ - .int 16 /* sizeof(struct multiboot_tag_efi64) */ - .quad (multiboot2_entry - KERNBASE) - .align 8 - -#if notyet - /* - * Could be used to get an early console for debug, - * but this is broken. - */ - .int 7 /* MULTIBOOT_HEADER_TAG_EFI_BS */ - .int 8 /* sizeof(struct multiboot_tag) */ - .align 8 -#endif - - .int 0 /* MULTIBOOT_HEADER_TAG_END */ - .int 8 /* sizeof(struct multiboot_tag) */ - .align 8 - .globl Multiboot2_Header_end -_C_LABEL(Multiboot2_Header_end): -#endif /* MULTIBOOT */ - /* * Some hackage to deal with 64bit symbols in 32 bit mode. * This may not be needed if things are cleaned up a little. @@ -492,700 +440,6 @@ ENTRY(start) /* Warm boot */ movw $0x1234,0x472 -#if defined(MULTIBOOT) - jmp .Lnative_loader - - -multiboot2_entry: - .code64 - /* - * multiboot2 entry point. We are left here without - * stack and with no idea of where we were loaded in memory. - * The only inputs are - * %eax MULTIBOOT2_BOOTLOADER_MAGIC - * %ebx pointer to multiboot_info - * - * Here we will: - * - copy the kernel to 0x20 (KERNTEXTOFF - KERNBASE) - * as almost all the code in locore.S assume it is there. - * This is derived from - * src/sys/arch/i386/stand/efiboot/bootx64/startprog64.S - * - copy multiboot_info, as done in multiboot_pre_reloc() from - * src/sys/arch/x86/x86/multiboot2.c - * Unfortunately we cannot call that function as there is - * no simple way to build it as 32 bit code in a 64 bit kernel. - * - Copy ELF symbols, also as in multiboot_pre_reloc() - */ - - cli - - /* - * Discover our load address and use it to get start address - */ - mov $_RELOC(tmpstk),%rsp - call next -next: pop %r8 - sub $(next - start), %r8 - - /* - * Save multiboot_info for later. We cannot use - * temporary stack for that since we are going to - * overwrite it. - */ - movl %ebx, (multiboot2_info_ptr - start)(%r8) - - /* - * Get relocated multiboot2_loader entry point in %r9 - */ - mov $(KERNTEXTOFF - KERNBASE), %r9 - add $(multiboot2_loader - kernel_text), %r9 - - /* Copy kernel */ - mov $(KERNTEXTOFF - KERNBASE), %rdi /* dest */ - mov %r8, %rsi - sub $(start - kernel_text), %rsi /* src */ - mov $(__kernel_end - kernel_text), %rcx /* size */ - mov %rcx, %r12 - movq %rdi, %r11 /* for misaligned check */ - -#if !defined(NO_OVERLAP) - movq %rdi, %r13 - subq %rsi, %r13 -#endif - - shrq $3, %rcx /* count for copy by words */ - jz 8f /* j if less than 8 bytes */ - - lea -8(%rdi, %r12), %r14 /* target address of last 8 */ - mov -8(%rsi, %r12), %r15 /* get last word */ -#if !defined(NO_OVERLAP) - cmpq %r12, %r13 /* overlapping? */ -
CVS commit: src/sys/dev/usb
Module Name:src Committed By: macallan Date: Wed Jan 8 23:28:56 UTC 2020 Modified Files: src/sys/dev/usb: ukbd.c Log Message: send PMF events for volume and brightness control keys on Apple keyboards To generate a diff of this commit: cvs rdiff -u -r1.142 -r1.143 src/sys/dev/usb/ukbd.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/usb/ukbd.c diff -u src/sys/dev/usb/ukbd.c:1.142 src/sys/dev/usb/ukbd.c:1.143 --- src/sys/dev/usb/ukbd.c:1.142 Sun May 5 03:17:54 2019 +++ src/sys/dev/usb/ukbd.c Wed Jan 8 23:28:56 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: ukbd.c,v 1.142 2019/05/05 03:17:54 mrg Exp $*/ +/* $NetBSD: ukbd.c,v 1.143 2020/01/08 23:28:56 macallan Exp $*/ /* * Copyright (c) 1998 The NetBSD Foundation, Inc. @@ -35,7 +35,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: ukbd.c,v 1.142 2019/05/05 03:17:54 mrg Exp $"); +__KERNEL_RCSID(0, "$NetBSD: ukbd.c,v 1.143 2020/01/08 23:28:56 macallan Exp $"); #ifdef _KERNEL_OPT #include "opt_ddb.h" @@ -121,16 +121,16 @@ Static const struct ukbd_keycodetrans tr { 0x33, 0x56 }, /* ; -> KP - */ { 0x37, 0x63 }, /* . -> KP . */ { 0x38, 0x57 }, /* / -> KP + */ - { 0x3a, 0xd1 }, /* F1..F12 mapped to reserved codes 0xd1..0xdc */ - { 0x3b, 0xd2 }, - { 0x3c, 0xd3 }, - { 0x3d, 0xd4 }, - { 0x3e, 0xd5 }, - { 0x3f, 0xd6 }, + { 0x3a, IS_PMF | PMFE_DISPLAY_BRIGHTNESS_DOWN }, + { 0x3b, IS_PMF | PMFE_DISPLAY_BRIGHTNESS_UP }, + { 0x3c, IS_PMF | PMFE_AUDIO_VOLUME_TOGGLE }, + { 0x3d, IS_PMF | PMFE_AUDIO_VOLUME_DOWN }, + { 0x3e, IS_PMF | PMFE_AUDIO_VOLUME_UP }, + { 0x3f, 0xd6 }, /* num lock */ { 0x40, 0xd7 }, { 0x41, 0xd8 }, - { 0x42, 0xd9 }, - { 0x43, 0xda }, + { 0x42, 0xd9 }, /* kbd light down */ + { 0x43, 0xda }, /* kbd light up */ { 0x44, 0xdb }, { 0x45, 0xdc }, { 0x4f, 0x4d }, /* Right -> End */
CVS commit: src/share/mk
Module Name:src Committed By: christos Date: Wed Jan 8 22:04:24 UTC 2020 Modified Files: src/share/mk: sys.mk Log Message: Back out previous. This has no chance to work unless the make variable parsing is not changed do that instead of scanning for a single character delim ':', it scans for "?:". This is because !empty(COMPILE.c:M*-pg*) contains a ':'. To generate a diff of this commit: cvs rdiff -u -r1.141 -r1.142 src/share/mk/sys.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/sys.mk diff -u src/share/mk/sys.mk:1.141 src/share/mk/sys.mk:1.142 --- src/share/mk/sys.mk:1.141 Tue Jan 7 23:15:45 2020 +++ src/share/mk/sys.mk Wed Jan 8 17:04:24 2020 @@ -1,4 +1,4 @@ -# $NetBSD: sys.mk,v 1.141 2020/01/08 04:15:45 christos Exp $ +# $NetBSD: sys.mk,v 1.142 2020/01/08 22:04:24 christos Exp $ # @(#)sys.mk 8.2 (Berkeley) 3/21/94 # # This file contains the basic rules for make(1) and is read first @@ -34,7 +34,7 @@ DBG?= -O2 -fno-reorder-blocks .elif ${MACHINE_ARCH} == "coldfire" DBG?= -O1 .elif !empty(MACHINE_ARCH:Maarch64*) -DBG?= -O2 ${!empty(COMPILE.c:M*-pg*) || !empty(COMPILE.cc:M*-pg*) :? -fomit-frame-pointer:} +DBG?= -O2 ${"${.TARGET:M*.po}" == "":? -fomit-frame-pointer:} .else DBG?= -O2 .endif
CVS commit: [ad-namecache] src/sys/kern
Module Name:src Committed By: ad Date: Wed Jan 8 21:55:10 UTC 2020 Modified Files: src/sys/kern [ad-namecache]: vfs_cache.c Log Message: Fix a comment. To generate a diff of this commit: cvs rdiff -u -r1.126.2.2 -r1.126.2.3 src/sys/kern/vfs_cache.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_cache.c diff -u src/sys/kern/vfs_cache.c:1.126.2.2 src/sys/kern/vfs_cache.c:1.126.2.3 --- src/sys/kern/vfs_cache.c:1.126.2.2 Wed Jan 8 11:44:30 2020 +++ src/sys/kern/vfs_cache.c Wed Jan 8 21:55:10 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: vfs_cache.c,v 1.126.2.2 2020/01/08 11:44:30 ad Exp $ */ +/* $NetBSD: vfs_cache.c,v 1.126.2.3 2020/01/08 21:55:10 ad Exp $ */ /*- * Copyright (c) 2008, 2019 The NetBSD Foundation, Inc. @@ -149,7 +149,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: vfs_cache.c,v 1.126.2.2 2020/01/08 11:44:30 ad Exp $"); +__KERNEL_RCSID(0, "$NetBSD: vfs_cache.c,v 1.126.2.3 2020/01/08 21:55:10 ad Exp $"); #define __NAMECACHE_PRIVATE #ifdef _KERNEL_OPT @@ -333,7 +333,7 @@ cache_lookup_entry(struct vnode *dvp, co KASSERT(ncp->nc_dvp == dvp); /* * Avoid false sharing: don't write back to nc_hittime - * unless it has changed within the last 32 ticks. + * unless changed significantly. */ if (((ncp->nc_hittime ^ hardclock_ticks) & ~31) != 0) { ncp->nc_hittime = hardclock_ticks;
CVS commit: src/sys/arch
Module Name:src Committed By: skrll Date: Wed Jan 8 20:59:20 UTC 2020 Modified Files: src/sys/arch/aarch64/aarch64: cpuswitch.S src/sys/arch/alpha/alpha: locore.s src/sys/arch/amd64/amd64: locore.S src/sys/arch/arm/arm32: cpuswitch.S src/sys/arch/hppa/hppa: locore.S src/sys/arch/m68k/m68k: switch_subr.s src/sys/arch/mips/mips: locore.S src/sys/arch/powerpc/powerpc: locore_subr.S src/sys/arch/riscv/riscv: locore.S src/sys/arch/sh3/sh3: locore_subr.S src/sys/arch/sparc/sparc: locore.s src/sys/arch/sparc64/sparc64: locore.s Log Message: oldlwp is always non-NULL in cpu_switchto so remove the test for NULL. To generate a diff of this commit: cvs rdiff -u -r1.14 -r1.15 src/sys/arch/aarch64/aarch64/cpuswitch.S cvs rdiff -u -r1.123 -r1.124 src/sys/arch/alpha/alpha/locore.s cvs rdiff -u -r1.196 -r1.197 src/sys/arch/amd64/amd64/locore.S cvs rdiff -u -r1.96 -r1.97 src/sys/arch/arm/arm32/cpuswitch.S cvs rdiff -u -r1.3 -r1.4 src/sys/arch/hppa/hppa/locore.S cvs rdiff -u -r1.33 -r1.34 src/sys/arch/m68k/m68k/switch_subr.s cvs rdiff -u -r1.221 -r1.222 src/sys/arch/mips/mips/locore.S cvs rdiff -u -r1.58 -r1.59 src/sys/arch/powerpc/powerpc/locore_subr.S cvs rdiff -u -r1.10 -r1.11 src/sys/arch/riscv/riscv/locore.S cvs rdiff -u -r1.57 -r1.58 src/sys/arch/sh3/sh3/locore_subr.S cvs rdiff -u -r1.275 -r1.276 src/sys/arch/sparc/sparc/locore.s cvs rdiff -u -r1.422 -r1.423 src/sys/arch/sparc64/sparc64/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/aarch64/aarch64/cpuswitch.S diff -u src/sys/arch/aarch64/aarch64/cpuswitch.S:1.14 src/sys/arch/aarch64/aarch64/cpuswitch.S:1.15 --- src/sys/arch/aarch64/aarch64/cpuswitch.S:1.14 Wed Jan 8 17:38:41 2020 +++ src/sys/arch/aarch64/aarch64/cpuswitch.S Wed Jan 8 20:59:18 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: cpuswitch.S,v 1.14 2020/01/08 17:38:41 ad Exp $ */ +/* $NetBSD: cpuswitch.S,v 1.15 2020/01/08 20:59:18 skrll Exp $ */ /*- * Copyright (c) 2014 The NetBSD Foundation, Inc. @@ -37,18 +37,16 @@ #include "opt_ddb.h" #include "opt_kasan.h" -RCSID("$NetBSD: cpuswitch.S,v 1.14 2020/01/08 17:38:41 ad Exp $") +RCSID("$NetBSD: cpuswitch.S,v 1.15 2020/01/08 20:59:18 skrll Exp $") /* * At IPL_SCHED: - * x0 = oldlwp (maybe be NULL) + * x0 = oldlwp * x1 = newlwp * x2 = returning * returns x0-x2 unchanged */ ENTRY_NP(cpu_switchto) - cbz x0, .Lrestore_lwp - /* * Store the callee saved register on the stack. */ @@ -72,7 +70,6 @@ ENTRY_NP(cpu_switchto) /* We are done with the old lwp */ -.Lrestore_lwp: DISABLE_INTERRUPT ldr x6, [x1, #L_PCB] /* x6 = lwp_getpcb(newlwp) */ ldr x4, [x6, #PCB_TF] /* get trapframe ptr (aka SP) */ Index: src/sys/arch/alpha/alpha/locore.s diff -u src/sys/arch/alpha/alpha/locore.s:1.123 src/sys/arch/alpha/alpha/locore.s:1.124 --- src/sys/arch/alpha/alpha/locore.s:1.123 Sat Apr 6 03:06:24 2019 +++ src/sys/arch/alpha/alpha/locore.s Wed Jan 8 20:59:18 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: locore.s,v 1.123 2019/04/06 03:06:24 thorpej Exp $ */ +/* $NetBSD: locore.s,v 1.124 2020/01/08 20:59:18 skrll Exp $ */ /*- * Copyright (c) 1999, 2000, 2019 The NetBSD Foundation, Inc. @@ -67,7 +67,7 @@ #include -__KERNEL_RCSID(0, "$NetBSD: locore.s,v 1.123 2019/04/06 03:06:24 thorpej Exp $"); +__KERNEL_RCSID(0, "$NetBSD: locore.s,v 1.124 2020/01/08 20:59:18 skrll Exp $"); #include "assym.h" @@ -663,8 +663,6 @@ LEAF(savectx, 1) LEAF(cpu_switchto, 0) LDGP(pv) - beq a0, 1f - /* * do an inline savectx(), to save old context */ @@ -679,7 +677,6 @@ LEAF(cpu_switchto, 0) stq s6, PCB_CONTEXT+(6 * 8)(a2) stq ra, PCB_CONTEXT+(7 * 8)(a2) /* store ra */ -1: mov a0, s4/* save old curlwp */ mov a1, s2/* save new lwp */ ldq a0, L_MD_PCBPADDR(s2) /* save new pcbpaddr */ Index: src/sys/arch/amd64/amd64/locore.S diff -u src/sys/arch/amd64/amd64/locore.S:1.196 src/sys/arch/amd64/amd64/locore.S:1.197 --- src/sys/arch/amd64/amd64/locore.S:1.196 Wed Jan 8 17:38:41 2020 +++ src/sys/arch/amd64/amd64/locore.S Wed Jan 8 20:59:18 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: locore.S,v 1.196 2020/01/08 17:38:41 ad Exp $ */ +/* $NetBSD: locore.S,v 1.197 2020/01/08 20:59:18 skrll Exp $ */ /* * Copyright-o-rama! @@ -1819,8 +1819,8 @@ END(dumpsys) * struct lwp *cpu_switchto(struct lwp *oldlwp, struct lwp *newlwp, * bool returning) * - * 1. if (oldlwp != NULL), save its context. - * 2. then, restore context of newlwp. + * 1. save context of oldlwp. + * 2. restore context of newlwp. * * Note that the stack frame layout is known to "struct switchframe" in * and to the code in cpu_lwp_fork() which initializes Index: src/sys/arch/arm/arm32/cpuswitch.S diff -u src/sys/arch/arm/arm32/cpuswitch.S:1.96 src/sys/arch/arm/arm32/cpuswitch.S:1.97 --- src/sys/arch/arm/arm32/cpuswitch.S:1.96 Wed Jan 8 17:38:41 2020 +++ sr
CVS commit: src/distrib/utils/embedded/conf
Module Name:src Committed By: skrll Date: Wed Jan 8 20:49:22 UTC 2020 Modified Files: src/distrib/utils/embedded/conf: rpi_inst.conf Log Message: Use fat16 as the partition is too small for fat32. from Harold Gutch To generate a diff of this commit: cvs rdiff -u -r1.14 -r1.15 src/distrib/utils/embedded/conf/rpi_inst.conf Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/distrib/utils/embedded/conf/rpi_inst.conf diff -u src/distrib/utils/embedded/conf/rpi_inst.conf:1.14 src/distrib/utils/embedded/conf/rpi_inst.conf:1.15 --- src/distrib/utils/embedded/conf/rpi_inst.conf:1.14 Sun Jan 5 16:41:07 2020 +++ src/distrib/utils/embedded/conf/rpi_inst.conf Wed Jan 8 20:49:22 2020 @@ -1,4 +1,4 @@ -# $NetBSD: rpi_inst.conf,v 1.14 2020/01/05 16:41:07 skrll Exp $ +# $NetBSD: rpi_inst.conf,v 1.15 2020/01/08 20:49:22 skrll Exp $ # Raspberry Pi customization script used by mkimage # @@ -16,7 +16,7 @@ boot=112 init=8 size=$(( 10485760 + ${swap} * 1024 * 512 + ${boot} * 1024 * 512 + ${init} * 1024 * 512 )) -msdosid=12 +msdosid=14 make_label() { make_label_evbarm
CVS commit: src/sys/arch/arm/arm32
Module Name:src Committed By: jmcneill Date: Wed Jan 8 18:47:43 UTC 2020 Modified Files: src/sys/arch/arm/arm32: arm32_boot.c cpu.c Log Message: cpu_hatch is too late to report AP topology, do it at attach time instead To generate a diff of this commit: cvs rdiff -u -r1.35 -r1.36 src/sys/arch/arm/arm32/arm32_boot.c cvs rdiff -u -r1.136 -r1.137 src/sys/arch/arm/arm32/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/arm/arm32/arm32_boot.c diff -u src/sys/arch/arm/arm32/arm32_boot.c:1.35 src/sys/arch/arm/arm32/arm32_boot.c:1.36 --- src/sys/arch/arm/arm32/arm32_boot.c:1.35 Fri Dec 20 21:05:33 2019 +++ src/sys/arch/arm/arm32/arm32_boot.c Wed Jan 8 18:47:43 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: arm32_boot.c,v 1.35 2019/12/20 21:05:33 ad Exp $ */ +/* $NetBSD: arm32_boot.c,v 1.36 2020/01/08 18:47:43 jmcneill Exp $ */ /* * Copyright (c) 2002, 2003, 2005 Genetec Corporation. All rights reserved. @@ -122,7 +122,7 @@ */ #include -__KERNEL_RCSID(1, "$NetBSD: arm32_boot.c,v 1.35 2019/12/20 21:05:33 ad Exp $"); +__KERNEL_RCSID(1, "$NetBSD: arm32_boot.c,v 1.36 2020/01/08 18:47:43 jmcneill Exp $"); #include "opt_arm_debug.h" #include "opt_cputypes.h" @@ -357,20 +357,6 @@ cpu_hatch(struct cpu_info *ci, u_int cpu ci->ci_ctrl = armreg_sctlr_read(); uint32_t mpidr = armreg_mpidr_read(); ci->ci_mpidr = mpidr; - if (mpidr & MPIDR_MT) { - cpu_topology_set(ci, - __SHIFTOUT(mpidr, MPIDR_AFF2), - __SHIFTOUT(mpidr, MPIDR_AFF1), - __SHIFTOUT(mpidr, MPIDR_AFF0), - 0); - } else { - cpu_topology_set(ci, - __SHIFTOUT(mpidr, MPIDR_AFF1), - __SHIFTOUT(mpidr, MPIDR_AFF0), - 0, - 0); - } - ci->ci_arm_cpuid = cpu_idnum(); ci->ci_arm_cputype = ci->ci_arm_cpuid & CPU_ID_CPU_MASK; ci->ci_arm_cpurev = ci->ci_arm_cpuid & CPU_ID_REVISION_MASK; Index: src/sys/arch/arm/arm32/cpu.c diff -u src/sys/arch/arm/arm32/cpu.c:1.136 src/sys/arch/arm/arm32/cpu.c:1.137 --- src/sys/arch/arm/arm32/cpu.c:1.136 Fri Dec 20 21:05:33 2019 +++ src/sys/arch/arm/arm32/cpu.c Wed Jan 8 18:47:43 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: cpu.c,v 1.136 2019/12/20 21:05:33 ad Exp $ */ +/* $NetBSD: cpu.c,v 1.137 2020/01/08 18:47:43 jmcneill Exp $ */ /* * Copyright (c) 1995 Mark Brinicombe. @@ -46,7 +46,7 @@ #include "opt_multiprocessor.h" #include -__KERNEL_RCSID(0, "$NetBSD: cpu.c,v 1.136 2019/12/20 21:05:33 ad Exp $"); +__KERNEL_RCSID(0, "$NetBSD: cpu.c,v 1.137 2020/01/08 18:47:43 jmcneill Exp $"); #include #include @@ -109,20 +109,6 @@ cpu_attach(device_t dv, cpuid_t id) #ifdef MULTIPROCESSOR uint32_t mpidr = armreg_mpidr_read(); ci->ci_mpidr = mpidr; - - if (mpidr & MPIDR_MT) { - cpu_topology_set(ci, - __SHIFTOUT(mpidr, MPIDR_AFF2), - __SHIFTOUT(mpidr, MPIDR_AFF1), - __SHIFTOUT(mpidr, MPIDR_AFF0), - 0); - } else { - cpu_topology_set(ci, - __SHIFTOUT(mpidr, MPIDR_AFF1), - __SHIFTOUT(mpidr, MPIDR_AFF0), - 0, - 0); - } #endif } else { #ifdef MULTIPROCESSOR @@ -152,6 +138,20 @@ cpu_attach(device_t dv, cpuid_t id) ci->ci_dev = dv; dv->dv_private = ci; + if (id & MPIDR_MT) { + cpu_topology_set(ci, + __SHIFTOUT(id, MPIDR_AFF2), + __SHIFTOUT(id, MPIDR_AFF1), + __SHIFTOUT(id, MPIDR_AFF0), + 0); + } else { + cpu_topology_set(ci, + __SHIFTOUT(id, MPIDR_AFF1), + __SHIFTOUT(id, MPIDR_AFF0), + 0, + 0); + } + evcnt_attach_dynamic(&ci->ci_arm700bugcount, EVCNT_TYPE_MISC, NULL, xname, "arm700swibug");
CVS commit: src
Module Name:src Committed By: ad Date: Wed Jan 8 17:38:43 UTC 2020 Modified Files: src/sys/arch/aarch64/aarch64: cpuswitch.S genassym.cf src/sys/arch/amd64/amd64: genassym.cf locore.S spl.S src/sys/arch/arm/arm32: cpuswitch.S genassym.cf src/sys/arch/hppa/hppa: genassym.cf src/sys/arch/i386/i386: genassym.cf locore.S spl.S src/sys/arch/mips/mips: genassym.cf locore.S mips_softint.c src/sys/arch/powerpc/powerpc: genassym.cf locore_subr.S softint_machdep.c src/sys/arch/riscv/riscv: genassym.cf locore.S src/sys/arch/sparc64/sparc64: genassym.cf locore.s src/sys/arch/vax/vax: genassym.cf pmap.c subr.S src/sys/ddb: db_proc.c src/sys/kern: init_main.c kern_exec.c kern_exit.c kern_idle.c kern_kthread.c kern_lwp.c kern_resource.c kern_runq.c kern_sleepq.c kern_softint.c kern_synch.c src/sys/rump/librump/rumpkern: lwproc.c scheduler.c src/sys/sys: lwp.h src/tests/rump/rumpkern: t_lwproc.c Log Message: Hopefully fix some problems seen with MP support on non-x86, in particular where curcpu() is defined as curlwp->l_cpu: - mi_switch(): undo the ~2007ish optimisation to unlock curlwp before calling cpu_switchto(). It's not safe to let other actors mess with the LWP (in particular l->l_cpu) while it's still context switching. This removes l->l_ctxswtch. - Move the LP_RUNNING flag into l->l_flag and rename to LW_RUNNING since it's now covered by the LWP's lock. - Ditch lwp_exit_switchaway() and just call mi_switch() instead. Everything is in cache anyway so it wasn't buying much by trying to avoid saving old state. This means cpu_switchto() will never be called with prevlwp == NULL. - Remove some KERNEL_LOCK handling which hasn't been needed for years. To generate a diff of this commit: cvs rdiff -u -r1.13 -r1.14 src/sys/arch/aarch64/aarch64/cpuswitch.S cvs rdiff -u -r1.17 -r1.18 src/sys/arch/aarch64/aarch64/genassym.cf cvs rdiff -u -r1.80 -r1.81 src/sys/arch/amd64/amd64/genassym.cf cvs rdiff -u -r1.195 -r1.196 src/sys/arch/amd64/amd64/locore.S cvs rdiff -u -r1.42 -r1.43 src/sys/arch/amd64/amd64/spl.S cvs rdiff -u -r1.95 -r1.96 src/sys/arch/arm/arm32/cpuswitch.S cvs rdiff -u -r1.82 -r1.83 src/sys/arch/arm/arm32/genassym.cf cvs rdiff -u -r1.1 -r1.2 src/sys/arch/hppa/hppa/genassym.cf cvs rdiff -u -r1.117 -r1.118 src/sys/arch/i386/i386/genassym.cf cvs rdiff -u -r1.174 -r1.175 src/sys/arch/i386/i386/locore.S cvs rdiff -u -r1.49 -r1.50 src/sys/arch/i386/i386/spl.S cvs rdiff -u -r1.67 -r1.68 src/sys/arch/mips/mips/genassym.cf cvs rdiff -u -r1.220 -r1.221 src/sys/arch/mips/mips/locore.S cvs rdiff -u -r1.7 -r1.8 src/sys/arch/mips/mips/mips_softint.c cvs rdiff -u -r1.11 -r1.12 src/sys/arch/powerpc/powerpc/genassym.cf cvs rdiff -u -r1.57 -r1.58 src/sys/arch/powerpc/powerpc/locore_subr.S cvs rdiff -u -r1.3 -r1.4 src/sys/arch/powerpc/powerpc/softint_machdep.c cvs rdiff -u -r1.6 -r1.7 src/sys/arch/riscv/riscv/genassym.cf cvs rdiff -u -r1.9 -r1.10 src/sys/arch/riscv/riscv/locore.S cvs rdiff -u -r1.82 -r1.83 src/sys/arch/sparc64/sparc64/genassym.cf cvs rdiff -u -r1.421 -r1.422 src/sys/arch/sparc64/sparc64/locore.s cvs rdiff -u -r1.53 -r1.54 src/sys/arch/vax/vax/genassym.cf cvs rdiff -u -r1.187 -r1.188 src/sys/arch/vax/vax/pmap.c cvs rdiff -u -r1.36 -r1.37 src/sys/arch/vax/vax/subr.S cvs rdiff -u -r1.8 -r1.9 src/sys/ddb/db_proc.c cvs rdiff -u -r1.517 -r1.518 src/sys/kern/init_main.c cvs rdiff -u -r1.485 -r1.486 src/sys/kern/kern_exec.c cvs rdiff -u -r1.278 -r1.279 src/sys/kern/kern_exit.c cvs rdiff -u -r1.29 -r1.30 src/sys/kern/kern_idle.c cvs rdiff -u -r1.44 -r1.45 src/sys/kern/kern_kthread.c cvs rdiff -u -r1.217 -r1.218 src/sys/kern/kern_lwp.c cvs rdiff -u -r1.183 -r1.184 src/sys/kern/kern_resource.c cvs rdiff -u -r1.55 -r1.56 src/sys/kern/kern_runq.c cvs rdiff -u -r1.56 -r1.57 src/sys/kern/kern_sleepq.c \ src/sys/kern/kern_softint.c cvs rdiff -u -r1.334 -r1.335 src/sys/kern/kern_synch.c cvs rdiff -u -r1.42 -r1.43 src/sys/rump/librump/rumpkern/lwproc.c cvs rdiff -u -r1.48 -r1.49 src/sys/rump/librump/rumpkern/scheduler.c cvs rdiff -u -r1.192 -r1.193 src/sys/sys/lwp.h cvs rdiff -u -r1.9 -r1.10 src/tests/rump/rumpkern/t_lwproc.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/cpuswitch.S diff -u src/sys/arch/aarch64/aarch64/cpuswitch.S:1.13 src/sys/arch/aarch64/aarch64/cpuswitch.S:1.14 --- src/sys/arch/aarch64/aarch64/cpuswitch.S:1.13 Fri Dec 20 07:16:43 2019 +++ src/sys/arch/aarch64/aarch64/cpuswitch.S Wed Jan 8 17:38:41 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: cpuswitch.S,v 1.13 2019/12/20 07:16:43 ryo Exp $ */ +/* $NetBSD: cpuswitch.S,v 1.14 2020/01/08 17:38:41 ad Exp $ */ /*- * Copyright (c) 2014 The NetBSD Foundation, Inc. @@ -37,7 +37,7 @@ #include "opt_ddb.h" #include "opt_kasan.h" -RCSID("$NetBSD: cpuswitch.S,v
CVS commit: src/tests/lib/libc/sys
Module Name:src Committed By: mgorny Date: Wed Jan 8 17:23:34 UTC 2020 Modified Files: src/tests/lib/libc/sys: t_ptrace_x86_wait.h Log Message: Add tests for reading registers from x86 core dumps To generate a diff of this commit: cvs rdiff -u -r1.17 -r1.18 src/tests/lib/libc/sys/t_ptrace_x86_wait.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/tests/lib/libc/sys/t_ptrace_x86_wait.h diff -u src/tests/lib/libc/sys/t_ptrace_x86_wait.h:1.17 src/tests/lib/libc/sys/t_ptrace_x86_wait.h:1.18 --- src/tests/lib/libc/sys/t_ptrace_x86_wait.h:1.17 Wed Jan 8 17:23:15 2020 +++ src/tests/lib/libc/sys/t_ptrace_x86_wait.h Wed Jan 8 17:23:34 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: t_ptrace_x86_wait.h,v 1.17 2020/01/08 17:23:15 mgorny Exp $ */ +/* $NetBSD: t_ptrace_x86_wait.h,v 1.18 2020/01/08 17:23:34 mgorny Exp $ */ /*- * Copyright (c) 2016, 2017, 2018, 2019 The NetBSD Foundation, Inc. @@ -2225,7 +2225,8 @@ enum x86_test_registers { enum x86_test_regmode { TEST_GETREGS, - TEST_SETREGS + TEST_SETREGS, + TEST_COREDUMP }; static __inline void get_gp32_regs(union x86_test_register out[]) @@ -2687,8 +2688,10 @@ x86_register_test(enum x86_test_regset r #endif struct xstate xst; struct iovec iov; - struct fxsave* fxs; + struct fxsave* fxs = NULL; uint64_t xst_flags = 0; + char core_path[] = "/tmp/core.XX"; + int core_fd; const union x86_test_register expected[] __aligned(32) = { {{ 0x0706050403020100, 0x0F0E0D0C0B0A0908, @@ -2796,6 +2799,7 @@ x86_register_test(enum x86_test_regset r DPRINTF("Before running assembly from child\n"); switch (regmode) { case TEST_GETREGS: + case TEST_COREDUMP: switch (regs) { case GPREGS_32: set_gp32_regs(expected); @@ -2969,40 +2973,7 @@ x86_register_test(enum x86_test_regset r validate_status_stopped(status, sigval); - switch (regset) { - case TEST_GPREGS: - ATF_REQUIRE(regs < FPREGS_MM); - DPRINTF("Call GETREGS for the child process\n"); - SYSCALL_REQUIRE(ptrace(PT_GETREGS, child, &gpr, 0) != -1); - break; - case TEST_XMMREGS: -#if defined(__i386__) - ATF_REQUIRE(regs >= FPREGS_MM && regs < FPREGS_YMM); - DPRINTF("Call GETXMMREGS for the child process\n"); - SYSCALL_REQUIRE(ptrace(PT_GETXMMREGS, child, &xmm, 0) != -1); - fxs = &xmm.fxstate; - break; -#else - /*FALLTHROUGH*/ -#endif - case TEST_FPREGS: -#if defined(__x86_64__) - ATF_REQUIRE(regs >= FPREGS_MM && regs < FPREGS_YMM); - fxs = &fpr.fxstate; -#else - ATF_REQUIRE(regs >= FPREGS_MM && regs < FPREGS_XMM); -#endif - DPRINTF("Call GETFPREGS for the child process\n"); - SYSCALL_REQUIRE(ptrace(PT_GETFPREGS, child, &fpr, 0) != -1); - break; - case TEST_XSTATE: - ATF_REQUIRE(regs >= FPREGS_MM); - iov.iov_base = &xst; - iov.iov_len = sizeof(xst); - - DPRINTF("Call GETXSTATE for the child process\n"); - SYSCALL_REQUIRE(ptrace(PT_GETXSTATE, child, &iov, 0) != -1); - + if (regset == TEST_XSTATE) { switch (regs) { case FPREGS_MM: xst_flags |= XCR0_X87; @@ -3020,21 +2991,117 @@ x86_register_test(enum x86_test_regset r __unreachable(); break; } + } - ATF_REQUIRE((xst.xs_rfbm & xst_flags) == xst_flags); - switch (regmode) { - case TEST_SETREGS: - xst.xs_rfbm = xst_flags; - xst.xs_xstate_bv = xst_flags; + switch (regmode) { + case TEST_GETREGS: + case TEST_SETREGS: + switch (regset) { + case TEST_GPREGS: + ATF_REQUIRE(regs < FPREGS_MM); + DPRINTF("Call GETREGS for the child process\n"); + SYSCALL_REQUIRE(ptrace(PT_GETREGS, child, &gpr, 0) + != -1); break; - case TEST_GETREGS: + case TEST_XMMREGS: +#if defined(__i386__) + ATF_REQUIRE(regs >= FPREGS_MM && regs < FPREGS_YMM); + DPRINTF("Call GETXMMREGS for the child process\n"); + SYSCALL_REQUIRE(ptrace(PT_GETXMMREGS, child, &xmm, 0) + != -1); + fxs = &xmm.fxstate; + break; +#else + /*FALLTHROUGH*/ +#endif + case TEST_FPREGS: +#if defined(__x86_64__) + ATF_REQUIRE(regs >= FPREGS_MM && regs < FPREGS_YMM); + fxs = &fpr.fxstate; +#else + ATF_REQUIRE(regs >= FPREGS_MM && regs < FPREGS_XMM); +#endif + DPRINTF("Call GETFPREGS for the child process\n"); + SYSCALL_REQUIRE(ptrace(PT_GETFPREGS, child, &fpr, 0) + != -1); + break; + case TEST_XSTATE: + ATF_REQUIRE(regs >= FPREGS_MM); + iov.iov_base = &xst; + iov.iov_len = sizeof(xst); + + DPRINTF("Call GETXSTATE for the child process\n"); + SYSCALL_REQUIRE(ptrace(PT_GETXSTATE, child, &iov, 0) + != -1); + + ATF_REQUIRE((xst.xs_rfbm & xst_flags) == xst_flags); + switch (regmode) { + case TEST_SETREGS: +xst.xs_rfbm = xst_flags; +xst.xs_xstate_bv = xst_flags; +break; + case TEST_GETREGS: +ATF_REQUIRE((xst.xs_xstate_bv & xst_flags) +== xst_flags); +break; + case TEST_COREDUMP: +__unreachable(); +break; + } + + fxs = &xst.xs_fxsave; + break; + } + break; + case TEST_COREDUMP: + SYSCALL_REQUIRE((core_fd = mkstemp(core_path
CVS commit: src/tests/lib/libc/sys
Module Name:src Committed By: mgorny Date: Wed Jan 8 17:23:15 UTC 2020 Modified Files: src/tests/lib/libc/sys: t_ptrace_amd64_wait.h t_ptrace_i386_wait.h t_ptrace_x86_wait.h Log Message: Combine x86 register tests into unified test function Reduce the code duplication and improve maintainability of x86 register tests by combining all of them to a single base function. To generate a diff of this commit: cvs rdiff -u -r1.11 -r1.12 src/tests/lib/libc/sys/t_ptrace_amd64_wait.h cvs rdiff -u -r1.9 -r1.10 src/tests/lib/libc/sys/t_ptrace_i386_wait.h cvs rdiff -u -r1.16 -r1.17 src/tests/lib/libc/sys/t_ptrace_x86_wait.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/tests/lib/libc/sys/t_ptrace_amd64_wait.h diff -u src/tests/lib/libc/sys/t_ptrace_amd64_wait.h:1.11 src/tests/lib/libc/sys/t_ptrace_amd64_wait.h:1.12 --- src/tests/lib/libc/sys/t_ptrace_amd64_wait.h:1.11 Tue Jun 4 12:17:05 2019 +++ src/tests/lib/libc/sys/t_ptrace_amd64_wait.h Wed Jan 8 17:23:15 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: t_ptrace_amd64_wait.h,v 1.11 2019/06/04 12:17:05 mgorny Exp $ */ +/* $NetBSD: t_ptrace_amd64_wait.h,v 1.12 2020/01/08 17:23:15 mgorny Exp $ */ /*- * Copyright (c) 2016, 2017, 2018, 2019 The NetBSD Foundation, Inc. @@ -111,415 +111,11 @@ ATF_TC_BODY(x86_64_regs1, tc) TWAIT_REQUIRE_FAILURE(ECHILD, wpid = TWAIT_GENERIC(child, &status, 0)); } -ATF_TC(x86_64_regs_gp_read); -ATF_TC_HEAD(x86_64_regs_gp_read, tc) -{ - atf_tc_set_md_var(tc, "descr", - "Set general-purpose reg values from debugged program and read " - "them via PT_GETREGS, comparing values against expected."); -} - -ATF_TC_BODY(x86_64_regs_gp_read, tc) -{ - const int exitval = 5; - pid_t child, wpid; -#if defined(TWAIT_HAVE_STATUS) - const int sigval = SIGTRAP; - int status; -#endif - struct reg gpr; - - const uint64_t rax = 0x0001020304050607; - const uint64_t rbx = 0x1011121314151617; - const uint64_t rcx = 0x2021222324252627; - const uint64_t rdx = 0x3031323334353637; - const uint64_t rsi = 0x4041424344454647; - const uint64_t rdi = 0x5051525354555657; - const uint64_t rsp = 0x6061626364656667; - const uint64_t rbp = 0x7071727374757677; - - DPRINTF("Before forking process PID=%d\n", getpid()); - SYSCALL_REQUIRE((child = fork()) != -1); - if (child == 0) { - DPRINTF("Before calling PT_TRACE_ME from child %d\n", getpid()); - FORKEE_ASSERT(ptrace(PT_TRACE_ME, 0, NULL, 0) != -1); - - DPRINTF("Before running assembly from child\n"); - - __asm__ __volatile__( - /* rbp & rbp are a bit tricky, we must not clobber them */ - "movq%%rsp, %%r8\n\t" - "movq%%rbp, %%r9\n\t" - "movq%6, %%rsp\n\t" - "movq%7, %%rbp\n\t" - "\n\t" - "int3\n\t" - "\n\t" - "movq%%r8, %%rsp\n\t" - "movq%%r9, %%rbp\n\t" - : - : "a"(rax), "b"(rbx), "c"(rcx), "d"(rdx), "S"(rsi), "D"(rdi), - "i"(rsp), "i"(rbp) - : "%r8", "%r9" - ); - - DPRINTF("Before exiting of the child process\n"); - _exit(exitval); - } - DPRINTF("Parent process PID=%d, child's PID=%d\n", getpid(), child); - - DPRINTF("Before calling %s() for the child\n", TWAIT_FNAME); - TWAIT_REQUIRE_SUCCESS(wpid = TWAIT_GENERIC(child, &status, 0), child); - - validate_status_stopped(status, sigval); - - DPRINTF("Call GETREGS for the child process\n"); - SYSCALL_REQUIRE(ptrace(PT_GETREGS, child, &gpr, 0) != -1); - - ATF_CHECK_EQ((uint64_t)gpr.regs[_REG_RAX], rax); - ATF_CHECK_EQ((uint64_t)gpr.regs[_REG_RBX], rbx); - ATF_CHECK_EQ((uint64_t)gpr.regs[_REG_RCX], rcx); - ATF_CHECK_EQ((uint64_t)gpr.regs[_REG_RDX], rdx); - ATF_CHECK_EQ((uint64_t)gpr.regs[_REG_RSI], rsi); - ATF_CHECK_EQ((uint64_t)gpr.regs[_REG_RDI], rdi); - ATF_CHECK_EQ((uint64_t)gpr.regs[_REG_RSP], rsp); - ATF_CHECK_EQ((uint64_t)gpr.regs[_REG_RBP], rbp); - - DPRINTF("Before resuming the child process where it left off and " - "without signal to be sent\n"); - SYSCALL_REQUIRE(ptrace(PT_CONTINUE, child, (void *)1, 0) != -1); - - DPRINTF("Before calling %s() for the child\n", TWAIT_FNAME); - TWAIT_REQUIRE_SUCCESS(wpid = TWAIT_GENERIC(child, &status, 0), child); - - validate_status_exited(status, exitval); - - DPRINTF("Before calling %s() for the child\n", TWAIT_FNAME); - TWAIT_REQUIRE_FAILURE(ECHILD, wpid = TWAIT_GENERIC(child, &status, 0)); -} - -ATF_TC(x86_64_regs_gp_write); -ATF_TC_HEAD(x86_64_regs_gp_write, tc) -{ - atf_tc_set_md_var(tc, "descr", - "Set general-purpose reg values into a debugged program via " - "PT_SETREGS and compare the result against expected."); -} - -ATF_TC_BODY(x86_64_regs_gp_write, tc) -{ - const int exitval = 5; - pid_t child, wpid; -#if defined(TWAIT_HAVE_STATUS) - const int sigval = SIGTRAP; - int status; -#endif - struct reg gpr; - - const uint64_t rax = 0x0001020304050607; - const uint64_t rbx = 0x1011121314151617; - const uint64_t rcx = 0x2021222324252627; - const uint64_t rdx = 0x3031323334353637; - const uint64_t rsi = 0x4041424344454647; - const uint64_
CVS commit: src/tests/lib/libc/sys
Module Name:src Committed By: mgorny Date: Wed Jan 8 17:22:40 UTC 2020 Modified Files: src/tests/lib/libc/sys: t_ptrace_wait.c Log Message: Fix alignment when reading core notes Both desc and note header needs to be aligned. Therefore, we need to realign after skipping past desc as well. While at it, fix the other alignment fix to use roundup() macro. To generate a diff of this commit: cvs rdiff -u -r1.145 -r1.146 src/tests/lib/libc/sys/t_ptrace_wait.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/tests/lib/libc/sys/t_ptrace_wait.c diff -u src/tests/lib/libc/sys/t_ptrace_wait.c:1.145 src/tests/lib/libc/sys/t_ptrace_wait.c:1.146 --- src/tests/lib/libc/sys/t_ptrace_wait.c:1.145 Wed Dec 25 02:23:37 2019 +++ src/tests/lib/libc/sys/t_ptrace_wait.c Wed Jan 8 17:22:40 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: t_ptrace_wait.c,v 1.145 2019/12/25 02:23:37 kamil Exp $ */ +/* $NetBSD: t_ptrace_wait.c,v 1.146 2020/01/08 17:22:40 mgorny Exp $ */ /*- * Copyright (c) 2016, 2017, 2018, 2019 The NetBSD Foundation, Inc. @@ -27,7 +27,7 @@ */ #include -__RCSID("$NetBSD: t_ptrace_wait.c,v 1.145 2019/12/25 02:23:37 kamil Exp $"); +__RCSID("$NetBSD: t_ptrace_wait.c,v 1.146 2020/01/08 17:22:40 mgorny Exp $"); #define __LEGACY_PT_LWPINFO @@ -7837,8 +7837,7 @@ static ssize_t core_find_note(const char offset += note_hdr.n_namesz; /* fix to alignment */ - offset = ((offset + core_hdr.p_align - 1) - / core_hdr.p_align) * core_hdr.p_align; + offset = roundup(offset, core_hdr.p_align); /* if name & type matched above */ if (ret != -1) { @@ -7850,6 +7849,8 @@ static ssize_t core_find_note(const char } offset += note_hdr.n_descsz; + /* fix to alignment */ + offset = roundup(offset, core_hdr.p_align); } }
CVS commit: src/sys
Module Name:src Committed By: mgorny Date: Wed Jan 8 17:21:38 UTC 2020 Modified Files: src/sys/arch/amd64/include: ptrace.h src/sys/arch/i386/include: ptrace.h src/sys/kern: core_elf32.c Log Message: Include XSTATE note in x86 core dumps Introduce a simple COREDUMP_MACHDEP_LWP_NOTES logic to provide machdep API for injecting per-LWP notes into coredumps, and use it to append PT_GETXSTATE note. Since the XSTATE block uses the same format on i386 and amd64, the code does not have to conditionalize between 32-bit and 64-bit ELF format on that. However, it does need to distinguish between 32-bit and 64-bit PT_* values. In order to do that, it reuses PT32_* constant already present for ptrace(), and adds a matching PT64_GETXSTATE to satisfy the cpp logic. To generate a diff of this commit: cvs rdiff -u -r1.20 -r1.21 src/sys/arch/amd64/include/ptrace.h cvs rdiff -u -r1.23 -r1.24 src/sys/arch/i386/include/ptrace.h cvs rdiff -u -r1.61 -r1.62 src/sys/kern/core_elf32.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/amd64/include/ptrace.h diff -u src/sys/arch/amd64/include/ptrace.h:1.20 src/sys/arch/amd64/include/ptrace.h:1.21 --- src/sys/arch/amd64/include/ptrace.h:1.20 Mon Dec 2 19:17:27 2019 +++ src/sys/arch/amd64/include/ptrace.h Wed Jan 8 17:21:38 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: ptrace.h,v 1.20 2019/12/02 19:17:27 kamil Exp $ */ +/* $NetBSD: ptrace.h,v 1.21 2020/01/08 17:21:38 mgorny Exp $ */ /* * Copyright (c) 1993 Christopher G. Demetriou @@ -105,6 +105,22 @@ int process_machdep_validfpu(struct proc MODULE_HOOK(netbsd32_process_doxmmregs_hook, int, (struct lwp *, struct lwp *, void *, bool)); +#ifdef EXEC_ELF32 +#include +#endif +#define PT64_GETXSTATE PT_GETXSTATE +#define COREDUMP_MACHDEP_LWP_NOTES(l, ns, name)\ +{ \ + struct xstate xstate; \ + memset(&xstate, 0, sizeof(xstate));\ + if (!process_read_xstate(l, &xstate))\ + {\ + ELFNAMEEND(coredump_savenote)(ns, \ + CONCAT(CONCAT(PT, ELFSIZE), _GETXSTATE), name, \ + &xstate, sizeof(xstate));\ + }\ +} + #endif /* _KERNEL */ #ifdef _KERNEL_OPT Index: src/sys/arch/i386/include/ptrace.h diff -u src/sys/arch/i386/include/ptrace.h:1.23 src/sys/arch/i386/include/ptrace.h:1.24 --- src/sys/arch/i386/include/ptrace.h:1.23 Wed Jun 26 12:30:12 2019 +++ src/sys/arch/i386/include/ptrace.h Wed Jan 8 17:21:38 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: ptrace.h,v 1.23 2019/06/26 12:30:12 mgorny Exp $ */ +/* $NetBSD: ptrace.h,v 1.24 2020/01/08 17:21:38 mgorny Exp $ */ /* * Copyright (c) 2001 Wasabi Systems, Inc. @@ -159,6 +159,18 @@ { DT_REG, N("xmmregs"), Pmachdep_xmmregs, \ procfs_machdep_validxmmregs }, +#define COREDUMP_MACHDEP_LWP_NOTES(l, ns, name)\ +{ \ + struct xstate xstate; \ + memset(&xstate, 0, sizeof(xstate));\ + if (!process_read_xstate(l, &xstate))\ + {\ + ELFNAMEEND(coredump_savenote)(ns, \ + CONCAT(CONCAT(PT, ELFSIZE), _GETXSTATE), name, \ + &xstate, sizeof(xstate));\ + }\ +} + struct xmmregs; /* Functions used by both ptrace(2) and procfs. */ Index: src/sys/kern/core_elf32.c diff -u src/sys/kern/core_elf32.c:1.61 src/sys/kern/core_elf32.c:1.62 --- src/sys/kern/core_elf32.c:1.61 Tue Dec 24 14:50:59 2019 +++ src/sys/kern/core_elf32.c Wed Jan 8 17:21:38 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: core_elf32.c,v 1.61 2019/12/24 14:50:59 kamil Exp $ */ +/* $NetBSD: core_elf32.c,v 1.62 2020/01/08 17:21:38 mgorny Exp $ */ /* * Copyright (c) 2001 Wasabi Systems, Inc. @@ -40,7 +40,7 @@ */ #include -__KERNEL_RCSID(1, "$NetBSD: core_elf32.c,v 1.61 2019/12/24 14:50:59 kamil Exp $"); +__KERNEL_RCSID(1, "$NetBSD: core_elf32.c,v 1.62 2020/01/08 17:21:38 mgorny Exp $"); #ifdef _KERNEL_OPT #include "opt_compat_netbsd32.h" @@ -513,7 +513,11 @@ ELFNAMEEND(coredump_note)(struct lwp *l, ELFNAMEEND(coredump_savenote)(ns, PT_GETFPREGS, name, &freg, freglen); #endif - /* XXX Add hook for machdep per-LWP notes. */ + +#ifdef COREDUMP_MACHDEP_LWP_NOTES + COREDUMP_MACHDEP_LWP_NOTES(l, ns, name); +#endif + return (0); }
CVS commit: src/sys/kern
Module Name:src Committed By: ad Date: Wed Jan 8 16:21:34 UTC 2020 Modified Files: src/sys/kern: subr_lockdebug.c Log Message: lockdebug_barrier(): allow the one permitted lock to be a sleep lock too. To generate a diff of this commit: cvs rdiff -u -r1.72 -r1.73 src/sys/kern/subr_lockdebug.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_lockdebug.c diff -u src/sys/kern/subr_lockdebug.c:1.72 src/sys/kern/subr_lockdebug.c:1.73 --- src/sys/kern/subr_lockdebug.c:1.72 Tue May 28 07:39:16 2019 +++ src/sys/kern/subr_lockdebug.c Wed Jan 8 16:21:34 2020 @@ -1,7 +1,7 @@ -/* $NetBSD: subr_lockdebug.c,v 1.72 2019/05/28 07:39:16 ryo Exp $ */ +/* $NetBSD: subr_lockdebug.c,v 1.73 2020/01/08 16:21:34 ad Exp $ */ /*- - * Copyright (c) 2006, 2007, 2008 The NetBSD Foundation, Inc. + * Copyright (c) 2006, 2007, 2008, 2020 The NetBSD Foundation, Inc. * All rights reserved. * * This code is derived from software contributed to The NetBSD Foundation @@ -34,7 +34,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: subr_lockdebug.c,v 1.72 2019/05/28 07:39:16 ryo Exp $"); +__KERNEL_RCSID(0, "$NetBSD: subr_lockdebug.c,v 1.73 2020/01/08 16:21:34 ad Exp $"); #ifdef _KERNEL_OPT #include "opt_ddb.h" @@ -647,11 +647,11 @@ lockdebug_wakeup(const char *func, size_ /* * lockdebug_barrier: * - * Panic if we hold more than one specified spin lock, and optionally, - * if we hold sleep locks. + * Panic if we hold more than one specified lock, and optionally, if we + * hold any sleep locks. */ void -lockdebug_barrier(const char *func, size_t line, volatile void *spinlock, +lockdebug_barrier(const char *func, size_t line, volatile void *onelock, int slplocks) { struct lwp *l = curlwp; @@ -664,7 +664,7 @@ lockdebug_barrier(const char *func, size s = splhigh(); if ((l->l_pflag & LP_INTR) == 0) { TAILQ_FOREACH(ld, &curcpu()->ci_data.cpu_ld_locks, ld_chain) { - if (ld->ld_lock == spinlock) { + if (ld->ld_lock == onelock) { continue; } __cpu_simple_lock(&ld->ld_spinlock); @@ -678,7 +678,7 @@ lockdebug_barrier(const char *func, size return; } ld = TAILQ_FIRST(&l->l_ld_locks); - if (__predict_false(ld != NULL)) { + if (__predict_false(ld != NULL && ld->ld_lock != onelock)) { __cpu_simple_lock(&ld->ld_spinlock); lockdebug_abort1(func, line, ld, s, "sleep lock held", true); return; @@ -686,6 +686,9 @@ lockdebug_barrier(const char *func, size splx(s); if (l->l_shlocks != 0) { TAILQ_FOREACH(ld, &ld_all, ld_achain) { + if (ld->ld_lock == onelock) { +continue; + } if (ld->ld_lockops->lo_type == LOCKOPS_CV) continue; if (ld->ld_lwp == l)
CVS commit: src/sys/arch/x86/x86
Module Name:src Committed By: ad Date: Wed Jan 8 15:47:50 UTC 2020 Modified Files: src/sys/arch/x86/x86: cpu.c Log Message: Make "mach cpu" in ddb show the IPL for each cpu. To generate a diff of this commit: cvs rdiff -u -r1.179 -r1.180 src/sys/arch/x86/x86/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/x86/x86/cpu.c diff -u src/sys/arch/x86/x86/cpu.c:1.179 src/sys/arch/x86/x86/cpu.c:1.180 --- src/sys/arch/x86/x86/cpu.c:1.179 Fri Dec 20 21:05:34 2019 +++ src/sys/arch/x86/x86/cpu.c Wed Jan 8 15:47:50 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: cpu.c,v 1.179 2019/12/20 21:05:34 ad Exp $ */ +/* $NetBSD: cpu.c,v 1.180 2020/01/08 15:47:50 ad Exp $ */ /* * Copyright (c) 2000-2012 NetBSD Foundation, Inc. @@ -62,7 +62,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: cpu.c,v 1.179 2019/12/20 21:05:34 ad Exp $"); +__KERNEL_RCSID(0, "$NetBSD: cpu.c,v 1.180 2020/01/08 15:47:50 ad Exp $"); #include "opt_ddb.h" #include "opt_mpbios.h" /* for MPDEBUG */ @@ -1014,14 +1014,14 @@ cpu_debug_dump(void) #endif ""; - db_printf("addr %sdev id flags ipis curlwp " + db_printf("addr %sdev id flags ipis spl curlwp " "\n", sixtyfour64space); for (CPU_INFO_FOREACH(cii, ci)) { - db_printf("%p %s %ld %x %x %10p\n", + db_printf("%p %s %ld %x %x %d %10p\n", ci, ci->ci_dev == NULL ? "BOOT" : device_xname(ci->ci_dev), (long)ci->ci_cpuid, - ci->ci_flags, ci->ci_ipis, + ci->ci_flags, ci->ci_ipis, ci->ci_ilevel, ci->ci_curlwp); } }
CVS commit: src/sys/arch/macppc/conf
Module Name:src Committed By: macallan Date: Wed Jan 8 14:21:12 UTC 2020 Modified Files: src/sys/arch/macppc/conf: GENERIC Log Message: add lmtemp, found in some late powerbooks To generate a diff of this commit: cvs rdiff -u -r1.358 -r1.359 src/sys/arch/macppc/conf/GENERIC 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/macppc/conf/GENERIC diff -u src/sys/arch/macppc/conf/GENERIC:1.358 src/sys/arch/macppc/conf/GENERIC:1.359 --- src/sys/arch/macppc/conf/GENERIC:1.358 Fri Nov 1 17:55:12 2019 +++ src/sys/arch/macppc/conf/GENERIC Wed Jan 8 14:21:12 2020 @@ -1,4 +1,4 @@ -# $NetBSD: GENERIC,v 1.358 2019/11/01 17:55:12 macallan Exp $ +# $NetBSD: GENERIC,v 1.359 2020/01/08 14:21:12 macallan Exp $ # # GENERIC machine description file # @@ -22,7 +22,7 @@ include "arch/macppc/conf/std.macppc" options INCLUDE_CONFIG_FILE # embed config file in kernel binary -#ident "GENERIC-$Revision: 1.358 $" +#ident "GENERIC-$Revision: 1.359 $" maxusers 32 @@ -371,6 +371,7 @@ iic* at ki2c? # I2C devices dbcool* at iic? # dbCool thermal monitor & fan control +lmtemp* at iic? # temperature sensor, found in PowerBook5,6 deq* at iic? # mixer/equalizer, used by snapper admtemp* at iic? # temperature sensor found in Mini, G5 psoc* at iic? # fan controller found in TiBooks
CVS commit: src/sys/sys
Module Name:src Committed By: ad Date: Wed Jan 8 14:04:06 UTC 2020 Modified Files: src/sys/sys: param.h Log Message: NetBSD 9.99.35 - namecache changes To generate a diff of this commit: cvs rdiff -u -r1.635 -r1.636 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.635 src/sys/sys/param.h:1.636 --- src/sys/sys/param.h:1.635 Sun Jan 5 20:52:15 2020 +++ src/sys/sys/param.h Wed Jan 8 14:04:06 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: param.h,v 1.635 2020/01/05 20:52:15 ad Exp $ */ +/* $NetBSD: param.h,v 1.636 2020/01/08 14:04:06 ad Exp $ */ /*- * Copyright (c) 1982, 1986, 1989, 1993 @@ -67,7 +67,7 @@ * 2.99.9 (299000900) */ -#define __NetBSD_Version__ 999003400 /* NetBSD 9.99.34 */ +#define __NetBSD_Version__ 999003500 /* NetBSD 9.99.35 */ #define __NetBSD_Prereq__(M,m,p) (M) * 1) + \ (m) * 100) + (p) * 100) <= __NetBSD_Version__)
CVS commit: src/external/bsd/tmux/dist
Module Name:src Committed By: joerg Date: Wed Jan 8 13:45:22 UTC 2020 Modified Files: src/external/bsd/tmux/dist: tmux.h Log Message: Format string annotation for cmdq_insert_hook. To generate a diff of this commit: cvs rdiff -u -r1.14 -r1.15 src/external/bsd/tmux/dist/tmux.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/tmux/dist/tmux.h diff -u src/external/bsd/tmux/dist/tmux.h:1.14 src/external/bsd/tmux/dist/tmux.h:1.15 --- src/external/bsd/tmux/dist/tmux.h:1.14 Mon Jan 6 21:03:23 2020 +++ src/external/bsd/tmux/dist/tmux.h Wed Jan 8 13:45:21 2020 @@ -2051,7 +2051,7 @@ struct cmdq_item *cmdq_get_callback1(con struct cmdq_item *cmdq_get_error(const char *); void cmdq_insert_after(struct cmdq_item *, struct cmdq_item *); void cmdq_append(struct client *, struct cmdq_item *); -void cmdq_insert_hook(struct session *, struct cmdq_item *, +void printflike(4, 5) cmdq_insert_hook(struct session *, struct cmdq_item *, struct cmd_find_state *, const char *, ...); void cmdq_continue(struct cmdq_item *); void printflike(3, 4) cmdq_format(struct cmdq_item *, const char *,
CVS commit: src/sys/dev/audio
Module Name:src Committed By: isaki Date: Wed Jan 8 13:30:16 UTC 2020 Modified Files: src/sys/dev/audio: audio.c Log Message: Fix an resource leak on audiobell close. audioclose() freed audio_file_t structure, but only audiobellclose didn't pass there. I change that all of freeing audio_file_t is done by each *_close(). To generate a diff of this commit: cvs rdiff -u -r1.38 -r1.39 src/sys/dev/audio/audio.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/audio/audio.c diff -u src/sys/dev/audio/audio.c:1.38 src/sys/dev/audio/audio.c:1.39 --- src/sys/dev/audio/audio.c:1.38 Wed Jan 8 13:05:02 2020 +++ src/sys/dev/audio/audio.c Wed Jan 8 13:30:15 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: audio.c,v 1.38 2020/01/08 13:05:02 isaki Exp $ */ +/* $NetBSD: audio.c,v 1.39 2020/01/08 13:30:15 isaki Exp $ */ /*- * Copyright (c) 2008 The NetBSD Foundation, Inc. @@ -142,7 +142,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: audio.c,v 1.38 2020/01/08 13:05:02 isaki Exp $"); +__KERNEL_RCSID(0, "$NetBSD: audio.c,v 1.39 2020/01/08 13:30:15 isaki Exp $"); #ifdef _KERNEL_OPT #include "audio.h" @@ -530,6 +530,7 @@ static int audio_mmap(struct audio_softc struct uvm_object **, int *, audio_file_t *); static int audioctl_open(dev_t, struct audio_softc *, int, int, struct lwp *); +static int audioctl_close(struct audio_softc *, audio_file_t *); static void audio_pintr(void *); static void audio_rintr(void *); @@ -1521,7 +1522,7 @@ audioclose(struct file *fp) error = audio_close(sc, file); break; case AUDIOCTL_DEVICE: - error = 0; + error = audioctl_close(sc, file); break; case MIXER_DEVICE: error = mixer_close(sc, file); @@ -1530,10 +1531,8 @@ audioclose(struct file *fp) error = ENXIO; break; } - if (error == 0) { - kmem_free(fp->f_audioctx, sizeof(audio_file_t)); - fp->f_audioctx = NULL; - } + /* f_audioctx has already been freed in lower *_close() */ + fp->f_audioctx = NULL; return error; } @@ -2196,6 +2195,8 @@ audio_close(struct audio_softc *sc, audi TRACE(3, "done"); audio_exit_exclusive(sc); + + kmem_free(file, sizeof(*file)); return 0; } @@ -3055,6 +3056,14 @@ audioctl_open(dev_t dev, struct audio_so return error; } +static int +audioctl_close(struct audio_softc *sc, audio_file_t *file) +{ + + kmem_free(file, sizeof(*file)); + return 0; +} + /* * Free 'mem' if available, and initialize the pointer. * For this reason, this is implemented as macro. @@ -7655,6 +7664,7 @@ mixer_close(struct audio_softc *sc, audi mixer_remove(sc); mutex_exit(sc->sc_lock); + kmem_free(file, sizeof(*file)); return 0; }
CVS commit: src/sys/arch/macppc/conf
Module Name:src Committed By: macallan Date: Wed Jan 8 13:28:14 UTC 2020 Modified Files: src/sys/arch/macppc/conf: INSTALL Log Message: add makphy, found in late(ish) PowerBooks To generate a diff of this commit: cvs rdiff -u -r1.129 -r1.130 src/sys/arch/macppc/conf/INSTALL 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/macppc/conf/INSTALL diff -u src/sys/arch/macppc/conf/INSTALL:1.129 src/sys/arch/macppc/conf/INSTALL:1.130 --- src/sys/arch/macppc/conf/INSTALL:1.129 Mon Jan 7 01:44:59 2019 +++ src/sys/arch/macppc/conf/INSTALL Wed Jan 8 13:28:14 2020 @@ -1,4 +1,4 @@ -# $NetBSD: INSTALL,v 1.129 2019/01/07 01:44:59 scole Exp $ +# $NetBSD: INSTALL,v 1.130 2020/01/08 13:28:14 macallan Exp $ # # config file for INSTALL FLOPPY # @@ -123,6 +123,7 @@ icsphy* at mii? phy ? # Integrated Cir inphy* at mii? phy ? # Intel 82555 PHYs iophy* at mii? phy ? # Intel 82553 PHYs lxtphy* at mii? phy ? # Level One LXT-970 PHYs +makphy* at mii? phy ? # Marvell Semiconductor 88E1000 PHYs nsphy* at mii? phy ? # NS83840 PHYs nsphyter* at mii? phy ? # NS83843 PHYs qsphy* at mii? phy ? # Quality Semiconductor QS6612 PHYs
CVS commit: src/sys/dev/audio
Module Name:src Committed By: isaki Date: Wed Jan 8 13:05:02 UTC 2020 Modified Files: src/sys/dev/audio: audio.c Log Message: Remove obsoleted comment. To generate a diff of this commit: cvs rdiff -u -r1.37 -r1.38 src/sys/dev/audio/audio.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/audio/audio.c diff -u src/sys/dev/audio/audio.c:1.37 src/sys/dev/audio/audio.c:1.38 --- src/sys/dev/audio/audio.c:1.37 Wed Jan 8 08:10:15 2020 +++ src/sys/dev/audio/audio.c Wed Jan 8 13:05:02 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: audio.c,v 1.37 2020/01/08 08:10:15 isaki Exp $ */ +/* $NetBSD: audio.c,v 1.38 2020/01/08 13:05:02 isaki Exp $ */ /*- * Copyright (c) 2008 The NetBSD Foundation, Inc. @@ -142,7 +142,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: audio.c,v 1.37 2020/01/08 08:10:15 isaki Exp $"); +__KERNEL_RCSID(0, "$NetBSD: audio.c,v 1.38 2020/01/08 13:05:02 isaki Exp $"); #ifdef _KERNEL_OPT #include "audio.h" @@ -1798,11 +1798,6 @@ audiobellclose(audio_file_t *file) device_active(sc->sc_dev, DVA_SYSTEM); error = audio_close(sc, file); - /* - * Since file has already been destructed, - * audio_file_release() is not necessary. - */ - return error; }
CVS commit: src/sys
Module Name:src Committed By: ad Date: Wed Jan 8 12:06:10 UTC 2020 Modified Files: src/sys/rump/include/rump: rump_namei.h src/sys/sys: namei.h Log Message: Regen. To generate a diff of this commit: cvs rdiff -u -r1.37 -r1.38 src/sys/rump/include/rump/rump_namei.h cvs rdiff -u -r1.103 -r1.104 src/sys/sys/namei.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/rump/include/rump/rump_namei.h diff -u src/sys/rump/include/rump/rump_namei.h:1.37 src/sys/rump/include/rump/rump_namei.h:1.38 --- src/sys/rump/include/rump/rump_namei.h:1.37 Mon Jan 6 11:23:31 2020 +++ src/sys/rump/include/rump/rump_namei.h Wed Jan 8 12:06:09 2020 @@ -1,11 +1,11 @@ -/* $NetBSD: rump_namei.h,v 1.37 2020/01/06 11:23:31 ad Exp $ */ +/* $NetBSD: rump_namei.h,v 1.38 2020/01/08 12:06:09 ad Exp $ */ /* * WARNING: GENERATED FILE. DO NOT EDIT * (edit namei.src and run make namei in src/sys/sys) * by: NetBSD: gennameih.awk,v 1.5 2009/12/23 14:17:19 pooka Exp - * from: NetBSD: namei.src,v 1.47 2020/01/06 11:22:33 ad Exp + * from: NetBSD: namei.src,v 1.48 2020/01/08 12:04:56 ad Exp */ #ifndef _RUMP_RUMP_NAMEI_H_ Index: src/sys/sys/namei.h diff -u src/sys/sys/namei.h:1.103 src/sys/sys/namei.h:1.104 --- src/sys/sys/namei.h:1.103 Mon Jan 6 11:23:31 2020 +++ src/sys/sys/namei.h Wed Jan 8 12:06:10 2020 @@ -1,11 +1,11 @@ -/* $NetBSD: namei.h,v 1.103 2020/01/06 11:23:31 ad Exp $ */ +/* $NetBSD: namei.h,v 1.104 2020/01/08 12:06:10 ad Exp $ */ /* * WARNING: GENERATED FILE. DO NOT EDIT * (edit namei.src and run make namei in src/sys/sys) * by: NetBSD: gennameih.awk,v 1.5 2009/12/23 14:17:19 pooka Exp - * from: NetBSD: namei.src,v 1.47 2020/01/06 11:22:33 ad Exp + * from: NetBSD: namei.src,v 1.48 2020/01/08 12:04:56 ad Exp */ /* @@ -220,7 +220,7 @@ struct namecache { LIST_ENTRY(namecache) nc_hash; /* L/C hash chain */ TAILQ_ENTRY(namecache) nc_lru; /* L pseudo-lru chain */ LIST_ENTRY(namecache) nc_dvlist;/* L dvp's list of cache entries */ - LIST_ENTRY(namecache) nc_vlist; /* L vp's list of cache entries */ + TAILQ_ENTRY(namecache) nc_vlist;/* L vp's list of cache entries */ struct vnode *nc_dvp; /* N vnode of parent of name */ struct vnode *nc_vp; /* N vnode the name refers to */ void *nc_gcqueue; /* N queue for garbage collection */
CVS commit: src
Module Name:src Committed By: ad Date: Wed Jan 8 12:04:57 UTC 2020 Modified Files: src/sbin/mount_procfs: mount_procfs.8 src/sys/conf: files src/sys/kern: vfs_cache.c vfs_getcwd.c vfs_vnode.c src/sys/sys: namei.src vnode_impl.h Log Message: - options NAMECACHE_ENTER_REVERSE is no more. - Partially sort the list of per-vnode namecache entries by using a TAILQ. Put the real name to the head, and put dot and dotdot to the tail so that cache_lookup_reverse() doesn't have to consider them. To generate a diff of this commit: cvs rdiff -u -r1.37 -r1.38 src/sbin/mount_procfs/mount_procfs.8 cvs rdiff -u -r1.1248 -r1.1249 src/sys/conf/files cvs rdiff -u -r1.126 -r1.127 src/sys/kern/vfs_cache.c cvs rdiff -u -r1.53 -r1.54 src/sys/kern/vfs_getcwd.c cvs rdiff -u -r1.105 -r1.106 src/sys/kern/vfs_vnode.c cvs rdiff -u -r1.47 -r1.48 src/sys/sys/namei.src cvs rdiff -u -r1.19 -r1.20 src/sys/sys/vnode_impl.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sbin/mount_procfs/mount_procfs.8 diff -u src/sbin/mount_procfs/mount_procfs.8:1.37 src/sbin/mount_procfs/mount_procfs.8:1.38 --- src/sbin/mount_procfs/mount_procfs.8:1.37 Mon Aug 28 05:58:08 2017 +++ src/sbin/mount_procfs/mount_procfs.8 Wed Jan 8 12:04:57 2020 @@ -1,4 +1,4 @@ -.\" $NetBSD: mount_procfs.8,v 1.37 2017/08/28 05:58:08 wiz Exp $ +.\" $NetBSD: mount_procfs.8,v 1.38 2020/01/08 12:04:57 ad Exp $ .\" .\" Copyright (c) 1992, 1993 .\" The Regents of the University of California. All rights reserved. @@ -34,7 +34,7 @@ .\" @(#)mount_procfs.8 8.3 (Berkeley) 6/1/94 .\" .\" -.Dd August 28, 2017 +.Dd January 8, 2020 .Dt MOUNT_PROCFS 8 .Os .Sh NAME @@ -111,9 +111,6 @@ A map of the process' virtual memory. .It Pa maps A map of the process' virtual memory in a form like the proc filesystem as implemented in Linux. -Note that the paths corresponding to file backed mappings will -not be present unless the kernel was built with the -NAMECACHE_ENTER_REVERSE option. .It Pa mem The complete virtual memory image of the process. Only those addresses which exist in the process can be accessed. Index: src/sys/conf/files diff -u src/sys/conf/files:1.1248 src/sys/conf/files:1.1249 --- src/sys/conf/files:1.1248 Mon Dec 23 06:45:37 2019 +++ src/sys/conf/files Wed Jan 8 12:04:56 2020 @@ -1,4 +1,4 @@ -# $NetBSD: files,v 1.1248 2019/12/23 06:45:37 maxv Exp $ +# $NetBSD: files,v 1.1249 2020/01/08 12:04:56 ad Exp $ # @(#)files.newconf 7.5 (Berkeley) 5/10/93 version 20171118 @@ -90,8 +90,6 @@ defflag opt_ptm.h NO_DEV_PTM COMPAT_BSD defparam opt_kmempages.h NKMEMPAGES NKMEMPAGES_MIN NKMEMPAGES_MAX -defflag opt_revcache.h NAMECACHE_ENTER_REVERSE - defflag opt_exec.h DEBUG_EXEC defflag opt_execfmt.h EXEC_AOUT EXEC_COFF EXEC_ECOFF EXEC_ELF32 Index: src/sys/kern/vfs_cache.c diff -u src/sys/kern/vfs_cache.c:1.126 src/sys/kern/vfs_cache.c:1.127 --- src/sys/kern/vfs_cache.c:1.126 Mon Jan 6 11:22:33 2020 +++ src/sys/kern/vfs_cache.c Wed Jan 8 12:04:56 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: vfs_cache.c,v 1.126 2020/01/06 11:22:33 ad Exp $ */ +/* $NetBSD: vfs_cache.c,v 1.127 2020/01/08 12:04:56 ad Exp $ */ /*- * Copyright (c) 2008 The NetBSD Foundation, Inc. @@ -58,13 +58,12 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: vfs_cache.c,v 1.126 2020/01/06 11:22:33 ad Exp $"); +__KERNEL_RCSID(0, "$NetBSD: vfs_cache.c,v 1.127 2020/01/08 12:04:56 ad Exp $"); #define __NAMECACHE_PRIVATE #ifdef _KERNEL_OPT #include "opt_ddb.h" #include "opt_dtrace.h" -#include "opt_revcache.h" #endif #include @@ -129,7 +128,7 @@ __KERNEL_RCSID(0, "$NetBSD: vfs_cache.c, * - Invalidate: active--->queued * * Done by cache_invalidate. If not already invalidated, nullify - * ncp->nc_dvp and ncp->nc_vp, and add to cache_gcqueue. Called, + * ncp->nc_dvp and and add to cache_gcqueue. Called, * among various other places, in cache_lookup(dvp, name, namelen, * nameiop, cnflags, &iswht, &vp) when MAKEENTRY is missing from * cnflags. @@ -376,7 +375,6 @@ cache_invalidate(struct namecache *ncp) SDT_PROBE(vfs, namecache, invalidate, done, ncp->nc_dvp, 0, 0, 0, 0); - ncp->nc_vp = NULL; ncp->nc_dvp = NULL; do { head = cache_gcqueue; @@ -401,9 +399,11 @@ cache_disassociate(struct namecache *ncp TAILQ_REMOVE(&nclruhead, ncp, nc_lru); ncp->nc_lru.tqe_prev = NULL; } - if (ncp->nc_vlist.le_prev != NULL) { - LIST_REMOVE(ncp, nc_vlist); - ncp->nc_vlist.le_prev = NULL; + if (ncp->nc_vlist.tqe_prev != NULL) { + KASSERT(ncp->nc_vp != NULL); + TAILQ_REMOVE(&VNODE_TO_VIMPL(ncp->nc_vp)->vi_nclist, ncp, + nc_vlist); + ncp->nc_vlist.tqe_prev = NULL; } if (ncp->nc_dvlist.le_prev != NULL) { LIST_REMOVE(ncp, nc_dvlist); @@ -777,59 +777,61 @@ cache_revlookup(struct vnode *vp, struct */ cpup = curcpu()->ci_data.cpu_nch; mutex_enter(namecache_lock); - LIST_FOREACH(ncp, &VNODE_TO_VIMPL(vp)->
CVS commit: src/usr.bin/vmstat
Module Name:src Committed By: ad Date: Wed Jan 8 11:58:02 UTC 2020 Modified Files: src/usr.bin/vmstat: vmstat.c Log Message: Show reverse misses too. To generate a diff of this commit: cvs rdiff -u -r1.233 -r1.234 src/usr.bin/vmstat/vmstat.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/usr.bin/vmstat/vmstat.c diff -u src/usr.bin/vmstat/vmstat.c:1.233 src/usr.bin/vmstat/vmstat.c:1.234 --- src/usr.bin/vmstat/vmstat.c:1.233 Mon Jan 6 11:24:30 2020 +++ src/usr.bin/vmstat/vmstat.c Wed Jan 8 11:58:02 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: vmstat.c,v 1.233 2020/01/06 11:24:30 ad Exp $ */ +/* $NetBSD: vmstat.c,v 1.234 2020/01/08 11:58:02 ad Exp $ */ /*- * Copyright (c) 1998, 2000, 2001, 2007, 2019 The NetBSD Foundation, Inc. @@ -70,7 +70,7 @@ __COPYRIGHT("@(#) Copyright (c) 1980, 19 #if 0 static char sccsid[] = "@(#)vmstat.c 8.2 (Berkeley) 3/1/95"; #else -__RCSID("$NetBSD: vmstat.c,v 1.233 2020/01/06 11:24:30 ad Exp $"); +__RCSID("$NetBSD: vmstat.c,v 1.234 2020/01/08 11:58:02 ad Exp $"); #endif #endif /* not lint */ @@ -1114,6 +1114,7 @@ dosum(void) (void)printf("%9" PRIu64 " pass2 hits\n", nch_stats.ncs_pass2); (void)printf("%9" PRIu64 " 2passes\n", nch_stats.ncs_2passes); (void)printf("%9" PRIu64 " reverse hits\n", nch_stats.ncs_revhits); + (void)printf("%9" PRIu64 " reverse miss\n", nch_stats.ncs_revmiss); (void)printf( "%9s cache hits (%d%% pos + %d%% neg) system %d%% per-process\n", "", PCT(nch_stats.ncs_goodhits, nchtotal),
CVS commit: [netbsd-9] src/doc
Module Name:src Committed By: martin Date: Wed Jan 8 11:52:25 UTC 2020 Modified Files: src/doc [netbsd-9]: CHANGES-9.0 Log Message: Ticket #610 To generate a diff of this commit: cvs rdiff -u -r1.1.2.156 -r1.1.2.157 src/doc/CHANGES-9.0 Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/doc/CHANGES-9.0 diff -u src/doc/CHANGES-9.0:1.1.2.156 src/doc/CHANGES-9.0:1.1.2.157 --- src/doc/CHANGES-9.0:1.1.2.156 Wed Jan 8 07:58:48 2020 +++ src/doc/CHANGES-9.0 Wed Jan 8 11:52:24 2020 @@ -1,4 +1,4 @@ -# $NetBSD: CHANGES-9.0,v 1.1.2.156 2020/01/08 07:58:48 msaitoh Exp $ +# $NetBSD: CHANGES-9.0,v 1.1.2.157 2020/01/08 11:52:24 martin Exp $ A complete list of changes from the initial NetBSD 9.0 branch on 2019-07-30 until the 9.0 release: @@ -7635,3 +7635,9 @@ distrib/notes/Makefile.inc 1.53 PR install/54836: Fix broken conditional, passing the wrong set name suffix to groff. [martin, ticket #608] + +sys/dev/ic/gem.c1.124 + + Fix error path in gem(4)'s TX checksum offload. + [msaitoh, ticket #610] +
CVS commit: [netbsd-9] src/sys/dev/ic
Module Name:src Committed By: martin Date: Wed Jan 8 11:50:58 UTC 2020 Modified Files: src/sys/dev/ic [netbsd-9]: gem.c Log Message: Pull up following revision(s) (requested by msaitoh in ticket #610): sys/dev/ic/gem.c: revision 1.124 Fix error path in gem(4)'s TX checksum offload. - Avoid accessing free'd m0 on error. Use m_freem() instead of m_free(). Reported by maxv@. - Tested by martin@, macallan@ and jdc@. To generate a diff of this commit: cvs rdiff -u -r1.120 -r1.120.2.1 src/sys/dev/ic/gem.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/ic/gem.c diff -u src/sys/dev/ic/gem.c:1.120 src/sys/dev/ic/gem.c:1.120.2.1 --- src/sys/dev/ic/gem.c:1.120 Tue May 28 08:59:34 2019 +++ src/sys/dev/ic/gem.c Wed Jan 8 11:50:57 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: gem.c,v 1.120 2019/05/28 08:59:34 msaitoh Exp $ */ +/* $NetBSD: gem.c,v 1.120.2.1 2020/01/08 11:50:57 martin Exp $ */ /* * @@ -37,7 +37,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: gem.c,v 1.120 2019/05/28 08:59:34 msaitoh Exp $"); +__KERNEL_RCSID(0, "$NetBSD: gem.c,v 1.120.2.1 2020/01/08 11:50:57 martin Exp $"); #include "opt_inet.h" @@ -1389,6 +1389,7 @@ gem_start(struct ifnet *ifp) * until we drain the queue, or use up all available transmit * descriptors. */ +next: while ((txs = SIMPLEQ_FIRST(&sc->sc_txfreeq)) != NULL && sc->sc_txfree != 0) { /* @@ -1498,16 +1499,9 @@ gem_start(struct ifnet *ifp) * and the checksum stuff if we want the hardware * to do it. */ - sc->sc_txdescs[nexttx].gd_addr = - GEM_DMA_WRITE(sc, dmamap->dm_segs[seg].ds_addr); flags = dmamap->dm_segs[seg].ds_len & GEM_TD_BUFSIZE; if (nexttx == firsttx) { flags |= GEM_TD_START_OF_PACKET; -if (++sc->sc_txwin > GEM_NTXSEGS * 2 / 3) { - sc->sc_txwin = 0; - flags |= GEM_TD_INTERRUPT_ME; -} - #ifdef INET /* h/w checksum */ if (ifp->if_csum_flags_tx & M_CSUM_TCPv4 && @@ -1526,8 +1520,10 @@ gem_start(struct ifnet *ifp) break; default: /* unsupported, drop it */ - m_free(m0); - continue; + bus_dmamap_unload(sc->sc_dmatag, + dmamap); + m_freem(m0); + goto next; } start += M_CSUM_DATA_IPv4_IPHL(m0->m_pkthdr.csum_data); offset = M_CSUM_DATA_IPv4_OFFSET(m0->m_pkthdr.csum_data) + start; @@ -1538,7 +1534,13 @@ gem_start(struct ifnet *ifp) GEM_TD_CXSUM_ENABLE; } #endif +if (++sc->sc_txwin > GEM_NTXSEGS * 2 / 3) { + sc->sc_txwin = 0; + flags |= GEM_TD_INTERRUPT_ME; +} } + sc->sc_txdescs[nexttx].gd_addr = + GEM_DMA_WRITE(sc, dmamap->dm_segs[seg].ds_addr); if (seg == dmamap->dm_nsegs - 1) { flags |= GEM_TD_END_OF_PACKET; } else {
CVS commit: [ad-namecache] src/sys/kern
Module Name:src Committed By: ad Date: Wed Jan 8 11:44:30 UTC 2020 Modified Files: src/sys/kern [ad-namecache]: vfs_cache.c Log Message: cache_enter(): check namelen before touching name. To generate a diff of this commit: cvs rdiff -u -r1.126.2.1 -r1.126.2.2 src/sys/kern/vfs_cache.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_cache.c diff -u src/sys/kern/vfs_cache.c:1.126.2.1 src/sys/kern/vfs_cache.c:1.126.2.2 --- src/sys/kern/vfs_cache.c:1.126.2.1 Wed Jan 8 11:02:16 2020 +++ src/sys/kern/vfs_cache.c Wed Jan 8 11:44:30 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: vfs_cache.c,v 1.126.2.1 2020/01/08 11:02:16 ad Exp $ */ +/* $NetBSD: vfs_cache.c,v 1.126.2.2 2020/01/08 11:44:30 ad Exp $ */ /*- * Copyright (c) 2008, 2019 The NetBSD Foundation, Inc. @@ -149,7 +149,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: vfs_cache.c,v 1.126.2.1 2020/01/08 11:02:16 ad Exp $"); +__KERNEL_RCSID(0, "$NetBSD: vfs_cache.c,v 1.126.2.2 2020/01/08 11:44:30 ad Exp $"); #define __NAMECACHE_PRIVATE #ifdef _KERNEL_OPT @@ -730,8 +730,8 @@ cache_enter(struct vnode *dvp, struct vn ncp->nc_whiteout = false; vi = VNODE_TO_VIMPL(vp); /* Partially sort the per-vnode list: dots go to back. */ - if ((name[0] == '.' && namelen == 1) || - (name[0] == '.' && name[1] == '.' && namelen == 2)) { + if ((namelen == 1 && name[0] == '.') || + (namelen == 2 && name[0] == '.' && name[1] == '.')) { TAILQ_INSERT_TAIL(&vi->vi_nclist, ncp, nc_vlist); } else { TAILQ_INSERT_HEAD(&vi->vi_nclist, ncp, nc_vlist);
CVS commit: src/doc
Module Name:src Committed By: ad Date: Wed Jan 8 11:05:39 UTC 2020 Modified Files: src/doc: BRANCHES Log Message: Add ad-namecache. To generate a diff of this commit: cvs rdiff -u -r1.351 -r1.352 src/doc/BRANCHES Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/doc/BRANCHES diff -u src/doc/BRANCHES:1.351 src/doc/BRANCHES:1.352 --- src/doc/BRANCHES:1.351 Tue Jul 30 15:56:53 2019 +++ src/doc/BRANCHES Wed Jan 8 11:05:39 2020 @@ -1,4 +1,4 @@ -# $NetBSD: BRANCHES,v 1.351 2019/07/30 15:56:53 martin Exp $ +# $NetBSD: BRANCHES,v 1.352 2020/01/08 11:05:39 ad Exp $ # # This file contains a list of branches that exist in the NetBSD CVS # tree and their current state. @@ -381,6 +381,26 @@ Maintainer: Andrew Doran Scope: kernel Notes: Ressurect ad-audiomp, make the audio drivers MP safe. +Branch: ad-namecache +Description: Redo the namecache +Status: Active +Start Date: 8 January 2020 +End Date: +Base Tag: ad-namecache-base +Maintainer: Andrew Doran +Scope: src/sys src/common +Notes: 1) Redo the namecache to focus on per-directory data + structures, removing the huge hashtable and nasty locking + scheme. + + Initially this uses rbtrees (because that's what's there). + The intent is that ultimately some other data structure + will be used. + + 2) Experiment with having namei() traverse the cache and + avoid vnode locks except for the leaf in the totally + in-cache case. + Branch: agc-netpgp-standalone Description: Remove dependency on openssl libraries in netpgp Status: Active
CVS commit: [ad-namecache] src/sys
Module Name:src Committed By: ad Date: Wed Jan 8 11:02:16 UTC 2020 Modified Files: src/sys/kern [ad-namecache]: init_sysctl.c vfs_cache.c vfs_vnode.c src/sys/sys [ad-namecache]: namei.src vnode_impl.h Log Message: Redo the namecache to focus on per-directory data structures, removing the huge hashtable and nasty locking scheme. Initially this uses rbtrees (because that's what's there). The intent is experiment with other data structures. To generate a diff of this commit: cvs rdiff -u -r1.223 -r1.223.2.1 src/sys/kern/init_sysctl.c cvs rdiff -u -r1.126 -r1.126.2.1 src/sys/kern/vfs_cache.c cvs rdiff -u -r1.105 -r1.105.2.1 src/sys/kern/vfs_vnode.c cvs rdiff -u -r1.47 -r1.47.2.1 src/sys/sys/namei.src cvs rdiff -u -r1.19 -r1.19.2.1 src/sys/sys/vnode_impl.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/init_sysctl.c diff -u src/sys/kern/init_sysctl.c:1.223 src/sys/kern/init_sysctl.c:1.223.2.1 --- src/sys/kern/init_sysctl.c:1.223 Thu Jan 2 15:42:27 2020 +++ src/sys/kern/init_sysctl.c Wed Jan 8 11:02:16 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: init_sysctl.c,v 1.223 2020/01/02 15:42:27 thorpej Exp $ */ +/* $NetBSD: init_sysctl.c,v 1.223.2.1 2020/01/08 11:02:16 ad Exp $ */ /*- * Copyright (c) 2003, 2007, 2008, 2009 The NetBSD Foundation, Inc. @@ -30,7 +30,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: init_sysctl.c,v 1.223 2020/01/02 15:42:27 thorpej Exp $"); +__KERNEL_RCSID(0, "$NetBSD: init_sysctl.c,v 1.223.2.1 2020/01/08 11:02:16 ad Exp $"); #include "opt_sysv.h" #include "opt_compat_netbsd.h" @@ -732,7 +732,6 @@ sysctl_kern_maxvnodes(SYSCTLFN_ARGS) return (error); } vfs_reinit(); - nchreinit(); return (0); } Index: src/sys/kern/vfs_cache.c diff -u src/sys/kern/vfs_cache.c:1.126 src/sys/kern/vfs_cache.c:1.126.2.1 --- src/sys/kern/vfs_cache.c:1.126 Mon Jan 6 11:22:33 2020 +++ src/sys/kern/vfs_cache.c Wed Jan 8 11:02:16 2020 @@ -1,9 +1,12 @@ -/* $NetBSD: vfs_cache.c,v 1.126 2020/01/06 11:22:33 ad Exp $ */ +/* $NetBSD: vfs_cache.c,v 1.126.2.1 2020/01/08 11:02:16 ad Exp $ */ /*- - * Copyright (c) 2008 The NetBSD Foundation, Inc. + * Copyright (c) 2008, 2019 The NetBSD Foundation, Inc. * All rights reserved. * + * This code is derived from software contributed to The NetBSD Foundation + * by Andrew Doran. + * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: @@ -57,23 +60,108 @@ * @(#)vfs_cache.c 8.3 (Berkeley) 8/22/94 */ +/* + * Name caching works as follows: + * + * Names found by directory scans are retained in a cache for future + * reference. It is managed pseudo-LRU, so frequently used names will + * hang around. Cache is indexed by directory. + * + * Upon reaching the last segment of a path, if the reference is for + * DELETE, or NOCACHE is set (rewrite), and name is located in the + * cache, it will be dropped. + * + * Data structures: + * + * The original BSD implementation used a global hash table, which + * works very well on a uniprocessor system but causes performance + * difficulties on a multiprocessor system. The global hash table is + * also difficult to size dynamically, and can become very large. To + * try and address these problems, the focus of interest in this + * implementation is the directory itself. A per-directory structure + * is used to look up names. + * + * XXX Currently this structure is an rbtree, but rbtrees touch many + * cache lines during a lookup and so perform badly. The intent is to + * utimately make use of some other data structure, perhaps a Robin + * Hood hash. Insert blurb here when that happens. + * + * Concurrency: + * + * There are two locks that are of particular interest: + * + * nc_dvp->vi_nclock: a per-directory lock. This is taken mainly + * during lookups. + * + * cache_list_lock: a global lock for all lists, including per-vnode + * lists and the LRU queue. This is taken mainly during insertion and + * removal, and when operating in the list -> tree direction. + * + * vp->v_interlock: per vnode interlock taken when acquiring a ref. + * + * Most all modifications are made holding both cache_list_lock and the + * directory lock. nc_hittime is modified with only the directory lock + * held. See the definition of "struct namecache" in src/sys/namei.src + * for the particulars. + * + * Per-CPU statistics, and "numcache" are read unlocked, since an + * approximate value is OK. We maintain uintptr_t sized per-CPU + * counters and 64-bit global counters under the theory that uintptr_t + * sized counters are less likely to be hosed by nonatomic increment. + * + * Lock order: + * + * 1) nc_dvp->vi_nclock + * 2) cache_list_lock + * 3) vp->v_interlock + * + * Ugly ASCII diagram: + * + * ... + * | + * -o- + * | VDIR | + * | vnode | + * --- + *
CVS commit: [ad-namecache] src/sys
Module Name:src Committed By: ad Date: Wed Jan 8 11:02:35 UTC 2020 Modified Files: src/sys/rump/include/rump [ad-namecache]: rump_namei.h src/sys/sys [ad-namecache]: namei.h Log Message: Regen. To generate a diff of this commit: cvs rdiff -u -r1.37 -r1.37.2.1 src/sys/rump/include/rump/rump_namei.h cvs rdiff -u -r1.103 -r1.103.2.1 src/sys/sys/namei.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/rump/include/rump/rump_namei.h diff -u src/sys/rump/include/rump/rump_namei.h:1.37 src/sys/rump/include/rump/rump_namei.h:1.37.2.1 --- src/sys/rump/include/rump/rump_namei.h:1.37 Mon Jan 6 11:23:31 2020 +++ src/sys/rump/include/rump/rump_namei.h Wed Jan 8 11:02:35 2020 @@ -1,11 +1,11 @@ -/* $NetBSD: rump_namei.h,v 1.37 2020/01/06 11:23:31 ad Exp $ */ +/* $NetBSD: rump_namei.h,v 1.37.2.1 2020/01/08 11:02:35 ad Exp $ */ /* * WARNING: GENERATED FILE. DO NOT EDIT * (edit namei.src and run make namei in src/sys/sys) * by: NetBSD: gennameih.awk,v 1.5 2009/12/23 14:17:19 pooka Exp - * from: NetBSD: namei.src,v 1.47 2020/01/06 11:22:33 ad Exp + * from: NetBSD: namei.src,v 1.47.2.1 2020/01/08 11:02:16 ad Exp */ #ifndef _RUMP_RUMP_NAMEI_H_ Index: src/sys/sys/namei.h diff -u src/sys/sys/namei.h:1.103 src/sys/sys/namei.h:1.103.2.1 --- src/sys/sys/namei.h:1.103 Mon Jan 6 11:23:31 2020 +++ src/sys/sys/namei.h Wed Jan 8 11:02:35 2020 @@ -1,11 +1,11 @@ -/* $NetBSD: namei.h,v 1.103 2020/01/06 11:23:31 ad Exp $ */ +/* $NetBSD: namei.h,v 1.103.2.1 2020/01/08 11:02:35 ad Exp $ */ /* * WARNING: GENERATED FILE. DO NOT EDIT * (edit namei.src and run make namei in src/sys/sys) * by: NetBSD: gennameih.awk,v 1.5 2009/12/23 14:17:19 pooka Exp - * from: NetBSD: namei.src,v 1.47 2020/01/06 11:22:33 ad Exp + * from: NetBSD: namei.src,v 1.47.2.1 2020/01/08 11:02:16 ad Exp */ /* @@ -196,42 +196,38 @@ struct nameidata { #endif #ifdef __NAMECACHE_PRIVATE +#include + /* * For simplicity (and economy of storage), names longer than * a maximum length of NCHNAMLEN are stored in non-pooled storage. */ -#define NCHNAMLEN 32 /* up to this size gets stored in pool */ +#define NCHNAMLEN sizeof(((struct namecache *)NULL)->nc_name) /* * Namecache entry. - * This structure describes the elements in the cache of recent - * names looked up by namei. - * - * Locking rules: * - * - stable after initialization - * L namecache_lock - * C struct nchcpu::cpu_lock - * L/C insert needs L, read needs L or any C, - * must hold L and all C after (or during) delete before free - * N struct namecache::nc_lock + * This structure describes the elements in the cache of recent names looked + * up by namei. It's carefully sized to take up 128 bytes on _LP64, to make + * good use of space and the CPU caches. + * + * Field markings and their corresponding locks: + * + * - stable throught the lifetime of the namecache entry + * d protected by nc_dvp->vi_nclock + * l protected by cache_list_lock */ struct namecache { - LIST_ENTRY(namecache) nc_hash; /* L/C hash chain */ - TAILQ_ENTRY(namecache) nc_lru; /* L pseudo-lru chain */ - LIST_ENTRY(namecache) nc_dvlist;/* L dvp's list of cache entries */ - LIST_ENTRY(namecache) nc_vlist; /* L vp's list of cache entries */ - struct vnode *nc_dvp; /* N vnode of parent of name */ - struct vnode *nc_vp; /* N vnode the name refers to */ - void *nc_gcqueue; /* N queue for garbage collection */ - kmutex_t nc_lock; /* lock on this entry */ - int nc_hittime; /* N last time scored a hit */ - int nc_flags; /* - copy of componentname ISWHITEOUT */ - u_short nc_nlen; /* - length of name */ - char nc_name[0]; /* - segment name */ + struct rb_node nc_node; /* d red-black tree node */ + TAILQ_ENTRY(namecache) nc_lru; /* l pseudo-lru chain */ + TAILQ_ENTRY(namecache) nc_vlist;/* l vp's list of cache entries */ + struct vnode *nc_dvp; /* - vnode of parent of name */ + struct vnode *nc_vp; /* - vnode the name refers to */ + int nc_hittime; /* d approx time of last hit */ + u_short nc_nlen; /* - length of name */ + bool nc_whiteout; /* - true if a whiteout */ + char nc_name[49]; /* - segment name */ }; -__CTASSERT((sizeof(struct namecache) + NCHNAMLEN) -% __alignof(struct namecache) == 0); #endif #ifdef _KERNEL @@ -297,11 +293,13 @@ bool cache_lookup_raw(struct vnode *, co int cache_revlookup(struct vnode *, struct vnode **, char **, char *); void cache_enter(struct vnode *, struct vnode *, const char *, size_t, uint32_t); +void cache_vnode_init(struct vnode * ); +void cache_vnode_fini(struct vnode * ); +void cache_cpu_init(struct cpu_info *); + void nchinit(void); -void nchreinit(void); void namecache_count_pass2(void); void namecache_count_2passes(void); -void cache_cpu_init(struct cpu_info *); void cache_purgevfs(struct mount *);
CVS commit: src/sys/dev/pci
Module Name:src Committed By: yamaguchi Date: Wed Jan 8 09:12:11 UTC 2020 Modified Files: src/sys/dev/pci: if_ixl.c Log Message: Not stop kpreempt if unnecessary, ixl(4) To generate a diff of this commit: cvs rdiff -u -r1.15 -r1.16 src/sys/dev/pci/if_ixl.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/pci/if_ixl.c diff -u src/sys/dev/pci/if_ixl.c:1.15 src/sys/dev/pci/if_ixl.c:1.16 --- src/sys/dev/pci/if_ixl.c:1.15 Thu Dec 26 03:55:00 2019 +++ src/sys/dev/pci/if_ixl.c Wed Jan 8 09:12:11 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: if_ixl.c,v 1.15 2019/12/26 03:55:00 yamaguchi Exp $ */ +/* $NetBSD: if_ixl.c,v 1.16 2020/01/08 09:12:11 yamaguchi Exp $ */ /* * Copyright (c) 2013-2015, Intel Corporation @@ -3337,6 +3337,8 @@ ixl_link_state_update(struct ixl_softc * struct ifnet *ifp = &sc->sc_ec.ec_if; int link_state; + KASSERT(kpreempt_disabled()); + link_state = ixl_set_link_status(sc, iaq); if (ifp->if_link_state != link_state) @@ -3405,7 +3407,9 @@ ixl_arq(void *xsc) switch (iaq->iaq_opcode) { case htole16(IXL_AQ_OP_PHY_LINK_STATUS): + kpreempt_disable(); ixl_link_state_update(sc, iaq); + kpreempt_enable(); break; } @@ -5665,9 +5669,7 @@ ixl_workq_work(struct work *wk, void *co work = container_of(wk, struct ixl_work, ixw_cookie); atomic_swap_uint(&work->ixw_added, 0); - kpreempt_disable(); work->ixw_func(work->ixw_arg); - kpreempt_enable(); } static int
CVS commit: src/sys/dev/audio
Module Name:src Committed By: isaki Date: Wed Jan 8 08:10:15 UTC 2020 Modified Files: src/sys/dev/audio: audio.c Log Message: Move mutex_exit() correct place to protect sc_async_mixer. Thanks maxv@! To generate a diff of this commit: cvs rdiff -u -r1.36 -r1.37 src/sys/dev/audio/audio.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/audio/audio.c diff -u src/sys/dev/audio/audio.c:1.36 src/sys/dev/audio/audio.c:1.37 --- src/sys/dev/audio/audio.c:1.36 Fri Dec 27 09:45:26 2019 +++ src/sys/dev/audio/audio.c Wed Jan 8 08:10:15 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: audio.c,v 1.36 2019/12/27 09:45:26 msaitoh Exp $ */ +/* $NetBSD: audio.c,v 1.37 2020/01/08 08:10:15 isaki Exp $ */ /*- * Copyright (c) 2008 The NetBSD Foundation, Inc. @@ -142,7 +142,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: audio.c,v 1.36 2019/12/27 09:45:26 msaitoh Exp $"); +__KERNEL_RCSID(0, "$NetBSD: audio.c,v 1.37 2020/01/08 08:10:15 isaki Exp $"); #ifdef _KERNEL_OPT #include "audio.h" @@ -7694,12 +7694,12 @@ mixer_ioctl(struct audio_softc *sc, u_lo } mutex_enter(sc->sc_lock); mixer_remove(sc); /* remove old entry */ - mutex_exit(sc->sc_lock); if (ma != NULL) { ma->next = sc->sc_async_mixer; ma->pid = curproc->p_pid; sc->sc_async_mixer = ma; } + mutex_exit(sc->sc_lock); error = 0; break;