CVS commit: src/sys/dev/pci
Module Name:src Committed By: yamaguchi Date: Tue Feb 25 07:58:44 UTC 2020 Modified Files: src/sys/dev/pci: if_ixl.c Log Message: Use kmem_alloc instead of malloc pointed out and reviewed by knakahar@n.o., thanks To generate a diff of this commit: cvs rdiff -u -r1.53 -r1.54 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.53 src/sys/dev/pci/if_ixl.c:1.54 --- src/sys/dev/pci/if_ixl.c:1.53 Tue Feb 25 07:53:55 2020 +++ src/sys/dev/pci/if_ixl.c Tue Feb 25 07:58:44 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: if_ixl.c,v 1.53 2020/02/25 07:53:55 yamaguchi Exp $ */ +/* $NetBSD: if_ixl.c,v 1.54 2020/02/25 07:58:44 yamaguchi Exp $ */ /* * Copyright (c) 2013-2015, Intel Corporation @@ -74,7 +74,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: if_ixl.c,v 1.53 2020/02/25 07:53:55 yamaguchi Exp $"); +__KERNEL_RCSID(0, "$NetBSD: if_ixl.c,v 1.54 2020/02/25 07:58:44 yamaguchi Exp $"); #ifdef _KERNEL_OPT #include "opt_net_mpsafe.h" @@ -89,7 +89,6 @@ __KERNEL_RCSID(0, "$NetBSD: if_ixl.c,v 1 #include #include #include -#include #include #include #include @@ -5229,9 +5228,7 @@ ixl_aqb_alloc(struct ixl_softc *sc) { struct ixl_aq_buf *aqb; - aqb = malloc(sizeof(*aqb), M_DEVBUF, M_WAITOK); - if (aqb == NULL) - return NULL; + aqb = kmem_alloc(sizeof(*aqb), KM_SLEEP); aqb->aqb_size = IXL_AQ_BUFLEN; @@ -5258,7 +5255,7 @@ dma_free: destroy: bus_dmamap_destroy(sc->sc_dmat, aqb->aqb_map); free: - free(aqb, M_DEVBUF); + kmem_free(aqb, sizeof(*aqb)); return NULL; } @@ -5266,11 +5263,12 @@ free: static void ixl_aqb_free(struct ixl_softc *sc, struct ixl_aq_buf *aqb) { + bus_dmamap_unload(sc->sc_dmat, aqb->aqb_map); bus_dmamem_unmap(sc->sc_dmat, aqb->aqb_data, aqb->aqb_size); bus_dmamem_free(sc->sc_dmat, &aqb->aqb_seg, 1); bus_dmamap_destroy(sc->sc_dmat, aqb->aqb_map); - free(aqb, M_DEVBUF); + kmem_free(aqb, sizeof(*aqb)); } static int
CVS commit: src/sys/dev/pci
Module Name:src Committed By: yamaguchi Date: Tue Feb 25 07:53:55 UTC 2020 Modified Files: src/sys/dev/pci: if_ixl.c Log Message: Change the number of retry to be the same as FreeBSD and Linux pointed out and reviewed by knakahara@n.o., thanks. To generate a diff of this commit: cvs rdiff -u -r1.52 -r1.53 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.52 src/sys/dev/pci/if_ixl.c:1.53 --- src/sys/dev/pci/if_ixl.c:1.52 Tue Feb 25 07:50:25 2020 +++ src/sys/dev/pci/if_ixl.c Tue Feb 25 07:53:55 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: if_ixl.c,v 1.52 2020/02/25 07:50:25 yamaguchi Exp $ */ +/* $NetBSD: if_ixl.c,v 1.53 2020/02/25 07:53:55 yamaguchi Exp $ */ /* * Copyright (c) 2013-2015, Intel Corporation @@ -74,7 +74,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: if_ixl.c,v 1.52 2020/02/25 07:50:25 yamaguchi Exp $"); +__KERNEL_RCSID(0, "$NetBSD: if_ixl.c,v 1.53 2020/02/25 07:53:55 yamaguchi Exp $"); #ifdef _KERNEL_OPT #include "opt_net_mpsafe.h" @@ -2583,7 +2583,7 @@ ixl_txr_disabled(struct ixl_softc *sc, s KASSERT(mutex_owned(&txr->txr_lock)); - for (i = 0; i < 20; i++) { + for (i = 0; i < 10; i++) { reg = ixl_rd(sc, ena); if (ISSET(reg, I40E_QTX_ENA_QENA_STAT_MASK) == 0) return 0; @@ -3097,7 +3097,7 @@ ixl_rxr_disabled(struct ixl_softc *sc, s KASSERT(mutex_owned(&rxr->rxr_lock)); - for (i = 0; i < 20; i++) { + for (i = 0; i < 10; i++) { reg = ixl_rd(sc, ena); if (ISSET(reg, I40E_QRX_ENA_QENA_STAT_MASK) == 0) return 0;
CVS commit: src/sys/dev/pci
Module Name:src Committed By: yamaguchi Date: Tue Feb 25 07:50:25 UTC 2020 Modified Files: src/sys/dev/pci: if_ixl.c Log Message: Disable all queues before waiting for the completion on each queue to reduce the number of delays pointed out and reviewed by knakahara@n.o., thanks To generate a diff of this commit: cvs rdiff -u -r1.51 -r1.52 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.51 src/sys/dev/pci/if_ixl.c:1.52 --- src/sys/dev/pci/if_ixl.c:1.51 Tue Feb 25 07:45:28 2020 +++ src/sys/dev/pci/if_ixl.c Tue Feb 25 07:50:25 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: if_ixl.c,v 1.51 2020/02/25 07:45:28 yamaguchi Exp $ */ +/* $NetBSD: if_ixl.c,v 1.52 2020/02/25 07:50:25 yamaguchi Exp $ */ /* * Copyright (c) 2013-2015, Intel Corporation @@ -74,7 +74,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: if_ixl.c,v 1.51 2020/02/25 07:45:28 yamaguchi Exp $"); +__KERNEL_RCSID(0, "$NetBSD: if_ixl.c,v 1.52 2020/02/25 07:50:25 yamaguchi Exp $"); #ifdef _KERNEL_OPT #include "opt_net_mpsafe.h" @@ -2257,17 +2257,39 @@ ixl_stop_locked(struct ixl_softc *sc) mutex_enter(&txr->txr_lock); ixl_txr_qdis(sc, txr, 0); - /* XXX wait at least 400 usec for all tx queues in one go */ - ixl_flush(sc); - DELAY(500); + mutex_exit(&txr->txr_lock); + } + + /* XXX wait at least 400 usec for all tx queues in one go */ + ixl_flush(sc); + DELAY(500); + + for (i = 0; i < sc->sc_nqueue_pairs; i++) { + txr = sc->sc_qps[i].qp_txr; + rxr = sc->sc_qps[i].qp_rxr; + mutex_enter(&txr->txr_lock); reg = ixl_rd(sc, I40E_QTX_ENA(i)); CLR(reg, I40E_QTX_ENA_QENA_REQ_MASK); ixl_wr(sc, I40E_QTX_ENA(i), reg); - /* XXX wait 50ms from completaion of the TX queue disable*/ - ixl_flush(sc); - DELAY(50); + mutex_exit(&txr->txr_lock); + + mutex_enter(&rxr->rxr_lock); + reg = ixl_rd(sc, I40E_QRX_ENA(i)); + CLR(reg, I40E_QRX_ENA_QENA_REQ_MASK); + ixl_wr(sc, I40E_QRX_ENA(i), reg); + mutex_exit(&rxr->rxr_lock); + } + + /* XXX short wait for all queue disables to settle */ + ixl_flush(sc); + DELAY(50); + + for (i = 0; i < sc->sc_nqueue_pairs; i++) { + txr = sc->sc_qps[i].qp_txr; + rxr = sc->sc_qps[i].qp_rxr; + mutex_enter(&txr->txr_lock); if (ixl_txr_disabled(sc, txr) != 0) { mutex_exit(&txr->txr_lock); goto die; @@ -2275,13 +2297,6 @@ ixl_stop_locked(struct ixl_softc *sc) mutex_exit(&txr->txr_lock); mutex_enter(&rxr->rxr_lock); - reg = ixl_rd(sc, I40E_QRX_ENA(i)); - CLR(reg, I40E_QRX_ENA_QENA_REQ_MASK); - ixl_wr(sc, I40E_QRX_ENA(i), reg); - /* XXX wait 50ms from completion of the RX queue disable */ - ixl_flush(sc); - DELAY(50); - if (ixl_rxr_disabled(sc, rxr) != 0) { mutex_exit(&rxr->rxr_lock); goto die;
CVS commit: src/sys/dev/pci
Module Name:src Committed By: yamaguchi Date: Tue Feb 25 07:45:28 UTC 2020 Modified Files: src/sys/dev/pci: if_ixl.c Log Message: Use callout_halt() instead of callout_stop for safety pointed out and reviewed by knakahara@n.o., thanks To generate a diff of this commit: cvs rdiff -u -r1.50 -r1.51 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.50 src/sys/dev/pci/if_ixl.c:1.51 --- src/sys/dev/pci/if_ixl.c:1.50 Tue Feb 25 07:41:32 2020 +++ src/sys/dev/pci/if_ixl.c Tue Feb 25 07:45:28 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: if_ixl.c,v 1.50 2020/02/25 07:41:32 yamaguchi Exp $ */ +/* $NetBSD: if_ixl.c,v 1.51 2020/02/25 07:45:28 yamaguchi Exp $ */ /* * Copyright (c) 2013-2015, Intel Corporation @@ -74,7 +74,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: if_ixl.c,v 1.50 2020/02/25 07:41:32 yamaguchi Exp $"); +__KERNEL_RCSID(0, "$NetBSD: if_ixl.c,v 1.51 2020/02/25 07:45:28 yamaguchi Exp $"); #ifdef _KERNEL_OPT #include "opt_net_mpsafe.h" @@ -1518,7 +1518,7 @@ ixl_detach(device_t self, int flags) ixl_disable_other_intr(sc); - callout_stop(&sc->sc_stats_callout); + callout_halt(&sc->sc_stats_callout, NULL); ixl_work_wait(sc->sc_workq, &sc->sc_stats_task); /* wait for ATQ handler */
CVS commit: src/sys/dev/pci
Module Name:src Committed By: yamaguchi Date: Tue Feb 25 07:41:32 UTC 2020 Modified Files: src/sys/dev/pci: if_ixl.c Log Message: Stop callout for statistics while the interface is not running To generate a diff of this commit: cvs rdiff -u -r1.49 -r1.50 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.49 src/sys/dev/pci/if_ixl.c:1.50 --- src/sys/dev/pci/if_ixl.c:1.49 Tue Feb 25 07:35:54 2020 +++ src/sys/dev/pci/if_ixl.c Tue Feb 25 07:41:32 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: if_ixl.c,v 1.49 2020/02/25 07:35:54 yamaguchi Exp $ */ +/* $NetBSD: if_ixl.c,v 1.50 2020/02/25 07:41:32 yamaguchi Exp $ */ /* * Copyright (c) 2013-2015, Intel Corporation @@ -74,7 +74,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: if_ixl.c,v 1.49 2020/02/25 07:35:54 yamaguchi Exp $"); +__KERNEL_RCSID(0, "$NetBSD: if_ixl.c,v 1.50 2020/02/25 07:41:32 yamaguchi Exp $"); #ifdef _KERNEL_OPT #include "opt_net_mpsafe.h" @@ -1448,7 +1448,6 @@ ixl_attach(device_t parent, device_t sel ixl_stats_update(sc); sc->sc_stats_counters.isc_has_offset = true; - callout_schedule(&sc->sc_stats_callout, mstohz(sc->sc_stats_intval)); if (pmf_device_register(self, NULL, NULL) != true) aprint_debug_dev(self, "couldn't establish power handler\n"); @@ -2133,6 +2132,8 @@ ixl_init_locked(struct ixl_softc *sc) return error; } + callout_schedule(&sc->sc_stats_callout, mstohz(sc->sc_stats_intval)); + return 0; } @@ -2246,6 +2247,7 @@ ixl_stop_locked(struct ixl_softc *sc) KASSERT(mutex_owned(&sc->sc_cfg_lock)); CLR(ifp->if_flags, IFF_RUNNING | IFF_OACTIVE); + callout_stop(&sc->sc_stats_callout); for (i = 0; i < sc->sc_nqueue_pairs; i++) { txr = sc->sc_qps[i].qp_txr;
CVS commit: src/sys/dev/pci
Module Name:src Committed By: yamaguchi Date: Tue Feb 25 07:35:54 UTC 2020 Modified Files: src/sys/dev/pci: if_ixl.c Log Message: Change position of the cpuid::ixl_hmc_txq to be same with ixl_hmc_pack_txq[] This has no functionality impact because the position on memory is defined in ixl_hmc_pack_txq[]. pointed out and reviewed by knakahara@n.o., thanks To generate a diff of this commit: cvs rdiff -u -r1.48 -r1.49 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.48 src/sys/dev/pci/if_ixl.c:1.49 --- src/sys/dev/pci/if_ixl.c:1.48 Tue Feb 25 07:31:19 2020 +++ src/sys/dev/pci/if_ixl.c Tue Feb 25 07:35:54 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: if_ixl.c,v 1.48 2020/02/25 07:31:19 yamaguchi Exp $ */ +/* $NetBSD: if_ixl.c,v 1.49 2020/02/25 07:35:54 yamaguchi Exp $ */ /* * Copyright (c) 2013-2015, Intel Corporation @@ -74,7 +74,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: if_ixl.c,v 1.48 2020/02/25 07:31:19 yamaguchi Exp $"); +__KERNEL_RCSID(0, "$NetBSD: if_ixl.c,v 1.49 2020/02/25 07:35:54 yamaguchi Exp $"); #ifdef _KERNEL_OPT #include "opt_net_mpsafe.h" @@ -369,8 +369,8 @@ struct ixl_hmc_txq { uint8_t timesync_ena; uint8_t fd_ena; uint8_t alt_vlan_ena; - uint16_t thead_wb; uint8_t cpuid; + uint16_t thead_wb; uint8_t head_wb_ena; #define IXL_HMC_TXQ_DESC_WB 0 #define IXL_HMC_TXQ_HEAD_WB 1
CVS commit: src/sys/dev/pci
Module Name:src Committed By: yamaguchi Date: Tue Feb 25 07:31:19 UTC 2020 Modified Files: src/sys/dev/pci: if_ixl.c Log Message: Hold per-queue locks when clearing config of queues for safety To generate a diff of this commit: cvs rdiff -u -r1.47 -r1.48 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.47 src/sys/dev/pci/if_ixl.c:1.48 --- src/sys/dev/pci/if_ixl.c:1.47 Tue Feb 25 07:22:18 2020 +++ src/sys/dev/pci/if_ixl.c Tue Feb 25 07:31:19 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: if_ixl.c,v 1.47 2020/02/25 07:22:18 yamaguchi Exp $ */ +/* $NetBSD: if_ixl.c,v 1.48 2020/02/25 07:31:19 yamaguchi Exp $ */ /* * Copyright (c) 2013-2015, Intel Corporation @@ -74,7 +74,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: if_ixl.c,v 1.47 2020/02/25 07:22:18 yamaguchi Exp $"); +__KERNEL_RCSID(0, "$NetBSD: if_ixl.c,v 1.48 2020/02/25 07:31:19 yamaguchi Exp $"); #ifdef _KERNEL_OPT #include "opt_net_mpsafe.h" @@ -2293,8 +2293,13 @@ ixl_stop_locked(struct ixl_softc *sc) txr = sc->sc_qps[i].qp_txr; rxr = sc->sc_qps[i].qp_rxr; + mutex_enter(&txr->txr_lock); ixl_txr_unconfig(sc, txr); + mutex_exit(&txr->txr_lock); + + mutex_enter(&rxr->rxr_lock); ixl_rxr_unconfig(sc, rxr); + mutex_exit(&rxr->rxr_lock); ixl_txr_clean(sc, txr); ixl_rxr_clean(sc, rxr);
CVS commit: src/sys/dev/pci
Module Name:src Committed By: yamaguchi Date: Tue Feb 25 07:22:18 UTC 2020 Modified Files: src/sys/dev/pci: if_ixl.c Log Message: Add defines for the max number of queue pointed out and reviewed by knakahara@n.o., thanks To generate a diff of this commit: cvs rdiff -u -r1.46 -r1.47 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.46 src/sys/dev/pci/if_ixl.c:1.47 --- src/sys/dev/pci/if_ixl.c:1.46 Tue Feb 25 07:17:19 2020 +++ src/sys/dev/pci/if_ixl.c Tue Feb 25 07:22:18 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: if_ixl.c,v 1.46 2020/02/25 07:17:19 yamaguchi Exp $ */ +/* $NetBSD: if_ixl.c,v 1.47 2020/02/25 07:22:18 yamaguchi Exp $ */ /* * Copyright (c) 2013-2015, Intel Corporation @@ -74,7 +74,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: if_ixl.c,v 1.46 2020/02/25 07:17:19 yamaguchi Exp $"); +__KERNEL_RCSID(0, "$NetBSD: if_ixl.c,v 1.47 2020/02/25 07:22:18 yamaguchi Exp $"); #ifdef _KERNEL_OPT #include "opt_net_mpsafe.h" @@ -175,6 +175,9 @@ struct ixl_softc; /* defined */ I40E_PFINT_ICR0_ECC_ERR_MASK | \ I40E_PFINT_ICR0_PE_CRITERR_MASK) +#define IXL_QUEUE_MAX_XL710 64 +#define IXL_QUEUE_MAX_X722 128 + #define IXL_TX_PKT_DESCS 8 #define IXL_TX_PKT_MAXSIZE (MCLBYTES * IXL_TX_PKT_DESCS) #define IXL_TX_QUEUE_ALIGN 128 @@ -1215,9 +1218,9 @@ ixl_attach(device_t parent, device_t sel ixl_get_nvm_version(sc); if (sc->sc_mac_type == I40E_MAC_X722) - sc->sc_nqueue_pairs_device = 128; + sc->sc_nqueue_pairs_device = IXL_QUEUE_MAX_X722; else - sc->sc_nqueue_pairs_device = 64; + sc->sc_nqueue_pairs_device = IXL_QUEUE_MAX_XL710; rv = ixl_get_hw_capabilities(sc); if (rv != 0) {
CVS commit: src/sys/dev/pci
Module Name:src Committed By: yamaguchi Date: Tue Feb 25 07:17:19 UTC 2020 Modified Files: src/sys/dev/pci: if_ixl.c Log Message: Set 0 to txr_{prod,cons} and rxr_{prod,cons} when HMC objects are cleared Those values should be the same as head and tail in an HMC object To generate a diff of this commit: cvs rdiff -u -r1.45 -r1.46 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.45 src/sys/dev/pci/if_ixl.c:1.46 --- src/sys/dev/pci/if_ixl.c:1.45 Tue Feb 25 07:10:10 2020 +++ src/sys/dev/pci/if_ixl.c Tue Feb 25 07:17:19 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: if_ixl.c,v 1.45 2020/02/25 07:10:10 yamaguchi Exp $ */ +/* $NetBSD: if_ixl.c,v 1.46 2020/02/25 07:17:19 yamaguchi Exp $ */ /* * Copyright (c) 2013-2015, Intel Corporation @@ -74,7 +74,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: if_ixl.c,v 1.45 2020/02/25 07:10:10 yamaguchi Exp $"); +__KERNEL_RCSID(0, "$NetBSD: if_ixl.c,v 1.46 2020/02/25 07:17:19 yamaguchi Exp $"); #ifdef _KERNEL_OPT #include "opt_net_mpsafe.h" @@ -2021,9 +2021,6 @@ ixl_reinit(struct ixl_softc *sc) txr = sc->sc_qps[i].qp_txr; rxr = sc->sc_qps[i].qp_rxr; - txr->txr_cons = txr->txr_prod = 0; - rxr->rxr_cons = rxr->rxr_prod = 0; - ixl_txr_config(sc, txr); ixl_rxr_config(sc, rxr); } @@ -2507,6 +2504,7 @@ ixl_txr_unconfig(struct ixl_softc *sc, s hmc = ixl_hmc_kva(sc, IXL_HMC_LAN_TX, txr->txr_qid); memset(hmc, 0, ixl_hmc_len(sc, IXL_HMC_LAN_TX)); + txr->txr_cons = txr->txr_prod = 0; } static void @@ -3127,6 +3125,7 @@ ixl_rxr_unconfig(struct ixl_softc *sc, s hmc = ixl_hmc_kva(sc, IXL_HMC_LAN_RX, rxr->rxr_qid); memset(hmc, 0, ixl_hmc_len(sc, IXL_HMC_LAN_RX)); + rxr->rxr_cons = rxr->rxr_prod = 0; } static void
CVS commit: src/sys/dev/pci
Module Name:src Committed By: yamaguchi Date: Tue Feb 25 07:10:10 UTC 2020 Modified Files: src/sys/dev/pci: if_ixl.c Log Message: Use workqueue API directly, without the wrapper in ixl(4) to improve performace by removing atomic_ops(3) pointed out and reviewed by knakahara@n.o., thanks To generate a diff of this commit: cvs rdiff -u -r1.44 -r1.45 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.44 src/sys/dev/pci/if_ixl.c:1.45 --- src/sys/dev/pci/if_ixl.c:1.44 Tue Feb 25 07:05:57 2020 +++ src/sys/dev/pci/if_ixl.c Tue Feb 25 07:10:10 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: if_ixl.c,v 1.44 2020/02/25 07:05:57 yamaguchi Exp $ */ +/* $NetBSD: if_ixl.c,v 1.45 2020/02/25 07:10:10 yamaguchi Exp $ */ /* * Copyright (c) 2013-2015, Intel Corporation @@ -74,7 +74,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: if_ixl.c,v 1.44 2020/02/25 07:05:57 yamaguchi Exp $"); +__KERNEL_RCSID(0, "$NetBSD: if_ixl.c,v 1.45 2020/02/25 07:10:10 yamaguchi Exp $"); #ifdef _KERNEL_OPT #include "opt_net_mpsafe.h" @@ -478,7 +478,7 @@ struct ixl_queue_pair { char qp_name[16]; void *qp_si; - struct ixl_work qp_task; + struct work qp_work; bool qp_workqueue; }; @@ -828,6 +828,7 @@ static int ixl_intr(void *); static int ixl_queue_intr(void *); static int ixl_other_intr(void *); static void ixl_handle_queue(void *); +static void ixl_handle_queue_wk(struct work *, void *); static void ixl_sched_handle_queue(struct ixl_softc *, struct ixl_queue_pair *); static int ixl_init(struct ifnet *); @@ -1346,10 +1347,12 @@ ixl_attach(device_t parent, device_t sel goto teardown_sysctls; snprintf(xnamebuf, sizeof(xnamebuf), "%s_wq_txrx", device_xname(self)); - sc->sc_workq_txrx = ixl_workq_create(xnamebuf, IXL_WORKQUEUE_PRI, - IPL_NET, WQ_PERCPU | WQ_MPSAFE); - if (sc->sc_workq_txrx == NULL) + rv = workqueue_create(&sc->sc_workq_txrx, xnamebuf, ixl_handle_queue_wk, + sc, IXL_WORKQUEUE_PRI, IPL_NET, WQ_PERCPU | WQ_MPSAFE); + if (rv != 0) { + sc->sc_workq_txrx = NULL; goto teardown_wqs; + } snprintf(xnamebuf, sizeof(xnamebuf), "%s_atq_cv", device_xname(self)); cv_init(&sc->sc_atq_cv, xnamebuf); @@ -1529,7 +1532,7 @@ ixl_detach(device_t self, int flags) } if (sc->sc_workq_txrx != NULL) { - ixl_workq_destroy(sc->sc_workq_txrx); + workqueue_destroy(sc->sc_workq_txrx); sc->sc_workq_txrx = NULL; } @@ -1597,7 +1600,7 @@ ixl_workqs_teardown(device_t self) } if (sc->sc_workq_txrx != NULL) { - ixl_workq_destroy(sc->sc_workq_txrx); + workqueue_destroy(sc->sc_workq_txrx); sc->sc_workq_txrx = NULL; } @@ -2225,8 +2228,9 @@ ixl_stop_rendezvous(struct ixl_softc *sc mutex_enter(&rxr->rxr_lock); mutex_exit(&rxr->rxr_lock); - ixl_work_wait(sc->sc_workq_txrx, - &sc->sc_qps[i].qp_task); + sc->sc_qps[i].qp_workqueue = false; + workqueue_wait(sc->sc_workq_txrx, + &sc->sc_qps[i].qp_work); } } @@ -2341,7 +2345,6 @@ ixl_queue_pairs_alloc(struct ixl_softc * goto free; qp->qp_sc = sc; - ixl_work_set(&qp->qp_task, ixl_handle_queue, qp); snprintf(qp->qp_name, sizeof(qp->qp_name), "%s-TXRX%d", device_xname(sc->sc_dev), i); } @@ -3420,7 +3423,7 @@ ixl_sched_handle_queue(struct ixl_softc { if (qp->qp_workqueue) - ixl_work_add(sc->sc_workq_txrx, &qp->qp_task); + workqueue_enqueue(sc->sc_workq_txrx, &qp->qp_work, NULL); else softint_schedule(qp->qp_si); } @@ -3503,6 +3506,15 @@ ixl_queue_intr(void *xqp) } static void +ixl_handle_queue_wk(struct work *wk, void *xsc) +{ + struct ixl_queue_pair *qp; + + qp = container_of(wk, struct ixl_queue_pair, qp_work); + ixl_handle_queue(qp); +} + +static void ixl_handle_queue(void *xqp) { struct ixl_queue_pair *qp = xqp;
CVS commit: src/sys/dev/pci
Module Name:src Committed By: yamaguchi Date: Tue Feb 25 07:05:58 UTC 2020 Modified Files: src/sys/dev/pci: if_ixl.c Log Message: Remove WQ_PERCPU flag for the workqueue that does configurations such as link up and down And added kpreempt_disable and kpreempt_enable around workqueue_enqueue to call it in non-WQ_PERCPU thread context. pointed out and reviewed by knakahara@n.o., thanks. To generate a diff of this commit: cvs rdiff -u -r1.43 -r1.44 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.43 src/sys/dev/pci/if_ixl.c:1.44 --- src/sys/dev/pci/if_ixl.c:1.43 Tue Feb 25 07:00:26 2020 +++ src/sys/dev/pci/if_ixl.c Tue Feb 25 07:05:57 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: if_ixl.c,v 1.43 2020/02/25 07:00:26 yamaguchi Exp $ */ +/* $NetBSD: if_ixl.c,v 1.44 2020/02/25 07:05:57 yamaguchi Exp $ */ /* * Copyright (c) 2013-2015, Intel Corporation @@ -74,7 +74,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: if_ixl.c,v 1.43 2020/02/25 07:00:26 yamaguchi Exp $"); +__KERNEL_RCSID(0, "$NetBSD: if_ixl.c,v 1.44 2020/02/25 07:05:57 yamaguchi Exp $"); #ifdef _KERNEL_OPT #include "opt_net_mpsafe.h" @@ -1341,7 +1341,7 @@ ixl_attach(device_t parent, device_t sel snprintf(xnamebuf, sizeof(xnamebuf), "%s_wq_cfg", device_xname(self)); sc->sc_workq = ixl_workq_create(xnamebuf, IXL_WORKQUEUE_PRI, - IPL_NET, WQ_PERCPU | WQ_MPSAFE); + IPL_NET, WQ_MPSAFE); if (sc->sc_workq == NULL) goto teardown_sysctls; @@ -6642,7 +6642,9 @@ ixl_work_add(struct workqueue *wq, struc if (atomic_cas_uint(&work->ixw_added, 0, 1) != 0) return; + kpreempt_disable(); workqueue_enqueue(wq, &work->ixw_cookie, NULL); + kpreempt_enable(); } static void
CVS commit: src/sys/dev/pci
Module Name:src Committed By: yamaguchi Date: Tue Feb 25 07:00:27 UTC 2020 Modified Files: src/sys/dev/pci: if_ixl.c Log Message: Added __KERNEL_RCSID To generate a diff of this commit: cvs rdiff -u -r1.42 -r1.43 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.42 src/sys/dev/pci/if_ixl.c:1.43 --- src/sys/dev/pci/if_ixl.c:1.42 Wed Feb 12 06:41:44 2020 +++ src/sys/dev/pci/if_ixl.c Tue Feb 25 07:00:26 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: if_ixl.c,v 1.42 2020/02/12 06:41:44 yamaguchi Exp $ */ +/* $NetBSD: if_ixl.c,v 1.43 2020/02/25 07:00:26 yamaguchi Exp $ */ /* * Copyright (c) 2013-2015, Intel Corporation @@ -74,6 +74,7 @@ */ #include +__KERNEL_RCSID(0, "$NetBSD: if_ixl.c,v 1.43 2020/02/25 07:00:26 yamaguchi Exp $"); #ifdef _KERNEL_OPT #include "opt_net_mpsafe.h"
CVS commit: src/sys/rump/net/lib/libshmif
Module Name:src Committed By: ozaki-r Date: Tue Feb 25 03:26:18 UTC 2020 Modified Files: src/sys/rump/net/lib/libshmif: if_shmem.c Log Message: shmif: reduce the number of calls of cprng(9) To generate a diff of this commit: cvs rdiff -u -r1.80 -r1.81 src/sys/rump/net/lib/libshmif/if_shmem.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/rump/net/lib/libshmif/if_shmem.c diff -u src/sys/rump/net/lib/libshmif/if_shmem.c:1.80 src/sys/rump/net/lib/libshmif/if_shmem.c:1.81 --- src/sys/rump/net/lib/libshmif/if_shmem.c:1.80 Tue Feb 25 03:25:36 2020 +++ src/sys/rump/net/lib/libshmif/if_shmem.c Tue Feb 25 03:26:18 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: if_shmem.c,v 1.80 2020/02/25 03:25:36 ozaki-r Exp $ */ +/* $NetBSD: if_shmem.c,v 1.81 2020/02/25 03:26:18 ozaki-r Exp $ */ /* * Copyright (c) 2009, 2010 Antti Kantee. All Rights Reserved. @@ -28,7 +28,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: if_shmem.c,v 1.80 2020/02/25 03:25:36 ozaki-r Exp $"); +__KERNEL_RCSID(0, "$NetBSD: if_shmem.c,v 1.81 2020/02/25 03:26:18 ozaki-r Exp $"); #include #include @@ -163,16 +163,16 @@ allocif(int unit, struct shmif_sc **scp) uint8_t enaddr[ETHER_ADDR_LEN] = { 0xb2, 0xa0, 0x00, 0x00, 0x00, 0x00 }; struct shmif_sc *sc; struct ifnet *ifp; - uint32_t randnum; + uint64_t randnum; int error; - randnum = cprng_strong32(); - memcpy(&enaddr[2], &randnum, sizeof(randnum)); + randnum = cprng_strong64(); + memcpy(&enaddr[2], &randnum, 4); sc = kmem_zalloc(sizeof(*sc), KM_SLEEP); sc->sc_memfd = -1; sc->sc_unit = unit; - sc->sc_uid = cprng_strong64(); + sc->sc_uid = randnum; ifp = &sc->sc_ec.ec_if;
CVS commit: src/sys/rump/net/lib/libshmif
Module Name:src Committed By: ozaki-r Date: Tue Feb 25 03:25:36 UTC 2020 Modified Files: src/sys/rump/net/lib/libshmif: if_shmem.c Log Message: shmif: s/sc_uuid/sc_uid/ It's not UUID :-/ To generate a diff of this commit: cvs rdiff -u -r1.79 -r1.80 src/sys/rump/net/lib/libshmif/if_shmem.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/rump/net/lib/libshmif/if_shmem.c diff -u src/sys/rump/net/lib/libshmif/if_shmem.c:1.79 src/sys/rump/net/lib/libshmif/if_shmem.c:1.80 --- src/sys/rump/net/lib/libshmif/if_shmem.c:1.79 Tue Feb 25 03:24:48 2020 +++ src/sys/rump/net/lib/libshmif/if_shmem.c Tue Feb 25 03:25:36 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: if_shmem.c,v 1.79 2020/02/25 03:24:48 ozaki-r Exp $ */ +/* $NetBSD: if_shmem.c,v 1.80 2020/02/25 03:25:36 ozaki-r Exp $ */ /* * Copyright (c) 2009, 2010 Antti Kantee. All Rights Reserved. @@ -28,7 +28,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: if_shmem.c,v 1.79 2020/02/25 03:24:48 ozaki-r Exp $"); +__KERNEL_RCSID(0, "$NetBSD: if_shmem.c,v 1.80 2020/02/25 03:25:36 ozaki-r Exp $"); #include #include @@ -101,7 +101,7 @@ struct shmif_sc { struct lwp *sc_rcvl; bool sc_dying; - uint64_t sc_uuid; + uint64_t sc_uid; }; static void shmif_rcv(void *); @@ -172,7 +172,7 @@ allocif(int unit, struct shmif_sc **scp) sc = kmem_zalloc(sizeof(*sc), KM_SLEEP); sc->sc_memfd = -1; sc->sc_unit = unit; - sc->sc_uuid = cprng_strong64(); + sc->sc_uid = cprng_strong64(); ifp = &sc->sc_ec.ec_if; @@ -605,7 +605,7 @@ shmif_snd(struct ifnet *ifp, struct mbuf sp.sp_len = pktsize; sp.sp_sec = tv.tv_sec; sp.sp_usec = tv.tv_usec; - sp.sp_sender = sc->sc_uuid; + sp.sp_sender = sc->sc_uid; bpf_mtap(ifp, m0, BPF_D_OUT); @@ -798,7 +798,7 @@ shmif_rcv(void *arg) * Test if we want to pass the packet upwards */ eth = mtod(m, struct ether_header *); - if (sp.sp_sender == sc->sc_uuid) { + if (sp.sp_sender == sc->sc_uid) { passup = false; } else if (memcmp(eth->ether_dhost, CLLADDR(ifp->if_sadl), ETHER_ADDR_LEN) == 0) {
CVS commit: src/sys/rump/net/lib/libshmif
Module Name:src Committed By: ozaki-r Date: Tue Feb 25 03:24:48 UTC 2020 Modified Files: src/sys/rump/net/lib/libshmif: if_shmem.c Log Message: shmif: use cprng_strong64 instead of cprng_fast64 to generate a unique ID shmif uses random bytes generated by cprng(9) as a unique device ID between rump kernels to identify packets fed by itself and not receive them. So if generated bytes are identical between shmif interfaces on different rump kernels, shmif may drop incoming packets unintentionally. This is one cause of recent ATF test failures of IPsec. Fix it by using cprng_strong64 instead of cprng_fast64. This is a workaround and we should also investigate why cprng_fast64 starts failing on rump kernels, although using cprng_strong64 in initialization itself is feasible. Fix PR kern/54897 To generate a diff of this commit: cvs rdiff -u -r1.78 -r1.79 src/sys/rump/net/lib/libshmif/if_shmem.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/rump/net/lib/libshmif/if_shmem.c diff -u src/sys/rump/net/lib/libshmif/if_shmem.c:1.78 src/sys/rump/net/lib/libshmif/if_shmem.c:1.79 --- src/sys/rump/net/lib/libshmif/if_shmem.c:1.78 Thu Feb 20 08:06:15 2020 +++ src/sys/rump/net/lib/libshmif/if_shmem.c Tue Feb 25 03:24:48 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: if_shmem.c,v 1.78 2020/02/20 08:06:15 ozaki-r Exp $ */ +/* $NetBSD: if_shmem.c,v 1.79 2020/02/25 03:24:48 ozaki-r Exp $ */ /* * Copyright (c) 2009, 2010 Antti Kantee. All Rights Reserved. @@ -28,7 +28,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: if_shmem.c,v 1.78 2020/02/20 08:06:15 ozaki-r Exp $"); +__KERNEL_RCSID(0, "$NetBSD: if_shmem.c,v 1.79 2020/02/25 03:24:48 ozaki-r Exp $"); #include #include @@ -172,7 +172,7 @@ allocif(int unit, struct shmif_sc **scp) sc = kmem_zalloc(sizeof(*sc), KM_SLEEP); sc->sc_memfd = -1; sc->sc_unit = unit; - sc->sc_uuid = cprng_fast64(); + sc->sc_uuid = cprng_strong64(); ifp = &sc->sc_ec.ec_if;
CVS commit: src/sys/arch/powerpc/powerpc
Module Name:src Committed By: rin Date: Tue Feb 25 00:42:12 UTC 2020 Modified Files: src/sys/arch/powerpc/powerpc: locore_subr.S trap.c Log Message: Comment out do_ucas_32(), only user of which, _ucas_32(), is commented out since powerpc/trap.c rev 1.156: http://cvsweb.netbsd.org/bsdweb.cgi/src/sys/arch/powerpc/powerpc/trap.c#rev1.156 To generate a diff of this commit: cvs rdiff -u -r1.59 -r1.60 src/sys/arch/powerpc/powerpc/locore_subr.S cvs rdiff -u -r1.156 -r1.157 src/sys/arch/powerpc/powerpc/trap.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/powerpc/powerpc/locore_subr.S diff -u src/sys/arch/powerpc/powerpc/locore_subr.S:1.59 src/sys/arch/powerpc/powerpc/locore_subr.S:1.60 --- src/sys/arch/powerpc/powerpc/locore_subr.S:1.59 Wed Jan 8 20:59:19 2020 +++ src/sys/arch/powerpc/powerpc/locore_subr.S Tue Feb 25 00:42:12 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: locore_subr.S,v 1.59 2020/01/08 20:59:19 skrll Exp $ */ +/* $NetBSD: locore_subr.S,v 1.60 2020/02/25 00:42:12 rin Exp $ */ /* * Copyright (c) 2001 Wasabi Systems, Inc. @@ -570,6 +570,7 @@ ENTRY(cpu_spinstart) #endif /*MULTIPROCESSOR + OEA*/ +#if 0 /* XXX CPU configuration spaghetti */ /* * int do_ucas_32(uint32_t *uptr, uint32_t old, uint32_t new, uint32_t *ret); */ @@ -585,3 +586,4 @@ ENTRY(do_ucas_32) li %r3,0 stw %r10,0(%r6) blr +#endif Index: src/sys/arch/powerpc/powerpc/trap.c diff -u src/sys/arch/powerpc/powerpc/trap.c:1.156 src/sys/arch/powerpc/powerpc/trap.c:1.157 --- src/sys/arch/powerpc/powerpc/trap.c:1.156 Sun Apr 7 05:25:56 2019 +++ src/sys/arch/powerpc/powerpc/trap.c Tue Feb 25 00:42:12 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: trap.c,v 1.156 2019/04/07 05:25:56 thorpej Exp $ */ +/* $NetBSD: trap.c,v 1.157 2020/02/25 00:42:12 rin Exp $ */ /* * Copyright (C) 1995, 1996 Wolfgang Solfrank. @@ -32,7 +32,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: trap.c,v 1.156 2019/04/07 05:25:56 thorpej Exp $"); +__KERNEL_RCSID(0, "$NetBSD: trap.c,v 1.157 2020/02/25 00:42:12 rin Exp $"); #include "opt_altivec.h" #include "opt_ddb.h" @@ -72,8 +72,6 @@ static int fix_unaligned(struct lwp *, s static inline vaddr_t setusr(vaddr_t, size_t *); static inline void unsetusr(void); -extern int do_ucas_32(volatile int32_t *, int32_t, int32_t, int32_t *); - void trap(struct trapframe *); /* Called from locore / trap_subr */ /* Why are these not defined in a header? */ int badaddr(void *, size_t); @@ -686,6 +684,7 @@ kcopy(const void *src, void *dst, size_t int _ucas_32(volatile uint32_t *uptr, uint32_t old, uint32_t new, uint32_t *ret) { + extern int do_ucas_32(volatile int32_t *, int32_t, int32_t, int32_t *); vaddr_t uva = (vaddr_t)uptr; vaddr_t p; struct faultbuf env;
CVS commit: src/tests/lib/libc/sys
Module Name:src Committed By: kamil Date: Mon Feb 24 23:46:45 UTC 2020 Modified Files: src/tests/lib/libc/sys: t_ptrace_wait.c Log Message: Add new test in t_ptrace_wait* New test: syscall_killed_on_sce Test passes correctly. To generate a diff of this commit: cvs rdiff -u -r1.165 -r1.166 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.165 src/tests/lib/libc/sys/t_ptrace_wait.c:1.166 --- src/tests/lib/libc/sys/t_ptrace_wait.c:1.165 Sat Feb 22 19:44:07 2020 +++ src/tests/lib/libc/sys/t_ptrace_wait.c Mon Feb 24 23:46:45 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: t_ptrace_wait.c,v 1.165 2020/02/22 19:44:07 kamil Exp $ */ +/* $NetBSD: t_ptrace_wait.c,v 1.166 2020/02/24 23:46:45 kamil Exp $ */ /*- * Copyright (c) 2016, 2017, 2018, 2019 The NetBSD Foundation, Inc. @@ -27,7 +27,7 @@ */ #include -__RCSID("$NetBSD: t_ptrace_wait.c,v 1.165 2020/02/22 19:44:07 kamil Exp $"); +__RCSID("$NetBSD: t_ptrace_wait.c,v 1.166 2020/02/24 23:46:45 kamil Exp $"); #define __LEGACY_PT_LWPINFO @@ -7458,14 +7458,8 @@ ATF_TC_BODY(resume, tc) /// -ATF_TC(syscall1); -ATF_TC_HEAD(syscall1, tc) -{ - atf_tc_set_md_var(tc, "descr", - "Verify that getpid(2) can be traced with PT_SYSCALL"); -} - -ATF_TC_BODY(syscall1, tc) +static void +syscall_body(bool killed) { const int exitval = 5; const int sigval = SIGSTOP; @@ -7514,36 +7508,69 @@ ATF_TC_BODY(syscall1, tc) ATF_REQUIRE_EQ(info.psi_siginfo.si_signo, SIGTRAP); ATF_REQUIRE_EQ(info.psi_siginfo.si_code, TRAP_SCE); - DPRINTF("Before resuming the child process where it left off and " - "without signal to be sent\n"); - SYSCALL_REQUIRE(ptrace(PT_SYSCALL, child, (void *)1, 0) != -1); + if (killed) { + SYSCALL_REQUIRE(ptrace(PT_KILL, child, NULL, 0) != -1); - DPRINTF("Before calling %s() for the child\n", TWAIT_FNAME); - TWAIT_REQUIRE_SUCCESS(wpid = TWAIT_GENERIC(child, &status, 0), 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, SIGTRAP); + validate_status_signaled(status, SIGKILL, 0); + } else { + DPRINTF("Before resuming the child process where it left off " + "and without signal to be sent\n"); + SYSCALL_REQUIRE(ptrace(PT_SYSCALL, child, (void *)1, 0) != -1); - DPRINTF("Before calling ptrace(2) with PT_GET_SIGINFO for child\n"); - SYSCALL_REQUIRE(ptrace(PT_GET_SIGINFO, child, &info, sizeof(info)) != -1); + DPRINTF("Before calling %s() for the child\n", TWAIT_FNAME); + TWAIT_REQUIRE_SUCCESS( + wpid = TWAIT_GENERIC(child, &status, 0), child); - DPRINTF("Before checking siginfo_t and lwpid\n"); - ATF_REQUIRE_EQ(info.psi_lwpid, 1); - ATF_REQUIRE_EQ(info.psi_siginfo.si_signo, SIGTRAP); - ATF_REQUIRE_EQ(info.psi_siginfo.si_code, TRAP_SCX); + validate_status_stopped(status, SIGTRAP); - 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 ptrace(2) with PT_GET_SIGINFO for " + "child\n"); + SYSCALL_REQUIRE( + ptrace(PT_GET_SIGINFO, child, &info, sizeof(info)) != -1); - DPRINTF("Before calling %s() for the child\n", TWAIT_FNAME); - TWAIT_REQUIRE_SUCCESS(wpid = TWAIT_GENERIC(child, &status, 0), child); + DPRINTF("Before checking siginfo_t and lwpid\n"); + ATF_REQUIRE_EQ(info.psi_lwpid, 1); + ATF_REQUIRE_EQ(info.psi_siginfo.si_signo, SIGTRAP); + ATF_REQUIRE_EQ(info.psi_siginfo.si_code, TRAP_SCX); + + 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); + } - 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)); } +#define SYSCALL_TEST(name,killed) \ +ATF_TC(name);\ +ATF_TC_HEAD(name, tc) \ +{ \ + atf_tc_set_md_var(tc, "descr", \ + "Verify that getpid(2) can be traced with PT_SYSCALL %s", \ + killed ? "and killed on syscall entry" : "" ); \ +} \ + \ +ATF_TC_BODY(name, tc) \ +{ \ + \ + syscall_body(killed); \ +} + +SYSCALL_TEST(syscall, false) +SYSCALL_TEST(syscall_killed_on_sce, true) + /// ATF_TC(syscallemu1); @@ -9532,7 +9559,8 @@ ATF
CVS commit: src/sys/uvm
Module Name:src Committed By: ad Date: Mon Feb 24 21:06:11 UTC 2020 Modified Files: src/sys/uvm: uvm_loan.c Log Message: uvm_unloanpage(): fix a screwup in previous. slock must be set NULL if it can't be acquired. To generate a diff of this commit: cvs rdiff -u -r1.95 -r1.96 src/sys/uvm/uvm_loan.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/uvm/uvm_loan.c diff -u src/sys/uvm/uvm_loan.c:1.95 src/sys/uvm/uvm_loan.c:1.96 --- src/sys/uvm/uvm_loan.c:1.95 Sun Feb 23 15:46:43 2020 +++ src/sys/uvm/uvm_loan.c Mon Feb 24 21:06:11 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: uvm_loan.c,v 1.95 2020/02/23 15:46:43 ad Exp $ */ +/* $NetBSD: uvm_loan.c,v 1.96 2020/02/24 21:06:11 ad Exp $ */ /* * Copyright (c) 1997 Charles D. Cranor and Washington University. @@ -32,7 +32,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: uvm_loan.c,v 1.95 2020/02/23 15:46:43 ad Exp $"); +__KERNEL_RCSID(0, "$NetBSD: uvm_loan.c,v 1.96 2020/02/24 21:06:11 ad Exp $"); #include #include @@ -988,6 +988,7 @@ uvm_unloanpage(struct vm_page **ploans, } /* XXX Better than yielding but inadequate. */ kpause("livelock", false, 1, &pg->interlock); + slock = NULL; } /* @@ -1015,7 +1016,9 @@ uvm_unloanpage(struct vm_page **ploans, KASSERT((pg->flags & PG_BUSY) == 0); uvm_pagefree(pg); } - rw_exit(slock); + if (slock != NULL) { + rw_exit(slock); + } } }
CVS commit: src/sys/coda
Module Name:src Committed By: ad Date: Mon Feb 24 20:53:11 UTC 2020 Modified Files: src/sys/coda: coda_vnops.c Log Message: v_interlock -> vmobjloc To generate a diff of this commit: cvs rdiff -u -r1.109 -r1.110 src/sys/coda/coda_vnops.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/coda/coda_vnops.c diff -u src/sys/coda/coda_vnops.c:1.109 src/sys/coda/coda_vnops.c:1.110 --- src/sys/coda/coda_vnops.c:1.109 Sun Feb 23 15:46:39 2020 +++ src/sys/coda/coda_vnops.c Mon Feb 24 20:53:11 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: coda_vnops.c,v 1.109 2020/02/23 15:46:39 ad Exp $ */ +/* $NetBSD: coda_vnops.c,v 1.110 2020/02/24 20:53:11 ad Exp $ */ /* * @@ -46,7 +46,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: coda_vnops.c,v 1.109 2020/02/23 15:46:39 ad Exp $"); +__KERNEL_RCSID(0, "$NetBSD: coda_vnops.c,v 1.110 2020/02/24 20:53:11 ad Exp $"); #include #include @@ -1889,6 +1889,7 @@ coda_getpages(void *v) int error, cerror; int waslocked; /* 1 if vnode lock was held on entry */ int didopen = 0; /* 1 if we opened container file */ + krw_t op; /* * Handle a case that uvm_fault doesn't quite use yet. @@ -1898,7 +1899,7 @@ coda_getpages(void *v) return EBUSY; } - KASSERT(mutex_owned(vp->v_interlock)); + KASSERT(rw_lock_held(vp->v_uobj.vmobjlock)); /* Check for control object. */ if (IS_CTL_VP(vp)) { @@ -1917,6 +1918,7 @@ coda_getpages(void *v) * mechanism. */ /* XXX VOP_ISLOCKED() may not be used for lock decisions. */ + op = rw_lock_op(vp->v_uobj.vmobjlock); waslocked = VOP_ISLOCKED(vp); /* Get container file if not already present. */ @@ -1928,7 +1930,7 @@ coda_getpages(void *v) * leave it in the same state on exit. */ if (waslocked == 0) { - mutex_exit(vp->v_interlock); + rw_exit(vp->v_uobj.vmobjlock); cerror = vn_lock(vp, LK_EXCLUSIVE); if (cerror) { #ifdef CODA_VERBOSE @@ -1966,12 +1968,12 @@ coda_getpages(void *v) cvp = cp->c_ovp; didopen = 1; if (waslocked == 0) - mutex_enter(vp->v_interlock); + rw_enter(vp->v_uobj.vmobjlock, op); } KASSERT(cvp != NULL); /* Munge the arg structure to refer to the container vnode. */ - KASSERT(cvp->v_interlock == vp->v_interlock); + KASSERT(cvp->v_uobj.vmobjlock == vp->v_uobj.vmobjlock); ap->a_vp = cp->c_ovp; /* Finally, call getpages on it. */ @@ -2015,11 +2017,11 @@ coda_putpages(void *v) struct cnode *cp = VTOC(vp); int error; - KASSERT(mutex_owned(vp->v_interlock)); + KASSERT(rw_write_held(vp->v_uobj.vmobjlock)); /* Check for control object. */ if (IS_CTL_VP(vp)) { - mutex_exit(vp->v_interlock); + rw_exit(vp->v_uobj.vmobjlock); #ifdef CODA_VERBOSE printf("%s: control object %p\n", __func__, vp); #endif @@ -2034,12 +2036,12 @@ coda_putpages(void *v) */ cvp = cp->c_ovp; if (cvp == NULL) { - mutex_exit(vp->v_interlock); + rw_exit(vp->v_uobj.vmobjlock); return 0; } /* Munge the arg structure to refer to the container vnode. */ - KASSERT(cvp->v_interlock == vp->v_interlock); + KASSERT(cvp->v_uobj.vmobjlock == vp->v_uobj.vmobjlock); ap->a_vp = cvp; /* Finally, call putpages on it. */
CVS commit: src/sys/miscfs/genfs
Module Name:src Committed By: ad Date: Mon Feb 24 20:49:51 UTC 2020 Modified Files: src/sys/miscfs/genfs: genfs_io.c Log Message: v_interlock -> vmobjlock To generate a diff of this commit: cvs rdiff -u -r1.86 -r1.87 src/sys/miscfs/genfs/genfs_io.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/miscfs/genfs/genfs_io.c diff -u src/sys/miscfs/genfs/genfs_io.c:1.86 src/sys/miscfs/genfs/genfs_io.c:1.87 --- src/sys/miscfs/genfs/genfs_io.c:1.86 Sun Feb 23 15:46:41 2020 +++ src/sys/miscfs/genfs/genfs_io.c Mon Feb 24 20:49:51 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: genfs_io.c,v 1.86 2020/02/23 15:46:41 ad Exp $ */ +/* $NetBSD: genfs_io.c,v 1.87 2020/02/24 20:49:51 ad Exp $ */ /* * Copyright (c) 1982, 1986, 1989, 1993 @@ -31,7 +31,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: genfs_io.c,v 1.86 2020/02/23 15:46:41 ad Exp $"); +__KERNEL_RCSID(0, "$NetBSD: genfs_io.c,v 1.87 2020/02/24 20:49:51 ad Exp $"); #include #include @@ -1916,7 +1916,7 @@ genfs_do_directio(struct vmspace *vs, va spoff = trunc_page(off); epoff = round_page(off + len); - mutex_enter(vp->v_interlock); + rw_enter(vp->v_uobj.vmobjlock, RW_WRITER); error = VOP_PUTPAGES(vp, spoff, epoff, pgoflags); if (error) { return error;
CVS commit: src/sys/kern
Module Name:src Committed By: jdolecek Date: Mon Feb 24 20:47:47 UTC 2020 Modified Files: src/sys/kern: init_main.c Log Message: move config_init_mi() call before vfsinit(), which can trigger loading of VFS modules fixes crash with LOCKDEBUG due to uninitialized mutex when zfs module is loaded in boot, because zfs's spa_init() calls config_mountroot() which now requires the config init having been done To generate a diff of this commit: cvs rdiff -u -r1.521 -r1.522 src/sys/kern/init_main.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/init_main.c diff -u src/sys/kern/init_main.c:1.521 src/sys/kern/init_main.c:1.522 --- src/sys/kern/init_main.c:1.521 Tue Feb 18 20:23:17 2020 +++ src/sys/kern/init_main.c Mon Feb 24 20:47:47 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: init_main.c,v 1.521 2020/02/18 20:23:17 chs Exp $ */ +/* $NetBSD: init_main.c,v 1.522 2020/02/24 20:47:47 jdolecek Exp $ */ /*- * Copyright (c) 2008, 2009, 2019 The NetBSD Foundation, Inc. @@ -97,7 +97,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: init_main.c,v 1.521 2020/02/18 20:23:17 chs Exp $"); +__KERNEL_RCSID(0, "$NetBSD: init_main.c,v 1.522 2020/02/24 20:47:47 jdolecek Exp $"); #include "opt_ddb.h" #include "opt_inet.h" @@ -466,6 +466,9 @@ main(void) /* Second part of module system initialization. */ module_start_unload_thread(); + /* Initialize autoconf data structures before any modules are loaded */ + config_init_mi(); + /* Initialize the file systems. */ #ifdef NVNODE_IMPLICIT /* @@ -743,8 +746,6 @@ static void configure(void) { - /* Initialize autoconf data structures. */ - config_init_mi(); /* * XXX * callout_setfunc() requires mutex(9) so it can't be in config_init()
CVS commit: src/sys/miscfs/procfs
Module Name:src Committed By: ad Date: Mon Feb 24 20:47:41 UTC 2020 Modified Files: src/sys/miscfs/procfs: procfs_vnops.c Log Message: v_interlock -> vmobjlock To generate a diff of this commit: cvs rdiff -u -r1.209 -r1.210 src/sys/miscfs/procfs/procfs_vnops.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/miscfs/procfs/procfs_vnops.c diff -u src/sys/miscfs/procfs/procfs_vnops.c:1.209 src/sys/miscfs/procfs/procfs_vnops.c:1.210 --- src/sys/miscfs/procfs/procfs_vnops.c:1.209 Sun Feb 23 22:14:04 2020 +++ src/sys/miscfs/procfs/procfs_vnops.c Mon Feb 24 20:47:41 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: procfs_vnops.c,v 1.209 2020/02/23 22:14:04 ad Exp $ */ +/* $NetBSD: procfs_vnops.c,v 1.210 2020/02/24 20:47:41 ad Exp $ */ /*- * Copyright (c) 2006, 2007, 2008, 2020 The NetBSD Foundation, Inc. @@ -105,7 +105,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: procfs_vnops.c,v 1.209 2020/02/23 22:14:04 ad Exp $"); +__KERNEL_RCSID(0, "$NetBSD: procfs_vnops.c,v 1.210 2020/02/24 20:47:41 ad Exp $"); #include #include @@ -1739,7 +1739,7 @@ procfs_getpages(void *v) } */ *ap = v; if ((ap->a_flags & PGO_LOCKED) == 0) - mutex_exit(ap->a_vp->v_interlock); + rw_exit(ap->a_vp->v_uobj.vmobjlock); return (EFAULT); }
CVS commit: src/sys/miscfs/kernfs
Module Name:src Committed By: ad Date: Mon Feb 24 20:44:25 UTC 2020 Modified Files: src/sys/miscfs/kernfs: kernfs_vnops.c Log Message: v_interlock -> vmobjlock To generate a diff of this commit: cvs rdiff -u -r1.163 -r1.164 src/sys/miscfs/kernfs/kernfs_vnops.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/miscfs/kernfs/kernfs_vnops.c diff -u src/sys/miscfs/kernfs/kernfs_vnops.c:1.163 src/sys/miscfs/kernfs/kernfs_vnops.c:1.164 --- src/sys/miscfs/kernfs/kernfs_vnops.c:1.163 Tue Feb 4 04:19:24 2020 +++ src/sys/miscfs/kernfs/kernfs_vnops.c Mon Feb 24 20:44:25 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: kernfs_vnops.c,v 1.163 2020/02/04 04:19:24 riastradh Exp $ */ +/* $NetBSD: kernfs_vnops.c,v 1.164 2020/02/24 20:44:25 ad Exp $ */ /* * Copyright (c) 1992, 1993 @@ -39,7 +39,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: kernfs_vnops.c,v 1.163 2020/02/04 04:19:24 riastradh Exp $"); +__KERNEL_RCSID(0, "$NetBSD: kernfs_vnops.c,v 1.164 2020/02/24 20:44:25 ad Exp $"); #include #include @@ -1229,7 +1229,7 @@ kernfs_getpages(void *v) } */ *ap = v; if ((ap->a_flags & PGO_LOCKED) == 0) - mutex_exit(ap->a_vp->v_interlock); + rw_exit(ap->a_vp->v_uobj.vmobjlock); return (EFAULT); }
CVS commit: src/sys/arch/hppa
Module Name:src Committed By: ad Date: Mon Feb 24 20:42:18 UTC 2020 Modified Files: src/sys/arch/hppa/hppa: pmap.c src/sys/arch/hppa/include: pmap.h Log Message: Adjust for UVM locking changes. To generate a diff of this commit: cvs rdiff -u -r1.103 -r1.104 src/sys/arch/hppa/hppa/pmap.c cvs rdiff -u -r1.38 -r1.39 src/sys/arch/hppa/include/pmap.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/hppa/hppa/pmap.c diff -u src/sys/arch/hppa/hppa/pmap.c:1.103 src/sys/arch/hppa/hppa/pmap.c:1.104 --- src/sys/arch/hppa/hppa/pmap.c:1.103 Sun Feb 23 15:46:39 2020 +++ src/sys/arch/hppa/hppa/pmap.c Mon Feb 24 20:42:18 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: pmap.c,v 1.103 2020/02/23 15:46:39 ad Exp $ */ +/* $NetBSD: pmap.c,v 1.104 2020/02/24 20:42:18 ad Exp $ */ /*- * Copyright (c) 2001, 2002 The NetBSD Foundation, Inc. @@ -65,7 +65,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.103 2020/02/23 15:46:39 ad Exp $"); +__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.104 2020/02/24 20:42:18 ad Exp $"); #include "opt_cputype.h" @@ -74,6 +74,7 @@ __KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.1 #include #include #include +#include #include #include @@ -237,16 +238,16 @@ void pmap_dump_pv(paddr_t); #define pmap_pvh_attrs(a) \ (((a) & (PVF_MOD|PVF_REF)) ^ PVF_REF) -#define PMAP_LOCK(pm) \ - do { \ - if ((pm) != pmap_kernel()) \ - mutex_enter((pm)->pm_lock); \ +#define PMAP_LOCK(pm) \ + do { \ + if ((pm) != pmap_kernel()) \ + rw_enter((pm)->pm_lock, RW_WRITER); \ } while (/*CONSTCOND*/0) -#define PMAP_UNLOCK(pm) \ - do { \ - if ((pm) != pmap_kernel()) \ - mutex_exit((pm)->pm_lock); \ +#define PMAP_UNLOCK(pm) \ + do { \ + if ((pm) != pmap_kernel()) \ + rw_exit((pm)->pm_lock); \ } while (/*CONSTCOND*/0) struct vm_page * @@ -346,7 +347,7 @@ pmap_pde_alloc(pmap_t pm, vaddr_t va, st ("%s(%p, 0x%lx, %p)\n", __func__, pm, va, pdep)); KASSERT(pm != pmap_kernel()); - KASSERT(mutex_owned(pm->pm_lock)); + KASSERT(rw_write_held(pm->pm_lock)); pg = pmap_pagealloc(&pm->pm_obj, va); @@ -694,7 +695,7 @@ pmap_bootstrap(vaddr_t vstart) kpm = pmap_kernel(); memset(kpm, 0, sizeof(*kpm)); - mutex_init(&kpm->pm_obj_lock, MUTEX_DEFAULT, IPL_NONE); + rw_init(&kpm->pm_obj_lock); uvm_obj_init(&kpm->pm_obj, NULL, false, 1); uvm_obj_setlock(&kpm->pm_obj, &kpm->pm_obj_lock); @@ -1057,7 +1058,7 @@ pmap_create(void) DPRINTF(PDB_FOLLOW|PDB_PMAP, ("%s: pmap = %p\n", __func__, pmap)); - mutex_init(&pmap->pm_obj_lock, MUTEX_DEFAULT, IPL_NONE); + rw_init(&pmap->pm_obj_lock); uvm_obj_init(&pmap->pm_obj, NULL, false, 1); uvm_obj_setlock(&pmap->pm_obj, &pmap->pm_obj_lock); @@ -1110,9 +,9 @@ pmap_destroy(pmap_t pmap) DPRINTF(PDB_FOLLOW|PDB_PMAP, ("%s(%p)\n", __func__, pmap)); - mutex_enter(pmap->pm_lock); + rw_enter(pmap->pm_lock, RW_WRITER); refs = --pmap->pm_obj.uo_refs; - mutex_exit(pmap->pm_lock); + rw_exit(pmap->pm_lock); if (refs > 0) return; @@ -1120,7 +1121,7 @@ pmap_destroy(pmap_t pmap) #ifdef DIAGNOSTIC uvm_page_array_init(&a); off = 0; - mutex_enter(pmap->pm_lock); + rw_enter(pmap->pm_lock, RW_WRITER); while ((pg = uvm_page_array_fill_and_peek(&a, &pmap->pm_obj, off, 0, 0)) != NULL) { pt_entry_t *pde, *epde; @@ -1161,16 +1162,16 @@ pmap_destroy(pmap_t pmap) } DPRINTF(PDB_FOLLOW, ("\n")); } - mutex_exit(pmap->pm_lock); + rw_exit(pmap->pm_lock); uvm_page_array_fini(&a); #endif pmap_sdir_set(pmap->pm_space, 0); - mutex_enter(pmap->pm_lock); + rw_enter(pmap->pm_lock, RW_WRITER); pmap_pagefree(pmap->pm_pdir_pg); - mutex_exit(pmap->pm_lock); + rw_exit(pmap->pm_lock); uvm_obj_destroy(&pmap->pm_obj, false); - mutex_destroy(&pmap->pm_obj_lock); + rw_destroy(&pmap->pm_obj_lock); pool_put(&pmap_pool, pmap); } @@ -1183,9 +1184,9 @@ pmap_reference(pmap_t pmap) DPRINTF(PDB_FOLLOW|PDB_PMAP, ("%s(%p)\n", __func__, pmap)); - mutex_enter(pmap->pm_lock); + rw_enter(pmap->pm_lock, RW_WRITER); pmap->pm_obj.uo_refs++; - mutex_exit(pmap->pm_lock); + rw_exit(pmap->pm_lock); } Index: src/sys/arch/hppa/include/pmap.h diff -u src/sys/arch/hppa/include/pmap.h:1.38 src/sys/arch/hppa/include/pmap.h:1.39 --- src/sys/arch/hppa/include/pmap.h:1.38 Mon Aug 12 09:18:30 2019 +++ src/sys/arch/hppa/include/pmap.h Mon Feb 24 20:42:18 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: pmap.h,v 1.38 2019/08/12 09:18:30 skrll Exp $ */ +/* $NetBSD: pmap.h,v 1.39 2020/02/24 20:42:18 ad Exp $ */ /* $OpenBSD: pmap.h,v 1.35 2007/12/14 18:32:23 deraadt Exp $ */ @@ -39,7 +39,7 @@ #include "opt_cputype.h" #endif -#include +#include #include #include @@ -53,7 +53,7 @@ struct pmap { struct uvm_object pm_obj; /* object (lck by object lock) */ #define pm_lock pm_obj.vmobjlock - kmutex_t pm_obj_lock; /* lock for pm_obj */ + krwlock_t pm_obj_lock; /* lock for pm_obj */ str
CVS commit: src/sys/arch/arm
Module Name:src Committed By: ad Date: Mon Feb 24 20:31:56 UTC 2020 Modified Files: src/sys/arch/arm/arm32: pmap.c src/sys/arch/arm/include/arm32: pmap.h Log Message: Adjust for UVM locking changes To generate a diff of this commit: cvs rdiff -u -r1.393 -r1.394 src/sys/arch/arm/arm32/pmap.c cvs rdiff -u -r1.162 -r1.163 src/sys/arch/arm/include/arm32/pmap.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/arm/arm32/pmap.c diff -u src/sys/arch/arm/arm32/pmap.c:1.393 src/sys/arch/arm/arm32/pmap.c:1.394 --- src/sys/arch/arm/arm32/pmap.c:1.393 Sun Feb 23 10:22:07 2020 +++ src/sys/arch/arm/arm32/pmap.c Mon Feb 24 20:31:56 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: pmap.c,v 1.393 2020/02/23 10:22:07 skrll Exp $ */ +/* $NetBSD: pmap.c,v 1.394 2020/02/24 20:31:56 ad Exp $ */ /* * Copyright 2003 Wasabi Systems, Inc. @@ -198,8 +198,9 @@ #endif #include -__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.393 2020/02/23 10:22:07 skrll Exp $"); +__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.394 2020/02/24 20:31:56 ad Exp $"); +#include #include #include #include @@ -548,7 +549,7 @@ pmap_acquire_pmap_lock(pmap_t pm) return; #endif - mutex_enter(pm->pm_lock); + mutex_enter(&pm->pm_lock); } static inline void @@ -558,7 +559,7 @@ pmap_release_pmap_lock(pmap_t pm) if (__predict_false(db_onproc != NULL)) return; #endif - mutex_exit(pm->pm_lock); + mutex_exit(&pm->pm_lock); } static inline void @@ -3026,10 +3027,9 @@ pmap_create(void) pm = pool_cache_get(&pmap_cache, PR_WAITOK); - mutex_init(&pm->pm_obj_lock, MUTEX_DEFAULT, IPL_NONE); - uvm_obj_init(&pm->pm_obj, NULL, false, 1); - uvm_obj_setlock(&pm->pm_obj, &pm->pm_obj_lock); + mutex_init(&pm->pm_lock, MUTEX_DEFAULT, IPL_NONE); + pm->pm_refs = 1; pm->pm_stats.wired_count = 0; pm->pm_stats.resident_count = 1; #ifdef ARM_MMU_EXTENDED @@ -5219,8 +5219,6 @@ pmap_destroy(pmap_t pm) { UVMHIST_FUNC(__func__); UVMHIST_CALLED(maphist); - u_int count; - if (pm == NULL) return; @@ -5239,10 +5237,7 @@ pmap_destroy(pmap_t pm) /* * Drop reference count */ - mutex_enter(pm->pm_lock); - count = --pm->pm_obj.uo_refs; - mutex_exit(pm->pm_lock); - if (count > 0) { + if (atomic_dec_uint_nv(&pm->pm_refs) > 0) { #ifndef ARM_MMU_EXTENDED if (pmap_is_current(pm)) { if (pm != pmap_kernel()) @@ -5280,8 +5275,7 @@ pmap_destroy(pmap_t pm) ci->ci_pmap_lastuser = NULL; #endif - uvm_obj_destroy(&pm->pm_obj, false); - mutex_destroy(&pm->pm_obj_lock); + mutex_destroy(&pm->pm_lock); pool_cache_put(&pmap_cache, pm); UVMHIST_LOG(maphist, " <-- done", 0, 0, 0, 0); } @@ -5303,9 +5297,7 @@ pmap_reference(pmap_t pm) pmap_use_l1(pm); #endif - mutex_enter(pm->pm_lock); - pm->pm_obj.uo_refs++; - mutex_exit(pm->pm_lock); + atomic_inc_uint(&pm->pm_refs); } #if (ARM_MMU_V6 + ARM_MMU_V7) > 0 @@ -6209,9 +6201,8 @@ pmap_bootstrap(vaddr_t vstart, vaddr_t v */ mutex_init(&pmap_lock, MUTEX_DEFAULT, IPL_VM); mutex_init(&kpm_lock, MUTEX_DEFAULT, IPL_NONE); - mutex_init(&pm->pm_obj_lock, MUTEX_DEFAULT, IPL_VM); - uvm_obj_init(&pm->pm_obj, NULL, false, 1); - uvm_obj_setlock(&pm->pm_obj, &pm->pm_obj_lock); + mutex_init(&pm->pm_lock, MUTEX_DEFAULT, IPL_VM); + pm->pm_refs = 1; VPRINTF("l1pt "); /* Index: src/sys/arch/arm/include/arm32/pmap.h diff -u src/sys/arch/arm/include/arm32/pmap.h:1.162 src/sys/arch/arm/include/arm32/pmap.h:1.163 --- src/sys/arch/arm/include/arm32/pmap.h:1.162 Sun Feb 23 15:12:18 2020 +++ src/sys/arch/arm/include/arm32/pmap.h Mon Feb 24 20:31:56 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: pmap.h,v 1.162 2020/02/23 15:12:18 skrll Exp $ */ +/* $NetBSD: pmap.h,v 1.163 2020/02/24 20:31:56 ad Exp $ */ /* * Copyright (c) 2002, 2003 Wasabi Systems, Inc. @@ -229,9 +229,8 @@ struct pmap_devmap { * The pmap structure itself */ struct pmap { - struct uvm_object pm_obj; - kmutex_t pm_obj_lock; -#define pm_lock pm_obj.vmobjlock + kmutex_t pm_lock; + u_int pm_refs; #ifndef ARM_HAS_VBAR pd_entry_t *pm_pl1vec; pd_entry_t pm_l1vec;
CVS commit: src/sys/nfs
Module Name:src Committed By: ad Date: Mon Feb 24 20:18:53 UTC 2020 Modified Files: src/sys/nfs: nfs_subs.c Log Message: v_interlock -> vmobjlock To generate a diff of this commit: cvs rdiff -u -r1.236 -r1.237 src/sys/nfs/nfs_subs.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/nfs/nfs_subs.c diff -u src/sys/nfs/nfs_subs.c:1.236 src/sys/nfs/nfs_subs.c:1.237 --- src/sys/nfs/nfs_subs.c:1.236 Sun Dec 15 21:11:34 2019 +++ src/sys/nfs/nfs_subs.c Mon Feb 24 20:18:53 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: nfs_subs.c,v 1.236 2019/12/15 21:11:34 ad Exp $ */ +/* $NetBSD: nfs_subs.c,v 1.237 2020/02/24 20:18:53 ad Exp $ */ /* * Copyright (c) 1989, 1993 @@ -70,7 +70,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: nfs_subs.c,v 1.236 2019/12/15 21:11:34 ad Exp $"); +__KERNEL_RCSID(0, "$NetBSD: nfs_subs.c,v 1.237 2020/02/24 20:18:53 ad Exp $"); #ifdef _KERNEL_OPT #include "opt_nfs.h" @@ -1751,28 +1751,13 @@ nfs_clearcommit_selector(void *cl, struc { struct nfs_clearcommit_ctx *c = cl; struct nfsnode *np; - struct vm_page *pg; - struct uvm_page_array a; - voff_t off; KASSERT(mutex_owned(vp->v_interlock)); + /* XXXAD mountpoint check looks like nonsense to me */ np = VTONFS(vp); if (vp->v_type != VREG || vp->v_mount != c->mp || np == NULL) return false; - np->n_pushlo = np->n_pushhi = np->n_pushedlo = - np->n_pushedhi = 0; - np->n_commitflags &= - ~(NFS_COMMIT_PUSH_VALID | NFS_COMMIT_PUSHED_VALID); - uvm_page_array_init(&a); - off = 0; - while ((pg = uvm_page_array_fill_and_peek(&a, &vp->v_uobj, off, - 0, 0)) != NULL) { - pg->flags &= ~PG_NEEDCOMMIT; - uvm_page_array_advance(&a); - off = pg->offset + PAGE_SIZE; - } - uvm_page_array_fini(&a); return false; } @@ -1786,15 +1771,41 @@ nfs_clearcommit_selector(void *cl, struc void nfs_clearcommit(struct mount *mp) { - struct vnode *vp __diagused; + struct vnode *vp; struct vnode_iterator *marker; struct nfsmount *nmp = VFSTONFS(mp); struct nfs_clearcommit_ctx ctx; + struct nfsnode *np; + struct vm_page *pg; + struct uvm_page_array a; + voff_t off; rw_enter(&nmp->nm_writeverflock, RW_WRITER); vfs_vnode_iterator_init(mp, &marker); ctx.mp = mp; - vp = vfs_vnode_iterator_next(marker, nfs_clearcommit_selector, &ctx); + for (;;) { + vp = vfs_vnode_iterator_next(marker, nfs_clearcommit_selector, + &ctx); + if (vp == NULL) + break; + rw_enter(vp->v_uobj.vmobjlock, RW_WRITER); + np = VTONFS(vp); + np->n_pushlo = np->n_pushhi = np->n_pushedlo = + np->n_pushedhi = 0; + np->n_commitflags &= + ~(NFS_COMMIT_PUSH_VALID | NFS_COMMIT_PUSHED_VALID); + uvm_page_array_init(&a); + off = 0; + while ((pg = uvm_page_array_fill_and_peek(&a, &vp->v_uobj, off, + 0, 0)) != NULL) { + pg->flags &= ~PG_NEEDCOMMIT; + uvm_page_array_advance(&a); + off = pg->offset + PAGE_SIZE; + } + uvm_page_array_fini(&a); + rw_exit(vp->v_uobj.vmobjlock); + vrele(vp); + } KASSERT(vp == NULL); vfs_vnode_iterator_destroy(marker); mutex_enter(&nmp->nm_lock);
CVS commit: src/sys/nfs
Module Name:src Committed By: ad Date: Mon Feb 24 20:11:46 UTC 2020 Modified Files: src/sys/nfs: nfs_node.c Log Message: v_interlock -> vmobjlock To generate a diff of this commit: cvs rdiff -u -r1.124 -r1.125 src/sys/nfs/nfs_node.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/nfs/nfs_node.c diff -u src/sys/nfs/nfs_node.c:1.124 src/sys/nfs/nfs_node.c:1.125 --- src/sys/nfs/nfs_node.c:1.124 Fri Oct 18 04:09:02 2019 +++ src/sys/nfs/nfs_node.c Mon Feb 24 20:11:45 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: nfs_node.c,v 1.124 2019/10/18 04:09:02 msaitoh Exp $ */ +/* $NetBSD: nfs_node.c,v 1.125 2020/02/24 20:11:45 ad Exp $ */ /* * Copyright (c) 1989, 1993 @@ -35,7 +35,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: nfs_node.c,v 1.124 2019/10/18 04:09:02 msaitoh Exp $"); +__KERNEL_RCSID(0, "$NetBSD: nfs_node.c,v 1.125 2020/02/24 20:11:45 ad Exp $"); #ifdef _KERNEL_OPT #include "opt_nfs.h" @@ -273,11 +273,11 @@ nfs_gop_write(struct vnode *vp, struct v { int i; - mutex_enter(vp->v_interlock); + rw_enter(vp->v_uobj.vmobjlock, RW_WRITER); for (i = 0; i < npages; i++) { pmap_page_protect(pgs[i], VM_PROT_READ); } - mutex_exit(vp->v_interlock); + rw_exit(vp->v_uobj.vmobjlock); return genfs_gop_write(vp, pgs, npages, flags); }
CVS commit: src/external/bsd/tcpdump/dist
Module Name:src Committed By: kamil Date: Mon Feb 24 18:39:47 UTC 2020 Modified Files: src/external/bsd/tcpdump/dist: print-ah.c print-bgp.c print-esp.c print-icmp.c print-icmp6.c print-igmp.c print-m3ua.c print-msnlb.c print-nfs.c print-ntp.c print-ospf6.c print-pgm.c print-rip.c print-ripng.c print-sctp.c print-tcp.c print-timed.c print-tipc.c print-udp.c print-wb.c Log Message: Use UNALIGNED_OK to disable unaligned pointer arithmetic checks in UBSan Upstream fixed it differently by refactoring the code and the problem will go away on upgrade to 5.0. To generate a diff of this commit: cvs rdiff -u -r1.6 -r1.7 src/external/bsd/tcpdump/dist/print-ah.c \ src/external/bsd/tcpdump/dist/print-timed.c cvs rdiff -u -r1.10 -r1.11 src/external/bsd/tcpdump/dist/print-bgp.c \ src/external/bsd/tcpdump/dist/print-esp.c \ src/external/bsd/tcpdump/dist/print-icmp.c cvs rdiff -u -r1.12 -r1.13 src/external/bsd/tcpdump/dist/print-icmp6.c cvs rdiff -u -r1.7 -r1.8 src/external/bsd/tcpdump/dist/print-igmp.c \ src/external/bsd/tcpdump/dist/print-ntp.c \ src/external/bsd/tcpdump/dist/print-rip.c \ src/external/bsd/tcpdump/dist/print-ripng.c cvs rdiff -u -r1.5 -r1.6 src/external/bsd/tcpdump/dist/print-m3ua.c cvs rdiff -u -r1.3 -r1.4 src/external/bsd/tcpdump/dist/print-msnlb.c \ src/external/bsd/tcpdump/dist/print-tipc.c cvs rdiff -u -r1.9 -r1.10 src/external/bsd/tcpdump/dist/print-nfs.c \ src/external/bsd/tcpdump/dist/print-ospf6.c \ src/external/bsd/tcpdump/dist/print-pgm.c \ src/external/bsd/tcpdump/dist/print-tcp.c \ src/external/bsd/tcpdump/dist/print-wb.c cvs rdiff -u -r1.8 -r1.9 src/external/bsd/tcpdump/dist/print-sctp.c \ src/external/bsd/tcpdump/dist/print-udp.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/external/bsd/tcpdump/dist/print-ah.c diff -u src/external/bsd/tcpdump/dist/print-ah.c:1.6 src/external/bsd/tcpdump/dist/print-ah.c:1.7 --- src/external/bsd/tcpdump/dist/print-ah.c:1.6 Sun Feb 5 04:05:05 2017 +++ src/external/bsd/tcpdump/dist/print-ah.c Mon Feb 24 18:39:47 2020 @@ -23,7 +23,7 @@ #include #ifndef lint -__RCSID("$NetBSD: print-ah.c,v 1.6 2017/02/05 04:05:05 spz Exp $"); +__RCSID("$NetBSD: print-ah.c,v 1.7 2020/02/24 18:39:47 kamil Exp $"); #endif /* \summary: IPSEC Authentication Header printer */ @@ -39,6 +39,7 @@ __RCSID("$NetBSD: print-ah.c,v 1.6 2017/ #include "netdissect.h" #include "extract.h" +UNALIGNED_OK int ah_print(netdissect_options *ndo, register const u_char *bp) { Index: src/external/bsd/tcpdump/dist/print-timed.c diff -u src/external/bsd/tcpdump/dist/print-timed.c:1.6 src/external/bsd/tcpdump/dist/print-timed.c:1.7 --- src/external/bsd/tcpdump/dist/print-timed.c:1.6 Sun Feb 5 04:05:05 2017 +++ src/external/bsd/tcpdump/dist/print-timed.c Mon Feb 24 18:39:47 2020 @@ -21,7 +21,7 @@ #include #ifndef lint -__RCSID("$NetBSD: print-timed.c,v 1.6 2017/02/05 04:05:05 spz Exp $"); +__RCSID("$NetBSD: print-timed.c,v 1.7 2020/02/24 18:39:47 kamil Exp $"); #endif /* \summary: BSD time daemon protocol printer */ @@ -99,6 +99,7 @@ static const char *tsptype[TSPTYPENUMBER "DATE", "DATEREQ", "DATEACK", "TRACEON", "TRACEOFF", "MSITE", "MSITEREQ", "TEST", "SETDATE", "SETDATEREQ", "LOOP" }; +UNALIGNED_OK void timed_print(netdissect_options *ndo, register const u_char *bp) Index: src/external/bsd/tcpdump/dist/print-bgp.c diff -u src/external/bsd/tcpdump/dist/print-bgp.c:1.10 src/external/bsd/tcpdump/dist/print-bgp.c:1.11 --- src/external/bsd/tcpdump/dist/print-bgp.c:1.10 Tue Oct 1 16:06:16 2019 +++ src/external/bsd/tcpdump/dist/print-bgp.c Mon Feb 24 18:39:47 2020 @@ -32,7 +32,7 @@ #include #ifndef lint -__RCSID("$NetBSD: print-bgp.c,v 1.10 2019/10/01 16:06:16 christos Exp $"); +__RCSID("$NetBSD: print-bgp.c,v 1.11 2020/02/24 18:39:47 kamil Exp $"); #endif /* \summary: Border Gateway Protocol (BGP) printer */ @@ -921,6 +921,7 @@ static const struct tok bgp_multicast_vp { 0, NULL} }; +UNALIGNED_OK static int decode_multicast_vpn(netdissect_options *ndo, const u_char *pptr, char *buf, u_int buflen) Index: src/external/bsd/tcpdump/dist/print-esp.c diff -u src/external/bsd/tcpdump/dist/print-esp.c:1.10 src/external/bsd/tcpdump/dist/print-esp.c:1.11 --- src/external/bsd/tcpdump/dist/print-esp.c:1.10 Tue Oct 1 16:06:16 2019 +++ src/external/bsd/tcpdump/dist/print-esp.c Mon Feb 24 18:39:47 2020 @@ -23,7 +23,7 @@ #include #ifndef lint -__RCSID("$NetBSD: print-esp.c,v 1.10 2019/10/01 16:06:16 christos Exp $"); +__RCSID("$NetBSD: print-esp.c,v 1.11 2020/02/24 18:39:47 kamil Exp $"); #endif /* \summary: IPSEC Encapsulating Security Payload (ESP) printer */ @@ -654,6 +654,7 @@ void esp_print_decodesecret(netdissect_o #endif +UNALIGNED_OK #ifdef HAVE_LIBCRYPTO USES_APPLE_DEPRECATED_API #endif Inde
CVS commit: src/external/bsd/tcpdump/dist
Module Name:src Committed By: kamil Date: Mon Feb 24 16:19:35 UTC 2020 Modified Files: src/external/bsd/tcpdump/dist: extract.h Log Message: Rearrange the code to make UNALIGNED_OK available for __NetBSD__ To generate a diff of this commit: cvs rdiff -u -r1.8 -r1.9 src/external/bsd/tcpdump/dist/extract.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/tcpdump/dist/extract.h diff -u src/external/bsd/tcpdump/dist/extract.h:1.8 src/external/bsd/tcpdump/dist/extract.h:1.9 --- src/external/bsd/tcpdump/dist/extract.h:1.8 Fri Sep 8 14:01:12 2017 +++ src/external/bsd/tcpdump/dist/extract.h Mon Feb 24 16:19:35 2020 @@ -19,6 +19,37 @@ * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. */ + +/* + * If we have versions of GCC or Clang that support an __attribute__ + * to say "if we're building with unsigned behavior sanitization, + * don't complain about undefined behavior in this function", we + * label these functions with that attribute - we *know* it's undefined + * in the C standard, but we *also* know it does what we want with + * the ISA we're targeting and the compiler we're using. + * + * For GCC 4.9.0 and later, we use __attribute__((no_sanitize_undefined)); + * pre-5.0 GCC doesn't have __has_attribute, and I'm not sure whether + * GCC or Clang first had __attribute__((no_sanitize(XXX)). + * + * For Clang, we check for __attribute__((no_sanitize(XXX)) with + * __has_attribute, as there are versions of Clang that support + * __attribute__((no_sanitize("undefined")) but don't support + * __attribute__((no_sanitize_undefined)). + * + * We define this here, rather than in funcattrs.h, because we + * only want it used here, we don't want it to be broadly used. + * (Any printer will get this defined, but this should at least + * make it harder for people to find.) + */ +#if defined(__GNUC__) && ((__GNUC__ * 100 + __GNUC_MINOR__) >= 409) +#define UNALIGNED_OK __attribute__((no_sanitize_undefined)) +#elif __has_attribute(no_sanitize) +#define UNALIGNED_OK __attribute__((no_sanitize("undefined"))) +#else +#define UNALIGNED_OK +#endif + #ifdef __NetBSD__ #include @@ -139,36 +170,6 @@ static inline uint64_t EXTRACT_LE_64BITS */ #include "funcattrs.h" -/* - * If we have versions of GCC or Clang that support an __attribute__ - * to say "if we're building with unsigned behavior sanitization, - * don't complain about undefined behavior in this function", we - * label these functions with that attribute - we *know* it's undefined - * in the C standard, but we *also* know it does what we want with - * the ISA we're targeting and the compiler we're using. - * - * For GCC 4.9.0 and later, we use __attribute__((no_sanitize_undefined)); - * pre-5.0 GCC doesn't have __has_attribute, and I'm not sure whether - * GCC or Clang first had __attribute__((no_sanitize(XXX)). - * - * For Clang, we check for __attribute__((no_sanitize(XXX)) with - * __has_attribute, as there are versions of Clang that support - * __attribute__((no_sanitize("undefined")) but don't support - * __attribute__((no_sanitize_undefined)). - * - * We define this here, rather than in funcattrs.h, because we - * only want it used here, we don't want it to be broadly used. - * (Any printer will get this defined, but this should at least - * make it harder for people to find.) - */ -#if defined(__GNUC__) && ((__GNUC__ * 100 + __GNUC_MINOR__) >= 409) -#define UNALIGNED_OK __attribute__((no_sanitize_undefined)) -#elif __has_attribute(no_sanitize) -#define UNALIGNED_OK __attribute__((no_sanitize("undefined"))) -#else -#define UNALIGNED_OK -#endif - #ifdef LBL_ALIGN /* * The processor doesn't natively handle unaligned loads.
CVS commit: src/sys
Module Name:src Committed By: rin Date: Mon Feb 24 12:38:58 UTC 2020 Modified Files: src/sys/arch/arm/arm32: fault.c src/sys/arch/arm/at91: at91pmc.c src/sys/dev/fdt: fdt_subr.c src/sys/dev/tprof: tprof_armv7.c src/sys/dev/usb: if_axe.c src/sys/uvm: uvm_amap.c uvm_anon.c uvm_aobj.c uvm_device.c uvm_fault.c uvm_km.c uvm_pager.c Log Message: 0x%#x --> %#x for non-external codes. Also, stop mixing up 0x%x and %#x in single files as far as possible. To generate a diff of this commit: cvs rdiff -u -r1.109 -r1.110 src/sys/arch/arm/arm32/fault.c cvs rdiff -u -r1.7 -r1.8 src/sys/arch/arm/at91/at91pmc.c cvs rdiff -u -r1.34 -r1.35 src/sys/dev/fdt/fdt_subr.c cvs rdiff -u -r1.2 -r1.3 src/sys/dev/tprof/tprof_armv7.c cvs rdiff -u -r1.122 -r1.123 src/sys/dev/usb/if_axe.c cvs rdiff -u -r1.115 -r1.116 src/sys/uvm/uvm_amap.c cvs rdiff -u -r1.73 -r1.74 src/sys/uvm/uvm_anon.c cvs rdiff -u -r1.135 -r1.136 src/sys/uvm/uvm_aobj.c cvs rdiff -u -r1.69 -r1.70 src/sys/uvm/uvm_device.c cvs rdiff -u -r1.216 -r1.217 src/sys/uvm/uvm_fault.c cvs rdiff -u -r1.155 -r1.156 src/sys/uvm/uvm_km.c cvs rdiff -u -r1.122 -r1.123 src/sys/uvm/uvm_pager.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/fault.c diff -u src/sys/arch/arm/arm32/fault.c:1.109 src/sys/arch/arm/arm32/fault.c:1.110 --- src/sys/arch/arm/arm32/fault.c:1.109 Fri Nov 29 17:33:43 2019 +++ src/sys/arch/arm/arm32/fault.c Mon Feb 24 12:38:57 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: fault.c,v 1.109 2019/11/29 17:33:43 ryo Exp $ */ +/* $NetBSD: fault.c,v 1.110 2020/02/24 12:38:57 rin Exp $ */ /* * Copyright 2003 Wasabi Systems, Inc. @@ -81,7 +81,7 @@ #include "opt_kgdb.h" #include -__KERNEL_RCSID(0, "$NetBSD: fault.c,v 1.109 2019/11/29 17:33:43 ryo Exp $"); +__KERNEL_RCSID(0, "$NetBSD: fault.c,v 1.110 2020/02/24 12:38:57 rin Exp $"); #include #include @@ -835,7 +835,7 @@ prefetch_abort_handler(trapframe_t *tf) /* Get fault address */ fault_pc = tf->tf_pc; KASSERTMSG(tf == lwp_trapframe(l), "tf %p vs %p", tf, lwp_trapframe(l)); - UVMHIST_LOG(maphist, " (pc=0x%jx, l=0x%#jx, tf=0x%#jx)", + UVMHIST_LOG(maphist, " (pc=%#jx, l=%#jx, tf=%#jx)", fault_pc, (uintptr_t)l, (uintptr_t)tf, 0); #ifdef THUMB_CODE Index: src/sys/arch/arm/at91/at91pmc.c diff -u src/sys/arch/arm/at91/at91pmc.c:1.7 src/sys/arch/arm/at91/at91pmc.c:1.8 --- src/sys/arch/arm/at91/at91pmc.c:1.7 Thu Apr 11 14:38:05 2019 +++ src/sys/arch/arm/at91/at91pmc.c Mon Feb 24 12:38:57 2020 @@ -1,5 +1,5 @@ -/* $Id: at91pmc.c,v 1.7 2019/04/11 14:38:05 kamil Exp $ */ -/* $NetBSD: at91pmc.c,v 1.7 2019/04/11 14:38:05 kamil Exp $ */ +/* $Id: at91pmc.c,v 1.8 2020/02/24 12:38:57 rin Exp $ */ +/* $NetBSD: at91pmc.c,v 1.8 2020/02/24 12:38:57 rin Exp $ */ /* * Copyright (c) 2007 Embedtronics Oy @@ -28,7 +28,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: at91pmc.c,v 1.7 2019/04/11 14:38:05 kamil Exp $"); +__KERNEL_RCSID(0, "$NetBSD: at91pmc.c,v 1.8 2020/02/24 12:38:57 rin Exp $"); #include #include @@ -56,10 +56,10 @@ at91pmc_get_clocks(struct at91bus_clocks uint32_t reg; if (!((reg = PMCREG(PMC_MOR)) & PMC_MOR_MOSCEN)) - panic("%s: main oscillator not enabled (MOR=0x%#X)", __FUNCTION__, reg); + panic("%s: main oscillator not enabled (MOR=%#X)", __FUNCTION__, reg); if (!((reg = PMCREG(PMC_MCFR)) & PMC_MCFR_MAINRDY)) - panic("%s: main oscillator not ready (MCFR=0x%#X)", __FUNCTION__, reg); + panic("%s: main oscillator not ready (MCFR=%#X)", __FUNCTION__, reg); mclk = ((reg & PMC_MCFR_MAINF) * SLOW_CLOCK) / 16U; Index: src/sys/dev/fdt/fdt_subr.c diff -u src/sys/dev/fdt/fdt_subr.c:1.34 src/sys/dev/fdt/fdt_subr.c:1.35 --- src/sys/dev/fdt/fdt_subr.c:1.34 Thu Feb 20 01:35:55 2020 +++ src/sys/dev/fdt/fdt_subr.c Mon Feb 24 12:38:57 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: fdt_subr.c,v 1.34 2020/02/20 01:35:55 jmcneill Exp $ */ +/* $NetBSD: fdt_subr.c,v 1.35 2020/02/24 12:38:57 rin Exp $ */ /*- * Copyright (c) 2015 Jared D. McNeill @@ -27,7 +27,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: fdt_subr.c,v 1.34 2020/02/20 01:35:55 jmcneill Exp $"); +__KERNEL_RCSID(0, "$NetBSD: fdt_subr.c,v 1.35 2020/02/24 12:38:57 rin Exp $"); #include "opt_fdt.h" @@ -243,7 +243,7 @@ fdtbus_decode_range(int phandle, uint64_ buf += size_cells * 4; #ifdef FDTBUS_DEBUG - printf("%s: %s: cba=0x%#" PRIx64 ", pba=0x%#" PRIx64 ", cl=0x%#" PRIx64 "\n", __func__, fdt_get_name(fdtbus_get_data(), fdtbus_phandle2offset(phandle), NULL), cba, pba, cl); + printf("%s: %s: cba=%#" PRIx64 ", pba=%#" PRIx64 ", cl=%#" PRIx64 "\n", __func__, fdt_get_name(fdtbus_get_data(), fdtbus_phandle2offset(phandle), NULL), cba, pba, cl); #endif if (paddr >= cba && paddr < cba + cl) Index: src/sys/dev/tprof/tprof_armv7.c diff -u src/sys/dev/tprof/tprof_armv7.c:1.2 src/sys/dev/tprof/tprof_armv7.c:1.3 --- src/sys/dev/tprof/tprof_armv7.c:
CVS commit: src
Module Name:src Committed By: rin Date: Mon Feb 24 12:20:30 UTC 2020 Modified Files: src/lib/libcurses: fileio.c refresh.c src/sys/arch/amiga/dev: if_bah_zbus.c src/sys/arch/arm/footbridge: footbridge_pci.c src/sys/arch/emips/ebus: ace_ebus.c src/sys/arch/rs6000/stand/boot: boot.c src/sys/arch/xen/x86: cpu.c src/sys/dev/isa: mcd.c src/sys/dev/pci: if_ena.c if_sk.c src/sys/dev/pci/igma: igmafb.c src/sys/net80211: ieee80211_node.c src/sys/uvm/pmap: pmap_segtab.c src/tests/lib/libc/sys: t_mincore.c Log Message: 0x%p --> %p for non-external codes. To generate a diff of this commit: cvs rdiff -u -r1.6 -r1.7 src/lib/libcurses/fileio.c cvs rdiff -u -r1.111 -r1.112 src/lib/libcurses/refresh.c cvs rdiff -u -r1.17 -r1.18 src/sys/arch/amiga/dev/if_bah_zbus.c cvs rdiff -u -r1.31 -r1.32 src/sys/arch/arm/footbridge/footbridge_pci.c cvs rdiff -u -r1.22 -r1.23 src/sys/arch/emips/ebus/ace_ebus.c cvs rdiff -u -r1.5 -r1.6 src/sys/arch/rs6000/stand/boot/boot.c cvs rdiff -u -r1.132 -r1.133 src/sys/arch/xen/x86/cpu.c cvs rdiff -u -r1.119 -r1.120 src/sys/dev/isa/mcd.c cvs rdiff -u -r1.22 -r1.23 src/sys/dev/pci/if_ena.c cvs rdiff -u -r1.104 -r1.105 src/sys/dev/pci/if_sk.c cvs rdiff -u -r1.1 -r1.2 src/sys/dev/pci/igma/igmafb.c cvs rdiff -u -r1.79 -r1.80 src/sys/net80211/ieee80211_node.c cvs rdiff -u -r1.13 -r1.14 src/sys/uvm/pmap/pmap_segtab.c cvs rdiff -u -r1.14 -r1.15 src/tests/lib/libc/sys/t_mincore.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/lib/libcurses/fileio.c diff -u src/lib/libcurses/fileio.c:1.6 src/lib/libcurses/fileio.c:1.7 --- src/lib/libcurses/fileio.c:1.6 Tue Oct 2 17:35:44 2018 +++ src/lib/libcurses/fileio.c Mon Feb 24 12:20:29 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: fileio.c,v 1.6 2018/10/02 17:35:44 roy Exp $ */ +/* $NetBSD: fileio.c,v 1.7 2020/02/24 12:20:29 rin Exp $ */ /*- * Copyright (c) 2008 The NetBSD Foundation, Inc. @@ -31,7 +31,7 @@ #include #ifndef lint -__RCSID("$NetBSD: fileio.c,v 1.6 2018/10/02 17:35:44 roy Exp $"); +__RCSID("$NetBSD: fileio.c,v 1.7 2020/02/24 12:20:29 rin Exp $"); #endif/* not lint */ #include "curses.h" @@ -236,7 +236,7 @@ getwin(FILE *fp) __touchline(win, y, 0, (int) win->maxx - 1); } #ifdef DEBUG - __CTRACE(__CTRACE_FILEIO, "getwin: win = 0x%p\n", win); + __CTRACE(__CTRACE_FILEIO, "getwin: win = %p\n", win); #endif return win; Index: src/lib/libcurses/refresh.c diff -u src/lib/libcurses/refresh.c:1.111 src/lib/libcurses/refresh.c:1.112 --- src/lib/libcurses/refresh.c:1.111 Sun Jun 9 07:40:14 2019 +++ src/lib/libcurses/refresh.c Mon Feb 24 12:20:29 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: refresh.c,v 1.111 2019/06/09 07:40:14 blymn Exp $ */ +/* $NetBSD: refresh.c,v 1.112 2020/02/24 12:20:29 rin Exp $ */ /* * Copyright (c) 1981, 1993, 1994 @@ -34,7 +34,7 @@ #if 0 static char sccsid[] = "@(#)refresh.c 8.7 (Berkeley) 8/13/94"; #else -__RCSID("$NetBSD: refresh.c,v 1.111 2019/06/09 07:40:14 blymn Exp $"); +__RCSID("$NetBSD: refresh.c,v 1.112 2020/02/24 12:20:29 rin Exp $"); #endif #endif/* not lint */ @@ -1436,7 +1436,7 @@ domvcur(WINDOW *win, int oy, int ox, int { #ifdef DEBUG - __CTRACE(__CTRACE_REFRESH, "domvcur: (%d,%d)=>(%d,%d) win 0x%p\n", + __CTRACE(__CTRACE_REFRESH, "domvcur: (%d,%d)=>(%d,%d) win %p\n", oy, ox, ny, nx, win ); #endif /* DEBUG */ Index: src/sys/arch/amiga/dev/if_bah_zbus.c diff -u src/sys/arch/amiga/dev/if_bah_zbus.c:1.17 src/sys/arch/amiga/dev/if_bah_zbus.c:1.18 --- src/sys/arch/amiga/dev/if_bah_zbus.c:1.17 Mon Oct 23 09:21:40 2017 +++ src/sys/arch/amiga/dev/if_bah_zbus.c Mon Feb 24 12:20:29 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: if_bah_zbus.c,v 1.17 2017/10/23 09:21:40 msaitoh Exp $ */ +/* $NetBSD: if_bah_zbus.c,v 1.18 2020/02/24 12:20:29 rin Exp $ */ /*- * Copyright (c) 1994, 1995, 1998 The NetBSD Foundation, Inc. @@ -34,7 +34,7 @@ #endif #include -__KERNEL_RCSID(0, "$NetBSD: if_bah_zbus.c,v 1.17 2017/10/23 09:21:40 msaitoh Exp $"); +__KERNEL_RCSID(0, "$NetBSD: if_bah_zbus.c,v 1.18 2020/02/24 12:20:29 rin Exp $"); /* * Driver frontend for the Commodore Busines Machines and the @@ -102,7 +102,7 @@ bah_zbus_attach(device_t parent, device_ sc->sc_dev = self; #if (defined(BAH_DEBUG) && (BAH_DEBUG > 2)) - printf("\n%s: attach(0x%p, 0x%p, 0x%p)\n", + printf("\n%s: attach(%p, %p, %p)\n", device_xname(self), parent, self, aux); #endif bsc->sc_bst.base = (bus_addr_t)zap->va; Index: src/sys/arch/arm/footbridge/footbridge_pci.c diff -u src/sys/arch/arm/footbridge/footbridge_pci.c:1.31 src/sys/arch/arm/footbridge/footbridge_pci.c:1.32 --- src/sys/arch/arm/footbridge/footbridge_pci.c:1.31 Sat Nov 17 01:45:25 2018 +++ src/sys/arch/arm/footbridge/footbridge_pci.c Mon Feb 24 12:20:29 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: footbridge_pci.c,v 1.31 2018/11/17 01:45:25 rjs Exp $ */ +/* $NetBSD: footb
CVS commit: src/sys/arch/arm/arm
Module Name:src Committed By: rin Date: Mon Feb 24 12:08:09 UTC 2020 Modified Files: src/sys/arch/arm/arm: fiq.c Log Message: Fix previous; we need for machines with !ARM_HAS_VBAR && !__ARM_FIQ_INDIRECT. To generate a diff of this commit: cvs rdiff -u -r1.9 -r1.10 src/sys/arch/arm/arm/fiq.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/arm/fiq.c diff -u src/sys/arch/arm/arm/fiq.c:1.9 src/sys/arch/arm/arm/fiq.c:1.10 --- src/sys/arch/arm/arm/fiq.c:1.9 Sat Feb 22 19:49:11 2020 +++ src/sys/arch/arm/arm/fiq.c Mon Feb 24 12:08:08 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: fiq.c,v 1.9 2020/02/22 19:49:11 chs Exp $ */ +/* $NetBSD: fiq.c,v 1.10 2020/02/24 12:08:08 rin Exp $ */ /* * Copyright (c) 2001, 2002 Wasabi Systems, Inc. @@ -36,7 +36,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: fiq.c,v 1.9 2020/02/22 19:49:11 chs Exp $"); +__KERNEL_RCSID(0, "$NetBSD: fiq.c,v 1.10 2020/02/24 12:08:08 rin Exp $"); #include #include @@ -44,6 +44,8 @@ __KERNEL_RCSID(0, "$NetBSD: fiq.c,v 1.9 #include #include +#include + TAILQ_HEAD(, fiqhandler) fiqhandler_stack = TAILQ_HEAD_INITIALIZER(fiqhandler_stack);
CVS commit: src/sbin/devpubd
Module Name:src Committed By: wiz Date: Mon Feb 24 11:59:33 UTC 2020 Modified Files: src/sbin/devpubd: devpubd.8 Log Message: New sentence, new line. Bump date for previous. To generate a diff of this commit: cvs rdiff -u -r1.6 -r1.7 src/sbin/devpubd/devpubd.8 Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sbin/devpubd/devpubd.8 diff -u src/sbin/devpubd/devpubd.8:1.6 src/sbin/devpubd/devpubd.8:1.7 --- src/sbin/devpubd/devpubd.8:1.6 Mon Feb 24 11:45:30 2020 +++ src/sbin/devpubd/devpubd.8 Mon Feb 24 11:59:33 2020 @@ -1,4 +1,4 @@ -.\" $NetBSD: devpubd.8,v 1.6 2020/02/24 11:45:30 mlelstv Exp $ +.\" $NetBSD: devpubd.8,v 1.7 2020/02/24 11:59:33 wiz Exp $ .\" .\" Copyright (c) 2011-2013 The NetBSD Foundation, Inc. .\" All rights reserved. @@ -27,7 +27,7 @@ .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE .\" POSSIBILITY OF SUCH DAMAGE. .\" -.Dd September 11, 2016 +.Dd February 24, 2020 .Dt DEVPUBD 8 .Os .Sh NAME @@ -48,7 +48,8 @@ When .Fl f is specified, .Nm -does not go into the background. With the option +does not go into the background. +With the option .Fl 1 it will also exit after the initial setup of device nodes. .Pp
CVS commit: src/sys/arch/powerpc/powerpc
Module Name:src Committed By: rin Date: Mon Feb 24 11:49:17 UTC 2020 Modified Files: src/sys/arch/powerpc/powerpc: vm_machdep.c Log Message: Oops, revert previous; fix build for PPC_OEA64 || PPC_OEA64_BRIDGE. oea and booke seem to work without direct-mapped and physically contiguous u-area. To generate a diff of this commit: cvs rdiff -u -r1.101 -r1.102 src/sys/arch/powerpc/powerpc/vm_machdep.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/powerpc/powerpc/vm_machdep.c diff -u src/sys/arch/powerpc/powerpc/vm_machdep.c:1.101 src/sys/arch/powerpc/powerpc/vm_machdep.c:1.102 --- src/sys/arch/powerpc/powerpc/vm_machdep.c:1.101 Fri Feb 21 13:38:05 2020 +++ src/sys/arch/powerpc/powerpc/vm_machdep.c Mon Feb 24 11:49:17 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: vm_machdep.c,v 1.101 2020/02/21 13:38:05 rin Exp $ */ +/* $NetBSD: vm_machdep.c,v 1.102 2020/02/24 11:49:17 rin Exp $ */ /* * Copyright (C) 1995, 1996 Wolfgang Solfrank. @@ -32,7 +32,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: vm_machdep.c,v 1.101 2020/02/21 13:38:05 rin Exp $"); +__KERNEL_RCSID(0, "$NetBSD: vm_machdep.c,v 1.102 2020/02/24 11:49:17 rin Exp $"); #include "opt_altivec.h" #include "opt_multiprocessor.h" @@ -310,11 +310,6 @@ vunmapbuf(struct buf *bp, vsize_t len) bp->b_saveaddr = 0; } -#if UPAGES > 1 && \ -(!defined(__HAVE_CPU_UAREA_ROUTINES) || !defined(PMAP_MAP_POOLPAGE)) -#error "We need physically contiguous pages for u-area." -#endif - #ifdef __HAVE_CPU_UAREA_ROUTINES void * cpu_uarea_alloc(bool system)
CVS commit: src/sbin/devpubd
Module Name:src Committed By: mlelstv Date: Mon Feb 24 11:45:30 UTC 2020 Modified Files: src/sbin/devpubd: devpubd.8 devpubd.c Log Message: Add one-shot mode. To generate a diff of this commit: cvs rdiff -u -r1.5 -r1.6 src/sbin/devpubd/devpubd.8 \ src/sbin/devpubd/devpubd.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sbin/devpubd/devpubd.8 diff -u src/sbin/devpubd/devpubd.8:1.5 src/sbin/devpubd/devpubd.8:1.6 --- src/sbin/devpubd/devpubd.8:1.5 Sun Sep 11 01:38:00 2016 +++ src/sbin/devpubd/devpubd.8 Mon Feb 24 11:45:30 2020 @@ -1,4 +1,4 @@ -.\" $NetBSD: devpubd.8,v 1.5 2016/09/11 01:38:00 sevan Exp $ +.\" $NetBSD: devpubd.8,v 1.6 2020/02/24 11:45:30 mlelstv Exp $ .\" .\" Copyright (c) 2011-2013 The NetBSD Foundation, Inc. .\" All rights reserved. @@ -35,7 +35,7 @@ .Nd device publish daemon for automatic device node creation .Sh SYNOPSIS .Nm -.Op Fl f +.Op Fl 1f .Sh DESCRIPTION .Nm listens on @@ -48,7 +48,9 @@ When .Fl f is specified, .Nm -does not go into the background. +does not go into the background. With the option +.Fl 1 +it will also exit after the initial setup of device nodes. .Pp .Nm runs Index: src/sbin/devpubd/devpubd.c diff -u src/sbin/devpubd/devpubd.c:1.5 src/sbin/devpubd/devpubd.c:1.6 --- src/sbin/devpubd/devpubd.c:1.5 Thu Feb 6 19:20:21 2020 +++ src/sbin/devpubd/devpubd.c Mon Feb 24 11:45:30 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: devpubd.c,v 1.5 2020/02/06 19:20:21 kamil Exp $ */ +/* $NetBSD: devpubd.c,v 1.6 2020/02/24 11:45:30 mlelstv Exp $ */ /*- * Copyright (c) 2011 Jared D. McNeill @@ -36,7 +36,7 @@ #include __COPYRIGHT("@(#) Copyright (c) 2011-2015\ Jared D. McNeill . All rights reserved."); -__RCSID("$NetBSD: devpubd.c,v 1.5 2020/02/06 19:20:21 kamil Exp $"); +__RCSID("$NetBSD: devpubd.c,v 1.6 2020/02/24 11:45:30 mlelstv Exp $"); #include #include @@ -252,7 +252,7 @@ devpubd_init(void) __dead static void usage(void) { - fprintf(stderr, "usage: %s [-f]\n", getprogname()); + fprintf(stderr, "usage: %s [-1f]\n", getprogname()); exit(EXIT_FAILURE); } @@ -260,12 +260,17 @@ int main(int argc, char *argv[]) { bool fflag = false; + bool once = false; int ch; setprogname(argv[0]); - while ((ch = getopt(argc, argv, "fh")) != -1) { + while ((ch = getopt(argc, argv, "1fh")) != -1) { switch (ch) { + case '1': + fflag = true; + once = true; + break; case 'f': fflag = true; break; @@ -295,7 +300,8 @@ main(int argc, char *argv[]) } } - devpubd_eventloop(); + if (!once) + devpubd_eventloop(); return EXIT_SUCCESS; }
CVS commit: xsrc/external/mit/xf86-video-ati-kms/dist/src
Module Name:xsrc Committed By: mrg Date: Mon Feb 24 09:32:31 UTC 2020 Modified Files: xsrc/external/mit/xf86-video-ati-kms/dist/src: radeon_glamor.c Log Message: for now, limit glamor to TAHITI and newer chipsets only. To generate a diff of this commit: cvs rdiff -u -r1.1.1.7 -r1.2 \ xsrc/external/mit/xf86-video-ati-kms/dist/src/radeon_glamor.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: xsrc/external/mit/xf86-video-ati-kms/dist/src/radeon_glamor.c diff -u xsrc/external/mit/xf86-video-ati-kms/dist/src/radeon_glamor.c:1.1.1.7 xsrc/external/mit/xf86-video-ati-kms/dist/src/radeon_glamor.c:1.2 --- xsrc/external/mit/xf86-video-ati-kms/dist/src/radeon_glamor.c:1.1.1.7 Sat Jun 1 07:24:16 2019 +++ xsrc/external/mit/xf86-video-ati-kms/dist/src/radeon_glamor.c Mon Feb 24 09:32:31 2020 @@ -81,6 +81,14 @@ radeon_glamor_pre_init(ScrnInfoPtr scrn) s = xf86GetOptValString(info->Options, OPTION_ACCELMETHOD); if (!s) { +#ifdef __NetBSD__ + /* + * glamor isn't working yet for GL. disable where not + * needed for anything at all. + */ + if (info->ChipFamily < CHIP_FAMILY_TAHITI) + return FALSE; +#else if (xorgGetVersion() >= XORG_VERSION_NUMERIC(1,18,3,0,0)) { if (info->ChipFamily < CHIP_FAMILY_R600) return FALSE; @@ -88,6 +96,7 @@ radeon_glamor_pre_init(ScrnInfoPtr scrn) if (info->ChipFamily < CHIP_FAMILY_TAHITI) return FALSE; } +#endif } if (s && strcasecmp(s, "glamor") != 0) {