From owner-svn-src-all@freebsd.org Sun Nov 17 00:52:24 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id A19531B1CA5; Sun, 17 Nov 2019 00:52:24 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47Ftpc2fZ4z3MRc; Sun, 17 Nov 2019 00:52:24 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 03A1A9E7C; Sun, 17 Nov 2019 00:52:24 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xAH0qNA3070700; Sun, 17 Nov 2019 00:52:23 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xAH0qNG8070699; Sun, 17 Nov 2019 00:52:23 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201911170052.xAH0qNG8070699@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Sun, 17 Nov 2019 00:52:23 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r354781 - stable/12/sys/cam/ctl X-SVN-Group: stable-12 X-SVN-Commit-Author: mav X-SVN-Commit-Paths: stable/12/sys/cam/ctl X-SVN-Commit-Revision: 354781 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 17 Nov 2019 00:52:24 -0000 Author: mav Date: Sun Nov 17 00:52:23 2019 New Revision: 354781 URL: https://svnweb.freebsd.org/changeset/base/354781 Log: MFC r354268: Remove lock from CTL camsim frontend. CAM does not need a SIM lock for quite a while, and CTL never needed it. Modified: stable/12/sys/cam/ctl/ctl_frontend_cam_sim.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/cam/ctl/ctl_frontend_cam_sim.c ============================================================================== --- stable/12/sys/cam/ctl/ctl_frontend_cam_sim.c Sat Nov 16 20:33:46 2019 (r354780) +++ stable/12/sys/cam/ctl/ctl_frontend_cam_sim.c Sun Nov 17 00:52:23 2019 (r354781) @@ -46,12 +46,9 @@ __FBSDID("$FreeBSD$"); #include #include #include -#include -#include -#include -#include #include #include +#include #include #include @@ -80,7 +77,6 @@ struct cfcs_softc { struct cam_sim *sim; struct cam_devq *devq; struct cam_path *path; - struct mtx lock; uint64_t wwnn; uint64_t wwpn; uint32_t cur_tag_num; @@ -135,7 +131,6 @@ cfcs_init(void) softc = &cfcs_softc; bzero(softc, sizeof(*softc)); - mtx_init(&softc->lock, "ctl2cam", NULL, MTX_DEF); port = &softc->port; port->frontend = &cfcs_frontend; @@ -155,7 +150,6 @@ cfcs_init(void) if (retval != 0) { printf("%s: ctl_port_register() failed with error %d!\n", __func__, retval); - mtx_destroy(&softc->lock); return (retval); } @@ -177,7 +171,6 @@ cfcs_init(void) softc->wwpn = port->wwpn; } - mtx_lock(&softc->lock); softc->devq = cam_simq_alloc(port->num_requested_ctl_io); if (softc->devq == NULL) { printf("%s: error allocating devq\n", __func__); @@ -186,7 +179,7 @@ cfcs_init(void) } softc->sim = cam_sim_alloc(cfcs_action, cfcs_poll, softc->port_name, - softc, /*unit*/ 0, &softc->lock, 1, + softc, /*unit*/ 0, NULL, 1, port->num_requested_ctl_io, softc->devq); if (softc->sim == NULL) { printf("%s: error allocating SIM\n", __func__); @@ -210,8 +203,6 @@ cfcs_init(void) goto bailout; } - mtx_unlock(&softc->lock); - return (retval); bailout: @@ -219,9 +210,6 @@ bailout: cam_sim_free(softc->sim, /*free_devq*/ TRUE); else if (softc->devq) cam_simq_free(softc->devq); - mtx_unlock(&softc->lock); - mtx_destroy(&softc->lock); - return (retval); } @@ -234,12 +222,9 @@ cfcs_shutdown(void) ctl_port_offline(port); - mtx_lock(&softc->lock); xpt_free_path(softc->path); xpt_bus_deregister(cam_sim_path(softc->sim)); cam_sim_free(softc->sim, /*free_devq*/ TRUE); - mtx_unlock(&softc->lock); - mtx_destroy(&softc->lock); if ((error = ctl_port_deregister(port)) != 0) printf("%s: cam_sim port deregistration failed\n", __func__); @@ -255,18 +240,15 @@ cfcs_poll(struct cam_sim *sim) static void cfcs_onoffline(void *arg, int online) { - struct cfcs_softc *softc; + struct cfcs_softc *softc = (struct cfcs_softc *)arg; union ccb *ccb; - softc = (struct cfcs_softc *)arg; - - mtx_lock(&softc->lock); softc->online = online; ccb = xpt_alloc_ccb_nowait(); if (ccb == NULL) { printf("%s: unable to allocate CCB for rescan\n", __func__); - goto bailout; + return; } if (xpt_create_path(&ccb->ccb_h.path, NULL, @@ -274,12 +256,9 @@ cfcs_onoffline(void *arg, int online) CAM_LUN_WILDCARD) != CAM_REQ_CMP) { printf("%s: can't allocate path for rescan\n", __func__); xpt_free_ccb(ccb); - goto bailout; + return; } xpt_rescan(ccb); - -bailout: - mtx_unlock(&softc->lock); } static void @@ -493,13 +472,13 @@ cfcs_done(union ctl_io *io) ccb->ccb_h.status |= CAM_REQ_CMP_ERR; break; } + ctl_free_io(io); if ((ccb->ccb_h.status & CAM_STATUS_MASK) != CAM_REQ_CMP && (ccb->ccb_h.status & CAM_DEV_QFRZN) == 0) { xpt_freeze_devq(ccb->ccb_h.path, 1); ccb->ccb_h.status |= CAM_DEV_QFRZN; } xpt_done(ccb); - ctl_free_io(io); } void @@ -509,7 +488,6 @@ cfcs_action(struct cam_sim *sim, union ccb *ccb) int err; softc = (struct cfcs_softc *)cam_sim_softc(sim); - mtx_assert(&softc->lock, MA_OWNED); switch (ccb->ccb_h.func_code) { case XPT_SCSI_IO: { @@ -569,7 +547,7 @@ cfcs_action(struct cam_sim *sim, union ccb *ccb) * enough for now. Since we're using unsigned ints, * they'll just wrap around. */ - io->scsiio.tag_num = softc->cur_tag_num++; + io->scsiio.tag_num = atomic_fetchadd_32(&softc->cur_tag_num, 1); csio->tag_id = io->scsiio.tag_num; switch (csio->tag_action) { case CAM_TAG_ACTION_NONE: @@ -775,13 +753,13 @@ cfcs_action(struct cam_sim *sim, union ccb *ccb) cpi->target_sprt = 0; cpi->hba_misc = PIM_EXTLUNS; cpi->hba_eng_cnt = 0; - cpi->max_target = 1; + cpi->max_target = 0; cpi->max_lun = 1024; /* Do we really have a limit? */ cpi->maxio = 1024 * 1024; cpi->async_flags = 0; cpi->hpath_id = 0; - cpi->initiator_id = 0; + cpi->initiator_id = 1; strlcpy(cpi->sim_vid, "FreeBSD", SIM_IDLEN); strlcpy(cpi->hba_vid, "FreeBSD", HBA_IDLEN); From owner-svn-src-all@freebsd.org Sun Nov 17 00:52:59 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 5E4001B1D42; Sun, 17 Nov 2019 00:52:59 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47FtqG6K68z3NZ0; Sun, 17 Nov 2019 00:52:58 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id A7FDD9E8D; Sun, 17 Nov 2019 00:52:58 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xAH0qw2o070778; Sun, 17 Nov 2019 00:52:58 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xAH0qwod070777; Sun, 17 Nov 2019 00:52:58 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201911170052.xAH0qwod070777@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Sun, 17 Nov 2019 00:52:58 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r354782 - stable/11/sys/cam/ctl X-SVN-Group: stable-11 X-SVN-Commit-Author: mav X-SVN-Commit-Paths: stable/11/sys/cam/ctl X-SVN-Commit-Revision: 354782 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 17 Nov 2019 00:52:59 -0000 Author: mav Date: Sun Nov 17 00:52:58 2019 New Revision: 354782 URL: https://svnweb.freebsd.org/changeset/base/354782 Log: MFC r354268: Remove lock from CTL camsim frontend. CAM does not need a SIM lock for quite a while, and CTL never needed it. Modified: stable/11/sys/cam/ctl/ctl_frontend_cam_sim.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/cam/ctl/ctl_frontend_cam_sim.c ============================================================================== --- stable/11/sys/cam/ctl/ctl_frontend_cam_sim.c Sun Nov 17 00:52:23 2019 (r354781) +++ stable/11/sys/cam/ctl/ctl_frontend_cam_sim.c Sun Nov 17 00:52:58 2019 (r354782) @@ -44,12 +44,9 @@ __FBSDID("$FreeBSD$"); #include #include #include -#include -#include -#include -#include #include #include +#include #include #include @@ -78,7 +75,6 @@ struct cfcs_softc { struct cam_sim *sim; struct cam_devq *devq; struct cam_path *path; - struct mtx lock; uint64_t wwnn; uint64_t wwpn; uint32_t cur_tag_num; @@ -133,7 +129,6 @@ cfcs_init(void) softc = &cfcs_softc; bzero(softc, sizeof(*softc)); - mtx_init(&softc->lock, "ctl2cam", NULL, MTX_DEF); port = &softc->port; port->frontend = &cfcs_frontend; @@ -158,7 +153,6 @@ cfcs_init(void) if (retval != 0) { printf("%s: ctl_port_register() failed with error %d!\n", __func__, retval); - mtx_destroy(&softc->lock); return (retval); } @@ -180,7 +174,6 @@ cfcs_init(void) softc->wwpn = port->wwpn; } - mtx_lock(&softc->lock); softc->devq = cam_simq_alloc(port->num_requested_ctl_io); if (softc->devq == NULL) { printf("%s: error allocating devq\n", __func__); @@ -189,7 +182,7 @@ cfcs_init(void) } softc->sim = cam_sim_alloc(cfcs_action, cfcs_poll, softc->port_name, - softc, /*unit*/ 0, &softc->lock, 1, + softc, /*unit*/ 0, NULL, 1, port->num_requested_ctl_io, softc->devq); if (softc->sim == NULL) { printf("%s: error allocating SIM\n", __func__); @@ -213,8 +206,6 @@ cfcs_init(void) goto bailout; } - mtx_unlock(&softc->lock); - return (retval); bailout: @@ -222,9 +213,6 @@ bailout: cam_sim_free(softc->sim, /*free_devq*/ TRUE); else if (softc->devq) cam_simq_free(softc->devq); - mtx_unlock(&softc->lock); - mtx_destroy(&softc->lock); - return (retval); } @@ -237,12 +225,9 @@ cfcs_shutdown(void) ctl_port_offline(port); - mtx_lock(&softc->lock); xpt_free_path(softc->path); xpt_bus_deregister(cam_sim_path(softc->sim)); cam_sim_free(softc->sim, /*free_devq*/ TRUE); - mtx_unlock(&softc->lock); - mtx_destroy(&softc->lock); if ((error = ctl_port_deregister(port)) != 0) printf("%s: cam_sim port deregistration failed\n", __func__); @@ -258,18 +243,15 @@ cfcs_poll(struct cam_sim *sim) static void cfcs_onoffline(void *arg, int online) { - struct cfcs_softc *softc; + struct cfcs_softc *softc = (struct cfcs_softc *)arg; union ccb *ccb; - softc = (struct cfcs_softc *)arg; - - mtx_lock(&softc->lock); softc->online = online; ccb = xpt_alloc_ccb_nowait(); if (ccb == NULL) { printf("%s: unable to allocate CCB for rescan\n", __func__); - goto bailout; + return; } if (xpt_create_path(&ccb->ccb_h.path, NULL, @@ -277,12 +259,9 @@ cfcs_onoffline(void *arg, int online) CAM_LUN_WILDCARD) != CAM_REQ_CMP) { printf("%s: can't allocate path for rescan\n", __func__); xpt_free_ccb(ccb); - goto bailout; + return; } xpt_rescan(ccb); - -bailout: - mtx_unlock(&softc->lock); } static void @@ -496,13 +475,13 @@ cfcs_done(union ctl_io *io) ccb->ccb_h.status |= CAM_REQ_CMP_ERR; break; } + ctl_free_io(io); if ((ccb->ccb_h.status & CAM_STATUS_MASK) != CAM_REQ_CMP && (ccb->ccb_h.status & CAM_DEV_QFRZN) == 0) { xpt_freeze_devq(ccb->ccb_h.path, 1); ccb->ccb_h.status |= CAM_DEV_QFRZN; } xpt_done(ccb); - ctl_free_io(io); } void @@ -512,7 +491,6 @@ cfcs_action(struct cam_sim *sim, union ccb *ccb) int err; softc = (struct cfcs_softc *)cam_sim_softc(sim); - mtx_assert(&softc->lock, MA_OWNED); switch (ccb->ccb_h.func_code) { case XPT_SCSI_IO: { @@ -572,7 +550,7 @@ cfcs_action(struct cam_sim *sim, union ccb *ccb) * enough for now. Since we're using unsigned ints, * they'll just wrap around. */ - io->scsiio.tag_num = softc->cur_tag_num++; + io->scsiio.tag_num = atomic_fetchadd_32(&softc->cur_tag_num, 1); csio->tag_id = io->scsiio.tag_num; switch (csio->tag_action) { case CAM_TAG_ACTION_NONE: @@ -778,13 +756,13 @@ cfcs_action(struct cam_sim *sim, union ccb *ccb) cpi->target_sprt = 0; cpi->hba_misc = PIM_EXTLUNS; cpi->hba_eng_cnt = 0; - cpi->max_target = 1; + cpi->max_target = 0; cpi->max_lun = 1024; /* Do we really have a limit? */ cpi->maxio = 1024 * 1024; cpi->async_flags = 0; cpi->hpath_id = 0; - cpi->initiator_id = 0; + cpi->initiator_id = 1; strlcpy(cpi->sim_vid, "FreeBSD", SIM_IDLEN); strlcpy(cpi->hba_vid, "FreeBSD", HBA_IDLEN); From owner-svn-src-all@freebsd.org Sun Nov 17 01:01:03 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id A256B1B1EC0; Sun, 17 Nov 2019 01:01:03 +0000 (UTC) (envelope-from jhibbits@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47Fv0b3gMLz4BlG; Sun, 17 Nov 2019 01:01:03 +0000 (UTC) (envelope-from jhibbits@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 5DB749EC3; Sun, 17 Nov 2019 01:01:03 +0000 (UTC) (envelope-from jhibbits@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xAH113HN072395; Sun, 17 Nov 2019 01:01:03 GMT (envelope-from jhibbits@FreeBSD.org) Received: (from jhibbits@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xAH113ih072380; Sun, 17 Nov 2019 01:01:03 GMT (envelope-from jhibbits@FreeBSD.org) Message-Id: <201911170101.xAH113ih072380@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhibbits set sender to jhibbits@FreeBSD.org using -f From: Justin Hibbits Date: Sun, 17 Nov 2019 01:01:03 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354783 - head/sys/powerpc/powerpc X-SVN-Group: head X-SVN-Commit-Author: jhibbits X-SVN-Commit-Paths: head/sys/powerpc/powerpc X-SVN-Commit-Revision: 354783 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 17 Nov 2019 01:01:03 -0000 Author: jhibbits Date: Sun Nov 17 01:01:02 2019 New Revision: 354783 URL: https://svnweb.freebsd.org/changeset/base/354783 Log: powerpc: Return SIGILL if DSCR does not exist in m{f,t}spr emulation Guard against programs written for one powerpc target running on another, and panicking the system due to not having the DSCR register. Modified: head/sys/powerpc/powerpc/exec_machdep.c Modified: head/sys/powerpc/powerpc/exec_machdep.c ============================================================================== --- head/sys/powerpc/powerpc/exec_machdep.c Sun Nov 17 00:52:58 2019 (r354782) +++ head/sys/powerpc/powerpc/exec_machdep.c Sun Nov 17 01:01:02 2019 (r354783) @@ -1086,15 +1086,17 @@ emulate_mfspr(int spr, int reg, struct trapframe *fram td = curthread; if (spr == SPR_DSCR || spr == SPR_DSCRP) { + if (!(cpu_features2 & PPC_FEATURE2_DSCR)) + return (SIGILL); // If DSCR was never set, get the default DSCR if ((td->td_pcb->pcb_flags & PCB_CDSCR) == 0) td->td_pcb->pcb_dscr = mfspr(SPR_DSCRP); frame->fixreg[reg] = td->td_pcb->pcb_dscr; frame->srr0 += 4; - return 0; + return (0); } else - return SIGILL; + return (SIGILL); } static int @@ -1104,13 +1106,15 @@ emulate_mtspr(int spr, int reg, struct trapframe *fram td = curthread; if (spr == SPR_DSCR || spr == SPR_DSCRP) { + if (!(cpu_features2 & PPC_FEATURE2_DSCR)) + return (SIGILL); td->td_pcb->pcb_flags |= PCB_CDSCR; td->td_pcb->pcb_dscr = frame->fixreg[reg]; mtspr(SPR_DSCRP, frame->fixreg[reg]); frame->srr0 += 4; - return 0; + return (0); } else - return SIGILL; + return (SIGILL); } #define XFX 0xFC0007FF From owner-svn-src-all@freebsd.org Sun Nov 17 06:50:37 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 5DC5B1B8499; Sun, 17 Nov 2019 06:50:37 +0000 (UTC) (envelope-from dougm@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47G2lw66Bsz4clr; Sun, 17 Nov 2019 06:50:36 +0000 (UTC) (envelope-from dougm@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id A76DBDFC8; Sun, 17 Nov 2019 06:50:36 +0000 (UTC) (envelope-from dougm@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xAH6oaBP078364; Sun, 17 Nov 2019 06:50:36 GMT (envelope-from dougm@FreeBSD.org) Received: (from dougm@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xAH6oaNY078363; Sun, 17 Nov 2019 06:50:36 GMT (envelope-from dougm@FreeBSD.org) Message-Id: <201911170650.xAH6oaNY078363@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dougm set sender to dougm@FreeBSD.org using -f From: Doug Moore Date: Sun, 17 Nov 2019 06:50:36 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354785 - head/sys/vm X-SVN-Group: head X-SVN-Commit-Author: dougm X-SVN-Commit-Paths: head/sys/vm X-SVN-Commit-Revision: 354785 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 17 Nov 2019 06:50:37 -0000 Author: dougm Date: Sun Nov 17 06:50:36 2019 New Revision: 354785 URL: https://svnweb.freebsd.org/changeset/base/354785 Log: The loop in vm_map_protect that verifies that all transition map entries are stabilized, repeatedly verifies the same entry. Check each entry in turn. Reviewed by: kib (code only), alc Tested by: pho MFC after: 7 days Differential Revision: https://reviews.freebsd.org/D22405 Modified: head/sys/vm/vm_map.c Modified: head/sys/vm/vm_map.c ============================================================================== --- head/sys/vm/vm_map.c Sun Nov 17 03:54:31 2019 (r354784) +++ head/sys/vm/vm_map.c Sun Nov 17 06:50:36 2019 (r354785) @@ -2469,17 +2469,16 @@ again: vm_map_unlock(map); return (KERN_PROTECTION_FAILURE); } - if ((entry->eflags & MAP_ENTRY_IN_TRANSITION) != 0) - in_tran = entry; + if ((current->eflags & MAP_ENTRY_IN_TRANSITION) != 0) + in_tran = current; } /* - * Postpone the operation until all in transition map entries - * are stabilized. In-transition entry might already have its - * pages wired and wired_count incremented, but - * MAP_ENTRY_USER_WIRED flag not yet set, and visible to other - * threads because the map lock is dropped. In this case we - * would miss our call to vm_fault_copy_entry(). + * Postpone the operation until all in-transition map entries have + * stabilized. An in-transition entry might already have its pages + * wired and wired_count incremented, but not yet have its + * MAP_ENTRY_USER_WIRED flag set. In which case, we would fail to call + * vm_fault_copy_entry() in the final loop below. */ if (in_tran != NULL) { in_tran->eflags |= MAP_ENTRY_NEEDS_WAKEUP; From owner-svn-src-all@freebsd.org Sun Nov 17 14:08:20 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 60D741C141F; Sun, 17 Nov 2019 14:08:20 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47GDSz53Ryz4R98; Sun, 17 Nov 2019 14:08:19 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 635661AE74; Sun, 17 Nov 2019 14:08:19 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xAHE8JHw037660; Sun, 17 Nov 2019 14:08:19 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xAHE8JUb037659; Sun, 17 Nov 2019 14:08:19 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201911171408.xAHE8JUb037659@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Sun, 17 Nov 2019 14:08:19 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354786 - head/sys/tools X-SVN-Group: head X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: head/sys/tools X-SVN-Commit-Revision: 354786 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 17 Nov 2019 14:08:20 -0000 Author: kevans Date: Sun Nov 17 14:08:19 2019 New Revision: 354786 URL: https://svnweb.freebsd.org/changeset/base/354786 Log: Add makesyscalls.lua, a rewrite of makesyscalls.sh This currently requires a suitable lua + luafilesystem + luaposix from the ports tree to build. Discussion is underway in D21893 to add a suitable lua to the base system, cleverly disguised and out of the way of normal consumers. makesyscalls.sh is a good target for rewrite into lua as it's currently a sh+sed+awk script that can be difficult to add on to, at times. For instance, adding a new COMPAT* option (that mimicks the behaivor of most other COMPAT* options) requires a fairly substantial amount of copy/paste; see r352693 for instance. Attempts to generate part of the awk script for COMPAT* handling was (very kindly) rejected with a desire to just rewrite the script in a single language that can handle all of it. Reviewed by: brooks Differential Revision: https://reviews.freebsd.org/D21775 Added: head/sys/tools/makesyscalls.lua (contents, props changed) Added: head/sys/tools/makesyscalls.lua ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/tools/makesyscalls.lua Sun Nov 17 14:08:19 2019 (r354786) @@ -0,0 +1,1322 @@ +-- +-- SPDX-License-Identifier: BSD-2-Clause-FreeBSD +-- +-- Copyright (c) 2019 Kyle Evans +-- +-- Redistribution and use in source and binary forms, with or without +-- modification, are permitted provided that the following conditions +-- are met: +-- 1. Redistributions of source code must retain the above copyright +-- notice, this list of conditions and the following disclaimer. +-- 2. Redistributions in binary form must reproduce the above copyright +-- notice, this list of conditions and the following disclaimer in the +-- documentation and/or other materials provided with the distribution. +-- +-- THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND +-- ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +-- IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +-- ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE +-- FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +-- DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +-- OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +-- HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +-- LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +-- OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +-- SUCH DAMAGE. +-- +-- $FreeBSD$ +-- + + +-- We generally assume that this script will be run by flua, however we've +-- carefully crafted modules for it that mimic interfaces provided by modules +-- available in ports. Currently, this script is compatible with lua from ports +-- along with the compatible luafilesystem and lua-posix modules. +local lfs = require("lfs") +local unistd = require("posix.unistd") + +local maxsyscall = 0 +local generated_tag = "@" .. "generated" + +-- Default configuration; any of these may get replaced by a configuration file +-- optionally specified. +local config = { + os_id_keyword = "FreeBSD", + abi_func_prefix = "", + sysnames = "syscalls.c", + sysproto = "../sys/sysproto.h", + sysproto_h = "_SYS_SYSPROTO_H_", + syshdr = "../sys/syscall.h", + sysmk = "../sys/syscall.mk", + syssw = "init_sysent.c", + syscallprefix = "SYS_", + switchname = "sysent", + namesname = "syscallnames", + systrace = "systrace_args.c", + capabilities_conf = "capabilities.conf", + capenabled = {}, + mincompat = 0, + abi_type_suffix = "", + abi_flags = "", + abi_flags_mask = 0, + ptr_intptr_t_cast = "intptr_t", +} + +local config_modified = {} +local cleantmp = true +local tmpspace = "/tmp/sysent." .. unistd.getpid() .. "/" + +-- These ones we'll open in place +local config_files_needed = { + "sysnames", + "syshdr", + "sysmk", + "syssw", + "systrace", +} + +-- These ones we'll create temporary files for; generation purposes. +local temp_files = { + "sysaue", + "sysdcl", + "syscompat", + "syscompatdcl", + "sysent", + "sysinc", + "sysarg", + "sysprotoend", + "systracetmp", + "systraceret", +} + +-- Opened files +local files = {} + +local function cleanup() + for _, v in pairs(files) do + v:close() + end + if cleantmp then + if lfs.dir(tmpspace) then + for fname in lfs.dir(tmpspace) do + os.remove(tmpspace .. "/" .. fname) + end + end + + if lfs.attributes(tmpspace) and not lfs.rmdir(tmpspace) then + io.stderr:write("Failed to clean up tmpdir: " .. + tmpspace .. "\n") + end + else + io.stderr:write("Temp files left in " .. tmpspace .. "\n") + end +end + +local function abort(status, msg) + io.stderr:write(msg .. "\n") + cleanup() + os.exit(status) +end + +-- Each entry should have a value so we can represent abi flags as a bitmask +-- for convenience. One may also optionally provide an expr; this gets applied +-- to each argument type to indicate whether this argument is subject to ABI +-- change given the configured flags. +local known_abi_flags = { + long_size = { + value = 0x00000001, + expr = "_Contains[a-z_]*_long_", + }, + time_t_size = { + value = 0x00000002, + expr = "_Contains[a-z_]*_timet_/", + }, + pointer_args = { + value = 0x00000004, + }, + pointer_size = { + value = 0x00000008, + expr = "_Contains[a-z_]*_ptr_", + }, +} + +local known_flags = { + STD = 0x00000001, + OBSOL = 0x00000002, + UNIMPL = 0x00000004, + NODEF = 0x00000008, + NOARGS = 0x00000010, + NOPROTO = 0x00000020, + NOSTD = 0x00000040, + NOTSTATIC = 0x00000080, + + -- Compat flags start from here. We have plenty of space. +} + +-- All compat_options entries should have five entries: +-- definition: The preprocessor macro that will be set for this +-- compatlevel: The level this compatibility should be included at. This +-- generally represents the version of FreeBSD that it is compatible +-- with, but ultimately it's just the level of mincompat in which it's +-- included. +-- flag: The name of the flag in syscalls.master. +-- prefix: The prefix to use for _args and syscall prototype. This will be +-- used as-is, without "_" or any other character appended. +-- descr: The description of this compat option in init_sysent.c comments. +-- The special "stdcompat" entry will cause the other five to be autogenerated. +local compat_options = { + { + definition = "COMPAT_43", + compatlevel = 3, + flag = "COMPAT", + prefix = "o", + descr = "old", + }, + { stdcompat = "FREEBSD4" }, + { stdcompat = "FREEBSD6" }, + { stdcompat = "FREEBSD7" }, + { stdcompat = "FREEBSD10" }, + { stdcompat = "FREEBSD11" }, + { stdcompat = "FREEBSD12" }, +} + +local function trim(s, char) + if s == nil then + return nil + end + if char == nil then + char = "%s" + end + return s:gsub("^" .. char .. "+", ""):gsub(char .. "+$", "") +end + +-- We have to io.popen it, making sure it's properly escaped, and grab the +-- output from the handle returned. +local function exec(cmd) + cmd = cmd:gsub('"', '\\"') + + local shcmd = "/bin/sh -c \"" .. cmd .. "\"" + local fh = io.popen(shcmd) + local output = fh:read("a") + + fh:close() + return output +end + +-- config looks like a shell script; in fact, the previous makesyscalls.sh +-- script actually sourced it in. It had a pretty common format, so we should +-- be fine to make various assumptions +local function process_config(file) + local cfg = {} + local commentExpr = "#.*" + local lineExpr = "([%w%p]+)%s*=%s*([`\"]?[^\"`]+[`\"]?)" + + if file == nil then + return nil, "No file given" + end + + local fh = io.open(file) + if fh == nil then + return nil, "Could not open file" + end + + for nextline in fh:lines() do + -- Strip any comments + nextline = nextline:gsub(commentExpr, "") + -- Parse it into key, value pairs + local key, value = nextline:match(lineExpr) + if key ~= nil and value ~= nil then + if value:sub(1,1) == '`' then + -- Command substition may use $1 and $2 to mean + -- the syscall definition file and itself + -- respectively. We'll go ahead and replace + -- $[0-9] with respective arg in case we want to + -- expand this in the future easily... + value = trim(value, "`") + for capture in value:gmatch("$([0-9]+)") do + capture = tonumber(capture) + if capture > #arg then + abort(1, "Not enough args: " .. + value) + end + value = value:gsub("$" .. capture, + arg[capture]) + end + + value = exec(value) + else + value = trim(value, '"') + end + cfg[key] = value + end + end + + io.close(fh) + return cfg +end + +local function grab_capenabled(file, open_fail_ok) + local capentries = {} + local commentExpr = "#.*" + + if file == nil then + print "No file" + return {} + end + + local fh = io.open(file) + if fh == nil then + if not open_fail_ok then + abort(1, "Failed to open " .. file) + end + return {} + end + + for nextline in fh:lines() do + -- Strip any comments + nextline = nextline:gsub(commentExpr, "") + if nextline ~= "" then + capentries[nextline] = true + end + end + + io.close(fh) + return capentries +end + +local function process_compat() + local nval = 0 + for _, v in pairs(known_flags) do + if v > nval then + nval = v + end + end + + nval = nval << 1 + for _, v in pairs(compat_options) do + if v["stdcompat"] ~= nil then + local stdcompat = v["stdcompat"] + v["definition"] = "COMPAT_" .. stdcompat:upper() + v["compatlevel"] = tonumber(stdcompat:match("([0-9]+)$")) + v["flag"] = stdcompat:gsub("FREEBSD", "COMPAT") + v["prefix"] = stdcompat:lower() .. "_" + v["descr"] = stdcompat:lower() + end + + local tmpname = "sys" .. v["flag"]:lower() + local dcltmpname = tmpname .. "dcl" + files[tmpname] = io.tmpfile() + files[dcltmpname] = io.tmpfile() + v["tmp"] = tmpname + v["dcltmp"] = dcltmpname + + known_flags[v["flag"]] = nval + v["mask"] = nval + nval = nval << 1 + + v["count"] = 0 + end +end + +local function process_abi_flags() + local flags, mask = config["abi_flags"], 0 + for txtflag in flags:gmatch("([^|]+)") do + if known_abi_flags[txtflag] == nil then + abort(1, "Unknown abi_flag: " .. txtflag) + end + + mask = mask | known_abi_flags[txtflag]["value"] + end + + config["abi_flags_mask"] = mask +end + +local function abi_changes(name) + if known_abi_flags[name] == nil then + abort(1, "abi_changes: unknown flag: " .. name) + end + + return config["abi_flags_mask"] & known_abi_flags[name]["value"] ~= 0 +end + +local function strip_abi_prefix(funcname) + local abiprefix = config["abi_func_prefix"] + local stripped_name + if abiprefix ~= "" and funcname:find("^" .. abiprefix) then + stripped_name = funcname:gsub("^" .. abiprefix, "") + else + stripped_name = funcname + end + + return stripped_name +end + +local function read_file(tmpfile) + if files[tmpfile] == nil then + print("Not found: " .. tmpfile) + return + end + + local fh = files[tmpfile] + fh:seek("set") + return fh:read("a") +end + +local function write_line(tmpfile, line) + if files[tmpfile] == nil then + print("Not found: " .. tmpfile) + return + end + files[tmpfile]:write(line) +end + +local function write_line_pfile(tmppat, line) + for k in pairs(files) do + if k:match(tmppat) ~= nil then + files[k]:write(line) + end + end +end + +local function isptrtype(type) + return type:find("*") or type:find("caddr_t") + -- XXX NOTYET: or type:find("intptr_t") +end + +local process_syscall_def + +-- These patterns are processed in order on any line that isn't empty. +local pattern_table = { + { + pattern = "%s*$" .. config['os_id_keyword'], + process = function(_, _) + -- Ignore... ID tag + end, + }, + { + dump_prevline = true, + pattern = "^#%s*include", + process = function(line) + line = line .. "\n" + write_line('sysinc', line) + end, + }, + { + dump_prevline = true, + pattern = "^#", + process = function(line) + line = line .. "\n" + write_line('sysent', line) + write_line('sysdcl', line) + write_line('sysarg', line) + write_line_pfile('syscompat[0-9]*$', line) + write_line('sysnames', line) + write_line_pfile('systrace.*', line) + end, + }, + { + -- Buffer anything else + pattern = ".+", + process = function(line, prevline) + local incomplete = line:find("\\$") ~= nil + -- Lines that end in \ get the \ stripped + -- Lines that start with a syscall number, prepend \n + line = trim(line):gsub("\\$", "") + if line:find("^[0-9]") and prevline then + process_syscall_def(prevline) + prevline = nil + end + + prevline = (prevline or '') .. line + incomplete = incomplete or prevline:find(",$") ~= nil + incomplete = incomplete or prevline:find("{") ~= nil and + prevline:find("}") == nil + if prevline:find("^[0-9]") and not incomplete then + process_syscall_def(prevline) + prevline = nil + end + + return prevline + end, + }, +} + +local function process_sysfile(file) + local capentries = {} + local commentExpr = "^%s*;.*" + + if file == nil then + print "No file" + return {} + end + + local fh = io.open(file) + if fh == nil then + print("Failed to open " .. file) + return {} + end + + local function do_match(nextline, prevline) + local pattern, handler, dump + for _, v in pairs(pattern_table) do + pattern = v['pattern'] + handler = v['process'] + dump = v['dump_prevline'] + if nextline:match(pattern) then + if dump and prevline then + process_syscall_def(prevline) + prevline = nil + end + + return handler(nextline, prevline) + end + end + + abort(1, "Failed to handle: " .. nextline) + end + + local prevline + for nextline in fh:lines() do + -- Strip any comments + nextline = nextline:gsub(commentExpr, "") + if nextline ~= "" then + prevline = do_match(nextline, prevline) + end + end + + -- Dump any remainder + if prevline ~= nil and prevline:find("^[0-9]") then + process_syscall_def(prevline) + end + + io.close(fh) + return capentries +end + +local function get_mask(flags) + local mask = 0 + for _, v in ipairs(flags) do + if known_flags[v] == nil then + abort(1, "Checking for unknown flag " .. v) + end + + mask = mask | known_flags[v] + end + + return mask +end + +local function get_mask_pat(pflags) + local mask = 0 + for k, v in pairs(known_flags) do + if k:find(pflags) then + mask = mask | v + end + end + + return mask +end + +local function align_sysent_comment(col) + write_line("sysent", "\t") + col = col + 8 - col % 8 + while col < 56 do + write_line("sysent", "\t") + col = col + 8 + end +end + +local function strip_arg_annotations(arg) + arg = arg:gsub("_In[^ ]*[_)] ?", "") + arg = arg:gsub("_Out[^ ]*[_)] ?", "") + return trim(arg) +end + +local function check_abi_changes(arg) + for k, v in pairs(known_abi_flags) do + local expr = v["expr"] + if abi_changes(k) and expr ~= nil and arg:find(expr) then + return true + end + end + + return false +end + +local function process_args(args) + local funcargs = {} + + for arg in args:gmatch("([^,]+)") do + local abi_change = not isptrtype(arg) or check_abi_changes(arg) + + arg = strip_arg_annotations(arg) + + local argname = arg:match("([^* ]+)$") + + -- argtype is... everything else. + local argtype = trim(arg:gsub(argname .. "$", ""), nil) + + if argtype == "" and argname == "void" then + goto out + end + + -- XX TODO: Forward declarations? See: sysstubfwd in CheriBSD + if abi_change then + local abi_type_suffix = config["abi_type_suffix"] + argtype = argtype:gsub("_native ", "") + argtype = argtype:gsub("(struct [^ ]*)", "%1" .. + abi_type_suffix) + argtype = argtype:gsub("(union [^ ]*)", "%1" .. + abi_type_suffix) + end + + funcargs[#funcargs + 1] = { + type = argtype, + name = argname, + } + end + + ::out:: + return funcargs +end + +local function handle_noncompat(sysnum, thr_flag, flags, sysflags, rettype, + auditev, syscallret, funcname, funcalias, funcargs, argalias) + local argssize + + if #funcargs > 0 or flags & known_flags["NODEF"] ~= 0 then + argssize = "AS(" .. argalias .. ")" + else + argssize = "0" + end + + write_line("systrace", string.format([[ + /* %s */ + case %d: { +]], funcname, sysnum)) + write_line("systracetmp", string.format([[ + /* %s */ + case %d: +]], funcname, sysnum)) + write_line("systraceret", string.format([[ + /* %s */ + case %d: +]], funcname, sysnum)) + + if #funcargs > 0 then + write_line("systracetmp", "\t\tswitch(ndx) {\n") + write_line("systrace", string.format( + "\t\tstruct %s *p = params;\n", argalias)) + + local argtype, argname + for idx, arg in ipairs(funcargs) do + argtype = arg["type"] + argname = arg["name"] + + argtype = trim(argtype:gsub("__restrict$", ""), nil) + -- Pointer arg? + if argtype:find("*") then + write_line("systracetmp", string.format( + "\t\tcase %d:\n\t\t\tp = \"userland %s\";\n\t\t\tbreak;\n", + idx - 1, argtype)) + else + write_line("systracetmp", string.format( + "\t\tcase %d:\n\t\t\tp = \"%s\";\n\t\t\tbreak;\n", + idx - 1, argtype)) + end + + if isptrtype(argtype) then + write_line("systrace", string.format( + "\t\tuarg[%d] = (%s) p->%s; /* %s */\n", + idx - 1, config["ptr_intptr_t_cast"], + argname, argtype)) + elseif argtype == "union l_semun" then + write_line("systrace", string.format( + "\t\tuarg[%d] = p->%s.buf; /* %s */\n", + idx - 1, argname, argtype)) + elseif argtype:sub(1,1) == "u" or argtype == "size_t" then + write_line("systrace", string.format( + "\t\tuarg[%d] = p->%s; /* %s */\n", + idx - 1, argname, argtype)) + else + write_line("systrace", string.format( + "\t\tiarg[%d] = p->%s; /* %s */\n", + idx - 1, argname, argtype)) + end + end + + write_line("systracetmp", + "\t\tdefault:\n\t\t\tbreak;\n\t\t};\n") + + write_line("systraceret", string.format([[ + if (ndx == 0 || ndx == 1) + p = "%s"; + break; +]], syscallret)) + end + write_line("systrace", string.format( + "\t\t*n_args = %d;\n\t\tbreak;\n\t}\n", #funcargs)) + write_line("systracetmp", "\t\tbreak;\n") + + local nargflags = get_mask({"NOARGS", "NOPROTO", "NODEF"}) + if flags & nargflags == 0 then + if #funcargs > 0 then + write_line("sysarg", string.format("struct %s {\n", + argalias)) + for _, v in ipairs(funcargs) do + local argname, argtype = v["name"], v["type"] + write_line("sysarg", string.format( + "\tchar %s_l_[PADL_(%s)]; %s %s; char %s_r_[PADR_(%s)];\n", + argname, argtype, + argtype, argname, + argname, argtype)) + end + write_line("sysarg", "};\n") + else + write_line("sysarg", string.format( + "struct %s {\n\tregister_t dummy;\n};\n", argalias)) + end + end + + local protoflags = get_mask({"NOPROTO", "NODEF"}) + if flags & protoflags == 0 then + if funcname == "nosys" or funcname == "lkmnosys" or + funcname == "sysarch" or funcname:find("^freebsd") or + funcname:find("^linux") or + funcname:find("^cloudabi") then + write_line("sysdcl", string.format( + "%s\t%s(struct thread *, struct %s *)", + rettype, funcname, argalias)) + else + write_line("sysdcl", string.format( + "%s\tsys_%s(struct thread *, struct %s *)", + rettype, funcname, argalias)) + end + write_line("sysdcl", ";\n") + write_line("sysaue", string.format("#define\t%sAUE_%s\t%s\n", + config['syscallprefix'], funcalias, auditev)) + end + + write_line("sysent", string.format("\t{ %s, (sy_call_t *)", argssize)) + local column = 8 + 2 + #argssize + 15 + + if flags & known_flags["NOSTD"] ~= 0 then + write_line("sysent", string.format( + "lkmressys, AUE_NULL, NULL, 0, 0, %s, SY_THR_ABSENT },", + sysflags)) + column = column + #"lkmressys" + #"AUE_NULL" + 3 + else + if funcname == "nosys" or funcname == "lkmnosys" or + funcname == "sysarch" or funcname:find("^freebsd") or + funcname:find("^linux") or + funcname:find("^cloudabi") then + write_line("sysent", string.format( + "%s, %s, NULL, 0, 0, %s, %s },", + funcname, auditev, sysflags, thr_flag)) + column = column + #funcname + #auditev + #sysflags + 3 + else + write_line("sysent", string.format( + "sys_%s, %s, NULL, 0, 0, %s, %s },", + funcname, auditev, sysflags, thr_flag)) + column = column + #funcname + #auditev + #sysflags + 7 + end + end + + align_sysent_comment(column) + write_line("sysent", string.format("/* %d = %s */\n", + sysnum, funcalias)) + write_line("sysnames", string.format("\t\"%s\",\t\t\t/* %d = %s */\n", + funcalias, sysnum, funcalias)) + + if flags & known_flags["NODEF"] == 0 then + write_line("syshdr", string.format("#define\t%s%s\t%d\n", + config['syscallprefix'], funcalias, sysnum)) + write_line("sysmk", string.format(" \\\n\t%s.o", + funcalias)) + end +end + +local function handle_obsol(sysnum, funcname, comment) + write_line("sysent", + "\t{ 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0, 0, SY_THR_ABSENT },") + align_sysent_comment(34) + + write_line("sysent", string.format("/* %d = obsolete %s */\n", + sysnum, comment)) + write_line("sysnames", string.format( + "\t\"obs_%s\",\t\t\t/* %d = obsolete %s */\n", + funcname, sysnum, comment)) + write_line("syshdr", string.format("\t\t\t\t/* %d is obsolete %s */\n", + sysnum, comment)) +end + +local function handle_compat(sysnum, thr_flag, flags, sysflags, rettype, + auditev, funcname, funcalias, funcargs, argalias) + local argssize, out, outdcl, wrap, prefix, descr + + if #funcargs > 0 or flags & known_flags["NODEF"] ~= 0 then + argssize = "AS(" .. argalias .. ")" + else + argssize = "0" + end + + for _, v in pairs(compat_options) do + if flags & v["mask"] ~= 0 then + if config["mincompat"] > v["compatlevel"] then + funcname = strip_abi_prefix(funcname) + funcname = v["prefix"] .. funcname + return handle_obsol(sysnum, funcname, funcname) + end + v["count"] = v["count"] + 1 + out = v["tmp"] + outdcl = v["dcltmp"] + wrap = v["flag"]:lower() + prefix = v["prefix"] + descr = v["descr"] + goto compatdone + end + end + + ::compatdone:: + local dprotoflags = get_mask({"NOPROTO", "NODEF"}) + local nargflags = dprotoflags | known_flags["NOARGS"] + if #funcargs > 0 and flags & nargflags == 0 then + write_line(out, string.format("struct %s {\n", argalias)) + for _, v in ipairs(funcargs) do + local argname, argtype = v["name"], v["type"] + write_line(out, string.format( + "\tchar %s_l_[PADL_(%s)]; %s %s; char %s_r_[PADR_(%s)];\n", + argname, argtype, + argtype, argname, + argname, argtype)) + end + write_line(out, "};\n") + elseif flags & nargflags == 0 then + write_line("sysarg", string.format( + "struct %s {\n\tregister_t dummy;\n};\n", argalias)) + end + if flags & dprotoflags == 0 then + write_line(outdcl, string.format( + "%s\t%s%s(struct thread *, struct %s *);\n", + rettype, prefix, funcname, argalias)) + write_line("sysaue", string.format( + "#define\t%sAUE_%s%s\t%s\n", config['syscallprefix'], + prefix, funcname, auditev)) + end + + if flags & known_flags['NOSTD'] ~= 0 then + write_line("sysent", string.format( + "\t{ %s, (sy_call_t *)%s, %s, NULL, 0, 0, 0, SY_THR_ABSENT },", + "0", "lkmressys", "AUE_NULL")) + align_sysent_comment(8 + 2 + #"0" + 15 + #"lkmressys" + + #"AUE_NULL" + 3) + else + write_line("sysent", string.format( + "\t{ %s(%s,%s), %s, NULL, 0, 0, %s, %s },", + wrap, argssize, funcname, auditev, sysflags, thr_flag)) + align_sysent_comment(8 + 9 + #argssize + 1 + #funcname + + #auditev + #sysflags + 4) + end + + write_line("sysent", string.format("/* %d = %s %s */\n", + sysnum, descr, funcalias)) + write_line("sysnames", string.format( + "\t\"%s.%s\",\t\t/* %d = %s %s */\n", + wrap, funcalias, sysnum, descr, funcalias)) + -- Do not provide freebsdN_* symbols in libc for < FreeBSD 7 + local nosymflags = get_mask({"COMPAT", "COMPAT4", "COMPAT6"}) + if flags & nosymflags ~= 0 then + write_line("syshdr", string.format( + "\t\t\t\t/* %d is %s %s */\n", + sysnum, descr, funcalias)) + elseif flags & known_flags["NODEF"] == 0 then + write_line("syshdr", string.format("#define\t%s%s%s\t%d\n", + config['syscallprefix'], prefix, funcalias, sysnum)) + write_line("sysmk", string.format(" \\\n\t%s%s.o", + prefix, funcalias)) + end +end + +local function handle_unimpl(sysnum, sysstart, sysend, comment) + if sysstart == nil and sysend == nil then + sysstart = tonumber(sysnum) + sysend = tonumber(sysnum) + end + + sysnum = sysstart + while sysnum <= sysend do + write_line("sysent", string.format( + "\t{ 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0, 0, SY_THR_ABSENT },\t\t\t/* %d = %s */\n", + sysnum, comment)) + write_line("sysnames", string.format( + "\t\"#%d\",\t\t\t/* %d = %s */\n", + sysnum, sysnum, comment)) + sysnum = sysnum + 1 + end +end + +process_syscall_def = function(line) + local sysstart, sysend, flags, funcname, sysflags + local thr_flag, syscallret + local orig = line + flags = 0 + thr_flag = "SY_THR_STATIC" + + -- Parse out the interesting information first + local initialExpr = "^([^%s]+)%s+([^%s]+)%s+([^%s]+)%s*" + local sysnum, auditev, allflags = line:match(initialExpr) + + if sysnum == nil or auditev == nil or allflags == nil then + -- XXX TODO: Better? + abort(1, "Completely malformed: " .. line) + end + + if sysnum:find("-") then + sysstart, sysend = sysnum:match("^([%d]+)-([%d]+)$") + if sysstart == nil or sysend == nil then + abort(1, "Malformed range: " .. sysnum) + end + sysnum = nil + sysstart = tonumber(sysstart) + sysend = tonumber(sysend) + end + + -- Split flags + for flag in allflags:gmatch("([^|]+)") do + if known_flags[flag] == nil then + abort(1, "Unknown flag " .. flag .. " for " .. sysnum) + end + flags = flags | known_flags[flag] + end + + if (flags & known_flags["UNIMPL"]) == 0 and sysnum == nil then + abort(1, "Range only allowed with UNIMPL: " .. line) + end + + if (flags & known_flags["NOTSTATIC"]) ~= 0 then + thr_flag = "SY_THR_ABSENT" + end + + -- Strip earlier bits out, leave declaration + alt + line = line:gsub("^.+" .. allflags .. "%s*", "") + + local decl_fnd = line:find("^{") ~= nil + if decl_fnd and line:find("}") == nil then + abort(1, "Malformed, no closing brace: " .. line) + end + + local decl, alt + if decl_fnd then + line = line:gsub("^{", "") + decl, alt = line:match("([^}]*)}[%s]*(.*)$") + else + alt = line + end + + if decl == nil and alt == nil then + abort(1, "Malformed bits: " .. line) + end + + local funcalias, funcomment, argalias, rettype, args + if not decl_fnd and alt ~= nil and alt ~= "" then + -- Peel off one entry for name + funcname = trim(alt:match("^([^%s]+)"), nil) + alt = alt:gsub("^([^%s]+)[%s]*", "") + end + -- Do we even need it? + if flags & get_mask({"OBSOL", "UNIMPL"}) ~= 0 then + local NF = 0 + for _ in orig:gmatch("[^%s]+") do + NF = NF + 1 + end + + funcomment = funcname or '' + if NF < 6 then + funcomment = funcomment .. " " .. alt + end + + funcomment = trim(funcomment) + +-- if funcname ~= nil then +-- else +-- funcomment = trim(alt) +-- end + goto skipalt + end + + if alt ~= nil and alt ~= "" then + local altExpr = "^([^%s]+)%s+([^%s]+)%s+([^%s]+)" + funcalias, argalias, rettype = alt:match(altExpr) + funcalias = trim(funcalias) + if funcalias == nil or argalias == nil or rettype == nil then + abort(1, "Malformed alt: " .. line) + end + end + if decl_fnd then + -- Don't clobber rettype set in the alt information + if rettype == nil then + rettype = "int" + end + -- Peel off the return type + syscallret = line:match("([^%s]+)%s") + line = line:match("[^%s]+%s(.+)") + -- Pointer incoming + if line:sub(1,1) == "*" then + syscallret = syscallret .. " " + end + while line:sub(1,1) == "*" do + line = line:sub(2) + syscallret = syscallret .. "*" + end + funcname = line:match("^([^(]+)%(") + if funcname == nil then + abort(1, "Not a signature? " .. line) + end + args = line:match("^[^(]+%((.+)%)[^)]*$") + end + + ::skipalt:: + + if funcname == nil then + funcname = funcalias + end + + funcname = trim(funcname) + + sysflags = "0" + + -- NODEF events do not get audited + if flags & known_flags['NODEF'] ~= 0 then + auditev = 'AUE_NULL' + end + + -- If applicable; strip the ABI prefix from the name + local stripped_name = strip_abi_prefix(funcname) + + if config["capenabled"][funcname] ~= nil or + config["capenabled"][stripped_name] ~= nil then *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-all@freebsd.org Sun Nov 17 14:11:09 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 453CD1C15FB; Sun, 17 Nov 2019 14:11:09 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47GDXD6Sg8z4Xn5; Sun, 17 Nov 2019 14:11:08 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 903F01AEC2; Sun, 17 Nov 2019 14:11:08 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xAHEB83b039757; Sun, 17 Nov 2019 14:11:08 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xAHEB8HV039740; Sun, 17 Nov 2019 14:11:08 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201911171411.xAHEB8HV039740@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Sun, 17 Nov 2019 14:11:08 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354787 - head/lib/libc/gen X-SVN-Group: head X-SVN-Commit-Author: kib X-SVN-Commit-Paths: head/lib/libc/gen X-SVN-Commit-Revision: 354787 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 17 Nov 2019 14:11:09 -0000 Author: kib Date: Sun Nov 17 14:11:08 2019 New Revision: 354787 URL: https://svnweb.freebsd.org/changeset/base/354787 Log: Document required size of buffer for elf_aux_info(3). PR: 241884 Reported by: jbeich Reviewed by: brooks Sponsored by: The FreeBSD Foundation MFC after: 3 days Differential revision: https://reviews.freebsd.org/D22380 Modified: head/lib/libc/gen/auxv.3 Modified: head/lib/libc/gen/auxv.3 ============================================================================== --- head/lib/libc/gen/auxv.3 Sun Nov 17 14:08:19 2019 (r354786) +++ head/lib/libc/gen/auxv.3 Sun Nov 17 14:11:08 2019 (r354787) @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd November 13, 2019 +.Dd November 17, 2019 .Dt ELF_AUX_INFO 3 .Os .Sh NAME @@ -44,29 +44,41 @@ function retrieves the auxiliary info vector requested The information is stored into the provided buffer if it will fit. The following values, defined in .In sys/elf_common.h -can be requested: +can be requested (corresponding buffer sizes are specified in parenthesis): .Bl -tag -width AT_OSRELDATE .It AT_CANARY -The canary value for SSP. +The canary value for SSP (arbitrary sized buffer, as many bytes are +returned as it fits into it, rest is zeroed). .It AT_EXECPATH -The path of executed program. +The path of executed program +.Dv (MAXPATHLEN). This may not be present if the process was initialized by .Xr fexecve 2 and the namecache no longer contains the file's name. .It AT_HWCAP -CPU / hardware feature flags. +CPU / hardware feature flags +.Dv (sizeof(u_long)). .It AT_HWCAP2 -CPU / hardware feature flags. +CPU / hardware feature flags +.Dv (sizeof(u_long)). .It AT_NCPUS -Number of CPUs. +Number of CPUs +.Dv (sizeof(int)). .It AT_OSRELDATE -Kernel OSRELDATE. +The +.Dv OSRELDATE +of the kernel or jail the program is running on +.Dv (sizeof(int)). .It AT_PAGESIZES -Vector of page sizes. +Vector of page sizes (arbitrary sized buffer, as many elements of the +.Dv pagesizes +array are returned as it fits). .It AT_PAGESZ -Page size in bytes. +Page size in bytes +.Dv (sizeof(int)). .It AT_TIMEKEEP -Pointer to VDSO timehands (for library internal use). +Pointer to VDSO timehands (for library internal use, +.Dv sizeof(void *)). .El .Sh RETURN VALUES Returns zero on success, or an error number on failure. From owner-svn-src-all@freebsd.org Sun Nov 17 14:41:48 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id D354B1C1ECA; Sun, 17 Nov 2019 14:41:48 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47GFCc2LRwz3QSd; Sun, 17 Nov 2019 14:41:48 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 214231B559; Sun, 17 Nov 2019 14:41:48 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xAHEflUs057992; Sun, 17 Nov 2019 14:41:47 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xAHEflWX057991; Sun, 17 Nov 2019 14:41:47 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201911171441.xAHEflWX057991@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Sun, 17 Nov 2019 14:41:47 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354788 - head/sys/amd64/amd64 X-SVN-Group: head X-SVN-Commit-Author: kib X-SVN-Commit-Paths: head/sys/amd64/amd64 X-SVN-Commit-Revision: 354788 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 17 Nov 2019 14:41:48 -0000 Author: kib Date: Sun Nov 17 14:41:47 2019 New Revision: 354788 URL: https://svnweb.freebsd.org/changeset/base/354788 Log: amd64 copyout: remove irrelevant comment. Sponsored by: The FreeBSD Foundation MFC after: 3 days Modified: head/sys/amd64/amd64/support.S Modified: head/sys/amd64/amd64/support.S ============================================================================== --- head/sys/amd64/amd64/support.S Sun Nov 17 14:11:08 2019 (r354787) +++ head/sys/amd64/amd64/support.S Sun Nov 17 14:41:47 2019 (r354788) @@ -671,13 +671,7 @@ END(fillw) movq $copy_fault,PCB_ONFAULT(%r11) /* - * Check explicitly for non-user addresses. If 486 write protection - * is being used, this check is essential because we are in kernel - * mode so the h/w does not provide any protection against writing - * kernel addresses. - */ - - /* + * Check explicitly for non-user addresses. * First, prevent address wrapping. */ movq %rsi,%rax From owner-svn-src-all@freebsd.org Sun Nov 17 14:52:47 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 8E9191C22E5; Sun, 17 Nov 2019 14:52:47 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47GFSG4pXRz4DJc; Sun, 17 Nov 2019 14:52:46 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 6AC761B752; Sun, 17 Nov 2019 14:52:46 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xAHEqkGF067266; Sun, 17 Nov 2019 14:52:46 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xAHEqkrh067265; Sun, 17 Nov 2019 14:52:46 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201911171452.xAHEqkrh067265@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Sun, 17 Nov 2019 14:52:46 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354789 - head/sys/kern X-SVN-Group: head X-SVN-Commit-Author: kib X-SVN-Commit-Paths: head/sys/kern X-SVN-Commit-Revision: 354789 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 17 Nov 2019 14:52:47 -0000 Author: kib Date: Sun Nov 17 14:52:45 2019 New Revision: 354789 URL: https://svnweb.freebsd.org/changeset/base/354789 Log: kern_exec: p_osrel and p_fctl0 were obliterated by failed execve(2) attempt. Zeroing of them is needed so that an image activator can update the values as appropriate (or not set at all). Reviewed by: markj Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D22379 Modified: head/sys/kern/kern_exec.c Modified: head/sys/kern/kern_exec.c ============================================================================== --- head/sys/kern/kern_exec.c Sun Nov 17 14:41:47 2019 (r354788) +++ head/sys/kern/kern_exec.c Sun Nov 17 14:52:45 2019 (r354789) @@ -361,7 +361,6 @@ do_execve(struct thread *td, struct image_args *args, struct ucred *oldcred; struct uidinfo *euip = NULL; register_t *stack_base; - int error, i; struct image_params image_params, *imgp; struct vattr attr; int (*img_first)(struct image_params *); @@ -380,6 +379,8 @@ do_execve(struct thread *td, struct image_args *args, #ifdef HWPMC_HOOKS struct pmckern_procexec pe; #endif + int error, i, orig_osrel; + uint32_t orig_fctl0; static const char fexecv_proc_title[] = "(fexecv)"; imgp = &image_params; @@ -405,6 +406,8 @@ do_execve(struct thread *td, struct image_args *args, imgp->attr = &attr; imgp->args = args; oldcred = p->p_ucred; + orig_osrel = p->p_osrel; + orig_fctl0 = p->p_fctl0; #ifdef MAC error = mac_execve_enter(imgp, mac_p); @@ -868,6 +871,11 @@ interpret: SDT_PROBE1(proc, , , exec__success, args->fname); exec_fail_dealloc: + if (error != 0) { + p->p_osrel = orig_osrel; + p->p_fctl0 = orig_fctl0; + } + if (imgp->firstpage != NULL) exec_unmap_first_page(imgp); From owner-svn-src-all@freebsd.org Sun Nov 17 14:54:09 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id C743D1C236C; Sun, 17 Nov 2019 14:54:09 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47GFTs2RDlz4FwW; Sun, 17 Nov 2019 14:54:09 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 7CE251B75A; Sun, 17 Nov 2019 14:54:08 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xAHEs87Y067370; Sun, 17 Nov 2019 14:54:08 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xAHEs80G067369; Sun, 17 Nov 2019 14:54:08 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201911171454.xAHEs80G067369@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Sun, 17 Nov 2019 14:54:08 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354790 - in head/sys: sys vm X-SVN-Group: head X-SVN-Commit-Author: kib X-SVN-Commit-Paths: in head/sys: sys vm X-SVN-Commit-Revision: 354790 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 17 Nov 2019 14:54:09 -0000 Author: kib Date: Sun Nov 17 14:54:07 2019 New Revision: 354790 URL: https://svnweb.freebsd.org/changeset/base/354790 Log: Add elf image flag to disable stack gap. Reviewed by: markj Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D22379 Modified: head/sys/sys/elf_common.h head/sys/vm/vm_map.c Modified: head/sys/sys/elf_common.h ============================================================================== --- head/sys/sys/elf_common.h Sun Nov 17 14:52:45 2019 (r354789) +++ head/sys/sys/elf_common.h Sun Nov 17 14:54:07 2019 (r354790) @@ -784,6 +784,7 @@ typedef struct { /* NT_FREEBSD_FEATURE_CTL desc[0] bits */ #define NT_FREEBSD_FCTL_ASLR_DISABLE 0x00000001 #define NT_FREEBSD_FCTL_PROTMAX_DISABLE 0x00000002 +#define NT_FREEBSD_FCTL_STKGAP_DISABLE 0x00000004 /* Values for n_type. Used in core files. */ #define NT_PRSTATUS 1 /* Process status. */ Modified: head/sys/vm/vm_map.c ============================================================================== --- head/sys/vm/vm_map.c Sun Nov 17 14:52:45 2019 (r354789) +++ head/sys/vm/vm_map.c Sun Nov 17 14:54:07 2019 (r354790) @@ -69,6 +69,7 @@ __FBSDID("$FreeBSD$"); #include #include +#include #include #include #include @@ -4136,7 +4137,8 @@ vm_map_stack_locked(vm_map_t map, vm_offset_t addrbos, addrbos + max_ssize > vm_map_max(map) || addrbos + max_ssize <= addrbos) return (KERN_INVALID_ADDRESS); - sgp = (curproc->p_flag2 & P2_STKGAP_DISABLE) != 0 ? 0 : + sgp = ((curproc->p_flag2 & P2_STKGAP_DISABLE) != 0 || + (curproc->p_fctl0 & NT_FREEBSD_FCTL_STKGAP_DISABLE) != 0) ? 0 : (vm_size_t)stack_guard_page * PAGE_SIZE; if (sgp >= max_ssize) return (KERN_INVALID_ARGUMENT); @@ -4273,7 +4275,8 @@ retry: } else { return (KERN_FAILURE); } - guard = (curproc->p_flag2 & P2_STKGAP_DISABLE) != 0 ? 0 : + guard = ((curproc->p_flag2 & P2_STKGAP_DISABLE) != 0 || + (curproc->p_fctl0 & NT_FREEBSD_FCTL_STKGAP_DISABLE) != 0) ? 0 : gap_entry->next_read; max_grow = gap_entry->end - gap_entry->start; if (guard > max_grow) From owner-svn-src-all@freebsd.org Sun Nov 17 14:54:45 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id BB69D1C23F8; Sun, 17 Nov 2019 14:54:45 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47GFVY00lgz4Gg7; Sun, 17 Nov 2019 14:54:44 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4F4131B75B; Sun, 17 Nov 2019 14:54:44 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xAHEsiw2067439; Sun, 17 Nov 2019 14:54:44 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xAHEsiOI067438; Sun, 17 Nov 2019 14:54:44 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201911171454.xAHEsiOI067438@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Sun, 17 Nov 2019 14:54:44 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354791 - head/tools/tools/controlelf X-SVN-Group: head X-SVN-Commit-Author: kib X-SVN-Commit-Paths: head/tools/tools/controlelf X-SVN-Commit-Revision: 354791 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 17 Nov 2019 14:54:45 -0000 Author: kib Date: Sun Nov 17 14:54:43 2019 New Revision: 354791 URL: https://svnweb.freebsd.org/changeset/base/354791 Log: Update controlelf(1) to ahndle stack gap disable flag. Reviewed by: markj Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D22379 Modified: head/tools/tools/controlelf/controlelf.c Modified: head/tools/tools/controlelf/controlelf.c ============================================================================== --- head/tools/tools/controlelf/controlelf.c Sun Nov 17 14:54:07 2019 (r354790) +++ head/tools/tools/controlelf/controlelf.c Sun Nov 17 14:54:43 2019 (r354791) @@ -63,7 +63,9 @@ struct ControlFeatures { static struct ControlFeatures featurelist[] = { { "aslr", NT_FREEBSD_FCTL_ASLR_DISABLE, "Disable ASLR" }, - { "protmax", NT_FREEBSD_FCTL_PROTMAX_DISABLE,"Disable implicit PROT_MAX" }, + { "protmax", NT_FREEBSD_FCTL_PROTMAX_DISABLE, + "Disable implicit PROT_MAX" }, + { "stackgap", NT_FREEBSD_FCTL_STKGAP_DISABLE, "Disable stack gap" }, }; static struct option long_opts[] = { From owner-svn-src-all@freebsd.org Sun Nov 17 17:38:54 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 3962E1C55DC; Sun, 17 Nov 2019 17:38:54 +0000 (UTC) (envelope-from alc@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47GK7x6nMmz4qPG; Sun, 17 Nov 2019 17:38:53 +0000 (UTC) (envelope-from alc@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id C1C401D3CE; Sun, 17 Nov 2019 17:38:53 +0000 (UTC) (envelope-from alc@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xAHHcrph061434; Sun, 17 Nov 2019 17:38:53 GMT (envelope-from alc@FreeBSD.org) Received: (from alc@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xAHHcrPN061433; Sun, 17 Nov 2019 17:38:53 GMT (envelope-from alc@FreeBSD.org) Message-Id: <201911171738.xAHHcrPN061433@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: alc set sender to alc@FreeBSD.org using -f From: Alan Cox Date: Sun, 17 Nov 2019 17:38:53 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354792 - head/sys/arm64/arm64 X-SVN-Group: head X-SVN-Commit-Author: alc X-SVN-Commit-Paths: head/sys/arm64/arm64 X-SVN-Commit-Revision: 354792 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 17 Nov 2019 17:38:54 -0000 Author: alc Date: Sun Nov 17 17:38:53 2019 New Revision: 354792 URL: https://svnweb.freebsd.org/changeset/base/354792 Log: Achieve two goals at once: (1) Avoid an unnecessary broadcast TLB invalidation in pmap_remove_all(). (2) Prevent an "invalid ASID" assertion failure in pmap_remove_all(). The architecture definition specifies that the TLB will not cache mappings that don't have the "AF" bit set, so pmap_remove_all() needn't issue a TLB invalidation for mappings that don't have the "AF" bit set. We allocate ASIDs lazily. Specifically, we don't allocate an ASID for a pmap until we are activating it. Now, consider what happens on a fork(). Before we activate the child's pmap, we use pmap_copy() to copy mappings from the parent's pmap to the child's. These new mappings have their "AF" bits cleared. Suppose that the page daemon decides to reclaim a page that underlies one of these new mappings. Previously, the pmap_invalidate_page() performed by pmap_remove_all() on a mapping in the child's pmap would fail an assertion because that pmap hasn't yet been assigned an ASID. However, we don't need to issue a TLB invalidation for such mappings because they can't possibly be cached in the TLB. Reported by: bob prohaska Reviewed by: markj MFC after: 1 week X-MFC-before: r354286 Differential Revision: https://reviews.freebsd.org/D22388 Modified: head/sys/arm64/arm64/pmap.c Modified: head/sys/arm64/arm64/pmap.c ============================================================================== --- head/sys/arm64/arm64/pmap.c Sun Nov 17 14:54:43 2019 (r354791) +++ head/sys/arm64/arm64/pmap.c Sun Nov 17 17:38:53 2019 (r354792) @@ -2879,11 +2879,12 @@ retry: pte = pmap_l2_to_l3(pde, pv->pv_va); tpte = pmap_load_clear(pte); - pmap_invalidate_page(pmap, pv->pv_va); if (tpte & ATTR_SW_WIRED) pmap->pm_stats.wired_count--; - if ((tpte & ATTR_AF) != 0) + if ((tpte & ATTR_AF) != 0) { + pmap_invalidate_page(pmap, pv->pv_va); vm_page_aflag_set(m, PGA_REFERENCED); + } /* * Update the vm_page_t clean and reference bits. From owner-svn-src-all@freebsd.org Sun Nov 17 18:25:43 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 943831C66EB; Sun, 17 Nov 2019 18:25:43 +0000 (UTC) (envelope-from lwhsu@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47GL9z1x9rz4BjM; Sun, 17 Nov 2019 18:25:43 +0000 (UTC) (envelope-from lwhsu@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 0A3C01DCBC; Sun, 17 Nov 2019 18:25:43 +0000 (UTC) (envelope-from lwhsu@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xAHIPgWP090805; Sun, 17 Nov 2019 18:25:42 GMT (envelope-from lwhsu@FreeBSD.org) Received: (from lwhsu@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xAHIPgUq090804; Sun, 17 Nov 2019 18:25:42 GMT (envelope-from lwhsu@FreeBSD.org) Message-Id: <201911171825.xAHIPgUq090804@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: lwhsu set sender to lwhsu@FreeBSD.org using -f From: Li-Wen Hsu Date: Sun, 17 Nov 2019 18:25:42 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r354793 - stable/12/lib/msun/src X-SVN-Group: stable-12 X-SVN-Commit-Author: lwhsu X-SVN-Commit-Paths: stable/12/lib/msun/src X-SVN-Commit-Revision: 354793 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 17 Nov 2019 18:25:43 -0000 Author: lwhsu Date: Sun Nov 17 18:25:42 2019 New Revision: 354793 URL: https://svnweb.freebsd.org/changeset/base/354793 Log: MFC r354520: Get the fix in back by reverting the part accidentally included in r354491. This brings back r354467. Sponsored by: The FreeBSD Foundation Modified: stable/12/lib/msun/src/k_sincosl.h Directory Properties: stable/12/ (props changed) Modified: stable/12/lib/msun/src/k_sincosl.h ============================================================================== --- stable/12/lib/msun/src/k_sincosl.h Sun Nov 17 17:38:53 2019 (r354792) +++ stable/12/lib/msun/src/k_sincosl.h Sun Nov 17 18:25:42 2019 (r354793) @@ -28,8 +28,8 @@ S1lo = -9.2563760475949941e-18; /* -0x15580000000000. #define C1 ((long double)C1hi + C1lo) #else static const long double -C1 = 0.0416666666666666666136L; /* 0xaaaaaaaaaaaaaa9b.0p-68 */ -S1 = -0.166666666666666666671L, /* -0xaaaaaaaaaaaaaaab.0p-66 */ +C1 = 0.0416666666666666666136L, /* 0xaaaaaaaaaaaaaa9b.0p-68 */ +S1 = -0.166666666666666666671L; /* -0xaaaaaaaaaaaaaaab.0p-66 */ #endif static const double From owner-svn-src-all@freebsd.org Sun Nov 17 18:26:08 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 1CCE01C674C; Sun, 17 Nov 2019 18:26:08 +0000 (UTC) (envelope-from lwhsu@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47GLBR5w10z4CSl; Sun, 17 Nov 2019 18:26:07 +0000 (UTC) (envelope-from lwhsu@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 764981DCBD; Sun, 17 Nov 2019 18:26:07 +0000 (UTC) (envelope-from lwhsu@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xAHIQ7w0090868; Sun, 17 Nov 2019 18:26:07 GMT (envelope-from lwhsu@FreeBSD.org) Received: (from lwhsu@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xAHIQ7Pg090867; Sun, 17 Nov 2019 18:26:07 GMT (envelope-from lwhsu@FreeBSD.org) Message-Id: <201911171826.xAHIQ7Pg090867@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: lwhsu set sender to lwhsu@FreeBSD.org using -f From: Li-Wen Hsu Date: Sun, 17 Nov 2019 18:26:07 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r354794 - stable/11/lib/msun/src X-SVN-Group: stable-11 X-SVN-Commit-Author: lwhsu X-SVN-Commit-Paths: stable/11/lib/msun/src X-SVN-Commit-Revision: 354794 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 17 Nov 2019 18:26:08 -0000 Author: lwhsu Date: Sun Nov 17 18:26:07 2019 New Revision: 354794 URL: https://svnweb.freebsd.org/changeset/base/354794 Log: MFC r354520: Get the fix in back by reverting the part accidentally included in r354491. This brings back r354467. Sponsored by: The FreeBSD Foundation Modified: stable/11/lib/msun/src/k_sincosl.h Directory Properties: stable/11/ (props changed) Modified: stable/11/lib/msun/src/k_sincosl.h ============================================================================== --- stable/11/lib/msun/src/k_sincosl.h Sun Nov 17 18:25:42 2019 (r354793) +++ stable/11/lib/msun/src/k_sincosl.h Sun Nov 17 18:26:07 2019 (r354794) @@ -28,8 +28,8 @@ S1lo = -9.2563760475949941e-18; /* -0x15580000000000. #define C1 ((long double)C1hi + C1lo) #else static const long double -C1 = 0.0416666666666666666136L; /* 0xaaaaaaaaaaaaaa9b.0p-68 */ -S1 = -0.166666666666666666671L, /* -0xaaaaaaaaaaaaaaab.0p-66 */ +C1 = 0.0416666666666666666136L, /* 0xaaaaaaaaaaaaaa9b.0p-68 */ +S1 = -0.166666666666666666671L; /* -0xaaaaaaaaaaaaaaab.0p-66 */ #endif static const double From owner-svn-src-all@freebsd.org Sun Nov 17 18:38:38 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id AE5D81C6DD6; Sun, 17 Nov 2019 18:38:38 +0000 (UTC) (envelope-from dougm@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47GLSt28q2z4d59; Sun, 17 Nov 2019 18:38:38 +0000 (UTC) (envelope-from dougm@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id D79021DE93; Sun, 17 Nov 2019 18:38:37 +0000 (UTC) (envelope-from dougm@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xAHIcbiN096795; Sun, 17 Nov 2019 18:38:37 GMT (envelope-from dougm@FreeBSD.org) Received: (from dougm@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xAHIcb4P096794; Sun, 17 Nov 2019 18:38:37 GMT (envelope-from dougm@FreeBSD.org) Message-Id: <201911171838.xAHIcb4P096794@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dougm set sender to dougm@FreeBSD.org using -f From: Doug Moore Date: Sun, 17 Nov 2019 18:38:37 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354795 - head/sys/vm X-SVN-Group: head X-SVN-Commit-Author: dougm X-SVN-Commit-Paths: head/sys/vm X-SVN-Commit-Revision: 354795 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 17 Nov 2019 18:38:38 -0000 Author: dougm Date: Sun Nov 17 18:38:37 2019 New Revision: 354795 URL: https://svnweb.freebsd.org/changeset/base/354795 Log: Add a helper function for testing a swap block and freeing it if empty. Submitted by: ota_j.email.ne.jp Approved by: alc, kib, dougm Differential Revision: https://reviews.freebsd.org/D22402 Modified: head/sys/vm/swap_pager.c Modified: head/sys/vm/swap_pager.c ============================================================================== --- head/sys/vm/swap_pager.c Sun Nov 17 18:26:07 2019 (r354794) +++ head/sys/vm/swap_pager.c Sun Nov 17 18:38:37 2019 (r354795) @@ -407,6 +407,7 @@ SYSCTL_INT(_vm, OID_AUTO, dmmax, CTLFLAG_RD, &nsw_clus static void swp_sizecheck(void); static void swp_pager_async_iodone(struct buf *bp); static bool swp_pager_swblk_empty(struct swblk *sb, int start, int limit); +static void swp_pager_free_empty_swblk(vm_object_t, struct swblk *sb); static int swapongeom(struct vnode *); static int swaponvp(struct thread *, struct vnode *, u_long); static int swapoff_one(struct swdevt *sp, struct ucred *cred); @@ -1872,6 +1873,21 @@ swp_pager_swblk_empty(struct swblk *sb, int start, int } return (true); } + +/* + * SWP_PAGER_FREE_EMPTY_SWBLK() - frees if a block is free + * + * Nothing is done if the block is still in use. + */ +static void +swp_pager_free_empty_swblk(vm_object_t object, struct swblk *sb) +{ + + if (swp_pager_swblk_empty(sb, 0, SWAP_META_PAGES)) { + SWAP_PCTRIE_REMOVE(&object->un_pager.swp.swp_blks, sb->p); + uma_zfree(swblk_zone, sb); + } +} /* * SWP_PAGER_META_BUILD() - add swap block to swap meta data for object @@ -1990,11 +2006,8 @@ allocated: /* * Free the swblk if we end up with the empty page run. */ - if (swapblk == SWAPBLK_NONE && - swp_pager_swblk_empty(sb, 0, SWAP_META_PAGES)) { - SWAP_PCTRIE_REMOVE(&object->un_pager.swp.swp_blks, rdpi); - uma_zfree(swblk_zone, sb); - } + if (swapblk == SWAPBLK_NONE) + swp_pager_free_empty_swblk(object, sb); return (prev_swapblk); } @@ -2140,11 +2153,7 @@ swp_pager_meta_ctl(vm_object_t object, vm_pindex_t pin return (SWAPBLK_NONE); if ((flags & SWM_POP) != 0) { sb->d[pindex % SWAP_META_PAGES] = SWAPBLK_NONE; - if (swp_pager_swblk_empty(sb, 0, SWAP_META_PAGES)) { - SWAP_PCTRIE_REMOVE(&object->un_pager.swp.swp_blks, - rounddown(pindex, SWAP_META_PAGES)); - uma_zfree(swblk_zone, sb); - } + swp_pager_free_empty_swblk(object, sb); } return (r1); } From owner-svn-src-all@freebsd.org Sun Nov 17 19:04:02 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id E02BC1C74F4; Sun, 17 Nov 2019 19:04:02 +0000 (UTC) (envelope-from arichardson@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47GM2B5T7pz4YRB; Sun, 17 Nov 2019 19:04:02 +0000 (UTC) (envelope-from arichardson@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 9EFAB1E3FA; Sun, 17 Nov 2019 19:04:02 +0000 (UTC) (envelope-from arichardson@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xAHJ4297014417; Sun, 17 Nov 2019 19:04:02 GMT (envelope-from arichardson@FreeBSD.org) Received: (from arichardson@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xAHJ42tn014416; Sun, 17 Nov 2019 19:04:02 GMT (envelope-from arichardson@FreeBSD.org) Message-Id: <201911171904.xAHJ42tn014416@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: arichardson set sender to arichardson@FreeBSD.org using -f From: Alex Richardson Date: Sun, 17 Nov 2019 19:04:02 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354796 - head/usr.sbin/i2c X-SVN-Group: head X-SVN-Commit-Author: arichardson X-SVN-Commit-Paths: head/usr.sbin/i2c X-SVN-Commit-Revision: 354796 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 17 Nov 2019 19:04:03 -0000 Author: arichardson Date: Sun Nov 17 19:04:02 2019 New Revision: 354796 URL: https://svnweb.freebsd.org/changeset/base/354796 Log: Fix error found by new clang operator precendence warning error: operator '?:' has lower precedence than '|'; '|' will be evaluated first I discovered this in CheriBSD after updating our fork of clang to the latest upstream master. Reviewed By: ian Differential Revision: https://reviews.freebsd.org/D22433 Modified: head/usr.sbin/i2c/i2c.c Modified: head/usr.sbin/i2c/i2c.c ============================================================================== --- head/usr.sbin/i2c/i2c.c Sun Nov 17 18:38:37 2019 (r354795) +++ head/usr.sbin/i2c/i2c.c Sun Nov 17 19:04:02 2019 (r354796) @@ -590,7 +590,7 @@ i2c_rdwr_transfer(char *dev, struct options i2c_opt, c * because of the NOSTOP flag used above. */ if (i2c_opt.dir == 'w') - msgs[i].flags = IIC_M_WR | (i > 0) ? IIC_M_NOSTART : 0; + msgs[i].flags = IIC_M_WR | ((i > 0) ? IIC_M_NOSTART : 0); else msgs[i].flags = IIC_M_RD; msgs[i].slave = i2c_opt.addr; From owner-svn-src-all@freebsd.org Sun Nov 17 20:49:25 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 1C5691AA4D9; Sun, 17 Nov 2019 20:49:25 +0000 (UTC) (envelope-from jhibbits@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47GPMm6W5fz3HSD; Sun, 17 Nov 2019 20:49:24 +0000 (UTC) (envelope-from jhibbits@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id A26DB1F5D1; Sun, 17 Nov 2019 20:49:24 +0000 (UTC) (envelope-from jhibbits@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xAHKnO0w072639; Sun, 17 Nov 2019 20:49:24 GMT (envelope-from jhibbits@FreeBSD.org) Received: (from jhibbits@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xAHKnOdQ072638; Sun, 17 Nov 2019 20:49:24 GMT (envelope-from jhibbits@FreeBSD.org) Message-Id: <201911172049.xAHKnOdQ072638@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhibbits set sender to jhibbits@FreeBSD.org using -f From: Justin Hibbits Date: Sun, 17 Nov 2019 20:49:24 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354797 - head/sys/powerpc/conf/dpaa X-SVN-Group: head X-SVN-Commit-Author: jhibbits X-SVN-Commit-Paths: head/sys/powerpc/conf/dpaa X-SVN-Commit-Revision: 354797 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 17 Nov 2019 20:49:25 -0000 Author: jhibbits Date: Sun Nov 17 20:49:24 2019 New Revision: 354797 URL: https://svnweb.freebsd.org/changeset/base/354797 Log: powerpc: Re-add -Wno-redundant-decls to DPAA build flags Since the DPAA code is from a third party, with minimal edits, there is no intent to fix these specific warnings at this time. Hide these warnings to prevent the noise from hiding real warnings. Modified: head/sys/powerpc/conf/dpaa/config.dpaa Modified: head/sys/powerpc/conf/dpaa/config.dpaa ============================================================================== --- head/sys/powerpc/conf/dpaa/config.dpaa Sun Nov 17 19:04:02 2019 (r354796) +++ head/sys/powerpc/conf/dpaa/config.dpaa Sun Nov 17 20:49:24 2019 (r354797) @@ -6,6 +6,7 @@ makeoptions DPAA_COMPILE_CMD="${LINUXKPI_C} ${DPAAWARN -Wno-cast-qual -Wno-unused-function -Wno-init-self -fms-extensions \ -include $S/contrib/ncsw/build/dflags.h \ -Wno-error=missing-prototypes \ + -Wno-redundant-decls \ -I$S/contrib/ncsw/build/ \ -I$S/contrib/ncsw/inc \ -I$S/contrib/ncsw/inc/cores \ From owner-svn-src-all@freebsd.org Sun Nov 17 20:56:27 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 6FAF41AA7EE; Sun, 17 Nov 2019 20:56:27 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47GPWt6czqz3Q7F; Sun, 17 Nov 2019 20:56:26 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 6E65F1F78A; Sun, 17 Nov 2019 20:56:26 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xAHKuQd6078707; Sun, 17 Nov 2019 20:56:26 GMT (envelope-from delphij@FreeBSD.org) Received: (from delphij@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xAHKuQMo078706; Sun, 17 Nov 2019 20:56:26 GMT (envelope-from delphij@FreeBSD.org) Message-Id: <201911172056.xAHKuQMo078706@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: delphij set sender to delphij@FreeBSD.org using -f From: Xin LI Date: Sun, 17 Nov 2019 20:56:26 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-vendor@freebsd.org Subject: svn commit: r354798 - vendor/file/dist/src X-SVN-Group: vendor X-SVN-Commit-Author: delphij X-SVN-Commit-Paths: vendor/file/dist/src X-SVN-Commit-Revision: 354798 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 17 Nov 2019 20:56:27 -0000 Author: delphij Date: Sun Nov 17 20:56:25 2019 New Revision: 354798 URL: https://svnweb.freebsd.org/changeset/base/354798 Log: Apply vendor fixes: 06de62c Detect multiplication overflow when computing sector position 46a8443 Limit the number of elements in a vector (found by oss-fuzz) Modified: vendor/file/dist/src/cdf.c vendor/file/dist/src/cdf.h Modified: vendor/file/dist/src/cdf.c ============================================================================== --- vendor/file/dist/src/cdf.c Sun Nov 17 20:49:24 2019 (r354797) +++ vendor/file/dist/src/cdf.c Sun Nov 17 20:56:25 2019 (r354798) @@ -35,7 +35,7 @@ #include "file.h" #ifndef lint -FILE_RCSID("@(#)$File: cdf.c,v 1.114 2019/02/20 02:35:27 christos Exp $") +FILE_RCSID("@(#)$File: cdf.c,v 1.116 2019/08/26 14:31:39 christos Exp $") #endif #include @@ -53,6 +53,10 @@ FILE_RCSID("@(#)$File: cdf.c,v 1.114 2019/02/20 02:35: #define EFTYPE EINVAL #endif +#ifndef SIZE_T_MAX +#define SIZE_T_MAX CAST(size_t, ~0ULL) +#endif + #include "cdf.h" #ifdef CDF_DEBUG @@ -405,7 +409,12 @@ cdf_read_sector(const cdf_info_t *info, void *buf, siz const cdf_header_t *h, cdf_secid_t id) { size_t ss = CDF_SEC_SIZE(h); - size_t pos = CDF_SEC_POS(h, id); + size_t pos; + + if (SIZE_T_MAX / ss < CAST(size_t, id)) + return -1; + + pos = CDF_SEC_POS(h, id); assert(ss == len); return cdf_read(info, CAST(off_t, pos), RCAST(char *, buf) + offs, len); } @@ -415,7 +424,12 @@ cdf_read_short_sector(const cdf_stream_t *sst, void *b size_t len, const cdf_header_t *h, cdf_secid_t id) { size_t ss = CDF_SHORT_SEC_SIZE(h); - size_t pos = CDF_SHORT_SEC_POS(h, id); + size_t pos; + + if (SIZE_T_MAX / ss < CAST(size_t, id)) + return -1; + + pos = CDF_SHORT_SEC_POS(h, id); assert(ss == len); if (pos + len > CDF_SEC_SIZE(h) * sst->sst_len) { DPRINTF(("Out of bounds read %" SIZE_T_FORMAT "u > %" @@ -1013,8 +1027,9 @@ cdf_read_property_info(const cdf_stream_t *sst, const goto out; } nelements = CDF_GETUINT32(q, 1); - if (nelements == 0) { - DPRINTF(("CDF_VECTOR with nelements == 0\n")); + if (nelements > CDF_ELEMENT_LIMIT || nelements == 0) { + DPRINTF(("CDF_VECTOR with nelements == %" + SIZE_T_FORMAT "u\n", nelements)); goto out; } slen = 2; @@ -1056,8 +1071,6 @@ cdf_read_property_info(const cdf_stream_t *sst, const goto out; inp += nelem; } - DPRINTF(("nelements = %" SIZE_T_FORMAT "u\n", - nelements)); for (j = 0; j < nelements && i < sh.sh_properties; j++, i++) { Modified: vendor/file/dist/src/cdf.h ============================================================================== --- vendor/file/dist/src/cdf.h Sun Nov 17 20:49:24 2019 (r354797) +++ vendor/file/dist/src/cdf.h Sun Nov 17 20:56:25 2019 (r354798) @@ -48,6 +48,7 @@ typedef int32_t cdf_secid_t; #define CDF_LOOP_LIMIT 10000 +#define CDF_ELEMENT_LIMIT 100000 #define CDF_SECID_NULL 0 #define CDF_SECID_FREE -1 From owner-svn-src-all@freebsd.org Sun Nov 17 22:44:39 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id EA53E1AD6DA; Sun, 17 Nov 2019 22:44:39 +0000 (UTC) (envelope-from alc@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47GRwl46Dxz4clf; Sun, 17 Nov 2019 22:44:39 +0000 (UTC) (envelope-from alc@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 662EE20C1C; Sun, 17 Nov 2019 22:44:39 +0000 (UTC) (envelope-from alc@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xAHMidcY042916; Sun, 17 Nov 2019 22:44:39 GMT (envelope-from alc@FreeBSD.org) Received: (from alc@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xAHMid7U042915; Sun, 17 Nov 2019 22:44:39 GMT (envelope-from alc@FreeBSD.org) Message-Id: <201911172244.xAHMid7U042915@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: alc set sender to alc@FreeBSD.org using -f From: Alan Cox Date: Sun, 17 Nov 2019 22:44:39 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r354799 - stable/12/sys/arm64/arm64 X-SVN-Group: stable-12 X-SVN-Commit-Author: alc X-SVN-Commit-Paths: stable/12/sys/arm64/arm64 X-SVN-Commit-Revision: 354799 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 17 Nov 2019 22:44:40 -0000 Author: alc Date: Sun Nov 17 22:44:38 2019 New Revision: 354799 URL: https://svnweb.freebsd.org/changeset/base/354799 Log: MFC r352847,352930,354585 Eliminate redundant calls to critical_enter() and critical_exit() from pmap_update_entry(). It suffices that interrupts are blocked. In short, pmap_enter_quick_locked("user space", ..., VM_PROT_READ) doesn't work. More precisely, it doesn't set ATTR_AP(ATTR_AP_USER) in the page table entry, so any attempt to read from the mapped page by user space generates a page fault. This problem has gone unnoticed because the page fault handler, vm_fault(), will ultimately call pmap_enter(), which replaces the non-working page table entry with one that has ATTR_AP(ATTR_AP_USER) set. This change reduces the number of page faults during a "buildworld" by about 19.4%. Eliminate a redundant pmap_load() from pmap_remove_pages(). There is no reason why the pmap_invalidate_all() in pmap_remove_pages() must be performed before the final PV list lock release. Move it past the lock release. Eliminate a stale comment from pmap_page_test_mappings(). We implemented a modified bit in r350004. Modified: stable/12/sys/arm64/arm64/pmap.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/arm64/arm64/pmap.c ============================================================================== --- stable/12/sys/arm64/arm64/pmap.c Sun Nov 17 20:56:25 2019 (r354798) +++ stable/12/sys/arm64/arm64/pmap.c Sun Nov 17 22:44:38 2019 (r354799) @@ -3019,7 +3019,6 @@ pmap_update_entry(pmap_t pmap, pd_entry_t *pte, pd_ent * as they may make use of an address we are about to invalidate. */ intr = intr_disable(); - critical_enter(); /* Clear the old mapping */ pmap_clear(pte); @@ -3029,7 +3028,6 @@ pmap_update_entry(pmap_t pmap, pd_entry_t *pte, pd_ent pmap_store(pte, newpte); dsb(ishst); - critical_exit(); intr_restore(intr); } @@ -3763,8 +3761,8 @@ pmap_enter_quick_locked(pmap_t pmap, vm_offset_t va, v ATTR_AP(ATTR_AP_RO) | L3_PAGE; if ((prot & VM_PROT_EXECUTE) == 0 || m->md.pv_memattr == DEVICE_MEMORY) l3_val |= ATTR_XN; - else if (va < VM_MAXUSER_ADDRESS) - l3_val |= ATTR_PXN; + if (va < VM_MAXUSER_ADDRESS) + l3_val |= ATTR_AP(ATTR_AP_USER) | ATTR_PXN; /* * Now validate mapping with RO protection @@ -4330,7 +4328,6 @@ pmap_remove_pages(pmap_t pmap) L2_BLOCK, ("Attempting to remove an invalid " "block: %lx", tpte)); - tpte = pmap_load(pte); break; case 2: pte = pmap_l2_to_l3(pde, pv->pv_va); @@ -4448,17 +4445,15 @@ pmap_remove_pages(pmap_t pmap) free_pv_chunk(pc); } } - pmap_invalidate_all(pmap); if (lock != NULL) rw_wunlock(lock); + pmap_invalidate_all(pmap); PMAP_UNLOCK(pmap); vm_page_free_pages_toq(&free, true); } /* - * This is used to check if a page has been accessed or modified. As we - * don't have a bit to see if it has been modified we have to assume it - * has been if the page is read/write. + * This is used to check if a page has been accessed or modified. */ static boolean_t pmap_page_test_mappings(vm_page_t m, boolean_t accessed, boolean_t modified) From owner-svn-src-all@freebsd.org Mon Nov 18 01:56:20 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id BFDD31B1717; Mon, 18 Nov 2019 01:56:20 +0000 (UTC) (envelope-from lwhsu@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47GX9w4VPlz4fjn; Mon, 18 Nov 2019 01:56:20 +0000 (UTC) (envelope-from lwhsu@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 6FAFA22D9A; Mon, 18 Nov 2019 01:56:20 +0000 (UTC) (envelope-from lwhsu@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xAI1uK9N055303; Mon, 18 Nov 2019 01:56:20 GMT (envelope-from lwhsu@FreeBSD.org) Received: (from lwhsu@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xAI1uKpn055302; Mon, 18 Nov 2019 01:56:20 GMT (envelope-from lwhsu@FreeBSD.org) Message-Id: <201911180156.xAI1uKpn055302@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: lwhsu set sender to lwhsu@FreeBSD.org using -f From: Li-Wen Hsu Date: Mon, 18 Nov 2019 01:56:20 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354800 - head/sys/conf X-SVN-Group: head X-SVN-Commit-Author: lwhsu X-SVN-Commit-Paths: head/sys/conf X-SVN-Commit-Revision: 354800 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 18 Nov 2019 01:56:20 -0000 Author: lwhsu Date: Mon Nov 18 01:56:19 2019 New Revision: 354800 URL: https://svnweb.freebsd.org/changeset/base/354800 Log: Also clean LINT64 kernel configuration for powerpc MFC after: 3 days Sponsored by: The FreeBSD Foundation Modified: head/sys/conf/makeLINT.mk Modified: head/sys/conf/makeLINT.mk ============================================================================== --- head/sys/conf/makeLINT.mk Sun Nov 17 22:44:38 2019 (r354799) +++ head/sys/conf/makeLINT.mk Mon Nov 18 01:56:19 2019 (r354800) @@ -14,6 +14,9 @@ clean: .if ${TARGET} == "arm" rm -f LINT-V5 LINT-V7 .endif +.if ${TARGET} == "powerpc" + rm -f LINT64 +.endif NOTES+= ${.CURDIR}/../../conf/NOTES ${.CURDIR}/NOTES MAKELINT_SED= ${.CURDIR}/../../conf/makeLINT.sed From owner-svn-src-all@freebsd.org Mon Nov 18 04:03:13 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 44B461B397E; Mon, 18 Nov 2019 04:03:13 +0000 (UTC) (envelope-from cem@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47Gb0K0wlMz4bSP; Mon, 18 Nov 2019 04:03:13 +0000 (UTC) (envelope-from cem@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 038D1245E8; Mon, 18 Nov 2019 04:03:13 +0000 (UTC) (envelope-from cem@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xAI43CeV034302; Mon, 18 Nov 2019 04:03:12 GMT (envelope-from cem@FreeBSD.org) Received: (from cem@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xAI43CnL034298; Mon, 18 Nov 2019 04:03:12 GMT (envelope-from cem@FreeBSD.org) Message-Id: <201911180403.xAI43CnL034298@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: cem set sender to cem@FreeBSD.org using -f From: Conrad Meyer Date: Mon, 18 Nov 2019 04:03:12 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354801 - in head: contrib/netbsd-tests/usr.bin/unifdef etc/mtree usr.bin/unifdef usr.bin/unifdef/tests X-SVN-Group: head X-SVN-Commit-Author: cem X-SVN-Commit-Paths: in head: contrib/netbsd-tests/usr.bin/unifdef etc/mtree usr.bin/unifdef usr.bin/unifdef/tests X-SVN-Commit-Revision: 354801 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 18 Nov 2019 04:03:13 -0000 Author: cem Date: Mon Nov 18 04:03:11 2019 New Revision: 354801 URL: https://svnweb.freebsd.org/changeset/base/354801 Log: Link in NetBSD's unifdef(1) tests Skip one, is it currently fails. Added: head/usr.bin/unifdef/tests/ head/usr.bin/unifdef/tests/Makefile (contents, props changed) Modified: head/contrib/netbsd-tests/usr.bin/unifdef/t_basic.sh head/etc/mtree/BSD.tests.dist head/usr.bin/unifdef/Makefile Modified: head/contrib/netbsd-tests/usr.bin/unifdef/t_basic.sh ============================================================================== --- head/contrib/netbsd-tests/usr.bin/unifdef/t_basic.sh Mon Nov 18 01:56:19 2019 (r354800) +++ head/contrib/netbsd-tests/usr.bin/unifdef/t_basic.sh Mon Nov 18 04:03:11 2019 (r354801) @@ -51,6 +51,10 @@ lastline_body() { printf '#ifdef foo\n#endif\n' >input atf_check -o file:input unifdef -Ubar input + # Begin FreeBSD + atf_skip "our version doesn't have this behavior" + # Endif + # Without newline after cpp directive printf '#ifdef foo\n#endif' >input atf_check -o file:input unifdef -Ubar input Modified: head/etc/mtree/BSD.tests.dist ============================================================================== --- head/etc/mtree/BSD.tests.dist Mon Nov 18 01:56:19 2019 (r354800) +++ head/etc/mtree/BSD.tests.dist Mon Nov 18 04:03:11 2019 (r354801) @@ -1064,6 +1064,8 @@ .. uuencode .. + unifdef + .. uniq .. vmstat Modified: head/usr.bin/unifdef/Makefile ============================================================================== --- head/usr.bin/unifdef/Makefile Mon Nov 18 01:56:19 2019 (r354800) +++ head/usr.bin/unifdef/Makefile Mon Nov 18 04:03:11 2019 (r354801) @@ -1,8 +1,13 @@ # @(#)Makefile 8.1 (Berkeley) 6/6/93 # $FreeBSD$ +.include + PROG= unifdef SCRIPTS=unifdefall.sh MLINKS= unifdef.1 unifdefall.1 + +HAS_TESTS= +SUBDIR.${MK_TESTS}+= tests .include Added: head/usr.bin/unifdef/tests/Makefile ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/usr.bin/unifdef/tests/Makefile Mon Nov 18 04:03:11 2019 (r354801) @@ -0,0 +1,12 @@ +# $FreeBSD$ + +PACKAGE= tests + +NETBSD_ATF_TESTS_SH= basic_test + +${PACKAGE}FILES+= d_basic.in +${PACKAGE}FILES+= d_basic.out + +.include + +.include From owner-svn-src-all@freebsd.org Mon Nov 18 04:22:05 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id D16921B3F45; Mon, 18 Nov 2019 04:22:05 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47GbQ55621z4rQS; Mon, 18 Nov 2019 04:22:05 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 9358F24941; Mon, 18 Nov 2019 04:22:05 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xAI4M5ur043292; Mon, 18 Nov 2019 04:22:05 GMT (envelope-from delphij@FreeBSD.org) Received: (from delphij@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xAI4M50F043290; Mon, 18 Nov 2019 04:22:05 GMT (envelope-from delphij@FreeBSD.org) Message-Id: <201911180422.xAI4M50F043290@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: delphij set sender to delphij@FreeBSD.org using -f From: Xin LI Date: Mon, 18 Nov 2019 04:22:05 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354802 - head/contrib/file/src X-SVN-Group: head X-SVN-Commit-Author: delphij X-SVN-Commit-Paths: head/contrib/file/src X-SVN-Commit-Revision: 354802 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 18 Nov 2019 04:22:05 -0000 Author: delphij Date: Mon Nov 18 04:22:04 2019 New Revision: 354802 URL: https://svnweb.freebsd.org/changeset/base/354802 Log: MFV r354798: Apply vendor fixes: 06de62c Detect multiplication overflow when computing sector position 46a8443 Limit the number of elements in a vector (found by oss-fuzz) Requested by: wen MFC after: 3 days Security: CVE-2019-18218 Modified: head/contrib/file/src/cdf.c head/contrib/file/src/cdf.h Directory Properties: head/contrib/file/ (props changed) Modified: head/contrib/file/src/cdf.c ============================================================================== --- head/contrib/file/src/cdf.c Mon Nov 18 04:03:11 2019 (r354801) +++ head/contrib/file/src/cdf.c Mon Nov 18 04:22:04 2019 (r354802) @@ -35,7 +35,7 @@ #include "file.h" #ifndef lint -FILE_RCSID("@(#)$File: cdf.c,v 1.114 2019/02/20 02:35:27 christos Exp $") +FILE_RCSID("@(#)$File: cdf.c,v 1.116 2019/08/26 14:31:39 christos Exp $") #endif #include @@ -53,6 +53,10 @@ FILE_RCSID("@(#)$File: cdf.c,v 1.114 2019/02/20 02:35: #define EFTYPE EINVAL #endif +#ifndef SIZE_T_MAX +#define SIZE_T_MAX CAST(size_t, ~0ULL) +#endif + #include "cdf.h" #ifdef CDF_DEBUG @@ -405,7 +409,12 @@ cdf_read_sector(const cdf_info_t *info, void *buf, siz const cdf_header_t *h, cdf_secid_t id) { size_t ss = CDF_SEC_SIZE(h); - size_t pos = CDF_SEC_POS(h, id); + size_t pos; + + if (SIZE_T_MAX / ss < CAST(size_t, id)) + return -1; + + pos = CDF_SEC_POS(h, id); assert(ss == len); return cdf_read(info, CAST(off_t, pos), RCAST(char *, buf) + offs, len); } @@ -415,7 +424,12 @@ cdf_read_short_sector(const cdf_stream_t *sst, void *b size_t len, const cdf_header_t *h, cdf_secid_t id) { size_t ss = CDF_SHORT_SEC_SIZE(h); - size_t pos = CDF_SHORT_SEC_POS(h, id); + size_t pos; + + if (SIZE_T_MAX / ss < CAST(size_t, id)) + return -1; + + pos = CDF_SHORT_SEC_POS(h, id); assert(ss == len); if (pos + len > CDF_SEC_SIZE(h) * sst->sst_len) { DPRINTF(("Out of bounds read %" SIZE_T_FORMAT "u > %" @@ -1013,8 +1027,9 @@ cdf_read_property_info(const cdf_stream_t *sst, const goto out; } nelements = CDF_GETUINT32(q, 1); - if (nelements == 0) { - DPRINTF(("CDF_VECTOR with nelements == 0\n")); + if (nelements > CDF_ELEMENT_LIMIT || nelements == 0) { + DPRINTF(("CDF_VECTOR with nelements == %" + SIZE_T_FORMAT "u\n", nelements)); goto out; } slen = 2; @@ -1056,8 +1071,6 @@ cdf_read_property_info(const cdf_stream_t *sst, const goto out; inp += nelem; } - DPRINTF(("nelements = %" SIZE_T_FORMAT "u\n", - nelements)); for (j = 0; j < nelements && i < sh.sh_properties; j++, i++) { Modified: head/contrib/file/src/cdf.h ============================================================================== --- head/contrib/file/src/cdf.h Mon Nov 18 04:03:11 2019 (r354801) +++ head/contrib/file/src/cdf.h Mon Nov 18 04:22:04 2019 (r354802) @@ -48,6 +48,7 @@ typedef int32_t cdf_secid_t; #define CDF_LOOP_LIMIT 10000 +#define CDF_ELEMENT_LIMIT 100000 #define CDF_SECID_NULL 0 #define CDF_SECID_FREE -1 From owner-svn-src-all@freebsd.org Mon Nov 18 07:04:59 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id E090F1B6FC1; Mon, 18 Nov 2019 07:04:59 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47Gg235jjWz4GVv; Mon, 18 Nov 2019 07:04:59 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 8F8B026587; Mon, 18 Nov 2019 07:04:59 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xAI74xdK039988; Mon, 18 Nov 2019 07:04:59 GMT (envelope-from dim@FreeBSD.org) Received: (from dim@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xAI74xd5039987; Mon, 18 Nov 2019 07:04:59 GMT (envelope-from dim@FreeBSD.org) Message-Id: <201911180704.xAI74xd5039987@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dim set sender to dim@FreeBSD.org using -f From: Dimitry Andric Date: Mon, 18 Nov 2019 07:04:59 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r354803 - in stable: 11/contrib/llvm/lib/Transforms/InstCombine 12/contrib/llvm/lib/Transforms/InstCombine X-SVN-Group: stable-12 X-SVN-Commit-Author: dim X-SVN-Commit-Paths: in stable: 11/contrib/llvm/lib/Transforms/InstCombine 12/contrib/llvm/lib/Transforms/InstCombine X-SVN-Commit-Revision: 354803 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 18 Nov 2019 07:05:00 -0000 Author: dim Date: Mon Nov 18 07:04:59 2019 New Revision: 354803 URL: https://svnweb.freebsd.org/changeset/base/354803 Log: MFC r354724: Merge commit 5bbb604bb from llvm git (by Craig Topper): [InstCombine] Disable some portions of foldGEPICmp for GEPs that return a vector of pointers. Fix other portions. llvm-svn: 370114 This should fix instances of 'Assertion failed: (isa(Val) && "cast() argument of incompatible type!"), function cast, file /usr/src/contrib/llvm/include/llvm/Support/Casting.h, line 255', when building openjdk8 for aarch64 and armv7. Reported by: jbeich PR: 236566 Modified: stable/12/contrib/llvm/lib/Transforms/InstCombine/InstCombineCompares.cpp Directory Properties: stable/12/ (props changed) Changes in other areas also in this revision: Modified: stable/11/contrib/llvm/lib/Transforms/InstCombine/InstCombineCompares.cpp Directory Properties: stable/11/ (props changed) Modified: stable/12/contrib/llvm/lib/Transforms/InstCombine/InstCombineCompares.cpp ============================================================================== --- stable/12/contrib/llvm/lib/Transforms/InstCombine/InstCombineCompares.cpp Mon Nov 18 04:22:04 2019 (r354802) +++ stable/12/contrib/llvm/lib/Transforms/InstCombine/InstCombineCompares.cpp Mon Nov 18 07:04:59 2019 (r354803) @@ -830,6 +830,10 @@ getAsConstantIndexedAddress(Value *V, const DataLayout static Instruction *transformToIndexedCompare(GEPOperator *GEPLHS, Value *RHS, ICmpInst::Predicate Cond, const DataLayout &DL) { + // FIXME: Support vector of pointers. + if (GEPLHS->getType()->isVectorTy()) + return nullptr; + if (!GEPLHS->hasAllConstantIndices()) return nullptr; @@ -880,7 +884,9 @@ Instruction *InstCombiner::foldGEPICmp(GEPOperator *GE RHS = RHS->stripPointerCasts(); Value *PtrBase = GEPLHS->getOperand(0); - if (PtrBase == RHS && GEPLHS->isInBounds()) { + // FIXME: Support vector pointer GEPs. + if (PtrBase == RHS && GEPLHS->isInBounds() && + !GEPLHS->getType()->isVectorTy()) { // ((gep Ptr, OFFSET) cmp Ptr) ---> (OFFSET cmp 0). // This transformation (ignoring the base and scales) is valid because we // know pointers can't overflow since the gep is inbounds. See if we can @@ -914,11 +920,13 @@ Instruction *InstCombiner::foldGEPICmp(GEPOperator *GE // If we're comparing GEPs with two base pointers that only differ in type // and both GEPs have only constant indices or just one use, then fold // the compare with the adjusted indices. + // FIXME: Support vector of pointers. if (GEPLHS->isInBounds() && GEPRHS->isInBounds() && (GEPLHS->hasAllConstantIndices() || GEPLHS->hasOneUse()) && (GEPRHS->hasAllConstantIndices() || GEPRHS->hasOneUse()) && PtrBase->stripPointerCasts() == - GEPRHS->getOperand(0)->stripPointerCasts()) { + GEPRHS->getOperand(0)->stripPointerCasts() && + !GEPLHS->getType()->isVectorTy()) { Value *LOffset = EmitGEPOffset(GEPLHS); Value *ROffset = EmitGEPOffset(GEPRHS); @@ -962,15 +970,20 @@ Instruction *InstCombiner::foldGEPICmp(GEPOperator *GE unsigned DiffOperand = 0; // The operand that differs. for (unsigned i = 1, e = GEPRHS->getNumOperands(); i != e; ++i) if (GEPLHS->getOperand(i) != GEPRHS->getOperand(i)) { - if (GEPLHS->getOperand(i)->getType()->getPrimitiveSizeInBits() != - GEPRHS->getOperand(i)->getType()->getPrimitiveSizeInBits()) { + Type *LHSType = GEPLHS->getOperand(i)->getType(); + Type *RHSType = GEPRHS->getOperand(i)->getType(); + // FIXME: Better support for vector of pointers. + if (LHSType->getPrimitiveSizeInBits() != + RHSType->getPrimitiveSizeInBits() || + (GEPLHS->getType()->isVectorTy() && + (!LHSType->isVectorTy() || !RHSType->isVectorTy()))) { // Irreconcilable differences. NumDifferences = 2; break; - } else { - if (NumDifferences++) break; - DiffOperand = i; } + + if (NumDifferences++) break; + DiffOperand = i; } if (NumDifferences == 0) // SAME GEP? From owner-svn-src-all@freebsd.org Mon Nov 18 07:05:00 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 2A4621B6FC5; Mon, 18 Nov 2019 07:05:00 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47Gg240Hvvz4GW1; Mon, 18 Nov 2019 07:05:00 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id E1B8D26588; Mon, 18 Nov 2019 07:04:59 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xAI74xnC039994; Mon, 18 Nov 2019 07:04:59 GMT (envelope-from dim@FreeBSD.org) Received: (from dim@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xAI74xAM039993; Mon, 18 Nov 2019 07:04:59 GMT (envelope-from dim@FreeBSD.org) Message-Id: <201911180704.xAI74xAM039993@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dim set sender to dim@FreeBSD.org using -f From: Dimitry Andric Date: Mon, 18 Nov 2019 07:04:59 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r354803 - in stable: 11/contrib/llvm/lib/Transforms/InstCombine 12/contrib/llvm/lib/Transforms/InstCombine X-SVN-Group: stable-11 X-SVN-Commit-Author: dim X-SVN-Commit-Paths: in stable: 11/contrib/llvm/lib/Transforms/InstCombine 12/contrib/llvm/lib/Transforms/InstCombine X-SVN-Commit-Revision: 354803 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 18 Nov 2019 07:05:00 -0000 Author: dim Date: Mon Nov 18 07:04:59 2019 New Revision: 354803 URL: https://svnweb.freebsd.org/changeset/base/354803 Log: MFC r354724: Merge commit 5bbb604bb from llvm git (by Craig Topper): [InstCombine] Disable some portions of foldGEPICmp for GEPs that return a vector of pointers. Fix other portions. llvm-svn: 370114 This should fix instances of 'Assertion failed: (isa(Val) && "cast() argument of incompatible type!"), function cast, file /usr/src/contrib/llvm/include/llvm/Support/Casting.h, line 255', when building openjdk8 for aarch64 and armv7. Reported by: jbeich PR: 236566 Modified: stable/11/contrib/llvm/lib/Transforms/InstCombine/InstCombineCompares.cpp Directory Properties: stable/11/ (props changed) Changes in other areas also in this revision: Modified: stable/12/contrib/llvm/lib/Transforms/InstCombine/InstCombineCompares.cpp Directory Properties: stable/12/ (props changed) Modified: stable/11/contrib/llvm/lib/Transforms/InstCombine/InstCombineCompares.cpp ============================================================================== --- stable/11/contrib/llvm/lib/Transforms/InstCombine/InstCombineCompares.cpp Mon Nov 18 04:22:04 2019 (r354802) +++ stable/11/contrib/llvm/lib/Transforms/InstCombine/InstCombineCompares.cpp Mon Nov 18 07:04:59 2019 (r354803) @@ -830,6 +830,10 @@ getAsConstantIndexedAddress(Value *V, const DataLayout static Instruction *transformToIndexedCompare(GEPOperator *GEPLHS, Value *RHS, ICmpInst::Predicate Cond, const DataLayout &DL) { + // FIXME: Support vector of pointers. + if (GEPLHS->getType()->isVectorTy()) + return nullptr; + if (!GEPLHS->hasAllConstantIndices()) return nullptr; @@ -880,7 +884,9 @@ Instruction *InstCombiner::foldGEPICmp(GEPOperator *GE RHS = RHS->stripPointerCasts(); Value *PtrBase = GEPLHS->getOperand(0); - if (PtrBase == RHS && GEPLHS->isInBounds()) { + // FIXME: Support vector pointer GEPs. + if (PtrBase == RHS && GEPLHS->isInBounds() && + !GEPLHS->getType()->isVectorTy()) { // ((gep Ptr, OFFSET) cmp Ptr) ---> (OFFSET cmp 0). // This transformation (ignoring the base and scales) is valid because we // know pointers can't overflow since the gep is inbounds. See if we can @@ -914,11 +920,13 @@ Instruction *InstCombiner::foldGEPICmp(GEPOperator *GE // If we're comparing GEPs with two base pointers that only differ in type // and both GEPs have only constant indices or just one use, then fold // the compare with the adjusted indices. + // FIXME: Support vector of pointers. if (GEPLHS->isInBounds() && GEPRHS->isInBounds() && (GEPLHS->hasAllConstantIndices() || GEPLHS->hasOneUse()) && (GEPRHS->hasAllConstantIndices() || GEPRHS->hasOneUse()) && PtrBase->stripPointerCasts() == - GEPRHS->getOperand(0)->stripPointerCasts()) { + GEPRHS->getOperand(0)->stripPointerCasts() && + !GEPLHS->getType()->isVectorTy()) { Value *LOffset = EmitGEPOffset(GEPLHS); Value *ROffset = EmitGEPOffset(GEPRHS); @@ -962,15 +970,20 @@ Instruction *InstCombiner::foldGEPICmp(GEPOperator *GE unsigned DiffOperand = 0; // The operand that differs. for (unsigned i = 1, e = GEPRHS->getNumOperands(); i != e; ++i) if (GEPLHS->getOperand(i) != GEPRHS->getOperand(i)) { - if (GEPLHS->getOperand(i)->getType()->getPrimitiveSizeInBits() != - GEPRHS->getOperand(i)->getType()->getPrimitiveSizeInBits()) { + Type *LHSType = GEPLHS->getOperand(i)->getType(); + Type *RHSType = GEPRHS->getOperand(i)->getType(); + // FIXME: Better support for vector of pointers. + if (LHSType->getPrimitiveSizeInBits() != + RHSType->getPrimitiveSizeInBits() || + (GEPLHS->getType()->isVectorTy() && + (!LHSType->isVectorTy() || !RHSType->isVectorTy()))) { // Irreconcilable differences. NumDifferences = 2; break; - } else { - if (NumDifferences++) break; - DiffOperand = i; } + + if (NumDifferences++) break; + DiffOperand = i; } if (NumDifferences == 0) // SAME GEP? From owner-svn-src-all@freebsd.org Mon Nov 18 09:38:36 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id C4CBD1BA80A; Mon, 18 Nov 2019 09:38:36 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47GkRJ56tZz4DnS; Mon, 18 Nov 2019 09:38:36 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 8D7B228073; Mon, 18 Nov 2019 09:38:36 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xAI9caZa028100; Mon, 18 Nov 2019 09:38:36 GMT (envelope-from avg@FreeBSD.org) Received: (from avg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xAI9cZFW028094; Mon, 18 Nov 2019 09:38:35 GMT (envelope-from avg@FreeBSD.org) Message-Id: <201911180938.xAI9cZFW028094@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avg set sender to avg@FreeBSD.org using -f From: Andriy Gapon Date: Mon, 18 Nov 2019 09:38:35 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354804 - in head: cddl/contrib/opensolaris/cmd/zdb cddl/contrib/opensolaris/cmd/zhack cddl/contrib/opensolaris/cmd/zpool cddl/contrib/opensolaris/cmd/ztest cddl/contrib/opensolaris/lib... X-SVN-Group: head X-SVN-Commit-Author: avg X-SVN-Commit-Paths: in head: cddl/contrib/opensolaris/cmd/zdb cddl/contrib/opensolaris/cmd/zhack cddl/contrib/opensolaris/cmd/zpool cddl/contrib/opensolaris/cmd/ztest cddl/contrib/opensolaris/lib/libzfs/common cddl/contr... X-SVN-Commit-Revision: 354804 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 18 Nov 2019 09:38:36 -0000 Author: avg Date: Mon Nov 18 09:38:35 2019 New Revision: 354804 URL: https://svnweb.freebsd.org/changeset/base/354804 Log: MFV r354378,r354379,r354386: 10499 Multi-modifier protection (MMP) 10499 Multi-modifier protection (MMP) illumos/illumos-gate@e0f1c0afa46cc84d4b1e40124032a9a87310386e https://github.com/illumos/illumos-gate/commit/e0f1c0afa46cc84d4b1e40124032a9a87310386e https://www.illumos.org/issues/10499 Port the following ZFS commits from ZoL to illumos. 379ca9cf2 Multi-modifier protection (MMP) bbffb59ef Fix multihost stale cache file import 0d398b256 Do not initiate MMP writes while pool is suspended 10701 Correct lock ASSERTs in vdev_label_read/write illumos/illumos-gate@58447f688d5e308373ab16a3b129bc0ba0fbc154 https://github.com/illumos/illumos-gate/commit/58447f688d5e308373ab16a3b129bc0ba0fbc154 https://www.illumos.org/issues/10701 Port of ZoL commit: 0091d66f4e Correct lock ASSERTs in vdev_label_read/write At a minimum, this fixes a blown assert during an MMP test run when running on a DEBUG build. 11770 additional mmp fixes illumos/illumos-gate@4348eb901228d2f8fa50bb132a34248e8662074e https://github.com/illumos/illumos-gate/commit/4348eb901228d2f8fa50bb132a34248e8662074e https://www.illumos.org/issues/11770 Port a few additional MMP fixes from ZoL that came in after our initial MMP port. 4ca457b065 ZTS: Fix mmp_interval failure ca95f70dff zpool import progress kstat (only minimal changes from above can be pulled in right now) 060f0226e6 MMP interval and fail_intervals in uberblock Note from the committer (me). I do not have any use for this feature and I have not tested it. I only did smoke testing with multihost=off. Please be aware. I merged the code only to make future merges easier. Portions contributed by: Jerry Jelinek Portions contributed by: Tim Chase Portions contributed by: sanjeevbagewadi Portions contributed by: John L. Hammond Portions contributed by: Giuseppe Di Natale Portions contributed by: Prakash Surya Portions contributed by: Brian Behlendorf Author: Olaf Faaland MFC after: 4 weeks Added: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/mmp.c - copied, changed from r354378, vendor-sys/illumos/dist/uts/common/fs/zfs/mmp.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/mmp.h - copied, changed from r354378, vendor-sys/illumos/dist/uts/common/fs/zfs/sys/mmp.h Modified: head/cddl/contrib/opensolaris/cmd/zdb/zdb.c head/cddl/contrib/opensolaris/cmd/zhack/zhack.c head/cddl/contrib/opensolaris/cmd/zpool/zpool.8 head/cddl/contrib/opensolaris/cmd/zpool/zpool_main.c head/cddl/contrib/opensolaris/cmd/ztest/ztest.c head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs.h head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_dataset.c head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_impl.h head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_import.c head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_pool.c head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_status.c head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_util.c head/cddl/contrib/opensolaris/lib/libzpool/common/kernel.c head/cddl/contrib/opensolaris/lib/libzpool/common/sys/zfs_context.h head/cddl/lib/libzpool/Makefile head/cddl/usr.bin/ztest/Makefile head/sys/cddl/contrib/opensolaris/common/zfs/zfs_comutil.h head/sys/cddl/contrib/opensolaris/common/zfs/zpool_prop.c head/sys/cddl/contrib/opensolaris/uts/common/Makefile.files head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_pool.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa_config.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa_misc.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dsl_pool.h head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/spa.h head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/spa_impl.h head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/uberblock.h head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/uberblock_impl.h head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/vdev.h head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/vdev_impl.h head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zio.h head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/uberblock.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_label.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zio.c head/sys/cddl/contrib/opensolaris/uts/common/sys/fs/zfs.h Directory Properties: head/cddl/contrib/opensolaris/ (props changed) head/cddl/contrib/opensolaris/cmd/zdb/ (props changed) head/cddl/contrib/opensolaris/lib/libzfs/ (props changed) head/sys/cddl/contrib/opensolaris/ (props changed) Modified: head/cddl/contrib/opensolaris/cmd/zdb/zdb.c ============================================================================== --- head/cddl/contrib/opensolaris/cmd/zdb/zdb.c Mon Nov 18 07:04:59 2019 (r354803) +++ head/cddl/contrib/opensolaris/cmd/zdb/zdb.c Mon Nov 18 09:38:35 2019 (r354804) @@ -24,6 +24,7 @@ * Copyright (c) 2011, 2017 by Delphix. All rights reserved. * Copyright (c) 2014 Integros [integros.com] * Copyright 2017 Nexenta Systems, Inc. + * Copyright (c) 2017, 2018 Lawrence Livermore National Security, LLC. * Copyright 2017 RackTop Systems. */ @@ -2436,6 +2437,26 @@ dump_uberblock(uberblock_t *ub, const char *header, co (void) printf("\tguid_sum = %llu\n", (u_longlong_t)ub->ub_guid_sum); (void) printf("\ttimestamp = %llu UTC = %s", (u_longlong_t)ub->ub_timestamp, asctime(localtime(×tamp))); + + (void) printf("\tmmp_magic = %016llx\n", + (u_longlong_t)ub->ub_mmp_magic); + if (MMP_VALID(ub)) { + (void) printf("\tmmp_delay = %0llu\n", + (u_longlong_t)ub->ub_mmp_delay); + if (MMP_SEQ_VALID(ub)) + (void) printf("\tmmp_seq = %u\n", + (unsigned int) MMP_SEQ(ub)); + if (MMP_FAIL_INT_VALID(ub)) + (void) printf("\tmmp_fail = %u\n", + (unsigned int) MMP_FAIL_INT(ub)); + if (MMP_INTERVAL_VALID(ub)) + (void) printf("\tmmp_write = %u\n", + (unsigned int) MMP_INTERVAL(ub)); + /* After MMP_* to make summarize_uberblock_mmp cleaner */ + (void) printf("\tmmp_valid = %x\n", + (unsigned int) ub->ub_mmp_config & 0xFF); + } + if (dump_opt['u'] >= 3) { char blkbuf[BP_SPRINTF_LEN]; snprintf_blkptr(blkbuf, sizeof (blkbuf), &ub->ub_rootbp); @@ -2534,6 +2555,12 @@ dump_label_uberblocks(vdev_label_t *lbl, uint64_t ashi if (uberblock_verify(ub)) continue; + + if ((dump_opt['u'] < 4) && + (ub->ub_mmp_magic == MMP_MAGIC) && ub->ub_mmp_delay && + (i >= VDEV_UBERBLOCK_COUNT(&vd) - MMP_BLOCKS_PER_LABEL)) + continue; + (void) snprintf(header, ZDB_MAX_UB_HEADER_SIZE, "Uberblock[%d]\n", i); dump_uberblock(ub, header, ""); @@ -4173,6 +4200,22 @@ verify_device_removal_feature_counts(spa_t *spa) return (ret); } +static void +zdb_set_skip_mmp(char *target) +{ + spa_t *spa; + + /* + * Disable the activity check to allow examination of + * active pools. + */ + mutex_enter(&spa_namespace_lock); + if ((spa = spa_lookup(target)) != NULL) { + spa->spa_import_flags |= ZFS_IMPORT_SKIP_MMP; + } + mutex_exit(&spa_namespace_lock); +} + #define BOGUS_SUFFIX "_CHECKPOINTED_UNIVERSE" /* * Import the checkpointed state of the pool specified by the target @@ -4207,6 +4250,7 @@ import_checkpointed_state(char *target, nvlist_t *cfg, } if (cfg == NULL) { + zdb_set_skip_mmp(poolname); error = spa_get_stats(poolname, &cfg, NULL, 0); if (error != 0) { fatal("Tried to read config of pool \"%s\" but " @@ -4219,7 +4263,8 @@ import_checkpointed_state(char *target, nvlist_t *cfg, fnvlist_add_string(cfg, ZPOOL_CONFIG_POOL_NAME, bogus_name); error = spa_import(bogus_name, cfg, NULL, - ZFS_IMPORT_MISSING_LOG | ZFS_IMPORT_CHECKPOINT); + ZFS_IMPORT_MISSING_LOG | ZFS_IMPORT_CHECKPOINT | + ZFS_IMPORT_SKIP_MMP); if (error != 0) { fatal("Tried to import pool \"%s\" but spa_import() failed " "with error %d\n", bogus_name, error); @@ -5222,90 +5267,6 @@ zdb_embedded_block(char *thing) free(buf); } -static boolean_t -pool_match(nvlist_t *cfg, char *tgt) -{ - uint64_t v, guid = strtoull(tgt, NULL, 0); - char *s; - - if (guid != 0) { - if (nvlist_lookup_uint64(cfg, ZPOOL_CONFIG_POOL_GUID, &v) == 0) - return (v == guid); - } else { - if (nvlist_lookup_string(cfg, ZPOOL_CONFIG_POOL_NAME, &s) == 0) - return (strcmp(s, tgt) == 0); - } - return (B_FALSE); -} - -static char * -find_zpool(char **target, nvlist_t **configp, int dirc, char **dirv) -{ - nvlist_t *pools; - nvlist_t *match = NULL; - char *name = NULL; - char *sepp = NULL; - char sep = '\0'; - int count = 0; - importargs_t args; - - bzero(&args, sizeof (args)); - args.paths = dirc; - args.path = dirv; - args.can_be_active = B_TRUE; - - if ((sepp = strpbrk(*target, "/@")) != NULL) { - sep = *sepp; - *sepp = '\0'; - } - - pools = zpool_search_import(g_zfs, &args); - - if (pools != NULL) { - nvpair_t *elem = NULL; - while ((elem = nvlist_next_nvpair(pools, elem)) != NULL) { - verify(nvpair_value_nvlist(elem, configp) == 0); - if (pool_match(*configp, *target)) { - count++; - if (match != NULL) { - /* print previously found config */ - if (name != NULL) { - (void) printf("%s\n", name); - dump_nvlist(match, 8); - name = NULL; - } - (void) printf("%s\n", - nvpair_name(elem)); - dump_nvlist(*configp, 8); - } else { - match = *configp; - name = nvpair_name(elem); - } - } - } - } - if (count > 1) - (void) fatal("\tMatched %d pools - use pool GUID " - "instead of pool name or \n" - "\tpool name part of a dataset name to select pool", count); - - if (sepp) - *sepp = sep; - /* - * If pool GUID was specified for pool id, replace it with pool name - */ - if (name && (strstr(*target, name) != *target)) { - int sz = 1 + strlen(name) + ((sepp) ? strlen(sepp) : 0); - - *target = umem_alloc(sz, UMEM_NOFAIL); - (void) snprintf(*target, sz, "%s%s", name, sepp ? sepp : ""); - } - - *configp = name ? match : NULL; - - return (name); -} - int main(int argc, char **argv) { @@ -5318,7 +5279,7 @@ main(int argc, char **argv) int error = 0; char **searchdirs = NULL; int nsearch = 0; - char *target; + char *target, *target_pool; nvlist_t *policy = NULL; uint64_t max_txg = UINT64_MAX; int flags = ZFS_IMPORT_MISSING_LOG; @@ -5526,22 +5487,48 @@ main(int argc, char **argv) error = 0; target = argv[0]; + if (strpbrk(target, "/@") != NULL) { + size_t targetlen; + + target_pool = strdup(target); + *strpbrk(target_pool, "/@") = '\0'; + + target_is_spa = B_FALSE; + targetlen = strlen(target); + if (targetlen && target[targetlen - 1] == '/') + target[targetlen - 1] = '\0'; + } else { + target_pool = target; + } + if (dump_opt['e']) { - char *name = find_zpool(&target, &cfg, nsearch, searchdirs); + importargs_t args = { 0 }; - error = ENOENT; - if (name) { - if (dump_opt['C'] > 1) { - (void) printf("\nConfiguration for import:\n"); - dump_nvlist(cfg, 8); - } + args.paths = nsearch; + args.path = searchdirs; + args.can_be_active = B_TRUE; + error = zpool_tryimport(g_zfs, target_pool, &cfg, &args); + + if (error == 0) { + if (nvlist_add_nvlist(cfg, ZPOOL_LOAD_POLICY, policy) != 0) { fatal("can't open '%s': %s", target, strerror(ENOMEM)); } - error = spa_import(name, cfg, NULL, flags); + + if (dump_opt['C'] > 1) { + (void) printf("\nConfiguration for import:\n"); + dump_nvlist(cfg, 8); + } + + /* + * Disable the activity check to allow examination of + * active pools. + */ + error = spa_import(target_pool, cfg, NULL, + flags | ZFS_IMPORT_SKIP_MMP); } } @@ -5556,21 +5543,6 @@ main(int argc, char **argv) } - if (strpbrk(target, "/@") != NULL) { - size_t targetlen; - - target_is_spa = B_FALSE; - /* - * Remove any trailing slash. Later code would get confused - * by it, but we want to allow it so that "pool/" can - * indicate that we want to dump the topmost filesystem, - * rather than the whole pool. - */ - targetlen = strlen(target); - if (targetlen != 0 && target[targetlen - 1] == '/') - target[targetlen - 1] = '\0'; - } - if (error == 0) { if (dump_opt['k'] && (target_is_spa || dump_opt['R'])) { ASSERT(checkpoint_pool != NULL); @@ -5584,6 +5556,7 @@ main(int argc, char **argv) } } else if (target_is_spa || dump_opt['R']) { + zdb_set_skip_mmp(target); error = spa_open_rewind(target, &spa, FTAG, policy, NULL); if (error) { @@ -5606,6 +5579,7 @@ main(int argc, char **argv) } } } else { + zdb_set_skip_mmp(target); error = open_objset(target, DMU_OST_ANY, FTAG, &os); } } Modified: head/cddl/contrib/opensolaris/cmd/zhack/zhack.c ============================================================================== --- head/cddl/contrib/opensolaris/cmd/zhack/zhack.c Mon Nov 18 07:04:59 2019 (r354803) +++ head/cddl/contrib/opensolaris/cmd/zhack/zhack.c Mon Nov 18 09:38:35 2019 (r354804) @@ -121,16 +121,11 @@ space_delta_cb(dmu_object_type_t bonustype, void *data * Target is the dataset whose pool we want to open. */ static void -import_pool(const char *target, boolean_t readonly) +zhack_import(char *target, boolean_t readonly) { nvlist_t *config; - nvlist_t *pools; - int error; - char *sepp; - spa_t *spa; - nvpair_t *elem; nvlist_t *props; - const char *name; + int error; kernel_init(readonly ? FREAD : (FREAD | FWRITE)); g_zfs = libzfs_init(); @@ -139,68 +134,40 @@ import_pool(const char *target, boolean_t readonly) dmu_objset_register_type(DMU_OST_ZFS, space_delta_cb); g_readonly = readonly; - - /* - * If we only want readonly access, it's OK if we find - * a potentially-active (ie, imported into the kernel) pool from the - * default cachefile. - */ - if (readonly && spa_open(target, &spa, FTAG) == 0) { - spa_close(spa, FTAG); - return; - } - g_importargs.unique = B_TRUE; g_importargs.can_be_active = readonly; g_pool = strdup(target); - if ((sepp = strpbrk(g_pool, "/@")) != NULL) - *sepp = '\0'; - g_importargs.poolname = g_pool; - pools = zpool_search_import(g_zfs, &g_importargs); - if (nvlist_empty(pools)) { - if (!g_importargs.can_be_active) { - g_importargs.can_be_active = B_TRUE; - if (zpool_search_import(g_zfs, &g_importargs) != NULL || - spa_open(target, &spa, FTAG) == 0) { - fatal(spa, FTAG, "cannot import '%s': pool is " - "active; run " "\"zpool export %s\" " - "first\n", g_pool, g_pool); - } - } + error = zpool_tryimport(g_zfs, target, &config, &g_importargs); + if (error) + fatal(NULL, FTAG, "cannot import '%s': %s", target, + libzfs_error_description(g_zfs)); - fatal(NULL, FTAG, "cannot import '%s': no such pool " - "available\n", g_pool); - } - - elem = nvlist_next_nvpair(pools, NULL); - name = nvpair_name(elem); - verify(nvpair_value_nvlist(elem, &config) == 0); - props = NULL; if (readonly) { - verify(nvlist_alloc(&props, NV_UNIQUE_NAME, 0) == 0); - verify(nvlist_add_uint64(props, + VERIFY(nvlist_alloc(&props, NV_UNIQUE_NAME, 0) == 0); + VERIFY(nvlist_add_uint64(props, zpool_prop_to_name(ZPOOL_PROP_READONLY), 1) == 0); } zfeature_checks_disable = B_TRUE; - error = spa_import(name, config, props, ZFS_IMPORT_NORMAL); + error = spa_import(target, config, props, + (readonly ? ZFS_IMPORT_SKIP_MMP : ZFS_IMPORT_NORMAL)); zfeature_checks_disable = B_FALSE; if (error == EEXIST) error = 0; if (error) - fatal(NULL, FTAG, "can't import '%s': %s", name, + fatal(NULL, FTAG, "can't import '%s': %s", target, strerror(error)); } static void -zhack_spa_open(const char *target, boolean_t readonly, void *tag, spa_t **spa) +zhack_spa_open(char *target, boolean_t readonly, void *tag, spa_t **spa) { int err; - import_pool(target, readonly); + zhack_import(target, readonly); zfeature_checks_disable = B_TRUE; err = spa_open(target, spa, tag); Modified: head/cddl/contrib/opensolaris/cmd/zpool/zpool.8 ============================================================================== --- head/cddl/contrib/opensolaris/cmd/zpool/zpool.8 Mon Nov 18 07:04:59 2019 (r354803) +++ head/cddl/contrib/opensolaris/cmd/zpool/zpool.8 Mon Nov 18 09:38:35 2019 (r354804) @@ -481,6 +481,11 @@ If a pool has a shared spare that is currently being u exported since other pools may use this shared spare, which may lead to potential data corruption. .Pp +Shared spares add some risk. +If the pools are imported on different hosts, and both pools suffer a device +failure at the same time, both could attempt to use the spare at the same time. +This may not be detected, resulting in data corruption. +.Pp An in-progress spare replacement can be cancelled by detaching the hot spare. If the original faulted device is detached, then the hot spare assumes its place in the configuration, and is removed from the spare list of all active @@ -806,7 +811,7 @@ to the enabled state. See .Xr zpool-features 7 for details on feature states. -.It Sy listsnaps Ns = Ns Cm on No | Cm off +.It Sy listsnapshots Ns = Ns Cm on No | Cm off Controls whether information about snapshots associated with this pool is output when .Qq Nm zfs Cm list @@ -814,6 +819,31 @@ is run without the .Fl t option. The default value is .Cm off . +This property can also be referred to by its shortened name, +.Sy listsnaps . +.It Sy multihost Ns = Ns Sy on No | Sy off +Controls whether a pool activity check should be performed during +.Nm zpool Cm import . +When a pool is determined to be active it cannot be imported, even with the +.Fl f +option. +This property is intended to be used in failover configurations +where multiple hosts have access to a pool on shared storage. +.sp +Multihost provides protection on import only. +It does not protect against an +individual device being used in multiple pools, regardless of the type of vdev. +See the discussion under +.Sy zpool create. +.sp +When this property is on, periodic writes to storage occur to show the pool is +in use. +See +.Sy vfs.zfs.multihost_interval +sysctl. +In order to enable this property each host must set a unique hostid. +The default value is +.Sy off . .It Sy version Ns = Ns Ar version The current on-disk version of the pool. This can be increased, but never decreased. The preferred method of updating pools is with the @@ -958,8 +988,22 @@ discarded transactions is irretrievably lost. Used in combination with the .Fl F flag. Check whether discarding transactions would make the pool openable, but +<<<<<<< do not actually discard any transactions. .El +||||||| +If no arguments are specified, all device errors within the pool are cleared. +If one or more devices is specified, only those errors associated with the +specified device or devices are cleared. +======= +If no arguments are specified, all device errors within the pool are cleared. +If one or more devices is specified, only those errors associated with the +specified device or devices are cleared. +If multihost is enabled, and the pool has been suspended, this will not +resume I/O. +While the pool was suspended, it may have been imported on +another host, and resuming I/O could result in pool damage. +>>>>>>> .It Xo .Nm .Cm create @@ -984,7 +1028,37 @@ specification is described in the .Qq Sx Virtual Devices section. .Pp +<<<<<<< The command verifies that each device specified is accessible and not currently +||||||| +The command verifies that each device specified is accessible and not currently +in use by another subsystem. +There are some uses, such as being currently mounted, or specified as the +dedicated dump device, that prevents a device from ever being used by ZFS. +Other uses, such as having a preexisting UFS file system, can be overridden with +======= +The command attempts to verify that each device specified is accessible and not +currently in use by another subsystem. +However this check is not robust enough +to detect simultaneous attempts to use a new device in different pools, even if +.Sy multihost +is +.Sy enabled. +The +administrator must ensure that simultaneous invocations of any combination of +.Sy zpool replace , +.Sy zpool create , +.Sy zpool add , +or +.Sy zpool labelclear , +do not refer to the same device. +Using the same device in two pools will +result in pool corruption. +.sp +There are some uses, such as being currently mounted, or specified as the +dedicated dump device, that prevents a device from ever being used by ZFS. +Other uses, such as having a preexisting UFS file system, can be overridden with +>>>>>>> in use by another subsystem. There are some uses, such as being currently mounted, or specified as the dedicated dump device, that prevents a device from ever being used by Modified: head/cddl/contrib/opensolaris/cmd/zpool/zpool_main.c ============================================================================== --- head/cddl/contrib/opensolaris/cmd/zpool/zpool_main.c Mon Nov 18 07:04:59 2019 (r354803) +++ head/cddl/contrib/opensolaris/cmd/zpool/zpool_main.c Mon Nov 18 09:38:35 2019 (r354804) @@ -53,6 +53,7 @@ #include #include #include +#include #include @@ -1635,6 +1636,10 @@ print_status_config(zpool_handle_t *zhp, const char *n (void) printf(gettext("split into new pool")); break; + case VDEV_AUX_ACTIVE: + (void) printf(gettext("currently in use")); + break; + case VDEV_AUX_CHILDREN_OFFLINE: (void) printf(gettext("all children offline")); break; @@ -1769,6 +1774,10 @@ print_import_config(const char *name, nvlist_t *nv, in (void) printf(gettext("too many errors")); break; + case VDEV_AUX_ACTIVE: + (void) printf(gettext("currently in use")); + break; + case VDEV_AUX_CHILDREN_OFFLINE: (void) printf(gettext("all children offline")); break; @@ -1866,8 +1875,10 @@ show_import(nvlist_t *config) vdev_stat_t *vs; char *name; uint64_t guid; + uint64_t hostid = 0; char *msgid; - nvlist_t *nvroot; + char *hostname = "unknown"; + nvlist_t *nvroot, *nvinfo; int reason; const char *health; uint_t vsc; @@ -1954,6 +1965,17 @@ show_import(nvlist_t *config) zpool_print_unsup_feat(config); break; + case ZPOOL_STATUS_HOSTID_ACTIVE: + (void) printf(gettext(" status: The pool is currently " + "imported by another system.\n")); + break; + + case ZPOOL_STATUS_HOSTID_REQUIRED: + (void) printf(gettext(" status: The pool has the " + "multihost property on. It cannot\n\tbe safely imported " + "when the system hostid is not set.\n")); + break; + case ZPOOL_STATUS_HOSTID_MISMATCH: (void) printf(gettext(" status: The pool was last accessed by " "another system.\n")); @@ -2040,6 +2062,27 @@ show_import(nvlist_t *config) "imported. Attach the missing\n\tdevices and try " "again.\n")); break; + case ZPOOL_STATUS_HOSTID_ACTIVE: + VERIFY0(nvlist_lookup_nvlist(config, + ZPOOL_CONFIG_LOAD_INFO, &nvinfo)); + + if (nvlist_exists(nvinfo, ZPOOL_CONFIG_MMP_HOSTNAME)) + hostname = fnvlist_lookup_string(nvinfo, + ZPOOL_CONFIG_MMP_HOSTNAME); + + if (nvlist_exists(nvinfo, ZPOOL_CONFIG_MMP_HOSTID)) + hostid = fnvlist_lookup_uint64(nvinfo, + ZPOOL_CONFIG_MMP_HOSTID); + + (void) printf(gettext(" action: The pool must be " + "exported from %s (hostid=%lx)\n\tbefore it " + "can be safely imported.\n"), hostname, + (unsigned long) hostid); + break; + case ZPOOL_STATUS_HOSTID_REQUIRED: + (void) printf(gettext(" action: Check the SMF " + "svc:/system/hostid service.\n")); + break; default: (void) printf(gettext(" action: The pool cannot be " "imported due to damaged devices or data.\n")); @@ -2087,6 +2130,31 @@ show_import(nvlist_t *config) } } +static boolean_t +zfs_force_import_required(nvlist_t *config) +{ + uint64_t state; + uint64_t hostid = 0; + nvlist_t *nvinfo; + + state = fnvlist_lookup_uint64(config, ZPOOL_CONFIG_POOL_STATE); + (void) nvlist_lookup_uint64(config, ZPOOL_CONFIG_HOSTID, &hostid); + + if (state != POOL_STATE_EXPORTED && hostid != get_system_hostid()) + return (B_TRUE); + + nvinfo = fnvlist_lookup_nvlist(config, ZPOOL_CONFIG_LOAD_INFO); + if (nvlist_exists(nvinfo, ZPOOL_CONFIG_MMP_STATE)) { + mmp_state_t mmp_state = fnvlist_lookup_uint64(nvinfo, + ZPOOL_CONFIG_MMP_STATE); + + if (mmp_state != MMP_STATE_INACTIVE) + return (B_TRUE); + } + + return (B_FALSE); +} + /* * Perform the import for the given configuration. This passes the heavy * lifting off to zpool_import_props(), and then mounts the datasets contained @@ -2098,53 +2166,73 @@ do_import(nvlist_t *config, const char *newname, const { zpool_handle_t *zhp; char *name; - uint64_t state; uint64_t version; - verify(nvlist_lookup_string(config, ZPOOL_CONFIG_POOL_NAME, - &name) == 0); + name = fnvlist_lookup_string(config, ZPOOL_CONFIG_POOL_NAME); + version = fnvlist_lookup_uint64(config, ZPOOL_CONFIG_VERSION); - verify(nvlist_lookup_uint64(config, - ZPOOL_CONFIG_POOL_STATE, &state) == 0); - verify(nvlist_lookup_uint64(config, - ZPOOL_CONFIG_VERSION, &version) == 0); if (!SPA_VERSION_IS_SUPPORTED(version)) { (void) fprintf(stderr, gettext("cannot import '%s': pool " "is formatted using an unsupported ZFS version\n"), name); return (1); - } else if (state != POOL_STATE_EXPORTED && + } else if (zfs_force_import_required(config) && !(flags & ZFS_IMPORT_ANY_HOST)) { - uint64_t hostid; + mmp_state_t mmp_state = MMP_STATE_INACTIVE; + nvlist_t *nvinfo; - if (nvlist_lookup_uint64(config, ZPOOL_CONFIG_HOSTID, - &hostid) == 0) { - if ((unsigned long)hostid != gethostid()) { - char *hostname; - uint64_t timestamp; - time_t t; + nvinfo = fnvlist_lookup_nvlist(config, ZPOOL_CONFIG_LOAD_INFO); + if (nvlist_exists(nvinfo, ZPOOL_CONFIG_MMP_STATE)) + mmp_state = fnvlist_lookup_uint64(nvinfo, + ZPOOL_CONFIG_MMP_STATE); - verify(nvlist_lookup_string(config, - ZPOOL_CONFIG_HOSTNAME, &hostname) == 0); - verify(nvlist_lookup_uint64(config, - ZPOOL_CONFIG_TIMESTAMP, ×tamp) == 0); - t = timestamp; - (void) fprintf(stderr, gettext("cannot import " - "'%s': pool may be in use from other " - "system, it was last accessed by %s " - "(hostid: 0x%lx) on %s"), name, hostname, - (unsigned long)hostid, - asctime(localtime(&t))); - (void) fprintf(stderr, gettext("use '-f' to " - "import anyway\n")); - return (1); - } + if (mmp_state == MMP_STATE_ACTIVE) { + char *hostname = ""; + uint64_t hostid = 0; + + if (nvlist_exists(nvinfo, ZPOOL_CONFIG_MMP_HOSTNAME)) + hostname = fnvlist_lookup_string(nvinfo, + ZPOOL_CONFIG_MMP_HOSTNAME); + + if (nvlist_exists(nvinfo, ZPOOL_CONFIG_MMP_HOSTID)) + hostid = fnvlist_lookup_uint64(nvinfo, + ZPOOL_CONFIG_MMP_HOSTID); + + (void) fprintf(stderr, gettext("cannot import '%s': " + "pool is imported on %s (hostid: " + "0x%lx)\nExport the pool on the other system, " + "then run 'zpool import'.\n"), + name, hostname, (unsigned long) hostid); + } else if (mmp_state == MMP_STATE_NO_HOSTID) { + (void) fprintf(stderr, gettext("Cannot import '%s': " + "pool has the multihost property on and the\n" + "system's hostid is not set.\n"), name); } else { + char *hostname = ""; + uint64_t timestamp = 0; + uint64_t hostid = 0; + + if (nvlist_exists(config, ZPOOL_CONFIG_HOSTNAME)) + hostname = fnvlist_lookup_string(config, + ZPOOL_CONFIG_HOSTNAME); + + if (nvlist_exists(config, ZPOOL_CONFIG_TIMESTAMP)) + timestamp = fnvlist_lookup_uint64(config, + ZPOOL_CONFIG_TIMESTAMP); + + if (nvlist_exists(config, ZPOOL_CONFIG_HOSTID)) + hostid = fnvlist_lookup_uint64(config, + ZPOOL_CONFIG_HOSTID); + (void) fprintf(stderr, gettext("cannot import '%s': " - "pool may be in use from other system\n"), name); - (void) fprintf(stderr, gettext("use '-f' to import " - "anyway\n")); - return (1); + "pool was previously in use from another system.\n" + "Last accessed by %s (hostid=%lx) at %s" + "The pool can be imported, use 'zpool import -f' " + "to import the pool.\n"), name, hostname, + (unsigned long)hostid, ctime((time_t *)×tamp)); + } + + return (1); } if (zpool_import_props(g_zfs, config, newname, props, flags) != 0) @@ -5106,6 +5194,15 @@ status_callback(zpool_handle_t *zhp, void *data) "from a backup source. Manually marking the device\n" "\trepaired using 'zpool clear' may allow some data " "to be recovered.\n")); + break; + + case ZPOOL_STATUS_IO_FAILURE_MMP: + (void) printf(gettext("status: The pool is suspended because " + "multihost writes failed or were delayed;\n\tanother " + "system could import the pool undetected.\n")); + (void) printf(gettext("action: Make sure the pool's devices " + "are connected, then reboot your system and\n\timport the " + "pool.\n")); break; case ZPOOL_STATUS_IO_FAILURE_WAIT: Modified: head/cddl/contrib/opensolaris/cmd/ztest/ztest.c ============================================================================== --- head/cddl/contrib/opensolaris/cmd/ztest/ztest.c Mon Nov 18 07:04:59 2019 (r354803) +++ head/cddl/contrib/opensolaris/cmd/ztest/ztest.c Mon Nov 18 09:38:35 2019 (r354804) @@ -128,6 +128,7 @@ #include #include #include +#include #include static int ztest_fd_data = -1; @@ -166,6 +167,7 @@ typedef struct ztest_shared_opts { uint64_t zo_time; uint64_t zo_maxloops; uint64_t zo_metaslab_force_ganging; + int zo_mmp_test; } ztest_shared_opts_t; static const ztest_shared_opts_t ztest_opts_defaults = { @@ -184,6 +186,7 @@ static const ztest_shared_opts_t ztest_opts_defaults = .zo_passtime = 60, /* 60 seconds */ .zo_killrate = 70, /* 70% kill rate */ .zo_verbose = 0, + .zo_mmp_test = 0, .zo_init = 1, .zo_time = 300, /* 5 minutes */ .zo_maxloops = 50, /* max loops during spa_freeze() */ @@ -343,6 +346,7 @@ ztest_func_t ztest_spa_create_destroy; ztest_func_t ztest_fault_inject; ztest_func_t ztest_ddt_repair; ztest_func_t ztest_dmu_snapshot_hold; +ztest_func_t ztest_mmp_enable_disable; ztest_func_t ztest_scrub; ztest_func_t ztest_dsl_dataset_promote_busy; ztest_func_t ztest_vdev_attach_detach; @@ -388,6 +392,7 @@ ztest_info_t ztest_info[] = { { ztest_fault_inject, 1, &zopt_incessant }, { ztest_ddt_repair, 1, &zopt_sometimes }, { ztest_dmu_snapshot_hold, 1, &zopt_sometimes }, + { ztest_mmp_enable_disable, 1, &zopt_sometimes }, { ztest_reguid, 1, &zopt_rarely }, { ztest_scrub, 1, &zopt_often }, { ztest_spa_upgrade, 1, &zopt_rarely }, @@ -601,6 +606,7 @@ usage(boolean_t requested) "\t[-k kill_percentage (default: %llu%%)]\n" "\t[-p pool_name (default: %s)]\n" "\t[-f dir (default: %s)] file directory for vdev files\n" + "\t[-M] Multi-host simulate pool imported on remote host\n" "\t[-V] verbose (use multiple times for ever more blather)\n" "\t[-E] use existing pool instead of creating new one\n" "\t[-T time (default: %llu sec)] total run time\n" @@ -644,7 +650,7 @@ process_options(int argc, char **argv) bcopy(&ztest_opts_defaults, zo, sizeof (*zo)); while ((opt = getopt(argc, argv, - "v:s:a:m:r:R:d:t:g:i:k:p:f:VET:P:hF:B:o:")) != EOF) { + "v:s:a:m:r:R:d:t:g:i:k:p:f:MVET:P:hF:B:o:")) != EOF) { value = 0; switch (opt) { case 'v': @@ -713,6 +719,9 @@ process_options(int argc, char **argv) sizeof (zo->zo_dir)); } break; + case 'M': + zo->zo_mmp_test = 1; + break; case 'V': zo->zo_verbose++; break; @@ -2480,6 +2489,9 @@ ztest_spa_create_destroy(ztest_ds_t *zd, uint64_t id) spa_t *spa; nvlist_t *nvroot; + if (zo->zo_mmp_test) + return; + /* * Attempt to create using a bad file. */ @@ -2511,8 +2523,58 @@ ztest_spa_create_destroy(ztest_ds_t *zd, uint64_t id) rw_exit(&ztest_name_lock); } +/* + * Start and then stop the MMP threads to ensure the startup and shutdown code + * works properly. Actual protection and property-related code tested via ZTS. + */ /* ARGSUSED */ void +ztest_mmp_enable_disable(ztest_ds_t *zd, uint64_t id) +{ + ztest_shared_opts_t *zo = &ztest_opts; + spa_t *spa = ztest_spa; + + if (zo->zo_mmp_test) + return; + + /* + * Since enabling MMP involves setting a property, it could not be done + * while the pool is suspended. + */ + if (spa_suspended(spa)) + return; + + spa_config_enter(spa, SCL_CONFIG, FTAG, RW_READER); + mutex_enter(&spa->spa_props_lock); + + zfs_multihost_fail_intervals = 0; + + if (!spa_multihost(spa)) { + spa->spa_multihost = B_TRUE; + mmp_thread_start(spa); + } + + mutex_exit(&spa->spa_props_lock); + spa_config_exit(spa, SCL_CONFIG, FTAG); + + txg_wait_synced(spa_get_dsl(spa), 0); + mmp_signal_all_threads(); + txg_wait_synced(spa_get_dsl(spa), 0); + + spa_config_enter(spa, SCL_CONFIG, FTAG, RW_READER); + mutex_enter(&spa->spa_props_lock); + + if (spa_multihost(spa)) { + mmp_thread_stop(spa); + spa->spa_multihost = B_FALSE; + } + + mutex_exit(&spa->spa_props_lock); + spa_config_exit(spa, SCL_CONFIG, FTAG); +} + +/* ARGSUSED */ +void ztest_spa_upgrade(ztest_ds_t *zd, uint64_t id) { spa_t *spa; @@ -2521,6 +2583,9 @@ ztest_spa_upgrade(ztest_ds_t *zd, uint64_t id) nvlist_t *nvroot, *props; char *name; + if (ztest_opts.zo_mmp_test) + return; + mutex_enter(&ztest_vdev_lock); name = kmem_asprintf("%s_upgrade", ztest_opts.zo_pool); @@ -2689,6 +2754,9 @@ ztest_vdev_add_remove(ztest_ds_t *zd, uint64_t id) nvlist_t *nvroot; int error; + if (ztest_opts.zo_mmp_test) + return; + mutex_enter(&ztest_vdev_lock); leaves = MAX(zs->zs_mirrors + zs->zs_splits, 1) * ztest_opts.zo_raidz; @@ -2771,6 +2839,9 @@ ztest_vdev_aux_add_remove(ztest_ds_t *zd, uint64_t id) uint64_t guid = 0; int error; + if (ztest_opts.zo_mmp_test) + return; + if (ztest_random(2) == 0) { sav = &spa->spa_spares; aux = ZPOOL_CONFIG_SPARES; @@ -2866,6 +2937,9 @@ ztest_split_pool(ztest_ds_t *zd, uint64_t id) uint_t c, children, schildren = 0, lastlogid = 0; int error = 0; + if (ztest_opts.zo_mmp_test) + return; + mutex_enter(&ztest_vdev_lock); /* ensure we have a useable config; mirrors of raidz aren't supported */ @@ -2972,6 +3046,9 @@ ztest_vdev_attach_detach(ztest_ds_t *zd, uint64_t id) int oldvd_is_log; int error, expected_error; + if (ztest_opts.zo_mmp_test) + return; + mutex_enter(&ztest_vdev_lock); leaves = MAX(zs->zs_mirrors, 1) * ztest_opts.zo_raidz; @@ -5564,6 +5641,9 @@ ztest_reguid(ztest_ds_t *zd, uint64_t id) uint64_t orig, load; int error; + if (ztest_opts.zo_mmp_test) + return; + orig = spa_guid(spa); load = spa_load_guid(spa); @@ -6249,7 +6329,7 @@ ztest_run(ztest_shared_t *zs) * Verify that we can export the pool and reimport it under a * different name. */ - if (ztest_random(2) == 0) { + if ((ztest_random(2) == 0) && !ztest_opts.zo_mmp_test) { char name[ZFS_MAX_DATASET_NAME_LEN]; (void) snprintf(name, sizeof (name), "%s_import", ztest_opts.zo_pool); @@ -6398,6 +6478,56 @@ make_random_props() } /* + * Import a storage pool with the given name. + */ +static void +ztest_import(ztest_shared_t *zs) +{ + libzfs_handle_t *hdl; + importargs_t args = { 0 }; + spa_t *spa; + nvlist_t *cfg = NULL; + int nsearch = 1; + char *searchdirs[nsearch]; + char *name = ztest_opts.zo_pool; + int flags = ZFS_IMPORT_MISSING_LOG; + int error; + + mutex_init(&ztest_vdev_lock, NULL, MUTEX_DEFAULT, NULL); + rw_init(&ztest_name_lock, NULL, USYNC_THREAD, NULL); + + kernel_init(FREAD | FWRITE); + hdl = libzfs_init(); + + searchdirs[0] = ztest_opts.zo_dir; + args.paths = nsearch; + args.path = searchdirs; + args.can_be_active = B_FALSE; + + error = zpool_tryimport(hdl, name, &cfg, &args); + if (error) + (void) fatal(0, "No pools found\n"); + + VERIFY0(spa_import(name, cfg, NULL, flags)); + VERIFY0(spa_open(name, &spa, FTAG)); + zs->zs_metaslab_sz = + 1ULL << spa->spa_root_vdev->vdev_child[0]->vdev_ms_shift; + spa_close(spa, FTAG); + + libzfs_fini(hdl); + kernel_fini(); + + if (!ztest_opts.zo_mmp_test) { *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-all@freebsd.org Mon Nov 18 10:19:18 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 37E5C1BB55E; Mon, 18 Nov 2019 10:19:18 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47GlLF4XzQz43jQ; Mon, 18 Nov 2019 10:19:17 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 56AAC28796; Mon, 18 Nov 2019 10:19:17 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xAIAJHh6051554; Mon, 18 Nov 2019 10:19:17 GMT (envelope-from trasz@FreeBSD.org) Received: (from trasz@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xAIAJHjw051553; Mon, 18 Nov 2019 10:19:17 GMT (envelope-from trasz@FreeBSD.org) Message-Id: <201911181019.xAIAJHjw051553@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: trasz set sender to trasz@FreeBSD.org using -f From: Edward Tomasz Napierala Date: Mon, 18 Nov 2019 10:19:17 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354805 - head/sys/compat/linux X-SVN-Group: head X-SVN-Commit-Author: trasz X-SVN-Commit-Paths: head/sys/compat/linux X-SVN-Commit-Revision: 354805 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 18 Nov 2019 10:19:18 -0000 Author: trasz Date: Mon Nov 18 10:19:16 2019 New Revision: 354805 URL: https://svnweb.freebsd.org/changeset/base/354805 Log: Make linux(4) open(2)/openat(2) return ELOOP instead of EMLINK, when being passed O_NOFOLLOW. This fixes LTP testcase openat02:5. Reviewed by: emaste MFC after: 2 weeks Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D22384 Modified: head/sys/compat/linux/linux_file.c Modified: head/sys/compat/linux/linux_file.c ============================================================================== --- head/sys/compat/linux/linux_file.c Mon Nov 18 09:38:35 2019 (r354804) +++ head/sys/compat/linux/linux_file.c Mon Nov 18 10:19:16 2019 (r354805) @@ -132,8 +132,11 @@ linux_common_open(struct thread *td, int dirfd, char * /* XXX LINUX_O_NOATIME: unable to be easily implemented. */ error = kern_openat(td, dirfd, path, UIO_SYSSPACE, bsd_flags, mode); - if (error != 0) + if (error != 0) { + if (error == EMLINK) + error = ELOOP; goto done; + } if (bsd_flags & O_NOCTTY) goto done; From owner-svn-src-all@freebsd.org Mon Nov 18 10:34:28 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 90D461BBB13; Mon, 18 Nov 2019 10:34:28 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47Glgm22llz4JCq; Mon, 18 Nov 2019 10:34:28 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 9E93028B16; Mon, 18 Nov 2019 10:34:27 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xAIAYRS1062911; Mon, 18 Nov 2019 10:34:27 GMT (envelope-from avg@FreeBSD.org) Received: (from avg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xAIAYRWB062910; Mon, 18 Nov 2019 10:34:27 GMT (envelope-from avg@FreeBSD.org) Message-Id: <201911181034.xAIAYRWB062910@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avg set sender to avg@FreeBSD.org using -f From: Andriy Gapon Date: Mon, 18 Nov 2019 10:34:27 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354806 - head/cddl/usr.bin/zstreamdump X-SVN-Group: head X-SVN-Commit-Author: avg X-SVN-Commit-Paths: head/cddl/usr.bin/zstreamdump X-SVN-Commit-Revision: 354806 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 18 Nov 2019 10:34:28 -0000 Author: avg Date: Mon Nov 18 10:34:27 2019 New Revision: 354806 URL: https://svnweb.freebsd.org/changeset/base/354806 Log: fix up r354804, link zstreamdump with libzfs Since r354804 libzpool depends on libzfs for get_system_hostid symbol. Except for zstreamdump, all binaries linked with libzpool were already linked with libzfs. So, zstreamdump is the only fall-out. It's interesting that on amd64 not only I was able to successfully build zstreamdump, I am able to run it despite having the unresolved symbol in libzpool. MFC after: 4 weeks X-MFC with: r354804 Modified: head/cddl/usr.bin/zstreamdump/Makefile Modified: head/cddl/usr.bin/zstreamdump/Makefile ============================================================================== --- head/cddl/usr.bin/zstreamdump/Makefile Mon Nov 18 10:19:16 2019 (r354805) +++ head/cddl/usr.bin/zstreamdump/Makefile Mon Nov 18 10:34:27 2019 (r354806) @@ -16,7 +16,7 @@ CFLAGS+= -I${SRCTOP}/sys/cddl/contrib/opensolaris/uts/ CFLAGS+= -I${SRCTOP}/sys/cddl/contrib/opensolaris/uts/common CFLAGS+= -I${SRCTOP}/cddl/contrib/opensolaris/head -LIBADD= m nvpair umem zpool pthread z avl +LIBADD= m nvpair umem zpool zfs pthread z avl CSTD= c99 From owner-svn-src-all@freebsd.org Mon Nov 18 10:46:56 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 8A8F81BBDCC; Mon, 18 Nov 2019 10:46:56 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47Gly82BC5z4WNk; Mon, 18 Nov 2019 10:46:56 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 272FF28CE7; Mon, 18 Nov 2019 10:46:56 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xAIAktQB068856; Mon, 18 Nov 2019 10:46:55 GMT (envelope-from avg@FreeBSD.org) Received: (from avg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xAIAktY1068855; Mon, 18 Nov 2019 10:46:55 GMT (envelope-from avg@FreeBSD.org) Message-Id: <201911181046.xAIAktY1068855@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avg set sender to avg@FreeBSD.org using -f From: Andriy Gapon Date: Mon, 18 Nov 2019 10:46:55 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354807 - head/sys/conf X-SVN-Group: head X-SVN-Commit-Author: avg X-SVN-Commit-Paths: head/sys/conf X-SVN-Commit-Revision: 354807 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 18 Nov 2019 10:46:56 -0000 Author: avg Date: Mon Nov 18 10:46:55 2019 New Revision: 354807 URL: https://svnweb.freebsd.org/changeset/base/354807 Log: fix up r354804, add new ZFS file mmp.c to kernel files Reported by: CI LINT build MFC after: 4 weeks X-MFC with: r354804 Modified: head/sys/conf/files Modified: head/sys/conf/files ============================================================================== --- head/sys/conf/files Mon Nov 18 10:34:27 2019 (r354806) +++ head/sys/conf/files Mon Nov 18 10:46:55 2019 (r354807) @@ -205,6 +205,7 @@ cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_synctas cddl/contrib/opensolaris/uts/common/fs/zfs/gzip.c optional zfs compile-with "${ZFS_C}" cddl/contrib/opensolaris/uts/common/fs/zfs/lzjb.c optional zfs compile-with "${ZFS_C}" cddl/contrib/opensolaris/uts/common/fs/zfs/metaslab.c optional zfs compile-with "${ZFS_C}" +cddl/contrib/opensolaris/uts/common/fs/zfs/mmp.c optional zfs compile-with "${ZFS_C}" cddl/contrib/opensolaris/uts/common/fs/zfs/multilist.c optional zfs compile-with "${ZFS_C}" cddl/contrib/opensolaris/uts/common/fs/zfs/range_tree.c optional zfs compile-with "${ZFS_C}" cddl/contrib/opensolaris/uts/common/fs/zfs/refcount.c optional zfs compile-with "${ZFS_C}" From owner-svn-src-all@freebsd.org Mon Nov 18 13:31:19 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 672D61C00DD; Mon, 18 Nov 2019 13:31:19 +0000 (UTC) (envelope-from dab@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47Gqbq2r3Xz3HHf; Mon, 18 Nov 2019 13:31:19 +0000 (UTC) (envelope-from dab@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 453E22AA59; Mon, 18 Nov 2019 13:31:19 +0000 (UTC) (envelope-from dab@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xAIDVJeR063477; Mon, 18 Nov 2019 13:31:19 GMT (envelope-from dab@FreeBSD.org) Received: (from dab@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xAIDVG75063465; Mon, 18 Nov 2019 13:31:16 GMT (envelope-from dab@FreeBSD.org) Message-Id: <201911181331.xAIDVG75063465@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dab set sender to dab@FreeBSD.org using -f From: David Bright Date: Mon, 18 Nov 2019 13:31:16 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354808 - in head: contrib/openbsm/etc contrib/openbsm/sys/bsm sys/bsm sys/compat/freebsd32 sys/kern sys/security/audit sys/sys tests/sys/posixshm X-SVN-Group: head X-SVN-Commit-Author: dab X-SVN-Commit-Paths: in head: contrib/openbsm/etc contrib/openbsm/sys/bsm sys/bsm sys/compat/freebsd32 sys/kern sys/security/audit sys/sys tests/sys/posixshm X-SVN-Commit-Revision: 354808 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 18 Nov 2019 13:31:19 -0000 Author: dab Date: Mon Nov 18 13:31:16 2019 New Revision: 354808 URL: https://svnweb.freebsd.org/changeset/base/354808 Log: Jail and capability mode for shm_rename; add audit support for shm_rename Co-mingling two things here: * Addressing some feedback from Konstantin and Kyle re: jail, capability mode, and a few other things * Adding audit support as promised. The audit support change includes a partial refresh of OpenBSM from upstream, where the change to add shm_rename has already been accepted. Matthew doesn't plan to work on refreshing anything else to support audit for those new event types. Submitted by: Matthew Bryan Reviewed by: kib Relnotes: Yes Sponsored by: Dell EMC Isilon Differential Revision: https://reviews.freebsd.org/D22083 Modified: head/contrib/openbsm/etc/audit_event head/contrib/openbsm/sys/bsm/audit_kevents.h head/sys/bsm/audit_kevents.h head/sys/compat/freebsd32/freebsd32_sysent.c head/sys/compat/freebsd32/syscalls.master head/sys/kern/init_sysent.c head/sys/kern/syscalls.master head/sys/kern/uipc_shm.c head/sys/security/audit/audit_bsm.c head/sys/sys/mman.h head/sys/sys/sysproto.h head/tests/sys/posixshm/posixshm_test.c Modified: head/contrib/openbsm/etc/audit_event ============================================================================== --- head/contrib/openbsm/etc/audit_event Mon Nov 18 10:46:55 2019 (r354807) +++ head/contrib/openbsm/etc/audit_event Mon Nov 18 13:31:16 2019 (r354808) @@ -601,6 +601,19 @@ 43238:AUE_SETLOGINCLASS:setloginclass(2):pc 43239:AUE_POSIX_FADVISE:posix_fadvise(2):no 43240:AUE_SCTP_GENERIC_SENDMSG_IOV:sctp_generic_sendmsg_iov(2):nt +43241:AUE_ABORT2:abort(2):pc +43242:AUE_SEMTIMEDWAIT:sem_timedwait(3):ip +43243:AUE_SEMDESTROY:sem_destroy(3):ip +43244:AUE_SEMGETVALUE:sem_getvalue(3):ip +43245:AUE_SEMINIT:sem_init(3):ip +43246:AUE_SEMPOST:sem_post(3):ip +43247:AUE_SEMTRYWAIT:sem_trywait(3):ip +43258:AUE_SEMWAIT:sem_wait(3):ip +43259:AUE_FGETUUID:fgetuuid(2):ip +43260:AUE_GETUUID:getuuid(2):ip +43261:AUE_LGETUUID:lgetuuid(2):ip +43262:AUE_EXECVEAT:execveat(2):pc,ex +43263:AUE_SHMRENAME:shm_rename(2):ip # # Solaris userspace events. # Modified: head/contrib/openbsm/sys/bsm/audit_kevents.h ============================================================================== --- head/contrib/openbsm/sys/bsm/audit_kevents.h Mon Nov 18 10:46:55 2019 (r354807) +++ head/contrib/openbsm/sys/bsm/audit_kevents.h Mon Nov 18 13:31:16 2019 (r354808) @@ -640,6 +640,19 @@ #define AUE_SETLOGINCLASS 43238 /* FreeBSD-specific. */ #define AUE_POSIX_FADVISE 43239 /* FreeBSD-specific. */ #define AUE_SCTP_GENERIC_SENDMSG_IOV 43240 /* FreeBSD-specific. */ +#define AUE_ABORT2 43241 /* FreeBSD-specific. */ +#define AUE_SEMTIMEDWAIT 43242 /* FreeBSD-specific. */ +#define AUE_SEMDESTROY 43243 /* FreeBSD-specific. */ +#define AUE_SEMGETVALUE 43244 /* FreeBSD-specific. */ +#define AUE_SEMINIT 43245 /* FreeBSD-specific. */ +#define AUE_SEMPOST 43246 /* FreeBSD-specific. */ +#define AUE_SEMTRYWAIT 43247 /* FreeBSD-specific. */ +#define AUE_SEMWAIT 43258 /* FreeBSD-specific. */ +#define AUE_FGETUUID 43259 /* CADETS. */ +#define AUE_GETUUID 43260 /* CADETS. */ +#define AUE_LGETUUID 43261 /* CADETS. */ +#define AUE_EXECVEAT 43262 /* FreeBSD/Linux. */ +#define AUE_SHMRENAME 43263 /* FreeBSD-specific. */ /* * Darwin BSM uses a number of AUE_O_* definitions, which are aliased to the @@ -794,12 +807,6 @@ #define AUE_REMOVEXATTR AUE_NULL #define AUE_SBRK AUE_NULL #define AUE_SELECT AUE_NULL -#define AUE_SEMDESTROY AUE_NULL -#define AUE_SEMGETVALUE AUE_NULL -#define AUE_SEMINIT AUE_NULL -#define AUE_SEMPOST AUE_NULL -#define AUE_SEMTRYWAIT AUE_NULL -#define AUE_SEMWAIT AUE_NULL #define AUE_SEMWAITSIGNAL AUE_NULL #define AUE_SETITIMER AUE_NULL #define AUE_SETSGROUPS AUE_NULL Modified: head/sys/bsm/audit_kevents.h ============================================================================== --- head/sys/bsm/audit_kevents.h Mon Nov 18 10:46:55 2019 (r354807) +++ head/sys/bsm/audit_kevents.h Mon Nov 18 13:31:16 2019 (r354808) @@ -644,6 +644,19 @@ #define AUE_SETLOGINCLASS 43238 /* FreeBSD-specific. */ #define AUE_POSIX_FADVISE 43239 /* FreeBSD-specific. */ #define AUE_SCTP_GENERIC_SENDMSG_IOV 43240 /* FreeBSD-specific. */ +#define AUE_ABORT2 43241 /* FreeBSD-specific. */ +#define AUE_SEMTIMEDWAIT 43242 /* FreeBSD-specific. */ +#define AUE_SEMDESTROY 43243 /* FreeBSD-specific. */ +#define AUE_SEMGETVALUE 43244 /* FreeBSD-specific. */ +#define AUE_SEMINIT 43245 /* FreeBSD-specific. */ +#define AUE_SEMPOST 43246 /* FreeBSD-specific. */ +#define AUE_SEMTRYWAIT 43247 /* FreeBSD-specific. */ +#define AUE_SEMWAIT 43258 /* FreeBSD-specific. */ +#define AUE_FGETUUID 43259 /* CADETS. */ +#define AUE_GETUUID 43260 /* CADETS. */ +#define AUE_LGETUUID 43261 /* CADETS. */ +#define AUE_EXECVEAT 43262 /* FreeBSD/Linux. */ +#define AUE_SHMRENAME 43263 /* FreeBSD-specific. */ /* * Darwin BSM uses a number of AUE_O_* definitions, which are aliased to the @@ -798,12 +811,6 @@ #define AUE_REMOVEXATTR AUE_NULL #define AUE_SBRK AUE_NULL #define AUE_SELECT AUE_NULL -#define AUE_SEMDESTROY AUE_NULL -#define AUE_SEMGETVALUE AUE_NULL -#define AUE_SEMINIT AUE_NULL -#define AUE_SEMPOST AUE_NULL -#define AUE_SEMTRYWAIT AUE_NULL -#define AUE_SEMWAIT AUE_NULL #define AUE_SEMWAITSIGNAL AUE_NULL #define AUE_SETITIMER AUE_NULL #define AUE_SETSGROUPS AUE_NULL Modified: head/sys/compat/freebsd32/freebsd32_sysent.c ============================================================================== --- head/sys/compat/freebsd32/freebsd32_sysent.c Mon Nov 18 10:46:55 2019 (r354807) +++ head/sys/compat/freebsd32/freebsd32_sysent.c Mon Nov 18 13:31:16 2019 (r354808) @@ -661,5 +661,5 @@ struct sysent freebsd32_sysent[] = { { AS(copy_file_range_args), (sy_call_t *)sys_copy_file_range, AUE_NULL, NULL, 0, 0, SYF_CAPENABLED, SY_THR_STATIC }, /* 569 = copy_file_range */ { AS(freebsd32___sysctlbyname_args), (sy_call_t *)freebsd32___sysctlbyname, AUE_SYSCTL, NULL, 0, 0, SYF_CAPENABLED, SY_THR_STATIC }, /* 570 = freebsd32___sysctlbyname */ { AS(shm_open2_args), (sy_call_t *)sys_shm_open2, AUE_SHMOPEN, NULL, 0, 0, SYF_CAPENABLED, SY_THR_STATIC }, /* 571 = shm_open2 */ - { AS(shm_rename_args), (sy_call_t *)sys_shm_rename, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC }, /* 572 = shm_rename */ + { AS(shm_rename_args), (sy_call_t *)sys_shm_rename, AUE_SHMRENAME, NULL, 0, 0, 0, SY_THR_STATIC }, /* 572 = shm_rename */ }; Modified: head/sys/compat/freebsd32/syscalls.master ============================================================================== --- head/sys/compat/freebsd32/syscalls.master Mon Nov 18 10:46:55 2019 (r354807) +++ head/sys/compat/freebsd32/syscalls.master Mon Nov 18 13:31:16 2019 (r354808) @@ -1157,7 +1157,7 @@ 571 AUE_SHMOPEN NOPROTO { int shm_open2( \ const char *path, int flags, mode_t mode, \ int shmflags, const char *name); } -572 AUE_NULL NOPROTO { int shm_rename(const char *path_from, \ +572 AUE_SHMRENAME NOPROTO { int shm_rename(const char *path_from, \ const char *path_to, int flags); } ; vim: syntax=off Modified: head/sys/kern/init_sysent.c ============================================================================== --- head/sys/kern/init_sysent.c Mon Nov 18 10:46:55 2019 (r354807) +++ head/sys/kern/init_sysent.c Mon Nov 18 13:31:16 2019 (r354808) @@ -627,5 +627,5 @@ struct sysent sysent[] = { { AS(copy_file_range_args), (sy_call_t *)sys_copy_file_range, AUE_NULL, NULL, 0, 0, SYF_CAPENABLED, SY_THR_STATIC }, /* 569 = copy_file_range */ { AS(__sysctlbyname_args), (sy_call_t *)sys___sysctlbyname, AUE_SYSCTL, NULL, 0, 0, SYF_CAPENABLED, SY_THR_STATIC }, /* 570 = __sysctlbyname */ { AS(shm_open2_args), (sy_call_t *)sys_shm_open2, AUE_SHMOPEN, NULL, 0, 0, SYF_CAPENABLED, SY_THR_STATIC }, /* 571 = shm_open2 */ - { AS(shm_rename_args), (sy_call_t *)sys_shm_rename, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC }, /* 572 = shm_rename */ + { AS(shm_rename_args), (sy_call_t *)sys_shm_rename, AUE_SHMRENAME, NULL, 0, 0, 0, SY_THR_STATIC }, /* 572 = shm_rename */ }; Modified: head/sys/kern/syscalls.master ============================================================================== --- head/sys/kern/syscalls.master Mon Nov 18 10:46:55 2019 (r354807) +++ head/sys/kern/syscalls.master Mon Nov 18 13:31:16 2019 (r354808) @@ -3205,7 +3205,7 @@ _In_z_ const char *name ); } -572 AUE_NULL STD { +572 AUE_SHMRENAME STD { int shm_rename( _In_z_ const char *path_from, _In_z_ const char *path_to, Modified: head/sys/kern/uipc_shm.c ============================================================================== --- head/sys/kern/uipc_shm.c Mon Nov 18 10:46:55 2019 (r354807) +++ head/sys/kern/uipc_shm.c Mon Nov 18 13:31:16 2019 (r354808) @@ -122,6 +122,8 @@ static struct shmfd *shm_lookup(char *path, Fnv32_t fn static int shm_remove(char *path, Fnv32_t fnv, struct ucred *ucred); static int shm_dotruncate_locked(struct shmfd *shmfd, off_t length, void *rl_cookie); +static int shm_copyin_path(struct thread *td, const char *userpath_in, + char **path_out); static fo_rdwr_t shm_read; static fo_rdwr_t shm_write; @@ -422,6 +424,44 @@ shm_close(struct file *fp, struct thread *td) } static int +shm_copyin_path(struct thread *td, const char *userpath_in, char **path_out) { + int error; + char *path; + const char *pr_path; + size_t pr_pathlen; + + path = malloc(MAXPATHLEN, M_SHMFD, M_WAITOK); + pr_path = td->td_ucred->cr_prison->pr_path; + + /* Construct a full pathname for jailed callers. */ + pr_pathlen = strcmp(pr_path, "/") == + 0 ? 0 : strlcpy(path, pr_path, MAXPATHLEN); + error = copyinstr(userpath_in, path + pr_pathlen, + MAXPATHLEN - pr_pathlen, NULL); + if (error != 0) + goto out; + +#ifdef KTRACE + if (KTRPOINT(curthread, KTR_NAMEI)) + ktrnamei(path); +#endif + + /* Require paths to start with a '/' character. */ + if (path[pr_pathlen] != '/') { + error = EINVAL; + goto out; + } + + *path_out = path; + +out: + if (error != 0) + free(path, M_SHMFD); + + return (error); +} + +static int shm_dotruncate_locked(struct shmfd *shmfd, off_t length, void *rl_cookie) { vm_object_t object; @@ -707,9 +747,7 @@ kern_shm_open(struct thread *td, const char *userpath, struct shmfd *shmfd; struct file *fp; char *path; - const char *pr_path; void *rl_cookie; - size_t pr_pathlen; Fnv32_t fnv; mode_t cmode; int fd, error; @@ -767,25 +805,10 @@ kern_shm_open(struct thread *td, const char *userpath, shmfd = shm_alloc(td->td_ucred, cmode); shmfd->shm_seals = initial_seals; } else { - path = malloc(MAXPATHLEN, M_SHMFD, M_WAITOK); - pr_path = td->td_ucred->cr_prison->pr_path; - - /* Construct a full pathname for jailed callers. */ - pr_pathlen = strcmp(pr_path, "/") == 0 ? 0 - : strlcpy(path, pr_path, MAXPATHLEN); - error = copyinstr(userpath, path + pr_pathlen, - MAXPATHLEN - pr_pathlen, NULL); -#ifdef KTRACE - if (error == 0 && KTRPOINT(curthread, KTR_NAMEI)) - ktrnamei(path); -#endif - /* Require paths to start with a '/' character. */ - if (error == 0 && path[pr_pathlen] != '/') - error = EINVAL; - if (error) { + error = shm_copyin_path(td, userpath, &path); + if (error != 0) { fdclose(td, fp, fd); fdrop(fp, td); - free(path, M_SHMFD); return (error); } @@ -918,25 +941,13 @@ int sys_shm_unlink(struct thread *td, struct shm_unlink_args *uap) { char *path; - const char *pr_path; - size_t pr_pathlen; Fnv32_t fnv; int error; - path = malloc(MAXPATHLEN, M_TEMP, M_WAITOK); - pr_path = td->td_ucred->cr_prison->pr_path; - pr_pathlen = strcmp(pr_path, "/") == 0 ? 0 - : strlcpy(path, pr_path, MAXPATHLEN); - error = copyinstr(uap->path, path + pr_pathlen, MAXPATHLEN - pr_pathlen, - NULL); - if (error) { - free(path, M_TEMP); + error = shm_copyin_path(td, uap->path, &path); + if (error != 0) return (error); - } -#ifdef KTRACE - if (KTRPOINT(curthread, KTR_NAMEI)) - ktrnamei(path); -#endif + AUDIT_ARG_UPATH1_CANON(path); fnv = fnv_32_str(path, FNV1_32_INIT); sx_xlock(&shm_dict_lock); @@ -958,6 +969,7 @@ sys_shm_rename(struct thread *td, struct shm_rename_ar int flags; flags = uap->flags; + AUDIT_ARG_FFLAGS(flags); /* * Make sure the user passed only valid flags. @@ -981,22 +993,25 @@ sys_shm_rename(struct thread *td, struct shm_rename_ar goto out; } - /* - * Malloc zone M_SHMFD, since this path may end up freed later from - * M_SHMFD if we end up doing an insert. - */ - path_from = malloc(MAXPATHLEN, M_SHMFD, M_WAITOK); - error = copyinstr(uap->path_from, path_from, MAXPATHLEN, NULL); - if (error) + /* Renaming to or from anonymous makes no sense */ + if (uap->path_from == SHM_ANON || uap->path_to == SHM_ANON) { + error = EINVAL; goto out; + } - path_to = malloc(MAXPATHLEN, M_SHMFD, M_WAITOK); - error = copyinstr(uap->path_to, path_to, MAXPATHLEN, NULL); - if (error) + error = shm_copyin_path(td, uap->path_from, &path_from); + if (error != 0) goto out; + error = shm_copyin_path(td, uap->path_to, &path_to); + if (error != 0) + goto out; + + AUDIT_ARG_UPATH1_CANON(path_from); + AUDIT_ARG_UPATH2_CANON(path_to); + /* Rename with from/to equal is a no-op */ - if (strncmp(path_from, path_to, MAXPATHLEN) == 0) + if (strcmp(path_from, path_to) == 0) goto out; fnv_from = fnv_32_str(path_from, FNV1_32_INIT); @@ -1006,16 +1021,14 @@ sys_shm_rename(struct thread *td, struct shm_rename_ar fd_from = shm_lookup(path_from, fnv_from); if (fd_from == NULL) { - sx_xunlock(&shm_dict_lock); error = ENOENT; - goto out; + goto out_locked; } fd_to = shm_lookup(path_to, fnv_to); if ((flags & SHM_RENAME_NOREPLACE) != 0 && fd_to != NULL) { - sx_xunlock(&shm_dict_lock); error = EEXIST; - goto out; + goto out_locked; } /* @@ -1031,10 +1044,9 @@ sys_shm_rename(struct thread *td, struct shm_rename_ar */ KASSERT(error != ENOENT, ("Our shm disappeared during shm_rename: %s", path_from)); - if (error) { + if (error != 0) { shm_drop(fd_from); - sx_xunlock(&shm_dict_lock); - goto out; + goto out_locked; } /* @@ -1057,15 +1069,16 @@ sys_shm_rename(struct thread *td, struct shm_rename_ar * operation. */ error = shm_remove(path_to, fnv_to, td->td_ucred); - if (error && error != ENOENT) { + if (error != 0 && error != ENOENT) { shm_insert(path_from, fnv_from, fd_from); shm_drop(fd_from); /* Don't free path_from now, since the hash references it */ path_from = NULL; - sx_xunlock(&shm_dict_lock); - goto out; + goto out_locked; } + error = 0; + shm_insert(path_to, fnv_to, fd_from); /* Don't free path_to now, since the hash references it */ @@ -1073,30 +1086,24 @@ sys_shm_rename(struct thread *td, struct shm_rename_ar /* We kept a ref when we removed, and incremented again in insert */ shm_drop(fd_from); -#ifdef DEBUG KASSERT(fd_from->shm_refs > 0, ("Expected >0 refs; got: %d\n", fd_from->shm_refs)); -#endif if ((flags & SHM_RENAME_EXCHANGE) != 0 && fd_to != NULL) { shm_insert(path_from, fnv_from, fd_to); path_from = NULL; shm_drop(fd_to); -#ifdef DEBUG KASSERT(fd_to->shm_refs > 0, ("Expected >0 refs; got: %d\n", fd_to->shm_refs)); -#endif } - error = 0; +out_locked: sx_xunlock(&shm_dict_lock); out: - if (path_from != NULL) - free(path_from, M_SHMFD); - if (path_to != NULL) - free(path_to, M_SHMFD); - return(error); + free(path_from, M_SHMFD); + free(path_to, M_SHMFD); + return (error); } int Modified: head/sys/security/audit/audit_bsm.c ============================================================================== --- head/sys/security/audit/audit_bsm.c Mon Nov 18 10:46:55 2019 (r354807) +++ head/sys/security/audit/audit_bsm.c Mon Nov 18 13:31:16 2019 (r354808) @@ -1565,6 +1565,16 @@ kaudit_to_bsm(struct kaudit_record *kar, struct au_rec } break; + /* shm_rename is a non-Posix extension to the Posix shm implementation */ + case AUE_SHMRENAME: + UPATH1_TOKENS; + UPATH2_TOKENS; + if (ARG_IS_VALID(kar, ARG_FFLAGS)) { + tok = au_to_arg32(2, "flags", ar->ar_arg_fflags); + kau_write(rec, tok); + } + break; + /* AUE_SHMOPEN, AUE_SHMUNLINK, AUE_SEMOPEN, AUE_SEMCLOSE * and AUE_SEMUNLINK are Posix IPC */ case AUE_SHMOPEN: Modified: head/sys/sys/mman.h ============================================================================== --- head/sys/sys/mman.h Mon Nov 18 10:46:55 2019 (r354807) +++ head/sys/sys/mman.h Mon Nov 18 13:31:16 2019 (r354808) @@ -118,6 +118,15 @@ #define MAP_ALIGNMENT_SHIFT 24 #define MAP_ALIGNMENT_MASK MAP_ALIGNED(0xff) #define MAP_ALIGNED_SUPER MAP_ALIGNED(1) /* align on a superpage */ + +/* + * Flags provided to shm_rename + */ +/* Don't overwrite dest, if it exists */ +#define SHM_RENAME_NOREPLACE (1 << 0) +/* Atomically swap src and dest */ +#define SHM_RENAME_EXCHANGE (1 << 1) + #endif /* __BSD_VISIBLE */ #if __POSIX_VISIBLE >= 199309 @@ -134,14 +143,6 @@ #define MAP_FAILED ((void *)-1) /* - * Flags provided to shm_rename - */ -/* Don't overwrite dest, if it exists */ -#define SHM_RENAME_NOREPLACE (1 << 0) -/* Atomically swap src and dest */ -#define SHM_RENAME_EXCHANGE (1 << 1) - -/* * msync() flags */ #define MS_SYNC 0x0000 /* msync synchronously */ @@ -321,11 +322,11 @@ int posix_madvise(void *, size_t, int); int mlockall(int); int munlockall(void); int shm_open(const char *, int, mode_t); -int shm_rename(const char *, const char *, int); int shm_unlink(const char *); #endif #if __BSD_VISIBLE int memfd_create(const char *, unsigned int); +int shm_rename(const char *, const char *, int); #endif __END_DECLS Modified: head/sys/sys/sysproto.h ============================================================================== --- head/sys/sys/sysproto.h Mon Nov 18 10:46:55 2019 (r354807) +++ head/sys/sys/sysproto.h Mon Nov 18 13:31:16 2019 (r354808) @@ -3129,7 +3129,7 @@ int freebsd12_shm_open(struct thread *, struct freebsd #define SYS_AUE_copy_file_range AUE_NULL #define SYS_AUE___sysctlbyname AUE_SYSCTL #define SYS_AUE_shm_open2 AUE_SHMOPEN -#define SYS_AUE_shm_rename AUE_NULL +#define SYS_AUE_shm_rename AUE_SHMRENAME #undef PAD_ #undef PADL_ Modified: head/tests/sys/posixshm/posixshm_test.c ============================================================================== --- head/tests/sys/posixshm/posixshm_test.c Mon Nov 18 10:46:55 2019 (r354807) +++ head/tests/sys/posixshm/posixshm_test.c Mon Nov 18 13:31:16 2019 (r354808) @@ -53,7 +53,7 @@ static unsigned int test_path_idx = 0; static void gen_a_test_path(char *path) { - snprintf(path, TEST_PATH_LEN, "%s/tmp.XXXXXX%d", + snprintf(path, TEST_PATH_LEN, "/%s/tmp.XXXXXX%d", getenv("TMPDIR") == NULL ? "/tmp" : getenv("TMPDIR"), test_path_idx); @@ -232,12 +232,14 @@ ATF_TC_BODY(rename_from_nonexisting, tc) int rc; gen_test_path(); + gen_test_path2(); rc = shm_rename(test_path, test_path2, 0); if (rc != -1) atf_tc_fail("shm_rename of nonexisting shm succeeded unexpectedly"); if (errno != ENOENT) - atf_tc_fail("Expected ENOENT to rename of nonexistent shm"); + atf_tc_fail("Expected ENOENT to rename of nonexistent shm; got %d", + errno); } ATF_TC_WITHOUT_HEAD(rename_to_anon); From owner-svn-src-all@freebsd.org Mon Nov 18 13:34:27 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id EC8F31C01B2; Mon, 18 Nov 2019 13:34:27 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47GqgR62B7z3LG8; Mon, 18 Nov 2019 13:34:27 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id B3C062AAE4; Mon, 18 Nov 2019 13:34:27 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xAIDYRsV068544; Mon, 18 Nov 2019 13:34:27 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xAIDYRPn068543; Mon, 18 Nov 2019 13:34:27 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201911181334.xAIDYRPn068543@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Mon, 18 Nov 2019 13:34:27 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r354809 - in stable/12/sys/amd64: amd64 include X-SVN-Group: stable-12 X-SVN-Commit-Author: kib X-SVN-Commit-Paths: in stable/12/sys/amd64: amd64 include X-SVN-Commit-Revision: 354809 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 18 Nov 2019 13:34:28 -0000 Author: kib Date: Mon Nov 18 13:34:27 2019 New Revision: 354809 URL: https://svnweb.freebsd.org/changeset/base/354809 Log: MFC r354592: amd64: change r_gdt to the local variable in hammer_time(). Modified: stable/12/sys/amd64/amd64/machdep.c stable/12/sys/amd64/include/segments.h Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/amd64/amd64/machdep.c ============================================================================== --- stable/12/sys/amd64/amd64/machdep.c Mon Nov 18 13:31:16 2019 (r354808) +++ stable/12/sys/amd64/amd64/machdep.c Mon Nov 18 13:34:27 2019 (r354809) @@ -228,7 +228,7 @@ vm_paddr_t dump_avail[PHYSMAP_SIZE + 2]; struct kva_md_info kmi; static struct trapframe proc0_tf; -struct region_descriptor r_gdt, r_idt; +struct region_descriptor r_idt; struct pcpu *__pcpu; struct pcpu temp_bsp_pcpu; @@ -1625,6 +1625,7 @@ hammer_time(u_int64_t modulep, u_int64_t physfree) struct xstate_hdr *xhdr; u_int64_t rsp0; char *env; + struct region_descriptor r_gdt; size_t kstack0_sz; int late_console; Modified: stable/12/sys/amd64/include/segments.h ============================================================================== --- stable/12/sys/amd64/include/segments.h Mon Nov 18 13:31:16 2019 (r354808) +++ stable/12/sys/amd64/include/segments.h Mon Nov 18 13:34:27 2019 (r354809) @@ -92,7 +92,7 @@ struct region_descriptor { extern struct user_segment_descriptor gdt[]; extern struct soft_segment_descriptor gdt_segs[]; extern struct gate_descriptor *idt; -extern struct region_descriptor r_gdt, r_idt; +extern struct region_descriptor r_idt; void lgdt(struct region_descriptor *rdp); void sdtossd(struct user_segment_descriptor *sdp, From owner-svn-src-all@freebsd.org Mon Nov 18 13:37:14 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 33DF21C02FF; Mon, 18 Nov 2019 13:37:14 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47Gqkf0gc2z3Nmv; Mon, 18 Nov 2019 13:37:14 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id D352B2AAE5; Mon, 18 Nov 2019 13:37:13 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xAIDbDZT068729; Mon, 18 Nov 2019 13:37:13 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xAIDbDVn068728; Mon, 18 Nov 2019 13:37:13 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201911181337.xAIDbDVn068728@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Mon, 18 Nov 2019 13:37:13 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r354810 - stable/12/sys/amd64/amd64 X-SVN-Group: stable-12 X-SVN-Commit-Author: kib X-SVN-Commit-Paths: stable/12/sys/amd64/amd64 X-SVN-Commit-Revision: 354810 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 18 Nov 2019 13:37:14 -0000 Author: kib Date: Mon Nov 18 13:37:13 2019 New Revision: 354810 URL: https://svnweb.freebsd.org/changeset/base/354810 Log: MFC r354591: amd64: Change SFENCE to locked op for synchronizing with CLFLUSHOPT on Intel. Modified: stable/12/sys/amd64/amd64/pmap.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/amd64/amd64/pmap.c ============================================================================== --- stable/12/sys/amd64/amd64/pmap.c Mon Nov 18 13:34:27 2019 (r354809) +++ stable/12/sys/amd64/amd64/pmap.c Mon Nov 18 13:37:13 2019 (r354810) @@ -2938,16 +2938,16 @@ pmap_force_invalidate_cache_range(vm_offset_t sva, vm_ if ((cpu_stdext_feature & CPUID_STDEXT_CLFLUSHOPT) != 0) { /* - * Do per-cache line flush. Use the sfence + * Do per-cache line flush. Use a locked * instruction to insure that previous stores are * included in the write-back. The processor * propagates flush to other processors in the cache * coherence domain. */ - sfence(); + atomic_thread_fence_seq_cst(); for (; sva < eva; sva += cpu_clflush_line_size) clflushopt(sva); - sfence(); + atomic_thread_fence_seq_cst(); } else { /* * Writes are ordered by CLFLUSH on Intel CPUs. @@ -2989,7 +2989,7 @@ pmap_invalidate_cache_pages(vm_page_t *pages, int coun pmap_invalidate_cache(); else { if (useclflushopt) - sfence(); + atomic_thread_fence_seq_cst(); else if (cpu_vendor_id != CPU_VENDOR_INTEL) mfence(); for (i = 0; i < count; i++) { @@ -3003,7 +3003,7 @@ pmap_invalidate_cache_pages(vm_page_t *pages, int coun } } if (useclflushopt) - sfence(); + atomic_thread_fence_seq_cst(); else if (cpu_vendor_id != CPU_VENDOR_INTEL) mfence(); } @@ -3024,10 +3024,10 @@ pmap_flush_cache_range(vm_offset_t sva, vm_offset_t ev if (pmap_kextract(sva) == lapic_paddr) return; - sfence(); + atomic_thread_fence_seq_cst(); for (; sva < eva; sva += cpu_clflush_line_size) clwb(sva); - sfence(); + atomic_thread_fence_seq_cst(); } void @@ -3060,7 +3060,7 @@ pmap_flush_cache_phys_range(vm_paddr_t spa, vm_paddr_t sched_pin(); pte_store(pte, spa | pte_bits); invlpg(vaddr); - /* XXXKIB sfences inside flush_cache_range are excessive */ + /* XXXKIB atomic inside flush_cache_range are excessive */ pmap_flush_cache_range(vaddr, vaddr + PAGE_SIZE); sched_unpin(); } @@ -9286,10 +9286,10 @@ pmap_large_map_wb_fence_mfence(void) } static void -pmap_large_map_wb_fence_sfence(void) +pmap_large_map_wb_fence_atomic(void) { - sfence(); + atomic_thread_fence_seq_cst(); } static void @@ -9304,7 +9304,7 @@ DEFINE_IFUNC(static, void, pmap_large_map_wb_fence, (v return (pmap_large_map_wb_fence_mfence); else if ((cpu_stdext_feature & (CPUID_STDEXT_CLWB | CPUID_STDEXT_CLFLUSHOPT)) == 0) - return (pmap_large_map_wb_fence_sfence); + return (pmap_large_map_wb_fence_atomic); else /* clflush is strongly enough ordered */ return (pmap_large_map_wb_fence_nop); From owner-svn-src-all@freebsd.org Mon Nov 18 13:38:36 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id DDCEF1C03E5; Mon, 18 Nov 2019 13:38:36 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47GqmD28fvz3Q5v; Mon, 18 Nov 2019 13:38:36 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id E4D972AAEA; Mon, 18 Nov 2019 13:38:35 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xAIDcZLN068842; Mon, 18 Nov 2019 13:38:35 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xAIDcZ5M068841; Mon, 18 Nov 2019 13:38:35 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201911181338.xAIDcZ5M068841@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Mon, 18 Nov 2019 13:38:35 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r354811 - stable/12/sys/amd64/amd64 X-SVN-Group: stable-12 X-SVN-Commit-Author: kib X-SVN-Commit-Paths: stable/12/sys/amd64/amd64 X-SVN-Commit-Revision: 354811 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 18 Nov 2019 13:38:37 -0000 Author: kib Date: Mon Nov 18 13:38:35 2019 New Revision: 354811 URL: https://svnweb.freebsd.org/changeset/base/354811 Log: MFC r354630: amd64: Issue MFENCE on context switch on AMD CPUs when reusing address space. Modified: stable/12/sys/amd64/amd64/pmap.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/amd64/amd64/pmap.c ============================================================================== --- stable/12/sys/amd64/amd64/pmap.c Mon Nov 18 13:37:13 2019 (r354810) +++ stable/12/sys/amd64/amd64/pmap.c Mon Nov 18 13:38:35 2019 (r354811) @@ -8592,8 +8592,11 @@ pmap_activate_sw(struct thread *td) oldpmap = PCPU_GET(curpmap); pmap = vmspace_pmap(td->td_proc->p_vmspace); - if (oldpmap == pmap) + if (oldpmap == pmap) { + if (cpu_vendor_id != CPU_VENDOR_INTEL) + mfence(); return; + } cpuid = PCPU_GET(cpuid); #ifdef SMP CPU_SET_ATOMIC(cpuid, &pmap->pm_active); From owner-svn-src-all@freebsd.org Mon Nov 18 14:12:34 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 648441C0F05; Mon, 18 Nov 2019 14:12:34 +0000 (UTC) (envelope-from asomers@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47GrWQ240Wz4VZS; Mon, 18 Nov 2019 14:12:34 +0000 (UTC) (envelope-from asomers@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 29E872B207; Mon, 18 Nov 2019 14:12:34 +0000 (UTC) (envelope-from asomers@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xAIECYi1091992; Mon, 18 Nov 2019 14:12:34 GMT (envelope-from asomers@FreeBSD.org) Received: (from asomers@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xAIECY4D091991; Mon, 18 Nov 2019 14:12:34 GMT (envelope-from asomers@FreeBSD.org) Message-Id: <201911181412.xAIECY4D091991@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: asomers set sender to asomers@FreeBSD.org using -f From: Alan Somers Date: Mon, 18 Nov 2019 14:12:34 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354812 - head/share/man/man4 X-SVN-Group: head X-SVN-Commit-Author: asomers X-SVN-Commit-Paths: head/share/man/man4 X-SVN-Commit-Revision: 354812 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 18 Nov 2019 14:12:34 -0000 Author: asomers Date: Mon Nov 18 14:12:33 2019 New Revision: 354812 URL: https://svnweb.freebsd.org/changeset/base/354812 Log: Update the ses(4) man page This driver was largely rewritten in 2015 (svn r235911) but the man page was never updated to match. Reviewed by: trasz MFC after: 2 weeks Sponsored by: Axcient Differential Revision: https://reviews.freebsd.org/D22339 Modified: head/share/man/man4/ses.4 Modified: head/share/man/man4/ses.4 ============================================================================== --- head/share/man/man4/ses.4 Mon Nov 18 13:38:35 2019 (r354811) +++ head/share/man/man4/ses.4 Mon Nov 18 14:12:33 2019 (r354812) @@ -25,7 +25,7 @@ .\" .\" $FreeBSD$ .\" -.Dd September 5, 2015 +.Dd November 12, 2019 .Dt SES 4 .Os .Sh NAME @@ -77,33 +77,47 @@ calls apply to .Nm devices. They are defined in the header file -.In cam/scsi/scsi_ses.h +.In cam/scsi/scsi_enc.h (\fIq.v.\fR). -.Bl -tag -width SESIOC_GETENCSTAT -.It Dv SESIOC_GETNOBJ +.Bl -tag -width ENCIOC_GETENCSTAT +.It Dv ENCIOC_GETNELM Used to find out how many .Nm -objects are driven by this particular device instance. -.It Dv SESIOC_GETOBJMAP -Read, from the kernel, an array of SES objects which contains -the object identifier, which subenclosure it is in, and the +elements are driven by this particular device instance. +.It Dv ENCIOC_GETELMMAP +Read, from the kernel, an array of SES elements which contains +the element identifier, which subenclosure it is in, and the .Nm -type of the object. -.It Dv SESIOC_GETENCSTAT +type of the element. +.It Dv ENCIOC_GETENCSTAT Get the overall enclosure status. -.It Dv SESIOC_SETENCSTAT +.It Dv ENCIOC_SETENCSTAT Set the overall enclosure status. -.It Dv SESIOC_GETOBJSTAT -Get the status of a particular object. -.It Dv SESIOC_SETOBJSTAT -Set the status of a particular object. -.It Dv SESIOC_GETTEXT -Get the associated help text for an object (not yet implemented). +.It Dv ENCIOC_GETELMSTAT +Get the status of a particular element. +.It Dv ENCIOC_SETELMSTAT +Set the status of a particular element. +.It Dv ENCIOC_GETTEXT +Get the associated help text for an element (not yet implemented). .Nm -devices often have descriptive text for an object which can tell +devices often have descriptive text for an element which can tell you things like location (e.g., "left power supply"). -.It Dv SESIOC_INIT +.It Dv ENCIOC_INIT Initialize the enclosure. +.It Dv ENCIOC_GETELMDESC +Get the element's descriptor string. +.It Dv ENCIOC_GETELMDEVNAMES +Get the device names, if any, associated with this element. +.It Dv ENCIOC_GETSTRING +Used to read the SES String In Diagnostic Page. +The contents of this page are device-specific. +.It Dv ENCIOC_SETSTRING +Used to set the SES String Out Diagnostic Page. +The contents of this page are device-specific. +.It Dv ENCIOC_GETENCNAME +Used to get the name of the enclosure. +.It Dv ENCIOC_GETENCID +Used to get the Enclosure Logical Identifier. .El .Sh EXAMPLE USAGE The files contained in @@ -128,9 +142,12 @@ parameters to the console. .Sh HISTORY The .Nm -driver was written for the +driver was originally written for the .Tn CAM .Tn SCSI -subsystem by Matthew Jacob. -This is a functional equivalent of a similar +subsystem by Matthew Jacob and first released in +.Fx 4.3 . +It was a functional equivalent of a similar driver available in Solaris, Release 7. +It was largely rewritten by Alexander Motin, Justin Gibbs, and Will Andrews for +.Fx 9.2 . From owner-svn-src-all@freebsd.org Mon Nov 18 15:27:53 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id F3C451C24D9; Mon, 18 Nov 2019 15:27:52 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47GtBJ4RC7z3Mdp; Mon, 18 Nov 2019 15:27:52 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 75DDB2BE72; Mon, 18 Nov 2019 15:27:52 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xAIFRq1a033654; Mon, 18 Nov 2019 15:27:52 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xAIFRqJD033653; Mon, 18 Nov 2019 15:27:52 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201911181527.xAIFRqJD033653@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Mon, 18 Nov 2019 15:27:52 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r354813 - stable/12/sys/kern X-SVN-Group: stable-12 X-SVN-Commit-Author: markj X-SVN-Commit-Paths: stable/12/sys/kern X-SVN-Commit-Revision: 354813 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 18 Nov 2019 15:27:53 -0000 Author: markj Date: Mon Nov 18 15:27:52 2019 New Revision: 354813 URL: https://svnweb.freebsd.org/changeset/base/354813 Log: MFC r354629: Fix handling of PIPE_EOF in the direct write path. Modified: stable/12/sys/kern/sys_pipe.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/kern/sys_pipe.c ============================================================================== --- stable/12/sys/kern/sys_pipe.c Mon Nov 18 14:12:33 2019 (r354812) +++ stable/12/sys/kern/sys_pipe.c Mon Nov 18 15:27:52 2019 (r354813) @@ -972,15 +972,8 @@ retry: goto error1; } - while (wpipe->pipe_map.cnt != 0) { - if (wpipe->pipe_state & PIPE_EOF) { - wpipe->pipe_map.cnt = 0; - pipe_destroy_write_buffer(wpipe); - pipeselwakeup(wpipe); - pipeunlock(wpipe); - error = EPIPE; - goto error1; - } + while (wpipe->pipe_map.cnt != 0 && + (wpipe->pipe_state & PIPE_EOF) == 0) { if (wpipe->pipe_state & PIPE_WANTR) { wpipe->pipe_state &= ~PIPE_WANTR; wakeup(wpipe); @@ -995,12 +988,16 @@ retry: break; } - if (wpipe->pipe_state & PIPE_EOF) + if ((wpipe->pipe_state & PIPE_EOF) != 0) { + wpipe->pipe_map.cnt = 0; + pipe_destroy_write_buffer(wpipe); + pipeselwakeup(wpipe); error = EPIPE; - if (error == EINTR || error == ERESTART) + } else if (error == EINTR || error == ERESTART) { pipe_clone_write_buffer(wpipe); - else + } else { pipe_destroy_write_buffer(wpipe); + } pipeunlock(wpipe); KASSERT((wpipe->pipe_state & PIPE_DIRECTW) == 0, ("pipe %p leaked PIPE_DIRECTW", wpipe)); From owner-svn-src-all@freebsd.org Mon Nov 18 15:28:12 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 539171C2534; Mon, 18 Nov 2019 15:28:12 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47GtBh05WBz3NPW; Mon, 18 Nov 2019 15:28:11 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 7AB5F2BE73; Mon, 18 Nov 2019 15:28:11 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xAIFSBxt033732; Mon, 18 Nov 2019 15:28:11 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xAIFSBES033730; Mon, 18 Nov 2019 15:28:11 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201911181528.xAIFSBES033730@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Mon, 18 Nov 2019 15:28:11 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r354814 - in stable/12/sys/amd64: amd64 include X-SVN-Group: stable-12 X-SVN-Commit-Author: markj X-SVN-Commit-Paths: in stable/12/sys/amd64: amd64 include X-SVN-Commit-Revision: 354814 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 18 Nov 2019 15:28:12 -0000 Author: markj Date: Mon Nov 18 15:28:10 2019 New Revision: 354814 URL: https://svnweb.freebsd.org/changeset/base/354814 Log: MFC r353672: Introduce pmap_change_prot() for amd64. Modified: stable/12/sys/amd64/amd64/pmap.c stable/12/sys/amd64/include/pmap.h Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/amd64/amd64/pmap.c ============================================================================== --- stable/12/sys/amd64/amd64/pmap.c Mon Nov 18 15:27:52 2019 (r354813) +++ stable/12/sys/amd64/amd64/pmap.c Mon Nov 18 15:28:10 2019 (r354814) @@ -1105,10 +1105,11 @@ static caddr_t crashdumpmap; /* * Internal flags for pmap_mapdev_internal() and - * pmap_change_attr_locked(). + * pmap_change_props_locked(). */ -#define MAPDEV_FLUSHCACHE 0x0000001 /* Flush cache after mapping. */ -#define MAPDEV_SETATTR 0x0000002 /* Modify existing attrs. */ +#define MAPDEV_FLUSHCACHE 0x00000001 /* Flush cache after mapping. */ +#define MAPDEV_SETATTR 0x00000002 /* Modify existing attrs. */ +#define MAPDEV_ASSERTVALID 0x00000004 /* Assert mapping validity. */ static void free_pv_chunk(struct pv_chunk *pc); static void free_pv_entry(pmap_t pmap, pv_entry_t pv); @@ -1129,8 +1130,8 @@ static void pmap_pvh_free(struct md_page *pvh, pmap_t static pv_entry_t pmap_pvh_remove(struct md_page *pvh, pmap_t pmap, vm_offset_t va); -static int pmap_change_attr_locked(vm_offset_t va, vm_size_t size, int mode, - int flags); +static int pmap_change_props_locked(vm_offset_t va, vm_size_t size, + vm_prot_t prot, int mode, int flags); static boolean_t pmap_demote_pde(pmap_t pmap, pd_entry_t *pde, vm_offset_t va); static boolean_t pmap_demote_pde_locked(pmap_t pmap, pd_entry_t *pde, vm_offset_t va, struct rwlock **lockp); @@ -1153,14 +1154,13 @@ static void pmap_invalidate_pde_page(pmap_t pmap, vm_o static void pmap_kenter_attr(vm_offset_t va, vm_paddr_t pa, int mode); static vm_page_t pmap_large_map_getptp_unlocked(void); static vm_paddr_t pmap_large_map_kextract(vm_offset_t va); -static void pmap_pde_attr(pd_entry_t *pde, int cache_bits, int mask); #if VM_NRESERVLEVEL > 0 static void pmap_promote_pde(pmap_t pmap, pd_entry_t *pde, vm_offset_t va, struct rwlock **lockp); #endif static boolean_t pmap_protect_pde(pmap_t pmap, pd_entry_t *pde, vm_offset_t sva, vm_prot_t prot); -static void pmap_pte_attr(pt_entry_t *pte, int cache_bits, int mask); +static void pmap_pte_props(pt_entry_t *pte, u_long bits, u_long mask); static void pmap_pti_add_kva_locked(vm_offset_t sva, vm_offset_t eva, bool exec); static pdp_entry_t *pmap_pti_pdpe(vm_offset_t va); @@ -7797,40 +7797,20 @@ restart: * Miscellaneous support routines follow */ -/* Adjust the cache mode for a 4KB page mapped via a PTE. */ +/* Adjust the properties for a leaf page table entry. */ static __inline void -pmap_pte_attr(pt_entry_t *pte, int cache_bits, int mask) +pmap_pte_props(pt_entry_t *pte, u_long bits, u_long mask) { - u_int opte, npte; + u_long opte, npte; - /* - * The cache mode bits are all in the low 32-bits of the - * PTE, so we can just spin on updating the low 32-bits. - */ + opte = *(u_long *)pte; do { - opte = *(u_int *)pte; npte = opte & ~mask; - npte |= cache_bits; - } while (npte != opte && !atomic_cmpset_int((u_int *)pte, opte, npte)); + npte |= bits; + } while (npte != opte && !atomic_fcmpset_long((u_long *)pte, &opte, + npte)); } -/* Adjust the cache mode for a 2MB page mapped via a PDE. */ -static __inline void -pmap_pde_attr(pd_entry_t *pde, int cache_bits, int mask) -{ - u_int opde, npde; - - /* - * The cache mode bits are all in the low 32-bits of the - * PDE, so we can just spin on updating the low 32-bits. - */ - do { - opde = *(u_int *)pde; - npde = opde & ~mask; - npde |= cache_bits; - } while (npde != opde && !atomic_cmpset_int((u_int *)pde, opde, npde)); -} - /* * Map a set of physical memory pages into the kernel virtual * address space. Return a pointer to where it is mapped. This @@ -7884,7 +7864,8 @@ pmap_mapdev_internal(vm_paddr_t pa, vm_size_t size, in va = PHYS_TO_DMAP(pa); if ((flags & MAPDEV_SETATTR) != 0) { PMAP_LOCK(kernel_pmap); - i = pmap_change_attr_locked(va, size, mode, flags); + i = pmap_change_props_locked(va, size, + PROT_NONE, mode, flags); PMAP_UNLOCK(kernel_pmap); } else i = 0; @@ -8070,21 +8051,46 @@ pmap_change_attr(vm_offset_t va, vm_size_t size, int m int error; PMAP_LOCK(kernel_pmap); - error = pmap_change_attr_locked(va, size, mode, MAPDEV_FLUSHCACHE); + error = pmap_change_props_locked(va, size, PROT_NONE, mode, + MAPDEV_FLUSHCACHE); PMAP_UNLOCK(kernel_pmap); return (error); } +/* + * Changes the specified virtual address range's protections to those + * specified by "prot". Like pmap_change_attr(), protections for aliases + * in the direct map are updated as well. Protections on aliasing mappings may + * be a subset of the requested protections; for example, mappings in the direct + * map are never executable. + */ +int +pmap_change_prot(vm_offset_t va, vm_size_t size, vm_prot_t prot) +{ + int error; + + /* Only supported within the kernel map. */ + if (va < VM_MIN_KERNEL_ADDRESS) + return (EINVAL); + + PMAP_LOCK(kernel_pmap); + error = pmap_change_props_locked(va, size, prot, -1, + MAPDEV_ASSERTVALID); + PMAP_UNLOCK(kernel_pmap); + return (error); +} + static int -pmap_change_attr_locked(vm_offset_t va, vm_size_t size, int mode, int flags) +pmap_change_props_locked(vm_offset_t va, vm_size_t size, vm_prot_t prot, + int mode, int flags) { vm_offset_t base, offset, tmpva; vm_paddr_t pa_start, pa_end, pa_end1; pdp_entry_t *pdpe; - pd_entry_t *pde; - pt_entry_t *pte; - int cache_bits_pte, cache_bits_pde, error; - boolean_t changed; + pd_entry_t *pde, pde_bits, pde_mask; + pt_entry_t *pte, pte_bits, pte_mask; + int error; + bool changed; PMAP_LOCK_ASSERT(kernel_pmap, MA_OWNED); base = trunc_page(va); @@ -8098,9 +8104,33 @@ pmap_change_attr_locked(vm_offset_t va, vm_size_t size if (base < DMAP_MIN_ADDRESS) return (EINVAL); - cache_bits_pde = pmap_cache_bits(kernel_pmap, mode, 1); - cache_bits_pte = pmap_cache_bits(kernel_pmap, mode, 0); - changed = FALSE; + /* + * Construct our flag sets and masks. "bits" is the subset of + * "mask" that will be set in each modified PTE. + * + * Mappings in the direct map are never allowed to be executable. + */ + pde_bits = pte_bits = 0; + pde_mask = pte_mask = 0; + if (mode != -1) { + pde_bits |= pmap_cache_bits(kernel_pmap, mode, true); + pde_mask |= X86_PG_PDE_CACHE; + pte_bits |= pmap_cache_bits(kernel_pmap, mode, false); + pte_mask |= X86_PG_PTE_CACHE; + } + if (prot != VM_PROT_NONE) { + if ((prot & VM_PROT_WRITE) != 0) { + pde_bits |= X86_PG_RW; + pte_bits |= X86_PG_RW; + } + if ((prot & VM_PROT_EXECUTE) == 0 || + va < VM_MIN_KERNEL_ADDRESS) { + pde_bits |= pg_nx; + pte_bits |= pg_nx; + } + pde_mask |= X86_PG_RW | pg_nx; + pte_mask |= X86_PG_RW | pg_nx; + } /* * Pages that aren't mapped aren't supported. Also break down 2MB pages @@ -8108,15 +8138,18 @@ pmap_change_attr_locked(vm_offset_t va, vm_size_t size */ for (tmpva = base; tmpva < base + size; ) { pdpe = pmap_pdpe(kernel_pmap, tmpva); - if (pdpe == NULL || *pdpe == 0) + if (pdpe == NULL || *pdpe == 0) { + KASSERT((flags & MAPDEV_ASSERTVALID) == 0, + ("%s: addr %#lx is not mapped", __func__, tmpva)); return (EINVAL); + } if (*pdpe & PG_PS) { /* * If the current 1GB page already has the required - * memory type, then we need not demote this page. Just + * properties, then we need not demote this page. Just * increment tmpva to the next 1GB page frame. */ - if ((*pdpe & X86_PG_PDE_CACHE) == cache_bits_pde) { + if ((*pdpe & pde_mask) == pde_bits) { tmpva = trunc_1gpage(tmpva) + NBPDP; continue; } @@ -8135,15 +8168,18 @@ pmap_change_attr_locked(vm_offset_t va, vm_size_t size return (ENOMEM); } pde = pmap_pdpe_to_pde(pdpe, tmpva); - if (*pde == 0) + if (*pde == 0) { + KASSERT((flags & MAPDEV_ASSERTVALID) == 0, + ("%s: addr %#lx is not mapped", __func__, tmpva)); return (EINVAL); + } if (*pde & PG_PS) { /* * If the current 2MB page already has the required - * memory type, then we need not demote this page. Just + * properties, then we need not demote this page. Just * increment tmpva to the next 2MB page frame. */ - if ((*pde & X86_PG_PDE_CACHE) == cache_bits_pde) { + if ((*pde & pde_mask) == pde_bits) { tmpva = trunc_2mpage(tmpva) + NBPDR; continue; } @@ -8162,24 +8198,27 @@ pmap_change_attr_locked(vm_offset_t va, vm_size_t size return (ENOMEM); } pte = pmap_pde_to_pte(pde, tmpva); - if (*pte == 0) + if (*pte == 0) { + KASSERT((flags & MAPDEV_ASSERTVALID) == 0, + ("%s: addr %#lx is not mapped", __func__, tmpva)); return (EINVAL); + } tmpva += PAGE_SIZE; } error = 0; /* * Ok, all the pages exist, so run through them updating their - * cache mode if required. + * properties if required. */ + changed = false; pa_start = pa_end = 0; for (tmpva = base; tmpva < base + size; ) { pdpe = pmap_pdpe(kernel_pmap, tmpva); if (*pdpe & PG_PS) { - if ((*pdpe & X86_PG_PDE_CACHE) != cache_bits_pde) { - pmap_pde_attr(pdpe, cache_bits_pde, - X86_PG_PDE_CACHE); - changed = TRUE; + if ((*pdpe & pde_mask) != pde_bits) { + pmap_pte_props(pdpe, pde_bits, pde_mask); + changed = true; } if (tmpva >= VM_MIN_KERNEL_ADDRESS && (*pdpe & PG_PS_FRAME) < dmaplimit) { @@ -8191,9 +8230,10 @@ pmap_change_attr_locked(vm_offset_t va, vm_size_t size pa_end += NBPDP; else { /* Run ended, update direct map. */ - error = pmap_change_attr_locked( + error = pmap_change_props_locked( PHYS_TO_DMAP(pa_start), - pa_end - pa_start, mode, flags); + pa_end - pa_start, prot, mode, + flags); if (error != 0) break; /* Start physical address run. */ @@ -8206,10 +8246,9 @@ pmap_change_attr_locked(vm_offset_t va, vm_size_t size } pde = pmap_pdpe_to_pde(pdpe, tmpva); if (*pde & PG_PS) { - if ((*pde & X86_PG_PDE_CACHE) != cache_bits_pde) { - pmap_pde_attr(pde, cache_bits_pde, - X86_PG_PDE_CACHE); - changed = TRUE; + if ((*pde & pde_mask) != pde_bits) { + pmap_pte_props(pde, pde_bits, pde_mask); + changed = true; } if (tmpva >= VM_MIN_KERNEL_ADDRESS && (*pde & PG_PS_FRAME) < dmaplimit) { @@ -8221,9 +8260,10 @@ pmap_change_attr_locked(vm_offset_t va, vm_size_t size pa_end += NBPDR; else { /* Run ended, update direct map. */ - error = pmap_change_attr_locked( + error = pmap_change_props_locked( PHYS_TO_DMAP(pa_start), - pa_end - pa_start, mode, flags); + pa_end - pa_start, prot, mode, + flags); if (error != 0) break; /* Start physical address run. */ @@ -8234,10 +8274,9 @@ pmap_change_attr_locked(vm_offset_t va, vm_size_t size tmpva = trunc_2mpage(tmpva) + NBPDR; } else { pte = pmap_pde_to_pte(pde, tmpva); - if ((*pte & X86_PG_PTE_CACHE) != cache_bits_pte) { - pmap_pte_attr(pte, cache_bits_pte, - X86_PG_PTE_CACHE); - changed = TRUE; + if ((*pte & pte_mask) != pte_bits) { + pmap_pte_props(pte, pte_bits, pte_mask); + changed = true; } if (tmpva >= VM_MIN_KERNEL_ADDRESS && (*pte & PG_FRAME) < dmaplimit) { @@ -8249,9 +8288,10 @@ pmap_change_attr_locked(vm_offset_t va, vm_size_t size pa_end += PAGE_SIZE; else { /* Run ended, update direct map. */ - error = pmap_change_attr_locked( + error = pmap_change_props_locked( PHYS_TO_DMAP(pa_start), - pa_end - pa_start, mode, flags); + pa_end - pa_start, prot, mode, + flags); if (error != 0) break; /* Start physical address run. */ @@ -8265,8 +8305,8 @@ pmap_change_attr_locked(vm_offset_t va, vm_size_t size if (error == 0 && pa_start != pa_end && pa_start < dmaplimit) { pa_end1 = MIN(pa_end, dmaplimit); if (pa_start != pa_end1) - error = pmap_change_attr_locked(PHYS_TO_DMAP(pa_start), - pa_end1 - pa_start, mode, flags); + error = pmap_change_props_locked(PHYS_TO_DMAP(pa_start), + pa_end1 - pa_start, prot, mode, flags); } /* Modified: stable/12/sys/amd64/include/pmap.h ============================================================================== --- stable/12/sys/amd64/include/pmap.h Mon Nov 18 15:27:52 2019 (r354813) +++ stable/12/sys/amd64/include/pmap.h Mon Nov 18 15:28:10 2019 (r354814) @@ -428,6 +428,7 @@ void pmap_allow_2m_x_ept_recalculate(void); void pmap_bootstrap(vm_paddr_t *); int pmap_cache_bits(pmap_t pmap, int mode, boolean_t is_pde); int pmap_change_attr(vm_offset_t, vm_size_t, int); +int pmap_change_prot(vm_offset_t, vm_size_t, vm_prot_t); void pmap_demote_DMAP(vm_paddr_t base, vm_size_t len, boolean_t invalidate); void pmap_flush_cache_range(vm_offset_t, vm_offset_t); void pmap_flush_cache_phys_range(vm_paddr_t, vm_paddr_t, vm_memattr_t); From owner-svn-src-all@freebsd.org Mon Nov 18 15:36:47 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 088B31C2855; Mon, 18 Nov 2019 15:36:47 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47GtNZ6Ht3z4GLg; Mon, 18 Nov 2019 15:36:46 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id B6AB12C03F; Mon, 18 Nov 2019 15:36:46 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xAIFakeM039810; Mon, 18 Nov 2019 15:36:46 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xAIFak2S039809; Mon, 18 Nov 2019 15:36:46 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201911181536.xAIFak2S039809@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Mon, 18 Nov 2019 15:36:46 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354815 - head/sys/arm64/arm64 X-SVN-Group: head X-SVN-Commit-Author: markj X-SVN-Commit-Paths: head/sys/arm64/arm64 X-SVN-Commit-Revision: 354815 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 18 Nov 2019 15:36:47 -0000 Author: markj Date: Mon Nov 18 15:36:46 2019 New Revision: 354815 URL: https://svnweb.freebsd.org/changeset/base/354815 Log: Let arm64 pmap_qenter() and pmap_kenter() unconditionally set NX. As on amd64, there is no need for mappings created by these functions to be executable. Reviewed by: alc, andrew MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D22141 Modified: head/sys/arm64/arm64/pmap.c Modified: head/sys/arm64/arm64/pmap.c ============================================================================== --- head/sys/arm64/arm64/pmap.c Mon Nov 18 15:28:10 2019 (r354814) +++ head/sys/arm64/arm64/pmap.c Mon Nov 18 15:36:46 2019 (r354815) @@ -1257,12 +1257,8 @@ pmap_kenter(vm_offset_t sva, vm_size_t size, vm_paddr_ KASSERT((size & PAGE_MASK) == 0, ("pmap_kenter: Mapping is not page-sized")); - attr = ATTR_DEFAULT | ATTR_IDX(mode) | L3_PAGE; - if (mode == DEVICE_MEMORY) - attr |= ATTR_XN; - else - attr |= ATTR_UXN; - + attr = ATTR_DEFAULT | ATTR_AP(ATTR_AP_RW) | ATTR_XN | ATTR_IDX(mode) | + L3_PAGE; va = sva; while (size != 0) { pde = pmap_pde(kernel_pmap, va, &lvl); @@ -1377,9 +1373,7 @@ pmap_qenter(vm_offset_t sva, vm_page_t *ma, int count) m = ma[i]; pa = VM_PAGE_TO_PHYS(m) | ATTR_DEFAULT | ATTR_AP(ATTR_AP_RW) | - ATTR_UXN | ATTR_IDX(m->md.pv_memattr) | L3_PAGE; - if (m->md.pv_memattr == DEVICE_MEMORY) - pa |= ATTR_XN; + ATTR_XN | ATTR_IDX(m->md.pv_memattr) | L3_PAGE; pte = pmap_l2_to_l3(pde, va); pmap_load_store(pte, pa); From owner-svn-src-all@freebsd.org Mon Nov 18 15:37:02 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 74A4C1C28A5; Mon, 18 Nov 2019 15:37:02 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47GtNt1kckz4GvX; Mon, 18 Nov 2019 15:37:02 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 068542C040; Mon, 18 Nov 2019 15:37:02 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xAIFb1ts039865; Mon, 18 Nov 2019 15:37:01 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xAIFb1gh039864; Mon, 18 Nov 2019 15:37:01 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201911181537.xAIFb1gh039864@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Mon, 18 Nov 2019 15:37:01 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354816 - head/sys/arm64/arm64 X-SVN-Group: head X-SVN-Commit-Author: markj X-SVN-Commit-Paths: head/sys/arm64/arm64 X-SVN-Commit-Revision: 354816 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 18 Nov 2019 15:37:02 -0000 Author: markj Date: Mon Nov 18 15:37:01 2019 New Revision: 354816 URL: https://svnweb.freebsd.org/changeset/base/354816 Log: Implement vm.pmap.kernel_maps for arm64. Reviewed by: alc MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D22142 Modified: head/sys/arm64/arm64/pmap.c Modified: head/sys/arm64/arm64/pmap.c ============================================================================== --- head/sys/arm64/arm64/pmap.c Mon Nov 18 15:36:46 2019 (r354815) +++ head/sys/arm64/arm64/pmap.c Mon Nov 18 15:37:01 2019 (r354816) @@ -121,6 +121,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include @@ -6156,3 +6157,212 @@ pmap_is_valid_memattr(pmap_t pmap __unused, vm_memattr return (mode >= VM_MEMATTR_DEVICE && mode <= VM_MEMATTR_WRITE_THROUGH); } + +/* + * Track a range of the kernel's virtual address space that is contiguous + * in various mapping attributes. + */ +struct pmap_kernel_map_range { + vm_offset_t sva; + pt_entry_t attrs; + int l3pages; + int l3contig; + int l2blocks; + int l1blocks; +}; + +static void +sysctl_kmaps_dump(struct sbuf *sb, struct pmap_kernel_map_range *range, + vm_offset_t eva) +{ + const char *mode; + int index; + + if (eva <= range->sva) + return; + + index = range->attrs & ATTR_IDX_MASK; + switch (index) { + case ATTR_IDX(VM_MEMATTR_DEVICE): + mode = "DEV"; + break; + case ATTR_IDX(VM_MEMATTR_UNCACHEABLE): + mode = "UC"; + break; + case ATTR_IDX(VM_MEMATTR_WRITE_BACK): + mode = "WB"; + break; + case ATTR_IDX(VM_MEMATTR_WRITE_THROUGH): + mode = "WT"; + break; + default: + printf( + "%s: unknown memory type %x for range 0x%016lx-0x%016lx\n", + __func__, index, range->sva, eva); + mode = "??"; + break; + } + + sbuf_printf(sb, "0x%016lx-0x%016lx r%c%c%c %3s %d %d %d %d\n", + range->sva, eva, + (range->attrs & ATTR_AP_RW_BIT) == ATTR_AP_RW ? 'w' : '-', + (range->attrs & ATTR_PXN) != 0 ? '-' : 'x', + (range->attrs & ATTR_AP_USER) != 0 ? 'u' : 's', + mode, range->l1blocks, range->l2blocks, range->l3contig, + range->l3pages); + + /* Reset to sentinel value. */ + range->sva = 0xfffffffffffffffful; +} + +/* + * Determine whether the attributes specified by a page table entry match those + * being tracked by the current range. + */ +static bool +sysctl_kmaps_match(struct pmap_kernel_map_range *range, pt_entry_t attrs) +{ + + return (range->attrs == attrs); +} + +static void +sysctl_kmaps_reinit(struct pmap_kernel_map_range *range, vm_offset_t va, + pt_entry_t attrs) +{ + + memset(range, 0, sizeof(*range)); + range->sva = va; + range->attrs = attrs; +} + +/* + * Given a leaf PTE, derive the mapping's attributes. If they do not match + * those of the current run, dump the address range and its attributes, and + * begin a new run. + */ +static void +sysctl_kmaps_check(struct sbuf *sb, struct pmap_kernel_map_range *range, + vm_offset_t va, pd_entry_t l0e, pd_entry_t l1e, pd_entry_t l2e, + pt_entry_t l3e) +{ + pt_entry_t attrs; + + attrs = l0e & (ATTR_AP_MASK | ATTR_XN); + attrs |= l1e & (ATTR_AP_MASK | ATTR_XN); + if ((l1e & ATTR_DESCR_MASK) == L1_BLOCK) + attrs |= l1e & ATTR_IDX_MASK; + attrs |= l2e & (ATTR_AP_MASK | ATTR_XN); + if ((l2e & ATTR_DESCR_MASK) == L2_BLOCK) + attrs |= l2e & ATTR_IDX_MASK; + attrs |= l3e & (ATTR_AP_MASK | ATTR_XN | ATTR_IDX_MASK); + + if (range->sva > va || !sysctl_kmaps_match(range, attrs)) { + sysctl_kmaps_dump(sb, range, va); + sysctl_kmaps_reinit(range, va, attrs); + } +} + +static int +sysctl_kmaps(SYSCTL_HANDLER_ARGS) +{ + struct pmap_kernel_map_range range; + struct sbuf sbuf, *sb; + pd_entry_t l0e, *l1, l1e, *l2, l2e; + pt_entry_t *l3, l3e; + vm_offset_t sva; + vm_paddr_t pa; + int error, i, j, k, l; + + error = sysctl_wire_old_buffer(req, 0); + if (error != 0) + return (error); + sb = &sbuf; + sbuf_new_for_sysctl(sb, NULL, PAGE_SIZE, req); + + /* Sentinel value. */ + range.sva = 0xfffffffffffffffful; + + /* + * Iterate over the kernel page tables without holding the kernel pmap + * lock. Kernel page table pages are never freed, so at worst we will + * observe inconsistencies in the output. + */ + for (sva = 0xffff000000000000ul, i = pmap_l0_index(sva); i < Ln_ENTRIES; + i++) { + if (i == pmap_l0_index(DMAP_MIN_ADDRESS)) + sbuf_printf(sb, "\nDirect map:\n"); + else if (i == pmap_l0_index(VM_MIN_KERNEL_ADDRESS)) + sbuf_printf(sb, "\nKernel map:\n"); + + l0e = kernel_pmap->pm_l0[i]; + if ((l0e & ATTR_DESCR_VALID) == 0) { + sysctl_kmaps_dump(sb, &range, sva); + sva += L0_SIZE; + continue; + } + pa = l0e & ~ATTR_MASK; + l1 = (pd_entry_t *)PHYS_TO_DMAP(pa); + + for (j = pmap_l1_index(sva); j < Ln_ENTRIES; j++) { + l1e = l1[j]; + if ((l1e & ATTR_DESCR_VALID) == 0) { + sysctl_kmaps_dump(sb, &range, sva); + sva += L1_SIZE; + continue; + } + if ((l1e & ATTR_DESCR_MASK) == L1_BLOCK) { + sysctl_kmaps_check(sb, &range, sva, l0e, l1e, + 0, 0); + range.l1blocks++; + sva += L1_SIZE; + continue; + } + pa = l1e & ~ATTR_MASK; + l2 = (pd_entry_t *)PHYS_TO_DMAP(pa); + + for (k = pmap_l2_index(sva); k < Ln_ENTRIES; k++) { + l2e = l2[k]; + if ((l2e & ATTR_DESCR_VALID) == 0) { + sysctl_kmaps_dump(sb, &range, sva); + sva += L2_SIZE; + continue; + } + if ((l2e & ATTR_DESCR_MASK) == L2_BLOCK) { + sysctl_kmaps_check(sb, &range, sva, + l0e, l1e, l2e, 0); + range.l2blocks++; + sva += L2_SIZE; + continue; + } + pa = l2e & ~ATTR_MASK; + l3 = (pt_entry_t *)PHYS_TO_DMAP(pa); + + for (l = pmap_l3_index(sva); l < Ln_ENTRIES; + l++, sva += L3_SIZE) { + l3e = l3[l]; + if ((l3e & ATTR_DESCR_VALID) == 0) { + sysctl_kmaps_dump(sb, &range, + sva); + continue; + } + sysctl_kmaps_check(sb, &range, sva, + l0e, l1e, l2e, l3e); + if ((l3e & ATTR_CONTIGUOUS) != 0) + range.l3contig += l % 16 == 0 ? + 1 : 0; + else + range.l3pages++; + } + } + } + } + + error = sbuf_finish(sb); + sbuf_delete(sb); + return (error); +} +SYSCTL_OID(_vm_pmap, OID_AUTO, kernel_maps, + CTLTYPE_STRING | CTLFLAG_RD | CTLFLAG_MPSAFE, + NULL, 0, sysctl_kmaps, "A", + "Dump kernel address layout"); From owner-svn-src-all@freebsd.org Mon Nov 18 16:37:22 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id B506E1C3DF8; Mon, 18 Nov 2019 16:37:22 +0000 (UTC) (envelope-from tsoome@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47GvkV2x1Kz47x7; Mon, 18 Nov 2019 16:37:22 +0000 (UTC) (envelope-from tsoome@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 2268A2CB22; Mon, 18 Nov 2019 16:37:22 +0000 (UTC) (envelope-from tsoome@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xAIGbL8c075255; Mon, 18 Nov 2019 16:37:21 GMT (envelope-from tsoome@FreeBSD.org) Received: (from tsoome@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xAIGbLMb075254; Mon, 18 Nov 2019 16:37:21 GMT (envelope-from tsoome@FreeBSD.org) Message-Id: <201911181637.xAIGbLMb075254@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tsoome set sender to tsoome@FreeBSD.org using -f From: Toomas Soome Date: Mon, 18 Nov 2019 16:37:21 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r354817 - stable/12/stand/efi/libefi X-SVN-Group: stable-12 X-SVN-Commit-Author: tsoome X-SVN-Commit-Paths: stable/12/stand/efi/libefi X-SVN-Commit-Revision: 354817 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 18 Nov 2019 16:37:22 -0000 Author: tsoome Date: Mon Nov 18 16:37:21 2019 New Revision: 354817 URL: https://svnweb.freebsd.org/changeset/base/354817 Log: MFC r354743, r354766: loader: r354415 did miss to sort subpaths below the partitions loader: remove unused variable from efipart.c Modified: stable/12/stand/efi/libefi/efipart.c Directory Properties: stable/12/ (props changed) Modified: stable/12/stand/efi/libefi/efipart.c ============================================================================== --- stable/12/stand/efi/libefi/efipart.c Mon Nov 18 15:37:01 2019 (r354816) +++ stable/12/stand/efi/libefi/efipart.c Mon Nov 18 16:37:21 2019 (r354817) @@ -506,9 +506,12 @@ efipart_initcd(void) static bool efipart_hdinfo_add_node(pdinfo_t *hd, EFI_DEVICE_PATH *node) { - pdinfo_t *pd, *last; - VENDOR_DEVICE_PATH *ven_node; + pdinfo_t *pd, *ptr; + if (node == NULL) + return (false); + + /* Find our disk device. */ STAILQ_FOREACH(pd, &hdinfo, pd_link) { if (efi_devpath_is_prefix(pd->pd_devpath, hd->pd_devpath)) break; @@ -516,13 +519,28 @@ efipart_hdinfo_add_node(pdinfo_t *hd, EFI_DEVICE_PATH if (pd == NULL) return (false); + /* If the node is not MEDIA_HARDDRIVE_DP, it is sub-partition. */ + if (DevicePathSubType(node) != MEDIA_HARDDRIVE_DP) { + STAILQ_FOREACH(ptr, &pd->pd_part, pd_link) { + if (efi_devpath_is_prefix(ptr->pd_devpath, + hd->pd_devpath)) + break; + } + /* + * ptr == NULL means we have handles in unexpected order + * and we would need to re-order the partitions later. + */ + if (ptr != NULL) + pd = ptr; + } + /* Add the partition. */ if (DevicePathSubType(node) == MEDIA_HARDDRIVE_DP) { hd->pd_unit = ((HARDDRIVE_DEVICE_PATH *)node)->PartitionNumber; } else { - last = STAILQ_LAST(&pd->pd_part, pdinfo, pd_link); - if (last != NULL) - hd->pd_unit = last->pd_unit + 1; + ptr = STAILQ_LAST(&pd->pd_part, pdinfo, pd_link); + if (ptr != NULL) + hd->pd_unit = ptr->pd_unit + 1; else hd->pd_unit = 0; } @@ -536,7 +554,7 @@ efipart_hdinfo_add_node(pdinfo_t *hd, EFI_DEVICE_PATH static void efipart_hdinfo_add(pdinfo_t *hd, EFI_DEVICE_PATH *node) { - pdinfo_t *pd, *last; + pdinfo_t *last; if (efipart_hdinfo_add_node(hd, node)) return; From owner-svn-src-all@freebsd.org Mon Nov 18 16:40:04 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 7056B1C3EFB; Mon, 18 Nov 2019 16:40:04 +0000 (UTC) (envelope-from tsoome@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47Gvnc0TMsz4G4C; Mon, 18 Nov 2019 16:40:04 +0000 (UTC) (envelope-from tsoome@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id CF3502CB27; Mon, 18 Nov 2019 16:40:03 +0000 (UTC) (envelope-from tsoome@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xAIGe3J7075558; Mon, 18 Nov 2019 16:40:03 GMT (envelope-from tsoome@FreeBSD.org) Received: (from tsoome@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xAIGe3hF075557; Mon, 18 Nov 2019 16:40:03 GMT (envelope-from tsoome@FreeBSD.org) Message-Id: <201911181640.xAIGe3hF075557@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tsoome set sender to tsoome@FreeBSD.org using -f From: Toomas Soome Date: Mon, 18 Nov 2019 16:40:03 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r354818 - stable/12/stand/common X-SVN-Group: stable-12 X-SVN-Commit-Author: tsoome X-SVN-Commit-Paths: stable/12/stand/common X-SVN-Commit-Revision: 354818 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 18 Nov 2019 16:40:04 -0000 Author: tsoome Date: Mon Nov 18 16:40:03 2019 New Revision: 354818 URL: https://svnweb.freebsd.org/changeset/base/354818 Log: MFC r354746: loader: add support for hybrid PMBR for GPT partition table Note hybrid table is nor really UEFI specification compliant. Sample hybrid partition table: > ::mbr Format: unknown Signature: 0xaa55 (valid) UniqueMBRDiskSignature: 0 PART TYPE ACTIVE STARTCHS ENDCHS SECTOR NUMSECT 0 EFI_PMBR:0xee 0 1023/254/63 1023/254/63 1 409639 1 0xff 0 1023/254/63 1023/254/63 409640 978508408 2 FDISK_EXT_WIN:0xc 0 1023/254/63 1023/254/63 978918048 31250000 3 0xff 0 1023/254/63 1023/254/63 1010168048 32 > Modified: stable/12/stand/common/part.c Directory Properties: stable/12/ (props changed) Modified: stable/12/stand/common/part.c ============================================================================== --- stable/12/stand/common/part.c Mon Nov 18 16:37:21 2019 (r354817) +++ stable/12/stand/common/part.c Mon Nov 18 16:40:03 2019 (r354818) @@ -651,7 +651,7 @@ ptable_open(void *dev, uint64_t sectors, uint16_t sect struct dos_partition *dp; struct ptable *table; uint8_t *buf; - int i, count; + int i; #ifdef LOADER_MBR_SUPPORT struct pentry *entry; uint32_t start, end; @@ -713,28 +713,23 @@ ptable_open(void *dev, uint64_t sectors, uint16_t sect } /* Check that we have PMBR. Also do some validation. */ dp = (struct dos_partition *)(buf + DOSPARTOFF); - for (i = 0, count = 0; i < NDOSPART; i++) { + /* + * In mac we can have PMBR partition in hybrid MBR; + * that is, MBR partition which has DOSPTYP_PMBR entry defined as + * start sector 1. After DOSPTYP_PMBR, there may be other partitions. + * UEFI compliant PMBR has no other partitions. + */ + for (i = 0; i < NDOSPART; i++) { if (dp[i].dp_flag != 0 && dp[i].dp_flag != 0x80) { DPRINTF("invalid partition flag %x", dp[i].dp_flag); goto out; } #ifdef LOADER_GPT_SUPPORT - if (dp[i].dp_typ == DOSPTYP_PMBR) { + if (dp[i].dp_typ == DOSPTYP_PMBR && dp[i].dp_start == 1) { table->type = PTABLE_GPT; DPRINTF("PMBR detected"); } #endif - if (dp[i].dp_typ != 0) - count++; - } - /* Do we have some invalid values? */ - if (table->type == PTABLE_GPT && count > 1) { - if (dp[1].dp_typ != DOSPTYP_HFS) { - table->type = PTABLE_NONE; - DPRINTF("Incorrect PMBR, ignore it"); - } else { - DPRINTF("Bootcamp detected"); - } } #ifdef LOADER_GPT_SUPPORT if (table->type == PTABLE_GPT) { From owner-svn-src-all@freebsd.org Mon Nov 18 17:19:17 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 4B5E51C4A77; Mon, 18 Nov 2019 17:19:17 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47Gwfs13bkz4FQM; Mon, 18 Nov 2019 17:19:17 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 079DD2D22F; Mon, 18 Nov 2019 17:19:17 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xAIHJGtN098808; Mon, 18 Nov 2019 17:19:16 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xAIHJGHm098807; Mon, 18 Nov 2019 17:19:16 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201911181719.xAIHJGHm098807@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Mon, 18 Nov 2019 17:19:16 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r354819 - stable/12/sys/kern X-SVN-Group: stable-12 X-SVN-Commit-Author: markj X-SVN-Commit-Paths: stable/12/sys/kern X-SVN-Commit-Revision: 354819 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 18 Nov 2019 17:19:17 -0000 Author: markj Date: Mon Nov 18 17:19:16 2019 New Revision: 354819 URL: https://svnweb.freebsd.org/changeset/base/354819 Log: MFC r353729: Apply mapping protections to .o kernel modules. Modified: stable/12/sys/kern/link_elf_obj.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/kern/link_elf_obj.c ============================================================================== --- stable/12/sys/kern/link_elf_obj.c Mon Nov 18 16:40:03 2019 (r354818) +++ stable/12/sys/kern/link_elf_obj.c Mon Nov 18 17:19:16 2019 (r354819) @@ -70,8 +70,8 @@ __FBSDID("$FreeBSD$"); typedef struct { void *addr; Elf_Off size; - int flags; - int sec; /* Original section */ + int flags; /* Section flags. */ + int sec; /* Original section number. */ char *name; } Elf_progent; @@ -196,6 +196,119 @@ link_elf_init(void *arg) SYSINIT(link_elf_obj, SI_SUB_KLD, SI_ORDER_SECOND, link_elf_init, NULL); +static void +link_elf_protect_range(elf_file_t ef, vm_offset_t start, vm_offset_t end, + vm_prot_t prot) +{ + int error __unused; + + KASSERT(start <= end && start >= (vm_offset_t)ef->address && + end <= round_page((vm_offset_t)ef->address + ef->lf.size), + ("link_elf_protect_range: invalid range %#jx-%#jx", + (uintmax_t)start, (uintmax_t)end)); + + if (start == end) + return; + error = vm_map_protect(kernel_map, start, end, prot, FALSE); + KASSERT(error == KERN_SUCCESS, + ("link_elf_protect_range: vm_map_protect() returned %d", error)); +} + +/* + * Restrict permissions on linker file memory based on section flags. + * Sections need not be page-aligned, so overlap within a page is possible. + */ +static void +link_elf_protect(elf_file_t ef) +{ + vm_offset_t end, segend, segstart, start; + vm_prot_t gapprot, prot, segprot; + int i; + + /* + * If the file was preloaded, the last page may contain other preloaded + * data which may need to be writeable. ELF files are always + * page-aligned, but other preloaded data, such as entropy or CPU + * microcode may be loaded with a smaller alignment. + */ + gapprot = ef->preloaded ? VM_PROT_RW : VM_PROT_READ; + + start = end = (vm_offset_t)ef->address; + prot = VM_PROT_READ; + for (i = 0; i < ef->nprogtab; i++) { + /* + * VNET and DPCPU sections have their memory allocated by their + * respective subsystems. + */ + if (ef->progtab[i].name != NULL && ( +#ifdef VIMAGE + strcmp(ef->progtab[i].name, VNET_SETNAME) == 0 || +#endif + strcmp(ef->progtab[i].name, DPCPU_SETNAME) == 0)) + continue; + + segstart = trunc_page((vm_offset_t)ef->progtab[i].addr); + segend = round_page((vm_offset_t)ef->progtab[i].addr + + ef->progtab[i].size); + segprot = VM_PROT_READ; + if ((ef->progtab[i].flags & SHF_WRITE) != 0) + segprot |= VM_PROT_WRITE; + if ((ef->progtab[i].flags & SHF_EXECINSTR) != 0) + segprot |= VM_PROT_EXECUTE; + + if (end <= segstart) { + /* + * Case 1: there is no overlap between the previous + * segment and this one. Apply protections to the + * previous segment, and protect the gap between the + * previous and current segments, if any. + */ + link_elf_protect_range(ef, start, end, prot); + link_elf_protect_range(ef, end, segstart, gapprot); + + start = segstart; + end = segend; + prot = segprot; + } else if (start < segstart && end == segend) { + /* + * Case 2: the current segment is a subrange of the + * previous segment. Apply protections to the + * non-overlapping portion of the previous segment. + */ + link_elf_protect_range(ef, start, segstart, prot); + + start = segstart; + prot |= segprot; + } else if (end < segend) { + /* + * Case 3: there is partial overlap between the previous + * and current segments. Apply protections to the + * non-overlapping portion of the previous segment, and + * then the overlap, which must use the union of the two + * segments' protections. + */ + link_elf_protect_range(ef, start, segstart, prot); + link_elf_protect_range(ef, segstart, end, + prot | segprot); + start = end; + end = segend; + prot = segprot; + } else { + /* + * Case 4: the two segments reside in the same page. + */ + prot |= segprot; + } + } + + /* + * Fix up the last unprotected segment and trailing data. + */ + link_elf_protect_range(ef, start, end, prot); + link_elf_protect_range(ef, end, + round_page((vm_offset_t)ef->address + ef->lf.size), gapprot); +} + static int link_elf_link_preload(linker_class_t cls, const char *filename, linker_file_t *result) @@ -358,6 +471,7 @@ link_elf_link_preload(linker_class_t cls, const char * else ef->progtab[pb].name = "<>"; ef->progtab[pb].size = shdr[i].sh_size; + ef->progtab[pb].flags = shdr[i].sh_flags; ef->progtab[pb].sec = i; if (ef->shstrtab && shdr[i].sh_name != 0) ef->progtab[pb].name = @@ -783,7 +897,9 @@ link_elf_load_file(linker_class_t cls, const char *fil /* * In order to satisfy amd64's architectural requirements on the * location of code and data in the kernel's address space, request a - * mapping that is above the kernel. + * mapping that is above the kernel. + * + * Protections will be restricted once relocations are applied. */ #ifdef __amd64__ mapbase = KERNBASE; @@ -884,6 +1000,7 @@ link_elf_load_file(linker_class_t cls, const char *fil goto out; } ef->progtab[pb].size = shdr[i].sh_size; + ef->progtab[pb].flags = shdr[i].sh_flags; ef->progtab[pb].sec = i; if (shdr[i].sh_type == SHT_PROGBITS #ifdef __amd64__ @@ -1023,9 +1140,8 @@ link_elf_load_file(linker_class_t cls, const char *fil goto out; #endif - /* Invoke .ctors */ + link_elf_protect(ef); link_elf_invoke_ctors(lf->ctors_addr, lf->ctors_size); - *result = lf; out: From owner-svn-src-all@freebsd.org Mon Nov 18 18:22:42 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 4122D1C62E4; Mon, 18 Nov 2019 18:22:42 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47Gy420lqDz4MZm; Mon, 18 Nov 2019 18:22:42 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id F23552DEC5; Mon, 18 Nov 2019 18:22:41 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xAIIMfI9044599; Mon, 18 Nov 2019 18:22:41 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xAIIMfcP044596; Mon, 18 Nov 2019 18:22:41 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201911181822.xAIIMfcP044596@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Mon, 18 Nov 2019 18:22:41 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354820 - in head/sys: sys vm X-SVN-Group: head X-SVN-Commit-Author: markj X-SVN-Commit-Paths: in head/sys: sys vm X-SVN-Commit-Revision: 354820 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 18 Nov 2019 18:22:42 -0000 Author: markj Date: Mon Nov 18 18:22:41 2019 New Revision: 354820 URL: https://svnweb.freebsd.org/changeset/base/354820 Log: Widen the vm_page aflags field to 16 bits. We are now out of aflags bits, whereas the "flags" field only makes use of five of its sixteen bits, so narrow "flags" to eight bits. I have no intention of adding a new aflag in the near future, but would like to combine the aflags, queue and act_count fields into a single atomically updated word. This will allow vm_page_pqstate_cmpset() to become much simpler and is a step towards eliminating the use of the page lock array in updating per-page queue state. The change modifies the layout of struct vm_page, so bump __FreeBSD_version. Reviewed by: alc, dougm, jeff, kib Sponsored by: Netflix, Intel Differential Revision: https://reviews.freebsd.org/D22397 Modified: head/sys/sys/param.h head/sys/vm/vm_page.c head/sys/vm/vm_page.h Modified: head/sys/sys/param.h ============================================================================== --- head/sys/sys/param.h Mon Nov 18 17:19:16 2019 (r354819) +++ head/sys/sys/param.h Mon Nov 18 18:22:41 2019 (r354820) @@ -60,7 +60,7 @@ * in the range 5 to 9. */ #undef __FreeBSD_version -#define __FreeBSD_version 1300057 /* Master, propagated to newvers */ +#define __FreeBSD_version 1300058 /* Master, propagated to newvers */ /* * __FreeBSD_kernel__ indicates that this system uses the kernel of FreeBSD, Modified: head/sys/vm/vm_page.c ============================================================================== --- head/sys/vm/vm_page.c Mon Nov 18 17:19:16 2019 (r354819) +++ head/sys/vm/vm_page.c Mon Nov 18 18:22:41 2019 (r354820) @@ -5014,7 +5014,7 @@ vm_page_object_busy_assert(vm_page_t m) } void -vm_page_assert_pga_writeable(vm_page_t m, uint8_t bits) +vm_page_assert_pga_writeable(vm_page_t m, uint16_t bits) { if ((bits & PGA_WRITEABLE) == 0) Modified: head/sys/vm/vm_page.h ============================================================================== --- head/sys/vm/vm_page.h Mon Nov 18 17:19:16 2019 (r354819) +++ head/sys/vm/vm_page.h Mon Nov 18 18:22:41 2019 (r354820) @@ -234,15 +234,15 @@ struct vm_page { struct md_page md; /* machine dependent stuff */ u_int ref_count; /* page references (A) */ volatile u_int busy_lock; /* busy owners lock */ - uint16_t flags; /* page PG_* flags (P) */ - uint8_t order; /* index of the buddy queue (F) */ + uint16_t aflags; /* atomic flags (A) */ + uint8_t queue; /* page queue index (Q) */ + uint8_t act_count; /* page usage count (P) */ + uint8_t order; /* index of the buddy queue (F) */ uint8_t pool; /* vm_phys freepool index (F) */ - uint8_t aflags; /* atomic flags (A) */ + uint8_t flags; /* page PG_* flags (P) */ uint8_t oflags; /* page VPO_* flags (O) */ - uint8_t queue; /* page queue index (Q) */ int8_t psind; /* pagesizes[] index (O) */ int8_t segind; /* vm_phys segment index (C) */ - u_char act_count; /* page usage count (P) */ /* NOTE that these must support one bit per DEV_BSIZE in a page */ /* so, on normal X86 kernels, they must be at least 8 bits wide */ vm_page_bits_t valid; /* valid DEV_BSIZE chunk map (O,B) */ @@ -414,14 +414,14 @@ extern struct mtx_padalign pa_lock[]; * the inactive queue, thus bypassing LRU. The page lock must be held to * set this flag, and the queue lock for the page must be held to clear it. */ -#define PGA_WRITEABLE 0x01 /* page may be mapped writeable */ -#define PGA_REFERENCED 0x02 /* page has been referenced */ -#define PGA_EXECUTABLE 0x04 /* page may be mapped executable */ -#define PGA_ENQUEUED 0x08 /* page is enqueued in a page queue */ -#define PGA_DEQUEUE 0x10 /* page is due to be dequeued */ -#define PGA_REQUEUE 0x20 /* page is due to be requeued */ -#define PGA_REQUEUE_HEAD 0x40 /* page requeue should bypass LRU */ -#define PGA_NOSYNC 0x80 /* do not collect for syncer */ +#define PGA_WRITEABLE 0x0001 /* page may be mapped writeable */ +#define PGA_REFERENCED 0x0002 /* page has been referenced */ +#define PGA_EXECUTABLE 0x0004 /* page may be mapped executable */ +#define PGA_ENQUEUED 0x0008 /* page is enqueued in a page queue */ +#define PGA_DEQUEUE 0x0010 /* page is due to be dequeued */ +#define PGA_REQUEUE 0x0020 /* page is due to be requeued */ +#define PGA_REQUEUE_HEAD 0x0040 /* page requeue should bypass LRU */ +#define PGA_NOSYNC 0x0080 /* do not collect for syncer */ #define PGA_QUEUE_STATE_MASK (PGA_ENQUEUED | PGA_DEQUEUE | PGA_REQUEUE | \ PGA_REQUEUE_HEAD) @@ -434,11 +434,11 @@ extern struct mtx_padalign pa_lock[]; * allocated from a per-CPU cache. It is cleared the next time that the * page is allocated from the physical memory allocator. */ -#define PG_PCPU_CACHE 0x0001 /* was allocated from per-CPU caches */ -#define PG_FICTITIOUS 0x0004 /* physical page doesn't exist */ -#define PG_ZERO 0x0008 /* page is zeroed */ -#define PG_MARKER 0x0010 /* special queue marker page */ -#define PG_NODUMP 0x0080 /* don't include this page in a dump */ +#define PG_PCPU_CACHE 0x01 /* was allocated from per-CPU caches */ +#define PG_FICTITIOUS 0x02 /* physical page doesn't exist */ +#define PG_ZERO 0x04 /* page is zeroed */ +#define PG_MARKER 0x08 /* special queue marker page */ +#define PG_NODUMP 0x10 /* don't include this page in a dump */ /* * Misc constants. @@ -716,7 +716,7 @@ void vm_page_lock_assert_KBI(vm_page_t m, int a, const #ifdef INVARIANTS void vm_page_object_busy_assert(vm_page_t m); #define VM_PAGE_OBJECT_BUSY_ASSERT(m) vm_page_object_busy_assert(m) -void vm_page_assert_pga_writeable(vm_page_t m, uint8_t bits); +void vm_page_assert_pga_writeable(vm_page_t m, uint16_t bits); #define VM_PAGE_ASSERT_PGA_WRITEABLE(m, bits) \ vm_page_assert_pga_writeable(m, bits) #else @@ -749,7 +749,7 @@ _Static_assert(sizeof(((struct vm_page *)NULL)->queue) #define VM_PAGE_AFLAG_SHIFT 0 #define VM_PAGE_QUEUE_SHIFT 16 #else -#define VM_PAGE_AFLAG_SHIFT 24 +#define VM_PAGE_AFLAG_SHIFT 16 #define VM_PAGE_QUEUE_SHIFT 8 #endif #define VM_PAGE_QUEUE_MASK (0xff << VM_PAGE_QUEUE_SHIFT) @@ -758,7 +758,7 @@ _Static_assert(sizeof(((struct vm_page *)NULL)->queue) * Clear the given bits in the specified page. */ static inline void -vm_page_aflag_clear(vm_page_t m, uint8_t bits) +vm_page_aflag_clear(vm_page_t m, uint16_t bits) { uint32_t *addr, val; @@ -782,7 +782,7 @@ vm_page_aflag_clear(vm_page_t m, uint8_t bits) * Set the given bits in the specified page. */ static inline void -vm_page_aflag_set(vm_page_t m, uint8_t bits) +vm_page_aflag_set(vm_page_t m, uint16_t bits) { uint32_t *addr, val; From owner-svn-src-all@freebsd.org Mon Nov 18 18:25:52 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id BDA7F1C6396; Mon, 18 Nov 2019 18:25:52 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47Gy7h4gprz4Mkp; Mon, 18 Nov 2019 18:25:52 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 69D672DED6; Mon, 18 Nov 2019 18:25:52 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xAIIPqua044776; Mon, 18 Nov 2019 18:25:52 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xAIIPqaL044775; Mon, 18 Nov 2019 18:25:52 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201911181825.xAIIPqaL044775@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Mon, 18 Nov 2019 18:25:52 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354821 - head/sys/vm X-SVN-Group: head X-SVN-Commit-Author: markj X-SVN-Commit-Paths: head/sys/vm X-SVN-Commit-Revision: 354821 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 18 Nov 2019 18:25:52 -0000 Author: markj Date: Mon Nov 18 18:25:51 2019 New Revision: 354821 URL: https://svnweb.freebsd.org/changeset/base/354821 Log: Group per-domain reservation data in the same structure. We currently have the per-domain partially populated reservation queues and the per-domain queue locks. Define a new per-domain padded structure to contain both of them. This puts the queue fields and lock in the same cache line and avoids the false sharing within the old queue array. Also fix field packing in the reservation structure. In many places we assume that a domain index fits in 8 bits, so we can do the same there as well. This reduces the size of the structure by 8 bytes. Update some comments while here. No functional change intended. Reviewed by: dougm, kib MFC after: 2 weeks Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D22391 Modified: head/sys/vm/vm_reserv.c Modified: head/sys/vm/vm_reserv.c ============================================================================== --- head/sys/vm/vm_reserv.c Mon Nov 18 18:22:41 2019 (r354820) +++ head/sys/vm/vm_reserv.c Mon Nov 18 18:25:51 2019 (r354821) @@ -188,15 +188,15 @@ popmap_is_set(popmap_t popmap[], int i) */ struct vm_reserv { struct mtx lock; /* reservation lock. */ - TAILQ_ENTRY(vm_reserv) partpopq; /* (d) per-domain queue. */ + TAILQ_ENTRY(vm_reserv) partpopq; /* (d, r) per-domain queue. */ LIST_ENTRY(vm_reserv) objq; /* (o, r) object queue */ vm_object_t object; /* (o, r) containing object */ vm_pindex_t pindex; /* (o, r) offset in object */ vm_page_t pages; /* (c) first page */ - uint16_t domain; /* (c) NUMA domain. */ uint16_t popcnt; /* (r) # of pages in use */ + uint8_t domain; /* (c) NUMA domain. */ + char inpartpopq; /* (d, r) */ int lasttick; /* (r) last pop update tick. */ - char inpartpopq; /* (d) */ popmap_t popmap[NPOPMAP_MAX]; /* (r) bit vector, used pages */ }; @@ -207,12 +207,6 @@ struct vm_reserv { #define vm_reserv_trylock(rv) mtx_trylock(vm_reserv_lockptr(rv)) #define vm_reserv_unlock(rv) mtx_unlock(vm_reserv_lockptr(rv)) -static struct mtx_padalign vm_reserv_domain_locks[MAXMEMDOM]; - -#define vm_reserv_domain_lockptr(d) &vm_reserv_domain_locks[(d)] -#define vm_reserv_domain_lock(d) mtx_lock(vm_reserv_domain_lockptr(d)) -#define vm_reserv_domain_unlock(d) mtx_unlock(vm_reserv_domain_lockptr(d)) - /* * The reservation array * @@ -237,16 +231,25 @@ static struct mtx_padalign vm_reserv_domain_locks[MAXM static vm_reserv_t vm_reserv_array; /* - * The partially populated reservation queue + * The per-domain partially populated reservation queues * - * This queue enables the fast recovery of an unused free small page from a - * partially populated reservation. The reservation at the head of this queue + * These queues enable the fast recovery of an unused free small page from a + * partially populated reservation. The reservation at the head of a queue * is the least recently changed, partially populated reservation. * - * Access to this queue is synchronized by the free page queue lock. + * Access to this queue is synchronized by the per-domain reservation lock. */ -static TAILQ_HEAD(, vm_reserv) vm_rvq_partpop[MAXMEMDOM]; +struct vm_reserv_domain { + struct mtx lock; + TAILQ_HEAD(, vm_reserv) partpop; +} __aligned(CACHE_LINE_SIZE); +static struct vm_reserv_domain vm_rvd[MAXMEMDOM]; + +#define vm_reserv_domain_lockptr(d) (&vm_rvd[(d)].lock) +#define vm_reserv_domain_lock(d) mtx_lock(vm_reserv_domain_lockptr(d)) +#define vm_reserv_domain_unlock(d) mtx_unlock(vm_reserv_domain_lockptr(d)) + static SYSCTL_NODE(_vm, OID_AUTO, reserv, CTLFLAG_RD, 0, "Reservation Info"); static counter_u64_t vm_reserv_broken = EARLY_COUNTER; @@ -301,8 +304,8 @@ static void vm_reserv_reclaim(vm_reserv_t rv); /* * Returns the current number of full reservations. * - * Since the number of full reservations is computed without acquiring the - * free page queue lock, the returned value may be inexact. + * Since the number of full reservations is computed without acquiring any + * locks, the returned value is inexact. */ static int sysctl_vm_reserv_fullpop(SYSCTL_HANDLER_ARGS) @@ -346,7 +349,7 @@ sysctl_vm_reserv_partpopq(SYSCTL_HANDLER_ARGS) counter = 0; unused_pages = 0; vm_reserv_domain_lock(domain); - TAILQ_FOREACH(rv, &vm_rvq_partpop[domain], partpopq) { + TAILQ_FOREACH(rv, &vm_rvd[domain].partpop, partpopq) { counter++; unused_pages += VM_LEVEL_0_NPAGES - rv->popcnt; } @@ -449,12 +452,13 @@ vm_reserv_depopulate(vm_reserv_t rv, int index) rv->popcnt == 0) { vm_reserv_domain_lock(rv->domain); if (rv->inpartpopq) { - TAILQ_REMOVE(&vm_rvq_partpop[rv->domain], rv, partpopq); + TAILQ_REMOVE(&vm_rvd[rv->domain].partpop, rv, partpopq); rv->inpartpopq = FALSE; } if (rv->popcnt != 0) { rv->inpartpopq = TRUE; - TAILQ_INSERT_TAIL(&vm_rvq_partpop[rv->domain], rv, partpopq); + TAILQ_INSERT_TAIL(&vm_rvd[rv->domain].partpop, rv, + partpopq); } vm_reserv_domain_unlock(rv->domain); rv->lasttick = ticks; @@ -531,8 +535,6 @@ vm_reserv_has_pindex(vm_reserv_t rv, vm_pindex_t pinde /* * Increases the given reservation's population count. Moves the reservation * to the tail of the partially populated reservation queue. - * - * The free page queue must be locked. */ static void vm_reserv_populate(vm_reserv_t rv, int index) @@ -561,12 +563,12 @@ vm_reserv_populate(vm_reserv_t rv, int index) rv->lasttick = ticks; vm_reserv_domain_lock(rv->domain); if (rv->inpartpopq) { - TAILQ_REMOVE(&vm_rvq_partpop[rv->domain], rv, partpopq); + TAILQ_REMOVE(&vm_rvd[rv->domain].partpop, rv, partpopq); rv->inpartpopq = FALSE; } if (rv->popcnt < VM_LEVEL_0_NPAGES) { rv->inpartpopq = TRUE; - TAILQ_INSERT_TAIL(&vm_rvq_partpop[rv->domain], rv, partpopq); + TAILQ_INSERT_TAIL(&vm_rvd[rv->domain].partpop, rv, partpopq); } else { KASSERT(rv->pages->psind == 0, ("vm_reserv_populate: reserv %p is already promoted", @@ -924,7 +926,7 @@ out: * population count and map are reset to their initial state. * * The given reservation must not be in the partially populated reservation - * queue. The free page queue lock must be held. + * queue. */ static void vm_reserv_break(vm_reserv_t rv) @@ -999,7 +1001,7 @@ vm_reserv_break_all(vm_object_t object) } vm_reserv_domain_lock(rv->domain); if (rv->inpartpopq) { - TAILQ_REMOVE(&vm_rvq_partpop[rv->domain], rv, partpopq); + TAILQ_REMOVE(&vm_rvd[rv->domain].partpop, rv, partpopq); rv->inpartpopq = FALSE; } vm_reserv_domain_unlock(rv->domain); @@ -1011,8 +1013,6 @@ vm_reserv_break_all(vm_object_t object) /* * Frees the given page if it belongs to a reservation. Returns TRUE if the * page is freed and FALSE otherwise. - * - * The free page queue lock must be held. */ boolean_t vm_reserv_free_page(vm_page_t m) @@ -1066,9 +1066,8 @@ vm_reserv_init(void) } } for (i = 0; i < MAXMEMDOM; i++) { - mtx_init(&vm_reserv_domain_locks[i], "VM reserv domain", NULL, - MTX_DEF); - TAILQ_INIT(&vm_rvq_partpop[i]); + mtx_init(&vm_rvd[i].lock, "VM reserv domain", NULL, MTX_DEF); + TAILQ_INIT(&vm_rvd[i].partpop); } for (i = 0; i < VM_RESERV_OBJ_LOCK_COUNT; i++) @@ -1120,8 +1119,6 @@ vm_reserv_level_iffullpop(vm_page_t m) /* * Breaks the given partially populated reservation, releasing its free pages * to the physical memory allocator. - * - * The free page queue lock must be held. */ static void vm_reserv_reclaim(vm_reserv_t rv) @@ -1136,7 +1133,7 @@ vm_reserv_reclaim(vm_reserv_t rv) KASSERT(rv->domain < vm_ndomains, ("vm_reserv_reclaim: reserv %p's domain is corrupted %d", rv, rv->domain)); - TAILQ_REMOVE(&vm_rvq_partpop[rv->domain], rv, partpopq); + TAILQ_REMOVE(&vm_rvd[rv->domain].partpop, rv, partpopq); rv->inpartpopq = FALSE; vm_reserv_domain_unlock(rv->domain); vm_reserv_break(rv); @@ -1147,17 +1144,15 @@ vm_reserv_reclaim(vm_reserv_t rv) * Breaks the reservation at the head of the partially populated reservation * queue, releasing its free pages to the physical memory allocator. Returns * TRUE if a reservation is broken and FALSE otherwise. - * - * The free page queue lock must be held. */ boolean_t vm_reserv_reclaim_inactive(int domain) { vm_reserv_t rv; - while ((rv = TAILQ_FIRST(&vm_rvq_partpop[domain])) != NULL) { + while ((rv = TAILQ_FIRST(&vm_rvd[domain].partpop)) != NULL) { vm_reserv_lock(rv); - if (rv != TAILQ_FIRST(&vm_rvq_partpop[domain])) { + if (rv != TAILQ_FIRST(&vm_rvd[domain].partpop)) { vm_reserv_unlock(rv); continue; } @@ -1172,8 +1167,6 @@ vm_reserv_reclaim_inactive(int domain) * Determine whether this reservation has free pages that satisfy the given * request for contiguous physical memory. Start searching from the lower * bound, defined by low_index. - * - * The free page queue lock must be held. */ static bool vm_reserv_test_contig(vm_reserv_t rv, u_long npages, vm_paddr_t low, @@ -1252,8 +1245,6 @@ vm_reserv_test_contig(vm_reserv_t rv, u_long npages, v * changed reservation with free pages that satisfy the given request for * contiguous physical memory. If a satisfactory reservation is found, it is * broken. Returns true if a reservation is broken and false otherwise. - * - * The free page queue lock must be held. */ boolean_t vm_reserv_reclaim_contig(int domain, u_long npages, vm_paddr_t low, @@ -1267,7 +1258,7 @@ vm_reserv_reclaim_contig(int domain, u_long npages, vm size = npages << PAGE_SHIFT; vm_reserv_domain_lock(domain); again: - for (rv = TAILQ_FIRST(&vm_rvq_partpop[domain]); rv != NULL; rv = rvn) { + for (rv = TAILQ_FIRST(&vm_rvd[domain].partpop); rv != NULL; rv = rvn) { rvn = TAILQ_NEXT(rv, partpopq); pa = VM_PAGE_TO_PHYS(&rv->pages[0]); if (pa + VM_LEVEL_0_SIZE - size < low) { From owner-svn-src-all@freebsd.org Mon Nov 18 18:34:23 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id E16BB1C66EA; Mon, 18 Nov 2019 18:34:23 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47GyKW59z3z4NDM; Mon, 18 Nov 2019 18:34:23 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 951002E09F; Mon, 18 Nov 2019 18:34:23 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xAIIYNEC050493; Mon, 18 Nov 2019 18:34:23 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xAIIYNvU050492; Mon, 18 Nov 2019 18:34:23 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201911181834.xAIIYNvU050492@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Mon, 18 Nov 2019 18:34:23 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354822 - head/cddl/contrib/opensolaris/cmd/dtrace X-SVN-Group: head X-SVN-Commit-Author: markj X-SVN-Commit-Paths: head/cddl/contrib/opensolaris/cmd/dtrace X-SVN-Commit-Revision: 354822 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 18 Nov 2019 18:34:23 -0000 Author: markj Date: Mon Nov 18 18:34:23 2019 New Revision: 354822 URL: https://svnweb.freebsd.org/changeset/base/354822 Log: Fix inconsistencies in anonymous DOF files. The DOF file output by dtrace -A contains only the loadable sections. However, as it was created by a call to dtrace_dof_create() without flags, the original DOF was created with the loadable sections. The result is that the DOF includes the section headers for the unloadable sections (COMMENTS and UTSNAME) without these sections actually being present. This is inconsistent. A simple change to anon_prog() ensures that the missing sections are present in the outputted DOF. Alternatively, the call to dtrace_dof_create() could pass the DTRACE_D_STRIP flag stripping out the loadable sections. As the unloadable sections contain info useful for debugging purposes they haven't been stripped. Submitted by: Graeme Jenkinson MFC after: 1 week Sponsored by: DARPA, AFRL Differential Revision: https://reviews.freebsd.org/D21875 Modified: head/cddl/contrib/opensolaris/cmd/dtrace/dtrace.c Modified: head/cddl/contrib/opensolaris/cmd/dtrace/dtrace.c ============================================================================== --- head/cddl/contrib/opensolaris/cmd/dtrace/dtrace.c Mon Nov 18 18:25:51 2019 (r354821) +++ head/cddl/contrib/opensolaris/cmd/dtrace/dtrace.c Mon Nov 18 18:34:23 2019 (r354822) @@ -681,7 +681,7 @@ anon_prog(const dtrace_cmd_t *dcp, dof_hdr_t *dof, int dfatal("failed to create DOF image for '%s'", dcp->dc_name); p = (uchar_t *)dof; - q = p + dof->dofh_loadsz; + q = p + dof->dofh_filesz; #ifdef __FreeBSD__ /* From owner-svn-src-all@freebsd.org Mon Nov 18 18:40:36 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 9478E1C687B; Mon, 18 Nov 2019 18:40:36 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47GySh3VLCz4Ndy; Mon, 18 Nov 2019 18:40:36 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 5B6C42E0CA; Mon, 18 Nov 2019 18:40:36 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xAIIeaDB050947; Mon, 18 Nov 2019 18:40:36 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xAIIeaTe050946; Mon, 18 Nov 2019 18:40:36 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201911181840.xAIIeaTe050946@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Mon, 18 Nov 2019 18:40:36 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354823 - head/sys/arm/broadcom/bcm2835 X-SVN-Group: head X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: head/sys/arm/broadcom/bcm2835 X-SVN-Commit-Revision: 354823 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 18 Nov 2019 18:40:36 -0000 Author: kevans Date: Mon Nov 18 18:40:35 2019 New Revision: 354823 URL: https://svnweb.freebsd.org/changeset/base/354823 Log: bcm2835_sdhci: push DATA_END handling out of DMA interrupt path This simplifies the DMA interrupt handler quite a bit. The sdhci framework will call platform_finish_transfer() if it's received SDHCI_INT_DATA_END, so we can take care of any final cleanup there and simply not worry about the possibility of it ending in the DMA interrupt path. Modified: head/sys/arm/broadcom/bcm2835/bcm2835_sdhci.c Modified: head/sys/arm/broadcom/bcm2835/bcm2835_sdhci.c ============================================================================== --- head/sys/arm/broadcom/bcm2835/bcm2835_sdhci.c Mon Nov 18 18:34:23 2019 (r354822) +++ head/sys/arm/broadcom/bcm2835/bcm2835_sdhci.c Mon Nov 18 18:40:35 2019 (r354823) @@ -167,6 +167,8 @@ bcm_sdhci_dmacb(void *arg, bus_dma_segment_t *segs, in struct bcm_sdhci_softc *sc = arg; int i; + /* Sanity check: we can only ever have one mapping at a time. */ + KASSERT(sc->dmamap_seg_count == 0, ("leaked DMA segment")); sc->dmamap_status = err; sc->dmamap_seg_count = nseg; @@ -546,8 +548,8 @@ bcm_sdhci_start_dma_seg(struct bcm_sdhci_softc *sc) */ if (idx == 0) { bus_dmamap_sync(sc->sc_dma_tag, sc->sc_dma_map, sync_op); - slot->intmask &= ~(SDHCI_INT_DATA_AVAIL | - SDHCI_INT_SPACE_AVAIL | SDHCI_INT_DATA_END); + slot->intmask &= ~(SDHCI_INT_DATA_AVAIL | + SDHCI_INT_SPACE_AVAIL); bcm_sdhci_write_4(sc->sc_dev, &sc->sc_slot, SDHCI_SIGNAL_ENABLE, slot->intmask); } @@ -572,8 +574,6 @@ bcm_sdhci_dma_intr(int ch, void *arg) if (slot->curcmd == NULL) { mtx_unlock(&slot->mtx); - device_printf(sc->sc_dev, - "command aborted in the middle of DMA\n"); return; } @@ -595,12 +595,15 @@ bcm_sdhci_dma_intr(int ch, void *arg) sync_op = BUS_DMASYNC_POSTWRITE; mask = SDHCI_INT_SPACE_AVAIL; } - bus_dmamap_sync(sc->sc_dma_tag, sc->sc_dma_map, sync_op); - bus_dmamap_unload(sc->sc_dma_tag, sc->sc_dma_map); - sc->dmamap_seg_count = 0; - sc->dmamap_seg_index = 0; + if (sc->dmamap_seg_count != 0) { + bus_dmamap_sync(sc->sc_dma_tag, sc->sc_dma_map, sync_op); + bus_dmamap_unload(sc->sc_dma_tag, sc->sc_dma_map); + sc->dmamap_seg_count = 0; + sc->dmamap_seg_index = 0; + } + left = min(BCM_SDHCI_BUFFER_SIZE, slot->curcmd->data->len - slot->offset); @@ -612,57 +615,40 @@ bcm_sdhci_dma_intr(int ch, void *arg) */ if (left < BCM_SDHCI_BUFFER_SIZE) { /* Re-enable data interrupts. */ - slot->intmask |= SDHCI_INT_DATA_AVAIL | SDHCI_INT_SPACE_AVAIL | - SDHCI_INT_DATA_END; + slot->intmask |= SDHCI_INT_DATA_AVAIL | SDHCI_INT_SPACE_AVAIL; bcm_sdhci_write_4(slot->bus, slot, SDHCI_SIGNAL_ENABLE, slot->intmask); mtx_unlock(&slot->mtx); return; } - /* DATA END? */ reg = bcm_sdhci_read_4(slot->bus, slot, SDHCI_INT_STATUS); - if (reg & SDHCI_INT_DATA_END) { - /* ACK for all outstanding interrupts */ - bcm_sdhci_write_4(slot->bus, slot, SDHCI_INT_STATUS, reg); + /* already available? */ + if (reg & mask) { - /* enable INT */ - slot->intmask |= SDHCI_INT_DATA_AVAIL | SDHCI_INT_SPACE_AVAIL - | SDHCI_INT_DATA_END; - bcm_sdhci_write_4(slot->bus, slot, SDHCI_SIGNAL_ENABLE, - slot->intmask); + /* ACK for DATA_AVAIL or SPACE_AVAIL */ + bcm_sdhci_write_4(slot->bus, slot, + SDHCI_INT_STATUS, mask); - /* finish this data */ - sdhci_finish_data(slot); - } - else { - /* already available? */ - if (reg & mask) { - - /* ACK for DATA_AVAIL or SPACE_AVAIL */ - bcm_sdhci_write_4(slot->bus, slot, - SDHCI_INT_STATUS, mask); - - /* continue next DMA transfer */ - if (bus_dmamap_load(sc->sc_dma_tag, sc->sc_dma_map, - (uint8_t *)slot->curcmd->data->data + - slot->offset, left, bcm_sdhci_dmacb, sc, - BUS_DMA_NOWAIT) != 0 || sc->dmamap_status != 0) { - slot->curcmd->error = MMC_ERR_NO_MEMORY; - sdhci_finish_data(slot); - } else { - bcm_sdhci_start_dma_seg(sc); - } + /* continue next DMA transfer */ + if (bus_dmamap_load(sc->sc_dma_tag, sc->sc_dma_map, + (uint8_t *)slot->curcmd->data->data + + slot->offset, left, bcm_sdhci_dmacb, sc, + BUS_DMA_NOWAIT) != 0 || sc->dmamap_status != 0) { + slot->curcmd->error = MMC_ERR_NO_MEMORY; + sdhci_finish_data(slot); } else { - /* wait for next data by INT */ - - /* enable INT */ - slot->intmask |= SDHCI_INT_DATA_AVAIL | - SDHCI_INT_SPACE_AVAIL | SDHCI_INT_DATA_END; - bcm_sdhci_write_4(slot->bus, slot, SDHCI_SIGNAL_ENABLE, - slot->intmask); + bcm_sdhci_start_dma_seg(sc); } + } else { + /* wait for next data by INT */ + + /* enable INT */ + slot->intmask |= SDHCI_INT_DATA_AVAIL | + SDHCI_INT_SPACE_AVAIL; + bcm_sdhci_write_4(slot->bus, slot, SDHCI_SIGNAL_ENABLE, + slot->intmask); } mtx_unlock(&slot->mtx); @@ -674,6 +660,7 @@ bcm_sdhci_read_dma(device_t dev, struct sdhci_slot *sl struct bcm_sdhci_softc *sc = device_get_softc(slot->bus); size_t left; + /* XXX TODO: Not many-segment safe */ if (sc->dmamap_seg_count != 0) { device_printf(sc->sc_dev, "DMA in use\n"); return; @@ -703,6 +690,7 @@ bcm_sdhci_write_dma(device_t dev, struct sdhci_slot *s struct bcm_sdhci_softc *sc = device_get_softc(slot->bus); size_t left; + /* XXX TODO: Not many-segment safe */ if (sc->dmamap_seg_count != 0) { device_printf(sc->sc_dev, "DMA in use\n"); return; @@ -764,7 +752,30 @@ bcm_sdhci_start_transfer(device_t dev, struct sdhci_sl static void bcm_sdhci_finish_transfer(device_t dev, struct sdhci_slot *slot) { + struct bcm_sdhci_softc *sc = device_get_softc(slot->bus); + /* Clean up */ + if (sc->dmamap_seg_count != 0) { + if (slot->curcmd->data->flags & MMC_DATA_READ) + bus_dmamap_sync(sc->sc_dma_tag, sc->sc_dma_map, + BUS_DMASYNC_POSTREAD); + else + bus_dmamap_sync(sc->sc_dma_tag, sc->sc_dma_map, + BUS_DMASYNC_POSTWRITE); + bus_dmamap_unload(sc->sc_dma_tag, sc->sc_dma_map); + + sc->dmamap_seg_count = 0; + sc->dmamap_seg_index = 0; + + slot->intmask |= SDHCI_INT_DATA_AVAIL | + SDHCI_INT_SPACE_AVAIL; + bcm_sdhci_write_4(slot->bus, slot, SDHCI_SIGNAL_ENABLE, + slot->intmask); + } else { + KASSERT((slot->intmask & SDHCI_INT_DATA_AVAIL) != 0 && + (slot->intmask & SDHCI_INT_SPACE_AVAIL) != 0, + ("%s: interrupt mask not restored", __func__)); + } sdhci_finish_data(slot); } From owner-svn-src-all@freebsd.org Mon Nov 18 19:05:53 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 51DB71C6D90; Mon, 18 Nov 2019 19:05:53 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47Gz1s1GSXz4PZB; Mon, 18 Nov 2019 19:05:53 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 0EDF62E606; Mon, 18 Nov 2019 19:05:53 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xAIJ5qbx068356; Mon, 18 Nov 2019 19:05:52 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xAIJ5q6A068355; Mon, 18 Nov 2019 19:05:52 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201911181905.xAIJ5q6A068355@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Mon, 18 Nov 2019 19:05:52 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354824 - head/lib/geom/part X-SVN-Group: head X-SVN-Commit-Author: markj X-SVN-Commit-Paths: head/lib/geom/part X-SVN-Commit-Revision: 354824 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 18 Nov 2019 19:05:53 -0000 Author: markj Date: Mon Nov 18 19:05:52 2019 New Revision: 354824 URL: https://svnweb.freebsd.org/changeset/base/354824 Log: Fix grammar in gpart.8. PR: 241973 MFC after: 3 days Modified: head/lib/geom/part/gpart.8 Modified: head/lib/geom/part/gpart.8 ============================================================================== --- head/lib/geom/part/gpart.8 Mon Nov 18 18:40:35 2019 (r354823) +++ head/lib/geom/part/gpart.8 Mon Nov 18 19:05:52 2019 (r354824) @@ -704,7 +704,7 @@ for APM, for GPT, and 0x0904 for VTOC8. .El .Pp -Another symbolic names that can be used with +Other symbolic names that can be used with .Cm gpart utility are: .Bl -tag -width ".Cm dragonfly-disklabel64" From owner-svn-src-all@freebsd.org Mon Nov 18 19:28:10 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id CA5BD1C746B; Mon, 18 Nov 2019 19:28:10 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47GzWZ24gBz4QYc; Mon, 18 Nov 2019 19:28:10 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 2ABAC2E9BE; Mon, 18 Nov 2019 19:28:10 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xAIJSARA080100; Mon, 18 Nov 2019 19:28:10 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xAIJSAiD080099; Mon, 18 Nov 2019 19:28:10 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201911181928.xAIJSAiD080099@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Mon, 18 Nov 2019 19:28:10 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354825 - head/sys/arm/broadcom/bcm2835 X-SVN-Group: head X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: head/sys/arm/broadcom/bcm2835 X-SVN-Commit-Revision: 354825 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 18 Nov 2019 19:28:10 -0000 Author: kevans Date: Mon Nov 18 19:28:09 2019 New Revision: 354825 URL: https://svnweb.freebsd.org/changeset/base/354825 Log: bcm2835_sdhci: use a macro for interrupts we handle This is just further simplification, very little functional change. In the DMA interrupt handler, we *do* now acknowledge both DATA_AVAIL | SPACE_AVAIL every time -- these operations are mutually exclusive, so while this is a functional change, it's effectively a nop. Removing the 'mask' local allows us to further simplify in a future change. Modified: head/sys/arm/broadcom/bcm2835/bcm2835_sdhci.c Modified: head/sys/arm/broadcom/bcm2835/bcm2835_sdhci.c ============================================================================== --- head/sys/arm/broadcom/bcm2835/bcm2835_sdhci.c Mon Nov 18 19:05:52 2019 (r354824) +++ head/sys/arm/broadcom/bcm2835/bcm2835_sdhci.c Mon Nov 18 19:28:09 2019 (r354825) @@ -68,6 +68,8 @@ __FBSDID("$FreeBSD$"); #define BCM_SDHCI_BUFFER_SIZE 512 #define NUM_DMA_SEGS 2 +#define DATA_PENDING_MASK (SDHCI_INT_DATA_AVAIL | SDHCI_INT_SPACE_AVAIL) + #ifdef DEBUG static int bcm2835_sdhci_debug = 0; @@ -548,8 +550,7 @@ bcm_sdhci_start_dma_seg(struct bcm_sdhci_softc *sc) */ if (idx == 0) { bus_dmamap_sync(sc->sc_dma_tag, sc->sc_dma_map, sync_op); - slot->intmask &= ~(SDHCI_INT_DATA_AVAIL | - SDHCI_INT_SPACE_AVAIL); + slot->intmask &= ~DATA_PENDING_MASK; bcm_sdhci_write_4(sc->sc_dev, &sc->sc_slot, SDHCI_SIGNAL_ENABLE, slot->intmask); } @@ -567,7 +568,7 @@ bcm_sdhci_dma_intr(int ch, void *arg) { struct bcm_sdhci_softc *sc = (struct bcm_sdhci_softc *)arg; struct sdhci_slot *slot = &sc->sc_slot; - uint32_t reg, mask; + uint32_t reg; int left, sync_op; mtx_lock(&slot->mtx); @@ -588,13 +589,10 @@ bcm_sdhci_dma_intr(int ch, void *arg) return; } - if (slot->curcmd->data->flags & MMC_DATA_READ) { + if (slot->curcmd->data->flags & MMC_DATA_READ) sync_op = BUS_DMASYNC_POSTREAD; - mask = SDHCI_INT_DATA_AVAIL; - } else { + else sync_op = BUS_DMASYNC_POSTWRITE; - mask = SDHCI_INT_SPACE_AVAIL; - } if (sc->dmamap_seg_count != 0) { bus_dmamap_sync(sc->sc_dma_tag, sc->sc_dma_map, sync_op); @@ -615,7 +613,7 @@ bcm_sdhci_dma_intr(int ch, void *arg) */ if (left < BCM_SDHCI_BUFFER_SIZE) { /* Re-enable data interrupts. */ - slot->intmask |= SDHCI_INT_DATA_AVAIL | SDHCI_INT_SPACE_AVAIL; + slot->intmask |= DATA_PENDING_MASK; bcm_sdhci_write_4(slot->bus, slot, SDHCI_SIGNAL_ENABLE, slot->intmask); mtx_unlock(&slot->mtx); @@ -625,11 +623,11 @@ bcm_sdhci_dma_intr(int ch, void *arg) reg = bcm_sdhci_read_4(slot->bus, slot, SDHCI_INT_STATUS); /* already available? */ - if (reg & mask) { + if ((reg & DATA_PENDING_MASK) != 0) { /* ACK for DATA_AVAIL or SPACE_AVAIL */ bcm_sdhci_write_4(slot->bus, slot, - SDHCI_INT_STATUS, mask); + SDHCI_INT_STATUS, DATA_PENDING_MASK); /* continue next DMA transfer */ if (bus_dmamap_load(sc->sc_dma_tag, sc->sc_dma_map, @@ -645,8 +643,7 @@ bcm_sdhci_dma_intr(int ch, void *arg) /* wait for next data by INT */ /* enable INT */ - slot->intmask |= SDHCI_INT_DATA_AVAIL | - SDHCI_INT_SPACE_AVAIL; + slot->intmask |= DATA_PENDING_MASK; bcm_sdhci_write_4(slot->bus, slot, SDHCI_SIGNAL_ENABLE, slot->intmask); } @@ -767,13 +764,12 @@ bcm_sdhci_finish_transfer(device_t dev, struct sdhci_s sc->dmamap_seg_count = 0; sc->dmamap_seg_index = 0; - slot->intmask |= SDHCI_INT_DATA_AVAIL | - SDHCI_INT_SPACE_AVAIL; + slot->intmask |= DATA_PENDING_MASK; bcm_sdhci_write_4(slot->bus, slot, SDHCI_SIGNAL_ENABLE, slot->intmask); } else { - KASSERT((slot->intmask & SDHCI_INT_DATA_AVAIL) != 0 && - (slot->intmask & SDHCI_INT_SPACE_AVAIL) != 0, + KASSERT((slot->intmask & DATA_PENDING_MASK) == + DATA_PENDING_MASK, ("%s: interrupt mask not restored", __func__)); } sdhci_finish_data(slot); From owner-svn-src-all@freebsd.org Mon Nov 18 19:33:05 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 3CC531C78D2; Mon, 18 Nov 2019 19:33:05 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from kib.kiev.ua (kib.kiev.ua [IPv6:2001:470:d5e7:1::1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 47GzdD6Djzz4R69; Mon, 18 Nov 2019 19:33:04 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from tom.home (kib@localhost [127.0.0.1]) by kib.kiev.ua (8.15.2/8.15.2) with ESMTPS id xAIJWvOu065648 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NO); Mon, 18 Nov 2019 21:33:00 +0200 (EET) (envelope-from kostikbel@gmail.com) DKIM-Filter: OpenDKIM Filter v2.10.3 kib.kiev.ua xAIJWvOu065648 Received: (from kostik@localhost) by tom.home (8.15.2/8.15.2/Submit) id xAIJWvJT065647; Mon, 18 Nov 2019 21:32:57 +0200 (EET) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: tom.home: kostik set sender to kostikbel@gmail.com using -f Date: Mon, 18 Nov 2019 21:32:57 +0200 From: Konstantin Belousov To: David Bright Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r354808 - in head: contrib/openbsm/etc contrib/openbsm/sys/bsm sys/bsm sys/compat/freebsd32 sys/kern sys/security/audit sys/sys tests/sys/posixshm Message-ID: <20191118193257.GO2707@kib.kiev.ua> References: <201911181331.xAIDVG75063465@repo.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <201911181331.xAIDVG75063465@repo.freebsd.org> User-Agent: Mutt/1.12.2 (2019-09-21) X-Spam-Status: No, score=-1.0 required=5.0 tests=ALL_TRUSTED,BAYES_00, DKIM_ADSP_CUSTOM_MED,FORGED_GMAIL_RCVD,FREEMAIL_FROM, NML_ADSP_CUSTOM_MED autolearn=no autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on tom.home X-Rspamd-Queue-Id: 47GzdD6Djzz4R69 X-Spamd-Bar: ----- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-5.40 / 15.00]; NEURAL_HAM_MEDIUM(-0.50)[-0.497,0]; NEURAL_HAM_LONG(-0.90)[-0.902,0]; REPLY(-4.00)[] X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 18 Nov 2019 19:33:05 -0000 On Mon, Nov 18, 2019 at 01:31:16PM +0000, David Bright wrote: > Author: dab > Date: Mon Nov 18 13:31:16 2019 > New Revision: 354808 > URL: https://svnweb.freebsd.org/changeset/base/354808 > > Log: > Jail and capability mode for shm_rename; add audit support for shm_rename > > Co-mingling two things here: > > * Addressing some feedback from Konstantin and Kyle re: jail, > capability mode, and a few other things > * Adding audit support as promised. > > The audit support change includes a partial refresh of OpenBSM from > upstream, where the change to add shm_rename has already been > accepted. Matthew doesn't plan to work on refreshing anything else to > support audit for those new event types. > > Submitted by: Matthew Bryan > Reviewed by: kib > Relnotes: Yes > Sponsored by: Dell EMC Isilon > Differential Revision: https://reviews.freebsd.org/D22083 > > Modified: > head/contrib/openbsm/etc/audit_event > head/contrib/openbsm/sys/bsm/audit_kevents.h > head/sys/bsm/audit_kevents.h > head/sys/compat/freebsd32/freebsd32_sysent.c > head/sys/compat/freebsd32/syscalls.master > head/sys/kern/init_sysent.c > head/sys/kern/syscalls.master > head/sys/kern/uipc_shm.c > head/sys/security/audit/audit_bsm.c > head/sys/sys/mman.h > head/sys/sys/sysproto.h > head/tests/sys/posixshm/posixshm_test.c At least, the generated files should be not committed together with human-written code. From owner-svn-src-all@freebsd.org Mon Nov 18 19:44:01 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 5C7621C7DD1; Mon, 18 Nov 2019 19:44:01 +0000 (UTC) (envelope-from asomers@gmail.com) Received: from mail-ot1-f45.google.com (mail-ot1-f45.google.com [209.85.210.45]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47Gzss1TzNz4Rfj; Mon, 18 Nov 2019 19:44:00 +0000 (UTC) (envelope-from asomers@gmail.com) Received: by mail-ot1-f45.google.com with SMTP id l14so15591161oti.10; Mon, 18 Nov 2019 11:44:00 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=xXTAK/o3yevO+m5KtdwHFXD1615Mz3lRqQY7CcvBLsg=; b=DNvl55Nkam+HWafWWuOLcVIdV2oeRStJi6ohSLyICdGBhXYQOrX12Yigvk8pzFjXDA YGeMbnsl621Buz9vcBQ3H1uIiOjHRnHxtLNPw530IKIKb7wYdf4BcIa9s2AusSMynocv sKMfz4GmOFZiDPyEqJZkM6dqZv+0/AV57Vnh9rpu6LKO1OFFH/JolgQ9oJyyqxZ92ktT ZoIxsFzT7ZiWef9md5EgqDTo98K7iC10V1UX/bmG5FJAuOpCmSDJ6stRHStex0uYqe77 y+91mBEKFOBY1Fq/RQCXG26/5FqOFJ2KG+WAhtgNXI4oPefAeM6/ln7AYVPgktOLwutE hWTA== X-Gm-Message-State: APjAAAVD+BC/HPbYTsyuVhYVvlgD3k3/HzQak5CU3tcBfF6pQekAeWYv UPZ2FaAQ9VUO1Dz0eypCqGFCqbN4xFgtG1fdM6iFL4ow X-Google-Smtp-Source: APXvYqx+5Ql75MMBpTjDsz0U9j4CIIuy982KFCJ8NJB6e/uHiS5AY1Au7BTKQ4/0bluwb4ByZbwuLOMXKlLlSXGVa6A= X-Received: by 2002:a9d:69cf:: with SMTP id v15mr658899oto.251.1574106239403; Mon, 18 Nov 2019 11:43:59 -0800 (PST) MIME-Version: 1.0 References: <201911181905.xAIJ5q6A068355@repo.freebsd.org> In-Reply-To: <201911181905.xAIJ5q6A068355@repo.freebsd.org> From: Alan Somers Date: Mon, 18 Nov 2019 12:43:48 -0700 Message-ID: Subject: Re: svn commit: r354824 - head/lib/geom/part To: Mark Johnston Cc: src-committers , svn-src-all , svn-src-head X-Rspamd-Queue-Id: 47Gzss1TzNz4Rfj X-Spamd-Bar: ----- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-5.93 / 15.00]; NEURAL_HAM_MEDIUM(-0.93)[-0.928,0]; NEURAL_HAM_LONG(-1.00)[-0.997,0]; REPLY(-4.00)[] Content-Type: text/plain; charset="UTF-8" X-Content-Filtered-By: Mailman/MimeDel 2.1.29 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 18 Nov 2019 19:44:01 -0000 On Mon, Nov 18, 2019 at 12:06 PM Mark Johnston wrote: > Author: markj > Date: Mon Nov 18 19:05:52 2019 > New Revision: 354824 > URL: https://svnweb.freebsd.org/changeset/base/354824 > > Log: > Fix grammar in gpart.8. > > PR: 241973 > MFC after: 3 days > > Modified: > head/lib/geom/part/gpart.8 > Don't forget to bump the .Dd date. From owner-svn-src-all@freebsd.org Mon Nov 18 19:48:11 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 5612B1C8093; Mon, 18 Nov 2019 19:48:11 +0000 (UTC) (envelope-from markjdb@gmail.com) Received: from mail-qk1-x730.google.com (mail-qk1-x730.google.com [IPv6:2607:f8b0:4864:20::730]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47Gzyg0XWqz4S3x; Mon, 18 Nov 2019 19:48:10 +0000 (UTC) (envelope-from markjdb@gmail.com) Received: by mail-qk1-x730.google.com with SMTP id 15so15561077qkh.6; Mon, 18 Nov 2019 11:48:10 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=3Yb3IwMSRsQat/X5ceLrXj7Fe0+hABtnewWweqXnor4=; b=Z9/Yzctpygb8JexBZJXkw72mJQsV9s4wiPFUvjOKN44k6N+VdpnhfPXsPZfrhNGzGn 1LtvxVspSY785Aoqojb3xSjH/vp6MGx+LM5JytzV2kuR0QSsZXtbj9tIEpSFzQ1923JH QPE8e3e3jMcnrXZKX72OJ1W433NMvfNcApJGUDVgNwdBDZNvFn3Srw1/OODaiZWoURpT 9xyaohGU3GPxhO8DU5nr0vFA2vwYnoLeeGyuiM5OKIiq+llmcVfnl1vQsEQu1KAyBF7w gH2inKa6D9hWY4Ej4Dhwj/Qt2yOLuwSXEZ/dcDMrN2DBx6GSysYhjXQrqnUYvHsZ4qoo zPvA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:date:from:to:cc:subject:message-id :references:mime-version:content-disposition:in-reply-to:user-agent; bh=3Yb3IwMSRsQat/X5ceLrXj7Fe0+hABtnewWweqXnor4=; b=fp79hYifaYVr8x9i6XEjAfBNsUSUQFWzaAYJLyNpj6EmJCkEL0+Y+rx4Qr9zDHVguY xmfvCoqr1byFK2qgNLjovL5Zeq1Je1GcbAHMhZD3vV5MD/NxBODr/G8jL5Z2/ashPes6 NEpRL9bQolHPNrL2UAu3rf9sZcQyjpeHkrPDKQeNZqz0+YK0VO1o87QhP/KQXglUSNap MIwK3DsVOtnVN93DiKibLfu9axW76QUYFzDv8CjZeceqI7BxsYkdbWAYQD9BJIOcl//G DRMZTWXw36+eNbzMTaIuYuAvtTP5mNgTQACNQ8APDFsKXG8CWHoqIsJvbO0IbzcGcknf FhXQ== X-Gm-Message-State: APjAAAXN6fW5rvgxWZtHvvSYXz6his9PgNz0ZrSkaHSoC8JWrpeFw0AN cBPLB9Zdd/yzpp/ETdeQwKa0qJN5iYM= X-Google-Smtp-Source: APXvYqx9YIPYn48fVXtjPxVetKlkIkjYbR4DhSHfVX4yqqSsmNTc91jk9FdvkPxlvBUMSxtbBIpB5g== X-Received: by 2002:a37:a104:: with SMTP id k4mr12957961qke.412.1574106489027; Mon, 18 Nov 2019 11:48:09 -0800 (PST) Received: from raichu (toroon0560w-lp130-05-69-158-183-252.dsl.bell.ca. [69.158.183.252]) by smtp.gmail.com with ESMTPSA id n49sm11035174qtk.94.2019.11.18.11.48.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 18 Nov 2019 11:48:08 -0800 (PST) Sender: Mark Johnston Date: Mon, 18 Nov 2019 14:45:01 -0500 From: Mark Johnston To: Alan Somers Cc: src-committers , svn-src-all , svn-src-head Subject: Re: svn commit: r354824 - head/lib/geom/part Message-ID: <20191118194501.GA43295@raichu> References: <201911181905.xAIJ5q6A068355@repo.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.12.2 (2019-09-21) X-Rspamd-Queue-Id: 47Gzyg0XWqz4S3x X-Spamd-Bar: ----- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-5.81 / 15.00]; NEURAL_HAM_MEDIUM(-0.82)[-0.818,0]; REPLY(-4.00)[]; NEURAL_HAM_LONG(-0.99)[-0.994,0] X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 18 Nov 2019 19:48:11 -0000 On Mon, Nov 18, 2019 at 12:43:48PM -0700, Alan Somers wrote: > On Mon, Nov 18, 2019 at 12:06 PM Mark Johnston wrote: > > > Author: markj > > Date: Mon Nov 18 19:05:52 2019 > > New Revision: 354824 > > URL: https://svnweb.freebsd.org/changeset/base/354824 > > > > Log: > > Fix grammar in gpart.8. > > > > PR: 241973 > > MFC after: 3 days > > > > Modified: > > head/lib/geom/part/gpart.8 > > > > Don't forget to bump the .Dd date. AFAIK we do not bump .Dd for such changes, only for content changes. From owner-svn-src-all@freebsd.org Mon Nov 18 20:03:30 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 755F31C8728; Mon, 18 Nov 2019 20:03:30 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47H0JL2Xtwz4T1g; Mon, 18 Nov 2019 20:03:30 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 3B4CA2F0F7; Mon, 18 Nov 2019 20:03:30 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xAIK3UYa003390; Mon, 18 Nov 2019 20:03:30 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xAIK3SOb003384; Mon, 18 Nov 2019 20:03:28 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201911182003.xAIK3SOb003384@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Mon, 18 Nov 2019 20:03:28 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354826 - in head/sys: amd64/conf arm/conf arm64/conf i386/conf powerpc/conf sparc64/conf X-SVN-Group: head X-SVN-Commit-Author: markj X-SVN-Commit-Paths: in head/sys: amd64/conf arm/conf arm64/conf i386/conf powerpc/conf sparc64/conf X-SVN-Commit-Revision: 354826 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 18 Nov 2019 20:03:30 -0000 Author: markj Date: Mon Nov 18 20:03:28 2019 New Revision: 354826 URL: https://svnweb.freebsd.org/changeset/base/354826 Log: Set MALLOC_DEBUG_MAXZONES=1 in GENERIC-NODEBUG configurations. The purpose of this option is to make it easier to track down memory corruption bugs by reducing the number of malloc(9) types that might have recently been associated with a given chunk of memory. However, it increases fragmentation and is disabled in release kernels. MFC after: 2 weeks Sponsored by: The FreeBSD Foundation Modified: head/sys/amd64/conf/GENERIC-NODEBUG head/sys/arm/conf/GENERIC-NODEBUG head/sys/arm64/conf/GENERIC-NODEBUG head/sys/i386/conf/GENERIC-NODEBUG head/sys/powerpc/conf/GENERIC-NODEBUG head/sys/powerpc/conf/GENERIC64-NODEBUG head/sys/sparc64/conf/GENERIC-NODEBUG Modified: head/sys/amd64/conf/GENERIC-NODEBUG ============================================================================== --- head/sys/amd64/conf/GENERIC-NODEBUG Mon Nov 18 19:28:09 2019 (r354825) +++ head/sys/amd64/conf/GENERIC-NODEBUG Mon Nov 18 20:03:28 2019 (r354826) @@ -39,3 +39,4 @@ nooptions DEADLKRES nooptions FULL_BUF_TRACKING nooptions COVERAGE nooptions KCOV +nooptions MALLOC_DEBUG_MAXZONES Modified: head/sys/arm/conf/GENERIC-NODEBUG ============================================================================== --- head/sys/arm/conf/GENERIC-NODEBUG Mon Nov 18 19:28:09 2019 (r354825) +++ head/sys/arm/conf/GENERIC-NODEBUG Mon Nov 18 20:03:28 2019 (r354826) @@ -35,4 +35,4 @@ nooptions INVARIANT_SUPPORT nooptions WITNESS nooptions WITNESS_SKIPSPIN nooptions DEADLKRES - +nooptions MALLOC_DEBUG_MAXZONES Modified: head/sys/arm64/conf/GENERIC-NODEBUG ============================================================================== --- head/sys/arm64/conf/GENERIC-NODEBUG Mon Nov 18 19:28:09 2019 (r354825) +++ head/sys/arm64/conf/GENERIC-NODEBUG Mon Nov 18 20:03:28 2019 (r354826) @@ -38,3 +38,4 @@ nooptions DEADLKRES nooptions USB_DEBUG nooptions COVERAGE nooptions KCOV +nooptions MALLOC_DEBUG_MAXZONES Modified: head/sys/i386/conf/GENERIC-NODEBUG ============================================================================== --- head/sys/i386/conf/GENERIC-NODEBUG Mon Nov 18 19:28:09 2019 (r354825) +++ head/sys/i386/conf/GENERIC-NODEBUG Mon Nov 18 20:03:28 2019 (r354826) @@ -35,4 +35,4 @@ nooptions INVARIANT_SUPPORT nooptions WITNESS nooptions WITNESS_SKIPSPIN nooptions DEADLKRES - +nooptions MALLOC_DEBUG_MAXZONES Modified: head/sys/powerpc/conf/GENERIC-NODEBUG ============================================================================== --- head/sys/powerpc/conf/GENERIC-NODEBUG Mon Nov 18 19:28:09 2019 (r354825) +++ head/sys/powerpc/conf/GENERIC-NODEBUG Mon Nov 18 20:03:28 2019 (r354826) @@ -35,4 +35,4 @@ nooptions INVARIANT_SUPPORT nooptions WITNESS nooptions WITNESS_SKIPSPIN nooptions DEADLKRES - +nooptions MALLOC_DEBUG_MAXZONES Modified: head/sys/powerpc/conf/GENERIC64-NODEBUG ============================================================================== --- head/sys/powerpc/conf/GENERIC64-NODEBUG Mon Nov 18 19:28:09 2019 (r354825) +++ head/sys/powerpc/conf/GENERIC64-NODEBUG Mon Nov 18 20:03:28 2019 (r354826) @@ -35,3 +35,4 @@ nooptions INVARIANT_SUPPORT nooptions WITNESS nooptions WITNESS_SKIPSPIN nooptions DEADLKRES +nooptions MALLOC_DEBUG_MAXZONES Modified: head/sys/sparc64/conf/GENERIC-NODEBUG ============================================================================== --- head/sys/sparc64/conf/GENERIC-NODEBUG Mon Nov 18 19:28:09 2019 (r354825) +++ head/sys/sparc64/conf/GENERIC-NODEBUG Mon Nov 18 20:03:28 2019 (r354826) @@ -35,4 +35,4 @@ nooptions INVARIANT_SUPPORT nooptions WITNESS nooptions WITNESS_SKIPSPIN nooptions DEADLKRES - +nooptions MALLOC_DEBUG_MAXZONES From owner-svn-src-all@freebsd.org Mon Nov 18 20:07:46 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 6402D1C87DA; Mon, 18 Nov 2019 20:07:46 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47H0PG24KWz4TFK; Mon, 18 Nov 2019 20:07:46 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 2A11C2F0FD; Mon, 18 Nov 2019 20:07:46 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xAIK7kQn003629; Mon, 18 Nov 2019 20:07:46 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xAIK7hZP003616; Mon, 18 Nov 2019 20:07:43 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <201911182007.xAIK7hZP003616@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Mon, 18 Nov 2019 20:07:43 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354827 - in head/sys: amd64/linux amd64/linux32 arm64/linux compat/cloudabi32 compat/cloudabi64 compat/freebsd32 i386/linux kern sys X-SVN-Group: head X-SVN-Commit-Author: jhb X-SVN-Commit-Paths: in head/sys: amd64/linux amd64/linux32 arm64/linux compat/cloudabi32 compat/cloudabi64 compat/freebsd32 i386/linux kern sys X-SVN-Commit-Revision: 354827 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 18 Nov 2019 20:07:46 -0000 Author: jhb Date: Mon Nov 18 20:07:43 2019 New Revision: 354827 URL: https://svnweb.freebsd.org/changeset/base/354827 Log: Check for errors from copyout() and suword*() in sv_copyout_args/strings. Reviewed by: brooks, kib Tested on: amd64 (amd64, i386, linux64), i386 (i386, linux) Sponsored by: DARPA Differential Revision: https://reviews.freebsd.org/D22401 Modified: head/sys/amd64/linux/linux_sysvec.c head/sys/amd64/linux32/linux32_sysvec.c head/sys/arm64/linux/linux_sysvec.c head/sys/compat/cloudabi32/cloudabi32_module.c head/sys/compat/cloudabi32/cloudabi32_util.h head/sys/compat/cloudabi64/cloudabi64_module.c head/sys/compat/cloudabi64/cloudabi64_util.h head/sys/compat/freebsd32/freebsd32_misc.c head/sys/compat/freebsd32/freebsd32_util.h head/sys/i386/linux/linux_sysvec.c head/sys/kern/imgact_elf.c head/sys/kern/kern_exec.c head/sys/sys/imgact.h head/sys/sys/imgact_elf.h head/sys/sys/sysent.h Modified: head/sys/amd64/linux/linux_sysvec.c ============================================================================== --- head/sys/amd64/linux/linux_sysvec.c Mon Nov 18 20:03:28 2019 (r354826) +++ head/sys/amd64/linux/linux_sysvec.c Mon Nov 18 20:07:43 2019 (r354827) @@ -96,7 +96,8 @@ extern struct sysent linux_sysent[LINUX_SYS_MAXSYSCALL SET_DECLARE(linux_ioctl_handler_set, struct linux_ioctl_handler); -static register_t * linux_copyout_strings(struct image_params *imgp); +static int linux_copyout_strings(struct image_params *imgp, + register_t **stack_base); static int linux_fixup_elf(register_t **stack_base, struct image_params *iparams); static bool linux_trans_osrel(const Elf_Note *note, int32_t *osrel); @@ -222,14 +223,14 @@ linux_set_syscall_retval(struct thread *td, int error) set_pcb_flags(td->td_pcb, PCB_FULL_IRET); } -static void +static int linux_copyout_auxargs(struct image_params *imgp, u_long *base) { Elf_Auxargs *args; Elf_Auxinfo *argarray, *pos; u_long auxlen; struct proc *p; - int issetugid; + int error, issetugid; p = imgp->proc; args = (Elf64_Auxargs *)imgp->auxargs; @@ -267,8 +268,9 @@ linux_copyout_auxargs(struct image_params *imgp, u_lon auxlen = sizeof(*argarray) * (pos - argarray); *base -= auxlen; - copyout(argarray, (void *)*base, auxlen); + error = copyout(argarray, (void *)*base, auxlen); free(argarray, M_TEMP); + return (error); } static int @@ -290,13 +292,12 @@ linux_fixup_elf(register_t **stack_base, struct image_ * and env vector tables. Return a pointer to the base so that it can be used * as the initial stack pointer. */ -static register_t * -linux_copyout_strings(struct image_params *imgp) +static int +linux_copyout_strings(struct image_params *imgp, register_t **stack_base) { - int argc, envc; + int argc, envc, error; char **vectp; char *stringp, *destp; - register_t *stack_base; struct ps_strings *arginfo; char canary[LINUX_AT_RANDOM_LEN]; size_t execpath_len; @@ -317,7 +318,10 @@ linux_copyout_strings(struct image_params *imgp) if (execpath_len != 0) { imgp->execpathp = (uintptr_t)arginfo - execpath_len; - copyout(imgp->execpath, (void *)imgp->execpathp, execpath_len); + error = copyout(imgp->execpath, (void *)imgp->execpathp, + execpath_len); + if (error != 0) + return (error); } /* Prepare the canary for SSP. */ @@ -325,7 +329,9 @@ linux_copyout_strings(struct image_params *imgp) imgp->canary = (uintptr_t)arginfo - roundup(execpath_len, sizeof(char *)) - roundup(sizeof(canary), sizeof(char *)); - copyout(canary, (void *)imgp->canary, sizeof(canary)); + error = copyout(canary, (void *)imgp->canary, sizeof(canary)); + if (error != 0) + return (error); vectp = (char **)destp; @@ -335,8 +341,12 @@ linux_copyout_strings(struct image_params *imgp) */ vectp = (char **)((((uintptr_t)vectp + 8) & ~0xF) - 8); - if (imgp->auxargs) - imgp->sysent->sv_copyout_auxargs(imgp, (u_long *)&vectp); + if (imgp->auxargs) { + error = imgp->sysent->sv_copyout_auxargs(imgp, + (u_long *)&vectp); + if (error != 0) + return (error); + } /* * Allocate room for the argv[] and env vectors including the @@ -345,44 +355,53 @@ linux_copyout_strings(struct image_params *imgp) vectp -= imgp->args->argc + 1 + imgp->args->envc + 1; /* vectp also becomes our initial stack base. */ - stack_base = (register_t *)vectp; + *stack_base = (register_t *)vectp; stringp = imgp->args->begin_argv; argc = imgp->args->argc; envc = imgp->args->envc; /* Copy out strings - arguments and environment. */ - copyout(stringp, destp, ARG_MAX - imgp->args->stringspace); + error = copyout(stringp, destp, ARG_MAX - imgp->args->stringspace); + if (error != 0) + return (error); /* Fill in "ps_strings" struct for ps, w, etc. */ - suword(&arginfo->ps_argvstr, (long)(intptr_t)vectp); - suword(&arginfo->ps_nargvstr, argc); + if (suword(&arginfo->ps_argvstr, (long)(intptr_t)vectp) != 0 || + suword(&arginfo->ps_nargvstr, argc) != 0) + return (EFAULT); /* Fill in argument portion of vector table. */ for (; argc > 0; --argc) { - suword(vectp++, (long)(intptr_t)destp); + if (suword(vectp++, (long)(intptr_t)destp) != 0) + return (EFAULT); while (*stringp++ != 0) destp++; destp++; } /* A null vector table pointer separates the argp's from the envp's. */ - suword(vectp++, 0); + if (suword(vectp++, 0) != 0) + return (EFAULT); - suword(&arginfo->ps_envstr, (long)(intptr_t)vectp); - suword(&arginfo->ps_nenvstr, envc); + if (suword(&arginfo->ps_envstr, (long)(intptr_t)vectp) != 0 || + suword(&arginfo->ps_nenvstr, envc) != 0) + return (EFAULT); /* Fill in environment portion of vector table. */ for (; envc > 0; --envc) { - suword(vectp++, (long)(intptr_t)destp); + if (suword(vectp++, (long)(intptr_t)destp) != 0) + return (EFAULT); while (*stringp++ != 0) destp++; destp++; } /* The end of the vector table is a null pointer. */ - suword(vectp, 0); - return (stack_base); + if (suword(vectp, 0) != 0) + return (EFAULT); + + return (0); } /* Modified: head/sys/amd64/linux32/linux32_sysvec.c ============================================================================== --- head/sys/amd64/linux32/linux32_sysvec.c Mon Nov 18 20:03:28 2019 (r354826) +++ head/sys/amd64/linux32/linux32_sysvec.c Mon Nov 18 20:07:43 2019 (r354827) @@ -103,7 +103,8 @@ SET_DECLARE(linux_ioctl_handler_set, struct linux_ioct static int linux_fixup_elf(register_t **stack_base, struct image_params *iparams); -static register_t *linux_copyout_strings(struct image_params *imgp); +static int linux_copyout_strings(struct image_params *imgp, + register_t **stack_base); static void linux_sendsig(sig_t catcher, ksiginfo_t *ksi, sigset_t *mask); static void linux_exec_setregs(struct thread *td, struct image_params *imgp, u_long stack); @@ -185,13 +186,13 @@ linux_translate_traps(int signal, int trap_code) } } -static void +static int linux_copyout_auxargs(struct image_params *imgp, u_long *base) { Elf32_Auxargs *args; Elf32_Auxinfo *argarray, *pos; u_long auxlen; - int issetugid; + int error, issetugid; args = (Elf32_Auxargs *)imgp->auxargs; argarray = pos = malloc(LINUX_AT_COUNT * sizeof(*pos), M_TEMP, @@ -239,8 +240,9 @@ linux_copyout_auxargs(struct image_params *imgp, u_lon auxlen = sizeof(*argarray) * (pos - argarray); *base -= auxlen; - copyout(argarray, (void *)*base, auxlen); + error = copyout(argarray, (void *)*base, auxlen); free(argarray, M_TEMP); + return (error); } static int @@ -718,13 +720,12 @@ linux_exec_setregs(struct thread *td, struct image_par /* * XXX copied from ia32_sysvec.c. */ -static register_t * -linux_copyout_strings(struct image_params *imgp) +static int +linux_copyout_strings(struct image_params *imgp, register_t **stack_base) { - int argc, envc; + int argc, envc, error; u_int32_t *vectp; char *stringp, *destp; - u_int32_t *stack_base; struct linux32_ps_strings *arginfo; char canary[LINUX_AT_RANDOM_LEN]; size_t execpath_len; @@ -743,7 +744,10 @@ linux_copyout_strings(struct image_params *imgp) if (execpath_len != 0) { imgp->execpathp = (uintptr_t)arginfo - execpath_len; - copyout(imgp->execpath, (void *)imgp->execpathp, execpath_len); + error = copyout(imgp->execpath, (void *)imgp->execpathp, + execpath_len); + if (error != 0) + return (error); } /* Prepare the canary for SSP. */ @@ -751,11 +755,17 @@ linux_copyout_strings(struct image_params *imgp) imgp->canary = (uintptr_t)arginfo - roundup(execpath_len, sizeof(char *)) - roundup(sizeof(canary), sizeof(char *)); - copyout(canary, (void *)imgp->canary, sizeof(canary)); + error = copyout(canary, (void *)imgp->canary, sizeof(canary)); + if (error != 0) + return (error); vectp = (uint32_t *)destp; - if (imgp->auxargs) - imgp->sysent->sv_copyout_auxargs(imgp, (u_long *)&vectp); + if (imgp->auxargs) { + error = imgp->sysent->sv_copyout_auxargs(imgp, + (u_long *)&vectp); + if (error != 0) + return (error); + } /* * Allocate room for the argv[] and env vectors including the @@ -764,44 +774,52 @@ linux_copyout_strings(struct image_params *imgp) vectp -= imgp->args->argc + 1 + imgp->args->envc + 1; /* vectp also becomes our initial stack base. */ - stack_base = vectp; + *stack_base = (register_t *)vectp; stringp = imgp->args->begin_argv; argc = imgp->args->argc; envc = imgp->args->envc; /* Copy out strings - arguments and environment. */ - copyout(stringp, destp, ARG_MAX - imgp->args->stringspace); + error = copyout(stringp, destp, ARG_MAX - imgp->args->stringspace); + if (error != 0) + return (error); /* Fill in "ps_strings" struct for ps, w, etc. */ - suword32(&arginfo->ps_argvstr, (uint32_t)(intptr_t)vectp); - suword32(&arginfo->ps_nargvstr, argc); + if (suword32(&arginfo->ps_argvstr, (uint32_t)(intptr_t)vectp) != 0 || + suword32(&arginfo->ps_nargvstr, argc) != 0) + return (EFAULT); /* Fill in argument portion of vector table. */ for (; argc > 0; --argc) { - suword32(vectp++, (uint32_t)(intptr_t)destp); + if (suword32(vectp++, (uint32_t)(intptr_t)destp) != 0) + return (EFAULT); while (*stringp++ != 0) destp++; destp++; } /* A null vector table pointer separates the argp's from the envp's. */ - suword32(vectp++, 0); + if (suword32(vectp++, 0) != 0) + return (EFAULT); - suword32(&arginfo->ps_envstr, (uint32_t)(intptr_t)vectp); - suword32(&arginfo->ps_nenvstr, envc); + if (suword32(&arginfo->ps_envstr, (uint32_t)(intptr_t)vectp) != 0 || + suword32(&arginfo->ps_nenvstr, envc) != 0) + return (EFAULT); /* Fill in environment portion of vector table. */ for (; envc > 0; --envc) { - suword32(vectp++, (uint32_t)(intptr_t)destp); + if (suword32(vectp++, (uint32_t)(intptr_t)destp) != 0) + return (EFAULT); while (*stringp++ != 0) destp++; destp++; } /* The end of the vector table is a null pointer. */ - suword32(vectp, 0); + if (suword32(vectp, 0) != 0) + return (EFAULT); - return ((register_t *)stack_base); + return (0); } static SYSCTL_NODE(_compat, OID_AUTO, linux32, CTLFLAG_RW, 0, Modified: head/sys/arm64/linux/linux_sysvec.c ============================================================================== --- head/sys/arm64/linux/linux_sysvec.c Mon Nov 18 20:03:28 2019 (r354826) +++ head/sys/arm64/linux/linux_sysvec.c Mon Nov 18 20:07:43 2019 (r354827) @@ -69,7 +69,8 @@ extern struct sysent linux_sysent[LINUX_SYS_MAXSYSCALL SET_DECLARE(linux_ioctl_handler_set, struct linux_ioctl_handler); -static register_t *linux_copyout_strings(struct image_params *imgp); +static int linux_copyout_strings(struct image_params *imgp, + register_t **stack_base); static int linux_elf_fixup(register_t **stack_base, struct image_params *iparams); static bool linux_trans_osrel(const Elf_Note *note, int32_t *osrel); @@ -141,14 +142,14 @@ linux_set_syscall_retval(struct thread *td, int error) cpu_set_syscall_retval(td, error); } -static void +static int linux_copyout_auxargs(struct image_params *imgp, u_long *base) { Elf_Auxargs *args; Elf_Auxinfo *argarray, *pos; u_long auxlen; struct proc *p; - int issetugid; + int error, issetugid; LIN_SDT_PROBE0(sysvec, linux_copyout_auxargs, todo); p = imgp->proc; @@ -191,8 +192,9 @@ linux_copyout_auxargs(struct image_params *imgp, u_lon auxlen = sizeof(*argarray) * (pos - argarray); *base -= auxlen; - copyout(argarray, (void *)*base, auxlen); + error = copyout(argarray, (void *)*base, auxlen); free(argarray, M_TEMP); + return (error); } static int @@ -210,17 +212,16 @@ linux_elf_fixup(register_t **stack_base, struct image_ * as the initial stack pointer. * LINUXTODO: deduplicate against other linuxulator archs */ -static register_t * -linux_copyout_strings(struct image_params *imgp) +static int +linux_copyout_strings(struct image_params *imgp, register_t **stack_base) { char **vectp; char *stringp, *destp; - register_t *stack_base; struct ps_strings *arginfo; char canary[LINUX_AT_RANDOM_LEN]; size_t execpath_len; struct proc *p; - int argc, envc; + int argc, envc, error; /* Calculate string base and vector table pointers. */ if (imgp->execpath != NULL && imgp->auxargs != NULL) @@ -237,7 +238,10 @@ linux_copyout_strings(struct image_params *imgp) if (execpath_len != 0) { imgp->execpathp = (uintptr_t)arginfo - execpath_len; - copyout(imgp->execpath, (void *)imgp->execpathp, execpath_len); + error = copyout(imgp->execpath, (void *)imgp->execpathp, + execpath_len); + if (error != 0) + return (error); } /* Prepare the canary for SSP. */ @@ -245,11 +249,17 @@ linux_copyout_strings(struct image_params *imgp) imgp->canary = (uintptr_t)arginfo - roundup(execpath_len, sizeof(char *)) - roundup(sizeof(canary), sizeof(char *)); - copyout(canary, (void *)imgp->canary, sizeof(canary)); + error = copyout(canary, (void *)imgp->canary, sizeof(canary)); + if (error != 0) + return (error); vectp = (char **)destp; - if (imgp->auxargs) - imgp->sysent->sv_copyout_auxargs(imgp, (u_long *)&vectp); + if (imgp->auxargs) { + error = imgp->sysent->sv_copyout_auxargs(imgp, + (u_long *)&vectp); + if (error != 0) + return (error); + } /* * Allocate room for argc and the argv[] and env vectors including the @@ -259,45 +269,56 @@ linux_copyout_strings(struct image_params *imgp) vectp = (char **)STACKALIGN(vectp); /* vectp also becomes our initial stack base. */ - stack_base = (register_t *)vectp; + *stack_base = (register_t *)vectp; stringp = imgp->args->begin_argv; argc = imgp->args->argc; envc = imgp->args->envc; /* Copy out strings - arguments and environment. */ - copyout(stringp, destp, ARG_MAX - imgp->args->stringspace); + error = copyout(stringp, destp, ARG_MAX - imgp->args->stringspace); + if (error != 0) + return (error); /* Fill in "ps_strings" struct for ps, w, etc. */ - suword(&arginfo->ps_argvstr, (long)(intptr_t)vectp); - suword(&arginfo->ps_nargvstr, argc); + if (suword(&arginfo->ps_argvstr, (long)(intptr_t)vectp) != 0 || + suword(&arginfo->ps_nargvstr, argc) != 0) + return (EFAULT); - suword(vectp++, argc); + if (suword(vectp++, argc) != 0) + return (EFAULT); + /* Fill in argument portion of vector table. */ for (; argc > 0; --argc) { - suword(vectp++, (long)(intptr_t)destp); + if (suword(vectp++, (long)(intptr_t)destp) != 0) + return (EFAULT); while (*stringp++ != 0) destp++; destp++; } /* A null vector table pointer separates the argp's from the envp's. */ - suword(vectp++, 0); + if (suword(vectp++, 0) != 0) + return (EFAULT); - suword(&arginfo->ps_envstr, (long)(intptr_t)vectp); - suword(&arginfo->ps_nenvstr, envc); + if (suword(&arginfo->ps_envstr, (long)(intptr_t)vectp) != 0 || + suword(&arginfo->ps_nenvstr, envc) != 0) + return (EFAULT); /* Fill in environment portion of vector table. */ for (; envc > 0; --envc) { - suword(vectp++, (long)(intptr_t)destp); + if (suword(vectp++, (long)(intptr_t)destp) != 0) + return (EFAULT); while (*stringp++ != 0) destp++; destp++; } /* The end of the vector table is a null pointer. */ - suword(vectp, 0); - return (stack_base); + if (suword(vectp, 0) != 0) + return (EFAULT); + + return (0); } /* Modified: head/sys/compat/cloudabi32/cloudabi32_module.c ============================================================================== --- head/sys/compat/cloudabi32/cloudabi32_module.c Mon Nov 18 20:03:28 2019 (r354826) +++ head/sys/compat/cloudabi32/cloudabi32_module.c Mon Nov 18 20:07:43 2019 (r354827) @@ -45,8 +45,8 @@ __FBSDID("$FreeBSD$"); extern char _binary_cloudabi32_vdso_o_start[]; extern char _binary_cloudabi32_vdso_o_end[]; -register_t * -cloudabi32_copyout_strings(struct image_params *imgp) +int +cloudabi32_copyout_strings(struct image_params *imgp, register_t **stack_base) { struct image_args *args; uintptr_t begin; @@ -56,8 +56,8 @@ cloudabi32_copyout_strings(struct image_params *imgp) args = imgp->args; len = exec_args_get_begin_envv(args) - args->begin_argv; begin = rounddown2(imgp->sysent->sv_usrstack - len, sizeof(register_t)); - copyout(args->begin_argv, (void *)begin, len); - return ((register_t *)begin); + *stack_base = (register_t *)begin; + return (copyout(args->begin_argv, (void *)begin, len)); } int Modified: head/sys/compat/cloudabi32/cloudabi32_util.h ============================================================================== --- head/sys/compat/cloudabi32/cloudabi32_util.h Mon Nov 18 20:03:28 2019 (r354826) +++ head/sys/compat/cloudabi32/cloudabi32_util.h Mon Nov 18 20:07:43 2019 (r354827) @@ -42,7 +42,7 @@ extern Elf32_Brandinfo cloudabi32_brand; #define TO_PTR(x) ((void *)(uintptr_t)(x)) /* Stack initialization during process execution. */ -register_t *cloudabi32_copyout_strings(struct image_params *); +int cloudabi32_copyout_strings(struct image_params *, register_t **); int cloudabi32_fixup(register_t **, struct image_params *); int cloudabi32_thread_setregs(struct thread *, Modified: head/sys/compat/cloudabi64/cloudabi64_module.c ============================================================================== --- head/sys/compat/cloudabi64/cloudabi64_module.c Mon Nov 18 20:03:28 2019 (r354826) +++ head/sys/compat/cloudabi64/cloudabi64_module.c Mon Nov 18 20:07:43 2019 (r354827) @@ -45,8 +45,8 @@ __FBSDID("$FreeBSD$"); extern char _binary_cloudabi64_vdso_o_start[]; extern char _binary_cloudabi64_vdso_o_end[]; -register_t * -cloudabi64_copyout_strings(struct image_params *imgp) +int +cloudabi64_copyout_strings(struct image_params *imgp, register_t **stack_base) { struct image_args *args; uintptr_t begin; @@ -56,8 +56,8 @@ cloudabi64_copyout_strings(struct image_params *imgp) args = imgp->args; len = exec_args_get_begin_envv(args) - args->begin_argv; begin = rounddown2(imgp->sysent->sv_usrstack - len, sizeof(register_t)); - copyout(args->begin_argv, (void *)begin, len); - return ((register_t *)begin); + *stack_base = (register_t *)begin; + return (copyout(args->begin_argv, (void *)begin, len)); } int Modified: head/sys/compat/cloudabi64/cloudabi64_util.h ============================================================================== --- head/sys/compat/cloudabi64/cloudabi64_util.h Mon Nov 18 20:03:28 2019 (r354826) +++ head/sys/compat/cloudabi64/cloudabi64_util.h Mon Nov 18 20:07:43 2019 (r354827) @@ -42,7 +42,7 @@ extern Elf64_Brandinfo cloudabi64_brand; #define TO_PTR(x) ((void *)(uintptr_t)(x)) /* Stack initialization during process execution. */ -register_t *cloudabi64_copyout_strings(struct image_params *); +int cloudabi64_copyout_strings(struct image_params *, register_t **); int cloudabi64_fixup(register_t **, struct image_params *); int cloudabi64_thread_setregs(struct thread *, Modified: head/sys/compat/freebsd32/freebsd32_misc.c ============================================================================== --- head/sys/compat/freebsd32/freebsd32_misc.c Mon Nov 18 20:03:28 2019 (r354826) +++ head/sys/compat/freebsd32/freebsd32_misc.c Mon Nov 18 20:07:43 2019 (r354827) @@ -3119,19 +3119,18 @@ syscall32_helper_unregister(struct syscall_helper_data return (kern_syscall_helper_unregister(freebsd32_sysent, sd)); } -register_t * -freebsd32_copyout_strings(struct image_params *imgp) +int +freebsd32_copyout_strings(struct image_params *imgp, register_t **stack_base) { int argc, envc, i; u_int32_t *vectp; char *stringp; uintptr_t destp; - u_int32_t *stack_base; struct freebsd32_ps_strings *arginfo; char canary[sizeof(long) * 8]; int32_t pagesizes32[MAXPAGESIZES]; size_t execpath_len; - int szsigcode; + int error, szsigcode; /* * Calculate string base and vector table pointers. @@ -3155,8 +3154,10 @@ freebsd32_copyout_strings(struct image_params *imgp) if (szsigcode != 0) { destp -= szsigcode; destp = rounddown2(destp, sizeof(uint32_t)); - copyout(imgp->proc->p_sysent->sv_sigcode, (void *)destp, + error = copyout(imgp->proc->p_sysent->sv_sigcode, (void *)destp, szsigcode); + if (error != 0) + return (error); } /* @@ -3165,7 +3166,9 @@ freebsd32_copyout_strings(struct image_params *imgp) if (execpath_len != 0) { destp -= execpath_len; imgp->execpathp = destp; - copyout(imgp->execpath, (void *)destp, execpath_len); + error = copyout(imgp->execpath, (void *)destp, execpath_len); + if (error != 0) + return (error); } /* @@ -3174,7 +3177,9 @@ freebsd32_copyout_strings(struct image_params *imgp) arc4rand(canary, sizeof(canary), 0); destp -= sizeof(canary); imgp->canary = destp; - copyout(canary, (void *)destp, sizeof(canary)); + error = copyout(canary, (void *)destp, sizeof(canary)); + if (error != 0) + return (error); imgp->canarylen = sizeof(canary); /* @@ -3185,7 +3190,9 @@ freebsd32_copyout_strings(struct image_params *imgp) destp -= sizeof(pagesizes32); destp = rounddown2(destp, sizeof(uint32_t)); imgp->pagesizes = destp; - copyout(pagesizes32, (void *)destp, sizeof(pagesizes32)); + error = copyout(pagesizes32, (void *)destp, sizeof(pagesizes32)); + if (error != 0) + return (error); imgp->pagesizeslen = sizeof(pagesizes32); destp -= ARG_MAX - imgp->args->stringspace; @@ -3195,8 +3202,12 @@ freebsd32_copyout_strings(struct image_params *imgp) if (imgp->sysent->sv_stackgap != NULL) imgp->sysent->sv_stackgap(imgp, (u_long *)&vectp); - if (imgp->auxargs) - imgp->sysent->sv_copyout_auxargs(imgp, (u_long *)&vectp); + if (imgp->auxargs) { + error = imgp->sysent->sv_copyout_auxargs(imgp, + (u_long *)&vectp); + if (error != 0) + return (error); + } /* * Allocate room for the argv[] and env vectors including the @@ -3207,7 +3218,7 @@ freebsd32_copyout_strings(struct image_params *imgp) /* * vectp also becomes our initial stack base */ - stack_base = vectp; + *stack_base = (register_t *)vectp; stringp = imgp->args->begin_argv; argc = imgp->args->argc; @@ -3215,44 +3226,53 @@ freebsd32_copyout_strings(struct image_params *imgp) /* * Copy out strings - arguments and environment. */ - copyout(stringp, (void *)destp, ARG_MAX - imgp->args->stringspace); + error = copyout(stringp, (void *)destp, + ARG_MAX - imgp->args->stringspace); + if (error != 0) + return (error); /* * Fill in "ps_strings" struct for ps, w, etc. */ - suword32(&arginfo->ps_argvstr, (u_int32_t)(intptr_t)vectp); - suword32(&arginfo->ps_nargvstr, argc); + if (suword32(&arginfo->ps_argvstr, (u_int32_t)(intptr_t)vectp) != 0 || + suword32(&arginfo->ps_nargvstr, argc) != 0) + return (EFAULT); /* * Fill in argument portion of vector table. */ for (; argc > 0; --argc) { - suword32(vectp++, (u_int32_t)(intptr_t)destp); + if (suword32(vectp++, (u_int32_t)(intptr_t)destp) != 0) + return (EFAULT); while (*stringp++ != 0) destp++; destp++; } /* a null vector table pointer separates the argp's from the envp's */ - suword32(vectp++, 0); + if (suword32(vectp++, 0) != 0) + return (EFAULT); - suword32(&arginfo->ps_envstr, (u_int32_t)(intptr_t)vectp); - suword32(&arginfo->ps_nenvstr, envc); + if (suword32(&arginfo->ps_envstr, (u_int32_t)(intptr_t)vectp) != 0 || + suword32(&arginfo->ps_nenvstr, envc) != 0) + return (EFAULT); /* * Fill in environment portion of vector table. */ for (; envc > 0; --envc) { - suword32(vectp++, (u_int32_t)(intptr_t)destp); + if (suword32(vectp++, (u_int32_t)(intptr_t)destp) != 0) + return (EFAULT); while (*stringp++ != 0) destp++; destp++; } /* end of vector table is a null pointer */ - suword32(vectp, 0); + if (suword32(vectp, 0) != 0) + return (EFAULT); - return ((register_t *)stack_base); + return (0); } int Modified: head/sys/compat/freebsd32/freebsd32_util.h ============================================================================== --- head/sys/compat/freebsd32/freebsd32_util.h Mon Nov 18 20:03:28 2019 (r354826) +++ head/sys/compat/freebsd32/freebsd32_util.h Mon Nov 18 20:07:43 2019 (r354827) @@ -112,7 +112,8 @@ int syscall32_helper_unregister(struct syscall_help struct iovec32; struct rusage32; -register_t *freebsd32_copyout_strings(struct image_params *imgp); +int freebsd32_copyout_strings(struct image_params *imgp, + register_t **stack_base); int freebsd32_copyiniov(struct iovec32 *iovp, u_int iovcnt, struct iovec **iov, int error); void freebsd32_rusage_out(const struct rusage *s, struct rusage32 *s32); Modified: head/sys/i386/linux/linux_sysvec.c ============================================================================== --- head/sys/i386/linux/linux_sysvec.c Mon Nov 18 20:03:28 2019 (r354826) +++ head/sys/i386/linux/linux_sysvec.c Mon Nov 18 20:07:43 2019 (r354827) @@ -95,7 +95,8 @@ static int linux_fixup_elf(register_t **stack_base, static void linux_sendsig(sig_t catcher, ksiginfo_t *ksi, sigset_t *mask); static void linux_exec_setregs(struct thread *td, struct image_params *imgp, u_long stack); -static register_t *linux_copyout_strings(struct image_params *imgp); +static int linux_copyout_strings(struct image_params *imgp, + register_t **stack_base); static bool linux_trans_osrel(const Elf_Note *note, int32_t *osrel); static void linux_vdso_install(void *param); static void linux_vdso_deinstall(void *param); @@ -188,7 +189,7 @@ linux_fixup(register_t **stack_base, struct image_para return (0); } -static void +static int linux_copyout_auxargs(struct image_params *imgp, u_long *base) { struct proc *p; @@ -197,7 +198,7 @@ linux_copyout_auxargs(struct image_params *imgp, u_lon Elf32_Addr *uplatform; struct ps_strings *arginfo; u_long auxlen; - int issetugid; + int error, issetugid; p = imgp->proc; issetugid = imgp->proc->p_flag & P_SUGID ? 1 : 0; @@ -248,8 +249,9 @@ linux_copyout_auxargs(struct image_params *imgp, u_lon auxlen = sizeof(*argarray) * (pos - argarray); *base -= auxlen; - copyout(argarray, (void *)*base, auxlen); + error = copyout(argarray, (void *)*base, auxlen); free(argarray, M_TEMP); + return (error); } static int @@ -265,13 +267,12 @@ linux_fixup_elf(register_t **stack_base, struct image_ /* * Copied from kern/kern_exec.c */ -static register_t * -linux_copyout_strings(struct image_params *imgp) +static int +linux_copyout_strings(struct image_params *imgp, register_t **stack_base) { - int argc, envc; + int argc, envc, error; char **vectp; char *stringp, *destp; - register_t *stack_base; struct ps_strings *arginfo; char canary[LINUX_AT_RANDOM_LEN]; size_t execpath_len; @@ -290,13 +291,18 @@ linux_copyout_strings(struct image_params *imgp) roundup(ARG_MAX - imgp->args->stringspace, sizeof(char *)); /* Install LINUX_PLATFORM. */ - copyout(linux_kplatform, ((caddr_t)arginfo - linux_szplatform), + error = copyout(linux_kplatform, ((caddr_t)arginfo - linux_szplatform), linux_szplatform); + if (error != 0) + return (error); if (execpath_len != 0) { imgp->execpathp = (uintptr_t)arginfo - linux_szplatform - execpath_len; - copyout(imgp->execpath, (void *)imgp->execpathp, execpath_len); + error = copyout(imgp->execpath, (void *)imgp->execpathp, + execpath_len); + if (error != 0) + return (error); } /* Prepare the canary for SSP. */ @@ -304,11 +310,17 @@ linux_copyout_strings(struct image_params *imgp) imgp->canary = (uintptr_t)arginfo - linux_szplatform - roundup(execpath_len, sizeof(char *)) - roundup(sizeof(canary), sizeof(char *)); - copyout(canary, (void *)imgp->canary, sizeof(canary)); + error = copyout(canary, (void *)imgp->canary, sizeof(canary)); + if (error != 0) + return (error); vectp = (char **)destp; - if (imgp->auxargs) - imgp->sysent->sv_copyout_auxargs(imgp, (u_long *)&vectp); + if (imgp->auxargs) { + error = imgp->sysent->sv_copyout_auxargs(imgp, + (u_long *)&vectp); + if (error != 0) + return (error); + } /* * Allocate room for the argv[] and env vectors including the @@ -317,45 +329,53 @@ linux_copyout_strings(struct image_params *imgp) vectp -= imgp->args->argc + 1 + imgp->args->envc + 1; /* vectp also becomes our initial stack base. */ - stack_base = (register_t *)vectp; + *stack_base = (register_t *)vectp; stringp = imgp->args->begin_argv; argc = imgp->args->argc; envc = imgp->args->envc; /* Copy out strings - arguments and environment. */ - copyout(stringp, destp, ARG_MAX - imgp->args->stringspace); + error = copyout(stringp, destp, ARG_MAX - imgp->args->stringspace); + if (error != 0) + return (error); /* Fill in "ps_strings" struct for ps, w, etc. */ - suword(&arginfo->ps_argvstr, (long)(intptr_t)vectp); - suword(&arginfo->ps_nargvstr, argc); + if (suword(&arginfo->ps_argvstr, (long)(intptr_t)vectp) != 0 || + suword(&arginfo->ps_nargvstr, argc) != 0) + return (EFAULT); /* Fill in argument portion of vector table. */ for (; argc > 0; --argc) { - suword(vectp++, (long)(intptr_t)destp); + if (suword(vectp++, (long)(intptr_t)destp) != 0) + return (EFAULT); while (*stringp++ != 0) destp++; destp++; } /* A null vector table pointer separates the argp's from the envp's. */ - suword(vectp++, 0); + if (suword(vectp++, 0) != 0) + return (EFAULT); - suword(&arginfo->ps_envstr, (long)(intptr_t)vectp); - suword(&arginfo->ps_nenvstr, envc); + if (suword(&arginfo->ps_envstr, (long)(intptr_t)vectp) != 0 || + suword(&arginfo->ps_nenvstr, envc) != 0) + return (EFAULT); /* Fill in environment portion of vector table. */ for (; envc > 0; --envc) { - suword(vectp++, (long)(intptr_t)destp); + if (suword(vectp++, (long)(intptr_t)destp) != 0) + return (EFAULT); while (*stringp++ != 0) destp++; destp++; } /* The end of the vector table is a null pointer. */ - suword(vectp, 0); + if (suword(vectp, 0) != 0) + return (EFAULT); - return (stack_base); + return (0); } static void Modified: head/sys/kern/imgact_elf.c ============================================================================== --- head/sys/kern/imgact_elf.c Mon Nov 18 20:03:28 2019 (r354826) +++ head/sys/kern/imgact_elf.c Mon Nov 18 20:07:43 2019 (r354827) @@ -1323,12 +1323,13 @@ ret: #define suword __CONCAT(suword, __ELF_WORD_SIZE) -void +int __elfN(freebsd_copyout_auxargs)(struct image_params *imgp, u_long *base) { Elf_Auxargs *args = (Elf_Auxargs *)imgp->auxargs; Elf_Auxinfo *argarray, *pos; u_long auxlen; + int error; argarray = pos = malloc(AT_COUNT * sizeof(*pos), M_TEMP, M_WAITOK | M_ZERO); @@ -1375,8 +1376,9 @@ __elfN(freebsd_copyout_auxargs)(struct image_params *i auxlen = sizeof(*argarray) * (pos - argarray); *base -= auxlen; - copyout(argarray, (void *)*base, auxlen); + error = copyout(argarray, (void *)*base, auxlen); free(argarray, M_TEMP); + return (error); } int Modified: head/sys/kern/kern_exec.c ============================================================================== --- head/sys/kern/kern_exec.c Mon Nov 18 20:03:28 2019 (r354826) +++ head/sys/kern/kern_exec.c Mon Nov 18 20:07:43 2019 (r354827) @@ -672,7 +672,11 @@ interpret: /* * Copy out strings (args and env) and initialize stack base. */ - stack_base = (*p->p_sysent->sv_copyout_strings)(imgp); + error = (*p->p_sysent->sv_copyout_strings)(imgp, &stack_base); + if (error != 0) { + vn_lock(imgp->vp, LK_SHARED | LK_RETRY); + goto exec_fail_dealloc; + } /* * Stack setup. @@ -1569,18 +1573,17 @@ exec_args_get_begin_envv(struct image_args *args) * and env vector tables. Return a pointer to the base so that it can be used * as the initial stack pointer. */ -register_t * -exec_copyout_strings(struct image_params *imgp) +int +exec_copyout_strings(struct image_params *imgp, register_t **stack_base) { int argc, envc; char **vectp; char *stringp; uintptr_t destp; - register_t *stack_base; struct ps_strings *arginfo; struct proc *p; size_t execpath_len; - int szsigcode, szps; + int error, szsigcode, szps; char canary[sizeof(long) * 8]; szps = sizeof(pagesizes[0]) * MAXPAGESIZES; @@ -1607,7 +1610,10 @@ exec_copyout_strings(struct image_params *imgp) if (szsigcode != 0) { destp -= szsigcode; destp = rounddown2(destp, sizeof(void *)); - copyout(p->p_sysent->sv_sigcode, (void *)destp, szsigcode); + error = copyout(p->p_sysent->sv_sigcode, (void *)destp, + szsigcode); + if (error != 0) + return (error); } /* @@ -1617,7 +1623,9 @@ exec_copyout_strings(struct image_params *imgp) destp -= execpath_len; destp = rounddown2(destp, sizeof(void *)); imgp->execpathp = destp; - copyout(imgp->execpath, (void *)destp, execpath_len); + error = copyout(imgp->execpath, (void *)destp, execpath_len); + if (error != 0) + return (error); } /* @@ -1626,7 +1634,9 @@ exec_copyout_strings(struct image_params *imgp) arc4rand(canary, sizeof(canary), 0); destp -= sizeof(canary); imgp->canary = destp; - copyout(canary, (void *)destp, sizeof(canary)); + error = copyout(canary, (void *)destp, sizeof(canary)); + if (error != 0) + return (error); imgp->canarylen = sizeof(canary); /* @@ -1635,7 +1645,9 @@ exec_copyout_strings(struct image_params *imgp) destp -= szps; destp = rounddown2(destp, sizeof(void *)); imgp->pagesizes = destp; - copyout(pagesizes, (void *)destp, szps); + error = copyout(pagesizes, (void *)destp, szps); + if (error != 0) + return (error); imgp->pagesizeslen = szps; destp -= ARG_MAX - imgp->args->stringspace; @@ -1645,8 +1657,12 @@ exec_copyout_strings(struct image_params *imgp) if (imgp->sysent->sv_stackgap != NULL) imgp->sysent->sv_stackgap(imgp, (u_long *)&vectp); - if (imgp->auxargs) - imgp->sysent->sv_copyout_auxargs(imgp, (u_long *)&vectp); + if (imgp->auxargs) { + error = imgp->sysent->sv_copyout_auxargs(imgp, + (u_long *)&vectp); *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-all@freebsd.org Mon Nov 18 20:09:32 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 76B4F1C8871; Mon, 18 Nov 2019 20:09:32 +0000 (UTC) (envelope-from asomers@gmail.com) Received: from mail-oi1-f169.google.com (mail-oi1-f169.google.com [209.85.167.169]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47H0RJ2PPnz4TP2; Mon, 18 Nov 2019 20:09:31 +0000 (UTC) (envelope-from asomers@gmail.com) Received: by mail-oi1-f169.google.com with SMTP id d22so9600370oic.7; Mon, 18 Nov 2019 12:09:31 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=RuZIEQYpF00NYzFuXm91okXjqRSzXpkzBMdb+KP+2P0=; b=KiOhAfuZAXercrSthfOmSa1VSKmZ7FIpGCP5XIuF4OGCfwOTtQOaIGDfwG3dEBIV34 es5uvBnbJHf+6JKkBhrVEzreqUx3OoKlG3piy4z+FNx/sDZL87H8oXqi8mf8tmfNscOE RQz9qqdg/2Bnt3LT8YepX5D6ESwY5vSa0O217Y8iBZshMO1svBCfjnlNqrdrTN20JpqM bPMi9KPivhUDEk1nSYYzs/bWRLbj3x0rr3obrzZU6rbQye3QHDHLz6mqdockiI3wo3mG lvZB7qF0jsyw98rAYLj/XAaR9+SUgYajYzGI1VrOAOaMSeuCBFn/op0XOtx+PtEORHaF Zp/w== X-Gm-Message-State: APjAAAXSsyTs6u1xwePEQbVmx3ZbV1durWMab+8KzGZXkv98l24mieG+ u18E0VdJrcsdehkhBKsAGPhK81irBml17C5EtjV3RqVW X-Google-Smtp-Source: APXvYqzvkyO+eSMs4dUfmyddswbh/NUGetyfy6yZgzdyt7OwmoFXWEm44g1Bl2SLcb5cptw7N0aHp7DEhuvhmvnbaVM= X-Received: by 2002:a05:6808:b3a:: with SMTP id t26mr650503oij.57.1574107770453; Mon, 18 Nov 2019 12:09:30 -0800 (PST) MIME-Version: 1.0 References: <201911181905.xAIJ5q6A068355@repo.freebsd.org> <20191118194501.GA43295@raichu> In-Reply-To: <20191118194501.GA43295@raichu> From: Alan Somers Date: Mon, 18 Nov 2019 13:09:19 -0700 Message-ID: Subject: Re: svn commit: r354824 - head/lib/geom/part To: Mark Johnston Cc: src-committers , svn-src-all , svn-src-head X-Rspamd-Queue-Id: 47H0RJ2PPnz4TP2 X-Spamd-Bar: ----- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-5.92 / 15.00]; NEURAL_HAM_MEDIUM(-0.92)[-0.921,0]; NEURAL_HAM_LONG(-1.00)[-0.997,0]; REPLY(-4.00)[] Content-Type: text/plain; charset="UTF-8" X-Content-Filtered-By: Mailman/MimeDel 2.1.29 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 18 Nov 2019 20:09:32 -0000 On Mon, Nov 18, 2019 at 12:48 PM Mark Johnston wrote: > On Mon, Nov 18, 2019 at 12:43:48PM -0700, Alan Somers wrote: > > On Mon, Nov 18, 2019 at 12:06 PM Mark Johnston > wrote: > > > > > Author: markj > > > Date: Mon Nov 18 19:05:52 2019 > > > New Revision: 354824 > > > URL: https://svnweb.freebsd.org/changeset/base/354824 > > > > > > Log: > > > Fix grammar in gpart.8. > > > > > > PR: 241973 > > > MFC after: 3 days > > > > > > Modified: > > > head/lib/geom/part/gpart.8 > > > > > > > Don't forget to bump the .Dd date. > > AFAIK we do not bump .Dd for such changes, only for content changes. > Isn't that a content change? I though anything displayed to the user counts as a content change? From owner-svn-src-all@freebsd.org Mon Nov 18 20:35:30 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 4BE091C8DE7; Mon, 18 Nov 2019 20:35:30 +0000 (UTC) (envelope-from danfe@freebsd.org) Received: from freefall.freebsd.org (freefall.freebsd.org [96.47.72.132]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "freefall.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47H11G19Vmz4VSY; Mon, 18 Nov 2019 20:35:30 +0000 (UTC) (envelope-from danfe@freebsd.org) Received: by freefall.freebsd.org (Postfix, from userid 1033) id 20C011DA4A; Mon, 18 Nov 2019 20:35:30 +0000 (UTC) Date: Mon, 18 Nov 2019 20:35:30 +0000 From: Alexey Dokuchaev To: Alan Somers Cc: Mark Johnston , svn-src-head , svn-src-all , src-committers Subject: Re: svn commit: r354824 - head/lib/geom/part Message-ID: <20191118203529.GA64688@FreeBSD.org> References: <201911181905.xAIJ5q6A068355@repo.freebsd.org> <20191118194501.GA43295@raichu> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.11.4 (2019-03-13) X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 18 Nov 2019 20:35:30 -0000 On Mon, Nov 18, 2019 at 01:09:19PM -0700, Alan Somers wrote: > On Mon, Nov 18, 2019 at 12:48 PM Mark Johnston wrote: > > On Mon, Nov 18, 2019 at 12:43:48PM -0700, Alan Somers wrote: > > > On Mon, Nov 18, 2019 at 12:06 PM Mark Johnston > > wrote: > > > > > > > Author: markj > > > > Date: Mon Nov 18 19:05:52 2019 > > > > New Revision: 354824 > > > > URL: https://svnweb.freebsd.org/changeset/base/354824 > > > > > > > > Log: > > > > Fix grammar in gpart.8. > > > > > > > > PR: 241973 > > > > MFC after: 3 days > > > > > > > > Modified: > > > > head/lib/geom/part/gpart.8 > > > > > > Don't forget to bump the .Dd date. > > > > AFAIK we do not bump .Dd for such changes, only for content changes. > > Isn't that a content change? I thought anything displayed to the user > counts as a content change? I presume that "content" means more like semantic, functional changes that affect some particular meaning. Grammar fixes are just, well, grammar fixes and thus do not warrant .Dd bump. ./danfe From owner-svn-src-all@freebsd.org Mon Nov 18 20:48:43 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 0CE141C94A0; Mon, 18 Nov 2019 20:48:43 +0000 (UTC) (envelope-from markjdb@gmail.com) Received: from mail-qt1-x832.google.com (mail-qt1-x832.google.com [IPv6:2607:f8b0:4864:20::832]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47H1JV6dZ7z4WCv; Mon, 18 Nov 2019 20:48:42 +0000 (UTC) (envelope-from markjdb@gmail.com) Received: by mail-qt1-x832.google.com with SMTP id p20so21856956qtq.5; Mon, 18 Nov 2019 12:48:42 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=MeHJxYkhxKqlFC13dNJXs+nX4XUgdKNTEUnmCuW7HGo=; b=tZPAofOO+eubye+AcYxfJbNwNLhzVskai1yX0UyrnP1Axj5fBYcxylrOk8iKSJ9ZXQ GyhZlRoyU8k3mQJiyADgDEj+LXrcrEunJ5aLcbIW48PvA0Cr+6DpB5aEygZKWPjNzyw0 2LxpzazX00qruC+0BTfWLJdN65HMl+7RFQv3YzpD5OgMZXtvHQP7t3MczAFitwtdWEui niiQsN1pcOSELzyN0ZxZbN2Yq1GEwMJZMBrZsWiD59yMS1PXva2NwggoeXkTWUlN4JAY Ma0NOfej+cUnSFPfAi2inxCCgefEWdcJjrCnUoaFTsX/GFyQFP2ZRkri8f9IXqZxBfK4 WHOQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:date:from:to:cc:subject:message-id :references:mime-version:content-disposition:in-reply-to:user-agent; bh=MeHJxYkhxKqlFC13dNJXs+nX4XUgdKNTEUnmCuW7HGo=; b=WRcy+Diw/hYzsukYdS5Mfb85EypxpbQrP7vvkkfrgC9vxzwG62f1yZONY89qgIzKhl SqfIP5rw6TMi+0B60vuO2aouHPttY5EeLkGm+9M9BPyXlWIJwpxFW23Ex0KCYT5WtqhT f2U9hQ8o/gFmvxMUCYAoPbCuK18ofzjiw8Nz3bwMnJTkCS4WcWDUPrAVLyD/hFk98Uof yDxGiKq5IzqdV4oMJljH0CdrIPQgzz5L2nm71QRC7U2WeSBpk6Zv1twr4/Eszozm72Ut 4PA0ghgXGiGwiMsC3YxURbuZo/TRMo2RXDZuLOaUqoa2EeKV7D28pl4ciKLlWH/NXBcj QMFg== X-Gm-Message-State: APjAAAWAnCWNU7abgubE49HWbbG40UyoogbTPI9oU1HPlhrWMM+io0Fy O+Yc0paBhrSM+kDKNTfon0Q6U/Nokhk= X-Google-Smtp-Source: APXvYqwYQFrwEOpn/0nFNLEOZ4aEIFWZA1Z8RLqyEt8+Ug4Q/rdMkj1Ery1GkY6HSgKvf5r613Hj1g== X-Received: by 2002:ac8:2ff3:: with SMTP id m48mr30414043qta.127.1574110120096; Mon, 18 Nov 2019 12:48:40 -0800 (PST) Received: from raichu (toroon0560w-lp130-05-69-158-183-252.dsl.bell.ca. [69.158.183.252]) by smtp.gmail.com with ESMTPSA id m25sm11660173qtc.0.2019.11.18.12.48.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 18 Nov 2019 12:48:39 -0800 (PST) Sender: Mark Johnston Date: Mon, 18 Nov 2019 15:48:36 -0500 From: Mark Johnston To: Alexey Dokuchaev Cc: Alan Somers , svn-src-head , svn-src-all , src-committers Subject: Re: svn commit: r354824 - head/lib/geom/part Message-ID: <20191118204836.GB43295@raichu> References: <201911181905.xAIJ5q6A068355@repo.freebsd.org> <20191118194501.GA43295@raichu> <20191118203529.GA64688@FreeBSD.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20191118203529.GA64688@FreeBSD.org> User-Agent: Mutt/1.12.2 (2019-09-21) X-Rspamd-Queue-Id: 47H1JV6dZ7z4WCv X-Spamd-Bar: ----- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-5.80 / 15.00]; NEURAL_HAM_MEDIUM(-0.81)[-0.807,0]; REPLY(-4.00)[]; NEURAL_HAM_LONG(-0.99)[-0.993,0] X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 18 Nov 2019 20:48:43 -0000 On Mon, Nov 18, 2019 at 08:35:30PM +0000, Alexey Dokuchaev wrote: > On Mon, Nov 18, 2019 at 01:09:19PM -0700, Alan Somers wrote: > > On Mon, Nov 18, 2019 at 12:48 PM Mark Johnston wrote: > > > On Mon, Nov 18, 2019 at 12:43:48PM -0700, Alan Somers wrote: > > > > On Mon, Nov 18, 2019 at 12:06 PM Mark Johnston > > > wrote: > > > > > > > > > Author: markj > > > > > Date: Mon Nov 18 19:05:52 2019 > > > > > New Revision: 354824 > > > > > URL: https://svnweb.freebsd.org/changeset/base/354824 > > > > > > > > > > Log: > > > > > Fix grammar in gpart.8. > > > > > > > > > > PR: 241973 > > > > > MFC after: 3 days > > > > > > > > > > Modified: > > > > > head/lib/geom/part/gpart.8 > > > > > > > > Don't forget to bump the .Dd date. > > > > > > AFAIK we do not bump .Dd for such changes, only for content changes. > > > > Isn't that a content change? I thought anything displayed to the user > > counts as a content change? > > I presume that "content" means more like semantic, functional changes > that affect some particular meaning. Grammar fixes are just, well, > grammar fixes and thus do not warrant .Dd bump. Indeed, this was always my understanding as well. I can't find a concrete definition anywhere. I don't understand why it would be useful as a user to see the date of the last "content change" if such changes might consist only of a small formatting change or typo fix. From owner-svn-src-all@freebsd.org Mon Nov 18 20:50:42 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id B54AA1C9557; Mon, 18 Nov 2019 20:50:42 +0000 (UTC) (envelope-from cy.schubert@cschubert.com) Received: from smtp-out-so.shaw.ca (smtp-out-so.shaw.ca [64.59.136.139]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "Client", Issuer "CA" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 47H1Ln19TZz4WNN; Mon, 18 Nov 2019 20:50:40 +0000 (UTC) (envelope-from cy.schubert@cschubert.com) Received: from spqr.komquats.com ([70.67.125.17]) by shaw.ca with ESMTPA id Wnylil1B0RnrKWnyniJIOH; Mon, 18 Nov 2019 13:50:38 -0700 X-Authority-Analysis: v=2.3 cv=L7FjvNb8 c=1 sm=1 tr=0 a=VFtTW3WuZNDh6VkGe7fA3g==:117 a=VFtTW3WuZNDh6VkGe7fA3g==:17 a=kj9zAlcOel0A:10 a=MeAgGD-zjQ4A:10 a=6I5d2MoRAAAA:8 a=YxBL1-UpAAAA:8 a=RnW7AQNEQsNdnM5ZpkYA:9 a=CjuIK1q_8ugA:10 a=IjZwj45LgO3ly-622nXo:22 a=Ia-lj3WSrqcvXOmTRaiG:22 Received: from slippy.cwsent.com (slippy8 [10.2.2.6]) by spqr.komquats.com (Postfix) with ESMTPS id 72296130A; Mon, 18 Nov 2019 12:50:34 -0800 (PST) Received: from slippy.cwsent.com (localhost [127.0.0.1]) by slippy.cwsent.com (8.15.2/8.15.2) with ESMTP id xAIKoXoq000664; Mon, 18 Nov 2019 12:50:33 -0800 (PST) (envelope-from Cy.Schubert@cschubert.com) Received: from slippy (cy@localhost) by slippy.cwsent.com (8.15.2/8.15.2/Submit) with ESMTP id xAIKoX32000661; Mon, 18 Nov 2019 12:50:33 -0800 (PST) (envelope-from Cy.Schubert@cschubert.com) Message-Id: <201911182050.xAIKoX32000661@slippy.cwsent.com> X-Authentication-Warning: slippy.cwsent.com: cy owned process doing -bs X-Mailer: exmh version 2.9.0 11/07/2018 with nmh-1.7.1 Reply-to: Cy Schubert From: Cy Schubert X-os: FreeBSD X-Sender: cy@cwsent.com X-URL: http://www.cschubert.com/ To: Mark Johnston cc: Alexey Dokuchaev , Alan Somers , svn-src-head , svn-src-all , src-committers Subject: Re: svn commit: r354824 - head/lib/geom/part In-reply-to: <20191118204836.GB43295@raichu> References: <201911181905.xAIJ5q6A068355@repo.freebsd.org> <20191118194501.GA43295@raichu> <20191118203529.GA64688@FreeBSD.org> <20191118204836.GB43295@raichu> Comments: In-reply-to Mark Johnston message dated "Mon, 18 Nov 2019 15:48:36 -0500." Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Date: Mon, 18 Nov 2019 12:50:33 -0800 X-CMAE-Envelope: MS4wfKgNbRxCn49DAv+vth6a5Cu19n61wHs6rKxtVarHTslt3FaJS3vPODXkFcdFKvNd4nnB832Lh2FDWC8ZH6QfnF5mU6HrGdK7R7PS0ViYGmjjYGW7g/6r YkBPa2k7SRZRbUSyPJ/awypbd7454GYZu6tnwl1YO1XFTy06Rlh2k7kLhJOj9mAB7l64GL+apzgzjtuGXD8zznczsUsRYUJvDOn1r12tGqI15Je4vVvgUlrP xLKUXc4DjvZjo+fvdj1RqRC987ws3iEK/qbQSnvCatWs+XdlMfQEyOJCTiXjRyTpRkM+DcdiZcySuZP26imhxIHN31x9VmbN+zJjTN18Gxf3qhvV45J6RHnF 3R5MhI7F X-Rspamd-Queue-Id: 47H1Ln19TZz4WNN X-Spamd-Bar: --- Authentication-Results: mx1.freebsd.org; dkim=none; spf=none (mx1.freebsd.org: domain of cy.schubert@cschubert.com has no SPF policy when checking 64.59.136.139) smtp.mailfrom=cy.schubert@cschubert.com X-Spamd-Result: default: False [-3.92 / 15.00]; ARC_NA(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; RCVD_COUNT_FIVE(0.00)[5]; RECEIVED_SPAMHAUS_PBL(0.00)[17.125.67.70.khpj7ygk5idzvmvt5x4ziurxhy.zen.dq.spamhaus.net : 127.0.0.11]; FROM_HAS_DN(0.00)[]; TO_MATCH_ENVRCPT_ALL(0.00)[]; MV_CASE(0.50)[]; MIME_GOOD(-0.10)[text/plain]; HAS_XAW(0.00)[]; HAS_REPLYTO(0.00)[Cy.Schubert@cschubert.com]; RCPT_COUNT_FIVE(0.00)[6]; REPLYTO_EQ_FROM(0.00)[]; IP_SCORE(-2.23)[ip: (-5.67), ipnet: 64.59.128.0/20(-3.04), asn: 6327(-2.35), country: CA(-0.09)]; TO_DN_ALL(0.00)[]; NEURAL_HAM_LONG(-1.00)[-0.999,0]; NEURAL_HAM_MEDIUM(-1.00)[-0.996,0]; R_SPF_NA(0.00)[]; FROM_EQ_ENVFROM(0.00)[]; R_DKIM_NA(0.00)[]; MIME_TRACE(0.00)[0:+]; ASN(0.00)[asn:6327, ipnet:64.59.128.0/20, country:CA]; RCVD_TLS_LAST(0.00)[]; RCVD_IN_DNSWL_LOW(-0.10)[139.136.59.64.list.dnswl.org : 127.0.5.1] X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 18 Nov 2019 20:50:42 -0000 In message <20191118204836.GB43295@raichu>, Mark Johnston writes: > On Mon, Nov 18, 2019 at 08:35:30PM +0000, Alexey Dokuchaev wrote: > > On Mon, Nov 18, 2019 at 01:09:19PM -0700, Alan Somers wrote: > > > On Mon, Nov 18, 2019 at 12:48 PM Mark Johnston wrote: > > > > On Mon, Nov 18, 2019 at 12:43:48PM -0700, Alan Somers wrote: > > > > > On Mon, Nov 18, 2019 at 12:06 PM Mark Johnston > > > > wrote: > > > > > > > > > > > Author: markj > > > > > > Date: Mon Nov 18 19:05:52 2019 > > > > > > New Revision: 354824 > > > > > > URL: https://svnweb.freebsd.org/changeset/base/354824 > > > > > > > > > > > > Log: > > > > > > Fix grammar in gpart.8. > > > > > > > > > > > > PR: 241973 > > > > > > MFC after: 3 days > > > > > > > > > > > > Modified: > > > > > > head/lib/geom/part/gpart.8 > > > > > > > > > > Don't forget to bump the .Dd date. > > > > > > > > AFAIK we do not bump .Dd for such changes, only for content changes. > > > > > > Isn't that a content change? I thought anything displayed to the user > > > counts as a content change? > > > > I presume that "content" means more like semantic, functional changes > > that affect some particular meaning. Grammar fixes are just, well, > > grammar fixes and thus do not warrant .Dd bump. > > Indeed, this was always my understanding as well. I can't find a > concrete definition anywhere. I don't understand why it would be useful > as a user to see the date of the last "content change" if such changes > might consist only of a small formatting change or typo fix. > Should this be documented in the committers guide? -- Cheers, Cy Schubert FreeBSD UNIX: Web: http://www.FreeBSD.org The need of the many outweighs the greed of the few. From owner-svn-src-all@freebsd.org Mon Nov 18 20:51:21 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id A00711C96E0; Mon, 18 Nov 2019 20:51:21 +0000 (UTC) (envelope-from asomers@gmail.com) Received: from mail-ot1-f54.google.com (mail-ot1-f54.google.com [209.85.210.54]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47H1MY3KT5z4WY3; Mon, 18 Nov 2019 20:51:21 +0000 (UTC) (envelope-from asomers@gmail.com) Received: by mail-ot1-f54.google.com with SMTP id 19so5879487otz.1; Mon, 18 Nov 2019 12:51:21 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=h3yxSjgkzzP3yDf49s5RIuiAOfocPw9zXTkrcVGHz4c=; b=olD+IWYRbVMELq1x+PlTFDuQXVWKuwYDBoUQ0phHWvuCs20ZWqTOqGaUszb+fXpA/l 1P419eakmrvHBT1Yo1fTOxQ+55xWNYQKK2BST4fZtJN0f6WnbaMFi07S8BpOx/zzxhr8 4Gbebs+fHpMXjVlpxINkKH8CzugMzioCfINPnqo0t/W/bmAPINdtpPbrQF+Peni7zpk+ hCOlYyYLYHl71KfdZS47doDj3Cb64QktlZVvfrozZ29qR80qe5GaX7z9cpfLmJ6yZ9om kfnkFAm+pWAi9U/DXCw1NJCcBYmTlGUHqHCV2ck07xMhj5ra7yTDUG95RRDJoF3H/rC3 dkLA== X-Gm-Message-State: APjAAAUHsfZ/nHrbkX7E/RwaCzIfZNRK+K0LGFBA56eO6Wj735Ex5xDo g+nwg69JbOnzlS5bmu2AZxHNHEBTHD7pqnA7MY2F5gwa X-Google-Smtp-Source: APXvYqxDXmk7L/i+hpoOh716kd97+QzduZoYGL9DljpeVvcFhnIUEHUVZ2ARKLPnsuWHQAI5icn8FdaylYjv2soyxfQ= X-Received: by 2002:a05:6830:1e0a:: with SMTP id s10mr971724otr.18.1574110279876; Mon, 18 Nov 2019 12:51:19 -0800 (PST) MIME-Version: 1.0 References: <201911181905.xAIJ5q6A068355@repo.freebsd.org> <20191118194501.GA43295@raichu> <20191118203529.GA64688@FreeBSD.org> <20191118204836.GB43295@raichu> In-Reply-To: <20191118204836.GB43295@raichu> From: Alan Somers Date: Mon, 18 Nov 2019 13:51:08 -0700 Message-ID: Subject: Re: svn commit: r354824 - head/lib/geom/part To: Mark Johnston Cc: Alexey Dokuchaev , svn-src-head , svn-src-all , src-committers X-Rspamd-Queue-Id: 47H1MY3KT5z4WY3 X-Spamd-Bar: ----- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-5.92 / 15.00]; NEURAL_HAM_MEDIUM(-0.92)[-0.921,0]; NEURAL_HAM_LONG(-1.00)[-0.996,0]; REPLY(-4.00)[] Content-Type: text/plain; charset="UTF-8" X-Content-Filtered-By: Mailman/MimeDel 2.1.29 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 18 Nov 2019 20:51:21 -0000 On Mon, Nov 18, 2019 at 1:48 PM Mark Johnston wrote: > On Mon, Nov 18, 2019 at 08:35:30PM +0000, Alexey Dokuchaev wrote: > > On Mon, Nov 18, 2019 at 01:09:19PM -0700, Alan Somers wrote: > > > On Mon, Nov 18, 2019 at 12:48 PM Mark Johnston > wrote: > > > > On Mon, Nov 18, 2019 at 12:43:48PM -0700, Alan Somers wrote: > > > > > On Mon, Nov 18, 2019 at 12:06 PM Mark Johnston > > > > wrote: > > > > > > > > > > > Author: markj > > > > > > Date: Mon Nov 18 19:05:52 2019 > > > > > > New Revision: 354824 > > > > > > URL: https://svnweb.freebsd.org/changeset/base/354824 > > > > > > > > > > > > Log: > > > > > > Fix grammar in gpart.8. > > > > > > > > > > > > PR: 241973 > > > > > > MFC after: 3 days > > > > > > > > > > > > Modified: > > > > > > head/lib/geom/part/gpart.8 > > > > > > > > > > Don't forget to bump the .Dd date. > > > > > > > > AFAIK we do not bump .Dd for such changes, only for content changes. > > > > > > Isn't that a content change? I thought anything displayed to the user > > > counts as a content change? > > > > I presume that "content" means more like semantic, functional changes > > that affect some particular meaning. Grammar fixes are just, well, > > grammar fixes and thus do not warrant .Dd bump. > > Indeed, this was always my understanding as well. I can't find a > concrete definition anywhere. I don't understand why it would be useful > as a user to see the date of the last "content change" if such changes > might consist only of a small formatting change or typo fix. > Ok, seems like everybody else is in agreement. From owner-svn-src-all@freebsd.org Mon Nov 18 20:53:58 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id B10931C97B8; Mon, 18 Nov 2019 20:53:58 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47H1QZ3nPBz4Wsx; Mon, 18 Nov 2019 20:53:58 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 651052F9BE; Mon, 18 Nov 2019 20:53:58 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xAIKrwPJ032718; Mon, 18 Nov 2019 20:53:58 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xAIKrv4Z032716; Mon, 18 Nov 2019 20:53:57 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201911182053.xAIKrv4Z032716@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Mon, 18 Nov 2019 20:53:57 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354828 - in head/sys: dev/hwpmc x86/include x86/x86 X-SVN-Group: head X-SVN-Commit-Author: kib X-SVN-Commit-Paths: in head/sys: dev/hwpmc x86/include x86/x86 X-SVN-Commit-Revision: 354828 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 18 Nov 2019 20:53:58 -0000 Author: kib Date: Mon Nov 18 20:53:57 2019 New Revision: 354828 URL: https://svnweb.freebsd.org/changeset/base/354828 Log: Add x86 msr tweak KPI. Use the KPI to tweak MSRs in mitigation code. Reviewed by: markj, scottl Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D22431 Modified: head/sys/dev/hwpmc/hwpmc_core.c head/sys/x86/include/x86_var.h head/sys/x86/x86/cpu_machdep.c Modified: head/sys/dev/hwpmc/hwpmc_core.c ============================================================================== --- head/sys/dev/hwpmc/hwpmc_core.c Mon Nov 18 20:07:43 2019 (r354827) +++ head/sys/dev/hwpmc/hwpmc_core.c Mon Nov 18 20:53:57 2019 (r354828) @@ -220,15 +220,6 @@ iaf_reload_count_to_perfctr_value(pmc_value_t rlc) return (1ULL << core_iaf_width) - rlc; } -static void -tweak_tsx_force_abort(void *arg) -{ - u_int val; - - val = (uintptr_t)arg; - wrmsr(MSR_TSX_FORCE_ABORT, val); -} - static int iaf_allocate_pmc(int cpu, int ri, struct pmc *pm, const struct pmc_op_pmcallocate *a) @@ -270,7 +261,8 @@ iaf_allocate_pmc(int cpu, int ri, struct pmc *pm, if ((cpu_stdext_feature3 & CPUID_STDEXT3_TSXFA) != 0 && !pmc_tsx_force_abort_set) { pmc_tsx_force_abort_set = true; - smp_rendezvous(NULL, tweak_tsx_force_abort, NULL, (void *)1); + x86_msr_op(MSR_TSX_FORCE_ABORT, MSR_OP_RENDEZVOUS | + MSR_OP_WRITE, 1); } flags = 0; @@ -411,7 +403,8 @@ iaf_release_pmc(int cpu, int ri, struct pmc *pmc) MPASS(pmc_alloc_refs > 0); if (pmc_alloc_refs-- == 1 && pmc_tsx_force_abort_set) { pmc_tsx_force_abort_set = false; - smp_rendezvous(NULL, tweak_tsx_force_abort, NULL, (void *)0); + x86_msr_op(MSR_TSX_FORCE_ABORT, MSR_OP_RENDEZVOUS | + MSR_OP_WRITE, 0); } return (0); Modified: head/sys/x86/include/x86_var.h ============================================================================== --- head/sys/x86/include/x86_var.h Mon Nov 18 20:07:43 2019 (r354827) +++ head/sys/x86/include/x86_var.h Mon Nov 18 20:53:57 2019 (r354828) @@ -148,4 +148,12 @@ int user_dbreg_trap(register_t dr6); int minidumpsys(struct dumperinfo *); struct pcb *get_pcb_td(struct thread *td); +#define MSR_OP_ANDNOT 0x00000001 +#define MSR_OP_OR 0x00000002 +#define MSR_OP_WRITE 0x00000003 +#define MSR_OP_LOCAL 0x10000000 +#define MSR_OP_SCHED 0x20000000 +#define MSR_OP_RENDEZVOUS 0x30000000 +void x86_msr_op(u_int msr, u_int op, uint64_t arg1); + #endif Modified: head/sys/x86/x86/cpu_machdep.c ============================================================================== --- head/sys/x86/x86/cpu_machdep.c Mon Nov 18 20:07:43 2019 (r354827) +++ head/sys/x86/x86/cpu_machdep.c Mon Nov 18 20:53:57 2019 (r354828) @@ -111,6 +111,80 @@ static u_int cpu_reset_proxyid; static volatile u_int cpu_reset_proxy_active; #endif +struct msr_op_arg { + u_int msr; + int op; + uint64_t arg1; +}; + +static void +x86_msr_op_one(void *argp) +{ + struct msr_op_arg *a; + uint64_t v; + + a = argp; + switch (a->op) { + case MSR_OP_ANDNOT: + v = rdmsr(a->msr); + v &= ~a->arg1; + wrmsr(a->msr, v); + break; + case MSR_OP_OR: + v = rdmsr(a->msr); + v |= a->arg1; + wrmsr(a->msr, v); + break; + case MSR_OP_WRITE: + wrmsr(a->msr, a->arg1); + break; + } +} + +#define MSR_OP_EXMODE_MASK 0xf0000000 +#define MSR_OP_OP_MASK 0x000000ff + +void +x86_msr_op(u_int msr, u_int op, uint64_t arg1) +{ + struct thread *td; + struct msr_op_arg a; + u_int exmode; + int bound_cpu, i, is_bound; + + a.op = op & MSR_OP_OP_MASK; + MPASS(a.op == MSR_OP_ANDNOT || a.op == MSR_OP_OR || + a.op == MSR_OP_WRITE); + exmode = op & MSR_OP_EXMODE_MASK; + MPASS(exmode == MSR_OP_LOCAL || exmode == MSR_OP_SCHED || + exmode == MSR_OP_RENDEZVOUS); + a.msr = msr; + a.arg1 = arg1; + switch (exmode) { + case MSR_OP_LOCAL: + x86_msr_op_one(&a); + break; + case MSR_OP_SCHED: + td = curthread; + thread_lock(td); + is_bound = sched_is_bound(td); + bound_cpu = td->td_oncpu; + CPU_FOREACH(i) { + sched_bind(td, i); + x86_msr_op_one(&a); + } + if (is_bound) + sched_bind(td, bound_cpu); + else + sched_unbind(td); + thread_unlock(td); + break; + case MSR_OP_RENDEZVOUS: + smp_rendezvous(NULL, x86_msr_op_one, NULL, &a); + break; + } +} + /* * Automatically initialized per CPU errata in cpu_idle_tun below. */ @@ -806,18 +880,10 @@ SYSCTL_INT(_hw, OID_AUTO, ibrs_active, CTLFLAG_RD, &hw void hw_ibrs_recalculate(void) { - uint64_t v; - if ((cpu_ia32_arch_caps & IA32_ARCH_CAP_IBRS_ALL) != 0) { - if (hw_ibrs_disable) { - v = rdmsr(MSR_IA32_SPEC_CTRL); - v &= ~(uint64_t)IA32_SPEC_CTRL_IBRS; - wrmsr(MSR_IA32_SPEC_CTRL, v); - } else { - v = rdmsr(MSR_IA32_SPEC_CTRL); - v |= IA32_SPEC_CTRL_IBRS; - wrmsr(MSR_IA32_SPEC_CTRL, v); - } + x86_msr_op(MSR_IA32_SPEC_CTRL, MSR_OP_LOCAL | + (hw_ibrs_disable ? MSR_OP_ANDNOT : MSR_OP_OR), + IA32_SPEC_CTRL_IBRS); return; } hw_ibrs_active = (cpu_stdext_feature3 & CPUID_STDEXT3_IBPB) != 0 && @@ -849,46 +915,17 @@ SYSCTL_INT(_hw, OID_AUTO, spec_store_bypass_disable_ac "Speculative Store Bypass Disable active"); static void -hw_ssb_set_one(bool enable) -{ - uint64_t v; - - v = rdmsr(MSR_IA32_SPEC_CTRL); - if (enable) - v |= (uint64_t)IA32_SPEC_CTRL_SSBD; - else - v &= ~(uint64_t)IA32_SPEC_CTRL_SSBD; - wrmsr(MSR_IA32_SPEC_CTRL, v); -} - -static void hw_ssb_set(bool enable, bool for_all_cpus) { - struct thread *td; - int bound_cpu, i, is_bound; if ((cpu_stdext_feature3 & CPUID_STDEXT3_SSBD) == 0) { hw_ssb_active = 0; return; } hw_ssb_active = enable; - if (for_all_cpus) { - td = curthread; - thread_lock(td); - is_bound = sched_is_bound(td); - bound_cpu = td->td_oncpu; - CPU_FOREACH(i) { - sched_bind(td, i); - hw_ssb_set_one(enable); - } - if (is_bound) - sched_bind(td, bound_cpu); - else - sched_unbind(td); - thread_unlock(td); - } else { - hw_ssb_set_one(enable); - } + x86_msr_op(MSR_IA32_SPEC_CTRL, + (enable ? MSR_OP_OR : MSR_OP_ANDNOT) | + (for_all_cpus ? MSR_OP_SCHED : MSR_OP_LOCAL), IA32_SPEC_CTRL_SSBD); } void @@ -1151,43 +1188,13 @@ enum { }; static void -taa_set_one(bool enable) -{ - uint64_t v; - - v = rdmsr(MSR_IA32_TSX_CTRL); - if (enable) - v |= (uint64_t)(IA32_TSX_CTRL_RTM_DISABLE | - IA32_TSX_CTRL_TSX_CPUID_CLEAR); - else - v &= ~(uint64_t)(IA32_TSX_CTRL_RTM_DISABLE | - IA32_TSX_CTRL_TSX_CPUID_CLEAR); - - wrmsr(MSR_IA32_TSX_CTRL, v); -} - -static void taa_set(bool enable, bool all) { - struct thread *td; - int bound_cpu, i, is_bound; - if (all) { - td = curthread; - thread_lock(td); - is_bound = sched_is_bound(td); - bound_cpu = td->td_oncpu; - CPU_FOREACH(i) { - sched_bind(td, i); - taa_set_one(enable); - } - if (is_bound) - sched_bind(td, bound_cpu); - else - sched_unbind(td); - thread_unlock(td); - } else - taa_set_one(enable); + x86_msr_op(MSR_IA32_TSX_CTRL, + (enable ? MSR_OP_OR : MSR_OP_ANDNOT) | + (all ? MSR_OP_RENDEZVOUS : MSR_OP_LOCAL), + IA32_TSX_CTRL_RTM_DISABLE | IA32_TSX_CTRL_TSX_CPUID_CLEAR); } void From owner-svn-src-all@freebsd.org Mon Nov 18 20:55:02 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 5E65C1C982B; Mon, 18 Nov 2019 20:55:02 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47H1Rp1qlTz4X2S; Mon, 18 Nov 2019 20:55:02 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 21D4E2F9C6; Mon, 18 Nov 2019 20:55:02 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xAIKt1nd032842; Mon, 18 Nov 2019 20:55:01 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xAIKt1Dl032841; Mon, 18 Nov 2019 20:55:01 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201911182055.xAIKt1Dl032841@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Mon, 18 Nov 2019 20:55:01 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354829 - head/usr.bin/top X-SVN-Group: head X-SVN-Commit-Author: markj X-SVN-Commit-Paths: head/usr.bin/top X-SVN-Commit-Revision: 354829 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 18 Nov 2019 20:55:02 -0000 Author: markj Date: Mon Nov 18 20:55:01 2019 New Revision: 354829 URL: https://svnweb.freebsd.org/changeset/base/354829 Log: Add a "B" suffix to memory quantities in top(1) output. Otherwise small quantities look nonsensical. For instance, when swapping in a single page we would print "4096 In". Fix code indentation while here. MFC after: 1 week Sponsored by: The FreeBSD Foundation Modified: head/usr.bin/top/utils.c Modified: head/usr.bin/top/utils.c ============================================================================== --- head/usr.bin/top/utils.c Mon Nov 18 20:53:57 2019 (r354828) +++ head/usr.bin/top/utils.c Mon Nov 18 20:55:01 2019 (r354829) @@ -291,13 +291,14 @@ format_time(long seconds) char * format_k(int64_t amt) { - static char retarray[NUM_STRINGS][16]; - static int index_ = 0; - char *ret; + static char retarray[NUM_STRINGS][16]; + static int index_ = 0; + char *ret; - ret = retarray[index_]; + ret = retarray[index_]; index_ = (index_ + 1) % NUM_STRINGS; - humanize_number(ret, 6, amt * 1024, "", HN_AUTOSCALE, HN_NOSPACE); + humanize_number(ret, 6, amt * 1024, "", HN_AUTOSCALE, HN_NOSPACE | + HN_B); return (ret); } From owner-svn-src-all@freebsd.org Mon Nov 18 20:57:02 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id D5C641C98FF; Mon, 18 Nov 2019 20:57:02 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47H1V65JbYz4XBM; Mon, 18 Nov 2019 20:57:02 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 788282F9C7; Mon, 18 Nov 2019 20:57:02 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xAIKv2VE032984; Mon, 18 Nov 2019 20:57:02 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xAIKuxpg032968; Mon, 18 Nov 2019 20:56:59 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201911182056.xAIKuxpg032968@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Mon, 18 Nov 2019 20:56:59 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354830 - in head/sys/x86: include iommu x86 X-SVN-Group: head X-SVN-Commit-Author: kib X-SVN-Commit-Paths: in head/sys/x86: include iommu x86 X-SVN-Commit-Revision: 354830 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 18 Nov 2019 20:57:02 -0000 Author: kib Date: Mon Nov 18 20:56:59 2019 New Revision: 354830 URL: https://svnweb.freebsd.org/changeset/base/354830 Log: bus_dma_dmar_set_buswide(9): KPI to indicate that the whole dmar context should share page tables. Practically it means that dma requests from any device on the bus are translated according to the entries loaded for the bus:0:0 device. KPI requires that the slot and function of the device be 0:0, and that no tags for other devices on the bus were used. The intended use are NTBs which pass TLPs from the downstream to the host with slot:func of the downstream originator. Reviewed and tested by: mav Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D22434 Modified: head/sys/x86/include/bus_dma.h head/sys/x86/iommu/busdma_dmar.c head/sys/x86/iommu/intel_ctx.c head/sys/x86/iommu/intel_dmar.h head/sys/x86/iommu/intel_drv.c head/sys/x86/iommu/intel_gas.c head/sys/x86/iommu/intel_idpgtbl.c head/sys/x86/iommu/intel_intrmap.c head/sys/x86/iommu/intel_qi.c head/sys/x86/iommu/intel_quirks.c head/sys/x86/iommu/intel_utils.c head/sys/x86/x86/busdma_machdep.c Modified: head/sys/x86/include/bus_dma.h ============================================================================== --- head/sys/x86/include/bus_dma.h Mon Nov 18 20:55:01 2019 (r354829) +++ head/sys/x86/include/bus_dma.h Mon Nov 18 20:56:59 2019 (r354830) @@ -191,5 +191,7 @@ _bus_dmamap_complete(bus_dma_tag_t dmat, bus_dmamap_t return (tc->impl->map_complete(dmat, map, segs, nsegs, error)); } +bool bus_dma_dmar_set_buswide(device_t dev); + #endif /* !_X86_BUS_DMA_H_ */ Modified: head/sys/x86/iommu/busdma_dmar.c ============================================================================== --- head/sys/x86/iommu/busdma_dmar.c Mon Nov 18 20:55:01 2019 (r354829) +++ head/sys/x86/iommu/busdma_dmar.c Mon Nov 18 20:56:59 2019 (r354830) @@ -289,6 +289,34 @@ dmar_get_dma_tag(device_t dev, device_t child) return (res); } +bool +bus_dma_dmar_set_buswide(device_t dev) +{ + struct dmar_unit *dmar; + device_t parent; + u_int busno, slot, func; + + parent = device_get_parent(dev); + if (device_get_devclass(parent) != devclass_find("pci")) + return (false); + dmar = dmar_find(dev, bootverbose); + if (dmar == NULL) + return (false); + busno = pci_get_bus(dev); + slot = pci_get_slot(dev); + func = pci_get_function(dev); + if (slot != 0 || func != 0) { + if (bootverbose) { + device_printf(dev, + "dmar%d pci%d:%d:%d requested buswide busdma\n", + dmar->unit, busno, slot, func); + } + return (false); + } + dmar_set_buswide_ctx(dmar, busno); + return (true); +} + static MALLOC_DEFINE(M_DMAR_DMAMAP, "dmar_dmamap", "Intel DMAR DMA Map"); static void dmar_bus_schedule_dmamap(struct dmar_unit *unit, Modified: head/sys/x86/iommu/intel_ctx.c ============================================================================== --- head/sys/x86/iommu/intel_ctx.c Mon Nov 18 20:55:01 2019 (r354829) +++ head/sys/x86/iommu/intel_ctx.c Mon Nov 18 20:56:59 2019 (r354830) @@ -67,8 +67,8 @@ __FBSDID("$FreeBSD$"); #include #include #include -#include #include +#include #include static MALLOC_DEFINE(M_DMAR_CTX, "dmar_ctx", "Intel DMAR Context"); @@ -141,20 +141,9 @@ ctx_tag_init(struct dmar_ctx *ctx, device_t dev) } static void -ctx_id_entry_init(struct dmar_ctx *ctx, dmar_ctx_entry_t *ctxp, bool move) +ctx_id_entry_init_one(dmar_ctx_entry_t *ctxp, struct dmar_domain *domain, + vm_page_t ctx_root) { - struct dmar_unit *unit; - struct dmar_domain *domain; - vm_page_t ctx_root; - - domain = ctx->domain; - unit = domain->dmar; - KASSERT(move || (ctxp->ctx1 == 0 && ctxp->ctx2 == 0), - ("dmar%d: initialized ctx entry %d:%d:%d 0x%jx 0x%jx", - unit->unit, pci_get_bus(ctx->ctx_tag.owner), - pci_get_slot(ctx->ctx_tag.owner), - pci_get_function(ctx->ctx_tag.owner), - ctxp->ctx1, ctxp->ctx2)); /* * For update due to move, the store is not atomic. It is * possible that DMAR read upper doubleword, while low @@ -166,17 +155,49 @@ ctx_id_entry_init(struct dmar_ctx *ctx, dmar_ctx_entry */ dmar_pte_store1(&ctxp->ctx2, DMAR_CTX2_DID(domain->domain) | domain->awlvl); + if (ctx_root == NULL) { + dmar_pte_store1(&ctxp->ctx1, DMAR_CTX1_T_PASS | DMAR_CTX1_P); + } else { + dmar_pte_store1(&ctxp->ctx1, DMAR_CTX1_T_UNTR | + (DMAR_CTX1_ASR_MASK & VM_PAGE_TO_PHYS(ctx_root)) | + DMAR_CTX1_P); + } +} + +static void +ctx_id_entry_init(struct dmar_ctx *ctx, dmar_ctx_entry_t *ctxp, bool move, + int busno) +{ + struct dmar_unit *unit; + struct dmar_domain *domain; + vm_page_t ctx_root; + int i; + + domain = ctx->domain; + unit = domain->dmar; + KASSERT(move || (ctxp->ctx1 == 0 && ctxp->ctx2 == 0), + ("dmar%d: initialized ctx entry %d:%d:%d 0x%jx 0x%jx", + unit->unit, busno, pci_get_slot(ctx->ctx_tag.owner), + pci_get_function(ctx->ctx_tag.owner), + ctxp->ctx1, ctxp->ctx2)); + if ((domain->flags & DMAR_DOMAIN_IDMAP) != 0 && (unit->hw_ecap & DMAR_ECAP_PT) != 0) { KASSERT(domain->pgtbl_obj == NULL, ("ctx %p non-null pgtbl_obj", ctx)); - dmar_pte_store1(&ctxp->ctx1, DMAR_CTX1_T_PASS | DMAR_CTX1_P); + ctx_root = NULL; } else { ctx_root = dmar_pgalloc(domain->pgtbl_obj, 0, DMAR_PGF_NOALLOC); - dmar_pte_store1(&ctxp->ctx1, DMAR_CTX1_T_UNTR | - (DMAR_CTX1_ASR_MASK & VM_PAGE_TO_PHYS(ctx_root)) | - DMAR_CTX1_P); } + + if (dmar_is_buswide_ctx(unit, busno)) { + MPASS(!move); + for (i = 0; i <= PCI_BUSMAX; i++) { + ctx_id_entry_init_one(&ctxp[i], domain, ctx_root); + } + } else { + ctx_id_entry_init_one(ctxp, domain, ctx_root); + } dmar_flush_ctx_to_ram(unit, ctxp); } @@ -444,6 +465,9 @@ dmar_get_ctx_for_dev1(struct dmar_unit *dmar, device_t enable = false; TD_PREP_PINNED_ASSERT; DMAR_LOCK(dmar); + KASSERT(!dmar_is_buswide_ctx(dmar, bus) || (slot == 0 && func == 0), + ("dmar%d pci%d:%d:%d get_ctx for buswide", dmar->unit, bus, + slot, func)); ctx = dmar_find_ctx_locked(dmar, rid); error = 0; if (ctx == NULL) { @@ -492,7 +516,7 @@ dmar_get_ctx_for_dev1(struct dmar_unit *dmar, device_t if (LIST_EMPTY(&dmar->domains)) enable = true; LIST_INSERT_HEAD(&dmar->domains, domain, link); - ctx_id_entry_init(ctx, ctxp, false); + ctx_id_entry_init(ctx, ctxp, false, bus); if (dev != NULL) { device_printf(dev, "dmar%d pci%d:%d:%d:%d rid %x domain %d mgaw %d " @@ -597,7 +621,7 @@ dmar_move_ctx_to_domain(struct dmar_domain *domain, st dmar_ctx_unlink(ctx); ctx->domain = domain; dmar_ctx_link(ctx); - ctx_id_entry_init(ctx, ctxp, true); + ctx_id_entry_init(ctx, ctxp, true, PCI_BUSMAX + 100); dmar_unmap_pgtbl(sf); error = dmar_flush_for_ctx_entry(dmar, true); /* If flush failed, rolling back would not work as well. */ Modified: head/sys/x86/iommu/intel_dmar.h ============================================================================== --- head/sys/x86/iommu/intel_dmar.h Mon Nov 18 20:55:01 2019 (r354829) +++ head/sys/x86/iommu/intel_dmar.h Mon Nov 18 20:56:59 2019 (r354830) @@ -239,6 +239,15 @@ struct dmar_unit { struct taskqueue *delayed_taskqueue; int dma_enabled; + + /* + * Bitmap of buses for which context must ignore slot:func, + * duplicating the page table pointer into all context table + * entries. This is a client-controlled quirk to support some + * NTBs. + */ + uint32_t buswide_ctxs[(PCI_BUSMAX + 1) / NBBY / sizeof(uint32_t)]; + }; #define DMAR_LOCK(dmar) mtx_lock(&(dmar)->lock) @@ -376,6 +385,9 @@ void dmar_quirks_pre_use(struct dmar_unit *dmar); int dmar_init_irt(struct dmar_unit *unit); void dmar_fini_irt(struct dmar_unit *unit); + +void dmar_set_buswide_ctx(struct dmar_unit *unit, u_int busno); +bool dmar_is_buswide_ctx(struct dmar_unit *unit, u_int busno); #define DMAR_GM_CANWAIT 0x0001 #define DMAR_GM_CANSPLIT 0x0002 Modified: head/sys/x86/iommu/intel_drv.c ============================================================================== --- head/sys/x86/iommu/intel_drv.c Mon Nov 18 20:55:01 2019 (r354829) +++ head/sys/x86/iommu/intel_drv.c Mon Nov 18 20:56:59 2019 (r354830) @@ -69,9 +69,9 @@ __FBSDID("$FreeBSD$"); #include #include #include -#include #include #include +#include #ifdef DEV_APIC #include "pcib_if.h" @@ -594,6 +594,26 @@ static driver_t dmar_driver = { DRIVER_MODULE(dmar, acpi, dmar_driver, dmar_devclass, 0, 0); MODULE_DEPEND(dmar, acpi, 1, 1, 1); + +void +dmar_set_buswide_ctx(struct dmar_unit *unit, u_int busno) +{ + + MPASS(busno <= PCI_BUSMAX); + DMAR_LOCK(unit); + unit->buswide_ctxs[busno / NBBY / sizeof(uint32_t)] |= + 1 << (busno % (NBBY * sizeof(uint32_t))); + DMAR_UNLOCK(unit); +} + +bool +dmar_is_buswide_ctx(struct dmar_unit *unit, u_int busno) +{ + + MPASS(busno <= PCI_BUSMAX); + return ((unit->buswide_ctxs[busno / NBBY / sizeof(uint32_t)] & + (1U << (busno % (NBBY * sizeof(uint32_t))))) != 0); +} static void dmar_print_path(int busno, int depth, const ACPI_DMAR_PCI_PATH *path) Modified: head/sys/x86/iommu/intel_gas.c ============================================================================== --- head/sys/x86/iommu/intel_gas.c Mon Nov 18 20:55:01 2019 (r354829) +++ head/sys/x86/iommu/intel_gas.c Mon Nov 18 20:56:59 2019 (r354830) @@ -67,6 +67,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include /* Modified: head/sys/x86/iommu/intel_idpgtbl.c ============================================================================== --- head/sys/x86/iommu/intel_idpgtbl.c Mon Nov 18 20:55:01 2019 (r354829) +++ head/sys/x86/iommu/intel_idpgtbl.c Mon Nov 18 20:56:59 2019 (r354830) @@ -66,6 +66,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include static int domain_unmap_buf_locked(struct dmar_domain *domain, Modified: head/sys/x86/iommu/intel_intrmap.c ============================================================================== --- head/sys/x86/iommu/intel_intrmap.c Mon Nov 18 20:55:01 2019 (r354829) +++ head/sys/x86/iommu/intel_intrmap.c Mon Nov 18 20:56:59 2019 (r354830) @@ -55,6 +55,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include Modified: head/sys/x86/iommu/intel_qi.c ============================================================================== --- head/sys/x86/iommu/intel_qi.c Mon Nov 18 20:55:01 2019 (r354829) +++ head/sys/x86/iommu/intel_qi.c Mon Nov 18 20:56:59 2019 (r354830) @@ -58,6 +58,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include static bool Modified: head/sys/x86/iommu/intel_quirks.c ============================================================================== --- head/sys/x86/iommu/intel_quirks.c Mon Nov 18 20:55:01 2019 (r354829) +++ head/sys/x86/iommu/intel_quirks.c Mon Nov 18 20:56:59 2019 (r354830) @@ -60,6 +60,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include Modified: head/sys/x86/iommu/intel_utils.c ============================================================================== --- head/sys/x86/iommu/intel_utils.c Mon Nov 18 20:55:01 2019 (r354829) +++ head/sys/x86/iommu/intel_utils.c Mon Nov 18 20:56:59 2019 (r354830) @@ -66,6 +66,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include u_int Modified: head/sys/x86/x86/busdma_machdep.c ============================================================================== --- head/sys/x86/x86/busdma_machdep.c Mon Nov 18 20:55:01 2019 (r354829) +++ head/sys/x86/x86/busdma_machdep.c Mon Nov 18 20:56:59 2019 (r354830) @@ -33,6 +33,8 @@ #include __FBSDID("$FreeBSD$"); +#include "opt_acpi.h" + #include #include #include @@ -245,3 +247,10 @@ bus_dma_tag_destroy(bus_dma_tag_t dmat) return (tc->impl->tag_destroy(dmat)); } +#ifndef ACPI_DMAR +bool +bus_dma_dmar_set_buswide(device_t dev) +{ + return (false); +} +#endif From owner-svn-src-all@freebsd.org Mon Nov 18 20:57:59 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id B7A5F1C99E5; Mon, 18 Nov 2019 20:57:59 +0000 (UTC) (envelope-from carpeddiem@gmail.com) Received: from mail-io1-f43.google.com (mail-io1-f43.google.com [209.85.166.43]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47H1WC3MPbz4XNK; Mon, 18 Nov 2019 20:57:59 +0000 (UTC) (envelope-from carpeddiem@gmail.com) Received: by mail-io1-f43.google.com with SMTP id r144so20402861iod.8; Mon, 18 Nov 2019 12:57:59 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=C59KyayCOmeEk250hAnHCENLY2icH3L1vcDQm2uqaNM=; b=YNAHGCJvHCKpVXLK9ie4/akmv2pzUn7wUXD4BVsLIIn9r2S2HdhupwqL9GxjiC7hih AoHxGmeFP45vLG4dXOcSbCl70hrDQyKG7O0Q39AosSQMNjoxkQLyQvnvdD3cUuFKj6Mi 867jMsFBTQFNzIntRSFEIrAzNRgHFAbEybKaXsy0BC4Itz7c1MYolXY2+A8mqlzW3QLb uSA/xpqkBszuw0DqL/WJpoEAZRdeB/BEhD08z89QpE3sxoYWciTDipTf8LPRguX3WXC4 c/e8SiMYFxVNuBdinZPwor7fkpuCrc7KCIQQ5IhlgjY6PxNsRilRV22C9FA3GaU0Pqc3 V6ZA== X-Gm-Message-State: APjAAAUEPx2iSQVI44LX0gu2I0HaL1bNNlbatE3B0rIWRvG7PqOKUAm9 iGsaJv02zfKBwM3GmBlXv2HUdNEDJBjrf+am84/MrRhu X-Google-Smtp-Source: APXvYqzphfdR9AcFPzuHzUZEY2hsH9ZiyCvEh01Y/0D915hPF6QdUit4EsHnLMnXpP0z2EwWmIKFSrOMEkj6dmRJT84= X-Received: by 2002:a6b:b511:: with SMTP id e17mr14460724iof.18.1574110677372; Mon, 18 Nov 2019 12:57:57 -0800 (PST) MIME-Version: 1.0 References: <201911181905.xAIJ5q6A068355@repo.freebsd.org> <20191118194501.GA43295@raichu> <20191118203529.GA64688@FreeBSD.org> <20191118204836.GB43295@raichu> In-Reply-To: <20191118204836.GB43295@raichu> From: Ed Maste Date: Mon, 18 Nov 2019 12:11:17 -0500 Message-ID: Subject: Re: svn commit: r354824 - head/lib/geom/part To: Mark Johnston Cc: Alexey Dokuchaev , Alan Somers , svn-src-head , svn-src-all , src-committers Content-Type: text/plain; charset="UTF-8" X-Rspamd-Queue-Id: 47H1WC3MPbz4XNK X-Spamd-Bar: ----- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-5.92 / 15.00]; NEURAL_HAM_MEDIUM(-0.93)[-0.927,0]; NEURAL_HAM_LONG(-1.00)[-0.996,0]; REPLY(-4.00)[] X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 18 Nov 2019 20:57:59 -0000 On Mon, 18 Nov 2019 at 15:48, Mark Johnston wrote: > > > I presume that "content" means more like semantic, functional changes > > that affect some particular meaning. Grammar fixes are just, well, > > grammar fixes and thus do not warrant .Dd bump. > > Indeed, this was always my understanding as well. I can't find a > concrete definition anywhere. I don't understand why it would be useful > as a user to see the date of the last "content change" if such changes > might consist only of a small formatting change or typo fix. My understanding as well. My thinking - if the user last read the man page prior to the .Dd date then they know they have a reason to read it again. On Mon, 18 Nov 2019 at 15:50, Cy Schubert wrote: > > Should this be documented in the committers guide? Yes, it probably should. We probably need to provide more guidance on documentation in the committer's guide, but there's already a small bit about man pages in "18.3. Other Suggestions" and we could add this there. From owner-svn-src-all@freebsd.org Mon Nov 18 21:54:30 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 8DE021CA939; Mon, 18 Nov 2019 21:54:30 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47H2mQ3BSPz4b9V; Mon, 18 Nov 2019 21:54:30 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 521A64FD; Mon, 18 Nov 2019 21:54:30 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xAILsUER068218; Mon, 18 Nov 2019 21:54:30 GMT (envelope-from bz@FreeBSD.org) Received: (from bz@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xAILsUXj068217; Mon, 18 Nov 2019 21:54:30 GMT (envelope-from bz@FreeBSD.org) Message-Id: <201911182154.xAILsUXj068217@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bz set sender to bz@FreeBSD.org using -f From: "Bjoern A. Zeeb" Date: Mon, 18 Nov 2019 21:54:30 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354831 - head/tests/sys/netinet6 X-SVN-Group: head X-SVN-Commit-Author: bz X-SVN-Commit-Paths: head/tests/sys/netinet6 X-SVN-Commit-Revision: 354831 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 18 Nov 2019 21:54:30 -0000 Author: bz Date: Mon Nov 18 21:54:29 2019 New Revision: 354831 URL: https://svnweb.freebsd.org/changeset/base/354831 Log: ipv6 tests Add a simple ping6 test as well. MFC after: 2 weeks Sponsored by: Netflix Modified: head/tests/sys/netinet6/exthdr.sh Modified: head/tests/sys/netinet6/exthdr.sh ============================================================================== --- head/tests/sys/netinet6/exthdr.sh Mon Nov 18 20:56:59 2019 (r354830) +++ head/tests/sys/netinet6/exthdr.sh Mon Nov 18 21:54:29 2019 (r354831) @@ -74,6 +74,8 @@ exthdr_body() { pyname=$(atf_get ident) pyname=${pyname%*_[0-9]} + atf_check -o ignore -s exit:0 ping6 -c 3 -q -o ${ip6b} + atf_check -s exit:0 $(atf_get_srcdir)/${pyname}.py \ --sendif ${epair}a --recvif ${epair}a \ --src ${ip6a} --to ${ip6b} From owner-svn-src-all@freebsd.org Mon Nov 18 21:59:49 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id C6CD21CAB97; Mon, 18 Nov 2019 21:59:49 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47H2tY4Y4Bz4bRf; Mon, 18 Nov 2019 21:59:49 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 7F57E535; Mon, 18 Nov 2019 21:59:49 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xAILxnsj068536; Mon, 18 Nov 2019 21:59:49 GMT (envelope-from bz@FreeBSD.org) Received: (from bz@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xAILxmAt068529; Mon, 18 Nov 2019 21:59:48 GMT (envelope-from bz@FreeBSD.org) Message-Id: <201911182159.xAILxmAt068529@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bz set sender to bz@FreeBSD.org using -f From: "Bjoern A. Zeeb" Date: Mon, 18 Nov 2019 21:59:48 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354832 - in head: sys/netinet6 tests/sys/netinet6 X-SVN-Group: head X-SVN-Commit-Author: bz X-SVN-Commit-Paths: in head: sys/netinet6 tests/sys/netinet6 X-SVN-Commit-Revision: 354832 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 18 Nov 2019 21:59:49 -0000 Author: bz Date: Mon Nov 18 21:59:47 2019 New Revision: 354832 URL: https://svnweb.freebsd.org/changeset/base/354832 Log: icmpv6: Fix mbuf change in mld After r354748 mld_input() can change the mbuf. The new pointer is never returned to icmp6_input() and when passed to icmp6_rip6_input() the mbuf may no longer valid leading to a panic. Pass a pointer to the mbuf to mld_input() so we can return an updated version in the non-error case. Add a test sending an MLD packet case which will trigger this bug. Pointyhat to: bz Reported by: gallatin, thj MFC After: 2 weeks X-MFC with: r354748 Sponsored by: Netflix Added: head/tests/sys/netinet6/mld.py (contents, props changed) head/tests/sys/netinet6/mld.sh (contents, props changed) Modified: head/sys/netinet6/icmp6.c head/sys/netinet6/mld6.c head/sys/netinet6/mld6_var.h head/tests/sys/netinet6/Makefile Modified: head/sys/netinet6/icmp6.c ============================================================================== --- head/sys/netinet6/icmp6.c Mon Nov 18 21:54:29 2019 (r354831) +++ head/sys/netinet6/icmp6.c Mon Nov 18 21:59:47 2019 (r354832) @@ -604,7 +604,7 @@ icmp6_input(struct mbuf **mp, int *offp, int proto) */ if ((ip6->ip6_hlim != 1) || (m->m_flags & M_RTALERT_MLD) == 0) goto freeit; - if (mld_input(m, off, icmp6len) != 0) { + if (mld_input(&m, off, icmp6len) != 0) { *mp = NULL; return (IPPROTO_DONE); } Modified: head/sys/netinet6/mld6.c ============================================================================== --- head/sys/netinet6/mld6.c Mon Nov 18 21:54:29 2019 (r354831) +++ head/sys/netinet6/mld6.c Mon Nov 18 21:59:47 2019 (r354832) @@ -1249,13 +1249,15 @@ out_locked: * Return IPPROTO_DONE if we freed m. Otherwise, return 0. */ int -mld_input(struct mbuf *m, int off, int icmp6len) +mld_input(struct mbuf **mp, int off, int icmp6len) { struct ifnet *ifp; struct ip6_hdr *ip6; + struct mbuf *m; struct mld_hdr *mld; int mldlen; + m = *mp; CTR3(KTR_MLD, "%s: called w/mbuf (%p,%d)", __func__, m, off); ifp = m->m_pkthdr.rcvif; @@ -1278,6 +1280,7 @@ mld_input(struct mbuf *m, int off, int icmp6len) ICMP6STAT_INC(icp6s_badlen); return (IPPROTO_DONE); } + *mp = m; ip6 = mtod(m, struct ip6_hdr *); mld = (struct mld_hdr *)(mtod(m, uint8_t *) + off); Modified: head/sys/netinet6/mld6_var.h ============================================================================== --- head/sys/netinet6/mld6_var.h Mon Nov 18 21:54:29 2019 (r354831) +++ head/sys/netinet6/mld6_var.h Mon Nov 18 21:59:47 2019 (r354832) @@ -167,7 +167,7 @@ struct mld_ifsoftc * void mld_domifdetach(struct ifnet *); void mld_fasttimo(void); void mld_ifdetach(struct ifnet *, struct in6_multi_head *); -int mld_input(struct mbuf *, int, int); +int mld_input(struct mbuf **, int, int); void mld_slowtimo(void); #ifdef SYSCTL_DECL Modified: head/tests/sys/netinet6/Makefile ============================================================================== --- head/tests/sys/netinet6/Makefile Mon Nov 18 21:54:29 2019 (r354831) +++ head/tests/sys/netinet6/Makefile Mon Nov 18 21:59:47 2019 (r354832) @@ -7,12 +7,15 @@ FILESDIR= ${TESTSDIR} ATF_TESTS_SH= \ exthdr \ + mld \ scapyi386 ${PACKAGE}FILES+= exthdr.py +${PACKAGE}FILES+= mld.py ${PACKAGE}FILES+= scapyi386.py ${PACKAGE}FILESMODE_exthdr.py= 0555 +${PACKAGE}FILESMODE_mld.py= 0555 ${PACKAGE}FILESMODE_scapyi386.py=0555 TESTS_SUBDIRS+= frag6 Added: head/tests/sys/netinet6/mld.py ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/tests/sys/netinet6/mld.py Mon Nov 18 21:59:47 2019 (r354832) @@ -0,0 +1,76 @@ +#!/usr/bin/env python +#- +# SPDX-License-Identifier: BSD-2-Clause +# +# Copyright (c) 2019 Netflix, Inc. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# +# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND +# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE +# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +# SUCH DAMAGE. +# +# $FreeBSD$ +# + +import argparse +import scapy.all as sp +import socket +import sys +import binascii + +def main(): + parser = argparse.ArgumentParser("scapyi386.py", + description="IPv6 Ethernet Dest MAC test") + parser.add_argument('--sendif', nargs=1, + required=True, + help='The interface through which the packet will be sent') + parser.add_argument('--recvif', nargs=1, + required=True, + help='The interface on which to check for the packet') + parser.add_argument('--src', nargs=1, + required=True, + help='The source IP address') + parser.add_argument('--to', nargs=1, + required=True, + help='The destination IP address') + parser.add_argument('--debug', + required=False, action='store_true', + help='Enable test debugging') + parser.add_argument('--mldraw01', + required=False, action='store_true', + help='Multicast Listener Query Raw01') + + args = parser.parse_args() + + pkt = None + if args.mldraw01: + pkt = sp.Ether() / \ + sp.IPv6(dst="ff02::1", hlim=1, nh=0) / \ + sp.IPv6ExtHdrHopByHop(options = sp.RouterAlert(value=0)) / \ + sp.ICMPv6MLQuery() + if pkt is None: + sys.exit(1) + if args.debug: + pkt.display() + sp.sendp(pkt, iface=args.sendif[0], verbose=False) + + sys.exit(0) + +if __name__ == '__main__': + main() Added: head/tests/sys/netinet6/mld.sh ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/tests/sys/netinet6/mld.sh Mon Nov 18 21:59:47 2019 (r354832) @@ -0,0 +1,89 @@ +# $FreeBSD$ +#- +# SPDX-License-Identifier: BSD-2-Clause +# +# Copyright (c) 2019 Netflix, Inc. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# +# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND +# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE +# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +# SUCH DAMAGE. +# + +. $(atf_get_srcdir)/../common/vnet.subr + +atf_test_case "mldraw01" "cleanup" +mldraw01_head() { + + atf_set descr 'Test for correct Ethernet Destination MAC address' + atf_set require.user root + atf_set require.progs scapy +} + +mldraw01_body() { + + ids=65533 + id=`printf "%x" ${ids}` + if [ $$ -gt 65535 ]; then + xl=`printf "%x" $(($$ - 65535))` + yl="1" + else + xl=`printf "%x" $$` + yl="" + fi + + vnet_init + + ip6a="2001:db8:6666:0000:${yl}:${id}:1:${xl}" + ip6b="2001:db8:6666:0000:${yl}:${id}:2:${xl}" + + epair=$(vnet_mkepair) + ifconfig ${epair}a up + ifconfig ${epair}a inet6 ${ip6a}/64 + + jname="v6t-${id}-${yl}-${xl}" + vnet_mkjail ${jname} ${epair}b + jexec ${jname} ifconfig ${epair}b up + jexec ${jname} ifconfig ${epair}b inet6 ${ip6b}/64 + + # Let IPv6 ND do its thing. + #ping6 -q -c 1 ff02::1%${epair}a + #ping6 -q -c 1 ${ip6b} + sleep 3 + + pyname=$(atf_get ident) + + atf_check -s exit:0 $(atf_get_srcdir)/mld.py \ + --sendif ${epair}a --recvif ${epair}a \ + --src ${ip6a} --to ${ip6b} \ + --${pyname} +} + +mldraw01_cleanup() { + + vnet_cleanup +} + +atf_init_test_cases() +{ + + atf_add_test_case "mldraw01" +} + +# end From owner-svn-src-all@freebsd.org Mon Nov 18 22:04:18 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id E13591CAD5C; Mon, 18 Nov 2019 22:04:18 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from smtp.freebsd.org (smtp.freebsd.org [96.47.72.83]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "smtp.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47H2zk5Qc7z4bpv; Mon, 18 Nov 2019 22:04:18 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from mx1.sbone.de (mx1.sbone.de [IPv6:2a01:4f8:13b:39f::9f:25]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mx1.sbone.de", Issuer "SBone.DE" (not verified)) (Authenticated sender: bz/mail) by smtp.freebsd.org (Postfix) with ESMTPSA id 53A60BEEE; Mon, 18 Nov 2019 22:04:18 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from mail.sbone.de (mail.sbone.de [IPv6:fde9:577b:c1a9:31::2013:587]) (using TLSv1 with cipher ADH-CAMELLIA256-SHA (256/256 bits)) (No client certificate requested) by mx1.sbone.de (Postfix) with ESMTPS id 3DA4E8D4A166; Mon, 18 Nov 2019 22:04:17 +0000 (UTC) Received: from content-filter.sbone.de (content-filter.sbone.de [IPv6:fde9:577b:c1a9:31::2013:2742]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.sbone.de (Postfix) with ESMTPS id B418EE708A7; Mon, 18 Nov 2019 22:04:16 +0000 (UTC) X-Virus-Scanned: amavisd-new at sbone.de Received: from mail.sbone.de ([IPv6:fde9:577b:c1a9:31::2013:587]) by content-filter.sbone.de (content-filter.sbone.de [fde9:577b:c1a9:31::2013:2742]) (amavisd-new, port 10024) with ESMTP id 5JO252xySknt; Mon, 18 Nov 2019 22:04:14 +0000 (UTC) Received: from [192.168.2.110] (unknown [IPv6:fde9:577b:c1a9:31:7c23:6b40:bb8b:b641]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.sbone.de (Postfix) with ESMTPSA id 3196CE707B4; Mon, 18 Nov 2019 22:04:14 +0000 (UTC) From: "Bjoern A. Zeeb" To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r354832 - in head: sys/netinet6 tests/sys/netinet6 Date: Mon, 18 Nov 2019 22:04:13 +0000 X-Mailer: MailMate (2.0BETAr6142) Message-ID: In-Reply-To: <201911182159.xAILxmAt068529@repo.freebsd.org> References: <201911182159.xAILxmAt068529@repo.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; format=flowed X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 18 Nov 2019 22:04:18 -0000 On 18 Nov 2019, at 21:59, Bjoern A. Zeeb wrote: > Author: bz > Date: Mon Nov 18 21:59:47 2019 > New Revision: 354832 > URL: https://svnweb.freebsd.org/changeset/base/354832 > > Log: > icmpv6: Fix mbuf change in mld > > After r354748 mld_input() can change the mbuf. The new pointer > is never returned to icmp6_input() and when passed to > icmp6_rip6_input() the mbuf may no longer valid leading to > a panic. > Pass a pointer to the mbuf to mld_input() so we can return an > updated version in the non-error case. > > Add a test sending an MLD packet case which will trigger this bug. The test case currently (after this commit) also triggers an epoch assert which is unrelated to these changes. Just in case anyone wonders in case they still see a panic with the changes applied. The original problem manifested itself like this: Fatal trap 9: general protection fault while in kernel mode cpuid = 0; apic id = 02 instruction pointer = 0x20:0xffffffff80e0a7e3 stack pointer = 0x28:0xfffffe00acfea5f0 frame pointer = 0x28:0xfffffe00acfea780 code segment = base 0x0, limit 0xfffff, type 0x1b = DPL 0, pres 1, long 1, def32 0, gran 1 processor eflags = interrupt enabled, resume, IOPL = 0 current process = 12 (swi1: netisr 0) trap number = 9 panic: general protection fault cpuid = 0 time = 1574113185 KDB: stack backtrace: db_trace_self_wrapper() at db_trace_self_wrapper+0x2b/frame 0xfffffe00acfea2d0 vpanic() at vpanic+0x17e/frame 0xfffffe00acfea330 panic() at panic+0x43/frame 0xfffffe00acfea390 trap_fatal() at trap_fatal+0x386/frame 0xfffffe00acfea3f0 trap() at trap+0x67/frame 0xfffffe00acfea520 calltrap() at calltrap+0x8/frame 0xfffffe00acfea520 --- trap 0x9, rip = 0xffffffff80e0a7e3, rsp = 0xfffffe00acfea5f0, rbp = 0xfffffe00acfea780 --- icmp6_input() at icmp6_input+0xf83/frame 0xfffffe00acfea780 ip6_input() at ip6_input+0xd1e/frame 0xfffffe00acfea860 netisr_dispatch_src() at netisr_dispatch_src+0xb1/frame 0xfffffe00acfea8e0 ether_demux() at ether_demux+0x16e/frame 0xfffffe00acfea910 ether_nh_input() at ether_nh_input+0x408/frame 0xfffffe00acfea970 netisr_dispatch_src() at netisr_dispatch_src+0xb1/frame 0xfffffe00acfea9f0 ether_input() at ether_input+0x9d/frame 0xfffffe00acfeaa70 epair_nh_sintr() at epair_nh_sintr+0x17/frame 0xfffffe00acfeaa90 swi_net() at swi_net+0x1c3/frame 0xfffffe00acfeab50 ithread_loop() at ithread_loop+0x1c6/frame 0xfffffe00acfeabb0 fork_exit() at fork_exit+0x80/frame 0xfffffe00acfeabf0 fork_trampoline() at fork_trampoline+0xe/frame 0xfffffe00acfeabf0 --- trap 0, rip = 0, rsp = 0, rbp = 0 --- KDB: enter: panic [ thread pid 12 tid 100027 ] Stopped at kdb_enter+0x37: movq $0,0x108a776(%rip) From owner-svn-src-all@freebsd.org Mon Nov 18 23:21:14 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id A17EA1CBE42; Mon, 18 Nov 2019 23:21:14 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47H4hV4bFKz4fqJ; Mon, 18 Nov 2019 23:21:14 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 81EC0140A; Mon, 18 Nov 2019 23:21:14 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xAINLEd1015949; Mon, 18 Nov 2019 23:21:14 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xAINLDaU015512; Mon, 18 Nov 2019 23:21:13 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201911182321.xAINLDaU015512@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Mon, 18 Nov 2019 23:21:13 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354833 - in head: libexec libexec/flua libexec/flua/modules share/mk stand stand/liblua X-SVN-Group: head X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: in head: libexec libexec/flua libexec/flua/modules share/mk stand stand/liblua X-SVN-Commit-Revision: 354833 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 18 Nov 2019 23:21:14 -0000 Author: kevans Date: Mon Nov 18 23:21:13 2019 New Revision: 354833 URL: https://svnweb.freebsd.org/changeset/base/354833 Log: Add flua to the base system, install to /usr/libexec FreeBSDlua ("flua") is a FreeBSD-private lua, flavored with whatever extensions we need for base system operations. We currently support a subset of lfs and lposix that are used in the rewrite of makesyscall.sh into lua, added in r354786. flua is intentionally written such that one can install standard lua and some set of lua modules from ports and achieve the same effect. linit_flua is a copy of linit.c from contrib/lua with lfs and lposix added in. This is similar to what we do in stand/. linit.c has been renamed to make it clear that this has flua-specific bits. luaconf has been slightly obfuscated to make extensions more difficult. Part of the problem is that flua is already hard enough to use as a bootstrap tool because it's not in PATH- attempting to do extension loading would require a special bootstrap version of flua with paths changed to protect the innocent. src.lua.mk has been added to make it easy for in-tree stuff to find flua, whether it's bootstrap-flua or relying on PATH frobbing by Makefile.inc1. Reviewed by: brooks, emaste (both earlier version), imp Differential Revision: https://reviews.freebsd.org/D21893 Added: head/libexec/flua/ head/libexec/flua/Makefile (contents, props changed) head/libexec/flua/linit_flua.c (contents, props changed) head/libexec/flua/luaconf.h (contents, props changed) head/libexec/flua/modules/ head/libexec/flua/modules/lfs.c - copied, changed from r354832, head/stand/liblua/lfs.c head/libexec/flua/modules/lfs.h - copied unchanged from r354832, head/stand/liblua/lfs.h head/libexec/flua/modules/lposix.c (contents, props changed) head/libexec/flua/modules/lposix.h (contents, props changed) head/share/mk/src.lua.mk (contents, props changed) Deleted: head/stand/liblua/lfs.c head/stand/liblua/lfs.h Modified: head/libexec/Makefile head/stand/defs.mk head/stand/liblua/Makefile head/stand/loader.mk Modified: head/libexec/Makefile ============================================================================== --- head/libexec/Makefile Mon Nov 18 21:59:47 2019 (r354832) +++ head/libexec/Makefile Mon Nov 18 23:21:13 2019 (r354833) @@ -8,6 +8,7 @@ SUBDIR= ${_atf} \ ${_blacklistd-helper} \ ${_comsat} \ ${_dma} \ + flua \ getty \ ${_mail.local} \ ${_makewhatis.local} \ Added: head/libexec/flua/Makefile ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/libexec/flua/Makefile Mon Nov 18 23:21:13 2019 (r354833) @@ -0,0 +1,36 @@ +#! $FreeBSD$ + +.include + +LUASRC?= ${SRCTOP}/contrib/lua/src +.PATH: ${LUASRC} + +PROG= flua +WARNS?= 2 +MAN= # No manpage; this is internal. + +LIBADD= m + +# Core functions +SRCS= lapi.c lcode.c lctype.c ldebug.c ldo.c ldump.c lfunc.c lgc.c llex.c \ + lmem.c lobject.c lopcodes.c lparser.c lstate.c lstring.c ltable.c \ + ltm.c lundump.c lvm.c lzio.c + +# Library functions; any change to these likely needs an accompanying change +# in our custom linit_flua.c. We use our custom linit.c to make it easier to +# support bootstrap flua that may not have supporting local libraries. +SRCS+= lauxlib.c lbaselib.c lbitlib.c lcorolib.c ldblib.c liolib.c \ + lmathlib.c loslib.c lstrlib.c ltablib.c lutf8lib.c loadlib.c + +# Entry point +SRCS+= lua.c + +# FreeBSD Extensions +.PATH: ${.CURDIR}/modules +SRCS+= linit_flua.c +SRCS+= lfs.c lposix.c + +CFLAGS+= -I${.CURDIR} -I${.CURDIR}/modules -I${LUASRC} +CFLAGS+= -DLUA_PROGNAME="\"${PROG}\"" + +.include Added: head/libexec/flua/linit_flua.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/libexec/flua/linit_flua.c Mon Nov 18 23:21:13 2019 (r354833) @@ -0,0 +1,73 @@ +/* $FreeBSD$ */ +/* +** $Id: linit.c,v 1.39.1.1 2017/04/19 17:20:42 roberto Exp $ +** Initialization of libraries for lua.c and other clients +** See Copyright Notice in lua.h +*/ + + +#define linit_c +#define LUA_LIB + +/* +** If you embed Lua in your program and need to open the standard +** libraries, call luaL_openlibs in your program. If you need a +** different set of libraries, copy this file to your project and edit +** it to suit your needs. +** +** You can also *preload* libraries, so that a later 'require' can +** open the library, which is already linked to the application. +** For that, do the following code: +** +** luaL_getsubtable(L, LUA_REGISTRYINDEX, LUA_PRELOAD_TABLE); +** lua_pushcfunction(L, luaopen_modname); +** lua_setfield(L, -2, modname); +** lua_pop(L, 1); // remove PRELOAD table +*/ + +#include "lprefix.h" + + +#include + +#include "lua.h" + +#include "lualib.h" +#include "lauxlib.h" +#include "lfs.h" +#include "lposix.h" + +/* +** these libs are loaded by lua.c and are readily available to any Lua +** program +*/ +static const luaL_Reg loadedlibs[] = { + {"_G", luaopen_base}, + {LUA_LOADLIBNAME, luaopen_package}, + {LUA_COLIBNAME, luaopen_coroutine}, + {LUA_TABLIBNAME, luaopen_table}, + {LUA_IOLIBNAME, luaopen_io}, + {LUA_OSLIBNAME, luaopen_os}, + {LUA_STRLIBNAME, luaopen_string}, + {LUA_MATHLIBNAME, luaopen_math}, + {LUA_UTF8LIBNAME, luaopen_utf8}, + {LUA_DBLIBNAME, luaopen_debug}, +#if defined(LUA_COMPAT_BITLIB) + {LUA_BITLIBNAME, luaopen_bit32}, +#endif + /* FreeBSD Extensions */ + {"lfs", luaopen_lfs}, + {"posix.unistd", luaopen_posix_unistd}, + {NULL, NULL} +}; + + +LUALIB_API void luaL_openlibs (lua_State *L) { + const luaL_Reg *lib; + /* "require" functions from 'loadedlibs' and set results to global table */ + for (lib = loadedlibs; lib->func; lib++) { + luaL_requiref(L, lib->name, lib->func, 1); + lua_pop(L, 1); /* remove lib */ + } +} + Added: head/libexec/flua/luaconf.h ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/libexec/flua/luaconf.h Mon Nov 18 23:21:13 2019 (r354833) @@ -0,0 +1,795 @@ +/* $FreeBSD$ */ +/* +** $Id: luaconf.h,v 1.259.1.1 2017/04/19 17:29:57 roberto Exp $ +** Configuration file for Lua +** See Copyright Notice in lua.h +*/ + + +#ifndef luaconf_h +#define luaconf_h + +#include +#include + + +/* +** =================================================================== +** Search for "@@" to find all configurable definitions. +** =================================================================== +*/ + + +/* +** {==================================================================== +** System Configuration: macros to adapt (if needed) Lua to some +** particular platform, for instance compiling it with 32-bit numbers or +** restricting it to C89. +** ===================================================================== +*/ + +/* +@@ LUA_32BITS enables Lua with 32-bit integers and 32-bit floats. You +** can also define LUA_32BITS in the make file, but changing here you +** ensure that all software connected to Lua will be compiled with the +** same configuration. +*/ +/* #define LUA_32BITS */ + + +/* +@@ LUA_USE_C89 controls the use of non-ISO-C89 features. +** Define it if you want Lua to avoid the use of a few C99 features +** or Windows-specific features on Windows. +*/ +/* #define LUA_USE_C89 */ + + +/* +** By default, Lua on Windows use (some) specific Windows features +*/ +#if !defined(LUA_USE_C89) && defined(_WIN32) && !defined(_WIN32_WCE) +#define LUA_USE_WINDOWS /* enable goodies for regular Windows */ +#endif + + +#if defined(LUA_USE_WINDOWS) +#define LUA_DL_DLL /* enable support for DLL */ +#define LUA_USE_C89 /* broadly, Windows is C89 */ +#endif + + +#if defined(LUA_USE_LINUX) +#define LUA_USE_POSIX +#define LUA_USE_DLOPEN /* needs an extra library: -ldl */ +#define LUA_USE_READLINE /* needs some extra libraries */ +#endif + + +#if defined(LUA_USE_MACOSX) +#define LUA_USE_POSIX +#define LUA_USE_DLOPEN /* MacOS does not need -ldl */ +#define LUA_USE_READLINE /* needs an extra library: -lreadline */ +#endif + +/* Local modifications: need io.popen */ +#ifdef __FreeBSD__ +#define LUA_USE_POSIX +#endif + +/* +@@ LUA_C89_NUMBERS ensures that Lua uses the largest types available for +** C89 ('long' and 'double'); Windows always has '__int64', so it does +** not need to use this case. +*/ +#if defined(LUA_USE_C89) && !defined(LUA_USE_WINDOWS) +#define LUA_C89_NUMBERS +#endif + + + +/* +@@ LUAI_BITSINT defines the (minimum) number of bits in an 'int'. +*/ +/* avoid undefined shifts */ +#if ((INT_MAX >> 15) >> 15) >= 1 +#define LUAI_BITSINT 32 +#else +/* 'int' always must have at least 16 bits */ +#define LUAI_BITSINT 16 +#endif + + +/* +@@ LUA_INT_TYPE defines the type for Lua integers. +@@ LUA_FLOAT_TYPE defines the type for Lua floats. +** Lua should work fine with any mix of these options (if supported +** by your C compiler). The usual configurations are 64-bit integers +** and 'double' (the default), 32-bit integers and 'float' (for +** restricted platforms), and 'long'/'double' (for C compilers not +** compliant with C99, which may not have support for 'long long'). +*/ + +/* predefined options for LUA_INT_TYPE */ +#define LUA_INT_INT 1 +#define LUA_INT_LONG 2 +#define LUA_INT_LONGLONG 3 + +/* predefined options for LUA_FLOAT_TYPE */ +#define LUA_FLOAT_FLOAT 1 +#define LUA_FLOAT_DOUBLE 2 +#define LUA_FLOAT_LONGDOUBLE 3 + +#if defined(LUA_32BITS) /* { */ +/* +** 32-bit integers and 'float' +*/ +#if LUAI_BITSINT >= 32 /* use 'int' if big enough */ +#define LUA_INT_TYPE LUA_INT_INT +#else /* otherwise use 'long' */ +#define LUA_INT_TYPE LUA_INT_LONG +#endif +#define LUA_FLOAT_TYPE LUA_FLOAT_FLOAT + +#elif defined(LUA_C89_NUMBERS) /* }{ */ +/* +** largest types available for C89 ('long' and 'double') +*/ +#define LUA_INT_TYPE LUA_INT_LONG +#define LUA_FLOAT_TYPE LUA_FLOAT_DOUBLE + +#endif /* } */ + + +/* +** default configuration for 64-bit Lua ('long long' and 'double') +*/ +#if !defined(LUA_INT_TYPE) +#define LUA_INT_TYPE LUA_INT_LONGLONG +#endif + +#if !defined(LUA_FLOAT_TYPE) +#define LUA_FLOAT_TYPE LUA_FLOAT_DOUBLE +#endif + +/* }================================================================== */ + + + + +/* +** {================================================================== +** Configuration for Paths. +** =================================================================== +*/ + +/* +** LUA_PATH_SEP is the character that separates templates in a path. +** LUA_PATH_MARK is the string that marks the substitution points in a +** template. +** LUA_EXEC_DIR in a Windows path is replaced by the executable's +** directory. +*/ +#define LUA_PATH_SEP ";" +#define LUA_PATH_MARK "?" +#define LUA_EXEC_DIR "!" + + +/* +@@ LUA_PATH_DEFAULT is the default path that Lua uses to look for +** Lua libraries. +@@ LUA_CPATH_DEFAULT is the default path that Lua uses to look for +** C libraries. +** CHANGE them if your machine has a non-conventional directory +** hierarchy or if you want to install your libraries in +** non-conventional directories. +*/ +#define LUA_VDIR LUA_VERSION_MAJOR "." LUA_VERSION_MINOR +#if defined(_WIN32) /* { */ +/* +** In Windows, any exclamation mark ('!') in the path is replaced by the +** path of the directory of the executable file of the current process. +*/ +#define LUA_LDIR "!\\lua\\" +#define LUA_CDIR "!\\" +#define LUA_SHRDIR "!\\..\\share\\lua\\" LUA_VDIR "\\" +#define LUA_PATH_DEFAULT \ + LUA_LDIR"?.lua;" LUA_LDIR"?\\init.lua;" \ + LUA_CDIR"?.lua;" LUA_CDIR"?\\init.lua;" \ + LUA_SHRDIR"?.lua;" LUA_SHRDIR"?\\init.lua;" \ + ".\\?.lua;" ".\\?\\init.lua" +#define LUA_CPATH_DEFAULT \ + LUA_CDIR"?.dll;" \ + LUA_CDIR"..\\lib\\lua\\" LUA_VDIR "\\?.dll;" \ + LUA_CDIR"loadall.dll;" ".\\?.dll" + +#else /* }{ */ + +#define LUA_ROOT "/usr/local/" +#define LUA_LDIR LUA_ROOT "share/lua/" LUA_VDIR "/" +#define LUA_CDIR LUA_ROOT "lib/lua/" LUA_VDIR "/" +#define LUA_PATH_DEFAULT \ + LUA_LDIR"?.lua;" LUA_LDIR"?/init.lua;" \ + LUA_CDIR"?.lua;" LUA_CDIR"?/init.lua;" \ + "./?.lua;" "./?/init.lua" +#define LUA_CPATH_DEFAULT \ + LUA_CDIR"?.so;" LUA_CDIR"loadall.so;" "./?.so" +#endif /* } */ + + +/* +@@ LUA_DIRSEP is the directory separator (for submodules). +** CHANGE it if your machine does not use "/" as the directory separator +** and is not Windows. (On Windows Lua automatically uses "\".) +*/ +#if defined(_WIN32) +#define LUA_DIRSEP "\\" +#else +#define LUA_DIRSEP "/" +#endif + +/* }================================================================== */ + + +/* +** {================================================================== +** Marks for exported symbols in the C code +** =================================================================== +*/ + +/* +@@ LUA_API is a mark for all core API functions. +@@ LUALIB_API is a mark for all auxiliary library functions. +@@ LUAMOD_API is a mark for all standard library opening functions. +** CHANGE them if you need to define those functions in some special way. +** For instance, if you want to create one Windows DLL with the core and +** the libraries, you may want to use the following definition (define +** LUA_BUILD_AS_DLL to get it). +*/ +#if defined(LUA_BUILD_AS_DLL) /* { */ + +#if defined(LUA_CORE) || defined(LUA_LIB) /* { */ +#define LUA_API __declspec(dllexport) +#else /* }{ */ +#define LUA_API __declspec(dllimport) +#endif /* } */ + +#else /* }{ */ + +#define LUA_API extern + +#endif /* } */ + + +/* more often than not the libs go together with the core */ +#define LUALIB_API LUA_API +#define LUAMOD_API LUALIB_API + + +/* +@@ LUAI_FUNC is a mark for all extern functions that are not to be +** exported to outside modules. +@@ LUAI_DDEF and LUAI_DDEC are marks for all extern (const) variables +** that are not to be exported to outside modules (LUAI_DDEF for +** definitions and LUAI_DDEC for declarations). +** CHANGE them if you need to mark them in some special way. Elf/gcc +** (versions 3.2 and later) mark them as "hidden" to optimize access +** when Lua is compiled as a shared library. Not all elf targets support +** this attribute. Unfortunately, gcc does not offer a way to check +** whether the target offers that support, and those without support +** give a warning about it. To avoid these warnings, change to the +** default definition. +*/ +#if defined(__GNUC__) && ((__GNUC__*100 + __GNUC_MINOR__) >= 302) && \ + defined(__ELF__) /* { */ +#define LUAI_FUNC __attribute__((visibility("hidden"))) extern +#else /* }{ */ +#define LUAI_FUNC extern +#endif /* } */ + +#define LUAI_DDEC LUAI_FUNC +#define LUAI_DDEF /* empty */ + +/* }================================================================== */ + + +/* +** {================================================================== +** Compatibility with previous versions +** =================================================================== +*/ + +/* +@@ LUA_COMPAT_5_2 controls other macros for compatibility with Lua 5.2. +@@ LUA_COMPAT_5_1 controls other macros for compatibility with Lua 5.1. +** You can define it to get all options, or change specific options +** to fit your specific needs. +*/ +#if defined(LUA_COMPAT_5_2) /* { */ + +/* +@@ LUA_COMPAT_MATHLIB controls the presence of several deprecated +** functions in the mathematical library. +*/ +#define LUA_COMPAT_MATHLIB + +/* +@@ LUA_COMPAT_BITLIB controls the presence of library 'bit32'. +*/ +#define LUA_COMPAT_BITLIB + +/* +@@ LUA_COMPAT_IPAIRS controls the effectiveness of the __ipairs metamethod. +*/ +#define LUA_COMPAT_IPAIRS + +/* +@@ LUA_COMPAT_APIINTCASTS controls the presence of macros for +** manipulating other integer types (lua_pushunsigned, lua_tounsigned, +** luaL_checkint, luaL_checklong, etc.) +*/ +#define LUA_COMPAT_APIINTCASTS + +#endif /* } */ + + +#if defined(LUA_COMPAT_5_1) /* { */ + +/* Incompatibilities from 5.2 -> 5.3 */ +#define LUA_COMPAT_MATHLIB +#define LUA_COMPAT_APIINTCASTS + +/* +@@ LUA_COMPAT_UNPACK controls the presence of global 'unpack'. +** You can replace it with 'table.unpack'. +*/ +#define LUA_COMPAT_UNPACK + +/* +@@ LUA_COMPAT_LOADERS controls the presence of table 'package.loaders'. +** You can replace it with 'package.searchers'. +*/ +#define LUA_COMPAT_LOADERS + +/* +@@ macro 'lua_cpcall' emulates deprecated function lua_cpcall. +** You can call your C function directly (with light C functions). +*/ +#define lua_cpcall(L,f,u) \ + (lua_pushcfunction(L, (f)), \ + lua_pushlightuserdata(L,(u)), \ + lua_pcall(L,1,0,0)) + + +/* +@@ LUA_COMPAT_LOG10 defines the function 'log10' in the math library. +** You can rewrite 'log10(x)' as 'log(x, 10)'. +*/ +#define LUA_COMPAT_LOG10 + +/* +@@ LUA_COMPAT_LOADSTRING defines the function 'loadstring' in the base +** library. You can rewrite 'loadstring(s)' as 'load(s)'. +*/ +#define LUA_COMPAT_LOADSTRING + +/* +@@ LUA_COMPAT_MAXN defines the function 'maxn' in the table library. +*/ +#define LUA_COMPAT_MAXN + +/* +@@ The following macros supply trivial compatibility for some +** changes in the API. The macros themselves document how to +** change your code to avoid using them. +*/ +#define lua_strlen(L,i) lua_rawlen(L, (i)) + +#define lua_objlen(L,i) lua_rawlen(L, (i)) + +#define lua_equal(L,idx1,idx2) lua_compare(L,(idx1),(idx2),LUA_OPEQ) +#define lua_lessthan(L,idx1,idx2) lua_compare(L,(idx1),(idx2),LUA_OPLT) + +/* +@@ LUA_COMPAT_MODULE controls compatibility with previous +** module functions 'module' (Lua) and 'luaL_register' (C). +*/ +#define LUA_COMPAT_MODULE + +#endif /* } */ + + +/* +@@ LUA_COMPAT_FLOATSTRING makes Lua format integral floats without a +@@ a float mark ('.0'). +** This macro is not on by default even in compatibility mode, +** because this is not really an incompatibility. +*/ +/* #define LUA_COMPAT_FLOATSTRING */ + +/* }================================================================== */ + + + +/* +** {================================================================== +** Configuration for Numbers. +** Change these definitions if no predefined LUA_FLOAT_* / LUA_INT_* +** satisfy your needs. +** =================================================================== +*/ + +/* +@@ LUA_NUMBER is the floating-point type used by Lua. +@@ LUAI_UACNUMBER is the result of a 'default argument promotion' +@@ over a floating number. +@@ l_mathlim(x) corrects limit name 'x' to the proper float type +** by prefixing it with one of FLT/DBL/LDBL. +@@ LUA_NUMBER_FRMLEN is the length modifier for writing floats. +@@ LUA_NUMBER_FMT is the format for writing floats. +@@ lua_number2str converts a float to a string. +@@ l_mathop allows the addition of an 'l' or 'f' to all math operations. +@@ l_floor takes the floor of a float. +@@ lua_str2number converts a decimal numeric string to a number. +*/ + + +/* The following definitions are good for most cases here */ + +#define l_floor(x) (l_mathop(floor)(x)) + +#define lua_number2str(s,sz,n) \ + l_sprintf((s), sz, LUA_NUMBER_FMT, (LUAI_UACNUMBER)(n)) + +/* +@@ lua_numbertointeger converts a float number to an integer, or +** returns 0 if float is not within the range of a lua_Integer. +** (The range comparisons are tricky because of rounding. The tests +** here assume a two-complement representation, where MININTEGER always +** has an exact representation as a float; MAXINTEGER may not have one, +** and therefore its conversion to float may have an ill-defined value.) +*/ +#define lua_numbertointeger(n,p) \ + ((n) >= (LUA_NUMBER)(LUA_MININTEGER) && \ + (n) < -(LUA_NUMBER)(LUA_MININTEGER) && \ + (*(p) = (LUA_INTEGER)(n), 1)) + + +/* now the variable definitions */ + +#if LUA_FLOAT_TYPE == LUA_FLOAT_FLOAT /* { single float */ + +#define LUA_NUMBER float + +#define l_mathlim(n) (FLT_##n) + +#define LUAI_UACNUMBER double + +#define LUA_NUMBER_FRMLEN "" +#define LUA_NUMBER_FMT "%.7g" + +#define l_mathop(op) op##f + +#define lua_str2number(s,p) strtof((s), (p)) + + +#elif LUA_FLOAT_TYPE == LUA_FLOAT_LONGDOUBLE /* }{ long double */ + +#define LUA_NUMBER long double + +#define l_mathlim(n) (LDBL_##n) + +#define LUAI_UACNUMBER long double + +#define LUA_NUMBER_FRMLEN "L" +#define LUA_NUMBER_FMT "%.19Lg" + +#define l_mathop(op) op##l + +#define lua_str2number(s,p) strtold((s), (p)) + +#elif LUA_FLOAT_TYPE == LUA_FLOAT_DOUBLE /* }{ double */ + +#define LUA_NUMBER double + +#define l_mathlim(n) (DBL_##n) + +#define LUAI_UACNUMBER double + +#define LUA_NUMBER_FRMLEN "" +#define LUA_NUMBER_FMT "%.14g" + +#define l_mathop(op) op + +#define lua_str2number(s,p) strtod((s), (p)) + +#else /* }{ */ + +#error "numeric float type not defined" + +#endif /* } */ + + + +/* +@@ LUA_INTEGER is the integer type used by Lua. +** +@@ LUA_UNSIGNED is the unsigned version of LUA_INTEGER. +** +@@ LUAI_UACINT is the result of a 'default argument promotion' +@@ over a lUA_INTEGER. +@@ LUA_INTEGER_FRMLEN is the length modifier for reading/writing integers. +@@ LUA_INTEGER_FMT is the format for writing integers. +@@ LUA_MAXINTEGER is the maximum value for a LUA_INTEGER. +@@ LUA_MININTEGER is the minimum value for a LUA_INTEGER. +@@ lua_integer2str converts an integer to a string. +*/ + + +/* The following definitions are good for most cases here */ + +#define LUA_INTEGER_FMT "%" LUA_INTEGER_FRMLEN "d" + +#define LUAI_UACINT LUA_INTEGER + +#define lua_integer2str(s,sz,n) \ + l_sprintf((s), sz, LUA_INTEGER_FMT, (LUAI_UACINT)(n)) + +/* +** use LUAI_UACINT here to avoid problems with promotions (which +** can turn a comparison between unsigneds into a signed comparison) +*/ +#define LUA_UNSIGNED unsigned LUAI_UACINT + + +/* now the variable definitions */ + +#if LUA_INT_TYPE == LUA_INT_INT /* { int */ + +#define LUA_INTEGER int +#define LUA_INTEGER_FRMLEN "" + +#define LUA_MAXINTEGER INT_MAX +#define LUA_MININTEGER INT_MIN + +#elif LUA_INT_TYPE == LUA_INT_LONG /* }{ long */ + +#define LUA_INTEGER long +#define LUA_INTEGER_FRMLEN "l" + +#define LUA_MAXINTEGER LONG_MAX +#define LUA_MININTEGER LONG_MIN + +#elif LUA_INT_TYPE == LUA_INT_LONGLONG /* }{ long long */ + +/* use presence of macro LLONG_MAX as proxy for C99 compliance */ +#if defined(LLONG_MAX) /* { */ +/* use ISO C99 stuff */ + +#define LUA_INTEGER long long +#define LUA_INTEGER_FRMLEN "ll" + +#define LUA_MAXINTEGER LLONG_MAX +#define LUA_MININTEGER LLONG_MIN + +#elif defined(LUA_USE_WINDOWS) /* }{ */ +/* in Windows, can use specific Windows types */ + +#define LUA_INTEGER __int64 +#define LUA_INTEGER_FRMLEN "I64" + +#define LUA_MAXINTEGER _I64_MAX +#define LUA_MININTEGER _I64_MIN + +#else /* }{ */ + +#error "Compiler does not support 'long long'. Use option '-DLUA_32BITS' \ + or '-DLUA_C89_NUMBERS' (see file 'luaconf.h' for details)" + +#endif /* } */ + +#else /* }{ */ + +#error "numeric integer type not defined" + +#endif /* } */ + +/* }================================================================== */ + + +/* +** {================================================================== +** Dependencies with C99 and other C details +** =================================================================== +*/ + +/* +@@ l_sprintf is equivalent to 'snprintf' or 'sprintf' in C89. +** (All uses in Lua have only one format item.) +*/ +#if !defined(LUA_USE_C89) +#define l_sprintf(s,sz,f,i) snprintf(s,sz,f,i) +#else +#define l_sprintf(s,sz,f,i) ((void)(sz), sprintf(s,f,i)) +#endif + + +/* +@@ lua_strx2number converts an hexadecimal numeric string to a number. +** In C99, 'strtod' does that conversion. Otherwise, you can +** leave 'lua_strx2number' undefined and Lua will provide its own +** implementation. +*/ +#if !defined(LUA_USE_C89) +#define lua_strx2number(s,p) lua_str2number(s,p) +#endif + + +/* +@@ lua_pointer2str converts a pointer to a readable string in a +** non-specified way. +*/ +#define lua_pointer2str(buff,sz,p) l_sprintf(buff,sz,"%p",p) + + +/* +@@ lua_number2strx converts a float to an hexadecimal numeric string. +** In C99, 'sprintf' (with format specifiers '%a'/'%A') does that. +** Otherwise, you can leave 'lua_number2strx' undefined and Lua will +** provide its own implementation. +*/ +#if !defined(LUA_USE_C89) +#define lua_number2strx(L,b,sz,f,n) \ + ((void)L, l_sprintf(b,sz,f,(LUAI_UACNUMBER)(n))) +#endif + + +/* +** 'strtof' and 'opf' variants for math functions are not valid in +** C89. Otherwise, the macro 'HUGE_VALF' is a good proxy for testing the +** availability of these variants. ('math.h' is already included in +** all files that use these macros.) +*/ +#if defined(LUA_USE_C89) || (defined(HUGE_VAL) && !defined(HUGE_VALF)) +#undef l_mathop /* variants not available */ +#undef lua_str2number +#define l_mathop(op) (lua_Number)op /* no variant */ +#define lua_str2number(s,p) ((lua_Number)strtod((s), (p))) +#endif + + +/* +@@ LUA_KCONTEXT is the type of the context ('ctx') for continuation +** functions. It must be a numerical type; Lua will use 'intptr_t' if +** available, otherwise it will use 'ptrdiff_t' (the nearest thing to +** 'intptr_t' in C89) +*/ +#define LUA_KCONTEXT ptrdiff_t + +#if !defined(LUA_USE_C89) && defined(__STDC_VERSION__) && \ + __STDC_VERSION__ >= 199901L +#include +#if defined(INTPTR_MAX) /* even in C99 this type is optional */ +#undef LUA_KCONTEXT +#define LUA_KCONTEXT intptr_t +#endif +#endif + + +/* +@@ lua_getlocaledecpoint gets the locale "radix character" (decimal point). +** Change that if you do not want to use C locales. (Code using this +** macro must include header 'locale.h'.) +*/ +#if !defined(lua_getlocaledecpoint) +#define lua_getlocaledecpoint() (localeconv()->decimal_point[0]) +#endif + +/* }================================================================== */ + + +/* +** {================================================================== +** Language Variations +** ===================================================================== +*/ + +/* +@@ LUA_NOCVTN2S/LUA_NOCVTS2N control how Lua performs some +** coercions. Define LUA_NOCVTN2S to turn off automatic coercion from +** numbers to strings. Define LUA_NOCVTS2N to turn off automatic +** coercion from strings to numbers. +*/ +/* #define LUA_NOCVTN2S */ +/* #define LUA_NOCVTS2N */ + + +/* +@@ LUA_USE_APICHECK turns on several consistency checks on the C API. +** Define it as a help when debugging C code. +*/ +#if defined(LUA_USE_APICHECK) +#include +#define luai_apicheck(l,e) assert(e) +#endif + +/* }================================================================== */ + + +/* +** {================================================================== +** Macros that affect the API and must be stable (that is, must be the +** same when you compile Lua and when you compile code that links to +** Lua). You probably do not want/need to change them. +** ===================================================================== +*/ + +/* +@@ LUAI_MAXSTACK limits the size of the Lua stack. +** CHANGE it if you need a different limit. This limit is arbitrary; +** its only purpose is to stop Lua from consuming unlimited stack +** space (and to reserve some numbers for pseudo-indices). +*/ +#if LUAI_BITSINT >= 32 +#define LUAI_MAXSTACK 1000000 +#else +#define LUAI_MAXSTACK 15000 +#endif + + +/* +@@ LUA_EXTRASPACE defines the size of a raw memory area associated with +** a Lua state with very fast access. +** CHANGE it if you need a different size. +*/ +#define LUA_EXTRASPACE (sizeof(void *)) + + +/* +@@ LUA_IDSIZE gives the maximum size for the description of the source +@@ of a function in debug information. +** CHANGE it if you want a different size. +*/ +#define LUA_IDSIZE 60 + + +/* +@@ LUAL_BUFFERSIZE is the buffer size used by the lauxlib buffer system. +** CHANGE it if it uses too much C-stack space. (For long double, +** 'string.format("%.99f", -1e4932)' needs 5034 bytes, so a +** smaller buffer would force a memory allocation for each call to +** 'string.format'.) +*/ +#if LUA_FLOAT_TYPE == LUA_FLOAT_LONGDOUBLE +#define LUAL_BUFFERSIZE 8192 +#else +#define LUAL_BUFFERSIZE ((int)(0x80 * sizeof(void*) * sizeof(lua_Integer))) +#endif + +/* }================================================================== */ + + +/* +@@ LUA_QL describes how error messages quote program elements. +** Lua does not use these macros anymore; they are here for +** compatibility only. +*/ +#define LUA_QL(x) "'" x "'" +#define LUA_QS LUA_QL("%s") + + + + +/* =================================================================== */ + +/* +** Local configuration. You can use this space to add your redefinitions +** without modifying the main part of the file. +*/ + + + + + +#endif + Copied and modified: head/libexec/flua/modules/lfs.c (from r354832, head/stand/liblua/lfs.c) ============================================================================== --- head/stand/liblua/lfs.c Mon Nov 18 21:59:47 2019 (r354832, copy source) +++ head/libexec/flua/modules/lfs.c Mon Nov 18 23:21:13 2019 (r354833) @@ -52,12 +52,24 @@ #include __FBSDID("$FreeBSD$"); +#ifndef _STANDALONE +#include +#include +#include +#include +#include +#include +#endif + #include #include "lauxlib.h" #include "lfs.h" + +#ifdef _STANDALONE #include "lstd.h" #include "lutils.h" #include "bootstrap.h" +#endif #ifndef nitems #define nitems(x) (sizeof((x)) / sizeof((x)[0])) @@ -120,7 +132,11 @@ lua_dir_iter_next(lua_State *L) dp = *dpp; luaL_argcheck(L, dp != NULL, 1, "closed directory"); +#ifdef _STANDALONE entry = readdirfd(dp->fd); +#else + entry = readdir(dp); +#endif if (entry == NULL) { closedir(dp); *dpp = NULL; @@ -325,10 +341,76 @@ lua_attributes(lua_State *L) return 1; } +#ifndef _STANDALONE +#define lfs_mkdir_impl(path) (mkdir((path), \ + S_IRUSR | S_IWUSR | S_IXUSR | S_IRGRP | S_IWGRP | S_IXGRP | \ + S_IROTH | S_IXOTH)) + +static int +lua_mkdir(lua_State *L) +{ + const char *path; + int error, serrno; + + path = luaL_checkstring(L, 1); + if (path == NULL) { + lua_pushnil(L); + lua_pushfstring(L, "cannot convert first argument to string"); + lua_pushinteger(L, EINVAL); + return 3; + } + + error = lfs_mkdir_impl(path); + if (error == -1) { + /* Save it; unclear what other libc functions may be invoked */ + serrno = errno; + lua_pushnil(L); + lua_pushfstring(L, strerror(serrno)); + lua_pushinteger(L, serrno); + return 3; + } + + lua_pushboolean(L, 1); + return 1; +} + +static int *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-all@freebsd.org Mon Nov 18 23:23:39 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 7F2281CC002; Mon, 18 Nov 2019 23:23:39 +0000 (UTC) (envelope-from jhibbits@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47H4lH2Qqdz4g3h; Mon, 18 Nov 2019 23:23:39 +0000 (UTC) (envelope-from jhibbits@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 36AE1158A; Mon, 18 Nov 2019 23:23:39 +0000 (UTC) (envelope-from jhibbits@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xAINNdkr021023; Mon, 18 Nov 2019 23:23:39 GMT (envelope-from jhibbits@FreeBSD.org) Received: (from jhibbits@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xAINNdsg021022; Mon, 18 Nov 2019 23:23:39 GMT (envelope-from jhibbits@FreeBSD.org) Message-Id: <201911182323.xAINNdsg021022@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhibbits set sender to jhibbits@FreeBSD.org using -f From: Justin Hibbits Date: Mon, 18 Nov 2019 23:23:39 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354834 - head/contrib/bsnmp/lib X-SVN-Group: head X-SVN-Commit-Author: jhibbits X-SVN-Commit-Paths: head/contrib/bsnmp/lib X-SVN-Commit-Revision: 354834 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 18 Nov 2019 23:23:39 -0000 Author: jhibbits Date: Mon Nov 18 23:23:38 2019 New Revision: 354834 URL: https://svnweb.freebsd.org/changeset/base/354834 Log: bsnmp: Fix operator precedence in error check in table_check_response Summary: The ?: operator has a lower precedence than == and &&, so the result will always be recorded as true. Found by gcc8. Reviewed by: ngie, ae Differential Revision: https://reviews.freebsd.org/D22427 Modified: head/contrib/bsnmp/lib/snmpclient.c Modified: head/contrib/bsnmp/lib/snmpclient.c ============================================================================== --- head/contrib/bsnmp/lib/snmpclient.c Mon Nov 18 23:21:13 2019 (r354833) +++ head/contrib/bsnmp/lib/snmpclient.c Mon Nov 18 23:23:38 2019 (r354834) @@ -480,7 +480,7 @@ table_check_response(struct tabwork *work, const struc if (snmp_client.version == SNMP_V1 && resp->error_status == SNMP_ERR_NOSUCHNAME && resp->error_index == - (work->descr->last_change.len == 0) ? 1 : 2) + ((work->descr->last_change.len == 0) ? 1 : 2)) /* EOT */ return (0); /* Error */ From owner-svn-src-all@freebsd.org Mon Nov 18 23:28:26 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 2A4761CC106; Mon, 18 Nov 2019 23:28:26 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47H4rp0Mvmz4gCD; Mon, 18 Nov 2019 23:28:26 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id DFF71158E; Mon, 18 Nov 2019 23:28:25 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xAINSPAr021330; Mon, 18 Nov 2019 23:28:25 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xAINSNwL021319; Mon, 18 Nov 2019 23:28:23 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201911182328.xAINSNwL021319@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Mon, 18 Nov 2019 23:28:23 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354835 - in head: . sys/amd64/linux sys/amd64/linux32 sys/arm64/linux sys/compat/cloudabi32 sys/compat/cloudabi64 sys/compat/freebsd32 sys/i386/linux sys/kern sys/sys tools/build X-SVN-Group: head X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: in head: . sys/amd64/linux sys/amd64/linux32 sys/arm64/linux sys/compat/cloudabi32 sys/compat/cloudabi64 sys/compat/freebsd32 sys/i386/linux sys/kern sys/sys tools/build X-SVN-Commit-Revision: 354835 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 18 Nov 2019 23:28:26 -0000 Author: kevans Date: Mon Nov 18 23:28:23 2019 New Revision: 354835 URL: https://svnweb.freebsd.org/changeset/base/354835 Log: Convert in-tree sysent targets to use new makesyscalls.lua flua is bootstrapped as part of the build for those on older versions/revisions that don't yet have flua installed. Once upgraded past r354833, "make sysent" will again naturally work as expected. Reviewed by: brooks Differential Revision: https://reviews.freebsd.org/D21894 Modified: head/Makefile.inc1 head/sys/amd64/linux/Makefile head/sys/amd64/linux32/Makefile head/sys/arm64/linux/Makefile head/sys/compat/cloudabi32/Makefile head/sys/compat/cloudabi64/Makefile head/sys/compat/freebsd32/Makefile head/sys/i386/linux/Makefile head/sys/kern/Makefile head/sys/sys/param.h head/tools/build/Makefile Modified: head/Makefile.inc1 ============================================================================== --- head/Makefile.inc1 Mon Nov 18 23:23:38 2019 (r354834) +++ head/Makefile.inc1 Mon Nov 18 23:28:23 2019 (r354835) @@ -1499,6 +1499,11 @@ makeman: .PHONY ${_+_}cd ${.CURDIR}/tools/build/options; sh makeman > \ ${.CURDIR}/share/man/man5/src.conf.5 +.if make(sysent) +.include +.endif + +_sysent_PATH= ${WORLDTMP}/legacy/usr/libexec:/usr/libexec:${PATH} _sysent_dirs= sys/kern _sysent_dirs+= sys/compat/freebsd32 _sysent_dirs+= sys/compat/cloudabi32 \ @@ -1509,7 +1514,9 @@ _sysent_dirs+= sys/amd64/linux \ sys/i386/linux sysent: .PHONY .for _dir in ${_sysent_dirs} - ${_+_}${MAKE} -C ${.CURDIR}/${_dir} sysent + @echo "${MAKE} -C ${.CURDIR}/${_dir} sysent" + ${_+_}@env PATH=${_sysent_PATH} LUA=${LUA_CMD} \ + ${MAKE} -C ${.CURDIR}/${_dir} sysent .endfor # @@ -2168,6 +2175,13 @@ ${_bt}-lib/libelf: ${_bt_m4_depend} ${_bt}-lib/libdwarf: ${_bt_m4_depend} .endif +# flua is required to regenerate syscall files. It first appeared during the +# 13.0-CURRENT cycle, thus needs to be built on -older releases and stable +# branches. +.if ${BOOTSTRAPPING} < 1300059 +_flua= libexec/flua +.endif + # r245440 mtree -N support added # r313404 requires sha384.h for libnetbsd, added to libmd in r292782 .if ${BOOTSTRAPPING} < 1100093 @@ -2390,6 +2404,7 @@ bootstrap-tools: ${_bt}-links .PHONY usr.bin/xinstall \ ${_gensnmptree} \ usr.sbin/config \ + ${_flua} \ ${_crunchide} \ ${_crunchgen} \ ${_nmtree} \ Modified: head/sys/amd64/linux/Makefile ============================================================================== --- head/sys/amd64/linux/Makefile Mon Nov 18 23:23:38 2019 (r354834) +++ head/sys/amd64/linux/Makefile Mon Nov 18 23:28:23 2019 (r354835) @@ -5,11 +5,13 @@ # Don't use an OBJDIR .OBJDIR: ${.CURDIR} +.include + all: @echo "make sysent only" sysent: linux_sysent.c linux_syscall.h linux_proto.h linux_syscalls.c linux_systrace_args.c linux_sysent.c linux_syscall.h linux_proto.h linux_syscalls.c linux_systrace_args.c: \ - ../../kern/makesyscalls.sh syscalls.master ${.CURDIR}/syscalls.conf - sh ../../kern/makesyscalls.sh syscalls.master ${.CURDIR}/syscalls.conf + ../../tools/makesyscalls.lua syscalls.master ${.CURDIR}/syscalls.conf + ${LUA} ../../tools/makesyscalls.lua syscalls.master ${.CURDIR}/syscalls.conf Modified: head/sys/amd64/linux32/Makefile ============================================================================== --- head/sys/amd64/linux32/Makefile Mon Nov 18 23:23:38 2019 (r354834) +++ head/sys/amd64/linux32/Makefile Mon Nov 18 23:28:23 2019 (r354835) @@ -5,11 +5,13 @@ # Don't use an OBJDIR .OBJDIR: ${.CURDIR} +.include + all: @echo "make sysent only" sysent: linux32_sysent.c linux32_syscall.h linux32_proto.h linux32_syscalls.c linux32_systrace_args.c -linux32_sysent.c linux32_syscall.h linux32_proto.h linux32_syscalls.c linux32_systrace_args.c: ../../kern/makesyscalls.sh \ +linux32_sysent.c linux32_syscall.h linux32_proto.h linux32_syscalls.c linux32_systrace_args.c: ../../tools/makesyscalls.lua \ syscalls.master ${.CURDIR}/syscalls.conf - sh ../../kern/makesyscalls.sh syscalls.master ${.CURDIR}/syscalls.conf + ${LUA} ../../tools/makesyscalls.lua syscalls.master ${.CURDIR}/syscalls.conf Modified: head/sys/arm64/linux/Makefile ============================================================================== --- head/sys/arm64/linux/Makefile Mon Nov 18 23:23:38 2019 (r354834) +++ head/sys/arm64/linux/Makefile Mon Nov 18 23:28:23 2019 (r354835) @@ -5,11 +5,13 @@ # Don't use an OBJDIR .OBJDIR: ${.CURDIR} +.include + all: @echo "make sysent only" sysent: linux_sysent.c linux_syscall.h linux_proto.h linux_syscalls.c linux_systrace_args.c linux_sysent.c linux_syscall.h linux_proto.h linux_syscalls.c linux_systrace_args.c: \ - ../../kern/makesyscalls.sh syscalls.master ${.CURDIR}/syscalls.conf - sh ../../kern/makesyscalls.sh syscalls.master ${.CURDIR}/syscalls.conf + ../../tools/makesyscalls.lua syscalls.master ${.CURDIR}/syscalls.conf + ${LUA} ../../tools/makesyscalls.lua syscalls.master ${.CURDIR}/syscalls.conf Modified: head/sys/compat/cloudabi32/Makefile ============================================================================== --- head/sys/compat/cloudabi32/Makefile Mon Nov 18 23:23:38 2019 (r354834) +++ head/sys/compat/cloudabi32/Makefile Mon Nov 18 23:28:23 2019 (r354835) @@ -3,6 +3,8 @@ # Don't use an OBJDIR .OBJDIR: ${.CURDIR} +.include + all: @echo "make sysent only" @@ -11,7 +13,7 @@ sysent: cloudabi32_sysent.c cloudabi32_syscall.h cloud cloudabi32_sysent.c cloudabi32_syscall.h cloudabi32_proto.h \ cloudabi32_syscalls.c cloudabi32_systrace_args.c: \ - ../../kern/makesyscalls.sh ../../contrib/cloudabi/syscalls32.master \ + ../../tools/makesyscalls.lua ../../contrib/cloudabi/syscalls32.master \ ${.CURDIR}/syscalls.conf - sh ../../kern/makesyscalls.sh ../../contrib/cloudabi/syscalls32.master \ - ${.CURDIR}/syscalls.conf + ${LUA} ../../tools/makesyscalls.lua \ + ../../contrib/cloudabi/syscalls32.master ${.CURDIR}/syscalls.conf Modified: head/sys/compat/cloudabi64/Makefile ============================================================================== --- head/sys/compat/cloudabi64/Makefile Mon Nov 18 23:23:38 2019 (r354834) +++ head/sys/compat/cloudabi64/Makefile Mon Nov 18 23:28:23 2019 (r354835) @@ -1,5 +1,7 @@ # $FreeBSD$ +.include + # Don't use an OBJDIR .OBJDIR: ${.CURDIR} @@ -11,7 +13,7 @@ sysent: cloudabi64_sysent.c cloudabi64_syscall.h cloud cloudabi64_sysent.c cloudabi64_syscall.h cloudabi64_proto.h \ cloudabi64_syscalls.c cloudabi64_systrace_args.c: \ - ../../kern/makesyscalls.sh ../../contrib/cloudabi/syscalls64.master \ + ../../tools/makesyscalls.lua ../../contrib/cloudabi/syscalls64.master \ ${.CURDIR}/syscalls.conf - sh ../../kern/makesyscalls.sh ../../contrib/cloudabi/syscalls64.master \ - ${.CURDIR}/syscalls.conf + ${LUA} ../../tools/makesyscalls.lua \ + ../../contrib/cloudabi/syscalls64.master ${.CURDIR}/syscalls.conf Modified: head/sys/compat/freebsd32/Makefile ============================================================================== --- head/sys/compat/freebsd32/Makefile Mon Nov 18 23:23:38 2019 (r354834) +++ head/sys/compat/freebsd32/Makefile Mon Nov 18 23:28:23 2019 (r354835) @@ -5,14 +5,16 @@ # Don't use an OBJDIR .OBJDIR: ${.CURDIR} +.include + all: @echo "make sysent only" sysent: freebsd32_sysent.c freebsd32_syscall.h freebsd32_proto.h freebsd32_systrace_args.c freebsd32_sysent.c freebsd32_syscalls.c freebsd32_syscall.h freebsd32_proto.h freebsd32_systrace_args.c : \ - ../../kern/makesyscalls.sh syscalls.master ${.CURDIR}/syscalls.conf ../../kern/capabilities.conf - sh ../../kern/makesyscalls.sh syscalls.master ${.CURDIR}/syscalls.conf + ../../tools/makesyscalls.lua syscalls.master ${.CURDIR}/syscalls.conf ../../kern/capabilities.conf + ${LUA} ../../tools/makesyscalls.lua syscalls.master ${.CURDIR}/syscalls.conf clean: rm -f freebsd32_sysent.c freebsd32_syscalls.c freebsd32_syscall.h freebsd32_proto.h Modified: head/sys/i386/linux/Makefile ============================================================================== --- head/sys/i386/linux/Makefile Mon Nov 18 23:23:38 2019 (r354834) +++ head/sys/i386/linux/Makefile Mon Nov 18 23:28:23 2019 (r354835) @@ -5,11 +5,13 @@ # Don't use an OBJDIR .OBJDIR: ${.CURDIR} +.include + all: @echo "make sysent only" sysent: linux_sysent.c linux_syscall.h linux_proto.h linux_syscalls.c linux_systrace_args.c linux_sysent.c linux_syscall.h linux_proto.h linux_syscalls.c linux_systrace_args.c: \ - ../../kern/makesyscalls.sh syscalls.master ${.CURDIR}/syscalls.conf - sh ../../kern/makesyscalls.sh syscalls.master ${.CURDIR}/syscalls.conf + ../../tools/makesyscalls.lua syscalls.master ${.CURDIR}/syscalls.conf + ${LUA} ../../tools/makesyscalls.lua syscalls.master ${.CURDIR}/syscalls.conf Modified: head/sys/kern/Makefile ============================================================================== --- head/sys/kern/Makefile Mon Nov 18 23:23:38 2019 (r354834) +++ head/sys/kern/Makefile Mon Nov 18 23:28:23 2019 (r354835) @@ -6,6 +6,8 @@ # Don't use an OBJDIR .OBJDIR: ${.CURDIR} +.include + all: @echo "make sysent only" @@ -13,6 +15,6 @@ sysent: init_sysent.c syscalls.c ../sys/syscall.h ../s ../sys/sysproto.h init_sysent.c syscalls.c systrace_args.c ../sys/syscall.h \ -../sys/syscall.mk ../sys/sysproto.h: makesyscalls.sh syscalls.master \ +../sys/syscall.mk ../sys/sysproto.h: ../tools/makesyscalls.lua syscalls.master \ capabilities.conf - sh makesyscalls.sh syscalls.master + ${LUA} ../tools/makesyscalls.lua syscalls.master Modified: head/sys/sys/param.h ============================================================================== --- head/sys/sys/param.h Mon Nov 18 23:23:38 2019 (r354834) +++ head/sys/sys/param.h Mon Nov 18 23:28:23 2019 (r354835) @@ -60,7 +60,7 @@ * in the range 5 to 9. */ #undef __FreeBSD_version -#define __FreeBSD_version 1300058 /* Master, propagated to newvers */ +#define __FreeBSD_version 1300059 /* Master, propagated to newvers */ /* * __FreeBSD_kernel__ indicates that this system uses the kernel of FreeBSD, Modified: head/tools/build/Makefile ============================================================================== --- head/tools/build/Makefile Mon Nov 18 23:23:38 2019 (r354834) +++ head/tools/build/Makefile Mon Nov 18 23:28:23 2019 (r354835) @@ -127,6 +127,7 @@ INSTALLDIR_LIST= \ usr/include/casper \ usr/include/private/zstd \ usr/lib \ + usr/libexec installdirs: mkdir -p ${INSTALLDIR_LIST:S,^,${DESTDIR}/,} From owner-svn-src-all@freebsd.org Mon Nov 18 23:30:48 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 056591CC28D; Mon, 18 Nov 2019 23:30:48 +0000 (UTC) (envelope-from freebsd@gndrsh.dnsmgr.net) Received: from gndrsh.dnsmgr.net (br1.CN84in.dnsmgr.net [69.59.192.140]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 47H4vV6vnZz3Bs2; Mon, 18 Nov 2019 23:30:46 +0000 (UTC) (envelope-from freebsd@gndrsh.dnsmgr.net) Received: from gndrsh.dnsmgr.net (localhost [127.0.0.1]) by gndrsh.dnsmgr.net (8.13.3/8.13.3) with ESMTP id xAINUcgi068637; Mon, 18 Nov 2019 15:30:38 -0800 (PST) (envelope-from freebsd@gndrsh.dnsmgr.net) Received: (from freebsd@localhost) by gndrsh.dnsmgr.net (8.13.3/8.13.3/Submit) id xAINUcUJ068636; Mon, 18 Nov 2019 15:30:38 -0800 (PST) (envelope-from freebsd) From: "Rodney W. Grimes" Message-Id: <201911182330.xAINUcUJ068636@gndrsh.dnsmgr.net> Subject: Re: svn commit: r354824 - head/lib/geom/part In-Reply-To: <201911182050.xAIKoX32000661@slippy.cwsent.com> To: Cy Schubert Date: Mon, 18 Nov 2019 15:30:38 -0800 (PST) CC: Mark Johnston , Alexey Dokuchaev , Alan Somers , svn-src-head , svn-src-all , src-committers Reply-To: rgrimes@freebsd.org X-Mailer: ELM [version 2.4ME+ PL121h (25)] MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=US-ASCII X-Rspamd-Queue-Id: 47H4vV6vnZz3Bs2 X-Spamd-Bar: / Authentication-Results: mx1.freebsd.org; dkim=none; dmarc=none; spf=none (mx1.freebsd.org: domain of freebsd@gndrsh.dnsmgr.net has no SPF policy when checking 69.59.192.140) smtp.mailfrom=freebsd@gndrsh.dnsmgr.net X-Spamd-Result: default: False [0.95 / 15.00]; ARC_NA(0.00)[]; HAS_REPLYTO(0.00)[rgrimes@freebsd.org]; NEURAL_HAM_MEDIUM(-0.58)[-0.577,0]; FROM_HAS_DN(0.00)[]; MIME_GOOD(-0.10)[text/plain]; RCVD_TLS_LAST(0.00)[]; DMARC_NA(0.00)[dnsmgr.net]; AUTH_NA(1.00)[]; REPLYTO_DOM_NEQ_FROM_DOM(0.00)[]; TO_MATCH_ENVRCPT_SOME(0.00)[]; TO_DN_ALL(0.00)[]; NEURAL_SPAM_LONG(0.59)[0.588,0]; RCPT_COUNT_SEVEN(0.00)[7]; R_SPF_NA(0.00)[]; FROM_EQ_ENVFROM(0.00)[]; R_DKIM_NA(0.00)[]; MIME_TRACE(0.00)[0:+]; ASN(0.00)[asn:13868, ipnet:69.59.192.0/19, country:US]; MID_RHS_MATCH_FROM(0.00)[]; IP_SCORE(0.04)[ip: (0.14), ipnet: 69.59.192.0/19(0.07), asn: 13868(0.03), country: US(-0.05)]; RCVD_COUNT_TWO(0.00)[2] X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 18 Nov 2019 23:30:48 -0000 > In message <20191118204836.GB43295@raichu>, Mark Johnston writes: > > On Mon, Nov 18, 2019 at 08:35:30PM +0000, Alexey Dokuchaev wrote: > > > On Mon, Nov 18, 2019 at 01:09:19PM -0700, Alan Somers wrote: > > > > On Mon, Nov 18, 2019 at 12:48 PM Mark Johnston wrote: > > > > > On Mon, Nov 18, 2019 at 12:43:48PM -0700, Alan Somers wrote: > > > > > > On Mon, Nov 18, 2019 at 12:06 PM Mark Johnston > > > > > wrote: > > > > > > > > > > > > > Author: markj > > > > > > > Date: Mon Nov 18 19:05:52 2019 > > > > > > > New Revision: 354824 > > > > > > > URL: https://svnweb.freebsd.org/changeset/base/354824 > > > > > > > > > > > > > > Log: > > > > > > > Fix grammar in gpart.8. > > > > > > > > > > > > > > PR: 241973 > > > > > > > MFC after: 3 days > > > > > > > > > > > > > > Modified: > > > > > > > head/lib/geom/part/gpart.8 > > > > > > > > > > > > Don't forget to bump the .Dd date. > > > > > > > > > > AFAIK we do not bump .Dd for such changes, only for content changes. > > > > > > > > Isn't that a content change? I thought anything displayed to the user > > > > counts as a content change? > > > > > > I presume that "content" means more like semantic, functional changes > > > that affect some particular meaning. Grammar fixes are just, well, > > > grammar fixes and thus do not warrant .Dd bump. > > > > Indeed, this was always my understanding as well. I can't find a > > concrete definition anywhere. I don't understand why it would be useful > > as a user to see the date of the last "content change" if such changes > > might consist only of a small formatting change or typo fix. > > > > Should this be documented in the committers guide? This should be documented someplace, that place probably being where bumping of .Dd is documented as a minimum. > Cy Schubert -- Rod Grimes rgrimes@freebsd.org From owner-svn-src-all@freebsd.org Mon Nov 18 23:31:13 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id DAAF61CC316; Mon, 18 Nov 2019 23:31:13 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47H4w15YBjz3C3g; Mon, 18 Nov 2019 23:31:13 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 897AD15E4; Mon, 18 Nov 2019 23:31:13 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xAINVDab021548; Mon, 18 Nov 2019 23:31:13 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xAINVC5a021544; Mon, 18 Nov 2019 23:31:12 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201911182331.xAINVC5a021544@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Mon, 18 Nov 2019 23:31:12 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354836 - in head/sys: compat/freebsd32 kern sys X-SVN-Group: head X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: in head/sys: compat/freebsd32 kern sys X-SVN-Commit-Revision: 354836 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 18 Nov 2019 23:31:13 -0000 Author: kevans Date: Mon Nov 18 23:31:12 2019 New Revision: 354836 URL: https://svnweb.freebsd.org/changeset/base/354836 Log: sysent: regenerate after r354835 The lua-based makesyscalls produces slightly different output than its makesyscalls.sh predecessor, all whitespace differences more closely matching the source syscalls.master. Modified: head/sys/compat/freebsd32/freebsd32_proto.h head/sys/compat/freebsd32/freebsd32_systrace_args.c head/sys/kern/systrace_args.c head/sys/sys/sysproto.h Modified: head/sys/compat/freebsd32/freebsd32_proto.h ============================================================================== --- head/sys/compat/freebsd32/freebsd32_proto.h Mon Nov 18 23:28:23 2019 (r354835) +++ head/sys/compat/freebsd32/freebsd32_proto.h Mon Nov 18 23:31:12 2019 (r354836) @@ -238,7 +238,7 @@ struct freebsd32_aio_write_args { }; struct freebsd32_lio_listio_args { char mode_l_[PADL_(int)]; int mode; char mode_r_[PADR_(int)]; - char acb_list_l_[PADL_(struct aiocb32 *const *)]; struct aiocb32 *const * acb_list; char acb_list_r_[PADR_(struct aiocb32 *const *)]; + char acb_list_l_[PADL_(struct aiocb32 * const *)]; struct aiocb32 * const * acb_list; char acb_list_r_[PADR_(struct aiocb32 * const *)]; char nent_l_[PADL_(int)]; int nent; char nent_r_[PADR_(int)]; char sig_l_[PADL_(struct sigevent32 *)]; struct sigevent32 * sig; char sig_r_[PADR_(struct sigevent32 *)]; }; @@ -272,7 +272,7 @@ struct freebsd32_aio_return_args { char aiocbp_l_[PADL_(struct aiocb32 *)]; struct aiocb32 * aiocbp; char aiocbp_r_[PADR_(struct aiocb32 *)]; }; struct freebsd32_aio_suspend_args { - char aiocbp_l_[PADL_(struct aiocb32 *const *)]; struct aiocb32 *const * aiocbp; char aiocbp_r_[PADR_(struct aiocb32 *const *)]; + char aiocbp_l_[PADL_(struct aiocb32 * const *)]; struct aiocb32 * const * aiocbp; char aiocbp_r_[PADR_(struct aiocb32 * const *)]; char nent_l_[PADL_(int)]; int nent; char nent_r_[PADR_(int)]; char timeout_l_[PADL_(const struct timespec32 *)]; const struct timespec32 * timeout; char timeout_r_[PADR_(const struct timespec32 *)]; }; @@ -1094,7 +1094,7 @@ struct freebsd6_freebsd32_aio_write_args { }; struct freebsd6_freebsd32_lio_listio_args { char mode_l_[PADL_(int)]; int mode; char mode_r_[PADR_(int)]; - char acb_list_l_[PADL_(struct oaiocb32 *const *)]; struct oaiocb32 *const * acb_list; char acb_list_r_[PADR_(struct oaiocb32 *const *)]; + char acb_list_l_[PADL_(struct oaiocb32 * const *)]; struct oaiocb32 * const * acb_list; char acb_list_r_[PADR_(struct oaiocb32 * const *)]; char nent_l_[PADL_(int)]; int nent; char nent_r_[PADR_(int)]; char sig_l_[PADL_(struct osigevent32 *)]; struct osigevent32 * sig; char sig_r_[PADR_(struct osigevent32 *)]; }; Modified: head/sys/compat/freebsd32/freebsd32_systrace_args.c ============================================================================== --- head/sys/compat/freebsd32/freebsd32_systrace_args.c Mon Nov 18 23:28:23 2019 (r354835) +++ head/sys/compat/freebsd32/freebsd32_systrace_args.c Mon Nov 18 23:31:12 2019 (r354836) @@ -1278,7 +1278,7 @@ systrace_args(int sysnum, void *params, uint64_t *uarg case 257: { struct freebsd32_lio_listio_args *p = params; iarg[0] = p->mode; /* int */ - uarg[1] = (intptr_t) p->acb_list; /* struct aiocb32 *const * */ + uarg[1] = (intptr_t) p->acb_list; /* struct aiocb32 * const * */ iarg[2] = p->nent; /* int */ uarg[3] = (intptr_t) p->sig; /* struct sigevent32 * */ *n_args = 4; @@ -1437,7 +1437,7 @@ systrace_args(int sysnum, void *params, uint64_t *uarg /* freebsd32_aio_suspend */ case 315: { struct freebsd32_aio_suspend_args *p = params; - uarg[0] = (intptr_t) p->aiocbp; /* struct aiocb32 *const * */ + uarg[0] = (intptr_t) p->aiocbp; /* struct aiocb32 * const * */ iarg[1] = p->nent; /* int */ uarg[2] = (intptr_t) p->timeout; /* const struct timespec32 * */ *n_args = 3; @@ -5370,7 +5370,7 @@ systrace_entry_setargdesc(int sysnum, int ndx, char *d p = "int"; break; case 1: - p = "userland struct aiocb32 *const *"; + p = "userland struct aiocb32 * const *"; break; case 2: p = "int"; @@ -5627,7 +5627,7 @@ systrace_entry_setargdesc(int sysnum, int ndx, char *d case 315: switch(ndx) { case 0: - p = "userland struct aiocb32 *const *"; + p = "userland struct aiocb32 * const *"; break; case 1: p = "int"; Modified: head/sys/kern/systrace_args.c ============================================================================== --- head/sys/kern/systrace_args.c Mon Nov 18 23:28:23 2019 (r354835) +++ head/sys/kern/systrace_args.c Mon Nov 18 23:31:12 2019 (r354836) @@ -1314,7 +1314,7 @@ systrace_args(int sysnum, void *params, uint64_t *uarg case 257: { struct lio_listio_args *p = params; iarg[0] = p->mode; /* int */ - uarg[1] = (intptr_t) p->acb_list; /* struct aiocb *const * */ + uarg[1] = (intptr_t) p->acb_list; /* struct aiocb * const * */ iarg[2] = p->nent; /* int */ uarg[3] = (intptr_t) p->sig; /* struct sigevent * */ *n_args = 4; @@ -1471,7 +1471,7 @@ systrace_args(int sysnum, void *params, uint64_t *uarg /* aio_suspend */ case 315: { struct aio_suspend_args *p = params; - uarg[0] = (intptr_t) p->aiocbp; /* struct aiocb *const * */ + uarg[0] = (intptr_t) p->aiocbp; /* struct aiocb * const * */ iarg[1] = p->nent; /* int */ uarg[2] = (intptr_t) p->timeout; /* const struct timespec * */ *n_args = 3; @@ -5421,7 +5421,7 @@ systrace_entry_setargdesc(int sysnum, int ndx, char *d p = "int"; break; case 1: - p = "userland struct aiocb *const *"; + p = "userland struct aiocb * const *"; break; case 2: p = "int"; @@ -5672,7 +5672,7 @@ systrace_entry_setargdesc(int sysnum, int ndx, char *d case 315: switch(ndx) { case 0: - p = "userland struct aiocb *const *"; + p = "userland struct aiocb * const *"; break; case 1: p = "int"; Modified: head/sys/sys/sysproto.h ============================================================================== --- head/sys/sys/sysproto.h Mon Nov 18 23:28:23 2019 (r354835) +++ head/sys/sys/sysproto.h Mon Nov 18 23:31:12 2019 (r354836) @@ -710,7 +710,7 @@ struct aio_write_args { }; struct lio_listio_args { char mode_l_[PADL_(int)]; int mode; char mode_r_[PADR_(int)]; - char acb_list_l_[PADL_(struct aiocb *const *)]; struct aiocb *const * acb_list; char acb_list_r_[PADR_(struct aiocb *const *)]; + char acb_list_l_[PADL_(struct aiocb * const *)]; struct aiocb * const * acb_list; char acb_list_r_[PADR_(struct aiocb * const *)]; char nent_l_[PADL_(int)]; int nent; char nent_r_[PADR_(int)]; char sig_l_[PADL_(struct sigevent *)]; struct sigevent * sig; char sig_r_[PADR_(struct sigevent *)]; }; @@ -787,7 +787,7 @@ struct aio_return_args { char aiocbp_l_[PADL_(struct aiocb *)]; struct aiocb * aiocbp; char aiocbp_r_[PADR_(struct aiocb *)]; }; struct aio_suspend_args { - char aiocbp_l_[PADL_(struct aiocb *const *)]; struct aiocb *const * aiocbp; char aiocbp_r_[PADR_(struct aiocb *const *)]; + char aiocbp_l_[PADL_(struct aiocb * const *)]; struct aiocb * const * aiocbp; char aiocbp_r_[PADR_(struct aiocb * const *)]; char nent_l_[PADL_(int)]; int nent; char nent_r_[PADR_(int)]; char timeout_l_[PADL_(const struct timespec *)]; const struct timespec * timeout; char timeout_r_[PADR_(const struct timespec *)]; }; @@ -2495,7 +2495,7 @@ struct freebsd6_aio_write_args { }; struct freebsd6_lio_listio_args { char mode_l_[PADL_(int)]; int mode; char mode_r_[PADR_(int)]; - char acb_list_l_[PADL_(struct oaiocb *const *)]; struct oaiocb *const * acb_list; char acb_list_r_[PADR_(struct oaiocb *const *)]; + char acb_list_l_[PADL_(struct oaiocb * const *)]; struct oaiocb * const * acb_list; char acb_list_r_[PADR_(struct oaiocb * const *)]; char nent_l_[PADL_(int)]; int nent; char nent_r_[PADR_(int)]; char sig_l_[PADL_(struct osigevent *)]; struct osigevent * sig; char sig_r_[PADR_(struct osigevent *)]; }; From owner-svn-src-all@freebsd.org Mon Nov 18 23:40:07 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id C03D81CC591; Mon, 18 Nov 2019 23:40:07 +0000 (UTC) (envelope-from freebsd@gndrsh.dnsmgr.net) Received: from gndrsh.dnsmgr.net (br1.CN84in.dnsmgr.net [69.59.192.140]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 47H56G6L5fz3CSS; Mon, 18 Nov 2019 23:40:06 +0000 (UTC) (envelope-from freebsd@gndrsh.dnsmgr.net) Received: from gndrsh.dnsmgr.net (localhost [127.0.0.1]) by gndrsh.dnsmgr.net (8.13.3/8.13.3) with ESMTP id xAINXCH9068667; Mon, 18 Nov 2019 15:33:12 -0800 (PST) (envelope-from freebsd@gndrsh.dnsmgr.net) Received: (from freebsd@localhost) by gndrsh.dnsmgr.net (8.13.3/8.13.3/Submit) id xAINXC1E068666; Mon, 18 Nov 2019 15:33:12 -0800 (PST) (envelope-from freebsd) From: "Rodney W. Grimes" Message-Id: <201911182333.xAINXC1E068666@gndrsh.dnsmgr.net> Subject: Re: svn commit: r354824 - head/lib/geom/part In-Reply-To: <201911182330.xAINUcUJ068636@gndrsh.dnsmgr.net> To: rgrimes@freebsd.org Date: Mon, 18 Nov 2019 15:33:12 -0800 (PST) CC: Cy Schubert , Mark Johnston , Alexey Dokuchaev , Alan Somers , svn-src-head , svn-src-all , src-committers Reply-To: rgrimes@freebsd.org X-Mailer: ELM [version 2.4ME+ PL121h (25)] MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=US-ASCII X-Rspamd-Queue-Id: 47H56G6L5fz3CSS X-Spamd-Bar: ++++++ Authentication-Results: mx1.freebsd.org; dkim=none; dmarc=none; spf=none (mx1.freebsd.org: domain of freebsd@gndrsh.dnsmgr.net has no SPF policy when checking 69.59.192.140) smtp.mailfrom=freebsd@gndrsh.dnsmgr.net X-Spamd-Result: default: False [6.33 / 15.00]; ARC_NA(0.00)[]; HAS_REPLYTO(0.00)[rgrimes@freebsd.org]; REPLYTO_EQ_TO_ADDR(5.00)[]; GREYLIST(0.00)[pass,body]; FROM_HAS_DN(0.00)[]; TO_DN_SOME(0.00)[]; NEURAL_HAM_MEDIUM(-0.49)[-0.489,0]; MIME_GOOD(-0.10)[text/plain]; RCVD_TLS_LAST(0.00)[]; DMARC_NA(0.00)[dnsmgr.net]; AUTH_NA(1.00)[]; TO_MATCH_ENVRCPT_SOME(0.00)[]; NEURAL_SPAM_LONG(0.88)[0.877,0]; RCPT_COUNT_SEVEN(0.00)[8]; R_SPF_NA(0.00)[]; FROM_EQ_ENVFROM(0.00)[]; R_DKIM_NA(0.00)[]; MIME_TRACE(0.00)[0:+]; ASN(0.00)[asn:13868, ipnet:69.59.192.0/19, country:US]; MID_RHS_MATCH_FROM(0.00)[]; IP_SCORE(0.04)[ip: (0.14), ipnet: 69.59.192.0/19(0.07), asn: 13868(0.03), country: US(-0.05)]; RCVD_COUNT_TWO(0.00)[2] X-Spam: Yes X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 18 Nov 2019 23:40:07 -0000 > > In message <20191118204836.GB43295@raichu>, Mark Johnston writes: > > > On Mon, Nov 18, 2019 at 08:35:30PM +0000, Alexey Dokuchaev wrote: > > > > On Mon, Nov 18, 2019 at 01:09:19PM -0700, Alan Somers wrote: > > > > > On Mon, Nov 18, 2019 at 12:48 PM Mark Johnston wrote: > > > > > > On Mon, Nov 18, 2019 at 12:43:48PM -0700, Alan Somers wrote: > > > > > > > On Mon, Nov 18, 2019 at 12:06 PM Mark Johnston > > > > > > wrote: > > > > > > > > > > > > > > > Author: markj > > > > > > > > Date: Mon Nov 18 19:05:52 2019 > > > > > > > > New Revision: 354824 > > > > > > > > URL: https://svnweb.freebsd.org/changeset/base/354824 > > > > > > > > > > > > > > > > Log: > > > > > > > > Fix grammar in gpart.8. > > > > > > > > > > > > > > > > PR: 241973 > > > > > > > > MFC after: 3 days > > > > > > > > > > > > > > > > Modified: > > > > > > > > head/lib/geom/part/gpart.8 > > > > > > > > > > > > > > Don't forget to bump the .Dd date. > > > > > > > > > > > > AFAIK we do not bump .Dd for such changes, only for content changes. > > > > > > > > > > Isn't that a content change? I thought anything displayed to the user > > > > > counts as a content change? > > > > > > > > I presume that "content" means more like semantic, functional changes > > > > that affect some particular meaning. Grammar fixes are just, well, > > > > grammar fixes and thus do not warrant .Dd bump. > > > > > > Indeed, this was always my understanding as well. I can't find a > > > concrete definition anywhere. I don't understand why it would be useful > > > as a user to see the date of the last "content change" if such changes > > > might consist only of a small formatting change or typo fix. > > > > > > > Should this be documented in the committers guide? > > This should be documented someplace, > that place probably being where bumping of .Dd is documented as a minimum. that place also being where .Dd is documented. > > Cy Schubert > -- > Rod Grimes rgrimes@freebsd.org -- Rod Grimes rgrimes@freebsd.org From owner-svn-src-all@freebsd.org Tue Nov 19 00:02:56 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id F31BE1CCED2; Tue, 19 Nov 2019 00:02:56 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47H5cc6C1Gz3Dwt; Tue, 19 Nov 2019 00:02:56 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id B43041CC4; Tue, 19 Nov 2019 00:02:56 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xAJ02uRu045200; Tue, 19 Nov 2019 00:02:56 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xAJ02uQQ045199; Tue, 19 Nov 2019 00:02:56 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201911190002.xAJ02uQQ045199@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Tue, 19 Nov 2019 00:02:56 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354837 - head/libexec/flua X-SVN-Group: head X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: head/libexec/flua X-SVN-Commit-Revision: 354837 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 19 Nov 2019 00:02:57 -0000 Author: kevans Date: Tue Nov 19 00:02:56 2019 New Revision: 354837 URL: https://svnweb.freebsd.org/changeset/base/354837 Log: flua: newer GCC complains about format-nonliteral at WARNS=2 Disable that one, too. Modified: head/libexec/flua/Makefile Modified: head/libexec/flua/Makefile ============================================================================== --- head/libexec/flua/Makefile Mon Nov 18 23:31:12 2019 (r354836) +++ head/libexec/flua/Makefile Tue Nov 19 00:02:56 2019 (r354837) @@ -9,6 +9,8 @@ PROG= flua WARNS?= 2 MAN= # No manpage; this is internal. +CWARNFLAGS.gcc+= -Wno-format-nonliteral + LIBADD= m # Core functions From owner-svn-src-all@freebsd.org Tue Nov 19 00:18:14 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 042951CDA43 for ; Tue, 19 Nov 2019 00:18:14 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: from mail-qk1-x72c.google.com (mail-qk1-x72c.google.com [IPv6:2607:f8b0:4864:20::72c]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47H5yD5jz6z3GCF for ; Tue, 19 Nov 2019 00:18:12 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: by mail-qk1-x72c.google.com with SMTP id z16so16250434qkg.7 for ; Mon, 18 Nov 2019 16:18:12 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bsdimp-com.20150623.gappssmtp.com; s=20150623; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=ncXkyjZsyBuGRbN+1mfxzGL93kvmCwm//Nw/9o5wiX8=; b=FVbLMAj/ZGr1S/60cxrFqjniM0ZJ5yP/SplpK92l5fQBqza2lO4Rh9PLbXU0uYovCd QydlDtuyH8AtiwWO8NLQqFtJd9bvIQt66Tqjn3D/n+RWwiruKeqGI8d0/QmlcunCiFeN TSWrKg6vY+9GyFnh5X7j1M304dK8QEYEKUV0L0iZnA66FtsePDKjnKrwh0f8H/kc8gSV faxmOAwoZcs8k0FQpm9vBzMaE1NY0MoiFOPEpHvIhDlcZwF0qrDq0cDn6sNh+CIDcVxu CAudhBpSlUvaBH6Si1MMjUzQA5vpY3gMMme9SbWpAAFI0mflpeHzXGvryyERURAMnMsO ovZg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=ncXkyjZsyBuGRbN+1mfxzGL93kvmCwm//Nw/9o5wiX8=; b=bEfaserDB9mWhOi9zl/K6eDFEUFUfX8CtlPyDk+9uDOUvkWx+kqWE5reqtuNYJcvla Z4GTujLgSVQ+ULYInruesPuemSKak0DimRTLMEZryO98tRwU0yzowDVjxpw+UaTLO6yl mJbuoy5dOQlwYNftVexLPy+0D9CMHaMwMAVlEUlO8+2hIEaLKJfJN2S4JQ6rZCMSWtEm aUN+pvB9l33cc4OanvIXUJUt/ASJ0ECDOk7yfWuk+sQYwdrOsE1zBMiMRH3USaxVfO6e 5JrMRcdQEAkpSQyfWwFcwJ5CCDsaLqnLeqj47iQiTV2/512iFlMwy/zS8uS+BNMG9F3r e1Fg== X-Gm-Message-State: APjAAAX4XtO4yVvCcNyMfxhaSKjJw+dgV5nBHU5OIEHANjlYW7MBCZmk 4yymk5Ix1/DxNBkNwqGfIoB63FDZL+LRA2sv6hfljOCR X-Google-Smtp-Source: APXvYqwvff2NN6kQzf3883HPwr8e+No6n0QHdEQXYLQ174CN2OD/QBHy3N+qWjRAPx3TyGT3W+4Ge2TXl47EXHPcmCs= X-Received: by 2002:a37:b0c5:: with SMTP id z188mr27676675qke.215.1574122691161; Mon, 18 Nov 2019 16:18:11 -0800 (PST) MIME-Version: 1.0 References: <201911182330.xAINUcUJ068636@gndrsh.dnsmgr.net> <201911182333.xAINXC1E068666@gndrsh.dnsmgr.net> In-Reply-To: <201911182333.xAINXC1E068666@gndrsh.dnsmgr.net> From: Warner Losh Date: Mon, 18 Nov 2019 17:18:00 -0700 Message-ID: Subject: Re: svn commit: r354824 - head/lib/geom/part To: "Rodney W. Grimes" Cc: Cy Schubert , Mark Johnston , Alexey Dokuchaev , Alan Somers , svn-src-head , svn-src-all , src-committers X-Rspamd-Queue-Id: 47H5yD5jz6z3GCF X-Spamd-Bar: --- Authentication-Results: mx1.freebsd.org; dkim=pass header.d=bsdimp-com.20150623.gappssmtp.com header.s=20150623 header.b=FVbLMAj/; dmarc=none; spf=none (mx1.freebsd.org: domain of wlosh@bsdimp.com has no SPF policy when checking 2607:f8b0:4864:20::72c) smtp.mailfrom=wlosh@bsdimp.com X-Spamd-Result: default: False [-3.72 / 15.00]; ARC_NA(0.00)[]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; R_DKIM_ALLOW(-0.20)[bsdimp-com.20150623.gappssmtp.com:s=20150623]; FROM_HAS_DN(0.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; MIME_GOOD(-0.10)[multipart/alternative,text/plain]; PREVIOUSLY_DELIVERED(0.00)[svn-src-all@freebsd.org]; DMARC_NA(0.00)[bsdimp.com]; URI_COUNT_ODD(1.00)[3]; TO_MATCH_ENVRCPT_SOME(0.00)[]; TO_DN_ALL(0.00)[]; DKIM_TRACE(0.00)[bsdimp-com.20150623.gappssmtp.com:+]; RCVD_IN_DNSWL_NONE(0.00)[c.2.7.0.0.0.0.0.0.0.0.0.0.0.0.0.0.2.0.0.4.6.8.4.0.b.8.f.7.0.6.2.list.dnswl.org : 127.0.5.0]; RCPT_COUNT_SEVEN(0.00)[8]; R_SPF_NA(0.00)[]; FORGED_SENDER(0.30)[imp@bsdimp.com,wlosh@bsdimp.com]; MIME_TRACE(0.00)[0:+,1:+,2:~]; IP_SCORE(-2.72)[ip: (-9.29), ipnet: 2607:f8b0::/32(-2.31), asn: 15169(-1.98), country: US(-0.05)]; ASN(0.00)[asn:15169, ipnet:2607:f8b0::/32, country:US]; FROM_NEQ_ENVFROM(0.00)[imp@bsdimp.com,wlosh@bsdimp.com]; RCVD_TLS_ALL(0.00)[]; RCVD_COUNT_TWO(0.00)[2] Content-Type: text/plain; charset="UTF-8" X-Content-Filtered-By: Mailman/MimeDel 2.1.29 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 19 Nov 2019 00:18:14 -0000 On Mon, Nov 18, 2019 at 4:40 PM Rodney W. Grimes wrote: > > > In message <20191118204836.GB43295@raichu>, Mark Johnston writes: > > > > On Mon, Nov 18, 2019 at 08:35:30PM +0000, Alexey Dokuchaev wrote: > > > > > On Mon, Nov 18, 2019 at 01:09:19PM -0700, Alan Somers wrote: > > > > > > On Mon, Nov 18, 2019 at 12:48 PM Mark Johnston < > markj@freebsd.org> wrote: > > > > > > > On Mon, Nov 18, 2019 at 12:43:48PM -0700, Alan Somers wrote: > > > > > > > > On Mon, Nov 18, 2019 at 12:06 PM Mark Johnston < > markj@freebsd.org> > > > > > > > wrote: > > > > > > > > > > > > > > > > > Author: markj > > > > > > > > > Date: Mon Nov 18 19:05:52 2019 > > > > > > > > > New Revision: 354824 > > > > > > > > > URL: https://svnweb.freebsd.org/changeset/base/354824 > > > > > > > > > > > > > > > > > > Log: > > > > > > > > > Fix grammar in gpart.8. > > > > > > > > > > > > > > > > > > PR: 241973 > > > > > > > > > MFC after: 3 days > > > > > > > > > > > > > > > > > > Modified: > > > > > > > > > head/lib/geom/part/gpart.8 > > > > > > > > > > > > > > > > Don't forget to bump the .Dd date. > > > > > > > > > > > > > > AFAIK we do not bump .Dd for such changes, only for content > changes. > > > > > > > > > > > > Isn't that a content change? I thought anything displayed to > the user > > > > > > counts as a content change? > > > > > > > > > > I presume that "content" means more like semantic, functional > changes > > > > > that affect some particular meaning. Grammar fixes are just, well, > > > > > grammar fixes and thus do not warrant .Dd bump. > > > > > > > > Indeed, this was always my understanding as well. I can't find a > > > > concrete definition anywhere. I don't understand why it would be > useful > > > > as a user to see the date of the last "content change" if such > changes > > > > might consist only of a small formatting change or typo fix. > > > > > > > > > > Should this be documented in the committers guide? > > > > This should be documented someplace, > > that place probably being where bumping of .Dd is documented as a > minimum. > that place also being where .Dd is documented. > The issue, though, is that we get the mdoc man page from upstream somewhere, so we'd have to change that. Plus, upstream seems to have a different .Dd policy that we do ($Mdocdate$ is the last modification time, for example, in OpenBSD's CVS client). So it's a bit tricky to implement. Warner From owner-svn-src-all@freebsd.org Tue Nov 19 01:28:06 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id DAEA71CF59B; Tue, 19 Nov 2019 01:28:06 +0000 (UTC) (envelope-from jhibbits@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47H7Vt5S7kz3Kg5; Tue, 19 Nov 2019 01:28:06 +0000 (UTC) (envelope-from jhibbits@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 9F94E2B27; Tue, 19 Nov 2019 01:28:06 +0000 (UTC) (envelope-from jhibbits@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xAJ1S6RM092647; Tue, 19 Nov 2019 01:28:06 GMT (envelope-from jhibbits@FreeBSD.org) Received: (from jhibbits@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xAJ1S6A6092646; Tue, 19 Nov 2019 01:28:06 GMT (envelope-from jhibbits@FreeBSD.org) Message-Id: <201911190128.xAJ1S6A6092646@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhibbits set sender to jhibbits@FreeBSD.org using -f From: Justin Hibbits Date: Tue, 19 Nov 2019 01:28:06 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354838 - head/sys/powerpc/booke X-SVN-Group: head X-SVN-Commit-Author: jhibbits X-SVN-Commit-Paths: head/sys/powerpc/booke X-SVN-Commit-Revision: 354838 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 19 Nov 2019 01:28:06 -0000 Author: jhibbits Date: Tue Nov 19 01:28:06 2019 New Revision: 354838 URL: https://svnweb.freebsd.org/changeset/base/354838 Log: powerpc/booke pmap: Use the right 'tlbilx' form to invalidate TIDs 'tlbilxpid' is 'tlbilx 1, 0', while the existing form is 'tlbilx 0, 0', which translates to 'tlbilxlpid', invalidating a LDPID. This effectively invalidates the entire TLB, causing unnecessary reloads. Modified: head/sys/powerpc/booke/pmap.c Modified: head/sys/powerpc/booke/pmap.c ============================================================================== --- head/sys/powerpc/booke/pmap.c Tue Nov 19 00:02:56 2019 (r354837) +++ head/sys/powerpc/booke/pmap.c Tue Nov 19 01:28:06 2019 (r354838) @@ -4254,7 +4254,7 @@ tid_flush(tlbtid_t tid) case FSL_E6500: mtspr(SPR_MAS6, tid << MAS6_SPID0_SHIFT); /* tlbilxpid */ - __asm __volatile("isync; .long 0x7c000024; isync; msync"); + __asm __volatile("isync; .long 0x7c200024; isync; msync"); __asm __volatile("wrtee %0" :: "r"(msr)); return; } From owner-svn-src-all@freebsd.org Tue Nov 19 02:00:13 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id D9EFD1780ED; Tue, 19 Nov 2019 02:00:13 +0000 (UTC) (envelope-from jhibbits@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47H8Cx5Tkqz3LsJ; Tue, 19 Nov 2019 02:00:13 +0000 (UTC) (envelope-from jhibbits@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 9FABF30B4; Tue, 19 Nov 2019 02:00:13 +0000 (UTC) (envelope-from jhibbits@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xAJ20DOY010508; Tue, 19 Nov 2019 02:00:13 GMT (envelope-from jhibbits@FreeBSD.org) Received: (from jhibbits@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xAJ20D0V010507; Tue, 19 Nov 2019 02:00:13 GMT (envelope-from jhibbits@FreeBSD.org) Message-Id: <201911190200.xAJ20D0V010507@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhibbits set sender to jhibbits@FreeBSD.org using -f From: Justin Hibbits Date: Tue, 19 Nov 2019 02:00:13 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354839 - head/sys/powerpc/aim X-SVN-Group: head X-SVN-Commit-Author: jhibbits X-SVN-Commit-Paths: head/sys/powerpc/aim X-SVN-Commit-Revision: 354839 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 19 Nov 2019 02:00:13 -0000 Author: jhibbits Date: Tue Nov 19 02:00:13 2019 New Revision: 354839 URL: https://svnweb.freebsd.org/changeset/base/354839 Log: powerpc/pmap: Remove an unused error from moea64_pvo_enter() ENOENT is leftover from mmu_oea.c's moea_pvo_enter(), where it's used to syncicache() on the first new mapping of a page. This sync is done differently in OEA64. Modified: head/sys/powerpc/aim/mmu_oea64.c Modified: head/sys/powerpc/aim/mmu_oea64.c ============================================================================== --- head/sys/powerpc/aim/mmu_oea64.c Tue Nov 19 01:28:06 2019 (r354838) +++ head/sys/powerpc/aim/mmu_oea64.c Tue Nov 19 02:00:13 2019 (r354839) @@ -1877,7 +1877,7 @@ moea64_kenter_attr(mmu_t mmu, vm_offset_t va, vm_paddr free_pvo_entry(oldpvo); } - if (error != 0 && error != ENOENT) + if (error != 0) panic("moea64_kenter: failed to enter va %#zx pa %#jx: %d", va, (uintmax_t)pa, error); } @@ -2515,8 +2515,8 @@ static int moea64_pvo_enter(mmu_t mmu, struct pvo_entry *pvo, struct pvo_head *pvo_head, struct pvo_entry **oldpvop) { - int first, err; struct pvo_entry *old_pvo; + int err; PMAP_LOCK_ASSERT(pvo->pvo_pmap, MA_OWNED); @@ -2533,13 +2533,7 @@ moea64_pvo_enter(mmu_t mmu, struct pvo_entry *pvo, str return (EEXIST); } - /* - * Remember if the list was empty and therefore will be the first - * item. - */ if (pvo_head != NULL) { - if (LIST_FIRST(pvo_head) == NULL) - first = 1; LIST_INSERT_HEAD(pvo_head, pvo, pvo_vlink); } @@ -2570,7 +2564,7 @@ moea64_pvo_enter(mmu_t mmu, struct pvo_entry *pvo, str pvo->pvo_vaddr & PVO_LARGE); #endif - return (first ? ENOENT : 0); + return (0); } static void From owner-svn-src-all@freebsd.org Tue Nov 19 02:03:11 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 651B2178322; Tue, 19 Nov 2019 02:03:11 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47H8HM1yKsz3MF5; Tue, 19 Nov 2019 02:03:11 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 27FA23271; Tue, 19 Nov 2019 02:03:11 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xAJ23Bbf015978; Tue, 19 Nov 2019 02:03:11 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xAJ23Bmf015977; Tue, 19 Nov 2019 02:03:11 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201911190203.xAJ23Bmf015977@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Tue, 19 Nov 2019 02:03:11 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354840 - head/sys/dev/ntb/ntb_hw X-SVN-Group: head X-SVN-Commit-Author: mav X-SVN-Commit-Paths: head/sys/dev/ntb/ntb_hw X-SVN-Commit-Revision: 354840 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 19 Nov 2019 02:03:11 -0000 Author: mav Date: Tue Nov 19 02:03:10 2019 New Revision: 354840 URL: https://svnweb.freebsd.org/changeset/base/354840 Log: Call bus_dma_dmar_set_buswide(9) added in r354830. PLX NTB sends translated DMA requests not only from itsels, but from all slots and functions of its bus. By default DMAR blocks those additional. MFC after: 1 week Sponsored by: iXsystems, Inc. Modified: head/sys/dev/ntb/ntb_hw/ntb_hw_plx.c Modified: head/sys/dev/ntb/ntb_hw/ntb_hw_plx.c ============================================================================== --- head/sys/dev/ntb/ntb_hw/ntb_hw_plx.c Tue Nov 19 02:00:13 2019 (r354839) +++ head/sys/dev/ntb/ntb_hw/ntb_hw_plx.c Tue Nov 19 02:03:10 2019 (r354840) @@ -339,6 +339,12 @@ ntb_plx_attach(device_t dev) return (ENXIO); } + /* + * The device occupies whole bus. In translated TLP slot field + * keeps LUT index (original bus/slot), function is passed through. + */ + bus_dma_dmar_set_buswide(dev); + /* Identify chip port we are connected to. */ val = bus_read_4(sc->conf_res, 0x360); sc->port = (val >> ((sc->ntx == 0) ? 8 : 16)) & 0x1f; From owner-svn-src-all@freebsd.org Tue Nov 19 02:09:05 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 62E641784E7; Tue, 19 Nov 2019 02:09:05 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47H8Q91sTVz3MPw; Tue, 19 Nov 2019 02:09:05 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 1C4DB3275; Tue, 19 Nov 2019 02:09:05 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xAJ294kF016275; Tue, 19 Nov 2019 02:09:04 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xAJ294cL016274; Tue, 19 Nov 2019 02:09:04 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201911190209.xAJ294cL016274@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Tue, 19 Nov 2019 02:09:04 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354841 - head/sys/dev/ioat X-SVN-Group: head X-SVN-Commit-Author: mav X-SVN-Commit-Paths: head/sys/dev/ioat X-SVN-Commit-Revision: 354841 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 19 Nov 2019 02:09:05 -0000 Author: mav Date: Tue Nov 19 02:09:04 2019 New Revision: 354841 URL: https://svnweb.freebsd.org/changeset/base/354841 Log: Add ioat_get_domain() to ioat(4) KPI. This allows NUMA-aware consumers to reduce inter-domain traffic. MFC after: 1 week Sponsored by: iXsystems, Inc. Modified: head/sys/dev/ioat/ioat.c head/sys/dev/ioat/ioat.h Modified: head/sys/dev/ioat/ioat.c ============================================================================== --- head/sys/dev/ioat/ioat.c Tue Nov 19 02:03:10 2019 (r354840) +++ head/sys/dev/ioat/ioat.c Tue Nov 19 02:09:04 2019 (r354841) @@ -1025,6 +1025,15 @@ ioat_get_capabilities(bus_dmaengine_t dmaengine) } int +ioat_get_domain(bus_dmaengine_t dmaengine, int *domain) +{ + struct ioat_softc *ioat; + + ioat = to_ioat_softc(dmaengine); + return (bus_get_domain(ioat->device, domain)); +} + +int ioat_set_interrupt_coalesce(bus_dmaengine_t dmaengine, uint16_t delay) { struct ioat_softc *ioat; Modified: head/sys/dev/ioat/ioat.h ============================================================================== --- head/sys/dev/ioat/ioat.h Tue Nov 19 02:03:10 2019 (r354840) +++ head/sys/dev/ioat/ioat.h Tue Nov 19 02:09:04 2019 (r354841) @@ -131,6 +131,7 @@ void ioat_put_dmaengine(bus_dmaengine_t dmaengine); int ioat_get_hwversion(bus_dmaengine_t dmaengine); size_t ioat_get_max_io_size(bus_dmaengine_t dmaengine); uint32_t ioat_get_capabilities(bus_dmaengine_t dmaengine); +int ioat_get_domain(bus_dmaengine_t dmaengine, int *domain); /* * Set interrupt coalescing on a DMA channel. From owner-svn-src-all@freebsd.org Tue Nov 19 02:11:01 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 3CED61785B4; Tue, 19 Nov 2019 02:11:01 +0000 (UTC) (envelope-from jhibbits@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47H8SP0YMQz3MhP; Tue, 19 Nov 2019 02:11:01 +0000 (UTC) (envelope-from jhibbits@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id EA50B33BB; Tue, 19 Nov 2019 02:11:00 +0000 (UTC) (envelope-from jhibbits@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xAJ2B0ox017870; Tue, 19 Nov 2019 02:11:00 GMT (envelope-from jhibbits@FreeBSD.org) Received: (from jhibbits@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xAJ2B0pI017869; Tue, 19 Nov 2019 02:11:00 GMT (envelope-from jhibbits@FreeBSD.org) Message-Id: <201911190211.xAJ2B0pI017869@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhibbits set sender to jhibbits@FreeBSD.org using -f From: Justin Hibbits Date: Tue, 19 Nov 2019 02:11:00 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354842 - head/contrib/elftoolchain/readelf X-SVN-Group: head X-SVN-Commit-Author: jhibbits X-SVN-Commit-Paths: head/contrib/elftoolchain/readelf X-SVN-Commit-Revision: 354842 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 19 Nov 2019 02:11:01 -0000 Author: jhibbits Date: Tue Nov 19 02:11:00 2019 New Revision: 354842 URL: https://svnweb.freebsd.org/changeset/base/354842 Log: ELF toolchain: Add PowerPC VMX and VSX note decode to readelf Summary: A follow-on to r276634, which added the VMX note to userland cores, and r334538 for VSX notes. Copied from note_type_linux_core(). Reviewed by: emaste Differential Revision: https://reviews.freebsd.org/D22404 Modified: head/contrib/elftoolchain/readelf/readelf.c Modified: head/contrib/elftoolchain/readelf/readelf.c ============================================================================== --- head/contrib/elftoolchain/readelf/readelf.c Tue Nov 19 02:09:04 2019 (r354841) +++ head/contrib/elftoolchain/readelf/readelf.c Tue Nov 19 02:11:00 2019 (r354842) @@ -1180,6 +1180,8 @@ note_type_freebsd_core(unsigned int nt) case 15: return "NT_PROCSTAT_PSSTRINGS"; case 16: return "NT_PROCSTAT_AUXV"; case 17: return "NT_PTLWPINFO"; + case 0x100: return "NT_PPC_VMX (ppc Altivec registers)"; + case 0x102: return "NT_PPC_VSX (ppc VSX registers)"; case 0x202: return "NT_X86_XSTATE (x86 XSAVE extended state)"; case 0x400: return "NT_ARM_VFP (arm VFP registers)"; default: return (note_type_unknown(nt)); From owner-svn-src-all@freebsd.org Tue Nov 19 03:15:07 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 5BF2C179E04; Tue, 19 Nov 2019 03:15:07 +0000 (UTC) (envelope-from cem@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47H9tM1p3Gz3QCC; Tue, 19 Nov 2019 03:15:07 +0000 (UTC) (envelope-from cem@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 20FC941DB; Tue, 19 Nov 2019 03:15:07 +0000 (UTC) (envelope-from cem@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xAJ3F7qU058218; Tue, 19 Nov 2019 03:15:07 GMT (envelope-from cem@FreeBSD.org) Received: (from cem@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xAJ3F7dA058217; Tue, 19 Nov 2019 03:15:07 GMT (envelope-from cem@FreeBSD.org) Message-Id: <201911190315.xAJ3F7dA058217@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: cem set sender to cem@FreeBSD.org using -f From: Conrad Meyer Date: Tue, 19 Nov 2019 03:15:07 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354843 - head/usr.bin/unifdef X-SVN-Group: head X-SVN-Commit-Author: cem X-SVN-Commit-Paths: head/usr.bin/unifdef X-SVN-Commit-Revision: 354843 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 19 Nov 2019 03:15:07 -0000 Author: cem Date: Tue Nov 19 03:15:06 2019 New Revision: 354843 URL: https://svnweb.freebsd.org/changeset/base/354843 Log: unifdef(1): Kill totally useless header No functional change. Deleted: head/usr.bin/unifdef/unifdef.h Modified: head/usr.bin/unifdef/unifdef.c Modified: head/usr.bin/unifdef/unifdef.c ============================================================================== --- head/usr.bin/unifdef/unifdef.c Tue Nov 19 02:11:00 2019 (r354842) +++ head/usr.bin/unifdef/unifdef.c Tue Nov 19 03:15:06 2019 (r354843) @@ -45,8 +45,17 @@ * it possible to handle all "dodgy" directives correctly. */ -#include "unifdef.h" +#include +#include +#include +#include +#include +#include +#include +#include +#include + static const char copyright[] = "@(#) $Version: unifdef-2.11 $\n" "@(#) $FreeBSD$\n" @@ -250,6 +259,21 @@ static const char *xstrdup(const char *, const ch #define endsym(c) (!isalnum((unsigned char)c) && c != '_') +static FILE * +mktempmode(char *tmp, int mode) +{ + int rc, fd; + + mode &= (S_IRWXU|S_IRWXG|S_IRWXO); + fd = mkstemp(tmp); + if (fd < 0) + err(2, "can't create %s", tmp); + rc = fchmod(fd, mode); + if (rc < 0) + err(2, "can't fchmod %s mode=0o%o", tmp, mode); + return (fdopen(fd, "wb")); +} + /* * The main program. */ @@ -388,7 +412,7 @@ processinout(const char *ifn, const char *ofn) if (ifn == NULL || strcmp(ifn, "-") == 0) { filename = "[stdin]"; linefile = NULL; - input = fbinmode(stdin); + input = stdin; } else { filename = ifn; linefile = ifn; @@ -397,7 +421,7 @@ processinout(const char *ifn, const char *ofn) err(2, "can't open %s", ifn); } if (strcmp(ofn, "-") == 0) { - output = fbinmode(stdout); + output = stdout; process(); return; } @@ -426,7 +450,7 @@ processinout(const char *ifn, const char *ofn) if (!altered && backext == NULL) { if (remove(tempname) < 0) warn("can't remove \"%s\"", tempname); - } else if (replace(tempname, ofn) < 0) + } else if (rename(tempname, ofn) < 0) err(2, "can't rename \"%s\" to \"%s\"", tempname, ofn); free(tempname); tempname = NULL; From owner-svn-src-all@freebsd.org Tue Nov 19 03:40:17 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id DECEF17ACC3; Tue, 19 Nov 2019 03:40:17 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47HBRP5cm4z3wfH; Tue, 19 Nov 2019 03:40:17 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id A41DC45B3; Tue, 19 Nov 2019 03:40:17 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xAJ3eHAJ070055; Tue, 19 Nov 2019 03:40:17 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xAJ3eH0m070054; Tue, 19 Nov 2019 03:40:17 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201911190340.xAJ3eH0m070054@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Tue, 19 Nov 2019 03:40:17 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354844 - head/sys/arm/broadcom/bcm2835 X-SVN-Group: head X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: head/sys/arm/broadcom/bcm2835 X-SVN-Commit-Revision: 354844 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 19 Nov 2019 03:40:17 -0000 Author: kevans Date: Tue Nov 19 03:40:17 2019 New Revision: 354844 URL: https://svnweb.freebsd.org/changeset/base/354844 Log: bcm2835_sdhci: drop an assert in start_dma_seg Trivial change to clarify locking expectations... no functional change. Modified: head/sys/arm/broadcom/bcm2835/bcm2835_sdhci.c Modified: head/sys/arm/broadcom/bcm2835/bcm2835_sdhci.c ============================================================================== --- head/sys/arm/broadcom/bcm2835/bcm2835_sdhci.c Tue Nov 19 03:15:06 2019 (r354843) +++ head/sys/arm/broadcom/bcm2835/bcm2835_sdhci.c Tue Nov 19 03:40:17 2019 (r354844) @@ -520,6 +520,7 @@ bcm_sdhci_start_dma_seg(struct bcm_sdhci_softc *sc) int err, idx, len, sync_op, width; slot = &sc->sc_slot; + mtx_assert(&slot->mtx, MA_OWNED); idx = sc->dmamap_seg_index++; len = sc->dmamap_seg_sizes[idx]; slot->offset += len; From owner-svn-src-all@freebsd.org Tue Nov 19 03:45:42 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 7A97B17AFEF; Tue, 19 Nov 2019 03:45:42 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47HBYf2mjjz3x4p; Tue, 19 Nov 2019 03:45:42 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 440554779; Tue, 19 Nov 2019 03:45:42 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xAJ3jgAf075860; Tue, 19 Nov 2019 03:45:42 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xAJ3jgO2075859; Tue, 19 Nov 2019 03:45:42 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201911190345.xAJ3jgO2075859@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Tue, 19 Nov 2019 03:45:42 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354845 - head/sys/arm/broadcom/bcm2835 X-SVN-Group: head X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: head/sys/arm/broadcom/bcm2835 X-SVN-Commit-Revision: 354845 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 19 Nov 2019 03:45:42 -0000 Author: kevans Date: Tue Nov 19 03:45:41 2019 New Revision: 354845 URL: https://svnweb.freebsd.org/changeset/base/354845 Log: bcm2835_sdhci: some style cleanup, no functional change Modified: head/sys/arm/broadcom/bcm2835/bcm2835_sdhci.c Modified: head/sys/arm/broadcom/bcm2835/bcm2835_sdhci.c ============================================================================== --- head/sys/arm/broadcom/bcm2835/bcm2835_sdhci.c Tue Nov 19 03:40:17 2019 (r354844) +++ head/sys/arm/broadcom/bcm2835/bcm2835_sdhci.c Tue Nov 19 03:45:41 2019 (r354845) @@ -240,18 +240,21 @@ bcm_sdhci_attach(device_t dev) #ifdef NOTYET if (sc->conf->clock_src > 0) { uint32_t f; - sc->clkman = devclass_get_device(devclass_find("bcm2835_clkman"), 0); + sc->clkman = devclass_get_device( + devclass_find("bcm2835_clkman"), 0); if (sc->clkman == NULL) { device_printf(dev, "cannot find Clock Manager\n"); return (ENXIO); } - f = bcm2835_clkman_set_frequency(sc->clkman, sc->conf->clock_src, default_freq); + f = bcm2835_clkman_set_frequency(sc->clkman, + sc->conf->clock_src, default_freq); if (f == 0) return (EINVAL); if (bootverbose) - device_printf(dev, "Clock source frequency: %dMHz\n", f); + device_printf(dev, "Clock source frequency: %dMHz\n", + f); } #endif @@ -291,7 +294,7 @@ bcm_sdhci_attach(device_t dev) sc->sc_slot.caps |= SDHCI_CAN_DO_HISPD; sc->sc_slot.caps |= (default_freq << SDHCI_CLOCK_BASE_SHIFT); sc->sc_slot.quirks = sc->conf->quirks; - + sdhci_init_slot(dev, &sc->sc_slot, 0); if (sc->conf->use_dma) { @@ -299,8 +302,10 @@ bcm_sdhci_attach(device_t dev) if (sc->sc_dma_ch == BCM_DMA_CH_INVALID) goto fail; - if (bcm_dma_setup_intr(sc->sc_dma_ch, bcm_sdhci_dma_intr, sc) != 0) { - device_printf(dev, "cannot setup dma interrupt handler\n"); + err = bcm_dma_setup_intr(sc->sc_dma_ch, bcm_sdhci_dma_intr, sc); + if (err != 0) { + device_printf(dev, + "cannot setup dma interrupt handler\n"); err = ENXIO; goto fail; } @@ -388,7 +393,7 @@ WR4(struct bcm_sdhci_softc *sc, bus_size_t off, uint32 /* * The Arasan HC has a bug where it may lose the content of * consecutive writes to registers that are within two SD-card - * clock cycles of each other (a clock domain crossing problem). + * clock cycles of each other (a clock domain crossing problem). */ if (sc->sc_slot.clock > 0) DELAY(((2 * 1000000) / sc->sc_slot.clock) + 1); @@ -442,7 +447,8 @@ bcm_sdhci_read_multi_4(device_t dev, struct sdhci_slot } static void -bcm_sdhci_write_1(device_t dev, struct sdhci_slot *slot, bus_size_t off, uint8_t val) +bcm_sdhci_write_1(device_t dev, struct sdhci_slot *slot, bus_size_t off, + uint8_t val) { struct bcm_sdhci_softc *sc = device_get_softc(dev); uint32_t val32 = RD4(sc, off & ~3); @@ -452,7 +458,8 @@ bcm_sdhci_write_1(device_t dev, struct sdhci_slot *slo } static void -bcm_sdhci_write_2(device_t dev, struct sdhci_slot *slot, bus_size_t off, uint16_t val) +bcm_sdhci_write_2(device_t dev, struct sdhci_slot *slot, bus_size_t off, + uint16_t val) { struct bcm_sdhci_softc *sc = device_get_softc(dev); uint32_t val32; @@ -497,7 +504,8 @@ bcm_sdhci_write_2(device_t dev, struct sdhci_slot *slo } static void -bcm_sdhci_write_4(device_t dev, struct sdhci_slot *slot, bus_size_t off, uint32_t val) +bcm_sdhci_write_4(device_t dev, struct sdhci_slot *slot, bus_size_t off, + uint32_t val) { struct bcm_sdhci_softc *sc = device_get_softc(dev); WR4(sc, off, val); @@ -528,7 +536,7 @@ bcm_sdhci_start_dma_seg(struct bcm_sdhci_softc *sc) if (slot->curcmd->data->flags & MMC_DATA_READ) { bcm_dma_setup_src(sc->sc_dma_ch, BCM_DMA_DREQ_EMMC, - BCM_DMA_SAME_ADDR, BCM_DMA_32BIT); + BCM_DMA_SAME_ADDR, BCM_DMA_32BIT); bcm_dma_setup_dst(sc->sc_dma_ch, BCM_DMA_DREQ_NONE, BCM_DMA_INC_ADDR, width); psrc = sc->sc_sdhci_buffer_phys; @@ -670,8 +678,8 @@ bcm_sdhci_read_dma(device_t dev, struct sdhci_slot *sl KASSERT((left & 3) == 0, ("%s: len = %zu, not word-aligned", __func__, left)); - if (bus_dmamap_load(sc->sc_dma_tag, sc->sc_dma_map, - (uint8_t *)slot->curcmd->data->data + slot->offset, left, + if (bus_dmamap_load(sc->sc_dma_tag, sc->sc_dma_map, + (uint8_t *)slot->curcmd->data->data + slot->offset, left, bcm_sdhci_dmacb, sc, BUS_DMA_NOWAIT) != 0 || sc->dmamap_status != 0) { slot->curcmd->error = MMC_ERR_NO_MEMORY; @@ -701,7 +709,7 @@ bcm_sdhci_write_dma(device_t dev, struct sdhci_slot *s ("%s: len = %zu, not word-aligned", __func__, left)); if (bus_dmamap_load(sc->sc_dma_tag, sc->sc_dma_map, - (uint8_t *)slot->curcmd->data->data + slot->offset, left, + (uint8_t *)slot->curcmd->data->data + slot->offset, left, bcm_sdhci_dmacb, sc, BUS_DMA_NOWAIT) != 0 || sc->dmamap_status != 0) { slot->curcmd->error = MMC_ERR_NO_MEMORY; From owner-svn-src-all@freebsd.org Tue Nov 19 04:23:58 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 634D117BFE5; Tue, 19 Nov 2019 04:23:58 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47HCPp1pbJz3yXg; Tue, 19 Nov 2019 04:23:58 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 224A84EBD; Tue, 19 Nov 2019 04:23:58 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xAJ4NwjV098948; Tue, 19 Nov 2019 04:23:58 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xAJ4NvRl098947; Tue, 19 Nov 2019 04:23:57 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201911190423.xAJ4NvRl098947@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Tue, 19 Nov 2019 04:23:57 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354846 - head/sys/arm/broadcom/bcm2835 X-SVN-Group: head X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: head/sys/arm/broadcom/bcm2835 X-SVN-Commit-Revision: 354846 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 19 Nov 2019 04:23:58 -0000 Author: kevans Date: Tue Nov 19 04:23:57 2019 New Revision: 354846 URL: https://svnweb.freebsd.org/changeset/base/354846 Log: bcm2835_sdhci: formalize DMA tag/segment scaling requirements This allows easy and care-free scaling of NUM_DMA_SEGS with proper-ish calculations to make sure we can actually handle the number of segments we'd like to handle on average so that performance comparisons can be easily made at different values if/once we can actually handle it. It also makes it helps the untrained reader understand more quickly the reasoning behind the choice of maxsize/maxsegs/maxsegsize. Modified: head/sys/arm/broadcom/bcm2835/bcm2835_sdhci.c Modified: head/sys/arm/broadcom/bcm2835/bcm2835_sdhci.c ============================================================================== --- head/sys/arm/broadcom/bcm2835/bcm2835_sdhci.c Tue Nov 19 03:45:41 2019 (r354845) +++ head/sys/arm/broadcom/bcm2835/bcm2835_sdhci.c Tue Nov 19 04:23:57 2019 (r354846) @@ -66,7 +66,17 @@ __FBSDID("$FreeBSD$"); #define BCM2838_DEFAULT_SDHCI_FREQ 100 #define BCM_SDHCI_BUFFER_SIZE 512 -#define NUM_DMA_SEGS 2 +/* + * NUM_DMA_SEGS is the number of DMA segments we want to accommodate on average. + * We add in a number of segments based on how much we may need to spill into + * another segment due to crossing page boundaries. e.g. up to PAGE_SIZE, an + * extra page is needed as we can cross a page boundary exactly once. + */ +#define NUM_DMA_SEGS 1 +#define NUM_DMA_SPILL_SEGS \ + ((((NUM_DMA_SEGS * BCM_SDHCI_BUFFER_SIZE) - 1) / PAGE_SIZE) + 1) +#define ALLOCATED_DMA_SEGS (NUM_DMA_SEGS + NUM_DMA_SPILL_SEGS) +#define BCM_DMA_MAXSIZE (NUM_DMA_SEGS * BCM_SDHCI_BUFFER_SIZE) #define DATA_PENDING_MASK (SDHCI_INT_DATA_AVAIL | SDHCI_INT_SPACE_AVAIL) @@ -141,8 +151,8 @@ struct bcm_sdhci_softc { bus_dma_tag_t sc_dma_tag; bus_dmamap_t sc_dma_map; vm_paddr_t sc_sdhci_buffer_phys; - bus_addr_t dmamap_seg_addrs[NUM_DMA_SEGS]; - bus_size_t dmamap_seg_sizes[NUM_DMA_SEGS]; + bus_addr_t dmamap_seg_addrs[ALLOCATED_DMA_SEGS]; + bus_size_t dmamap_seg_sizes[ALLOCATED_DMA_SEGS]; int dmamap_seg_count; int dmamap_seg_index; int dmamap_status; @@ -314,7 +324,7 @@ bcm_sdhci_attach(device_t dev) err = bus_dma_tag_create(bus_get_dma_tag(dev), 1, 0, BUS_SPACE_MAXADDR_32BIT, BUS_SPACE_MAXADDR, NULL, NULL, - BCM_SDHCI_BUFFER_SIZE, NUM_DMA_SEGS, BCM_SDHCI_BUFFER_SIZE, + BCM_DMA_MAXSIZE, ALLOCATED_DMA_SEGS, BCM_SDHCI_BUFFER_SIZE, BUS_DMA_ALLOCNOW, NULL, NULL, &sc->sc_dma_tag); From owner-svn-src-all@freebsd.org Tue Nov 19 04:30:24 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 14AB417C18E; Tue, 19 Nov 2019 04:30:24 +0000 (UTC) (envelope-from cem@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47HCYC6rk6z3yjk; Tue, 19 Nov 2019 04:30:23 +0000 (UTC) (envelope-from cem@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id CE4564EC8; Tue, 19 Nov 2019 04:30:23 +0000 (UTC) (envelope-from cem@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xAJ4UNGv099284; Tue, 19 Nov 2019 04:30:23 GMT (envelope-from cem@FreeBSD.org) Received: (from cem@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xAJ4UNPY099283; Tue, 19 Nov 2019 04:30:23 GMT (envelope-from cem@FreeBSD.org) Message-Id: <201911190430.xAJ4UNPY099283@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: cem set sender to cem@FreeBSD.org using -f From: Conrad Meyer Date: Tue, 19 Nov 2019 04:30:23 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354847 - head/usr.bin/unifdef X-SVN-Group: head X-SVN-Commit-Author: cem X-SVN-Commit-Paths: head/usr.bin/unifdef X-SVN-Commit-Revision: 354847 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 19 Nov 2019 04:30:24 -0000 Author: cem Date: Tue Nov 19 04:30:23 2019 New Revision: 354847 URL: https://svnweb.freebsd.org/changeset/base/354847 Log: unifdef(1): Improve worst-case bound on symbol resolution Use RB_TREE to make some algorithms O(lg N) and O(N lg N) instead of O(N) and O(N^2). Because N is typically small and the former linear array also has great constant factors (as a property of CPU caching), this doesn't provide material benefit most or all of the time. While here, remove arbitrarily limit on number of macros understood. Modified: head/usr.bin/unifdef/unifdef.c Modified: head/usr.bin/unifdef/unifdef.c ============================================================================== --- head/usr.bin/unifdef/unifdef.c Tue Nov 19 04:23:57 2019 (r354846) +++ head/usr.bin/unifdef/unifdef.c Tue Nov 19 04:30:23 2019 (r354847) @@ -45,8 +45,11 @@ * it possible to handle all "dodgy" directives correctly. */ +#include #include +#include +#include #include #include #include @@ -149,7 +152,6 @@ static char const * const linestate_name[] = { */ #define MAXDEPTH 64 /* maximum #if nesting */ #define MAXLINE 4096 /* maximum length of line */ -#define MAXSYMS 16384 /* maximum number of symbols */ /* * Sometimes when editing a keyword the replacement text is longer, so @@ -158,6 +160,26 @@ static char const * const linestate_name[] = { #define EDITSLOP 10 /* + * C17/18 allow 63 characters per macro name, but up to 127 arbitrarily large + * parameters. + */ +struct macro { + RB_ENTRY(macro) entry; + const char *name; + const char *value; + bool ignore; /* -iDsym or -iUsym */ +}; + +static int +macro_cmp(struct macro *a, struct macro *b) +{ + return (strcmp(a->name, b->name)); +} + +static RB_HEAD(macrohd, macro) macro_tree = RB_INITIALIZER(¯o_tree); +RB_GENERATE_STATIC(macrohd, macro, entry, macro_cmp); + +/* * Globals. */ @@ -174,11 +196,6 @@ static bool symlist; /* -s: output symbol static bool symdepth; /* -S: output symbol depth */ static bool text; /* -t: this is a text file */ -static const char *symname[MAXSYMS]; /* symbol name */ -static const char *value[MAXSYMS]; /* -Dsym=value */ -static bool ignore[MAXSYMS]; /* -iDsym or -iUsym */ -static int nsyms; /* number of symbols */ - static FILE *input; /* input file pointer */ static const char *filename; /* input file name */ static int linenum; /* current line number */ @@ -227,12 +244,12 @@ static char *astrcat(const char *, const ch static void cleantemp(void); static void closeio(void); static void debug(const char *, ...); -static void debugsym(const char *, int); +static void debugsym(const char *, const struct macro *); static bool defundef(void); static void defundefile(const char *); static void done(void); static void error(const char *); -static int findsym(const char **); +static struct macro *findsym(const char **); static void flushline(bool); static void hashline(void); static void help(void); @@ -807,7 +824,7 @@ static Linetype parseline(void) { const char *cp; - int cursym; + struct macro *cursym; Linetype retval; Comment_state wascomment; @@ -829,15 +846,15 @@ parseline(void) if ((cp = matchsym("ifdef", keyword)) != NULL || (cp = matchsym("ifndef", keyword)) != NULL) { cp = skipcomment(cp); - if ((cursym = findsym(&cp)) < 0) + if ((cursym = findsym(&cp)) == NULL) retval = LT_IF; else { retval = (keyword[2] == 'n') ? LT_FALSE : LT_TRUE; - if (value[cursym] == NULL) + if (cursym->value == NULL) retval = (retval == LT_TRUE) ? LT_FALSE : LT_TRUE; - if (ignore[cursym]) + if (cursym->ignore) retval = (retval == LT_TRUE) ? LT_TRUEI : LT_FALSEI; } @@ -1037,7 +1054,7 @@ eval_unary(const struct ops *ops, long *valp, const ch { const char *cp; char *ep; - int sym; + struct macro *sym; bool defparen; Linetype lt; @@ -1102,27 +1119,27 @@ eval_unary(const struct ops *ops, long *valp, const ch debug("eval%d defined missing ')'", prec(ops)); return (LT_ERROR); } - if (sym < 0) { + if (sym == NULL) { debug("eval%d defined unknown", prec(ops)); lt = LT_IF; } else { - debug("eval%d defined %s", prec(ops), symname[sym]); - *valp = (value[sym] != NULL); + debug("eval%d defined %s", prec(ops), sym->name); + *valp = (sym->value != NULL); lt = *valp ? LT_TRUE : LT_FALSE; } constexpr = false; } else if (!endsym(*cp)) { debug("eval%d symbol", prec(ops)); sym = findsym(&cp); - if (sym < 0) { + if (sym == NULL) { lt = LT_IF; cp = skipargs(cp); - } else if (value[sym] == NULL) { + } else if (sym->value == NULL) { *valp = 0; lt = LT_FALSE; } else { - *valp = strtol(value[sym], &ep, 0); - if (*ep != '\0' || ep == value[sym]) + *valp = strtol(sym->value, &ep, 0); + if (*ep != '\0' || ep == sym->value) return (LT_ERROR); lt = *valp ? LT_TRUE : LT_FALSE; cp = skipargs(cp); @@ -1439,17 +1456,17 @@ matchsym(const char *s, const char *t) * Look for the symbol in the symbol table. If it is found, we return * the symbol table index, else we return -1. */ -static int +static struct macro * findsym(const char **strp) { const char *str; - int symind; + struct macro key, *res; str = *strp; *strp = skipsym(str); if (symlist) { if (*strp == str) - return (-1); + return (NULL); if (symdepth && firstsym) printf("%s%3d", zerosyms ? "" : "\n", depth); firstsym = zerosyms = false; @@ -1458,15 +1475,14 @@ findsym(const char **strp) (int)(*strp-str), str, symdepth ? "" : "\n"); /* we don't care about the value of the symbol */ - return (0); + return (NULL); } - for (symind = 0; symind < nsyms; ++symind) { - if (matchsym(symname[symind], str) != NULL) { - debugsym("findsym", symind); - return (symind); - } - } - return (-1); + + key.name = str; + res = RB_FIND(macrohd, ¯o_tree, &key); + if (res != NULL) + debugsym("findsym", res); + return (res); } /* @@ -1476,22 +1492,23 @@ static void indirectsym(void) { const char *cp; - int changed, sym, ind; + int changed; + struct macro *sym, *ind; do { changed = 0; - for (sym = 0; sym < nsyms; ++sym) { - if (value[sym] == NULL) + RB_FOREACH(sym, macrohd, ¯o_tree) { + if (sym->value == NULL) continue; - cp = value[sym]; + cp = sym->value; ind = findsym(&cp); - if (ind == -1 || ind == sym || + if (ind == NULL || ind == sym || *cp != '\0' || - value[ind] == NULL || - value[ind] == value[sym]) + ind->value == NULL || + ind->value == sym->value) continue; debugsym("indir...", sym); - value[sym] = value[ind]; + sym->value = ind->value; debugsym("...ectsym", sym); changed++; } @@ -1523,29 +1540,29 @@ addsym1(bool ignorethis, bool definethis, char *symval * Add a symbol to the symbol table. */ static void -addsym2(bool ignorethis, const char *sym, const char *val) +addsym2(bool ignorethis, const char *symname, const char *val) { - const char *cp = sym; - int symind; + const char *cp = symname; + struct macro *sym, *r; - symind = findsym(&cp); - if (symind < 0) { - if (nsyms >= MAXSYMS) - errx(2, "too many symbols"); - symind = nsyms++; + sym = findsym(&cp); + if (sym == NULL) { + sym = calloc(1, sizeof(*sym)); + sym->ignore = ignorethis; + sym->name = symname; + sym->value = val; + r = RB_INSERT(macrohd, ¯o_tree, sym); + assert(r == NULL); } - ignore[symind] = ignorethis; - symname[symind] = sym; - value[symind] = val; - debugsym("addsym", symind); + debugsym("addsym", sym); } static void -debugsym(const char *why, int symind) +debugsym(const char *why, const struct macro *sym) { - debug("%s %s%c%s", why, symname[symind], - value[symind] ? '=' : ' ', - value[symind] ? value[symind] : "undef"); + debug("%s %s%c%s", why, sym->name, + sym->value ? '=' : ' ', + sym->value ? sym->value : "undef"); } /* From owner-svn-src-all@freebsd.org Tue Nov 19 07:19:35 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id CA10A17FB36; Tue, 19 Nov 2019 07:19:35 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47HHJR5XP8z46fh; Tue, 19 Nov 2019 07:19:35 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id A0FF36D1E; Tue, 19 Nov 2019 07:19:35 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xAJ7JZn8098701; Tue, 19 Nov 2019 07:19:35 GMT (envelope-from avg@FreeBSD.org) Received: (from avg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xAJ7JXwX098691; Tue, 19 Nov 2019 07:19:33 GMT (envelope-from avg@FreeBSD.org) Message-Id: <201911190719.xAJ7JXwX098691@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avg set sender to avg@FreeBSD.org using -f From: Andriy Gapon Date: Tue, 19 Nov 2019 07:19:33 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r354848 - in stable/12: cddl/contrib/opensolaris/lib/libzpool/common cddl/contrib/opensolaris/lib/libzpool/common/sys sys/cddl/contrib/opensolaris/uts/common/fs/zfs sys/cddl/contrib/ope... X-SVN-Group: stable-12 X-SVN-Commit-Author: avg X-SVN-Commit-Paths: in stable/12: cddl/contrib/opensolaris/lib/libzpool/common cddl/contrib/opensolaris/lib/libzpool/common/sys sys/cddl/contrib/opensolaris/uts/common/fs/zfs sys/cddl/contrib/opensolaris/uts/common/fs/zf... X-SVN-Commit-Revision: 354848 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 19 Nov 2019 07:19:35 -0000 Author: avg Date: Tue Nov 19 07:19:33 2019 New Revision: 354848 URL: https://svnweb.freebsd.org/changeset/base/354848 Log: MFC r353618,r353625,r353627: MFV r353617: 9425 allow channel programs to be stopped via signals Modified: stable/12/cddl/contrib/opensolaris/lib/libzpool/common/kernel.c stable/12/cddl/contrib/opensolaris/lib/libzpool/common/sys/zfs_context.h stable/12/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_synctask.c stable/12/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dsl_synctask.h stable/12/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/txg.h stable/12/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zcp.h stable/12/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/txg.c stable/12/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zcp.c stable/12/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c Directory Properties: stable/12/ (props changed) Modified: stable/12/cddl/contrib/opensolaris/lib/libzpool/common/kernel.c ============================================================================== --- stable/12/cddl/contrib/opensolaris/lib/libzpool/common/kernel.c Tue Nov 19 04:30:23 2019 (r354847) +++ stable/12/cddl/contrib/opensolaris/lib/libzpool/common/kernel.c Tue Nov 19 07:19:33 2019 (r354848) @@ -321,6 +321,18 @@ cv_wait(kcondvar_t *cv, kmutex_t *mp) mp->m_owner = curthread; } +/* + * NB: this emulates FreeBSD cv_wait_sig(9), not the illumos one. + * Meanings of the return code are different. + * NB: this does not actually catch any signals. + */ +int +cv_wait_sig(kcondvar_t *cv, kmutex_t *mp) +{ + cv_wait(cv, mp); + return (0); +} + clock_t cv_timedwait(kcondvar_t *cv, kmutex_t *mp, clock_t abstime) { Modified: stable/12/cddl/contrib/opensolaris/lib/libzpool/common/sys/zfs_context.h ============================================================================== --- stable/12/cddl/contrib/opensolaris/lib/libzpool/common/sys/zfs_context.h Tue Nov 19 04:30:23 2019 (r354847) +++ stable/12/cddl/contrib/opensolaris/lib/libzpool/common/sys/zfs_context.h Tue Nov 19 07:19:33 2019 (r354848) @@ -330,6 +330,7 @@ typedef cond_t kcondvar_t; extern void cv_init(kcondvar_t *cv, char *name, int type, void *arg); extern void cv_destroy(kcondvar_t *cv); extern void cv_wait(kcondvar_t *cv, kmutex_t *mp); +extern int cv_wait_sig(kcondvar_t *cv, kmutex_t *mp); extern clock_t cv_timedwait(kcondvar_t *cv, kmutex_t *mp, clock_t abstime); extern clock_t cv_timedwait_hires(kcondvar_t *cvp, kmutex_t *mp, hrtime_t tim, hrtime_t res, int flag); Modified: stable/12/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_synctask.c ============================================================================== --- stable/12/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_synctask.c Tue Nov 19 04:30:23 2019 (r354847) +++ stable/12/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_synctask.c Tue Nov 19 07:19:33 2019 (r354848) @@ -41,7 +41,7 @@ dsl_null_checkfunc(void *arg, dmu_tx_t *tx) static int dsl_sync_task_common(const char *pool, dsl_checkfunc_t *checkfunc, - dsl_syncfunc_t *syncfunc, void *arg, + dsl_syncfunc_t *syncfunc, dsl_sigfunc_t *sigfunc, void *arg, int blocks_modified, zfs_space_check_t space_check, boolean_t early) { spa_t *spa; @@ -85,6 +85,11 @@ top: dmu_tx_commit(tx); + if (sigfunc != NULL && txg_wait_synced_sig(dp, dst.dst_txg)) { + /* current contract is to call func once */ + sigfunc(arg, tx); + sigfunc = NULL; /* in case of an EAGAIN retry */ + } txg_wait_synced(dp, dst.dst_txg); if (dst.dst_error == EAGAIN) { @@ -124,7 +129,7 @@ dsl_sync_task(const char *pool, dsl_checkfunc_t *check dsl_syncfunc_t *syncfunc, void *arg, int blocks_modified, zfs_space_check_t space_check) { - return (dsl_sync_task_common(pool, checkfunc, syncfunc, arg, + return (dsl_sync_task_common(pool, checkfunc, syncfunc, NULL, arg, blocks_modified, space_check, B_FALSE)); } @@ -146,8 +151,21 @@ dsl_early_sync_task(const char *pool, dsl_checkfunc_t dsl_syncfunc_t *syncfunc, void *arg, int blocks_modified, zfs_space_check_t space_check) { - return (dsl_sync_task_common(pool, checkfunc, syncfunc, arg, + return (dsl_sync_task_common(pool, checkfunc, syncfunc, NULL, arg, blocks_modified, space_check, B_TRUE)); +} + +/* + * A standard synctask that can be interrupted from a signal. The sigfunc + * is called once if a signal occurred while waiting for the task to sync. + */ +int +dsl_sync_task_sig(const char *pool, dsl_checkfunc_t *checkfunc, + dsl_syncfunc_t *syncfunc, dsl_sigfunc_t *sigfunc, void *arg, + int blocks_modified, zfs_space_check_t space_check) +{ + return (dsl_sync_task_common(pool, checkfunc, syncfunc, sigfunc, arg, + blocks_modified, space_check, B_FALSE)); } static void Modified: stable/12/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dsl_synctask.h ============================================================================== --- stable/12/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dsl_synctask.h Tue Nov 19 04:30:23 2019 (r354847) +++ stable/12/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dsl_synctask.h Tue Nov 19 07:19:33 2019 (r354848) @@ -37,6 +37,7 @@ struct dsl_pool; typedef int (dsl_checkfunc_t)(void *, dmu_tx_t *); typedef void (dsl_syncfunc_t)(void *, dmu_tx_t *); +typedef void (dsl_sigfunc_t)(void *, dmu_tx_t *); typedef enum zfs_space_check { /* @@ -116,6 +117,8 @@ int dsl_early_sync_task(const char *, dsl_checkfunc_t dsl_syncfunc_t *, void *, int, zfs_space_check_t); void dsl_early_sync_task_nowait(struct dsl_pool *, dsl_syncfunc_t *, void *, int, zfs_space_check_t, dmu_tx_t *); +int dsl_sync_task_sig(const char *, dsl_checkfunc_t *, dsl_syncfunc_t *, + dsl_sigfunc_t *, void *, int, zfs_space_check_t); #ifdef __cplusplus } Modified: stable/12/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/txg.h ============================================================================== --- stable/12/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/txg.h Tue Nov 19 04:30:23 2019 (r354847) +++ stable/12/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/txg.h Tue Nov 19 07:19:33 2019 (r354848) @@ -88,6 +88,11 @@ extern void txg_kick(struct dsl_pool *dp); extern void txg_wait_synced(struct dsl_pool *dp, uint64_t txg); /* + * Wait as above. Returns true if the thread was signaled while waiting. + */ +extern boolean_t txg_wait_synced_sig(struct dsl_pool *dp, uint64_t txg); + +/* * Wait until the given transaction group, or one after it, is * the open transaction group. Try to make this happen as soon * as possible (eg. kick off any necessary syncs immediately). Modified: stable/12/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zcp.h ============================================================================== --- stable/12/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zcp.h Tue Nov 19 04:30:23 2019 (r354847) +++ stable/12/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zcp.h Tue Nov 19 07:19:33 2019 (r354848) @@ -52,6 +52,12 @@ typedef struct zcp_cleanup_handler { list_node_t zch_node; } zcp_cleanup_handler_t; +typedef struct zcp_alloc_arg { + boolean_t aa_must_succeed; + int64_t aa_alloc_remaining; + int64_t aa_alloc_limit; +} zcp_alloc_arg_t; + typedef struct zcp_run_info { dsl_pool_t *zri_pool; @@ -94,6 +100,11 @@ typedef struct zcp_run_info { boolean_t zri_timed_out; /* + * Channel program was canceled by user + */ + boolean_t zri_canceled; + + /* * Boolean indicating whether or not we are running in syncing * context. */ @@ -104,6 +115,26 @@ typedef struct zcp_run_info { * triggered in the event of a fatal error. */ list_t zri_cleanup_handlers; + + /* + * The Lua state context of our channel program. + */ + lua_State *zri_state; + + /* + * Lua memory allocator arguments. + */ + zcp_alloc_arg_t *zri_allocargs; + + /* + * Contains output values from zcp script or error string. + */ + nvlist_t *zri_outnvl; + + /* + * The errno number returned to caller of zcp_eval(). + */ + int zri_result; } zcp_run_info_t; zcp_run_info_t *zcp_run_info(lua_State *); Modified: stable/12/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/txg.c ============================================================================== --- stable/12/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/txg.c Tue Nov 19 04:30:23 2019 (r354847) +++ stable/12/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/txg.c Tue Nov 19 07:19:33 2019 (r354848) @@ -638,8 +638,8 @@ txg_delay(dsl_pool_t *dp, uint64_t txg, hrtime_t delay mutex_exit(&tx->tx_sync_lock); } -void -txg_wait_synced(dsl_pool_t *dp, uint64_t txg) +static boolean_t +txg_wait_synced_impl(dsl_pool_t *dp, uint64_t txg, boolean_t wait_sig) { tx_state_t *tx = &dp->dp_tx; @@ -658,9 +658,51 @@ txg_wait_synced(dsl_pool_t *dp, uint64_t txg) "tx_synced=%llu waiting=%llu dp=%p\n", tx->tx_synced_txg, tx->tx_sync_txg_waiting, dp); cv_broadcast(&tx->tx_sync_more_cv); - cv_wait(&tx->tx_sync_done_cv, &tx->tx_sync_lock); + if (wait_sig) { + /* + * Condition wait here but stop if the thread receives a + * signal. The caller may call txg_wait_synced*() again + * to resume waiting for this txg. + */ +#ifdef __FreeBSD__ + /* + * FreeBSD returns EINTR or ERESTART if there is + * a pending signal, zero if the conditional variable + * is signaled. illumos returns zero in the former case + * and >0 in the latter. + */ + if (cv_wait_sig(&tx->tx_sync_done_cv, + &tx->tx_sync_lock) != 0) { +#else + if (cv_wait_sig(&tx->tx_sync_done_cv, + &tx->tx_sync_lock) == 0) { +#endif + + mutex_exit(&tx->tx_sync_lock); + return (B_TRUE); + } + } else { + cv_wait(&tx->tx_sync_done_cv, &tx->tx_sync_lock); + } } mutex_exit(&tx->tx_sync_lock); + return (B_FALSE); +} + +void +txg_wait_synced(dsl_pool_t *dp, uint64_t txg) +{ + VERIFY0(txg_wait_synced_impl(dp, txg, B_FALSE)); +} + +/* + * Similar to a txg_wait_synced but it can be interrupted from a signal. + * Returns B_TRUE if the thread was signaled while waiting. + */ +boolean_t +txg_wait_synced_sig(dsl_pool_t *dp, uint64_t txg) +{ + return (txg_wait_synced_impl(dp, txg, B_TRUE)); } void Modified: stable/12/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zcp.c ============================================================================== --- stable/12/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zcp.c Tue Nov 19 04:30:23 2019 (r354847) +++ stable/12/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zcp.c Tue Nov 19 07:19:33 2019 (r354848) @@ -122,21 +122,6 @@ static int zcp_nvpair_value_to_lua(lua_State *, nvpair static int zcp_lua_to_nvlist_impl(lua_State *, int, nvlist_t *, const char *, int); -typedef struct zcp_alloc_arg { - boolean_t aa_must_succeed; - int64_t aa_alloc_remaining; - int64_t aa_alloc_limit; -} zcp_alloc_arg_t; - -typedef struct zcp_eval_arg { - lua_State *ea_state; - zcp_alloc_arg_t *ea_allocargs; - cred_t *ea_cred; - nvlist_t *ea_outnvl; - int ea_result; - uint64_t ea_instrlimit; -} zcp_eval_arg_t; - /* * The outer-most error callback handler for use with lua_pcall(). On * error Lua will call this callback with a single argument that @@ -456,7 +441,7 @@ zcp_lua_to_nvlist_helper(lua_State *state) static void zcp_convert_return_values(lua_State *state, nvlist_t *nvl, - const char *key, zcp_eval_arg_t *evalargs) + const char *key, int *result) { int err; VERIFY3U(1, ==, lua_gettop(state)); @@ -468,7 +453,7 @@ zcp_convert_return_values(lua_State *state, nvlist_t * err = lua_pcall(state, 3, 0, 0); /* zcp_lua_to_nvlist_helper */ if (err != 0) { zcp_lua_to_nvlist(state, 1, nvl, ZCP_RET_ERROR); - evalargs->ea_result = SET_ERROR(ECHRNG); + *result = SET_ERROR(ECHRNG); } } @@ -795,13 +780,24 @@ zcp_lua_alloc(void *ud, void *ptr, size_t osize, size_ static void zcp_lua_counthook(lua_State *state, lua_Debug *ar) { - /* - * If we're called, check how many instructions the channel program has - * executed so far, and compare against the limit. - */ lua_getfield(state, LUA_REGISTRYINDEX, ZCP_RUN_INFO_KEY); zcp_run_info_t *ri = lua_touserdata(state, -1); + /* + * Check if we were canceled while waiting for the + * txg to sync or from our open context thread + */ + if (ri->zri_canceled || + (!ri->zri_sync && issig(JUSTLOOKING) && issig(FORREAL))) { + ri->zri_canceled = B_TRUE; + (void) lua_pushstring(state, "Channel program was canceled."); + (void) lua_error(state); + } + + /* + * Check how many instructions the channel program has + * executed so far, and compare against the limit. + */ ri->zri_curinstrs += zfs_lua_check_instrlimit_interval; if (ri->zri_maxinstrs != 0 && ri->zri_curinstrs > ri->zri_maxinstrs) { ri->zri_timed_out = B_TRUE; @@ -820,31 +816,25 @@ zcp_panic_cb(lua_State *state) } static void -zcp_eval_impl(dmu_tx_t *tx, boolean_t sync, zcp_eval_arg_t *evalargs) +zcp_eval_impl(dmu_tx_t *tx, zcp_run_info_t *ri) { int err; - zcp_run_info_t ri; - lua_State *state = evalargs->ea_state; + lua_State *state = ri->zri_state; VERIFY3U(3, ==, lua_gettop(state)); + /* finish initializing our runtime state */ + ri->zri_pool = dmu_tx_pool(tx); + ri->zri_tx = tx; + list_create(&ri->zri_cleanup_handlers, sizeof (zcp_cleanup_handler_t), + offsetof(zcp_cleanup_handler_t, zch_node)); + /* * Store the zcp_run_info_t struct for this run in the Lua registry. * Registry entries are not directly accessible by the Lua scripts but * can be accessed by our callbacks. */ - ri.zri_space_used = 0; - ri.zri_pool = dmu_tx_pool(tx); - ri.zri_cred = evalargs->ea_cred; - ri.zri_tx = tx; - ri.zri_timed_out = B_FALSE; - ri.zri_sync = sync; - list_create(&ri.zri_cleanup_handlers, sizeof (zcp_cleanup_handler_t), - offsetof(zcp_cleanup_handler_t, zch_node)); - ri.zri_curinstrs = 0; - ri.zri_maxinstrs = evalargs->ea_instrlimit; - - lua_pushlightuserdata(state, &ri); + lua_pushlightuserdata(state, ri); lua_setfield(state, LUA_REGISTRYINDEX, ZCP_RUN_INFO_KEY); VERIFY3U(3, ==, lua_gettop(state)); @@ -861,7 +851,7 @@ zcp_eval_impl(dmu_tx_t *tx, boolean_t sync, zcp_eval_a * off control to the channel program. Channel programs that use too * much memory should die with ENOSPC. */ - evalargs->ea_allocargs->aa_must_succeed = B_FALSE; + ri->zri_allocargs->aa_must_succeed = B_FALSE; /* * Call the Lua function that open-context passed us. This pops the @@ -873,14 +863,14 @@ zcp_eval_impl(dmu_tx_t *tx, boolean_t sync, zcp_eval_a /* * Let Lua use KM_SLEEP while we interpret the return values. */ - evalargs->ea_allocargs->aa_must_succeed = B_TRUE; + ri->zri_allocargs->aa_must_succeed = B_TRUE; /* * Remove the error handler callback from the stack. At this point, * there shouldn't be any cleanup handler registered in the handler * list (zri_cleanup_handlers), regardless of whether it ran or not. */ - list_destroy(&ri.zri_cleanup_handlers); + list_destroy(&ri->zri_cleanup_handlers); lua_remove(state, 1); switch (err) { @@ -900,16 +890,16 @@ zcp_eval_impl(dmu_tx_t *tx, boolean_t sync, zcp_eval_a int return_count = lua_gettop(state); if (return_count == 1) { - evalargs->ea_result = 0; - zcp_convert_return_values(state, evalargs->ea_outnvl, - ZCP_RET_RETURN, evalargs); + ri->zri_result = 0; + zcp_convert_return_values(state, ri->zri_outnvl, + ZCP_RET_RETURN, &ri->zri_result); } else if (return_count > 1) { - evalargs->ea_result = SET_ERROR(ECHRNG); + ri->zri_result = SET_ERROR(ECHRNG); lua_settop(state, 0); (void) lua_pushfstring(state, "Multiple return " "values not supported"); - zcp_convert_return_values(state, evalargs->ea_outnvl, - ZCP_RET_ERROR, evalargs); + zcp_convert_return_values(state, ri->zri_outnvl, + ZCP_RET_ERROR, &ri->zri_result); } break; } @@ -923,14 +913,16 @@ zcp_eval_impl(dmu_tx_t *tx, boolean_t sync, zcp_eval_a * stack. */ VERIFY3U(1, ==, lua_gettop(state)); - if (ri.zri_timed_out) { - evalargs->ea_result = SET_ERROR(ETIME); + if (ri->zri_timed_out) { + ri->zri_result = SET_ERROR(ETIME); + } else if (ri->zri_canceled) { + ri->zri_result = SET_ERROR(EINTR); } else { - evalargs->ea_result = SET_ERROR(ECHRNG); + ri->zri_result = SET_ERROR(ECHRNG); } - zcp_convert_return_values(state, evalargs->ea_outnvl, - ZCP_RET_ERROR, evalargs); + zcp_convert_return_values(state, ri->zri_outnvl, + ZCP_RET_ERROR, &ri->zri_result); break; } case LUA_ERRERR: { @@ -941,14 +933,16 @@ zcp_eval_impl(dmu_tx_t *tx, boolean_t sync, zcp_eval_a * return the error message. */ VERIFY3U(1, ==, lua_gettop(state)); - if (ri.zri_timed_out) { - evalargs->ea_result = SET_ERROR(ETIME); + if (ri->zri_timed_out) { + ri->zri_result = SET_ERROR(ETIME); + } else if (ri->zri_canceled) { + ri->zri_result = SET_ERROR(EINTR); } else { - evalargs->ea_result = SET_ERROR(ECHRNG); + ri->zri_result = SET_ERROR(ECHRNG); } - zcp_convert_return_values(state, evalargs->ea_outnvl, - ZCP_RET_ERROR, evalargs); + zcp_convert_return_values(state, ri->zri_outnvl, + ZCP_RET_ERROR, &ri->zri_result); break; } case LUA_ERRMEM: @@ -956,7 +950,7 @@ zcp_eval_impl(dmu_tx_t *tx, boolean_t sync, zcp_eval_a * Lua ran out of memory while running the channel program. * There's not much we can do. */ - evalargs->ea_result = SET_ERROR(ENOSPC); + ri->zri_result = SET_ERROR(ENOSPC); break; default: VERIFY0(err); @@ -964,21 +958,35 @@ zcp_eval_impl(dmu_tx_t *tx, boolean_t sync, zcp_eval_a } static void -zcp_pool_error(zcp_eval_arg_t *evalargs, const char *poolname) +zcp_pool_error(zcp_run_info_t *ri, const char *poolname) { - evalargs->ea_result = SET_ERROR(ECHRNG); - lua_settop(evalargs->ea_state, 0); - (void) lua_pushfstring(evalargs->ea_state, "Could not open pool: %s", + ri->zri_result = SET_ERROR(ECHRNG); + lua_settop(ri->zri_state, 0); + (void) lua_pushfstring(ri->zri_state, "Could not open pool: %s", poolname); - zcp_convert_return_values(evalargs->ea_state, evalargs->ea_outnvl, - ZCP_RET_ERROR, evalargs); + zcp_convert_return_values(ri->zri_state, ri->zri_outnvl, + ZCP_RET_ERROR, &ri->zri_result); } +/* + * This callback is called when txg_wait_synced_sig encountered a signal. + * The txg_wait_synced_sig will continue to wait for the txg to complete + * after calling this callback. + */ +/* ARGSUSED */ static void +zcp_eval_sig(void *arg, dmu_tx_t *tx) +{ + zcp_run_info_t *ri = arg; + + ri->zri_canceled = B_TRUE; +} + +static void zcp_eval_sync(void *arg, dmu_tx_t *tx) { - zcp_eval_arg_t *evalargs = arg; + zcp_run_info_t *ri = arg; /* * Open context should have setup the stack to contain: @@ -986,15 +994,14 @@ zcp_eval_sync(void *arg, dmu_tx_t *tx) * 2: Script to run (converted to a Lua function) * 3: nvlist input to function (converted to Lua table or nil) */ - VERIFY3U(3, ==, lua_gettop(evalargs->ea_state)); + VERIFY3U(3, ==, lua_gettop(ri->zri_state)); - zcp_eval_impl(tx, B_TRUE, evalargs); + zcp_eval_impl(tx, ri); } static void -zcp_eval_open(zcp_eval_arg_t *evalargs, const char *poolname) +zcp_eval_open(zcp_run_info_t *ri, const char *poolname) { - int error; dsl_pool_t *dp; dmu_tx_t *tx; @@ -1002,11 +1009,11 @@ zcp_eval_open(zcp_eval_arg_t *evalargs, const char *po /* * See comment from the same assertion in zcp_eval_sync(). */ - VERIFY3U(3, ==, lua_gettop(evalargs->ea_state)); + VERIFY3U(3, ==, lua_gettop(ri->zri_state)); error = dsl_pool_hold(poolname, FTAG, &dp); if (error != 0) { - zcp_pool_error(evalargs, poolname); + zcp_pool_error(ri, poolname); return; } @@ -1021,7 +1028,7 @@ zcp_eval_open(zcp_eval_arg_t *evalargs, const char *po */ tx = dmu_tx_create_dd(dp->dp_mos_dir); - zcp_eval_impl(tx, B_FALSE, evalargs); + zcp_eval_impl(tx, ri); dmu_tx_abort(tx); @@ -1034,7 +1041,7 @@ zcp_eval(const char *poolname, const char *program, bo { int err; lua_State *state; - zcp_eval_arg_t evalargs; + zcp_run_info_t runinfo; if (instrlimit > zfs_lua_max_instrlimit) return (SET_ERROR(EINVAL)); @@ -1134,24 +1141,29 @@ zcp_eval(const char *poolname, const char *program, bo } VERIFY3U(3, ==, lua_gettop(state)); - evalargs.ea_state = state; - evalargs.ea_allocargs = &allocargs; - evalargs.ea_instrlimit = instrlimit; - evalargs.ea_cred = CRED(); - evalargs.ea_outnvl = outnvl; - evalargs.ea_result = 0; + runinfo.zri_state = state; + runinfo.zri_allocargs = &allocargs; + runinfo.zri_outnvl = outnvl; + runinfo.zri_result = 0; + runinfo.zri_cred = CRED(); + runinfo.zri_timed_out = B_FALSE; + runinfo.zri_canceled = B_FALSE; + runinfo.zri_sync = sync; + runinfo.zri_space_used = 0; + runinfo.zri_curinstrs = 0; + runinfo.zri_maxinstrs = instrlimit; if (sync) { - err = dsl_sync_task(poolname, NULL, - zcp_eval_sync, &evalargs, 0, ZFS_SPACE_CHECK_ZCP_EVAL); + err = dsl_sync_task_sig(poolname, NULL, zcp_eval_sync, + zcp_eval_sig, &runinfo, 0, ZFS_SPACE_CHECK_ZCP_EVAL); if (err != 0) - zcp_pool_error(&evalargs, poolname); + zcp_pool_error(&runinfo, poolname); } else { - zcp_eval_open(&evalargs, poolname); + zcp_eval_open(&runinfo, poolname); } lua_close(state); - return (evalargs.ea_result); + return (runinfo.zri_result); } /* Modified: stable/12/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c ============================================================================== --- stable/12/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c Tue Nov 19 04:30:23 2019 (r354847) +++ stable/12/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c Tue Nov 19 07:19:33 2019 (r354848) @@ -6865,7 +6865,7 @@ zfsdev_ioctl(struct cdev *dev, u_long zcmd, caddr_t ar error = vec->zvec_func(zc->zc_name, innvl, outnvl); /* - * Some commands can partially execute, modfiy state, and still + * Some commands can partially execute, modify state, and still * return an error. In these cases, attempt to record what * was modified. */ From owner-svn-src-all@freebsd.org Tue Nov 19 07:21:00 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 699B117FC3F; Tue, 19 Nov 2019 07:21:00 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47HHL42FPfz46pw; Tue, 19 Nov 2019 07:21:00 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 318D36D45; Tue, 19 Nov 2019 07:21:00 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xAJ7L0s6099485; Tue, 19 Nov 2019 07:21:00 GMT (envelope-from avg@FreeBSD.org) Received: (from avg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xAJ7L001099484; Tue, 19 Nov 2019 07:21:00 GMT (envelope-from avg@FreeBSD.org) Message-Id: <201911190721.xAJ7L001099484@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avg set sender to avg@FreeBSD.org using -f From: Andriy Gapon Date: Tue, 19 Nov 2019 07:21:00 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354849 - head/sys/dev/hyperv/storvsc X-SVN-Group: head X-SVN-Commit-Author: avg X-SVN-Commit-Paths: head/sys/dev/hyperv/storvsc X-SVN-Commit-Revision: 354849 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 19 Nov 2019 07:21:00 -0000 Author: avg Date: Tue Nov 19 07:20:59 2019 New Revision: 354849 URL: https://svnweb.freebsd.org/changeset/base/354849 Log: hyperv/storvsc: stash a pointer to hv_storvsc_request in ccb A SIM-private field is used for that. The pointer can be useful when examining a state of a queued ccb. E.g., a ccb on a da_softc.pending_ccbs. MFC after: 2 weeks Modified: head/sys/dev/hyperv/storvsc/hv_storvsc_drv_freebsd.c Modified: head/sys/dev/hyperv/storvsc/hv_storvsc_drv_freebsd.c ============================================================================== --- head/sys/dev/hyperv/storvsc/hv_storvsc_drv_freebsd.c Tue Nov 19 07:19:33 2019 (r354848) +++ head/sys/dev/hyperv/storvsc/hv_storvsc_drv_freebsd.c Tue Nov 19 07:20:59 2019 (r354849) @@ -1915,6 +1915,7 @@ create_storvsc_request(union ccb *ccb, struct hv_storv reqp->sense_info_len = csio->sense_len; reqp->ccb = ccb; + ccb->ccb_h.spriv_ptr0 = reqp; if (0 == csio->dxfer_len) { return (0); From owner-svn-src-all@freebsd.org Tue Nov 19 08:06:32 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 341B61A9560; Tue, 19 Nov 2019 08:06:32 +0000 (UTC) (envelope-from dougm@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47HJLc0D3Tz495H; Tue, 19 Nov 2019 08:06:32 +0000 (UTC) (envelope-from dougm@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id D89B27605; Tue, 19 Nov 2019 08:06:31 +0000 (UTC) (envelope-from dougm@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xAJ86Vtb028136; Tue, 19 Nov 2019 08:06:31 GMT (envelope-from dougm@FreeBSD.org) Received: (from dougm@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xAJ86VGJ028135; Tue, 19 Nov 2019 08:06:31 GMT (envelope-from dougm@FreeBSD.org) Message-Id: <201911190806.xAJ86VGJ028135@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dougm set sender to dougm@FreeBSD.org using -f From: Doug Moore Date: Tue, 19 Nov 2019 08:06:31 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354850 - head/sys/vm X-SVN-Group: head X-SVN-Commit-Author: dougm X-SVN-Commit-Paths: head/sys/vm X-SVN-Commit-Revision: 354850 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 19 Nov 2019 08:06:32 -0000 Author: dougm Date: Tue Nov 19 08:06:31 2019 New Revision: 354850 URL: https://svnweb.freebsd.org/changeset/base/354850 Log: Drop the extra argument from swp_pager_meta_ctl and have it do lookup only. Rename it swp_pager_meta_lookup. Stop checking for obj->type == swap there and assert it instead. Make the caller responsible for the obj->type check. Move the meta_ctl 'pop' functionality to swap_pager_unswapped, the only place that uses it, and assume obj->type == swap there too. Assisted by: ota_j.email.ne.jp Reviewed by: kib Tested by: pho Differential Revision: https://reviews.freebsd.org/D22437 Modified: head/sys/vm/swap_pager.c Modified: head/sys/vm/swap_pager.c ============================================================================== --- head/sys/vm/swap_pager.c Tue Nov 19 07:20:59 2019 (r354849) +++ head/sys/vm/swap_pager.c Tue Nov 19 08:06:31 2019 (r354850) @@ -321,8 +321,6 @@ swap_release_by_cred(vm_ooffset_t decr, struct ucred * #endif } -#define SWM_POP 0x01 /* pop out */ - static int swap_pager_full = 2; /* swap space exhaustion (task killing) */ static int swap_pager_almost_full = 1; /* swap space exhaustion (w/hysteresis)*/ static struct mtx swbuf_mtx; /* to sync nsw_wcount_async */ @@ -426,7 +424,7 @@ static void swp_pager_meta_free(vm_object_t, vm_pindex static void swp_pager_meta_transfer(vm_object_t src, vm_object_t dst, vm_pindex_t pindex, vm_pindex_t count); static void swp_pager_meta_free_all(vm_object_t); -static daddr_t swp_pager_meta_ctl(vm_object_t, vm_pindex_t, int); +static daddr_t swp_pager_meta_lookup(vm_object_t, vm_pindex_t); static void swp_pager_init_freerange(daddr_t *start, daddr_t *num) @@ -942,7 +940,10 @@ swp_pager_xfer_source(vm_object_t srcobject, vm_object { daddr_t dstaddr; - if (swp_pager_meta_ctl(dstobject, pindex, 0) != SWAPBLK_NONE) { + KASSERT(srcobject->type == OBJT_SWAP, + ("%s: Srcobject not swappable", __func__)); + if (dstobject->type == OBJT_SWAP && + swp_pager_meta_lookup(dstobject, pindex) != SWAPBLK_NONE) { /* Caller should destroy the source block. */ return (false); } @@ -1050,11 +1051,13 @@ swap_pager_haspage(vm_object_t object, vm_pindex_t pin int i; VM_OBJECT_ASSERT_LOCKED(object); + KASSERT(object->type == OBJT_SWAP, + ("%s: object not swappable", __func__)); /* * do we have good backing store at the requested index ? */ - blk0 = swp_pager_meta_ctl(object, pindex, 0); + blk0 = swp_pager_meta_lookup(object, pindex); if (blk0 == SWAPBLK_NONE) { if (before) *before = 0; @@ -1070,7 +1073,7 @@ swap_pager_haspage(vm_object_t object, vm_pindex_t pin for (i = 1; i < SWB_NPAGES; i++) { if (i > pindex) break; - blk = swp_pager_meta_ctl(object, pindex - i, 0); + blk = swp_pager_meta_lookup(object, pindex - i); if (blk != blk0 - i) break; } @@ -1082,7 +1085,7 @@ swap_pager_haspage(vm_object_t object, vm_pindex_t pin */ if (after != NULL) { for (i = 1; i < SWB_NPAGES; i++) { - blk = swp_pager_meta_ctl(object, pindex + i, 0); + blk = swp_pager_meta_lookup(object, pindex + i); if (blk != blk0 + i) break; } @@ -1113,11 +1116,26 @@ swap_pager_haspage(vm_object_t object, vm_pindex_t pin static void swap_pager_unswapped(vm_page_t m) { - daddr_t srcaddr; + struct swblk *sb; - srcaddr = swp_pager_meta_ctl(m->object, m->pindex, SWM_POP); - if (srcaddr != SWAPBLK_NONE) - swp_pager_freeswapspace(srcaddr, 1); + VM_OBJECT_ASSERT_WLOCKED(m->object); + + /* + * The meta data only exists if the object is OBJT_SWAP + * and even then might not be allocated yet. + */ + KASSERT(m->object->type == OBJT_SWAP, + ("Free object not swappable")); + + sb = SWAP_PCTRIE_LOOKUP(&m->object->un_pager.swp.swp_blks, + rounddown(m->pindex, SWAP_META_PAGES)); + if (sb == NULL) + return; + if (sb->d[m->pindex % SWAP_META_PAGES] == SWAPBLK_NONE) + return; + swp_pager_freeswapspace(sb->d[m->pindex % SWAP_META_PAGES], 1); + sb->d[m->pindex % SWAP_META_PAGES] = SWAPBLK_NONE; + swp_pager_free_empty_swblk(m->object, sb); } /* @@ -1152,6 +1170,8 @@ swap_pager_getpages(vm_object_t object, vm_page_t *ma, * and then this function incorrectly recreates those pages as * read-behind pages in the current object. */ + KASSERT(object->type == OBJT_SWAP, + ("%s: object not swappable", __func__)); if (!swap_pager_haspage(object, ma[0]->pindex, &maxbehind, &maxahead)) return (VM_PAGER_FAIL); @@ -1211,7 +1231,7 @@ swap_pager_getpages(vm_object_t object, vm_page_t *ma, vm_object_pip_add(object, count); pindex = bm->pindex; - blk = swp_pager_meta_ctl(object, pindex, 0); + blk = swp_pager_meta_lookup(object, pindex); KASSERT(blk != SWAPBLK_NONE, ("no swap blocking containing %p(%jx)", object, (uintmax_t)pindex)); @@ -1688,6 +1708,8 @@ swp_pager_force_pagein(vm_object_t object, vm_pindex_t KASSERT(npages > 0, ("%s: No pages", __func__)); KASSERT(npages <= MAXPHYS / PAGE_SIZE, ("%s: Too many pages: %d", __func__, npages)); + KASSERT(object->type == OBJT_SWAP, + ("%s: Object not swappable", __func__)); vm_object_pip_add(object, npages); vm_page_grab_pages(object, pindex, VM_ALLOC_NORMAL, ma, npages); for (i = j = 0;; i++) { @@ -1725,6 +1747,8 @@ swap_pager_swapoff_object(struct swdevt *sp, vm_object daddr_t blk, n_blks, s_blk; int i; + KASSERT(object->type == OBJT_SWAP, + ("%s: Object not swappable", __func__)); n_blks = 0; for (pi = 0; (sb = SWAP_PCTRIE_LOOKUP_GE( &object->un_pager.swp.swp_blks, pi)) != NULL; ) { @@ -2123,39 +2147,26 @@ swp_pager_meta_free_all(vm_object_t object) * When acting on a busy resident page and paging is in progress, we * have to wait until paging is complete but otherwise can act on the * busy page. - * - * SWM_POP remove from meta data but do not free it */ static daddr_t -swp_pager_meta_ctl(vm_object_t object, vm_pindex_t pindex, int flags) +swp_pager_meta_lookup(vm_object_t object, vm_pindex_t pindex) { struct swblk *sb; - daddr_t r1; - if ((flags & SWM_POP) != 0) - VM_OBJECT_ASSERT_WLOCKED(object); - else - VM_OBJECT_ASSERT_LOCKED(object); + VM_OBJECT_ASSERT_LOCKED(object); /* * The meta data only exists if the object is OBJT_SWAP * and even then might not be allocated yet. */ - if (object->type != OBJT_SWAP) - return (SWAPBLK_NONE); + KASSERT(object->type == OBJT_SWAP, + ("Lookup object not swappable")); sb = SWAP_PCTRIE_LOOKUP(&object->un_pager.swp.swp_blks, rounddown(pindex, SWAP_META_PAGES)); if (sb == NULL) return (SWAPBLK_NONE); - r1 = sb->d[pindex % SWAP_META_PAGES]; - if (r1 == SWAPBLK_NONE) - return (SWAPBLK_NONE); - if ((flags & SWM_POP) != 0) { - sb->d[pindex % SWAP_META_PAGES] = SWAPBLK_NONE; - swp_pager_free_empty_swblk(object, sb); - } - return (r1); + return (sb->d[pindex % SWAP_META_PAGES]); } /* From owner-svn-src-all@freebsd.org Tue Nov 19 10:57:45 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 603411ADEB2; Tue, 19 Nov 2019 10:57:45 +0000 (UTC) (envelope-from andrew@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47HN891t33z4KYX; Tue, 19 Nov 2019 10:57:45 +0000 (UTC) (envelope-from andrew@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 1FEB59482; Tue, 19 Nov 2019 10:57:45 +0000 (UTC) (envelope-from andrew@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xAJAviUn031294; Tue, 19 Nov 2019 10:57:44 GMT (envelope-from andrew@FreeBSD.org) Received: (from andrew@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xAJAvixk031293; Tue, 19 Nov 2019 10:57:44 GMT (envelope-from andrew@FreeBSD.org) Message-Id: <201911191057.xAJAvixk031293@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: andrew set sender to andrew@FreeBSD.org using -f From: Andrew Turner Date: Tue, 19 Nov 2019 10:57:44 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354851 - head/sys/arm64/include X-SVN-Group: head X-SVN-Commit-Author: andrew X-SVN-Commit-Paths: head/sys/arm64/include X-SVN-Commit-Revision: 354851 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 19 Nov 2019 10:57:45 -0000 Author: andrew Date: Tue Nov 19 10:57:44 2019 New Revision: 354851 URL: https://svnweb.freebsd.org/changeset/base/354851 Log: Fix the definition of bus_space_read_stream_8 on arm64. This is currently unused, however will be when the Kernel Concurrency Sanitizer (KCSAN) is imported from NetBSD. Sponsored by: DARPA, AFRL Modified: head/sys/arm64/include/bus.h Modified: head/sys/arm64/include/bus.h ============================================================================== --- head/sys/arm64/include/bus.h Tue Nov 19 08:06:31 2019 (r354850) +++ head/sys/arm64/include/bus.h Tue Nov 19 10:57:44 2019 (r354851) @@ -322,7 +322,7 @@ struct bus_space { #define bus_space_read_stream_1(t, h, o) __bs_rs_s(1,(t), (h), (o)) #define bus_space_read_stream_2(t, h, o) __bs_rs_s(2,(t), (h), (o)) #define bus_space_read_stream_4(t, h, o) __bs_rs_s(4,(t), (h), (o)) -#define bus_space_read_stream_8(t, h, o) __bs_rs_s(8,8,(t),(h),(o)) +#define bus_space_read_stream_8(t, h, o) __bs_rs_s(8,(t), (h), (o)) /* * Bus read multiple operations. From owner-svn-src-all@freebsd.org Tue Nov 19 13:25:46 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id C8ACF1B2BA2; Tue, 19 Nov 2019 13:25:46 +0000 (UTC) (envelope-from andrew@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47HRQy4c70z4Tbb; Tue, 19 Nov 2019 13:25:46 +0000 (UTC) (envelope-from andrew@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 816E6AF1B; Tue, 19 Nov 2019 13:25:46 +0000 (UTC) (envelope-from andrew@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xAJDPkUI020067; Tue, 19 Nov 2019 13:25:46 GMT (envelope-from andrew@FreeBSD.org) Received: (from andrew@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xAJDPku7020066; Tue, 19 Nov 2019 13:25:46 GMT (envelope-from andrew@FreeBSD.org) Message-Id: <201911191325.xAJDPku7020066@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: andrew set sender to andrew@FreeBSD.org using -f From: Andrew Turner Date: Tue, 19 Nov 2019 13:25:46 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354852 - head/sys/arm64/arm64 X-SVN-Group: head X-SVN-Commit-Author: andrew X-SVN-Commit-Paths: head/sys/arm64/arm64 X-SVN-Commit-Revision: 354852 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 19 Nov 2019 13:25:46 -0000 Author: andrew Date: Tue Nov 19 13:25:46 2019 New Revision: 354852 URL: https://svnweb.freebsd.org/changeset/base/354852 Log: Allow ptrace to set the probram counter on arm64. Sponsored by: DARPA, AFRL Modified: head/sys/arm64/arm64/machdep.c Modified: head/sys/arm64/arm64/machdep.c ============================================================================== --- head/sys/arm64/arm64/machdep.c Tue Nov 19 10:57:44 2019 (r354851) +++ head/sys/arm64/arm64/machdep.c Tue Nov 19 13:25:46 2019 (r354852) @@ -412,7 +412,7 @@ int ptrace_set_pc(struct thread *td, u_long addr) { - printf("ARM64TODO: ptrace_set_pc"); + td->td_frame->tf_elr = addr; return (EDOOFUS); } From owner-svn-src-all@freebsd.org Tue Nov 19 13:29:00 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 422971B2D2F; Tue, 19 Nov 2019 13:29:00 +0000 (UTC) (envelope-from andrew@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47HRVh0ggzz4Tr8; Tue, 19 Nov 2019 13:29:00 +0000 (UTC) (envelope-from andrew@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id EE61FAF2E; Tue, 19 Nov 2019 13:28:59 +0000 (UTC) (envelope-from andrew@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xAJDSx4p020290; Tue, 19 Nov 2019 13:28:59 GMT (envelope-from andrew@FreeBSD.org) Received: (from andrew@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xAJDSxp4020289; Tue, 19 Nov 2019 13:28:59 GMT (envelope-from andrew@FreeBSD.org) Message-Id: <201911191328.xAJDSxp4020289@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: andrew set sender to andrew@FreeBSD.org using -f From: Andrew Turner Date: Tue, 19 Nov 2019 13:28:59 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354853 - head/sys/arm64/arm64 X-SVN-Group: head X-SVN-Commit-Author: andrew X-SVN-Commit-Paths: head/sys/arm64/arm64 X-SVN-Commit-Revision: 354853 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 19 Nov 2019 13:29:00 -0000 Author: andrew Date: Tue Nov 19 13:28:59 2019 New Revision: 354853 URL: https://svnweb.freebsd.org/changeset/base/354853 Log: Return 0 from ptrace_set_pc as it now completes successfully. Sponsored by: DARPA, AFRL Modified: head/sys/arm64/arm64/machdep.c Modified: head/sys/arm64/arm64/machdep.c ============================================================================== --- head/sys/arm64/arm64/machdep.c Tue Nov 19 13:25:46 2019 (r354852) +++ head/sys/arm64/arm64/machdep.c Tue Nov 19 13:28:59 2019 (r354853) @@ -413,7 +413,7 @@ ptrace_set_pc(struct thread *td, u_long addr) { td->td_frame->tf_elr = addr; - return (EDOOFUS); + return (0); } int From owner-svn-src-all@freebsd.org Tue Nov 19 14:46:29 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 7A9E11B4D71; Tue, 19 Nov 2019 14:46:29 +0000 (UTC) (envelope-from dab@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47HTD52f14z4ZHC; Tue, 19 Nov 2019 14:46:29 +0000 (UTC) (envelope-from dab@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 3DF92C060; Tue, 19 Nov 2019 14:46:29 +0000 (UTC) (envelope-from dab@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xAJEkTLl067852; Tue, 19 Nov 2019 14:46:29 GMT (envelope-from dab@FreeBSD.org) Received: (from dab@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xAJEkSri067850; Tue, 19 Nov 2019 14:46:28 GMT (envelope-from dab@FreeBSD.org) Message-Id: <201911191446.xAJEkSri067850@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dab set sender to dab@FreeBSD.org using -f From: David Bright Date: Tue, 19 Nov 2019 14:46:28 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354854 - head/sys/sys X-SVN-Group: head X-SVN-Commit-Author: dab X-SVN-Commit-Paths: head/sys/sys X-SVN-Commit-Revision: 354854 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 19 Nov 2019 14:46:29 -0000 Author: dab Date: Tue Nov 19 14:46:28 2019 New Revision: 354854 URL: https://svnweb.freebsd.org/changeset/base/354854 Log: Don't sanitize linker_set The assumptions of linker_set don't play nicely with AddressSanitizer. AddressSanitizer adds a 'redzone' of zeros around globals (including those in named sections), whereas linker_set assumes they are all packed consecutively like a pointer array. So: let's annotate linker_set so that AddressSanitizer ignores it. Submitted by: Matthew Bryan Reviewed by: kib, rang_acm.org Sponsored by: Dell EMC Isilon Differential Revision: https://reviews.freebsd.org/D22239 Modified: head/sys/sys/cdefs.h head/sys/sys/linker_set.h Modified: head/sys/sys/cdefs.h ============================================================================== --- head/sys/sys/cdefs.h Tue Nov 19 13:28:59 2019 (r354853) +++ head/sys/sys/cdefs.h Tue Nov 19 14:46:28 2019 (r354854) @@ -872,6 +872,13 @@ /* Function should not be analyzed. */ #define __no_lock_analysis __lock_annotate(no_thread_safety_analysis) +/* Function or variable should not be sanitized, ie. by AddressSanitizer */ +#if __has_attribute(no_sanitize) +#define __nosanitizeaddress __attribute__((no_sanitize("address"))) +#else +#define __nosanitizeaddress +#endif + /* Guard variables and structure members by lock. */ #define __guarded_by(x) __lock_annotate(guarded_by(x)) #define __pt_guarded_by(x) __lock_annotate(pt_guarded_by(x)) Modified: head/sys/sys/linker_set.h ============================================================================== --- head/sys/sys/linker_set.h Tue Nov 19 13:28:59 2019 (r354853) +++ head/sys/sys/linker_set.h Tue Nov 19 14:46:28 2019 (r354854) @@ -61,6 +61,7 @@ __GLOBL(__CONCAT(__stop_set_,set)); \ static void const * qv \ __set_##set##_sym_##sym __section("set_" #set) \ + __nosanitizeaddress \ __used = &(sym) #define __MAKE_SET(set, sym) __MAKE_SET_QV(set, sym, __MAKE_SET_CONST) #else /* !__GNUCLIKE___SECTION */ From owner-svn-src-all@freebsd.org Tue Nov 19 14:53:14 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 410951B5071; Tue, 19 Nov 2019 14:53:14 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47HTMt0ks0z4Zlb; Tue, 19 Nov 2019 14:53:14 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id D6D5AC21D; Tue, 19 Nov 2019 14:53:13 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xAJErDYs073365; Tue, 19 Nov 2019 14:53:13 GMT (envelope-from bz@FreeBSD.org) Received: (from bz@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xAJErDEa073364; Tue, 19 Nov 2019 14:53:13 GMT (envelope-from bz@FreeBSD.org) Message-Id: <201911191453.xAJErDEa073364@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bz set sender to bz@FreeBSD.org using -f From: "Bjoern A. Zeeb" Date: Tue, 19 Nov 2019 14:53:13 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354855 - head/sys/netinet6 X-SVN-Group: head X-SVN-Commit-Author: bz X-SVN-Commit-Paths: head/sys/netinet6 X-SVN-Commit-Revision: 354855 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 19 Nov 2019 14:53:14 -0000 Author: bz Date: Tue Nov 19 14:53:13 2019 New Revision: 354855 URL: https://svnweb.freebsd.org/changeset/base/354855 Log: mld: fix epoch assertion in6ifa_ifpforlinklocal() asserts the net epoch. The test case from r354832 revealed code paths where we call into the function without having acquired the net epoch first and consequently we hit the assert. This happens in certain MLD states during VNET shutdown and most people normaly not notice this. For correctness acquire the net epoch around calls to mld_v1_transmit_report() in all cases to avoid the assertion firing. MFC after: 2 weeks Sponsored by: Netflix Modified: head/sys/netinet6/mld6.c Modified: head/sys/netinet6/mld6.c ============================================================================== --- head/sys/netinet6/mld6.c Tue Nov 19 14:46:28 2019 (r354854) +++ head/sys/netinet6/mld6.c Tue Nov 19 14:53:13 2019 (r354855) @@ -1800,6 +1800,7 @@ mld_v1_transmit_report(struct in6_multi *in6m, const i struct mbuf *mh, *md; struct mld_hdr *mld; + NET_EPOCH_ASSERT(); IN6_MULTI_LIST_LOCK_ASSERT(); MLD_LOCK_ASSERT(); @@ -1968,6 +1969,7 @@ static int mld_initial_join(struct in6_multi *inm, struct mld_ifsoftc *mli, const int delay) { + struct epoch_tracker et; struct ifnet *ifp; struct mbufq *mq; int error, retval, syncstates; @@ -2035,8 +2037,10 @@ mld_initial_join(struct in6_multi *inm, struct mld_ifs V_current_state_timers_running6 = 1; } else { inm->in6m_state = MLD_IDLE_MEMBER; + NET_EPOCH_ENTER(et); error = mld_v1_transmit_report(inm, MLD_LISTENER_REPORT); + NET_EPOCH_EXIT(et); if (error == 0) { inm->in6m_timer = odelay; V_current_state_timers_running6 = 1; @@ -2181,6 +2185,7 @@ mld_handle_state_change(struct in6_multi *inm, struct static void mld_final_leave(struct in6_multi *inm, struct mld_ifsoftc *mli) { + struct epoch_tracker et; int syncstates; #ifdef KTR char ip6tbuf[INET6_ADDRSTRLEN]; @@ -2214,7 +2219,9 @@ mld_final_leave(struct in6_multi *inm, struct mld_ifso panic("%s: MLDv2 state reached, not MLDv2 mode", __func__); #endif + NET_EPOCH_ENTER(et); mld_v1_transmit_report(inm, MLD_LISTENER_DONE); + NET_EPOCH_EXIT(et); inm->in6m_state = MLD_NOT_MEMBER; V_current_state_timers_running6 = 1; } else if (mli->mli_version == MLD_VERSION_2) { @@ -3194,6 +3201,7 @@ mld_v2_encap_report(struct ifnet *ifp, struct mbuf *m) /* * RFC3590: OK to send as :: or tentative during DAD. */ + NET_EPOCH_ASSERT(); ia = in6ifa_ifpforlinklocal(ifp, IN6_IFF_NOTREADY|IN6_IFF_ANYCAST); if (ia == NULL) CTR1(KTR_MLD, "%s: warning: ia is NULL", __func__); From owner-svn-src-all@freebsd.org Tue Nov 19 15:32:16 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 1754F1B5E27; Tue, 19 Nov 2019 15:32:16 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47HVDv6cMDz4cMt; Tue, 19 Nov 2019 15:32:15 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id C6214C80B; Tue, 19 Nov 2019 15:32:15 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xAJFWFlI096736; Tue, 19 Nov 2019 15:32:15 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xAJFWFru096735; Tue, 19 Nov 2019 15:32:15 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201911191532.xAJFWFru096735@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Tue, 19 Nov 2019 15:32:15 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r354856 - stable/12/sys/amd64/amd64 X-SVN-Group: stable-12 X-SVN-Commit-Author: kib X-SVN-Commit-Paths: stable/12/sys/amd64/amd64 X-SVN-Commit-Revision: 354856 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 19 Nov 2019 15:32:16 -0000 Author: kib Date: Tue Nov 19 15:32:15 2019 New Revision: 354856 URL: https://svnweb.freebsd.org/changeset/base/354856 Log: MFC r354644: amd64: assert that size of the software prototype table for gdt is equal to the size of hardware gdt. Modified: stable/12/sys/amd64/amd64/machdep.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/amd64/amd64/machdep.c ============================================================================== --- stable/12/sys/amd64/amd64/machdep.c Tue Nov 19 14:53:13 2019 (r354855) +++ stable/12/sys/amd64/amd64/machdep.c Tue Nov 19 15:32:15 2019 (r354856) @@ -812,6 +812,7 @@ struct soft_segment_descriptor gdt_segs[] = { .ssd_def32 = 0, .ssd_gran = 0 }, }; +_Static_assert(nitems(gdt_segs) == NGDT, "Stale NGDT"); void setidt(int idx, inthand_t *func, int typ, int dpl, int ist) From owner-svn-src-all@freebsd.org Tue Nov 19 15:38:56 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 011761B5F7C; Tue, 19 Nov 2019 15:38:56 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47HVNb69yHz4cdx; Tue, 19 Nov 2019 15:38:55 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 9D40EC952; Tue, 19 Nov 2019 15:38:55 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xAJFctCL097218; Tue, 19 Nov 2019 15:38:55 GMT (envelope-from bz@FreeBSD.org) Received: (from bz@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xAJFctMe097217; Tue, 19 Nov 2019 15:38:55 GMT (envelope-from bz@FreeBSD.org) Message-Id: <201911191538.xAJFctMe097217@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bz set sender to bz@FreeBSD.org using -f From: "Bjoern A. Zeeb" Date: Tue, 19 Nov 2019 15:38:55 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354857 - head/sys/netinet X-SVN-Group: head X-SVN-Commit-Author: bz X-SVN-Commit-Paths: head/sys/netinet X-SVN-Commit-Revision: 354857 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 19 Nov 2019 15:38:56 -0000 Author: bz Date: Tue Nov 19 15:38:55 2019 New Revision: 354857 URL: https://svnweb.freebsd.org/changeset/base/354857 Log: Reduce the vnet_set module size of ip_mroute to allow loading as a module. With VIMAGE kernels modules get special treatment as they need to also keep the original values and make copies for each instance. For that a few pages of vnet modspace are provided and the kernel-linker and the VNET framework know how to deal with things. When the modspace is (almost) full, other modules which would overflow the modspace cannot be loaded and kldload will fail. ip_mroute uses a lot of variable space, mostly be four big arrays: set_vnet 0000000000000510 vnet_entry_multicast_register_if set_vnet 0000000000000700 vnet_entry_viftable set_vnet 0000000000002000 vnet_entry_bw_meter_timers set_vnet 0000000000002800 vnet_entry_bw_upcalls Dynamically malloc the three big ones for each instance we need and free them again on vnet teardown (the 4th is an ifnet). That way they only need module space for a single pointer and allow a lot more modules using virtualized variables to be loaded on a VNET kernel. PR: 206583 Reviewed by: hselasky, kp MFC after: 3 weeks Differential Revision: https://reviews.freebsd.org/D22443 Modified: head/sys/netinet/ip_mroute.c Modified: head/sys/netinet/ip_mroute.c ============================================================================== --- head/sys/netinet/ip_mroute.c Tue Nov 19 15:32:15 2019 (r354856) +++ head/sys/netinet/ip_mroute.c Tue Nov 19 15:38:55 2019 (r354857) @@ -179,10 +179,14 @@ static struct mtx mfc_mtx; VNET_DEFINE_STATIC(vifi_t, numvifs); #define V_numvifs VNET(numvifs) -VNET_DEFINE_STATIC(struct vif, viftable[MAXVIFS]); +VNET_DEFINE_STATIC(struct vif *, viftable); #define V_viftable VNET(viftable) +/* + * No one should be able to "query" this before initialisation happened in + * vnet_mroute_init(), so we should still be fine. + */ SYSCTL_OPAQUE(_net_inet_ip, OID_AUTO, viftable, CTLFLAG_VNET | CTLFLAG_RD, - &VNET_NAME(viftable), sizeof(V_viftable), "S,vif[MAXVIFS]", + &VNET_NAME(viftable), sizeof(*V_viftable) * MAXVIFS, "S,vif[MAXVIFS]", "IPv4 Multicast Interfaces (struct vif[MAXVIFS], netinet/ip_mroute.h)"); static struct mtx vif_mtx; @@ -210,7 +214,7 @@ static MALLOC_DEFINE(M_BWMETER, "bwmeter", "multicast * expiration time. Periodically, the entries are analysed and processed. */ #define BW_METER_BUCKETS 1024 -VNET_DEFINE_STATIC(struct bw_meter*, bw_meter_timers[BW_METER_BUCKETS]); +VNET_DEFINE_STATIC(struct bw_meter **, bw_meter_timers); #define V_bw_meter_timers VNET(bw_meter_timers) VNET_DEFINE_STATIC(struct callout, bw_meter_ch); #define V_bw_meter_ch VNET(bw_meter_ch) @@ -220,7 +224,7 @@ VNET_DEFINE_STATIC(struct callout, bw_meter_ch); * Pending upcalls are stored in a vector which is flushed when * full, or periodically */ -VNET_DEFINE_STATIC(struct bw_upcall, bw_upcalls[BW_UPCALLS_MAX]); +VNET_DEFINE_STATIC(struct bw_upcall *, bw_upcalls); #define V_bw_upcalls VNET(bw_upcalls) VNET_DEFINE_STATIC(u_int, bw_upcalls_n); /* # of pending upcalls */ #define V_bw_upcalls_n VNET(bw_upcalls_n) @@ -764,7 +768,7 @@ X_ip_mrouter_done(void) bzero(V_nexpire, sizeof(V_nexpire[0]) * mfchashsize); V_bw_upcalls_n = 0; - bzero(V_bw_meter_timers, sizeof(V_bw_meter_timers)); + bzero(V_bw_meter_timers, BW_METER_BUCKETS * sizeof(*V_bw_meter_timers)); MFC_UNLOCK(); @@ -2802,7 +2806,14 @@ vnet_mroute_init(const void *unused __unused) { V_nexpire = malloc(mfchashsize, M_MRTABLE, M_WAITOK|M_ZERO); - bzero(V_bw_meter_timers, sizeof(V_bw_meter_timers)); + + V_viftable = mallocarray(MAXVIFS, sizeof(*V_viftable), + M_MRTABLE, M_WAITOK|M_ZERO); + V_bw_meter_timers = mallocarray(BW_METER_BUCKETS, + sizeof(*V_bw_meter_timers), M_MRTABLE, M_WAITOK|M_ZERO); + V_bw_upcalls = mallocarray(BW_UPCALLS_MAX, sizeof(*V_bw_upcalls), + M_MRTABLE, M_WAITOK|M_ZERO); + callout_init(&V_expire_upcalls_ch, 1); callout_init(&V_bw_upcalls_ch, 1); callout_init(&V_bw_meter_ch, 1); @@ -2815,6 +2826,9 @@ static void vnet_mroute_uninit(const void *unused __unused) { + free(V_bw_upcalls, M_MRTABLE); + free(V_bw_meter_timers, M_MRTABLE); + free(V_viftable, M_MRTABLE); free(V_nexpire, M_MRTABLE); V_nexpire = NULL; } From owner-svn-src-all@freebsd.org Tue Nov 19 16:29:48 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 512221B75C9; Tue, 19 Nov 2019 16:29:48 +0000 (UTC) (envelope-from ae@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47HWWJ19J2z4fxr; Tue, 19 Nov 2019 16:29:48 +0000 (UTC) (envelope-from ae@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 06DD0D25A; Tue, 19 Nov 2019 16:29:48 +0000 (UTC) (envelope-from ae@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xAJGTlMx026774; Tue, 19 Nov 2019 16:29:47 GMT (envelope-from ae@FreeBSD.org) Received: (from ae@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xAJGTlkA026773; Tue, 19 Nov 2019 16:29:47 GMT (envelope-from ae@FreeBSD.org) Message-Id: <201911191629.xAJGTlkA026773@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ae set sender to ae@FreeBSD.org using -f From: "Andrey V. Elsukov" Date: Tue, 19 Nov 2019 16:29:47 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354858 - head/contrib/bsnmp/snmpd X-SVN-Group: head X-SVN-Commit-Author: ae X-SVN-Commit-Paths: head/contrib/bsnmp/snmpd X-SVN-Commit-Revision: 354858 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 19 Nov 2019 16:29:48 -0000 Author: ae Date: Tue Nov 19 16:29:47 2019 New Revision: 354858 URL: https://svnweb.freebsd.org/changeset/base/354858 Log: Fix the byte order of IPv4 address parsed from begemotSnmpdTransInetStatus config option. An address is already in network byte order, there is no need to do htonl(). PR: 242056 MFC after: 1 week Modified: head/contrib/bsnmp/snmpd/trans_inet.c Modified: head/contrib/bsnmp/snmpd/trans_inet.c ============================================================================== --- head/contrib/bsnmp/snmpd/trans_inet.c Tue Nov 19 15:38:55 2019 (r354857) +++ head/contrib/bsnmp/snmpd/trans_inet.c Tue Nov 19 16:29:47 2019 (r354858) @@ -458,12 +458,10 @@ struct inet_port_params { static int ipv4_create(struct inet_port *port, struct inet_port_params *params) { - uint32_t ip; if (params->addr_len != 4) return (SNMP_ERR_INCONS_VALUE); - memcpy(&ip, params->addr, 4); struct port_sock *sock = calloc(1, sizeof(struct port_sock)); if (sock == NULL) return (SNMP_ERR_GENERR); @@ -477,8 +475,8 @@ ipv4_create(struct inet_port *port, struct inet_port_p sin->sin_len = sizeof(struct sockaddr_in); sin->sin_family = AF_INET; - sin->sin_addr.s_addr = htonl(ip); sin->sin_port = htons(params->port); + memcpy(&sin->sin_addr, params->addr, 4); /* network byte order */ sock->port = port; From owner-svn-src-all@freebsd.org Tue Nov 19 16:40:47 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 594671B794A; Tue, 19 Nov 2019 16:40:47 +0000 (UTC) (envelope-from bdrewery@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47HWlz1hLSz3ByY; Tue, 19 Nov 2019 16:40:47 +0000 (UTC) (envelope-from bdrewery@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 1E75DD43C; Tue, 19 Nov 2019 16:40:47 +0000 (UTC) (envelope-from bdrewery@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xAJGekVA035574; Tue, 19 Nov 2019 16:40:46 GMT (envelope-from bdrewery@FreeBSD.org) Received: (from bdrewery@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xAJGekwR035573; Tue, 19 Nov 2019 16:40:46 GMT (envelope-from bdrewery@FreeBSD.org) Message-Id: <201911191640.xAJGekwR035573@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bdrewery set sender to bdrewery@FreeBSD.org using -f From: Bryan Drewery Date: Tue, 19 Nov 2019 16:40:46 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354859 - head X-SVN-Group: head X-SVN-Commit-Author: bdrewery X-SVN-Commit-Paths: head X-SVN-Commit-Revision: 354859 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 19 Nov 2019 16:40:47 -0000 Author: bdrewery Date: Tue Nov 19 16:40:46 2019 New Revision: 354859 URL: https://svnweb.freebsd.org/changeset/base/354859 Log: WITH_SYSTEM_LINKER: Fix rebuilding lld every time. This is due to LLD_REVISION_STRING being renamed to LLD_REVISION in r351442 and the value being moved to another location in r351965. `make test-system-linker` can be used to see the values being used here. Reported by: ler Modified: head/Makefile.inc1 Modified: head/Makefile.inc1 ============================================================================== --- head/Makefile.inc1 Tue Nov 19 16:29:47 2019 (r354858) +++ head/Makefile.inc1 Tue Nov 19 16:40:46 2019 (r354859) @@ -289,9 +289,9 @@ WANT_LINKER_TYPE= .if !defined(WANT_LINKER_FREEBSD_VERSION) && !make(showconfig) && \ !make(test-system-compiler) .if ${WANT_LINKER_TYPE} == "lld" -WANT_LINKER_FREEBSD_VERSION_FILE= lib/clang/include/lld/Common/Version.inc +WANT_LINKER_FREEBSD_VERSION_FILE= lib/clang/include/VCSVersion.inc WANT_LINKER_FREEBSD_VERSION!= \ - awk '$$2 == "LLD_REVISION_STRING" {gsub(/"/, "", $$3); print $$3}' \ + awk '$$2 == "LLD_REVISION" {gsub(/"/, "", $$3); print $$3}' \ ${SRCDIR}/${WANT_LINKER_FREEBSD_VERSION_FILE} || echo unknown WANT_LINKER_VERSION_FILE= lib/clang/include/lld/Common/Version.inc WANT_LINKER_VERSION!= \ From owner-svn-src-all@freebsd.org Tue Nov 19 17:28:43 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 35C1C1B9074; Tue, 19 Nov 2019 17:28:43 +0000 (UTC) (envelope-from hps@selasky.org) Received: from mail.turbocat.net (turbocat.net [IPv6:2a01:4f8:c17:6c4b::2]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 47HXqH0Wy6z3FNS; Tue, 19 Nov 2019 17:28:42 +0000 (UTC) (envelope-from hps@selasky.org) Received: from hps2016.home.selasky.org (unknown [62.141.129.235]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by mail.turbocat.net (Postfix) with ESMTPSA id C86E9260184; Tue, 19 Nov 2019 17:10:50 +0100 (CET) Subject: Re: svn commit: r354856 - stable/12/sys/amd64/amd64 To: Konstantin Belousov , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org References: <201911191532.xAJFWFru096735@repo.freebsd.org> From: Hans Petter Selasky Message-ID: <5b2560fa-78b8-457a-a6ba-a48547bae438@selasky.org> Date: Tue, 19 Nov 2019 17:08:13 +0100 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:68.0) Gecko/20100101 Thunderbird/68.1.2 MIME-Version: 1.0 In-Reply-To: <201911191532.xAJFWFru096735@repo.freebsd.org> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-Rspamd-Queue-Id: 47HXqH0Wy6z3FNS X-Spamd-Bar: ----- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-5.89 / 15.00]; NEURAL_HAM_MEDIUM(-0.99)[-0.993,0]; NEURAL_HAM_LONG(-0.90)[-0.899,0]; REPLY(-4.00)[] X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 19 Nov 2019 17:28:43 -0000 On 2019-11-19 16:32, Konstantin Belousov wrote: > +_Static_assert(nitems(gdt_segs) == NGDT, "Stale NGDT"); Why are you not using the CTASSERT() macro? Is _Static_assert() portable? --HPS From owner-svn-src-all@freebsd.org Tue Nov 19 18:33:58 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id C3B141BA607; Tue, 19 Nov 2019 18:33:58 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from kib.kiev.ua (kib.kiev.ua [IPv6:2001:470:d5e7:1::1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 47HZGY6SPJz3JLT; Tue, 19 Nov 2019 18:33:57 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from tom.home (kib@localhost [127.0.0.1]) by kib.kiev.ua (8.15.2/8.15.2) with ESMTPS id xAJIXoxr088215 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NO); Tue, 19 Nov 2019 20:33:53 +0200 (EET) (envelope-from kostikbel@gmail.com) DKIM-Filter: OpenDKIM Filter v2.10.3 kib.kiev.ua xAJIXoxr088215 Received: (from kostik@localhost) by tom.home (8.15.2/8.15.2/Submit) id xAJIXojc088214; Tue, 19 Nov 2019 20:33:50 +0200 (EET) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: tom.home: kostik set sender to kostikbel@gmail.com using -f Date: Tue, 19 Nov 2019 20:33:50 +0200 From: Konstantin Belousov To: Hans Petter Selasky Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: Re: svn commit: r354856 - stable/12/sys/amd64/amd64 Message-ID: <20191119183349.GA2707@kib.kiev.ua> References: <201911191532.xAJFWFru096735@repo.freebsd.org> <5b2560fa-78b8-457a-a6ba-a48547bae438@selasky.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <5b2560fa-78b8-457a-a6ba-a48547bae438@selasky.org> User-Agent: Mutt/1.12.2 (2019-09-21) X-Spam-Status: No, score=-1.0 required=5.0 tests=ALL_TRUSTED,BAYES_00, DKIM_ADSP_CUSTOM_MED,FORGED_GMAIL_RCVD,FREEMAIL_FROM, NML_ADSP_CUSTOM_MED autolearn=no autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on tom.home X-Rspamd-Queue-Id: 47HZGY6SPJz3JLT X-Spamd-Bar: - Authentication-Results: mx1.freebsd.org; dkim=none; dmarc=fail reason="No valid SPF, No valid DKIM" header.from=gmail.com (policy=none); spf=softfail (mx1.freebsd.org: 2001:470:d5e7:1::1 is neither permitted nor denied by domain of kostikbel@gmail.com) smtp.mailfrom=kostikbel@gmail.com X-Spamd-Result: default: False [-2.00 / 15.00]; ARC_NA(0.00)[]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; RCVD_TLS_ALL(0.00)[]; FROM_HAS_DN(0.00)[]; TO_DN_SOME(0.00)[]; FREEMAIL_FROM(0.00)[gmail.com]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; MIME_GOOD(-0.10)[text/plain]; HAS_XAW(0.00)[]; R_SPF_SOFTFAIL(0.00)[~all]; RCPT_COUNT_FIVE(0.00)[5]; IP_SCORE_FREEMAIL(0.00)[]; TO_MATCH_ENVRCPT_SOME(0.00)[]; IP_SCORE(0.00)[ip: (-2.78), ipnet: 2001:470::/32(-4.63), asn: 6939(-3.50), country: US(-0.05)]; FROM_EQ_ENVFROM(0.00)[]; R_DKIM_NA(0.00)[]; MIME_TRACE(0.00)[0:+]; ASN(0.00)[asn:6939, ipnet:2001:470::/32, country:US]; RCVD_COUNT_TWO(0.00)[2]; FREEMAIL_ENVFROM(0.00)[gmail.com]; DMARC_POLICY_SOFTFAIL(0.10)[gmail.com : No valid SPF, No valid DKIM,none] X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 19 Nov 2019 18:33:58 -0000 On Tue, Nov 19, 2019 at 05:08:13PM +0100, Hans Petter Selasky wrote: > On 2019-11-19 16:32, Konstantin Belousov wrote: > > +_Static_assert(nitems(gdt_segs) == NGDT, "Stale NGDT"); > > Why are you not using the CTASSERT() macro? Is _Static_assert() portable? _Static_assert() is the feature of C11, while CTASSERT() is an old FreeBSD macro, which historically has very serious usability issues (they were fixed by redefining CTASSERT() to just _Static_assert() with useless message). In this sense yes, _Static_assert() is more portable, but I also do not see a reason to introduce new uses of CTASSERT(). From owner-svn-src-all@freebsd.org Tue Nov 19 19:05:06 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 836F01BB53A; Tue, 19 Nov 2019 19:05:06 +0000 (UTC) (envelope-from alc@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47HZyV2r9lz3L24; Tue, 19 Nov 2019 19:05:06 +0000 (UTC) (envelope-from alc@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 41D0DEFA1; Tue, 19 Nov 2019 19:05:06 +0000 (UTC) (envelope-from alc@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xAJJ56mw020108; Tue, 19 Nov 2019 19:05:06 GMT (envelope-from alc@FreeBSD.org) Received: (from alc@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xAJJ561L020107; Tue, 19 Nov 2019 19:05:06 GMT (envelope-from alc@FreeBSD.org) Message-Id: <201911191905.xAJJ561L020107@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: alc set sender to alc@FreeBSD.org using -f From: Alan Cox Date: Tue, 19 Nov 2019 19:05:06 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354860 - head/sys/arm64/arm64 X-SVN-Group: head X-SVN-Commit-Author: alc X-SVN-Commit-Paths: head/sys/arm64/arm64 X-SVN-Commit-Revision: 354860 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 19 Nov 2019 19:05:06 -0000 Author: alc Date: Tue Nov 19 19:05:05 2019 New Revision: 354860 URL: https://svnweb.freebsd.org/changeset/base/354860 Log: Achieve two goals at once: (1) Avoid an unnecessary broadcast TLB invalidation in reclaim_pv_chunk(). (2) Prevent an "invalid ASID" assertion failure in reclaim_pv_chunk(). The detailed explanation for this change is provided by r354792. X-MFC with: r354792 Modified: head/sys/arm64/arm64/pmap.c Modified: head/sys/arm64/arm64/pmap.c ============================================================================== --- head/sys/arm64/arm64/pmap.c Tue Nov 19 16:40:46 2019 (r354859) +++ head/sys/arm64/arm64/pmap.c Tue Nov 19 19:05:05 2019 (r354860) @@ -2062,12 +2062,13 @@ reclaim_pv_chunk(pmap_t locked_pmap, struct rwlock **l if ((tpte & ATTR_SW_WIRED) != 0) continue; tpte = pmap_load_clear(pte); - pmap_invalidate_page(pmap, va); m = PHYS_TO_VM_PAGE(tpte & ~ATTR_MASK); if (pmap_pte_dirty(tpte)) vm_page_dirty(m); - if ((tpte & ATTR_AF) != 0) + if ((tpte & ATTR_AF) != 0) { + pmap_invalidate_page(pmap, va); vm_page_aflag_set(m, PGA_REFERENCED); + } CHANGE_PV_LIST_LOCK_TO_VM_PAGE(lockp, m); TAILQ_REMOVE(&m->md.pv_list, pv, pv_next); m->md.pv_gen++; From owner-svn-src-all@freebsd.org Tue Nov 19 20:34:33 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 7F2671BD332; Tue, 19 Nov 2019 20:34:33 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47Hcxj3X2cz3PYw; Tue, 19 Nov 2019 20:34:33 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 5C3E8FFC3; Tue, 19 Nov 2019 20:34:33 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xAJKYXwc072451; Tue, 19 Nov 2019 20:34:33 GMT (envelope-from bz@FreeBSD.org) Received: (from bz@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xAJKYXFB072450; Tue, 19 Nov 2019 20:34:33 GMT (envelope-from bz@FreeBSD.org) Message-Id: <201911192034.xAJKYXFB072450@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bz set sender to bz@FreeBSD.org using -f From: "Bjoern A. Zeeb" Date: Tue, 19 Nov 2019 20:34:33 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354861 - head/sys/netinet6 X-SVN-Group: head X-SVN-Commit-Author: bz X-SVN-Commit-Paths: head/sys/netinet6 X-SVN-Commit-Revision: 354861 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 19 Nov 2019 20:34:33 -0000 Author: bz Date: Tue Nov 19 20:34:33 2019 New Revision: 354861 URL: https://svnweb.freebsd.org/changeset/base/354861 Log: nd6_rtr: re-sort functions Resort functions within file in a way that they depend on each other as that makes it easier to rework various things. Also allows us to remove file local function declarations. No functional changes. MFC after: 3 weeks Sponsored by: Netflix Modified: head/sys/netinet6/nd6_rtr.c Modified: head/sys/netinet6/nd6_rtr.c ============================================================================== --- head/sys/netinet6/nd6_rtr.c Tue Nov 19 19:05:05 2019 (r354860) +++ head/sys/netinet6/nd6_rtr.c Tue Nov 19 20:34:33 2019 (r354861) @@ -73,25 +73,10 @@ __FBSDID("$FreeBSD$"); #include #include -static int rtpref(struct nd_defrouter *); static struct nd_defrouter *defrtrlist_update(struct nd_defrouter *); static int prelist_update(struct nd_prefixctl *, struct nd_defrouter *, struct mbuf *, int); -static struct in6_ifaddr *in6_ifadd(struct nd_prefixctl *, int); -static struct nd_pfxrouter *pfxrtr_lookup(struct nd_prefix *, - struct nd_defrouter *); -static void pfxrtr_add(struct nd_prefix *, struct nd_defrouter *); -static void pfxrtr_del(struct nd_pfxrouter *); -static struct nd_pfxrouter *find_pfxlist_reachable_router(struct nd_prefix *); -static void defrouter_delreq(struct nd_defrouter *); -static void nd6_rtmsg(int, struct rtentry *); -static int in6_init_prefix_ltimes(struct nd_prefix *); -static void in6_init_address_ltimes(struct nd_prefix *, - struct in6_addrlifetime *); - -static int rt6_deleteroute(const struct rtentry *, void *); - TAILQ_HEAD(nd6_drhead, nd_defrouter); VNET_DEFINE_STATIC(struct nd6_drhead, nd6_defrouter); #define V_nd6_defrouter VNET(nd6_defrouter) @@ -115,6 +100,8 @@ VNET_DEFINE(int, ip6_temp_regen_advance) = TEMPADDR_RE VNET_DEFINE(int, nd6_ignore_ipv6_only_ra) = 1; #endif +SYSCTL_DECL(_net_inet6_icmp6); + /* RTPREF_MEDIUM has to be 0! */ #define RTPREF_HIGH 1 #define RTPREF_MEDIUM 0 @@ -644,11 +631,72 @@ nd6_rtmsg(int cmd, struct rtentry *rt) ifa_free(ifa); } -/* - * default router list processing sub routines - */ +/* PFXRTR */ +static struct nd_pfxrouter * +pfxrtr_lookup(struct nd_prefix *pr, struct nd_defrouter *dr) +{ + struct nd_pfxrouter *search; + ND6_LOCK_ASSERT(); + + LIST_FOREACH(search, &pr->ndpr_advrtrs, pfr_entry) { + if (search->router == dr) + break; + } + return (search); +} + static void +pfxrtr_add(struct nd_prefix *pr, struct nd_defrouter *dr) +{ + struct nd_pfxrouter *new; + bool update; + + ND6_UNLOCK_ASSERT(); + + ND6_RLOCK(); + if (pfxrtr_lookup(pr, dr) != NULL) { + ND6_RUNLOCK(); + return; + } + ND6_RUNLOCK(); + + new = malloc(sizeof(*new), M_IP6NDP, M_NOWAIT | M_ZERO); + if (new == NULL) + return; + defrouter_ref(dr); + new->router = dr; + + ND6_WLOCK(); + if (pfxrtr_lookup(pr, dr) == NULL) { + LIST_INSERT_HEAD(&pr->ndpr_advrtrs, new, pfr_entry); + update = true; + } else { + /* We lost a race to add the reference. */ + defrouter_rele(dr); + free(new, M_IP6NDP); + update = false; + } + ND6_WUNLOCK(); + + if (update) + pfxlist_onlink_check(); +} + +static void +pfxrtr_del(struct nd_pfxrouter *pfr) +{ + + ND6_WLOCK_ASSERT(); + + LIST_REMOVE(pfr, pfr_entry); + defrouter_rele(pfr->router); + free(pfr, M_IP6NDP); +} + + +/* Default router list processing sub routines. */ +static void defrouter_addreq(struct nd_defrouter *new) { struct sockaddr_in6 def, mask, gate; @@ -675,31 +723,6 @@ defrouter_addreq(struct nd_defrouter *new) new->installed = 1; } -struct nd_defrouter * -defrouter_lookup_locked(struct in6_addr *addr, struct ifnet *ifp) -{ - struct nd_defrouter *dr; - - ND6_LOCK_ASSERT(); - TAILQ_FOREACH(dr, &V_nd6_defrouter, dr_entry) - if (dr->ifp == ifp && IN6_ARE_ADDR_EQUAL(addr, &dr->rtaddr)) { - defrouter_ref(dr); - return (dr); - } - return (NULL); -} - -struct nd_defrouter * -defrouter_lookup(struct in6_addr *addr, struct ifnet *ifp) -{ - struct nd_defrouter *dr; - - ND6_RLOCK(); - dr = defrouter_lookup_locked(addr, ifp); - ND6_RUNLOCK(); - return (dr); -} - /* * Remove the default route for a given router. * This is just a subroutine function for defrouter_select_fib(), and @@ -731,49 +754,6 @@ defrouter_delreq(struct nd_defrouter *dr) dr->installed = 0; } -/* - * Remove all default routes from default router list. - */ -void -defrouter_reset(void) -{ - struct nd_defrouter *dr, **dra; - int count, i; - - count = i = 0; - - /* - * We can't delete routes with the ND lock held, so make a copy of the - * current default router list and use that when deleting routes. - */ - ND6_RLOCK(); - TAILQ_FOREACH(dr, &V_nd6_defrouter, dr_entry) - count++; - ND6_RUNLOCK(); - - dra = malloc(count * sizeof(*dra), M_TEMP, M_WAITOK | M_ZERO); - - ND6_RLOCK(); - TAILQ_FOREACH(dr, &V_nd6_defrouter, dr_entry) { - if (i == count) - break; - defrouter_ref(dr); - dra[i++] = dr; - } - ND6_RUNLOCK(); - - for (i = 0; i < count && dra[i] != NULL; i++) { - defrouter_delreq(dra[i]); - defrouter_rele(dra[i]); - } - free(dra, M_TEMP); - - /* - * XXX should we also nuke any default routers in the kernel, by - * going through them by rtalloc1()? - */ -} - static void defrouter_del(struct nd_defrouter *dr) { @@ -826,7 +806,75 @@ defrouter_del(struct nd_defrouter *dr) } +struct nd_defrouter * +defrouter_lookup_locked(struct in6_addr *addr, struct ifnet *ifp) +{ + struct nd_defrouter *dr; + + ND6_LOCK_ASSERT(); + TAILQ_FOREACH(dr, &V_nd6_defrouter, dr_entry) + if (dr->ifp == ifp && IN6_ARE_ADDR_EQUAL(addr, &dr->rtaddr)) { + defrouter_ref(dr); + return (dr); + } + return (NULL); +} + +struct nd_defrouter * +defrouter_lookup(struct in6_addr *addr, struct ifnet *ifp) +{ + struct nd_defrouter *dr; + + ND6_RLOCK(); + dr = defrouter_lookup_locked(addr, ifp); + ND6_RUNLOCK(); + return (dr); +} + /* + * Remove all default routes from default router list. + */ +void +defrouter_reset(void) +{ + struct nd_defrouter *dr, **dra; + int count, i; + + count = i = 0; + + /* + * We can't delete routes with the ND lock held, so make a copy of the + * current default router list and use that when deleting routes. + */ + ND6_RLOCK(); + TAILQ_FOREACH(dr, &V_nd6_defrouter, dr_entry) + count++; + ND6_RUNLOCK(); + + dra = malloc(count * sizeof(*dra), M_TEMP, M_WAITOK | M_ZERO); + + ND6_RLOCK(); + TAILQ_FOREACH(dr, &V_nd6_defrouter, dr_entry) { + if (i == count) + break; + defrouter_ref(dr); + dra[i++] = dr; + } + ND6_RUNLOCK(); + + for (i = 0; i < count && dra[i] != NULL; i++) { + defrouter_delreq(dra[i]); + defrouter_rele(dra[i]); + } + free(dra, M_TEMP); + + /* + * XXX should we also nuke any default routers in the kernel, by + * going through them by rtalloc1()? + */ +} + +/* * Look up a matching default router list entry and remove it. Returns true if a * matching entry was found, false otherwise. */ @@ -850,6 +898,33 @@ defrouter_remove(struct in6_addr *addr, struct ifnet * } /* + * for default router selection + * regards router-preference field as a 2-bit signed integer + */ +static int +rtpref(struct nd_defrouter *dr) +{ + switch (dr->raflags & ND_RA_FLAG_RTPREF_MASK) { + case ND_RA_FLAG_RTPREF_HIGH: + return (RTPREF_HIGH); + case ND_RA_FLAG_RTPREF_MEDIUM: + case ND_RA_FLAG_RTPREF_RSV: + return (RTPREF_MEDIUM); + case ND_RA_FLAG_RTPREF_LOW: + return (RTPREF_LOW); + default: + /* + * This case should never happen. If it did, it would mean a + * serious bug of kernel internal. We thus always bark here. + * Or, can we even panic? + */ + log(LOG_ERR, "rtpref: impossible RA flag %x\n", dr->raflags); + return (RTPREF_INVALID); + } + /* NOTREACHED */ +} + +/* * Default Router Selection according to Section 6.3.6 of RFC 2461 and * draft-ietf-ipngwg-router-selection: * 1) Routers that are reachable or probably reachable should be preferred. @@ -987,33 +1062,6 @@ defrouter_select_fib(int fibnum) defrouter_rele(selected_dr); } -/* - * for default router selection - * regards router-preference field as a 2-bit signed integer - */ -static int -rtpref(struct nd_defrouter *dr) -{ - switch (dr->raflags & ND_RA_FLAG_RTPREF_MASK) { - case ND_RA_FLAG_RTPREF_HIGH: - return (RTPREF_HIGH); - case ND_RA_FLAG_RTPREF_MEDIUM: - case ND_RA_FLAG_RTPREF_RSV: - return (RTPREF_MEDIUM); - case ND_RA_FLAG_RTPREF_LOW: - return (RTPREF_LOW); - default: - /* - * This case should never happen. If it did, it would mean a - * serious bug of kernel internal. We thus always bark here. - * Or, can we even panic? - */ - log(LOG_ERR, "rtpref: impossible RA flag %x\n", dr->raflags); - return (RTPREF_INVALID); - } - /* NOTREACHED */ -} - static struct nd_defrouter * defrtrlist_update(struct nd_defrouter *new) { @@ -1112,66 +1160,154 @@ restart: return (n); } -static struct nd_pfxrouter * -pfxrtr_lookup(struct nd_prefix *pr, struct nd_defrouter *dr) +static int +in6_init_prefix_ltimes(struct nd_prefix *ndpr) { - struct nd_pfxrouter *search; + if (ndpr->ndpr_pltime == ND6_INFINITE_LIFETIME) + ndpr->ndpr_preferred = 0; + else + ndpr->ndpr_preferred = time_uptime + ndpr->ndpr_pltime; + if (ndpr->ndpr_vltime == ND6_INFINITE_LIFETIME) + ndpr->ndpr_expire = 0; + else + ndpr->ndpr_expire = time_uptime + ndpr->ndpr_vltime; - ND6_LOCK_ASSERT(); + return 0; +} - LIST_FOREACH(search, &pr->ndpr_advrtrs, pfr_entry) { - if (search->router == dr) - break; +static void +in6_init_address_ltimes(struct nd_prefix *new, struct in6_addrlifetime *lt6) +{ + /* init ia6t_expire */ + if (lt6->ia6t_vltime == ND6_INFINITE_LIFETIME) + lt6->ia6t_expire = 0; + else { + lt6->ia6t_expire = time_uptime; + lt6->ia6t_expire += lt6->ia6t_vltime; } - return (search); + + /* init ia6t_preferred */ + if (lt6->ia6t_pltime == ND6_INFINITE_LIFETIME) + lt6->ia6t_preferred = 0; + else { + lt6->ia6t_preferred = time_uptime; + lt6->ia6t_preferred += lt6->ia6t_pltime; + } } -static void -pfxrtr_add(struct nd_prefix *pr, struct nd_defrouter *dr) +static struct in6_ifaddr * +in6_ifadd(struct nd_prefixctl *pr, int mcast) { - struct nd_pfxrouter *new; - bool update; + struct ifnet *ifp = pr->ndpr_ifp; + struct ifaddr *ifa; + struct in6_aliasreq ifra; + struct in6_ifaddr *ia, *ib; + int error, plen0; + struct in6_addr mask; + int prefixlen = pr->ndpr_plen; + int updateflags; + char ip6buf[INET6_ADDRSTRLEN]; - ND6_UNLOCK_ASSERT(); + in6_prefixlen2mask(&mask, prefixlen); - ND6_RLOCK(); - if (pfxrtr_lookup(pr, dr) != NULL) { - ND6_RUNLOCK(); - return; + /* + * find a link-local address (will be interface ID). + * Is it really mandatory? Theoretically, a global or a site-local + * address can be configured without a link-local address, if we + * have a unique interface identifier... + * + * it is not mandatory to have a link-local address, we can generate + * interface identifier on the fly. we do this because: + * (1) it should be the easiest way to find interface identifier. + * (2) RFC2462 5.4 suggesting the use of the same interface identifier + * for multiple addresses on a single interface, and possible shortcut + * of DAD. we omitted DAD for this reason in the past. + * (3) a user can prevent autoconfiguration of global address + * by removing link-local address by hand (this is partly because we + * don't have other way to control the use of IPv6 on an interface. + * this has been our design choice - cf. NRL's "ifconfig auto"). + * (4) it is easier to manage when an interface has addresses + * with the same interface identifier, than to have multiple addresses + * with different interface identifiers. + */ + ifa = (struct ifaddr *)in6ifa_ifpforlinklocal(ifp, 0); /* 0 is OK? */ + if (ifa) + ib = (struct in6_ifaddr *)ifa; + else + return NULL; + + /* prefixlen + ifidlen must be equal to 128 */ + plen0 = in6_mask2len(&ib->ia_prefixmask.sin6_addr, NULL); + if (prefixlen != plen0) { + ifa_free(ifa); + nd6log((LOG_INFO, "in6_ifadd: wrong prefixlen for %s " + "(prefix=%d ifid=%d)\n", + if_name(ifp), prefixlen, 128 - plen0)); + return NULL; } - ND6_RUNLOCK(); - new = malloc(sizeof(*new), M_IP6NDP, M_NOWAIT | M_ZERO); - if (new == NULL) - return; - defrouter_ref(dr); - new->router = dr; + /* make ifaddr */ + in6_prepare_ifra(&ifra, &pr->ndpr_prefix.sin6_addr, &mask); - ND6_WLOCK(); - if (pfxrtr_lookup(pr, dr) == NULL) { - LIST_INSERT_HEAD(&pr->ndpr_advrtrs, new, pfr_entry); - update = true; - } else { - /* We lost a race to add the reference. */ - defrouter_rele(dr); - free(new, M_IP6NDP); - update = false; - } - ND6_WUNLOCK(); + IN6_MASK_ADDR(&ifra.ifra_addr.sin6_addr, &mask); + /* interface ID */ + ifra.ifra_addr.sin6_addr.s6_addr32[0] |= + (ib->ia_addr.sin6_addr.s6_addr32[0] & ~mask.s6_addr32[0]); + ifra.ifra_addr.sin6_addr.s6_addr32[1] |= + (ib->ia_addr.sin6_addr.s6_addr32[1] & ~mask.s6_addr32[1]); + ifra.ifra_addr.sin6_addr.s6_addr32[2] |= + (ib->ia_addr.sin6_addr.s6_addr32[2] & ~mask.s6_addr32[2]); + ifra.ifra_addr.sin6_addr.s6_addr32[3] |= + (ib->ia_addr.sin6_addr.s6_addr32[3] & ~mask.s6_addr32[3]); + ifa_free(ifa); - if (update) - pfxlist_onlink_check(); -} + /* lifetimes. */ + ifra.ifra_lifetime.ia6t_vltime = pr->ndpr_vltime; + ifra.ifra_lifetime.ia6t_pltime = pr->ndpr_pltime; -static void -pfxrtr_del(struct nd_pfxrouter *pfr) -{ + /* XXX: scope zone ID? */ - ND6_WLOCK_ASSERT(); + ifra.ifra_flags |= IN6_IFF_AUTOCONF; /* obey autoconf */ - LIST_REMOVE(pfr, pfr_entry); - defrouter_rele(pfr->router); - free(pfr, M_IP6NDP); + /* + * Make sure that we do not have this address already. This should + * usually not happen, but we can still see this case, e.g., if we + * have manually configured the exact address to be configured. + */ + ifa = (struct ifaddr *)in6ifa_ifpwithaddr(ifp, + &ifra.ifra_addr.sin6_addr); + if (ifa != NULL) { + ifa_free(ifa); + /* this should be rare enough to make an explicit log */ + log(LOG_INFO, "in6_ifadd: %s is already configured\n", + ip6_sprintf(ip6buf, &ifra.ifra_addr.sin6_addr)); + return (NULL); + } + + /* + * Allocate ifaddr structure, link into chain, etc. + * If we are going to create a new address upon receiving a multicasted + * RA, we need to impose a random delay before starting DAD. + * [draft-ietf-ipv6-rfc2462bis-02.txt, Section 5.4.2] + */ + updateflags = 0; + if (mcast) + updateflags |= IN6_IFAUPDATE_DADDELAY; + if ((error = in6_update_ifa(ifp, &ifra, NULL, updateflags)) != 0) { + nd6log((LOG_ERR, + "in6_ifadd: failed to make ifaddr %s on %s (errno=%d)\n", + ip6_sprintf(ip6buf, &ifra.ifra_addr.sin6_addr), + if_name(ifp), error)); + return (NULL); /* ifaddr must not have been allocated. */ + } + + ia = in6ifa_ifpwithaddr(ifp, &ifra.ifra_addr.sin6_addr); + /* + * XXXRW: Assumption of non-NULLness here might not be true with + * fine-grained locking -- should we validate it? Or just return + * earlier ifa rather than looking it up again? + */ + return (ia); /* this is always non-NULL and referenced. */ } static struct nd_prefix * @@ -2171,121 +2307,6 @@ restart: return (error); } -static struct in6_ifaddr * -in6_ifadd(struct nd_prefixctl *pr, int mcast) -{ - struct ifnet *ifp = pr->ndpr_ifp; - struct ifaddr *ifa; - struct in6_aliasreq ifra; - struct in6_ifaddr *ia, *ib; - int error, plen0; - struct in6_addr mask; - int prefixlen = pr->ndpr_plen; - int updateflags; - char ip6buf[INET6_ADDRSTRLEN]; - - in6_prefixlen2mask(&mask, prefixlen); - - /* - * find a link-local address (will be interface ID). - * Is it really mandatory? Theoretically, a global or a site-local - * address can be configured without a link-local address, if we - * have a unique interface identifier... - * - * it is not mandatory to have a link-local address, we can generate - * interface identifier on the fly. we do this because: - * (1) it should be the easiest way to find interface identifier. - * (2) RFC2462 5.4 suggesting the use of the same interface identifier - * for multiple addresses on a single interface, and possible shortcut - * of DAD. we omitted DAD for this reason in the past. - * (3) a user can prevent autoconfiguration of global address - * by removing link-local address by hand (this is partly because we - * don't have other way to control the use of IPv6 on an interface. - * this has been our design choice - cf. NRL's "ifconfig auto"). - * (4) it is easier to manage when an interface has addresses - * with the same interface identifier, than to have multiple addresses - * with different interface identifiers. - */ - ifa = (struct ifaddr *)in6ifa_ifpforlinklocal(ifp, 0); /* 0 is OK? */ - if (ifa) - ib = (struct in6_ifaddr *)ifa; - else - return NULL; - - /* prefixlen + ifidlen must be equal to 128 */ - plen0 = in6_mask2len(&ib->ia_prefixmask.sin6_addr, NULL); - if (prefixlen != plen0) { - ifa_free(ifa); - nd6log((LOG_INFO, "in6_ifadd: wrong prefixlen for %s " - "(prefix=%d ifid=%d)\n", - if_name(ifp), prefixlen, 128 - plen0)); - return NULL; - } - - /* make ifaddr */ - in6_prepare_ifra(&ifra, &pr->ndpr_prefix.sin6_addr, &mask); - - IN6_MASK_ADDR(&ifra.ifra_addr.sin6_addr, &mask); - /* interface ID */ - ifra.ifra_addr.sin6_addr.s6_addr32[0] |= - (ib->ia_addr.sin6_addr.s6_addr32[0] & ~mask.s6_addr32[0]); - ifra.ifra_addr.sin6_addr.s6_addr32[1] |= - (ib->ia_addr.sin6_addr.s6_addr32[1] & ~mask.s6_addr32[1]); - ifra.ifra_addr.sin6_addr.s6_addr32[2] |= - (ib->ia_addr.sin6_addr.s6_addr32[2] & ~mask.s6_addr32[2]); - ifra.ifra_addr.sin6_addr.s6_addr32[3] |= - (ib->ia_addr.sin6_addr.s6_addr32[3] & ~mask.s6_addr32[3]); - ifa_free(ifa); - - /* lifetimes. */ - ifra.ifra_lifetime.ia6t_vltime = pr->ndpr_vltime; - ifra.ifra_lifetime.ia6t_pltime = pr->ndpr_pltime; - - /* XXX: scope zone ID? */ - - ifra.ifra_flags |= IN6_IFF_AUTOCONF; /* obey autoconf */ - - /* - * Make sure that we do not have this address already. This should - * usually not happen, but we can still see this case, e.g., if we - * have manually configured the exact address to be configured. - */ - ifa = (struct ifaddr *)in6ifa_ifpwithaddr(ifp, - &ifra.ifra_addr.sin6_addr); - if (ifa != NULL) { - ifa_free(ifa); - /* this should be rare enough to make an explicit log */ - log(LOG_INFO, "in6_ifadd: %s is already configured\n", - ip6_sprintf(ip6buf, &ifra.ifra_addr.sin6_addr)); - return (NULL); - } - - /* - * Allocate ifaddr structure, link into chain, etc. - * If we are going to create a new address upon receiving a multicasted - * RA, we need to impose a random delay before starting DAD. - * [draft-ietf-ipv6-rfc2462bis-02.txt, Section 5.4.2] - */ - updateflags = 0; - if (mcast) - updateflags |= IN6_IFAUPDATE_DADDELAY; - if ((error = in6_update_ifa(ifp, &ifra, NULL, updateflags)) != 0) { - nd6log((LOG_ERR, - "in6_ifadd: failed to make ifaddr %s on %s (errno=%d)\n", - ip6_sprintf(ip6buf, &ifra.ifra_addr.sin6_addr), - if_name(ifp), error)); - return (NULL); /* ifaddr must not have been allocated. */ - } - - ia = in6ifa_ifpwithaddr(ifp, &ifra.ifra_addr.sin6_addr); - /* - * XXXRW: Assumption of non-NULLness here might not be true with - * fine-grained locking -- should we validate it? Or just return - * earlier ifa rather than looking it up again? - */ - return (ia); /* this is always non-NULL and referenced. */ -} - /* * ia0 - corresponding public address */ @@ -2411,58 +2432,6 @@ in6_tmpifadd(const struct in6_ifaddr *ia0, int forcege } static int -in6_init_prefix_ltimes(struct nd_prefix *ndpr) -{ - if (ndpr->ndpr_pltime == ND6_INFINITE_LIFETIME) - ndpr->ndpr_preferred = 0; - else - ndpr->ndpr_preferred = time_uptime + ndpr->ndpr_pltime; - if (ndpr->ndpr_vltime == ND6_INFINITE_LIFETIME) - ndpr->ndpr_expire = 0; - else - ndpr->ndpr_expire = time_uptime + ndpr->ndpr_vltime; - - return 0; -} - -static void -in6_init_address_ltimes(struct nd_prefix *new, struct in6_addrlifetime *lt6) -{ - /* init ia6t_expire */ - if (lt6->ia6t_vltime == ND6_INFINITE_LIFETIME) - lt6->ia6t_expire = 0; - else { - lt6->ia6t_expire = time_uptime; - lt6->ia6t_expire += lt6->ia6t_vltime; - } - - /* init ia6t_preferred */ - if (lt6->ia6t_pltime == ND6_INFINITE_LIFETIME) - lt6->ia6t_preferred = 0; - else { - lt6->ia6t_preferred = time_uptime; - lt6->ia6t_preferred += lt6->ia6t_pltime; - } -} - -/* - * Delete all the routing table entries that use the specified gateway. - * XXX: this function causes search through all entries of routing table, so - * it shouldn't be called when acting as a router. - */ -void -rt6_flush(struct in6_addr *gateway, struct ifnet *ifp) -{ - - /* We'll care only link-local addresses */ - if (!IN6_IS_ADDR_LINKLOCAL(gateway)) - return; - - /* XXX Do we really need to walk any but the default FIB? */ - rt_foreach_fib_walk_del(AF_INET6, rt6_deleteroute, (void *)gateway); -} - -static int rt6_deleteroute(const struct rtentry *rt, void *arg) { #define SIN6(s) ((struct sockaddr_in6 *)s) @@ -2494,6 +2463,23 @@ rt6_deleteroute(const struct rtentry *rt, void *arg) #undef SIN6 } +/* + * Delete all the routing table entries that use the specified gateway. + * XXX: this function causes search through all entries of routing table, so + * it shouldn't be called when acting as a router. + */ +void +rt6_flush(struct in6_addr *gateway, struct ifnet *ifp) +{ + + /* We'll care only link-local addresses */ + if (!IN6_IS_ADDR_LINKLOCAL(gateway)) + return; + + /* XXX Do we really need to walk any but the default FIB? */ + rt_foreach_fib_walk_del(AF_INET6, rt6_deleteroute, (void *)gateway); +} + int nd6_setdefaultiface(int ifindex) { @@ -2522,47 +2508,6 @@ nd6_setdefaultiface(int ifindex) return (error); } -static int -nd6_sysctl_drlist(SYSCTL_HANDLER_ARGS) -{ - struct in6_defrouter d; - struct nd_defrouter *dr; - int error; - - if (req->newptr != NULL) - return (EPERM); - - error = sysctl_wire_old_buffer(req, 0); - if (error != 0) - return (error); - - bzero(&d, sizeof(d)); - d.rtaddr.sin6_family = AF_INET6; - d.rtaddr.sin6_len = sizeof(d.rtaddr); - - ND6_RLOCK(); - TAILQ_FOREACH(dr, &V_nd6_defrouter, dr_entry) { - d.rtaddr.sin6_addr = dr->rtaddr; - error = sa6_recoverscope(&d.rtaddr); - if (error != 0) - break; - d.flags = dr->raflags; - d.rtlifetime = dr->rtlifetime; - d.expire = dr->expire + (time_second - time_uptime); - d.if_index = dr->ifp->if_index; - error = SYSCTL_OUT(req, &d, sizeof(d)); - if (error != 0) - break; - } - ND6_RUNLOCK(); - return (error); -} -SYSCTL_DECL(_net_inet6_icmp6); -SYSCTL_PROC(_net_inet6_icmp6, ICMPV6CTL_ND6_DRLIST, nd6_drlist, - CTLTYPE_OPAQUE | CTLFLAG_RD | CTLFLAG_MPSAFE, - NULL, 0, nd6_sysctl_drlist, "S,in6_defrouter", - "NDP default router list"); - bool nd6_defrouter_list_empty(void) { @@ -2650,3 +2595,43 @@ nd6_defrouter_init(void) TAILQ_INIT(&V_nd6_defrouter); } + +static int +nd6_sysctl_drlist(SYSCTL_HANDLER_ARGS) +{ + struct in6_defrouter d; + struct nd_defrouter *dr; + int error; + + if (req->newptr != NULL) + return (EPERM); + + error = sysctl_wire_old_buffer(req, 0); + if (error != 0) + return (error); + + bzero(&d, sizeof(d)); + d.rtaddr.sin6_family = AF_INET6; + d.rtaddr.sin6_len = sizeof(d.rtaddr); + + ND6_RLOCK(); + TAILQ_FOREACH(dr, &V_nd6_defrouter, dr_entry) { + d.rtaddr.sin6_addr = dr->rtaddr; + error = sa6_recoverscope(&d.rtaddr); + if (error != 0) + break; + d.flags = dr->raflags; + d.rtlifetime = dr->rtlifetime; + d.expire = dr->expire + (time_second - time_uptime); + d.if_index = dr->ifp->if_index; + error = SYSCTL_OUT(req, &d, sizeof(d)); + if (error != 0) + break; + } + ND6_RUNLOCK(); + return (error); +} +SYSCTL_PROC(_net_inet6_icmp6, ICMPV6CTL_ND6_DRLIST, nd6_drlist, + CTLTYPE_OPAQUE | CTLFLAG_RD | CTLFLAG_MPSAFE, + NULL, 0, nd6_sysctl_drlist, "S,in6_defrouter", + "NDP default router list"); From owner-svn-src-all@freebsd.org Tue Nov 19 20:54:17 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id E4E3F1BD8CD; Tue, 19 Nov 2019 20:54:17 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47HdNT5dQmz3QKn; Tue, 19 Nov 2019 20:54:17 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id A5DC818334; Tue, 19 Nov 2019 20:54:17 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xAJKsHCT083899; Tue, 19 Nov 2019 20:54:17 GMT (envelope-from bz@FreeBSD.org) Received: (from bz@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xAJKsHwM083898; Tue, 19 Nov 2019 20:54:17 GMT (envelope-from bz@FreeBSD.org) Message-Id: <201911192054.xAJKsHwM083898@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bz set sender to bz@FreeBSD.org using -f From: "Bjoern A. Zeeb" Date: Tue, 19 Nov 2019 20:54:17 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354862 - head/sys/netinet6 X-SVN-Group: head X-SVN-Commit-Author: bz X-SVN-Commit-Paths: head/sys/netinet6 X-SVN-Commit-Revision: 354862 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 19 Nov 2019 20:54:18 -0000 Author: bz Date: Tue Nov 19 20:54:17 2019 New Revision: 354862 URL: https://svnweb.freebsd.org/changeset/base/354862 Log: nd6: make nd6_timer_ch static nd6_timer_ch is only used in file local context. There is no need to export it, so make it static. MFC after: 3 weeks Sponsored by: Netflix Modified: head/sys/netinet6/nd6.c Modified: head/sys/netinet6/nd6.c ============================================================================== --- head/sys/netinet6/nd6.c Tue Nov 19 20:34:33 2019 (r354861) +++ head/sys/netinet6/nd6.c Tue Nov 19 20:54:17 2019 (r354862) @@ -145,7 +145,7 @@ static int nd6_need_cache(struct ifnet *); VNET_DEFINE_STATIC(struct callout, nd6_slowtimo_ch); #define V_nd6_slowtimo_ch VNET(nd6_slowtimo_ch) -VNET_DEFINE(struct callout, nd6_timer_ch); +VNET_DEFINE_STATIC(struct callout, nd6_timer_ch); #define V_nd6_timer_ch VNET(nd6_timer_ch) static void From owner-svn-src-all@freebsd.org Tue Nov 19 21:08:19 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 14A091BE080; Tue, 19 Nov 2019 21:08:19 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47Hdhf6ttbz3wgm; Tue, 19 Nov 2019 21:08:18 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id B6EA1184FB; Tue, 19 Nov 2019 21:08:18 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xAJL8IGM090791; Tue, 19 Nov 2019 21:08:18 GMT (envelope-from bz@FreeBSD.org) Received: (from bz@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xAJL8IG4090790; Tue, 19 Nov 2019 21:08:18 GMT (envelope-from bz@FreeBSD.org) Message-Id: <201911192108.xAJL8IG4090790@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bz set sender to bz@FreeBSD.org using -f From: "Bjoern A. Zeeb" Date: Tue, 19 Nov 2019 21:08:18 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354863 - head/sys/netinet6 X-SVN-Group: head X-SVN-Commit-Author: bz X-SVN-Commit-Paths: head/sys/netinet6 X-SVN-Commit-Revision: 354863 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 19 Nov 2019 21:08:19 -0000 Author: bz Date: Tue Nov 19 21:08:18 2019 New Revision: 354863 URL: https://svnweb.freebsd.org/changeset/base/354863 Log: nd6: sysctl Move the SYSCTL_DECL to the top of the file. Move the sysctl function before SYSCTL_PROC so that we don't need an extra function declaration in the middle of the file. No functional changes. MFC after: 3 weeks Sponsored by: Netflix Modified: head/sys/netinet6/nd6.c Modified: head/sys/netinet6/nd6.c ============================================================================== --- head/sys/netinet6/nd6.c Tue Nov 19 20:54:17 2019 (r354862) +++ head/sys/netinet6/nd6.c Tue Nov 19 21:08:18 2019 (r354863) @@ -148,6 +148,8 @@ VNET_DEFINE_STATIC(struct callout, nd6_slowtimo_ch); VNET_DEFINE_STATIC(struct callout, nd6_timer_ch); #define V_nd6_timer_ch VNET(nd6_timer_ch) +SYSCTL_DECL(_net_inet6_icmp6); + static void nd6_lle_event(void *arg __unused, struct llentry *lle, int evt) { @@ -2571,18 +2573,6 @@ clear_llinfo_pqueue(struct llentry *ln) ln->la_hold = NULL; } -static int nd6_sysctl_prlist(SYSCTL_HANDLER_ARGS); - -SYSCTL_DECL(_net_inet6_icmp6); -SYSCTL_PROC(_net_inet6_icmp6, ICMPV6CTL_ND6_PRLIST, nd6_prlist, - CTLTYPE_OPAQUE | CTLFLAG_RD | CTLFLAG_MPSAFE, - NULL, 0, nd6_sysctl_prlist, "S,in6_prefix", - "NDP prefix list"); -SYSCTL_INT(_net_inet6_icmp6, ICMPV6CTL_ND6_MAXQLEN, nd6_maxqueuelen, - CTLFLAG_VNET | CTLFLAG_RW, &VNET_NAME(nd6_maxqueuelen), 1, ""); -SYSCTL_INT(_net_inet6_icmp6, OID_AUTO, nd6_gctimer, - CTLFLAG_VNET | CTLFLAG_RW, &VNET_NAME(nd6_gctimer), (60 * 60 * 24), ""); - static int nd6_sysctl_prlist(SYSCTL_HANDLER_ARGS) { @@ -2656,3 +2646,11 @@ out: ND6_RUNLOCK(); return (error); } +SYSCTL_PROC(_net_inet6_icmp6, ICMPV6CTL_ND6_PRLIST, nd6_prlist, + CTLTYPE_OPAQUE | CTLFLAG_RD | CTLFLAG_MPSAFE, + NULL, 0, nd6_sysctl_prlist, "S,in6_prefix", + "NDP prefix list"); +SYSCTL_INT(_net_inet6_icmp6, ICMPV6CTL_ND6_MAXQLEN, nd6_maxqueuelen, + CTLFLAG_VNET | CTLFLAG_RW, &VNET_NAME(nd6_maxqueuelen), 1, ""); +SYSCTL_INT(_net_inet6_icmp6, OID_AUTO, nd6_gctimer, + CTLFLAG_VNET | CTLFLAG_RW, &VNET_NAME(nd6_gctimer), (60 * 60 * 24), ""); From owner-svn-src-all@freebsd.org Tue Nov 19 21:10:44 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id BB7D41BE20B; Tue, 19 Nov 2019 21:10:44 +0000 (UTC) (envelope-from vmaffione@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47HdlS4XSmz3wy1; Tue, 19 Nov 2019 21:10:44 +0000 (UTC) (envelope-from vmaffione@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 7F32B1851A; Tue, 19 Nov 2019 21:10:44 +0000 (UTC) (envelope-from vmaffione@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xAJLAilC092848; Tue, 19 Nov 2019 21:10:44 GMT (envelope-from vmaffione@FreeBSD.org) Received: (from vmaffione@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xAJLAi9Y092847; Tue, 19 Nov 2019 21:10:44 GMT (envelope-from vmaffione@FreeBSD.org) Message-Id: <201911192110.xAJLAi9Y092847@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: vmaffione set sender to vmaffione@FreeBSD.org using -f From: Vincenzo Maffione Date: Tue, 19 Nov 2019 21:10:44 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354864 - head/usr.sbin/bhyve X-SVN-Group: head X-SVN-Commit-Author: vmaffione X-SVN-Commit-Paths: head/usr.sbin/bhyve X-SVN-Commit-Revision: 354864 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 19 Nov 2019 21:10:44 -0000 Author: vmaffione Date: Tue Nov 19 21:10:44 2019 New Revision: 354864 URL: https://svnweb.freebsd.org/changeset/base/354864 Log: bhyve: virtio-net: disable receive until features are negotiated This patch fixes a race condition where the receive callback is called while the device is being reset. Since the rx_merge variable may change during reset, the receive callback may operate inconsistently with what the guest expects. Also, get rid of the unused rx_vhdrlen variable. PR: 242023 Reported by: aleksandr.fedorov@itglobal.com Reviewed by: markj, jhb MFC with: r354552 Differential Revision: https://reviews.freebsd.org/D22440 Modified: head/usr.sbin/bhyve/pci_virtio_net.c Modified: head/usr.sbin/bhyve/pci_virtio_net.c ============================================================================== --- head/usr.sbin/bhyve/pci_virtio_net.c Tue Nov 19 21:08:18 2019 (r354863) +++ head/usr.sbin/bhyve/pci_virtio_net.c Tue Nov 19 21:10:44 2019 (r354864) @@ -109,7 +109,6 @@ struct pci_vtnet_softc { uint64_t vsc_features; /* negotiated features */ pthread_mutex_t rx_mtx; - unsigned int rx_vhdrlen; int rx_merge; /* merged rx bufs in use */ pthread_t tx_tid; @@ -149,6 +148,16 @@ pci_vtnet_reset(void *vsc) /* Acquire the RX lock to block RX processing. */ pthread_mutex_lock(&sc->rx_mtx); + /* + * Make sure receive operation is disabled at least until we + * re-negotiate the features, since receive operation depends + * on the value of sc->rx_merge and the header length, which + * are both set in pci_vtnet_neg_features(). + * Receive operation will be enabled again once the guest adds + * the first receive buffers and kicks us. + */ + netbe_rx_disable(sc->vsc_be); + /* Set sc->resetting and give a chance to the TX thread to stop. */ pthread_mutex_lock(&sc->tx_mtx); sc->resetting = 1; @@ -158,9 +167,6 @@ pci_vtnet_reset(void *vsc) pthread_mutex_lock(&sc->tx_mtx); } - sc->rx_merge = 1; - sc->rx_vhdrlen = sizeof(struct virtio_net_rxhdr); - /* * Now reset rings, MSI-X vectors, and negotiated capabilities. * Do that with the TX lock held, since we need to reset @@ -512,8 +518,7 @@ pci_vtnet_init(struct vmctx *ctx, struct pci_devinst * sc->resetting = 0; - sc->rx_merge = 1; - sc->rx_vhdrlen = sizeof(struct virtio_net_rxhdr); + sc->rx_merge = 0; pthread_mutex_init(&sc->rx_mtx, NULL); /* @@ -568,18 +573,24 @@ static void pci_vtnet_neg_features(void *vsc, uint64_t negotiated_features) { struct pci_vtnet_softc *sc = vsc; + unsigned int rx_vhdrlen; sc->vsc_features = negotiated_features; - if (!(negotiated_features & VIRTIO_NET_F_MRG_RXBUF)) { + if (negotiated_features & VIRTIO_NET_F_MRG_RXBUF) { + rx_vhdrlen = sizeof(struct virtio_net_rxhdr); + sc->rx_merge = 1; + } else { + /* + * Without mergeable rx buffers, virtio-net header is 2 + * bytes shorter than sizeof(struct virtio_net_rxhdr). + */ + rx_vhdrlen = sizeof(struct virtio_net_rxhdr) - 2; sc->rx_merge = 0; - /* Without mergeable rx buffers, virtio-net header is 2 - * bytes shorter than sizeof(struct virtio_net_rxhdr). */ - sc->rx_vhdrlen = sizeof(struct virtio_net_rxhdr) - 2; } /* Tell the backend to enable some capabilities it has advertised. */ - netbe_set_cap(sc->vsc_be, negotiated_features, sc->rx_vhdrlen); + netbe_set_cap(sc->vsc_be, negotiated_features, rx_vhdrlen); } static struct pci_devemu pci_de_vnet = { From owner-svn-src-all@freebsd.org Tue Nov 19 21:14:16 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 6D4621BE491; Tue, 19 Nov 2019 21:14:16 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47HdqX2G8zz3xPt; Tue, 19 Nov 2019 21:14:16 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 30C5D1870B; Tue, 19 Nov 2019 21:14:16 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xAJLEGMo096688; Tue, 19 Nov 2019 21:14:16 GMT (envelope-from bz@FreeBSD.org) Received: (from bz@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xAJLEGT9096687; Tue, 19 Nov 2019 21:14:16 GMT (envelope-from bz@FreeBSD.org) Message-Id: <201911192114.xAJLEGT9096687@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bz set sender to bz@FreeBSD.org using -f From: "Bjoern A. Zeeb" Date: Tue, 19 Nov 2019 21:14:16 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354865 - head/sys/netinet6 X-SVN-Group: head X-SVN-Commit-Author: bz X-SVN-Commit-Paths: head/sys/netinet6 X-SVN-Commit-Revision: 354865 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 19 Nov 2019 21:14:16 -0000 Author: bz Date: Tue Nov 19 21:14:15 2019 New Revision: 354865 URL: https://svnweb.freebsd.org/changeset/base/354865 Log: in6: move include Move the include for sysctl.h out of the middle of the file to the includes at the beginning. This is will make it easier to add new sysctls. No functional changes. MFC after: 3 weeks Sponsored by: Netflix Modified: head/sys/netinet6/in6.c Modified: head/sys/netinet6/in6.c ============================================================================== --- head/sys/netinet6/in6.c Tue Nov 19 21:10:44 2019 (r354864) +++ head/sys/netinet6/in6.c Tue Nov 19 21:14:15 2019 (r354865) @@ -84,6 +84,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include @@ -2023,8 +2024,6 @@ in6_if2idlen(struct ifnet *ifp) return (64); } } - -#include struct in6_llentry { struct llentry base; From owner-svn-src-all@freebsd.org Tue Nov 19 21:15:13 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id A92221BE567; Tue, 19 Nov 2019 21:15:13 +0000 (UTC) (envelope-from vmaffione@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47Hdrd40M2z3xZb; Tue, 19 Nov 2019 21:15:13 +0000 (UTC) (envelope-from vmaffione@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 6C4E91870F; Tue, 19 Nov 2019 21:15:13 +0000 (UTC) (envelope-from vmaffione@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xAJLFDfJ096787; Tue, 19 Nov 2019 21:15:13 GMT (envelope-from vmaffione@FreeBSD.org) Received: (from vmaffione@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xAJLFC8l096782; Tue, 19 Nov 2019 21:15:12 GMT (envelope-from vmaffione@FreeBSD.org) Message-Id: <201911192115.xAJLFC8l096782@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: vmaffione set sender to vmaffione@FreeBSD.org using -f From: Vincenzo Maffione Date: Tue, 19 Nov 2019 21:15:12 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r354866 - stable/12/usr.sbin/bhyve X-SVN-Group: stable-12 X-SVN-Commit-Author: vmaffione X-SVN-Commit-Paths: stable/12/usr.sbin/bhyve X-SVN-Commit-Revision: 354866 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 19 Nov 2019 21:15:13 -0000 Author: vmaffione Date: Tue Nov 19 21:15:12 2019 New Revision: 354866 URL: https://svnweb.freebsd.org/changeset/base/354866 Log: MFC r354288: bhyve: add backend rx backpressure to virtio-net If a VM is flooded with more ingress packets than the guest OS can handle, the current virtio-net code will keep reading those packets and drop most of them as no space is available in the receive queue. This is an undesirable receive livelock, which is a waste of CPU and memory resources and potentially opens to DoS attacks. With this change, virtio-net uses the new netbe_rx_disable() function to disable ingress operation in the backend while the guest is short on RX buffers. Once the guest makes more buffers available to the RX virtqueue, ingress operation is enabled again by calling netbe_rx_enable(). Reviewed by: bryanv, jhb Differential Revision: https://reviews.freebsd.org/D20987 Modified: stable/12/usr.sbin/bhyve/mevent.c stable/12/usr.sbin/bhyve/mevent.h stable/12/usr.sbin/bhyve/net_backends.c stable/12/usr.sbin/bhyve/pci_e82545.c stable/12/usr.sbin/bhyve/pci_virtio_net.c Directory Properties: stable/12/ (props changed) Modified: stable/12/usr.sbin/bhyve/mevent.c ============================================================================== --- stable/12/usr.sbin/bhyve/mevent.c Tue Nov 19 21:14:15 2019 (r354865) +++ stable/12/usr.sbin/bhyve/mevent.c Tue Nov 19 21:15:12 2019 (r354866) @@ -321,6 +321,14 @@ mevent_add(int tfd, enum ev_type type, return mevent_add_state(tfd, type, func, param, MEV_ADD); } +struct mevent * +mevent_add_disabled(int tfd, enum ev_type type, + void (*func)(int, enum ev_type, void *), void *param) +{ + + return mevent_add_state(tfd, type, func, param, MEV_ADD_DISABLED); +} + static int mevent_update(struct mevent *evp, int newstate) { Modified: stable/12/usr.sbin/bhyve/mevent.h ============================================================================== --- stable/12/usr.sbin/bhyve/mevent.h Tue Nov 19 21:14:15 2019 (r354865) +++ stable/12/usr.sbin/bhyve/mevent.h Tue Nov 19 21:15:12 2019 (r354866) @@ -43,6 +43,9 @@ struct mevent; struct mevent *mevent_add(int fd, enum ev_type type, void (*func)(int, enum ev_type, void *), void *param); +struct mevent *mevent_add_disabled(int fd, enum ev_type type, + void (*func)(int, enum ev_type, void *), + void *param); int mevent_enable(struct mevent *evp); int mevent_disable(struct mevent *evp); int mevent_delete(struct mevent *evp); Modified: stable/12/usr.sbin/bhyve/net_backends.c ============================================================================== --- stable/12/usr.sbin/bhyve/net_backends.c Tue Nov 19 21:14:15 2019 (r354865) +++ stable/12/usr.sbin/bhyve/net_backends.c Tue Nov 19 21:15:12 2019 (r354866) @@ -220,7 +220,7 @@ tap_init(struct net_backend *be, const char *devname, errx(EX_OSERR, "Unable to apply rights for sandbox"); #endif - priv->mevp = mevent_add(be->fd, EVF_READ, cb, param); + priv->mevp = mevent_add_disabled(be->fd, EVF_READ, cb, param); if (priv->mevp == NULL) { WPRINTF(("Could not register event\n")); goto error; @@ -432,7 +432,7 @@ netmap_init(struct net_backend *be, const char *devnam priv->cb_param = param; be->fd = priv->nmd->fd; - priv->mevp = mevent_add(be->fd, EVF_READ, cb, param); + priv->mevp = mevent_add_disabled(be->fd, EVF_READ, cb, param); if (priv->mevp == NULL) { WPRINTF(("Could not register event\n")); return (-1); Modified: stable/12/usr.sbin/bhyve/pci_e82545.c ============================================================================== --- stable/12/usr.sbin/bhyve/pci_e82545.c Tue Nov 19 21:14:15 2019 (r354865) +++ stable/12/usr.sbin/bhyve/pci_e82545.c Tue Nov 19 21:15:12 2019 (r354866) @@ -2351,6 +2351,8 @@ e82545_init(struct vmctx *ctx, struct pci_devinst *pi, net_genmac(pi, sc->esc_mac.octet); } + netbe_rx_enable(sc->esc_be); + /* H/w initiated reset */ e82545_reset(sc, 0); Modified: stable/12/usr.sbin/bhyve/pci_virtio_net.c ============================================================================== --- stable/12/usr.sbin/bhyve/pci_virtio_net.c Tue Nov 19 21:14:15 2019 (r354865) +++ stable/12/usr.sbin/bhyve/pci_virtio_net.c Tue Nov 19 21:15:12 2019 (r354866) @@ -101,7 +101,6 @@ struct pci_vtnet_softc { net_backend_t *vsc_be; - int vsc_rx_ready; int resetting; /* protected by tx_mtx */ uint64_t vsc_features; /* negotiated features */ @@ -156,7 +155,6 @@ pci_vtnet_reset(void *vsc) pthread_mutex_lock(&sc->tx_mtx); } - sc->vsc_rx_ready = 0; sc->rx_merge = 1; sc->rx_vhdrlen = sizeof(struct virtio_net_rxhdr); @@ -180,30 +178,29 @@ pci_vtnet_rx(struct pci_vtnet_softc *sc) int len, n; uint16_t idx; - if (!sc->vsc_rx_ready) { - /* - * The rx ring has not yet been set up. - * Drop the packet and try later. - */ - netbe_rx_discard(sc->vsc_be); - return; - } - - /* - * Check for available rx buffers - */ vq = &sc->vsc_queues[VTNET_RXQ]; - if (!vq_has_descs(vq)) { + for (;;) { /* - * No available rx buffers. Drop the packet and try later. - * Interrupt on empty, if that's negotiated. + * Check for available rx buffers. */ - netbe_rx_discard(sc->vsc_be); - vq_endchains(vq, /*used_all_avail=*/1); - return; - } + if (!vq_has_descs(vq)) { + /* No rx buffers. Enable RX kicks and double check. */ + vq_kick_enable(vq); + if (!vq_has_descs(vq)) { + /* + * Still no buffers. Interrupt if needed + * (including for NOTIFY_ON_EMPTY), and + * disable the backend until the next kick. + */ + vq_endchains(vq, /*used_all_avail=*/1); + netbe_rx_disable(sc->vsc_be); + return; + } - do { + /* More rx buffers found, so keep going. */ + vq_kick_disable(vq); + } + /* * Get descriptor chain. */ @@ -215,7 +212,8 @@ pci_vtnet_rx(struct pci_vtnet_softc *sc) if (len <= 0) { /* * No more packets (len == 0), or backend errored - * (err < 0). Return unused available buffers. + * (err < 0). Return unused available buffers + * and stop. */ vq_retchain(vq); /* Interrupt if needed/appropriate and stop. */ @@ -225,10 +223,8 @@ pci_vtnet_rx(struct pci_vtnet_softc *sc) /* Publish the info to the guest */ vq_relchain(vq, idx, (uint32_t)len); - } while (vq_has_descs(vq)); + } - /* Interrupt if needed, including for NOTIFY_ON_EMPTY. */ - vq_endchains(vq, /*used_all_avail=*/1); } /* @@ -254,13 +250,11 @@ pci_vtnet_ping_rxq(void *vsc, struct vqueue_info *vq) struct pci_vtnet_softc *sc = vsc; /* - * A qnotify means that the rx process can now begin + * A qnotify means that the rx process can now begin. */ pthread_mutex_lock(&sc->rx_mtx); - if (sc->vsc_rx_ready == 0) { - sc->vsc_rx_ready = 1; - vq_kick_disable(vq); - } + vq_kick_disable(vq); + netbe_rx_enable(sc->vsc_be); pthread_mutex_unlock(&sc->rx_mtx); } From owner-svn-src-all@freebsd.org Tue Nov 19 21:29:50 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 66A021BEA29; Tue, 19 Nov 2019 21:29:50 +0000 (UTC) (envelope-from vmaffione@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47Hf9V22cwz3yDy; Tue, 19 Nov 2019 21:29:50 +0000 (UTC) (envelope-from vmaffione@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 2958F188F4; Tue, 19 Nov 2019 21:29:50 +0000 (UTC) (envelope-from vmaffione@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xAJLTouE003049; Tue, 19 Nov 2019 21:29:50 GMT (envelope-from vmaffione@FreeBSD.org) Received: (from vmaffione@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xAJLTo3e003048; Tue, 19 Nov 2019 21:29:50 GMT (envelope-from vmaffione@FreeBSD.org) Message-Id: <201911192129.xAJLTo3e003048@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: vmaffione set sender to vmaffione@FreeBSD.org using -f From: Vincenzo Maffione Date: Tue, 19 Nov 2019 21:29:50 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354867 - head/sys/net X-SVN-Group: head X-SVN-Commit-Author: vmaffione X-SVN-Commit-Paths: head/sys/net X-SVN-Commit-Revision: 354867 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 19 Nov 2019 21:29:50 -0000 Author: vmaffione Date: Tue Nov 19 21:29:49 2019 New Revision: 354867 URL: https://svnweb.freebsd.org/changeset/base/354867 Log: netmap: check if we already ran mmap before we attempt it Submitted by: neel@neelc.org Reviewed by: vmaffione MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D22390 Modified: head/sys/net/netmap_user.h Modified: head/sys/net/netmap_user.h ============================================================================== --- head/sys/net/netmap_user.h Tue Nov 19 21:15:12 2019 (r354866) +++ head/sys/net/netmap_user.h Tue Nov 19 21:29:49 2019 (r354867) @@ -981,7 +981,8 @@ nm_close(struct nm_desc *d) static int nm_mmap(struct nm_desc *d, const struct nm_desc *parent) { - //XXX TODO: check if mmap is already done + if (d->done_mmap) + return 0; if (IS_NETMAP_DESC(parent) && parent->mem && parent->req.nr_arg2 == d->req.nr_arg2) { From owner-svn-src-all@freebsd.org Tue Nov 19 23:12:44 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 12B671C10B4; Tue, 19 Nov 2019 23:12:44 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47HhSC6pxpz44FH; Tue, 19 Nov 2019 23:12:43 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id CD42E19CD5; Tue, 19 Nov 2019 23:12:43 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xAJNChYG067500; Tue, 19 Nov 2019 23:12:43 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xAJNChTV067498; Tue, 19 Nov 2019 23:12:43 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201911192312.xAJNChTV067498@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Tue, 19 Nov 2019 23:12:43 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354868 - head/sys/arm/broadcom/bcm2835 X-SVN-Group: head X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: head/sys/arm/broadcom/bcm2835 X-SVN-Commit-Revision: 354868 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 19 Nov 2019 23:12:44 -0000 Author: kevans Date: Tue Nov 19 23:12:43 2019 New Revision: 354868 URL: https://svnweb.freebsd.org/changeset/base/354868 Log: bcm2835_sdhci: various refactoring of DMA path This round of refactoring is mostly about streamlining the interrupt handler to make it easier to verify and reason about operations taking place while trying to bring FreeBSD up on the RPi4. Modified: head/sys/arm/broadcom/bcm2835/bcm2835_sdhci.c Modified: head/sys/arm/broadcom/bcm2835/bcm2835_sdhci.c ============================================================================== --- head/sys/arm/broadcom/bcm2835/bcm2835_sdhci.c Tue Nov 19 21:29:49 2019 (r354867) +++ head/sys/arm/broadcom/bcm2835/bcm2835_sdhci.c Tue Nov 19 23:12:43 2019 (r354868) @@ -78,6 +78,13 @@ __FBSDID("$FreeBSD$"); #define ALLOCATED_DMA_SEGS (NUM_DMA_SEGS + NUM_DMA_SPILL_SEGS) #define BCM_DMA_MAXSIZE (NUM_DMA_SEGS * BCM_SDHCI_BUFFER_SIZE) +#define BCM_SDHCI_SLOT_LEFT(slot) \ + ((slot)->curcmd->data->len - (slot)->offset) + +#define BCM_SDHCI_SEGSZ_LEFT(slot) \ + min(BCM_DMA_MAXSIZE, \ + rounddown(BCM_SDHCI_SLOT_LEFT(slot), BCM_SDHCI_BUFFER_SIZE)) + #define DATA_PENDING_MASK (SDHCI_INT_DATA_AVAIL | SDHCI_INT_SPACE_AVAIL) #ifdef DEBUG @@ -172,6 +179,7 @@ static void bcm_sdhci_intr(void *); static int bcm_sdhci_get_ro(device_t, device_t); static void bcm_sdhci_dma_intr(int ch, void *arg); +static void bcm_sdhci_start_dma(struct sdhci_slot *slot); static void bcm_sdhci_dmacb(void *arg, bus_dma_segment_t *segs, int nseg, int err) @@ -569,8 +577,9 @@ bcm_sdhci_start_dma_seg(struct bcm_sdhci_softc *sc) */ if (idx == 0) { bus_dmamap_sync(sc->sc_dma_tag, sc->sc_dma_map, sync_op); + slot->intmask &= ~DATA_PENDING_MASK; - bcm_sdhci_write_4(sc->sc_dev, &sc->sc_slot, SDHCI_SIGNAL_ENABLE, + bcm_sdhci_write_4(sc->sc_dev, slot, SDHCI_SIGNAL_ENABLE, slot->intmask); } @@ -583,20 +592,28 @@ bcm_sdhci_start_dma_seg(struct bcm_sdhci_softc *sc) } static void +bcm_sdhci_dma_exit(struct bcm_sdhci_softc *sc) +{ + struct sdhci_slot *slot = &sc->sc_slot; + + mtx_assert(&slot->mtx, MA_OWNED); + + /* Re-enable interrupts */ + slot->intmask |= DATA_PENDING_MASK; + bcm_sdhci_write_4(slot->bus, slot, SDHCI_SIGNAL_ENABLE, + slot->intmask); +} + +static void bcm_sdhci_dma_intr(int ch, void *arg) { struct bcm_sdhci_softc *sc = (struct bcm_sdhci_softc *)arg; struct sdhci_slot *slot = &sc->sc_slot; uint32_t reg; - int left, sync_op; mtx_lock(&slot->mtx); - - if (slot->curcmd == NULL) { - mtx_unlock(&slot->mtx); - return; - } - + if (slot->curcmd == NULL) + goto out; /* * If there are more segments for the current dma, start the next one. * Otherwise unload the dma map and decide what to do next based on the @@ -604,92 +621,64 @@ bcm_sdhci_dma_intr(int ch, void *arg) */ if (sc->dmamap_seg_index < sc->dmamap_seg_count) { bcm_sdhci_start_dma_seg(sc); - mtx_unlock(&slot->mtx); - return; + goto out; } - if (slot->curcmd->data->flags & MMC_DATA_READ) - sync_op = BUS_DMASYNC_POSTREAD; + if ((slot->curcmd->data->flags & MMC_DATA_READ) != 0) + bus_dmamap_sync(sc->sc_dma_tag, sc->sc_dma_map, + BUS_DMASYNC_POSTREAD); else - sync_op = BUS_DMASYNC_POSTWRITE; + bus_dmamap_sync(sc->sc_dma_tag, sc->sc_dma_map, + BUS_DMASYNC_POSTWRITE); + bus_dmamap_unload(sc->sc_dma_tag, sc->sc_dma_map); - if (sc->dmamap_seg_count != 0) { - bus_dmamap_sync(sc->sc_dma_tag, sc->sc_dma_map, sync_op); - bus_dmamap_unload(sc->sc_dma_tag, sc->sc_dma_map); + sc->dmamap_seg_count = 0; + sc->dmamap_seg_index = 0; - sc->dmamap_seg_count = 0; - sc->dmamap_seg_index = 0; - } - - left = min(BCM_SDHCI_BUFFER_SIZE, - slot->curcmd->data->len - slot->offset); - /* - * If there is less than buffer size outstanding, we would not handle - * it anymore using DMA if bcm_sdhci_will_handle_transfer() were asked. - * Re-enable interrupts and return and let the SDHCI state machine - * finish the job. + * If we had no further segments pending, we need to determine how to + * proceed next. If the 'data/space pending' bit is already set and we + * can continue via DMA, do so. Otherwise, re-enable interrupts and + * return. */ - if (left < BCM_SDHCI_BUFFER_SIZE) { - /* Re-enable data interrupts. */ - slot->intmask |= DATA_PENDING_MASK; - bcm_sdhci_write_4(slot->bus, slot, SDHCI_SIGNAL_ENABLE, - slot->intmask); - mtx_unlock(&slot->mtx); - return; - } - reg = bcm_sdhci_read_4(slot->bus, slot, SDHCI_INT_STATUS); + if ((reg & DATA_PENDING_MASK) != 0 && + BCM_SDHCI_SEGSZ_LEFT(slot) >= BCM_SDHCI_BUFFER_SIZE) { + /* ACK any pending interrupts */ + bcm_sdhci_write_4(slot->bus, slot, SDHCI_INT_STATUS, + DATA_PENDING_MASK); - /* already available? */ - if ((reg & DATA_PENDING_MASK) != 0) { - - /* ACK for DATA_AVAIL or SPACE_AVAIL */ - bcm_sdhci_write_4(slot->bus, slot, - SDHCI_INT_STATUS, DATA_PENDING_MASK); - - /* continue next DMA transfer */ - if (bus_dmamap_load(sc->sc_dma_tag, sc->sc_dma_map, - (uint8_t *)slot->curcmd->data->data + - slot->offset, left, bcm_sdhci_dmacb, sc, - BUS_DMA_NOWAIT) != 0 || sc->dmamap_status != 0) { - slot->curcmd->error = MMC_ERR_NO_MEMORY; + bcm_sdhci_start_dma(slot); + if (slot->curcmd->error != 0) { sdhci_finish_data(slot); - } else { - bcm_sdhci_start_dma_seg(sc); + bcm_sdhci_dma_exit(sc); } } else { - /* wait for next data by INT */ - - /* enable INT */ - slot->intmask |= DATA_PENDING_MASK; - bcm_sdhci_write_4(slot->bus, slot, SDHCI_SIGNAL_ENABLE, - slot->intmask); + bcm_sdhci_dma_exit(sc); } - +out: mtx_unlock(&slot->mtx); } static void -bcm_sdhci_read_dma(device_t dev, struct sdhci_slot *slot) +bcm_sdhci_start_dma(struct sdhci_slot *slot) { struct bcm_sdhci_softc *sc = device_get_softc(slot->bus); + uint8_t *buf; size_t left; - /* XXX TODO: Not many-segment safe */ - if (sc->dmamap_seg_count != 0) { - device_printf(sc->sc_dev, "DMA in use\n"); - return; - } + mtx_assert(&slot->mtx, MA_OWNED); - left = min(BCM_SDHCI_BUFFER_SIZE, - slot->curcmd->data->len - slot->offset); + left = BCM_SDHCI_SEGSZ_LEFT(slot); + buf = (uint8_t *)slot->curcmd->data->data + slot->offset; + KASSERT(left != 0, + ("%s: DMA handling incorrectly indicated", __func__)); - KASSERT((left & 3) == 0, - ("%s: len = %zu, not word-aligned", __func__, left)); - - if (bus_dmamap_load(sc->sc_dma_tag, sc->sc_dma_map, - (uint8_t *)slot->curcmd->data->data + slot->offset, left, + /* + * No need to check segment count here; if we've not yet unloaded + * previous segments, we'll catch that in bcm_sdhci_dmacb. + */ + if (bus_dmamap_load(sc->sc_dma_tag, sc->sc_dma_map, buf, left, bcm_sdhci_dmacb, sc, BUS_DMA_NOWAIT) != 0 || sc->dmamap_status != 0) { slot->curcmd->error = MMC_ERR_NO_MEMORY; @@ -700,55 +689,30 @@ bcm_sdhci_read_dma(device_t dev, struct sdhci_slot *sl bcm_sdhci_start_dma_seg(sc); } -static void -bcm_sdhci_write_dma(device_t dev, struct sdhci_slot *slot) -{ - struct bcm_sdhci_softc *sc = device_get_softc(slot->bus); - size_t left; - - /* XXX TODO: Not many-segment safe */ - if (sc->dmamap_seg_count != 0) { - device_printf(sc->sc_dev, "DMA in use\n"); - return; - } - - left = min(BCM_SDHCI_BUFFER_SIZE, - slot->curcmd->data->len - slot->offset); - - KASSERT((left & 3) == 0, - ("%s: len = %zu, not word-aligned", __func__, left)); - - if (bus_dmamap_load(sc->sc_dma_tag, sc->sc_dma_map, - (uint8_t *)slot->curcmd->data->data + slot->offset, left, - bcm_sdhci_dmacb, sc, BUS_DMA_NOWAIT) != 0 || - sc->dmamap_status != 0) { - slot->curcmd->error = MMC_ERR_NO_MEMORY; - return; - } - - /* DMA start */ - bcm_sdhci_start_dma_seg(sc); -} - static int bcm_sdhci_will_handle_transfer(device_t dev, struct sdhci_slot *slot) { struct bcm_sdhci_softc *sc = device_get_softc(slot->bus); - size_t left; if (!sc->conf->use_dma) return (0); /* - * Do not use DMA for transfers less than block size or with a length - * that is not a multiple of four. + * This indicates that we somehow let a data interrupt slip by into the + * SDHCI framework, when it should not have. This really needs to be + * caught and fixed ASAP, as it really shouldn't happen. */ - left = min(BCM_DMA_BLOCK_SIZE, - slot->curcmd->data->len - slot->offset); - if (left < BCM_DMA_BLOCK_SIZE) + KASSERT(sc->dmamap_seg_count == 0, + ("data pending interrupt pushed through SDHCI framework")); + + /* + * Do not use DMA for transfers less than our block size. Checking + * alignment serves little benefit, as we round transfer sizes down to + * a multiple of the block size and push the transfer back to + * SDHCI-driven PIO once we're below the block size. + */ + if (BCM_SDHCI_SEGSZ_LEFT(slot) < BCM_DMA_BLOCK_SIZE) return (0); - if (left & 0x03) - return (0); return (1); } @@ -759,10 +723,7 @@ bcm_sdhci_start_transfer(device_t dev, struct sdhci_sl { /* DMA transfer FIFO 1KB */ - if (slot->curcmd->data->flags & MMC_DATA_READ) - bcm_sdhci_read_dma(dev, slot); - else - bcm_sdhci_write_dma(dev, slot); + bcm_sdhci_start_dma(slot); } static void @@ -772,6 +733,13 @@ bcm_sdhci_finish_transfer(device_t dev, struct sdhci_s /* Clean up */ if (sc->dmamap_seg_count != 0) { + /* + * Our segment math should have worked out such that we would + * never finish the transfer without having used up all of the + * segments. If we haven't, that means we must have erroneously + * regressed to SDHCI-driven PIO to finish the operation and + * this is certainly caused by developer-error. + */ if (slot->curcmd->data->flags & MMC_DATA_READ) bus_dmamap_sync(sc->sc_dma_tag, sc->sc_dma_map, BUS_DMASYNC_POSTREAD); @@ -782,15 +750,9 @@ bcm_sdhci_finish_transfer(device_t dev, struct sdhci_s sc->dmamap_seg_count = 0; sc->dmamap_seg_index = 0; - - slot->intmask |= DATA_PENDING_MASK; - bcm_sdhci_write_4(slot->bus, slot, SDHCI_SIGNAL_ENABLE, - slot->intmask); - } else { - KASSERT((slot->intmask & DATA_PENDING_MASK) == - DATA_PENDING_MASK, - ("%s: interrupt mask not restored", __func__)); } + + bcm_sdhci_dma_exit(sc); sdhci_finish_data(slot); } From owner-svn-src-all@freebsd.org Tue Nov 19 23:19:45 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id BF6691C14CF; Tue, 19 Nov 2019 23:19:45 +0000 (UTC) (envelope-from jeff@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47HhcK5Kv0z44h7; Tue, 19 Nov 2019 23:19:45 +0000 (UTC) (envelope-from jeff@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 81B5019CE1; Tue, 19 Nov 2019 23:19:45 +0000 (UTC) (envelope-from jeff@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xAJNJj9r067845; Tue, 19 Nov 2019 23:19:45 GMT (envelope-from jeff@FreeBSD.org) Received: (from jeff@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xAJNJh2U067835; Tue, 19 Nov 2019 23:19:43 GMT (envelope-from jeff@FreeBSD.org) Message-Id: <201911192319.xAJNJh2U067835@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jeff set sender to jeff@FreeBSD.org using -f From: Jeff Roberson Date: Tue, 19 Nov 2019 23:19:43 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354869 - in head/sys: fs/tmpfs kern vm X-SVN-Group: head X-SVN-Commit-Author: jeff X-SVN-Commit-Paths: in head/sys: fs/tmpfs kern vm X-SVN-Commit-Revision: 354869 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 19 Nov 2019 23:19:45 -0000 Author: jeff Date: Tue Nov 19 23:19:43 2019 New Revision: 354869 URL: https://svnweb.freebsd.org/changeset/base/354869 Log: Simplify anonymous memory handling with an OBJ_ANON flag. This eliminates reudundant complicated checks and additional locking required only for anonymous memory. Introduce vm_object_allocate_anon() to create these objects. DEFAULT and SWAP objects now have the correct settings for non-anonymous consumers and so individual consumers need not modify the default flags to create super-pages and avoid ONEMAPPING/NOSPLIT. Reviewed by: alc, dougm, kib, markj Tested by: pho Differential Revision: https://reviews.freebsd.org/D22119 Modified: head/sys/fs/tmpfs/tmpfs_subr.c head/sys/kern/sysv_shm.c head/sys/kern/uipc_shm.c head/sys/vm/swap_pager.c head/sys/vm/vm_fault.c head/sys/vm/vm_map.c head/sys/vm/vm_meter.c head/sys/vm/vm_object.c head/sys/vm/vm_object.h head/sys/vm/vm_reserv.c Modified: head/sys/fs/tmpfs/tmpfs_subr.c ============================================================================== --- head/sys/fs/tmpfs/tmpfs_subr.c Tue Nov 19 23:12:43 2019 (r354868) +++ head/sys/fs/tmpfs/tmpfs_subr.c Tue Nov 19 23:19:43 2019 (r354869) @@ -273,8 +273,7 @@ tmpfs_alloc_node(struct mount *mp, struct tmpfs_mount NULL /* XXXKIB - tmpfs needs swap reservation */); VM_OBJECT_WLOCK(obj); /* OBJ_TMPFS is set together with the setting of vp->v_object */ - vm_object_set_flag(obj, OBJ_NOSPLIT | OBJ_TMPFS_NODE); - vm_object_clear_flag(obj, OBJ_ONEMAPPING); + vm_object_set_flag(obj, OBJ_TMPFS_NODE); VM_OBJECT_WUNLOCK(obj); break; Modified: head/sys/kern/sysv_shm.c ============================================================================== --- head/sys/kern/sysv_shm.c Tue Nov 19 23:12:43 2019 (r354868) +++ head/sys/kern/sysv_shm.c Tue Nov 19 23:19:43 2019 (r354869) @@ -751,11 +751,6 @@ shmget_allocate_segment(struct thread *td, struct shmg #endif return (ENOMEM); } - shm_object->pg_color = 0; - VM_OBJECT_WLOCK(shm_object); - vm_object_clear_flag(shm_object, OBJ_ONEMAPPING); - vm_object_set_flag(shm_object, OBJ_COLORED | OBJ_NOSPLIT); - VM_OBJECT_WUNLOCK(shm_object); shmseg->object = shm_object; shmseg->u.shm_perm.cuid = shmseg->u.shm_perm.uid = cred->cr_uid; Modified: head/sys/kern/uipc_shm.c ============================================================================== --- head/sys/kern/uipc_shm.c Tue Nov 19 23:12:43 2019 (r354868) +++ head/sys/kern/uipc_shm.c Tue Nov 19 23:19:43 2019 (r354869) @@ -597,11 +597,6 @@ shm_alloc(struct ucred *ucred, mode_t mode) shmfd->shm_object = vm_pager_allocate(OBJT_SWAP, NULL, shmfd->shm_size, VM_PROT_DEFAULT, 0, ucred); KASSERT(shmfd->shm_object != NULL, ("shm_create: vm_pager_allocate")); - shmfd->shm_object->pg_color = 0; - VM_OBJECT_WLOCK(shmfd->shm_object); - vm_object_clear_flag(shmfd->shm_object, OBJ_ONEMAPPING); - vm_object_set_flag(shmfd->shm_object, OBJ_COLORED | OBJ_NOSPLIT); - VM_OBJECT_WUNLOCK(shmfd->shm_object); vfs_timestamp(&shmfd->shm_birthtime); shmfd->shm_atime = shmfd->shm_mtime = shmfd->shm_ctime = shmfd->shm_birthtime; Modified: head/sys/vm/swap_pager.c ============================================================================== --- head/sys/vm/swap_pager.c Tue Nov 19 23:12:43 2019 (r354868) +++ head/sys/vm/swap_pager.c Tue Nov 19 23:19:43 2019 (r354869) @@ -3038,7 +3038,7 @@ swap_pager_update_writecount(vm_object_t object, vm_of { VM_OBJECT_WLOCK(object); - KASSERT((object->flags & OBJ_NOSPLIT) != 0, + KASSERT((object->flags & OBJ_ANON) == 0, ("Splittable object with writecount")); object->un_pager.swp.writemappings += (vm_ooffset_t)end - start; VM_OBJECT_WUNLOCK(object); @@ -3050,7 +3050,7 @@ swap_pager_release_writecount(vm_object_t object, vm_o { VM_OBJECT_WLOCK(object); - KASSERT((object->flags & OBJ_NOSPLIT) != 0, + KASSERT((object->flags & OBJ_ANON) == 0, ("Splittable object with writecount")); object->un_pager.swp.writemappings -= (vm_ooffset_t)end - start; VM_OBJECT_WUNLOCK(object); Modified: head/sys/vm/vm_fault.c ============================================================================== --- head/sys/vm/vm_fault.c Tue Nov 19 23:12:43 2019 (r354868) +++ head/sys/vm/vm_fault.c Tue Nov 19 23:19:43 2019 (r354869) @@ -1239,8 +1239,7 @@ readrest: /* * No other ways to look the object up */ - ((fs.object->type == OBJT_DEFAULT) || - (fs.object->type == OBJT_SWAP)) && + ((fs.object->flags & OBJ_ANON) != 0) && (is_first_object_locked = VM_OBJECT_TRYWLOCK(fs.first_object)) && /* * We don't chase down the shadow chain @@ -1739,7 +1738,7 @@ vm_fault_copy_entry(vm_map_t dst_map, vm_map_t src_map * Create the top-level object for the destination entry. (Doesn't * actually shadow anything - we copy the pages directly.) */ - dst_object = vm_object_allocate(OBJT_DEFAULT, + dst_object = vm_object_allocate_anon( atop(dst_entry->end - dst_entry->start)); #if VM_NRESERVLEVEL > 0 dst_object->flags |= OBJ_COLORED; Modified: head/sys/vm/vm_map.c ============================================================================== --- head/sys/vm/vm_map.c Tue Nov 19 23:12:43 2019 (r354868) +++ head/sys/vm/vm_map.c Tue Nov 19 23:19:43 2019 (r354869) @@ -1504,10 +1504,12 @@ charged: * reference counting is insufficient to recognize * aliases with precision.) */ - VM_OBJECT_WLOCK(object); - if (object->ref_count > 1 || object->shadow_count != 0) - vm_object_clear_flag(object, OBJ_ONEMAPPING); - VM_OBJECT_WUNLOCK(object); + if ((object->flags & OBJ_ANON) != 0) { + VM_OBJECT_WLOCK(object); + if (object->ref_count > 1 || object->shadow_count != 0) + vm_object_clear_flag(object, OBJ_ONEMAPPING); + VM_OBJECT_WUNLOCK(object); + } } else if ((prev_entry->eflags & ~MAP_ENTRY_USER_WIRED) == protoeflags && (cow & (MAP_STACK_GROWS_DOWN | MAP_STACK_GROWS_UP | @@ -2101,8 +2103,7 @@ vm_map_entry_back(vm_map_entry_t entry) ("map entry %p has backing object", entry)); KASSERT((entry->eflags & MAP_ENTRY_IS_SUB_MAP) == 0, ("map entry %p is a submap", entry)); - object = vm_object_allocate(OBJT_DEFAULT, - atop(entry->end - entry->start)); + object = vm_object_allocate_anon(atop(entry->end - entry->start)); entry->object.vm_object = object; entry->offset = 0; if (entry->cred != NULL) { @@ -3488,8 +3489,10 @@ vm_map_entry_delete(vm_map_t map, vm_map_entry_t entry crfree(entry->cred); } - if ((entry->eflags & MAP_ENTRY_IS_SUB_MAP) == 0 && - (object != NULL)) { + if ((entry->eflags & MAP_ENTRY_IS_SUB_MAP) != 0 || object == NULL) { + entry->object.vm_object = NULL; + } else if ((object->flags & OBJ_ANON) != 0 || + object == kernel_object) { KASSERT(entry->cred == NULL || object->cred == NULL || (entry->eflags & MAP_ENTRY_NEEDS_COPY), ("OVERCOMMIT vm_map_entry_delete: both cred %p", entry)); @@ -3497,8 +3500,8 @@ vm_map_entry_delete(vm_map_t map, vm_map_entry_t entry offidxstart = OFF_TO_IDX(entry->offset); offidxend = offidxstart + count; VM_OBJECT_WLOCK(object); - if (object->ref_count != 1 && ((object->flags & (OBJ_NOSPLIT | - OBJ_ONEMAPPING)) == OBJ_ONEMAPPING || + if (object->ref_count != 1 && + ((object->flags & OBJ_ONEMAPPING) != 0 || object == kernel_object)) { vm_object_collapse(object); @@ -3528,8 +3531,7 @@ vm_map_entry_delete(vm_map_t map, vm_map_entry_t entry } } VM_OBJECT_WUNLOCK(object); - } else - entry->object.vm_object = NULL; + } if (map->system_map) vm_map_entry_deallocate(entry, TRUE); else { @@ -3748,11 +3750,9 @@ vm_map_copy_entry( VM_OBJECT_WLOCK(src_object); charged = ENTRY_CHARGED(src_entry); if (src_object->handle == NULL && - (src_object->type == OBJT_DEFAULT || - src_object->type == OBJT_SWAP)) { + (src_object->flags & OBJ_ANON) != 0) { vm_object_collapse(src_object); - if ((src_object->flags & (OBJ_NOSPLIT | - OBJ_ONEMAPPING)) == OBJ_ONEMAPPING) { + if ((src_object->flags & OBJ_ONEMAPPING) != 0) { vm_object_split(src_entry); src_object = src_entry->object.vm_object; @@ -4686,8 +4686,7 @@ RetryLookupLocked: !map->system_map) { if (vm_map_lock_upgrade(map)) goto RetryLookup; - entry->object.vm_object = vm_object_allocate(OBJT_DEFAULT, - atop(size)); + entry->object.vm_object = vm_object_allocate_anon(atop(size)); entry->offset = 0; if (entry->cred != NULL) { VM_OBJECT_WLOCK(entry->object.vm_object); Modified: head/sys/vm/vm_meter.c ============================================================================== --- head/sys/vm/vm_meter.c Tue Nov 19 23:12:43 2019 (r354868) +++ head/sys/vm/vm_meter.c Tue Nov 19 23:19:43 2019 (r354869) @@ -258,7 +258,7 @@ vmtotal(SYSCTL_HANDLER_ARGS) continue; } if (object->ref_count == 1 && - (object->flags & OBJ_NOSPLIT) != 0) { + (object->flags & OBJ_ANON) == 0) { /* * Also skip otherwise unreferenced swap * objects backing tmpfs vnodes, and POSIX or Modified: head/sys/vm/vm_object.c ============================================================================== --- head/sys/vm/vm_object.c Tue Nov 19 23:12:43 2019 (r354868) +++ head/sys/vm/vm_object.c Tue Nov 19 23:19:43 2019 (r354869) @@ -239,7 +239,8 @@ vm_object_zinit(void *mem, int size, int flags) } static void -_vm_object_allocate(objtype_t type, vm_pindex_t size, vm_object_t object) +_vm_object_allocate(objtype_t type, vm_pindex_t size, u_short flags, + vm_object_t object) { TAILQ_INIT(&object->memq); @@ -256,29 +257,8 @@ _vm_object_allocate(objtype_t type, vm_pindex_t size, */ atomic_thread_fence_rel(); - switch (type) { - case OBJT_DEAD: - panic("_vm_object_allocate: can't create OBJT_DEAD"); - case OBJT_DEFAULT: - case OBJT_SWAP: - object->flags = OBJ_ONEMAPPING; - break; - case OBJT_DEVICE: - case OBJT_SG: - object->flags = OBJ_FICTITIOUS | OBJ_UNMANAGED; - break; - case OBJT_MGTDEVICE: - object->flags = OBJ_FICTITIOUS; - break; - case OBJT_PHYS: - object->flags = OBJ_UNMANAGED; - break; - case OBJT_VNODE: - object->flags = 0; - break; - default: - panic("_vm_object_allocate: type %d is undefined", type); - } + object->pg_color = 0; + object->flags = flags; object->size = size; object->domain.dr_policy = NULL; object->generation = 1; @@ -309,7 +289,7 @@ vm_object_init(void) rw_init(&kernel_object->lock, "kernel vm object"); _vm_object_allocate(OBJT_PHYS, atop(VM_MAX_KERNEL_ADDRESS - - VM_MIN_KERNEL_ADDRESS), kernel_object); + VM_MIN_KERNEL_ADDRESS), OBJ_UNMANAGED, kernel_object); #if VM_NRESERVLEVEL > 0 kernel_object->flags |= OBJ_COLORED; kernel_object->pg_color = (u_short)atop(VM_MIN_KERNEL_ADDRESS); @@ -427,13 +407,57 @@ vm_object_t vm_object_allocate(objtype_t type, vm_pindex_t size) { vm_object_t object; + u_short flags; + switch (type) { + case OBJT_DEAD: + panic("vm_object_allocate: can't create OBJT_DEAD"); + case OBJT_DEFAULT: + case OBJT_SWAP: + flags = OBJ_COLORED; + break; + case OBJT_DEVICE: + case OBJT_SG: + flags = OBJ_FICTITIOUS | OBJ_UNMANAGED; + break; + case OBJT_MGTDEVICE: + flags = OBJ_FICTITIOUS; + break; + case OBJT_PHYS: + flags = OBJ_UNMANAGED; + break; + case OBJT_VNODE: + flags = 0; + break; + default: + panic("vm_object_allocate: type %d is undefined", type); + } object = (vm_object_t)uma_zalloc(obj_zone, M_WAITOK); - _vm_object_allocate(type, size, object); + _vm_object_allocate(type, size, flags, object); + return (object); } +/* + * vm_object_allocate_anon: + * + * Returns a new default object of the given size and marked as + * anonymous memory for special split/collapse handling. Color + * to be initialized by the caller. + */ +vm_object_t +vm_object_allocate_anon(vm_pindex_t size) +{ + vm_object_t object; + object = (vm_object_t)uma_zalloc(obj_zone, M_WAITOK); + _vm_object_allocate(OBJT_DEFAULT, size, OBJ_ANON | OBJ_ONEMAPPING, + object); + + return (object); +} + + /* * vm_object_reference: * @@ -522,7 +546,10 @@ vm_object_deallocate(vm_object_t object) * being 0 or 1. These cases require a write lock on the * object. */ - released = refcount_release_if_gt(&object->ref_count, 2); + if ((object->flags & OBJ_ANON) == 0) + released = refcount_release_if_gt(&object->ref_count, 1); + else + released = refcount_release_if_gt(&object->ref_count, 2); VM_OBJECT_RUNLOCK(object); if (released) return; @@ -538,14 +565,11 @@ vm_object_deallocate(vm_object_t object) } else if (object->ref_count == 1) { if (object->shadow_count == 0 && object->handle == NULL && - (object->type == OBJT_DEFAULT || - (object->type == OBJT_SWAP && - (object->flags & OBJ_TMPFS_NODE) == 0))) { + (object->flags & OBJ_ANON) != 0) { vm_object_set_flag(object, OBJ_ONEMAPPING); } else if ((object->shadow_count == 1) && (object->handle == NULL) && - (object->type == OBJT_DEFAULT || - object->type == OBJT_SWAP)) { + (object->flags & OBJ_ANON) != 0) { vm_object_t robject; robject = LIST_FIRST(&object->shadow_head); @@ -576,10 +600,9 @@ vm_object_deallocate(vm_object_t object) * be deallocated by the thread that is * deallocating its shadow. */ - if ((robject->flags & OBJ_DEAD) == 0 && - (robject->handle == NULL) && - (robject->type == OBJT_DEFAULT || - robject->type == OBJT_SWAP)) { + if ((robject->flags & + (OBJ_DEAD | OBJ_ANON)) == OBJ_ANON && + robject->handle == NULL) { refcount_acquire(&robject->ref_count); retry: @@ -1049,8 +1072,8 @@ vm_object_advice_applies(vm_object_t object, int advic return (false); if (advice != MADV_FREE) return (true); - return ((object->type == OBJT_DEFAULT || object->type == OBJT_SWAP) && - (object->flags & OBJ_ONEMAPPING) != 0); + return ((object->flags & (OBJ_ONEMAPPING | OBJ_ANON)) == + (OBJ_ONEMAPPING | OBJ_ANON)); } static void @@ -1211,23 +1234,20 @@ vm_object_shadow( /* * Don't create the new object if the old object isn't shared. + * + * If we hold the only reference we can guarantee that it won't + * increase while we have the map locked. Otherwise the race is + * harmless and we will end up with an extra shadow object that + * will be collapsed later. */ - if (source != NULL) { - VM_OBJECT_RLOCK(source); - if (source->ref_count == 1 && - source->handle == NULL && - (source->type == OBJT_DEFAULT || - source->type == OBJT_SWAP)) { - VM_OBJECT_RUNLOCK(source); - return; - } - VM_OBJECT_RUNLOCK(source); - } + if (source != NULL && source->ref_count == 1 && + source->handle == NULL && (source->flags & OBJ_ANON) != 0) + return; /* * Allocate a new object with the given length. */ - result = vm_object_allocate(OBJT_DEFAULT, atop(length)); + result = vm_object_allocate_anon(atop(length)); /* * The new object shadows the source object, adding a reference to it. @@ -1282,7 +1302,7 @@ vm_object_split(vm_map_entry_t entry) vm_size_t size; orig_object = entry->object.vm_object; - if (orig_object->type != OBJT_DEFAULT && orig_object->type != OBJT_SWAP) + if ((orig_object->flags & OBJ_ANON) == 0) return; if (orig_object->ref_count <= 1) return; @@ -1295,7 +1315,7 @@ vm_object_split(vm_map_entry_t entry) * If swap_pager_copy() is later called, it will convert new_object * into a swap object. */ - new_object = vm_object_allocate(OBJT_DEFAULT, size); + new_object = vm_object_allocate_anon(size); /* * At this point, the new object is still private, so the order in @@ -1443,8 +1463,7 @@ vm_object_scan_all_shadowed(vm_object_t object) backing_object = object->backing_object; - if (backing_object->type != OBJT_DEFAULT && - backing_object->type != OBJT_SWAP) + if ((backing_object->flags & OBJ_ANON) == 0) return (false); pi = backing_offset_index = OFF_TO_IDX(object->backing_object_offset); @@ -1668,15 +1687,13 @@ vm_object_collapse(vm_object_t object) * we check the backing object first, because it is most likely * not collapsable. */ + if ((backing_object->flags & OBJ_ANON) == 0) + break; VM_OBJECT_WLOCK(backing_object); if (backing_object->handle != NULL || - (backing_object->type != OBJT_DEFAULT && - backing_object->type != OBJT_SWAP) || - (backing_object->flags & (OBJ_DEAD | OBJ_NOSPLIT)) != 0 || + (backing_object->flags & OBJ_DEAD) != 0 || object->handle != NULL || - (object->type != OBJT_DEFAULT && - object->type != OBJT_SWAP) || - (object->flags & OBJ_DEAD)) { + (object->flags & OBJ_DEAD) != 0) { VM_OBJECT_WUNLOCK(backing_object); break; } @@ -2027,14 +2044,10 @@ vm_object_coalesce(vm_object_t prev_object, vm_ooffset if (prev_object == NULL) return (TRUE); - VM_OBJECT_WLOCK(prev_object); - if ((prev_object->type != OBJT_DEFAULT && - prev_object->type != OBJT_SWAP) || - (prev_object->flags & OBJ_NOSPLIT) != 0) { - VM_OBJECT_WUNLOCK(prev_object); + if ((prev_object->flags & OBJ_ANON) == 0) return (FALSE); - } + VM_OBJECT_WLOCK(prev_object); /* * Try to collapse the object first */ Modified: head/sys/vm/vm_object.h ============================================================================== --- head/sys/vm/vm_object.h Tue Nov 19 23:12:43 2019 (r354868) +++ head/sys/vm/vm_object.h Tue Nov 19 23:19:43 2019 (r354869) @@ -185,7 +185,7 @@ struct vm_object { #define OBJ_UNMANAGED 0x0002 /* (c) contains unmanaged pages */ #define OBJ_POPULATE 0x0004 /* pager implements populate() */ #define OBJ_DEAD 0x0008 /* dead objects (during rundown) */ -#define OBJ_NOSPLIT 0x0010 /* dont split this object */ +#define OBJ_ANON 0x0010 /* (c) contains anonymous memory */ #define OBJ_UMTXDEAD 0x0020 /* umtx pshared was terminated */ #define OBJ_SIZEVNLOCK 0x0040 /* lock vnode to check obj size */ #define OBJ_PG_DTOR 0x0080 /* dont reset object, leave that for dtor */ @@ -340,6 +340,7 @@ void umtx_shm_object_terminated(vm_object_t object); extern int umtx_shm_vnobj_persistent; vm_object_t vm_object_allocate (objtype_t, vm_pindex_t); +vm_object_t vm_object_allocate_anon(vm_pindex_t); boolean_t vm_object_coalesce(vm_object_t, vm_ooffset_t, vm_size_t, vm_size_t, boolean_t); void vm_object_collapse (vm_object_t); Modified: head/sys/vm/vm_reserv.c ============================================================================== --- head/sys/vm/vm_reserv.c Tue Nov 19 23:12:43 2019 (r354868) +++ head/sys/vm/vm_reserv.c Tue Nov 19 23:19:43 2019 (r354869) @@ -719,20 +719,15 @@ out: /* * Would the last new reservation extend past the end of the object? + * + * If the object is unlikely to grow don't allocate a reservation for + * the tail. */ - if (first + maxpages > object->size) { - /* - * Don't allocate the last new reservation if the object is a - * vnode or backed by another object that is a vnode. - */ - if (object->type == OBJT_VNODE || - (object->backing_object != NULL && - object->backing_object->type == OBJT_VNODE)) { - if (maxpages == VM_LEVEL_0_NPAGES) - return (NULL); - allocpages = minpages; - } - /* Speculate that the object may grow. */ + if ((object->flags & OBJ_ANON) == 0 && + first + maxpages > object->size) { + if (maxpages == VM_LEVEL_0_NPAGES) + return (NULL); + allocpages = minpages; } /* @@ -878,19 +873,14 @@ out: vm_reserv_object_unlock(object); /* - * Would a new reservation extend past the end of the object? + * Would the last new reservation extend past the end of the object? + * + * If the object is unlikely to grow don't allocate a reservation for + * the tail. */ - if (first + VM_LEVEL_0_NPAGES > object->size) { - /* - * Don't allocate a new reservation if the object is a vnode or - * backed by another object that is a vnode. - */ - if (object->type == OBJT_VNODE || - (object->backing_object != NULL && - object->backing_object->type == OBJT_VNODE)) - return (NULL); - /* Speculate that the object may grow. */ - } + if ((object->flags & OBJ_ANON) == 0 && + first + VM_LEVEL_0_NPAGES > object->size) + return (NULL); /* * Allocate and populate the new reservation. From owner-svn-src-all@freebsd.org Tue Nov 19 23:30:10 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 8328D1C17CB; Tue, 19 Nov 2019 23:30:10 +0000 (UTC) (envelope-from jeff@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47HhrL2gTpz458R; Tue, 19 Nov 2019 23:30:10 +0000 (UTC) (envelope-from jeff@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 3E8AF19ED5; Tue, 19 Nov 2019 23:30:10 +0000 (UTC) (envelope-from jeff@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xAJNUALS073846; Tue, 19 Nov 2019 23:30:10 GMT (envelope-from jeff@FreeBSD.org) Received: (from jeff@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xAJNU9dD073843; Tue, 19 Nov 2019 23:30:09 GMT (envelope-from jeff@FreeBSD.org) Message-Id: <201911192330.xAJNU9dD073843@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jeff set sender to jeff@FreeBSD.org using -f From: Jeff Roberson Date: Tue, 19 Nov 2019 23:30:09 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354870 - head/sys/vm X-SVN-Group: head X-SVN-Commit-Author: jeff X-SVN-Commit-Paths: head/sys/vm X-SVN-Commit-Revision: 354870 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 19 Nov 2019 23:30:10 -0000 Author: jeff Date: Tue Nov 19 23:30:09 2019 New Revision: 354870 URL: https://svnweb.freebsd.org/changeset/base/354870 Log: Remove unnecessary object locking from the vnode pager. Recent changes to busy/valid/dirty locking make these acquires redundant. Reviewed by: kib, markj Differential Revision: https://reviews.freebsd.org/D22186 Modified: head/sys/vm/vm_page.c head/sys/vm/vm_page.h head/sys/vm/vnode_pager.c Modified: head/sys/vm/vm_page.c ============================================================================== --- head/sys/vm/vm_page.c Tue Nov 19 23:19:43 2019 (r354869) +++ head/sys/vm/vm_page.c Tue Nov 19 23:30:09 2019 (r354870) @@ -4527,7 +4527,7 @@ vm_page_bits(int base, int size) ((vm_page_bits_t)1 << first_bit)); } -static inline void +void vm_page_bits_set(vm_page_t m, vm_page_bits_t *bits, vm_page_bits_t set) { Modified: head/sys/vm/vm_page.h ============================================================================== --- head/sys/vm/vm_page.h Tue Nov 19 23:19:43 2019 (r354869) +++ head/sys/vm/vm_page.h Tue Nov 19 23:30:09 2019 (r354870) @@ -587,6 +587,7 @@ vm_page_t vm_page_alloc_contig_domain(vm_object_t obje vm_memattr_t memattr); vm_page_t vm_page_alloc_freelist(int, int); vm_page_t vm_page_alloc_freelist_domain(int, int, int); +void vm_page_bits_set(vm_page_t m, vm_page_bits_t *bits, vm_page_bits_t set); bool vm_page_blacklist_add(vm_paddr_t pa, bool verbose); void vm_page_change_lock(vm_page_t m, struct mtx **mtx); vm_page_t vm_page_grab (vm_object_t, vm_pindex_t, int); Modified: head/sys/vm/vnode_pager.c ============================================================================== --- head/sys/vm/vnode_pager.c Tue Nov 19 23:19:43 2019 (r354869) +++ head/sys/vm/vnode_pager.c Tue Nov 19 23:30:09 2019 (r354870) @@ -649,9 +649,7 @@ vnode_pager_input_smlfs(vm_object_t object, vm_page_t bzero((caddr_t)sf_buf_kva(sf) + i * bsize, bsize); KASSERT((m->dirty & bits) == 0, ("vnode_pager_input_smlfs: page %p is dirty", m)); - VM_OBJECT_WLOCK(object); - m->valid |= bits; - VM_OBJECT_WUNLOCK(object); + vm_page_bits_set(m, &m->valid, bits); } sf_buf_free(sf); if (error) { @@ -888,9 +886,7 @@ vnode_pager_generic_getpages(struct vnode *vp, vm_page pmap_zero_page(m[0]); KASSERT(m[0]->dirty == 0, ("%s: page %p is dirty", __func__, m[0])); - VM_OBJECT_WLOCK(object); vm_page_valid(m[0]); - VM_OBJECT_WUNLOCK(object); return (VM_PAGER_OK); } @@ -1143,7 +1139,8 @@ vnode_pager_generic_getpages_done(struct buf *bp) bp->b_data = unmapped_buf; } - VM_OBJECT_WLOCK(object); + /* Read lock to protect size. */ + VM_OBJECT_RLOCK(object); for (i = 0, tfoff = IDX_TO_OFF(bp->b_pages[0]->pindex); i < bp->b_npages; i++, tfoff = nextoff) { vm_page_t mt; @@ -1180,7 +1177,7 @@ vnode_pager_generic_getpages_done(struct buf *bp) if (i < bp->b_pgbefore || i >= bp->b_npages - bp->b_pgafter) vm_page_readahead_finish(mt); } - VM_OBJECT_WUNLOCK(object); + VM_OBJECT_RUNLOCK(object); if (error != 0) printf("%s: I/O read error %d\n", __func__, error); @@ -1304,12 +1301,6 @@ vnode_pager_generic_putpages(struct vnode *vp, vm_page */ VM_OBJECT_RLOCK(object); if (maxsize + poffset > object->un_pager.vnp.vnp_size) { - if (!VM_OBJECT_TRYUPGRADE(object)) { - VM_OBJECT_RUNLOCK(object); - VM_OBJECT_WLOCK(object); - if (maxsize + poffset <= object->un_pager.vnp.vnp_size) - goto downgrade; - } if (object->un_pager.vnp.vnp_size > poffset) { maxsize = object->un_pager.vnp.vnp_size - poffset; ncount = btoc(maxsize); @@ -1317,7 +1308,7 @@ vnode_pager_generic_putpages(struct vnode *vp, vm_page pgoff = roundup2(pgoff, DEV_BSIZE); /* - * If the object is locked and the following + * If the page is busy and the following * conditions hold, then the page's dirty * field cannot be concurrently changed by a * pmap operation. @@ -1336,9 +1327,8 @@ vnode_pager_generic_putpages(struct vnode *vp, vm_page } for (i = ncount; i < count; i++) rtvals[i] = VM_PAGER_BAD; -downgrade: - VM_OBJECT_LOCK_DOWNGRADE(object); } + VM_OBJECT_RUNLOCK(object); auio.uio_iov = &aiov; auio.uio_segflg = UIO_NOCOPY; @@ -1384,7 +1374,6 @@ start_write: */ MPASS(prev_offset < next_offset); - VM_OBJECT_RUNLOCK(object); aiov.iov_base = NULL; auio.uio_iovcnt = 1; auio.uio_offset = prev_offset; @@ -1400,7 +1389,6 @@ start_write: "zero-length write at %ju resid %zd\n", auio.uio_offset, auio.uio_resid); } - VM_OBJECT_RLOCK(object); break; } @@ -1418,7 +1406,6 @@ start_write: vn_printf(vp, "vnode_pager_putpages: residual I/O %zd " "at %ju\n", auio.uio_resid, (uintmax_t)ma[0]->pindex); - VM_OBJECT_RLOCK(object); if (error != 0 || auio.uio_resid != 0) break; } @@ -1432,7 +1419,6 @@ write_done: /* Unwritten pages in range, free bonus if the page is clean. */ for (; i < ncount; i++) rtvals[i] = ma[i]->dirty == 0 ? VM_PAGER_OK : VM_PAGER_ERROR; - VM_OBJECT_RUNLOCK(object); VM_CNT_ADD(v_vnodepgsout, i); VM_CNT_INC(v_vnodeout); return (rtvals[0]); @@ -1482,7 +1468,6 @@ vnode_pager_undirty_pages(vm_page_t *ma, int *rtvals, if (written == 0 && eof >= lpos) return; obj = ma[0]->object; - VM_OBJECT_WLOCK(obj); for (i = 0, pos = 0; pos < written; i++, pos += PAGE_SIZE) { if (pos < trunc_page(written)) { rtvals[i] = VM_PAGER_OK; @@ -1494,7 +1479,7 @@ vnode_pager_undirty_pages(vm_page_t *ma, int *rtvals, } } if (eof >= lpos) /* avoid truncation */ - goto done; + return; for (pos = eof, i = OFF_TO_IDX(trunc_page(pos)); pos < lpos; i++) { if (pos != trunc_page(pos)) { /* @@ -1523,8 +1508,6 @@ vnode_pager_undirty_pages(vm_page_t *ma, int *rtvals, pos += PAGE_SIZE; } } -done: - VM_OBJECT_WUNLOCK(obj); } static void From owner-svn-src-all@freebsd.org Wed Nov 20 00:31:15 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 4D02B1C2E02; Wed, 20 Nov 2019 00:31:15 +0000 (UTC) (envelope-from jeff@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47HkBq1LGyz47lG; Wed, 20 Nov 2019 00:31:15 +0000 (UTC) (envelope-from jeff@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 1219E1AAC0; Wed, 20 Nov 2019 00:31:15 +0000 (UTC) (envelope-from jeff@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xAK0VEcU010304; Wed, 20 Nov 2019 00:31:14 GMT (envelope-from jeff@FreeBSD.org) Received: (from jeff@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xAK0VEeH010302; Wed, 20 Nov 2019 00:31:14 GMT (envelope-from jeff@FreeBSD.org) Message-Id: <201911200031.xAK0VEeH010302@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jeff set sender to jeff@FreeBSD.org using -f From: Jeff Roberson Date: Wed, 20 Nov 2019 00:31:14 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354871 - head/sys/vm X-SVN-Group: head X-SVN-Commit-Author: jeff X-SVN-Commit-Paths: head/sys/vm X-SVN-Commit-Revision: 354871 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 20 Nov 2019 00:31:15 -0000 Author: jeff Date: Wed Nov 20 00:31:14 2019 New Revision: 354871 URL: https://svnweb.freebsd.org/changeset/base/354871 Log: Only keep anonymous objects on shadow lists. This eliminates locking of globally visible objects when they are part of a backing chain. Reviewed by: kib, markj Differential Revision: https://reviews.freebsd.org/D22423 Modified: head/sys/vm/vm_object.c head/sys/vm/vm_object.h Modified: head/sys/vm/vm_object.c ============================================================================== --- head/sys/vm/vm_object.c Tue Nov 19 23:30:09 2019 (r354870) +++ head/sys/vm/vm_object.c Wed Nov 20 00:31:14 2019 (r354871) @@ -118,6 +118,7 @@ static boolean_t vm_object_page_remove_write(vm_page_t boolean_t *allclean); static void vm_object_qcollapse(vm_object_t object); static void vm_object_vndeallocate(vm_object_t object); +static void vm_object_backing_remove(vm_object_t object); /* * Virtual memory objects maintain the actual data @@ -651,11 +652,7 @@ doterm: if (temp != NULL) { KASSERT((object->flags & OBJ_TMPFS_NODE) == 0, ("shadowed tmpfs v_object 2 %p", object)); - VM_OBJECT_WLOCK(temp); - LIST_REMOVE(object, shadow_list); - temp->shadow_count--; - VM_OBJECT_WUNLOCK(temp); - object->backing_object = NULL; + vm_object_backing_remove(object); } /* * Don't double-terminate, we could be in a termination @@ -695,6 +692,70 @@ vm_object_destroy(vm_object_t object) uma_zfree(obj_zone, object); } +static void +vm_object_backing_remove_locked(vm_object_t object) +{ + vm_object_t backing_object; + + backing_object = object->backing_object; + VM_OBJECT_ASSERT_WLOCKED(object); + VM_OBJECT_ASSERT_WLOCKED(backing_object); + + if ((object->flags & OBJ_SHADOWLIST) != 0) { + LIST_REMOVE(object, shadow_list); + backing_object->shadow_count--; + object->flags &= ~OBJ_SHADOWLIST; + } + object->backing_object = NULL; +} + +static void +vm_object_backing_remove(vm_object_t object) +{ + vm_object_t backing_object; + + VM_OBJECT_ASSERT_WLOCKED(object); + + if ((object->flags & OBJ_SHADOWLIST) != 0) { + backing_object = object->backing_object; + VM_OBJECT_WLOCK(backing_object); + vm_object_backing_remove_locked(object); + VM_OBJECT_WUNLOCK(backing_object); + } else + object->backing_object = NULL; +} + +static void +vm_object_backing_insert_locked(vm_object_t object, vm_object_t backing_object) +{ + + VM_OBJECT_ASSERT_WLOCKED(object); + + if ((backing_object->flags & OBJ_ANON) != 0) { + VM_OBJECT_ASSERT_WLOCKED(backing_object); + LIST_INSERT_HEAD(&backing_object->shadow_head, object, + shadow_list); + backing_object->shadow_count++; + object->flags |= OBJ_SHADOWLIST; + } + object->backing_object = backing_object; +} + +static void +vm_object_backing_insert(vm_object_t object, vm_object_t backing_object) +{ + + VM_OBJECT_ASSERT_WLOCKED(object); + + if ((backing_object->flags & OBJ_ANON) != 0) { + VM_OBJECT_WLOCK(backing_object); + vm_object_backing_insert_locked(object, backing_object); + VM_OBJECT_WUNLOCK(backing_object); + } else + object->backing_object = backing_object; +} + + /* * vm_object_terminate_pages removes any remaining pageable pages * from the object and resets the object to an empty state. @@ -1250,6 +1311,12 @@ vm_object_shadow( result = vm_object_allocate_anon(atop(length)); /* + * Store the offset into the source object, and fix up the offset into + * the new object. + */ + result->backing_object_offset = *offset; + + /* * The new object shadows the source object, adding a reference to it. * Our caller changes his reference to point to the new object, * removing a reference to the source object. Net result: no change @@ -1259,26 +1326,18 @@ vm_object_shadow( * in order to maintain page coloring consistency in the combined * shadowed object. */ - result->backing_object = source; - /* - * Store the offset into the source object, and fix up the offset into - * the new object. - */ - result->backing_object_offset = *offset; if (source != NULL) { - VM_OBJECT_WLOCK(source); + VM_OBJECT_WLOCK(result); + vm_object_backing_insert(result, source); result->domain = source->domain; - LIST_INSERT_HEAD(&source->shadow_head, result, shadow_list); - source->shadow_count++; #if VM_NRESERVLEVEL > 0 result->flags |= source->flags & OBJ_COLORED; result->pg_color = (source->pg_color + OFF_TO_IDX(*offset)) & ((1 << (VM_NFREEORDER - 1)) - 1); #endif - VM_OBJECT_WUNLOCK(source); + VM_OBJECT_WUNLOCK(result); } - /* * Return the new things */ @@ -1326,24 +1385,26 @@ vm_object_split(vm_map_entry_t entry) new_object->domain = orig_object->domain; source = orig_object->backing_object; if (source != NULL) { - VM_OBJECT_WLOCK(source); - if ((source->flags & OBJ_DEAD) != 0) { + if ((source->flags & (OBJ_ANON | OBJ_DEAD)) != 0) { + VM_OBJECT_WLOCK(source); + if ((source->flags & OBJ_DEAD) != 0) { + VM_OBJECT_WUNLOCK(source); + VM_OBJECT_WUNLOCK(orig_object); + VM_OBJECT_WUNLOCK(new_object); + vm_object_deallocate(new_object); + VM_OBJECT_WLOCK(orig_object); + return; + } + vm_object_backing_insert_locked(new_object, source); + vm_object_reference_locked(source); /* for new_object */ + vm_object_clear_flag(source, OBJ_ONEMAPPING); VM_OBJECT_WUNLOCK(source); - VM_OBJECT_WUNLOCK(orig_object); - VM_OBJECT_WUNLOCK(new_object); - vm_object_deallocate(new_object); - VM_OBJECT_WLOCK(orig_object); - return; + } else { + vm_object_backing_insert(new_object, source); + vm_object_reference(source); } - LIST_INSERT_HEAD(&source->shadow_head, - new_object, shadow_list); - source->shadow_count++; - vm_object_reference_locked(source); /* for new_object */ - vm_object_clear_flag(source, OBJ_ONEMAPPING); - VM_OBJECT_WUNLOCK(source); new_object->backing_object_offset = orig_object->backing_object_offset + entry->offset; - new_object->backing_object = source; } if (orig_object->cred != NULL) { new_object->cred = orig_object->cred; @@ -1756,20 +1817,15 @@ vm_object_collapse(vm_object_t object) * backing_object->backing_object moves from within * backing_object to within object. */ - LIST_REMOVE(object, shadow_list); - backing_object->shadow_count--; - if (backing_object->backing_object) { - VM_OBJECT_WLOCK(backing_object->backing_object); - LIST_REMOVE(backing_object, shadow_list); - LIST_INSERT_HEAD( - &backing_object->backing_object->shadow_head, - object, shadow_list); - /* - * The shadow_count has not changed. - */ - VM_OBJECT_WUNLOCK(backing_object->backing_object); + vm_object_backing_remove_locked(object); + new_backing_object = backing_object->backing_object; + if (new_backing_object != NULL) { + VM_OBJECT_WLOCK(new_backing_object); + vm_object_backing_remove_locked(backing_object); + vm_object_backing_insert_locked(object, + new_backing_object); + VM_OBJECT_WUNLOCK(new_backing_object); } - object->backing_object = backing_object->backing_object; object->backing_object_offset += backing_object->backing_object_offset; @@ -1807,20 +1863,13 @@ vm_object_collapse(vm_object_t object) * chain. Deallocating backing_object will not remove * it, since its reference count is at least 2. */ - LIST_REMOVE(object, shadow_list); - backing_object->shadow_count--; + vm_object_backing_remove_locked(object); new_backing_object = backing_object->backing_object; - if ((object->backing_object = new_backing_object) != NULL) { - VM_OBJECT_WLOCK(new_backing_object); - LIST_INSERT_HEAD( - &new_backing_object->shadow_head, - object, - shadow_list - ); - new_backing_object->shadow_count++; - vm_object_reference_locked(new_backing_object); - VM_OBJECT_WUNLOCK(new_backing_object); + if (new_backing_object != NULL) { + vm_object_backing_insert(object, + new_backing_object); + vm_object_reference(new_backing_object); object->backing_object_offset += backing_object->backing_object_offset; } Modified: head/sys/vm/vm_object.h ============================================================================== --- head/sys/vm/vm_object.h Tue Nov 19 23:30:09 2019 (r354870) +++ head/sys/vm/vm_object.h Wed Nov 20 00:31:14 2019 (r354871) @@ -192,6 +192,7 @@ struct vm_object { #define OBJ_TMPFS_NODE 0x0200 /* object belongs to tmpfs VREG node */ #define OBJ_COLORED 0x1000 /* pg_color is defined */ #define OBJ_ONEMAPPING 0x2000 /* One USE (a single, non-forked) mapping flag */ +#define OBJ_SHADOWLIST 0x4000 /* Object is on the shadow list. */ #define OBJ_TMPFS 0x8000 /* has tmpfs vnode allocated */ /* From owner-svn-src-all@freebsd.org Wed Nov 20 01:10:02 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 955A01C37DF; Wed, 20 Nov 2019 01:10:02 +0000 (UTC) (envelope-from mckusick@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47Hl3Z3BBHz490Z; Wed, 20 Nov 2019 01:10:02 +0000 (UTC) (envelope-from mckusick@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 43B9B1B099; Wed, 20 Nov 2019 01:10:02 +0000 (UTC) (envelope-from mckusick@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xAK1A2gm031971; Wed, 20 Nov 2019 01:10:02 GMT (envelope-from mckusick@FreeBSD.org) Received: (from mckusick@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xAK1A2wS031970; Wed, 20 Nov 2019 01:10:02 GMT (envelope-from mckusick@FreeBSD.org) Message-Id: <201911200110.xAK1A2wS031970@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mckusick set sender to mckusick@FreeBSD.org using -f From: Kirk McKusick Date: Wed, 20 Nov 2019 01:10:02 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354872 - head/sys/ufs/ffs X-SVN-Group: head X-SVN-Commit-Author: mckusick X-SVN-Commit-Paths: head/sys/ufs/ffs X-SVN-Commit-Revision: 354872 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 20 Nov 2019 01:10:02 -0000 Author: mckusick Date: Wed Nov 20 01:10:01 2019 New Revision: 354872 URL: https://svnweb.freebsd.org/changeset/base/354872 Log: Add some KASSERTs. Reacquire a mutex after a kernel printf rather than holding it during the printf. White space cleanup. Sponsored by: Netflix Modified: head/sys/ufs/ffs/ffs_softdep.c Modified: head/sys/ufs/ffs/ffs_softdep.c ============================================================================== --- head/sys/ufs/ffs/ffs_softdep.c Wed Nov 20 00:31:14 2019 (r354871) +++ head/sys/ufs/ffs/ffs_softdep.c Wed Nov 20 01:10:01 2019 (r354872) @@ -9881,6 +9881,9 @@ handle_workitem_remove(dirrem, flags) */ if ((dirrem->dm_state & RMDIR) == 0) { ip->i_nlink--; + KASSERT(ip->i_nlink >= 0, ("handle_workitem_remove: file ino " + "%ju negative i_nlink %d", (intmax_t)ip->i_number, + ip->i_nlink)); DIP_SET(ip, i_nlink, ip->i_nlink); ip->i_flag |= IN_CHANGE; if (ip->i_nlink < ip->i_effnlink) @@ -9902,6 +9905,8 @@ handle_workitem_remove(dirrem, flags) * to account for the loss of "..". */ ip->i_nlink -= 2; + KASSERT(ip->i_nlink >= 0, ("handle_workitem_remove: directory ino " + "%ju negative i_nlink %d", (intmax_t)ip->i_number, ip->i_nlink)); DIP_SET(ip, i_nlink, ip->i_nlink); ip->i_flag |= IN_CHANGE; if (ip->i_nlink < ip->i_effnlink) @@ -10802,7 +10807,6 @@ softdep_setup_inofree(mp, bp, ino, wkhd) FREE_LOCK(ump); } - /* * Called via ffs_blkfree() after a set of frags has been cleared from a cg * map. Any dependencies waiting for the write to clear are added to the @@ -12265,6 +12269,8 @@ softdep_load_inodeblock(ip) return; } ip->i_effnlink -= inodedep->id_nlinkdelta; + KASSERT(ip->i_effnlink >= 0, + ("softdep_load_inodeblock: negative i_effnlink")); FREE_LOCK(ump); } @@ -13429,9 +13435,9 @@ softdep_request_cleanup(fs, vp, cred, resource) roundup((fs->fs_dsize * fs->fs_minfree / 100) - fs->fs_cstotal.cs_nffree, fs->fs_frag)); } else { - UFS_LOCK(ump); printf("softdep_request_cleanup: Unknown resource type %d\n", resource); + UFS_LOCK(ump); return (0); } starttime = time_second; From owner-svn-src-all@freebsd.org Wed Nov 20 01:14:22 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id ED41D1C3A1D; Wed, 20 Nov 2019 01:14:22 +0000 (UTC) (envelope-from mckusick@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47Hl8Z60Dhz49NC; Wed, 20 Nov 2019 01:14:22 +0000 (UTC) (envelope-from mckusick@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id B13321B250; Wed, 20 Nov 2019 01:14:22 +0000 (UTC) (envelope-from mckusick@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xAK1EMAB037781; Wed, 20 Nov 2019 01:14:22 GMT (envelope-from mckusick@FreeBSD.org) Received: (from mckusick@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xAK1EMII037780; Wed, 20 Nov 2019 01:14:22 GMT (envelope-from mckusick@FreeBSD.org) Message-Id: <201911200114.xAK1EMII037780@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mckusick set sender to mckusick@FreeBSD.org using -f From: Kirk McKusick Date: Wed, 20 Nov 2019 01:14:22 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354873 - head/sys/sys X-SVN-Group: head X-SVN-Commit-Author: mckusick X-SVN-Commit-Paths: head/sys/sys X-SVN-Commit-Revision: 354873 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 20 Nov 2019 01:14:23 -0000 Author: mckusick Date: Wed Nov 20 01:14:22 2019 New Revision: 354873 URL: https://svnweb.freebsd.org/changeset/base/354873 Log: White space cleanup. No functional change. Sponsored by: Netflix Modified: head/sys/sys/buf.h Modified: head/sys/sys/buf.h ============================================================================== --- head/sys/sys/buf.h Wed Nov 20 01:10:01 2019 (r354872) +++ head/sys/sys/buf.h Wed Nov 20 01:14:22 2019 (r354873) @@ -262,9 +262,9 @@ struct buf { #define BX_VNDIRTY 0x00000001 /* On vnode dirty list */ #define BX_VNCLEAN 0x00000002 /* On vnode clean list */ #define BX_BKGRDWRITE 0x00000010 /* Do writes in background */ -#define BX_BKGRDMARKER 0x00000020 /* Mark buffer for splay tree */ +#define BX_BKGRDMARKER 0x00000020 /* Mark buffer for splay tree */ #define BX_ALTDATA 0x00000040 /* Holds extended data */ -#define BX_FSPRIV 0x00FF0000 /* filesystem-specific flags mask */ +#define BX_FSPRIV 0x00FF0000 /* Filesystem-specific flags mask */ #define PRINT_BUF_XFLAGS "\20\7altdata\6bkgrdmarker\5bkgrdwrite\2clean\1dirty" From owner-svn-src-all@freebsd.org Wed Nov 20 01:57:33 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id EEBA71C4646; Wed, 20 Nov 2019 01:57:33 +0000 (UTC) (envelope-from jeff@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47Hm6P5mr4z4Br7; Wed, 20 Nov 2019 01:57:33 +0000 (UTC) (envelope-from jeff@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id A95B21B996; Wed, 20 Nov 2019 01:57:33 +0000 (UTC) (envelope-from jeff@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xAK1vX2H061101; Wed, 20 Nov 2019 01:57:33 GMT (envelope-from jeff@FreeBSD.org) Received: (from jeff@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xAK1vXGB061100; Wed, 20 Nov 2019 01:57:33 GMT (envelope-from jeff@FreeBSD.org) Message-Id: <201911200157.xAK1vXGB061100@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jeff set sender to jeff@FreeBSD.org using -f From: Jeff Roberson Date: Wed, 20 Nov 2019 01:57:33 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354874 - head/sys/vm X-SVN-Group: head X-SVN-Commit-Author: jeff X-SVN-Commit-Paths: head/sys/vm X-SVN-Commit-Revision: 354874 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 20 Nov 2019 01:57:34 -0000 Author: jeff Date: Wed Nov 20 01:57:33 2019 New Revision: 354874 URL: https://svnweb.freebsd.org/changeset/base/354874 Log: When we set OFFPAGE to limit fragmentation we should also set VTOSLAB so that we avoid the hashtables. The hashtable is now only required if a zone is created with OFFPAGE specified initially, not internally. This flag signals to UMA that it can't touch the allocated memory and so can't store a slab pointer in the containing page. Reviewed by: markj Differential Revision: https://reviews.freebsd.org/D22453 Modified: head/sys/vm/uma_core.c Modified: head/sys/vm/uma_core.c ============================================================================== --- head/sys/vm/uma_core.c Wed Nov 20 01:14:22 2019 (r354873) +++ head/sys/vm/uma_core.c Wed Nov 20 01:57:33 2019 (r354874) @@ -585,7 +585,7 @@ zone_timeout(uma_zone_t zone) uma_keg_t keg; u_int slabs; - if ((zone->uz_flags & UMA_ZFLAG_CACHE) != 0) + if ((zone->uz_flags & UMA_ZONE_HASH) == 0) goto update_wss; keg = zone->uz_keg; @@ -1568,7 +1568,14 @@ keg_small_init(uma_keg_t keg) "new wasted space = %d\n", keg->uk_name, keg, wastedspace, slabsize / UMA_MAX_WASTE, keg->uk_ipers, slabsize - keg->uk_ipers * keg->uk_rsize); - keg->uk_flags |= UMA_ZONE_OFFPAGE; + /* + * If we had access to memory to embed a slab header we + * also have a page structure to use vtoslab() instead of + * hash to find slabs. If the zone was explicitly created + * OFFPAGE we can't necessarily touch the memory. + */ + if ((keg->uk_flags & UMA_ZONE_OFFPAGE) == 0) + keg->uk_flags |= UMA_ZONE_OFFPAGE | UMA_ZONE_VTOSLAB; } if ((keg->uk_flags & UMA_ZONE_OFFPAGE) && @@ -1608,7 +1615,7 @@ keg_large_init(uma_keg_t keg) * slab header. */ if ((keg->uk_flags & UMA_ZFLAG_INTERNAL) == 0) - keg->uk_flags |= UMA_ZONE_OFFPAGE; + keg->uk_flags |= UMA_ZONE_OFFPAGE | UMA_ZONE_VTOSLAB; else keg->uk_ppera++; } From owner-svn-src-all@freebsd.org Wed Nov 20 03:57:49 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 119A61C6B52; Wed, 20 Nov 2019 03:57:49 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47Hpn90Kfhz4HQL; Wed, 20 Nov 2019 03:57:49 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id C40841CF64; Wed, 20 Nov 2019 03:57:48 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xAK3vmId032202; Wed, 20 Nov 2019 03:57:48 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xAK3vl9P032195; Wed, 20 Nov 2019 03:57:47 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201911200357.xAK3vl9P032195@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Wed, 20 Nov 2019 03:57:47 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354875 - in head/sys: arm/broadcom/bcm2835 conf X-SVN-Group: head X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: in head/sys: arm/broadcom/bcm2835 conf X-SVN-Commit-Revision: 354875 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 20 Nov 2019 03:57:49 -0000 Author: kevans Date: Wed Nov 20 03:57:46 2019 New Revision: 354875 URL: https://svnweb.freebsd.org/changeset/base/354875 Log: bcm2835: push address mapping conversion for DMA/mailbox to runtime We could maintain the static conversions for the !AArch64 Raspberry Pis, but I'm not sure it's worth it -- we'll traverse the platform list exactly once (of which there are only two for armv7), then every conversion there-after traverses the memory map listing of which there are at-most two entries for these boards: sdram and peripheral space. Detecting this at runtime is necessary for the AArch64 SOC, though, because of the distinct IO windows being otherwise not discernible just from support compiled into the kernel. We currently select the correct window based on /compatible in the FDT. We also use a similar mechanism to describe the DMA restrictions- the RPi 4 can have up to 4GB of RAM while the DMA controller and mailbox mechanism can technically, kind of, only access the lowest 1GB. See the comment in bcm2835_vcbus.h for a fun description/clarification of this. Differential Revision: https://reviews.freebsd.org/D22301 Added: head/sys/arm/broadcom/bcm2835/bcm2835_vcbus.c (contents, props changed) Modified: head/sys/arm/broadcom/bcm2835/bcm2835_dma.c head/sys/arm/broadcom/bcm2835/bcm2835_ft5406.c head/sys/arm/broadcom/bcm2835/bcm2835_mbox.c head/sys/arm/broadcom/bcm2835/bcm2835_sdhci.c head/sys/arm/broadcom/bcm2835/bcm2835_vcbus.h head/sys/arm/broadcom/bcm2835/files.bcm283x head/sys/conf/files.arm64 Modified: head/sys/arm/broadcom/bcm2835/bcm2835_dma.c ============================================================================== --- head/sys/arm/broadcom/bcm2835/bcm2835_dma.c Wed Nov 20 01:57:33 2019 (r354874) +++ head/sys/arm/broadcom/bcm2835/bcm2835_dma.c Wed Nov 20 03:57:46 2019 (r354875) @@ -169,7 +169,7 @@ bcm_dmamap_cb(void *arg, bus_dma_segment_t *segs, return; addr = (bus_addr_t*)arg; - *addr = PHYS_TO_VCBUS(segs[0].ds_addr); + *addr = ARMC_TO_VCBUS(segs[0].ds_addr); } static void @@ -247,8 +247,12 @@ bcm_dma_init(device_t dev) if ((reg & bcm_dma_channel_mask) != 0) device_printf(dev, "statuses are not cleared\n"); - /* Allocate DMA chunks control blocks */ - /* p.40 of spec - control block should be 32-bit aligned */ + /* + * Allocate DMA chunks control blocks based on p.40 of the peripheral + * spec - control block should be 32-bit aligned. The DMA controller + * has a full 32-bit register dedicated to this address, so we do not + * need to bother with the per-SoC peripheral restrictions. + */ err = bus_dma_tag_create(bus_get_dma_tag(dev), 1, 0, BUS_SPACE_MAXADDR_32BIT, BUS_SPACE_MAXADDR, NULL, NULL, @@ -561,14 +565,9 @@ bcm_dma_start(int ch, vm_paddr_t src, vm_paddr_t dst, return (-1); cb = sc->sc_dma_ch[ch].cb; - if (BCM2835_ARM_IS_IO(src)) - cb->src = IO_TO_VCBUS(src); - else - cb->src = PHYS_TO_VCBUS(src); - if (BCM2835_ARM_IS_IO(dst)) - cb->dst = IO_TO_VCBUS(dst); - else - cb->dst = PHYS_TO_VCBUS(dst); + cb->src = ARMC_TO_VCBUS(src); + cb->dst = ARMC_TO_VCBUS(dst); + cb->len = len; bus_dmamap_sync(sc->sc_dma_tag, Modified: head/sys/arm/broadcom/bcm2835/bcm2835_ft5406.c ============================================================================== --- head/sys/arm/broadcom/bcm2835/bcm2835_ft5406.c Wed Nov 20 01:57:33 2019 (r354874) +++ head/sys/arm/broadcom/bcm2835/bcm2835_ft5406.c Wed Nov 20 03:57:46 2019 (r354875) @@ -227,7 +227,7 @@ ft5406ts_init(void *arg) return; } - touchbuf = VCBUS_TO_PHYS(msg.body.resp.address); + touchbuf = VCBUS_TO_ARMC(msg.body.resp.address); sc->touch_buf = (uint8_t*)pmap_mapdev(touchbuf, FT5406_WINDOW_SIZE); /* 60Hz */ Modified: head/sys/arm/broadcom/bcm2835/bcm2835_mbox.c ============================================================================== --- head/sys/arm/broadcom/bcm2835/bcm2835_mbox.c Wed Nov 20 01:57:33 2019 (r354874) +++ head/sys/arm/broadcom/bcm2835/bcm2835_mbox.c Wed Nov 20 03:57:46 2019 (r354875) @@ -303,7 +303,7 @@ bcm2835_mbox_dma_cb(void *arg, bus_dma_segment_t *segs if (err) return; addr = (bus_addr_t *)arg; - *addr = PHYS_TO_VCBUS(segs[0].ds_addr); + *addr = ARMC_TO_VCBUS(segs[0].ds_addr); } static void * @@ -314,7 +314,7 @@ bcm2835_mbox_init_dma(device_t dev, size_t len, bus_dm int err; err = bus_dma_tag_create(bus_get_dma_tag(dev), 16, 0, - BUS_SPACE_MAXADDR_32BIT, BUS_SPACE_MAXADDR, NULL, NULL, + bcm283x_dmabus_peripheral_lowaddr(), BUS_SPACE_MAXADDR, NULL, NULL, len, 1, len, 0, NULL, NULL, tag); if (err != 0) { device_printf(dev, "can't create DMA tag\n"); @@ -554,7 +554,7 @@ bcm2835_mbox_fb_init(struct bcm2835_fb_config *fb) fb->xoffset = msg.offset.body.resp.x; fb->yoffset = msg.offset.body.resp.y; fb->pitch = msg.pitch.body.resp.pitch; - fb->base = VCBUS_TO_PHYS(msg.buffer.body.resp.fb_address); + fb->base = VCBUS_TO_ARMC(msg.buffer.body.resp.fb_address); fb->size = msg.buffer.body.resp.fb_size; } Modified: head/sys/arm/broadcom/bcm2835/bcm2835_sdhci.c ============================================================================== --- head/sys/arm/broadcom/bcm2835/bcm2835_sdhci.c Wed Nov 20 01:57:33 2019 (r354874) +++ head/sys/arm/broadcom/bcm2835/bcm2835_sdhci.c Wed Nov 20 03:57:46 2019 (r354875) @@ -61,6 +61,7 @@ __FBSDID("$FreeBSD$"); #ifdef NOTYET #include #endif +#include #define BCM2835_DEFAULT_SDHCI_FREQ 50 #define BCM2838_DEFAULT_SDHCI_FREQ 100 @@ -330,7 +331,7 @@ bcm_sdhci_attach(device_t dev) /* Allocate bus_dma resources. */ err = bus_dma_tag_create(bus_get_dma_tag(dev), - 1, 0, BUS_SPACE_MAXADDR_32BIT, + 1, 0, bcm283x_dmabus_peripheral_lowaddr(), BUS_SPACE_MAXADDR, NULL, NULL, BCM_DMA_MAXSIZE, ALLOCATED_DMA_SEGS, BCM_SDHCI_BUFFER_SIZE, BUS_DMA_ALLOCNOW, NULL, NULL, Added: head/sys/arm/broadcom/bcm2835/bcm2835_vcbus.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/arm/broadcom/bcm2835/bcm2835_vcbus.c Wed Nov 20 03:57:46 2019 (r354875) @@ -0,0 +1,263 @@ +/*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * + * Copyright (c) 2019 Kyle Evans + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * $FreeBSD$ + */ + +#include +__FBSDID("$FreeBSD$"); + +/* + * This file contains facilities for runtime determination of address space + * mappings for use in DMA/mailbox interactions. This is only used for the + * arm64 SoC because the 32-bit SoC used the same mappings. + */ +#if defined (__aarch64__) +#include "opt_soc.h" +#endif + +#include +#include + +#include +#include +#include + +#include + +#include + +/* + * This structure describes mappings that need to take place when transforming + * ARM core addresses into vcbus addresses for use with the DMA/mailbox + * interfaces. Currently, we only deal with peripheral/SDRAM address spaces + * here. + * + * The SDRAM address space is consistently mapped starting at 0 and extends to + * the size of the installed SDRAM. + * + * Peripherals are mapped further up at spots that vary per-SOC. + */ +struct bcm283x_memory_mapping { + vm_paddr_t armc_start; + vm_paddr_t armc_size; + vm_paddr_t vcbus_start; +}; + +#if defined(SOC_BCM2835) || defined(SOC_BCM2836) +static struct bcm283x_memory_mapping bcm2835_memmap[] = { + { + /* SDRAM */ + .armc_start = 0x00000000, + .armc_size = BCM2835_ARM_IO_BASE, + .vcbus_start = BCM2835_VCBUS_SDRAM_BASE, + }, + { + /* Peripherals */ + .armc_start = BCM2835_ARM_IO_BASE, + .armc_size = BCM28XX_ARM_IO_SIZE, + .vcbus_start = BCM2835_VCBUS_IO_BASE, + }, + { 0, 0, 0 }, +}; +#endif + +#ifdef SOC_BRCM_BCM2837 +static struct bcm283x_memory_mapping bcm2837_memmap[] = { + { + /* SDRAM */ + .armc_start = 0x00000000, + .armc_size = BCM2837_ARM_IO_BASE, + .vcbus_start = BCM2837_VCBUS_SDRAM_BASE, + }, + { + /* Peripherals */ + .armc_start = BCM2837_ARM_IO_BASE, + .armc_size = BCM28XX_ARM_IO_SIZE, + .vcbus_start = BCM2837_VCBUS_IO_BASE, + }, + { 0, 0, 0 }, +}; +#endif + +#ifdef SOC_BRCM_BCM2838 + +/* + * The BCM2838 supports up to 4GB of SDRAM, but unfortunately we can still only + * map the first 1GB into the "legacy master view" (vcbus) address space. Thus, + * peripherals can still only access the lower end of SDRAM. For this reason, + * we also capture the main-peripheral busdma restriction below. + */ +static struct bcm283x_memory_mapping bcm2838_memmap[] = { + { + /* SDRAM */ + .armc_start = 0x00000000, + .armc_size = 0x40000000, + .vcbus_start = BCM2838_VCBUS_SDRAM_BASE, + }, + { + /* Main peripherals */ + .armc_start = BCM2838_ARM_IO_BASE, + .armc_size = BCM28XX_ARM_IO_SIZE, + .vcbus_start = BCM2838_VCBUS_IO_BASE, + }, + { 0, 0, 0 }, +}; +#endif + +static struct bcm283x_memory_soc_cfg { + struct bcm283x_memory_mapping *memmap; + const char *soc_compat; + bus_addr_t busdma_lowaddr; +} bcm283x_memory_configs[] = { +#ifdef SOC_BCM2835 + { + .memmap = bcm2835_memmap, + .soc_compat = "brcm,bcm2835", + .busdma_lowaddr = BUS_SPACE_MAXADDR_32BIT, + }, +#endif +#ifdef SOC_BCM2836 + { + .memmap = bcm2835_memmap, + .soc_compat = "brcm,bcm2836", + .busdma_lowaddr = BUS_SPACE_MAXADDR_32BIT, + }, + +#endif +#ifdef SOC_BRCM_BCM2837 + { + .memmap = bcm2837_memmap, + .soc_compat = "brcm,bcm2837", + .busdma_lowaddr = BUS_SPACE_MAXADDR_32BIT, + }, +#endif +#ifdef SOC_BRCM_BCM2838 + { + .memmap = bcm2838_memmap, + .soc_compat = "brcm,bcm2838", + .busdma_lowaddr = BCM2838_PERIPH_MAXADDR, + }, +#endif +}; + +static struct bcm283x_memory_soc_cfg *booted_soc_memcfg; + +static struct bcm283x_memory_soc_cfg * +bcm283x_get_current_memcfg(void) +{ + phandle_t root; + int i; + + /* We'll cache it once we decide, because it won't change per-boot. */ + if (booted_soc_memcfg != NULL) + return (booted_soc_memcfg); + + KASSERT(nitems(bcm283x_memory_configs) != 0, + ("No SOC memory configurations enabled!")); + + root = OF_finddevice("/"); + for (i = 0; i < nitems(bcm283x_memory_configs); ++i) { + booted_soc_memcfg = &bcm283x_memory_configs[i]; + printf("Checking root against %s\n", + booted_soc_memcfg->soc_compat); + if (ofw_bus_node_is_compatible(root, + booted_soc_memcfg->soc_compat)) + return (booted_soc_memcfg); + } + + /* + * The kernel doesn't fit the board; we can't really make a reasonable + * guess, as these SOC are different enough that something will blow up + * later. + */ + panic("No suitable SOC memory configuration found."); +} + +#define BCM283X_MEMMAP_ISTERM(ent) \ + ((ent)->armc_start == 0 && (ent)->armc_size == 0 && \ + (ent)->vcbus_start == 0) + +vm_paddr_t +bcm283x_armc_to_vcbus(vm_paddr_t pa) +{ + struct bcm283x_memory_soc_cfg *cfg; + struct bcm283x_memory_mapping *map, *ment; + + /* Guaranteed not NULL if we haven't panicked yet. */ + cfg = bcm283x_get_current_memcfg(); + map = cfg->memmap; + for (ment = map; !BCM283X_MEMMAP_ISTERM(ment); ++ment) { + if (pa >= ment->armc_start && + pa < ment->armc_start + ment->armc_size) { + return (pa - ment->armc_start) + ment->vcbus_start; + } + } + + /* + * Assume 1:1 mapping for anything else, but complain about it on + * verbose boots. + */ + if (bootverbose) + printf("bcm283x_vcbus: No armc -> vcbus mapping found: %jx\n", + (uintmax_t)pa); + return (pa); +} + +vm_paddr_t +bcm283x_vcbus_to_armc(vm_paddr_t vca) +{ + struct bcm283x_memory_soc_cfg *cfg; + struct bcm283x_memory_mapping *map, *ment; + + /* Guaranteed not NULL if we haven't panicked yet. */ + cfg = bcm283x_get_current_memcfg(); + map = cfg->memmap; + for (ment = map; !BCM283X_MEMMAP_ISTERM(ment); ++ment) { + if (vca >= ment->vcbus_start && + vca < ment->vcbus_start + ment->armc_size) { + return (vca - ment->vcbus_start) + ment->armc_start; + } + } + + /* + * Assume 1:1 mapping for anything else, but complain about it on + * verbose boots. + */ + if (bootverbose) + printf("bcm283x_vcbus: No vcbus -> armc mapping found: %jx\n", + (uintmax_t)vca); + return (vca); +} + +bus_addr_t +bcm283x_dmabus_peripheral_lowaddr(void) +{ + struct bcm283x_memory_soc_cfg *cfg; + + cfg = bcm283x_get_current_memcfg(); + return (cfg->busdma_lowaddr); +} Modified: head/sys/arm/broadcom/bcm2835/bcm2835_vcbus.h ============================================================================== --- head/sys/arm/broadcom/bcm2835/bcm2835_vcbus.h Wed Nov 20 01:57:33 2019 (r354874) +++ head/sys/arm/broadcom/bcm2835/bcm2835_vcbus.h Wed Nov 20 03:57:46 2019 (r354875) @@ -35,47 +35,40 @@ #ifndef _BCM2835_VCBUS_H_ #define _BCM2835_VCBUS_H_ -/* - * ARM64 define its SOC options in opt_soc.h - */ -#if defined(__aarch64__) -#include "opt_soc.h" -#endif - #define BCM2835_VCBUS_SDRAM_CACHED 0x40000000 -#define BCM2835_VCBUS_IO_BASE 0x7E000000 #define BCM2835_VCBUS_SDRAM_UNCACHED 0xC0000000 -#if defined(SOC_BCM2835) #define BCM2835_ARM_IO_BASE 0x20000000 +#define BCM2835_VCBUS_IO_BASE 0x7E000000 #define BCM2835_VCBUS_SDRAM_BASE BCM2835_VCBUS_SDRAM_CACHED -#else -#define BCM2835_ARM_IO_BASE 0x3f000000 -#define BCM2835_VCBUS_SDRAM_BASE BCM2835_VCBUS_SDRAM_UNCACHED -#endif -#define BCM2835_ARM_IO_SIZE 0x01000000 -/* - * Convert physical address to VC bus address. Should be used - * when submitting address over mailbox interface - */ -#define PHYS_TO_VCBUS(pa) ((pa) + BCM2835_VCBUS_SDRAM_BASE) +#define BCM2837_ARM_IO_BASE 0x3f000000 +#define BCM2837_VCBUS_IO_BASE BCM2835_VCBUS_IO_BASE +#define BCM2837_VCBUS_SDRAM_BASE BCM2835_VCBUS_SDRAM_UNCACHED -/* Check whether pa bellong top IO window */ -#define BCM2835_ARM_IS_IO(pa) (((pa) >= BCM2835_ARM_IO_BASE) && \ - ((pa) < BCM2835_ARM_IO_BASE + BCM2835_ARM_IO_SIZE)) +#define BCM2838_ARM_IO_BASE 0xfe000000 +#define BCM2838_VCBUS_IO_BASE BCM2835_VCBUS_IO_BASE +#define BCM2838_VCBUS_SDRAM_BASE BCM2835_VCBUS_SDRAM_UNCACHED /* - * Convert physical address in IO space to VC bus address. + * Max allowed SDRAM mapping for most peripherals. The Raspberry Pi 4 has more + * than 1 GB of SDRAM, but only the lowest 1 GB is mapped into the "Legacy + * Master view" of the address space accessible by the DMA engine. Technically, + * we can slide this window around to whatever similarly sized range is + * convenient, but this is the most useful window given how busdma(9) works and + * that the window must be reconfigured for all channels in a given DMA engine. + * The DMA lite engine's window can be configured separately from the 30-bit DMA + * engine. */ -#define IO_TO_VCBUS(pa) ((pa - BCM2835_ARM_IO_BASE) + \ - BCM2835_VCBUS_IO_BASE) +#define BCM2838_PERIPH_MAXADDR 0x3fffffff -/* - * Convert address from VC bus space to physical. Should be used - * when address is returned by VC over mailbox interface. e.g. - * framebuffer base - */ -#define VCBUS_TO_PHYS(vca) ((vca) & ~(BCM2835_VCBUS_SDRAM_BASE)) +#define BCM28XX_ARM_IO_SIZE 0x01000000 + +vm_paddr_t bcm283x_armc_to_vcbus(vm_paddr_t pa); +vm_paddr_t bcm283x_vcbus_to_armc(vm_paddr_t vca); +bus_addr_t bcm283x_dmabus_peripheral_lowaddr(void); + +#define ARMC_TO_VCBUS(pa) bcm283x_armc_to_vcbus(pa) +#define VCBUS_TO_ARMC(vca) bcm283x_vcbus_to_armc(vca) #endif /* _BCM2835_VCBUS_H_ */ Modified: head/sys/arm/broadcom/bcm2835/files.bcm283x ============================================================================== --- head/sys/arm/broadcom/bcm2835/files.bcm283x Wed Nov 20 01:57:33 2019 (r354874) +++ head/sys/arm/broadcom/bcm2835/files.bcm283x Wed Nov 20 03:57:46 2019 (r354875) @@ -14,6 +14,7 @@ arm/broadcom/bcm2835/bcm2835_rng.c optional random arm/broadcom/bcm2835/bcm2835_sdhci.c optional sdhci arm/broadcom/bcm2835/bcm2835_sdhost.c optional sdhci arm/broadcom/bcm2835/bcm2835_spi.c optional bcm2835_spi +arm/broadcom/bcm2835/bcm2835_vcbus.c standard arm/broadcom/bcm2835/bcm2835_vcio.c standard arm/broadcom/bcm2835/bcm2835_wdog.c standard arm/broadcom/bcm2835/bcm283x_dwc_fdt.c optional dwcotg fdt Modified: head/sys/conf/files.arm64 ============================================================================== --- head/sys/conf/files.arm64 Wed Nov 20 01:57:33 2019 (r354874) +++ head/sys/conf/files.arm64 Wed Nov 20 03:57:46 2019 (r354875) @@ -101,6 +101,7 @@ arm/broadcom/bcm2835/bcm2835_rng.c optional !random_l arm/broadcom/bcm2835/bcm2835_sdhci.c optional sdhci soc_brcm_bcm2837 fdt | sdhci soc_brcm_bcm2838 fdt arm/broadcom/bcm2835/bcm2835_sdhost.c optional sdhci soc_brcm_bcm2837 fdt | sdhci soc_brcm_bcm2838 fdt arm/broadcom/bcm2835/bcm2835_spi.c optional bcm2835_spi fdt +arm/broadcom/bcm2835/bcm2835_vcbus.c optional soc_brcm_bcm2837 fdt | soc_brcm_bcm2838 fdt arm/broadcom/bcm2835/bcm2835_vcio.c optional soc_brcm_bcm2837 fdt | soc_brcm_bcm2838 fdt arm/broadcom/bcm2835/bcm2835_wdog.c optional soc_brcm_bcm2837 fdt | soc_brcm_bcm2838 fdt arm/broadcom/bcm2835/bcm2836.c optional soc_brcm_bcm2837 fdt | soc_brcm_bcm2838 fdt From owner-svn-src-all@freebsd.org Wed Nov 20 05:04:44 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id E9EA11A84E4; Wed, 20 Nov 2019 05:04:44 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47HrGN54cyz4Kxf; Wed, 20 Nov 2019 05:04:44 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 92A611DBDC; Wed, 20 Nov 2019 05:04:44 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xAK54iUk072802; Wed, 20 Nov 2019 05:04:44 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xAK54iSc072801; Wed, 20 Nov 2019 05:04:44 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201911200504.xAK54iSc072801@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Wed, 20 Nov 2019 05:04:44 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354876 - head/sys/arm/broadcom/bcm2835 X-SVN-Group: head X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: head/sys/arm/broadcom/bcm2835 X-SVN-Commit-Revision: 354876 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 20 Nov 2019 05:04:45 -0000 Author: kevans Date: Wed Nov 20 05:04:44 2019 New Revision: 354876 URL: https://svnweb.freebsd.org/changeset/base/354876 Log: bcm2835_vcbus: add compatibility name for ^/sys/contrib/vchiq It's unclear how this didn't get caught in my last iteration, but the fix is easy- the interface is still compatible, it was just gratuituously renamed to match my arbitrary definition of consistency... VCBUS, the BCM2835 name, represents an address on the VideoCore CPU Bus. In a similar fashion, while it is a physical address, the ARMC portion represents that these are addresses as seen by the ARM CPU. To make things even more fun, the BCM2711 peripheral documentation describes not virtual address space vs. physical address space, but instead the 32-bit address map vs. the address map in "Low Peripheral" mode. The latter of these is what the *ARMC* macros translate to/from. Modified: head/sys/arm/broadcom/bcm2835/bcm2835_vcbus.h Modified: head/sys/arm/broadcom/bcm2835/bcm2835_vcbus.h ============================================================================== --- head/sys/arm/broadcom/bcm2835/bcm2835_vcbus.h Wed Nov 20 03:57:46 2019 (r354875) +++ head/sys/arm/broadcom/bcm2835/bcm2835_vcbus.h Wed Nov 20 05:04:44 2019 (r354876) @@ -71,4 +71,7 @@ bus_addr_t bcm283x_dmabus_peripheral_lowaddr(void); #define ARMC_TO_VCBUS(pa) bcm283x_armc_to_vcbus(pa) #define VCBUS_TO_ARMC(vca) bcm283x_vcbus_to_armc(vca) +/* Compatibility name for vchiq arm interface. */ +#define PHYS_TO_VCBUS ARMC_TO_VCBUS + #endif /* _BCM2835_VCBUS_H_ */ From owner-svn-src-all@freebsd.org Wed Nov 20 05:30:32 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 2FDC61A8DE8; Wed, 20 Nov 2019 05:30:32 +0000 (UTC) (envelope-from lwhsu@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47Hrr80YnQz4LtR; Wed, 20 Nov 2019 05:30:32 +0000 (UTC) (envelope-from lwhsu@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id EC2221DF6D; Wed, 20 Nov 2019 05:30:31 +0000 (UTC) (envelope-from lwhsu@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xAK5UVI0086077; Wed, 20 Nov 2019 05:30:31 GMT (envelope-from lwhsu@FreeBSD.org) Received: (from lwhsu@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xAK5UVda086063; Wed, 20 Nov 2019 05:30:31 GMT (envelope-from lwhsu@FreeBSD.org) Message-Id: <201911200530.xAK5UVda086063@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: lwhsu set sender to lwhsu@FreeBSD.org using -f From: Li-Wen Hsu Date: Wed, 20 Nov 2019 05:30:31 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354877 - head/contrib/netbsd-tests/usr.bin/unifdef X-SVN-Group: head X-SVN-Commit-Author: lwhsu X-SVN-Commit-Paths: head/contrib/netbsd-tests/usr.bin/unifdef X-SVN-Commit-Revision: 354877 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 20 Nov 2019 05:30:32 -0000 Author: lwhsu Date: Wed Nov 20 05:30:31 2019 New Revision: 354877 URL: https://svnweb.freebsd.org/changeset/base/354877 Log: Temporarily skip the failing test case usr.bin.unifdef.basic_test.basic PR: 242095 Sponsored by: The FreeBSD Foundation Modified: head/contrib/netbsd-tests/usr.bin/unifdef/t_basic.sh Modified: head/contrib/netbsd-tests/usr.bin/unifdef/t_basic.sh ============================================================================== --- head/contrib/netbsd-tests/usr.bin/unifdef/t_basic.sh Wed Nov 20 05:04:44 2019 (r354876) +++ head/contrib/netbsd-tests/usr.bin/unifdef/t_basic.sh Wed Nov 20 05:30:31 2019 (r354877) @@ -35,6 +35,7 @@ basic_head() { } basic_body() { + atf_skip "https://bugs.freebsd.org/242095" atf_check -s ignore -o file:$(atf_get_srcdir)/d_basic.out \ -x "unifdef -U__FreeBSD__ $(atf_get_srcdir)/d_basic.in" From owner-svn-src-all@freebsd.org Wed Nov 20 05:34:02 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id F38911A9048; Wed, 20 Nov 2019 05:34:02 +0000 (UTC) (envelope-from lwhsu@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47HrwB68K7z4MHH; Wed, 20 Nov 2019 05:34:02 +0000 (UTC) (envelope-from lwhsu@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id B6B3D1E141; Wed, 20 Nov 2019 05:34:02 +0000 (UTC) (envelope-from lwhsu@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xAK5Y2kL090463; Wed, 20 Nov 2019 05:34:02 GMT (envelope-from lwhsu@FreeBSD.org) Received: (from lwhsu@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xAK5Y2xO090462; Wed, 20 Nov 2019 05:34:02 GMT (envelope-from lwhsu@FreeBSD.org) Message-Id: <201911200534.xAK5Y2xO090462@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: lwhsu set sender to lwhsu@FreeBSD.org using -f From: Li-Wen Hsu Date: Wed, 20 Nov 2019 05:34:02 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354878 - head/contrib/netbsd-tests/usr.bin/unifdef X-SVN-Group: head X-SVN-Commit-Author: lwhsu X-SVN-Commit-Paths: head/contrib/netbsd-tests/usr.bin/unifdef X-SVN-Commit-Revision: 354878 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 20 Nov 2019 05:34:03 -0000 Author: lwhsu Date: Wed Nov 20 05:34:02 2019 New Revision: 354878 URL: https://svnweb.freebsd.org/changeset/base/354878 Log: Only skip failing test case in CI. PR: 242095 Sponsored by: The FreeBSD Foundation Modified: head/contrib/netbsd-tests/usr.bin/unifdef/t_basic.sh Modified: head/contrib/netbsd-tests/usr.bin/unifdef/t_basic.sh ============================================================================== --- head/contrib/netbsd-tests/usr.bin/unifdef/t_basic.sh Wed Nov 20 05:30:31 2019 (r354877) +++ head/contrib/netbsd-tests/usr.bin/unifdef/t_basic.sh Wed Nov 20 05:34:02 2019 (r354878) @@ -35,7 +35,9 @@ basic_head() { } basic_body() { - atf_skip "https://bugs.freebsd.org/242095" + if [ "$(atf_config_get ci false)" = "true" ]; then + atf_skip "https://bugs.freebsd.org/242095" + fi atf_check -s ignore -o file:$(atf_get_srcdir)/d_basic.out \ -x "unifdef -U__FreeBSD__ $(atf_get_srcdir)/d_basic.in" From owner-svn-src-all@freebsd.org Wed Nov 20 08:34:25 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 7CB3D1AE5A4; Wed, 20 Nov 2019 08:34:25 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47HwwK2g9Wz4VlM; Wed, 20 Nov 2019 08:34:25 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 3EB9F2014E; Wed, 20 Nov 2019 08:34:25 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xAK8YPQc096369; Wed, 20 Nov 2019 08:34:25 GMT (envelope-from avg@FreeBSD.org) Received: (from avg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xAK8YPlE096368; Wed, 20 Nov 2019 08:34:25 GMT (envelope-from avg@FreeBSD.org) Message-Id: <201911200834.xAK8YPlE096368@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avg set sender to avg@FreeBSD.org using -f From: Andriy Gapon Date: Wed, 20 Nov 2019 08:34:25 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r354879 - stable/12/sys/dev/ow X-SVN-Group: stable-12 X-SVN-Commit-Author: avg X-SVN-Commit-Paths: stable/12/sys/dev/ow X-SVN-Commit-Revision: 354879 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 20 Nov 2019 08:34:25 -0000 Author: avg Date: Wed Nov 20 08:34:24 2019 New Revision: 354879 URL: https://svnweb.freebsd.org/changeset/base/354879 Log: MFC r354180: ow(4): increase regular mode recovery time, t_rec, to 15 us Modified: stable/12/sys/dev/ow/ow.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/dev/ow/ow.c ============================================================================== --- stable/12/sys/dev/ow/ow.c Wed Nov 20 05:34:02 2019 (r354878) +++ stable/12/sys/dev/ow/ow.c Wed Nov 20 08:34:24 2019 (r354879) @@ -78,7 +78,7 @@ static struct ow_timing timing_regular = { .t_low0 = 60, /* really 60 to 120 */ .t_low1 = 1, /* really 1 to 15 */ .t_release = 45, /* <= 45us */ - .t_rec = 1, /* at least 1us */ + .t_rec = 15, /* at least 1us */ .t_rdv = 15, /* 15us */ .t_rstl = 480, /* 480us or more */ .t_rsth = 480, /* 480us or more */ From owner-svn-src-all@freebsd.org Wed Nov 20 08:35:55 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 345EA1AE67C; Wed, 20 Nov 2019 08:35:55 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47Hwy30YhNz4Vsb; Wed, 20 Nov 2019 08:35:55 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id EA5352014F; Wed, 20 Nov 2019 08:35:54 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xAK8Zslj096531; Wed, 20 Nov 2019 08:35:54 GMT (envelope-from avg@FreeBSD.org) Received: (from avg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xAK8Zsro096530; Wed, 20 Nov 2019 08:35:54 GMT (envelope-from avg@FreeBSD.org) Message-Id: <201911200835.xAK8Zsro096530@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avg set sender to avg@FreeBSD.org using -f From: Andriy Gapon Date: Wed, 20 Nov 2019 08:35:54 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r354880 - stable/12/sys/dev/ow X-SVN-Group: stable-12 X-SVN-Commit-Author: avg X-SVN-Commit-Paths: stable/12/sys/dev/ow X-SVN-Commit-Revision: 354880 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 20 Nov 2019 08:35:55 -0000 Author: avg Date: Wed Nov 20 08:35:54 2019 New Revision: 354880 URL: https://svnweb.freebsd.org/changeset/base/354880 Log: MFC r354181: ow(4): protocol timings can now be changed as sysctl-s / tunables Modified: stable/12/sys/dev/ow/ow.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/dev/ow/ow.c ============================================================================== --- stable/12/sys/dev/ow/ow.c Wed Nov 20 08:34:24 2019 (r354879) +++ stable/12/sys/dev/ow/ow.c Wed Nov 20 08:35:54 2019 (r354880) @@ -36,6 +36,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include @@ -73,34 +74,137 @@ static void ow_release_bus(device_t ndev, device_t pde static MALLOC_DEFINE(M_OW, "ow", "House keeping data for 1wire bus"); +static const struct ow_timing timing_regular_min = { + .t_slot = 60, + .t_low0 = 60, + .t_low1 = 1, + .t_release = 0, + .t_rec = 1, + .t_rdv = 15, /* fixed */ + .t_rstl = 480, + .t_rsth = 480, + .t_pdl = 60, + .t_pdh = 15, + .t_lowr = 1, +}; + +static const struct ow_timing timing_regular_max = { + .t_slot = 120, + .t_low0 = 120, + .t_low1 = 15, + .t_release = 45, + .t_rec = 960, /* infinity */ + .t_rdv = 15, /* fixed */ + .t_rstl = 960, /* infinity */ + .t_rsth = 960, /* infinity */ + .t_pdl = 240, /* 60us to 240us */ + .t_pdh = 60, /* 15us to 60us */ + .t_lowr = 15, /* 1us */ +}; + static struct ow_timing timing_regular = { - .t_slot = 60, /* 60 to 120 */ - .t_low0 = 60, /* really 60 to 120 */ - .t_low1 = 1, /* really 1 to 15 */ - .t_release = 45, /* <= 45us */ - .t_rec = 15, /* at least 1us */ - .t_rdv = 15, /* 15us */ - .t_rstl = 480, /* 480us or more */ - .t_rsth = 480, /* 480us or more */ - .t_pdl = 60, /* 60us to 240us */ - .t_pdh = 60, /* 15us to 60us */ - .t_lowr = 1, /* 1us */ + .t_slot = 60, /* 60 <= t < 120 */ + .t_low0 = 60, /* 60 <= t < t_slot < 120 */ + .t_low1 = 1, /* 1 <= t < 15 */ + .t_release = 45, /* 0 <= t < 45 */ + .t_rec = 15, /* 1 <= t < inf */ + .t_rdv = 15, /* t == 15 */ + .t_rstl = 480, /* 480 <= t < inf */ + .t_rsth = 480, /* 480 <= t < inf */ + .t_pdl = 60, /* 60 <= t < 240 */ + .t_pdh = 60, /* 15 <= t < 60 */ + .t_lowr = 1, /* 1 <= t < 15 */ }; /* NB: Untested */ +static const struct ow_timing timing_overdrive_min = { + .t_slot = 6, + .t_low0 = 6, + .t_low1 = 1, + .t_release = 0, + .t_rec = 1, + .t_rdv = 2, /* fixed */ + .t_rstl = 48, + .t_rsth = 48, + .t_pdl = 8, + .t_pdh = 2, + .t_lowr = 1, +}; + +static const struct ow_timing timing_overdrive_max = { + .t_slot = 16, + .t_low0 = 16, + .t_low1 = 2, + .t_release = 4, + .t_rec = 960, /* infinity */ + .t_rdv = 2, /* fixed */ + .t_rstl = 80, + .t_rsth = 960, /* infinity */ + .t_pdl = 24, + .t_pdh = 6, + .t_lowr = 2, +}; + static struct ow_timing timing_overdrive = { - .t_slot = 11, /* 6us to 16us */ - .t_low0 = 6, /* really 6 to 16 */ - .t_low1 = 1, /* really 1 to 2 */ - .t_release = 4, /* <= 4us */ - .t_rec = 1, /* at least 1us */ - .t_rdv = 2, /* 2us */ - .t_rstl = 48, /* 48us to 80us */ - .t_rsth = 48, /* 48us or more */ - .t_pdl = 8, /* 8us to 24us */ - .t_pdh = 2, /* 2us to 6us */ - .t_lowr = 1, /* 1us */ + .t_slot = 11, /* 6 <= t < 16 */ + .t_low0 = 6, /* 6 <= t < t_slot < 16 */ + .t_low1 = 1, /* 1 <= t < 2 */ + .t_release = 4, /* 0 <= t < 4 */ + .t_rec = 1, /* 1 <= t < inf */ + .t_rdv = 2, /* t == 2 */ + .t_rstl = 48, /* 48 <= t < 80 */ + .t_rsth = 48, /* 48 <= t < inf */ + .t_pdl = 8, /* 8 <= t < 24 */ + .t_pdh = 2, /* 2 <= t < 6 */ + .t_lowr = 1, /* 1 <= t < 2 */ }; + +SYSCTL_DECL(_hw); +SYSCTL_NODE(_hw, OID_AUTO, ow, CTLFLAG_RD, 0, "1-Wire protocol"); +SYSCTL_NODE(_hw_ow, OID_AUTO, regular, CTLFLAG_RD, 0, + "Regular mode timings"); +SYSCTL_NODE(_hw_ow, OID_AUTO, overdrive, CTLFLAG_RD, 0, + "Overdrive mode timings"); + +#define _OW_TIMING_SYSCTL(mode, param) \ + static int \ + sysctl_ow_timing_ ## mode ## _ ## param(SYSCTL_HANDLER_ARGS) \ + { \ + int val = timing_ ## mode.param; \ + int err; \ + err = sysctl_handle_int(oidp, &val, 0, req); \ + if (err != 0 || req->newptr == NULL) \ + return (err); \ + if (val < timing_ ## mode ## _min.param) \ + return (EINVAL); \ + else if (val >= timing_ ## mode ## _max.param) \ + return (EINVAL); \ + timing_ ## mode.param = val; \ + return (0); \ + } \ +SYSCTL_PROC(_hw_ow_ ## mode, OID_AUTO, param, \ + CTLTYPE_INT | CTLFLAG_RWTUN, 0, sizeof(int), \ + sysctl_ow_timing_ ## mode ## _ ## param, "I", \ + "1-Wire timing parameter in microseconds (-1 resets to default)") + +#define OW_TIMING_SYSCTL(param) \ + _OW_TIMING_SYSCTL(regular, param); \ + _OW_TIMING_SYSCTL(overdrive, param) + +OW_TIMING_SYSCTL(t_slot); +OW_TIMING_SYSCTL(t_low0); +OW_TIMING_SYSCTL(t_low1); +OW_TIMING_SYSCTL(t_release); +OW_TIMING_SYSCTL(t_rec); +OW_TIMING_SYSCTL(t_rdv); +OW_TIMING_SYSCTL(t_rstl); +OW_TIMING_SYSCTL(t_rsth); +OW_TIMING_SYSCTL(t_pdl); +OW_TIMING_SYSCTL(t_pdh); +OW_TIMING_SYSCTL(t_lowr); + +#undef _OW_TIMING_SYSCTL +#undef OW_TIMING_SYSCTL static void ow_send_byte(device_t lldev, struct ow_timing *t, uint8_t byte) From owner-svn-src-all@freebsd.org Wed Nov 20 08:37:23 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 9C0481AE70B; Wed, 20 Nov 2019 08:37:23 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47Hwzl3c81z4W0v; Wed, 20 Nov 2019 08:37:23 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 5F0D820157; Wed, 20 Nov 2019 08:37:23 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xAK8bNj2096671; Wed, 20 Nov 2019 08:37:23 GMT (envelope-from avg@FreeBSD.org) Received: (from avg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xAK8bNGh096670; Wed, 20 Nov 2019 08:37:23 GMT (envelope-from avg@FreeBSD.org) Message-Id: <201911200837.xAK8bNGh096670@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avg set sender to avg@FreeBSD.org using -f From: Andriy Gapon Date: Wed, 20 Nov 2019 08:37:23 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r354881 - stable/12/sys/dev/ow X-SVN-Group: stable-12 X-SVN-Commit-Author: avg X-SVN-Commit-Paths: stable/12/sys/dev/ow X-SVN-Commit-Revision: 354881 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 20 Nov 2019 08:37:23 -0000 Author: avg Date: Wed Nov 20 08:37:22 2019 New Revision: 354881 URL: https://svnweb.freebsd.org/changeset/base/354881 Log: MFC r354183: ow(4): clean up stray white space Modified: stable/12/sys/dev/ow/ow.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/dev/ow/ow.c ============================================================================== --- stable/12/sys/dev/ow/ow.c Wed Nov 20 08:35:54 2019 (r354880) +++ stable/12/sys/dev/ow/ow.c Wed Nov 20 08:37:22 2019 (r354881) @@ -51,7 +51,7 @@ __FBSDID("$FreeBSD$"); typedef int ow_enum_fn(device_t, device_t); typedef int ow_found_fn(device_t, romid_t); -struct ow_softc +struct ow_softc { device_t dev; /* Newbus driver back pointer */ struct mtx mtx; /* bus mutex */ @@ -210,7 +210,7 @@ static void ow_send_byte(device_t lldev, struct ow_timing *t, uint8_t byte) { int i; - + for (i = 0; i < 8; i++) if (byte & (1 << i)) OWLL_WRITE_ONE(lldev, t); @@ -224,7 +224,7 @@ ow_read_byte(device_t lldev, struct ow_timing *t, uint int i; uint8_t byte = 0; int bit; - + for (i = 0; i < 8; i++) { OWLL_READ_DATA(lldev, t, &bit); byte |= bit << i; From owner-svn-src-all@freebsd.org Wed Nov 20 08:39:21 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id B6C4E1AE806; Wed, 20 Nov 2019 08:39:21 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47Hx214RNzz4W7c; Wed, 20 Nov 2019 08:39:21 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 7BC7E2015A; Wed, 20 Nov 2019 08:39:21 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xAK8dLSF096853; Wed, 20 Nov 2019 08:39:21 GMT (envelope-from avg@FreeBSD.org) Received: (from avg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xAK8dLxC096852; Wed, 20 Nov 2019 08:39:21 GMT (envelope-from avg@FreeBSD.org) Message-Id: <201911200839.xAK8dLxC096852@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avg set sender to avg@FreeBSD.org using -f From: Andriy Gapon Date: Wed, 20 Nov 2019 08:39:21 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r354882 - stable/12/sys/dev/ow X-SVN-Group: stable-12 X-SVN-Commit-Author: avg X-SVN-Commit-Paths: stable/12/sys/dev/ow X-SVN-Commit-Revision: 354882 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 20 Nov 2019 08:39:21 -0000 Author: avg Date: Wed Nov 20 08:39:21 2019 New Revision: 354882 URL: https://svnweb.freebsd.org/changeset/base/354882 Log: MFC r354205: Remove redundant hw sysctl declaration. gcc CI complains, but clang doesn't. Modified: stable/12/sys/dev/ow/ow.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/dev/ow/ow.c ============================================================================== --- stable/12/sys/dev/ow/ow.c Wed Nov 20 08:37:22 2019 (r354881) +++ stable/12/sys/dev/ow/ow.c Wed Nov 20 08:39:21 2019 (r354882) @@ -159,7 +159,6 @@ static struct ow_timing timing_overdrive = { .t_lowr = 1, /* 1 <= t < 2 */ }; -SYSCTL_DECL(_hw); SYSCTL_NODE(_hw, OID_AUTO, ow, CTLFLAG_RD, 0, "1-Wire protocol"); SYSCTL_NODE(_hw_ow, OID_AUTO, regular, CTLFLAG_RD, 0, "Regular mode timings"); From owner-svn-src-all@freebsd.org Wed Nov 20 08:41:01 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 9E60F1AE8D9; Wed, 20 Nov 2019 08:41:01 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47Hx3x4VJPz4WHF; Wed, 20 Nov 2019 08:41:01 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 6550720189; Wed, 20 Nov 2019 08:41:01 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xAK8f192099304; Wed, 20 Nov 2019 08:41:01 GMT (envelope-from avg@FreeBSD.org) Received: (from avg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xAK8f1Ip099303; Wed, 20 Nov 2019 08:41:01 GMT (envelope-from avg@FreeBSD.org) Message-Id: <201911200841.xAK8f1Ip099303@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avg set sender to avg@FreeBSD.org using -f From: Andriy Gapon Date: Wed, 20 Nov 2019 08:41:01 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r354883 - stable/12/sys/dev/nctgpio X-SVN-Group: stable-12 X-SVN-Commit-Author: avg X-SVN-Commit-Paths: stable/12/sys/dev/nctgpio X-SVN-Commit-Revision: 354883 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 20 Nov 2019 08:41:01 -0000 Author: avg Date: Wed Nov 20 08:41:01 2019 New Revision: 354883 URL: https://svnweb.freebsd.org/changeset/base/354883 Log: MFC r353887: nctgpio: improve performance (latency) of operation Modified: stable/12/sys/dev/nctgpio/nctgpio.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/dev/nctgpio/nctgpio.c ============================================================================== --- stable/12/sys/dev/nctgpio/nctgpio.c Wed Nov 20 08:39:21 2019 (r354882) +++ stable/12/sys/dev/nctgpio/nctgpio.c Wed Nov 20 08:41:01 2019 (r354883) @@ -69,21 +69,49 @@ #define NCT_LDF_GPIO0_OUTCFG 0xe0 #define NCT_LDF_GPIO1_OUTCFG 0xe1 +/* Direct I/O port access. */ +#define NCT_IO_GSR 0 +#define NCT_IO_IOR 1 +#define NCT_IO_DAT 2 +#define NCT_IO_INV 3 #define NCT_MAX_PIN 15 #define NCT_IS_VALID_PIN(_p) ((_p) >= 0 && (_p) <= NCT_MAX_PIN) -#define NCT_PIN_BIT(_p) (1 << ((_p) % 8)) +#define NCT_PIN_BIT(_p) (1 << ((_p) & 7)) #define NCT_GPIO_CAPS (GPIO_PIN_INPUT | GPIO_PIN_OUTPUT | \ GPIO_PIN_OPENDRAIN | GPIO_PIN_PUSHPULL | \ GPIO_PIN_INVIN | GPIO_PIN_INVOUT) +/* + * Note that the values are important. + * They match actual register offsets. + */ +typedef enum { + REG_IOR = 0, + REG_DAT = 1, + REG_INV = 2, +} reg_t; + struct nct_softc { device_t dev; device_t dev_f; device_t busdev; struct mtx mtx; + struct resource *iores; + int iorid; + int curgrp; + struct { + /* direction, 1: pin is input */ + uint8_t ior[2]; + /* output value */ + uint8_t out[2]; + /* whether out is valid */ + uint8_t out_known[2]; + /* inversion, 1: pin is inverted */ + uint8_t inv[2]; + } cache; struct gpio_pin pins[NCT_MAX_PIN + 1]; }; @@ -113,97 +141,142 @@ struct nuvoton_vendor_device_id { }, }; -/* - * Get the GPIO Input/Output register address - * for a pin. - */ +static void +nct_io_set_group(struct nct_softc *sc, int group) +{ + + GPIO_ASSERT_LOCKED(sc); + if (group != sc->curgrp) { + bus_write_1(sc->iores, NCT_IO_GSR, group); + sc->curgrp = group; + } +} + static uint8_t -nct_ior_addr(uint32_t pin_num) +nct_io_read(struct nct_softc *sc, int group, uint8_t reg) { - uint8_t addr; + nct_io_set_group(sc, group); + return (bus_read_1(sc->iores, reg)); +} - addr = NCT_LD7_GPIO0_IOR; - if (pin_num > 7) - addr = NCT_LD7_GPIO1_IOR; +static void +nct_io_write(struct nct_softc *sc, int group, uint8_t reg, uint8_t val) +{ + nct_io_set_group(sc, group); + return (bus_write_1(sc->iores, reg, val)); +} - return (addr); +static uint8_t +nct_get_ioreg(struct nct_softc *sc, reg_t reg, int group) +{ + uint8_t ioreg; + + if (sc->iores != NULL) + ioreg = NCT_IO_IOR + reg; + else if (group == 0) + ioreg = NCT_LD7_GPIO0_IOR + reg; + else + ioreg = NCT_LD7_GPIO1_IOR + reg; + return (ioreg); } -/* - * Get the GPIO Data register address for a pin. - */ static uint8_t -nct_dat_addr(uint32_t pin_num) +nct_read_reg(struct nct_softc *sc, reg_t reg, int group) { - uint8_t addr; + uint8_t ioreg; + uint8_t val; - addr = NCT_LD7_GPIO0_DAT; - if (pin_num > 7) - addr = NCT_LD7_GPIO1_DAT; + ioreg = nct_get_ioreg(sc, reg, group); + if (sc->iores != NULL) + val = nct_io_read(sc, group, ioreg); + else + val = superio_read(sc->dev, ioreg); - return (addr); + return (val); } -/* - * Get the GPIO Inversion register address - * for a pin. - */ -static uint8_t -nct_inv_addr(uint32_t pin_num) +#define GET_BIT(v, b) (((v) >> (b)) & 1) +static bool +nct_get_pin_reg(struct nct_softc *sc, reg_t reg, uint32_t pin_num) { - uint8_t addr; + uint8_t bit; + uint8_t group; + uint8_t val; - addr = NCT_LD7_GPIO0_INV; - if (pin_num > 7) - addr = NCT_LD7_GPIO1_INV; + KASSERT(NCT_IS_VALID_PIN(pin_num), ("%s: invalid pin number %d", + __func__, pin_num)); - return (addr); + group = pin_num >> 3; + bit = pin_num & 7; + val = nct_read_reg(sc, reg, group); + return (GET_BIT(val, bit)); } -/* - * Get the GPIO Output Configuration/Mode - * register address for a pin. - */ -static uint8_t -nct_outcfg_addr(uint32_t pin_num) +static int +nct_get_pin_cache(struct nct_softc *sc, uint32_t pin_num, uint8_t *cache) { - uint8_t addr; + uint8_t bit; + uint8_t group; + uint8_t val; - addr = NCT_LDF_GPIO0_OUTCFG; - if (pin_num > 7) - addr = NCT_LDF_GPIO1_OUTCFG; + KASSERT(NCT_IS_VALID_PIN(pin_num), ("%s: invalid pin number %d", + __func__, pin_num)); - return (addr); + group = pin_num >> 3; + bit = pin_num & 7; + val = cache[group]; + return (GET_BIT(val, bit)); } -/* - * Set a pin to output mode. - */ static void -nct_set_pin_is_output(struct nct_softc *sc, uint32_t pin_num) +nct_write_reg(struct nct_softc *sc, reg_t reg, int group, uint8_t val) { - uint8_t reg; - uint8_t ior; + uint8_t ioreg; - reg = nct_ior_addr(pin_num); - ior = superio_read(sc->dev, reg); - ior &= ~(NCT_PIN_BIT(pin_num)); - superio_write(sc->dev, reg, ior); + ioreg = nct_get_ioreg(sc, reg, group); + if (sc->iores != NULL) + nct_io_write(sc, group, ioreg, val); + else + superio_write(sc->dev, ioreg, val); } +static void +nct_set_pin_reg(struct nct_softc *sc, reg_t reg, uint32_t pin_num, bool val) +{ + uint8_t *cache; + uint8_t bit; + uint8_t bitval; + uint8_t group; + uint8_t mask; + + KASSERT(NCT_IS_VALID_PIN(pin_num), + ("%s: invalid pin number %d", __func__, pin_num)); + KASSERT(reg == REG_IOR || reg == REG_INV, + ("%s: unsupported register %d", __func__, reg)); + + group = pin_num >> 3; + bit = pin_num & 7; + mask = (uint8_t)1 << bit; + bitval = (uint8_t)val << bit; + + if (reg == REG_IOR) + cache = &sc->cache.ior[group]; + else + cache = &sc->cache.inv[group]; + if ((*cache & mask) == bitval) + return; + *cache &= ~mask; + *cache |= bitval; + nct_write_reg(sc, reg, group, *cache); +} + /* - * Set a pin to input mode. + * Set a pin to input (val is true) or output (val is false) mode. */ static void -nct_set_pin_is_input(struct nct_softc *sc, uint32_t pin_num) +nct_set_pin_input(struct nct_softc *sc, uint32_t pin_num, bool val) { - uint8_t reg; - uint8_t ior; - - reg = nct_ior_addr(pin_num); - ior = superio_read(sc->dev, reg); - ior |= NCT_PIN_BIT(pin_num); - superio_write(sc->dev, reg, ior); + nct_set_pin_reg(sc, REG_IOR, pin_num, val); } /* @@ -212,80 +285,98 @@ nct_set_pin_is_input(struct nct_softc *sc, uint32_t pi static bool nct_pin_is_input(struct nct_softc *sc, uint32_t pin_num) { - uint8_t reg; - uint8_t ior; + return (nct_get_pin_cache(sc, pin_num, sc->cache.ior)); +} - reg = nct_ior_addr(pin_num); - ior = superio_read(sc->dev, reg); +/* + * Set a pin to inverted (val is true) or normal (val is false) mode. + */ +static void +nct_set_pin_inverted(struct nct_softc *sc, uint32_t pin_num, bool val) +{ + nct_set_pin_reg(sc, REG_INV, pin_num, val); +} - return (ior & NCT_PIN_BIT(pin_num)); +static bool +nct_pin_is_inverted(struct nct_softc *sc, uint32_t pin_num) +{ + return (nct_get_pin_cache(sc, pin_num, sc->cache.inv)); } /* * Write a value to an output pin. + * NB: the hardware remembers last output value across switching from + * output mode to input mode and back. + * Writes to a pin in input mode are not allowed here as they cannot + * have any effect and would corrupt the output value cache. */ static void -nct_write_pin(struct nct_softc *sc, uint32_t pin_num, uint8_t data) +nct_write_pin(struct nct_softc *sc, uint32_t pin_num, bool val) { - uint8_t reg; - uint8_t value; + uint8_t bit; + uint8_t group; - reg = nct_dat_addr(pin_num); - value = superio_read(sc->dev, reg); - if (data) - value |= NCT_PIN_BIT(pin_num); + KASSERT(!nct_pin_is_input(sc, pin_num), ("attempt to write input pin")); + group = pin_num >> 3; + bit = pin_num & 7; + if (GET_BIT(sc->cache.out_known[group], bit) && + GET_BIT(sc->cache.out[group], bit) == val) { + /* The pin is already in requested state. */ + return; + } + sc->cache.out_known[group] |= 1 << bit; + if (val) + sc->cache.out[group] |= 1 << bit; else - value &= ~(NCT_PIN_BIT(pin_num)); - - superio_write(sc->dev, reg, value); + sc->cache.out[group] &= ~(1 << bit); + nct_write_reg(sc, REG_DAT, group, sc->cache.out[group]); } +/* + * NB: state of an input pin cannot be cached, of course. + * For an output we can either take the value from the cache if it's valid + * or read the state from the hadrware and cache it. + */ static bool nct_read_pin(struct nct_softc *sc, uint32_t pin_num) { - uint8_t reg; + uint8_t bit; + uint8_t group; + bool val; - reg = nct_dat_addr(pin_num); + if (nct_pin_is_input(sc, pin_num)) + return (nct_get_pin_reg(sc, REG_DAT, pin_num)); - return (superio_read(sc->dev, reg) & NCT_PIN_BIT(pin_num)); -} + group = pin_num >> 3; + bit = pin_num & 7; + if (GET_BIT(sc->cache.out_known[group], bit)) + return (GET_BIT(sc->cache.out[group], bit)); -static void -nct_set_pin_is_inverted(struct nct_softc *sc, uint32_t pin_num) -{ - uint8_t reg; - uint8_t inv; - - reg = nct_inv_addr(pin_num); - inv = superio_read(sc->dev, reg); - inv |= (NCT_PIN_BIT(pin_num)); - superio_write(sc->dev, reg, inv); + val = nct_get_pin_reg(sc, REG_DAT, pin_num); + sc->cache.out_known[group] |= 1 << bit; + if (val) + sc->cache.out[group] |= 1 << bit; + else + sc->cache.out[group] &= ~(1 << bit); + return (val); } -static void -nct_set_pin_not_inverted(struct nct_softc *sc, uint32_t pin_num) +static uint8_t +nct_outcfg_addr(uint32_t pin_num) { - uint8_t reg; - uint8_t inv; - - reg = nct_inv_addr(pin_num); - inv = superio_read(sc->dev, reg); - inv &= ~(NCT_PIN_BIT(pin_num)); - superio_write(sc->dev, reg, inv); + KASSERT(NCT_IS_VALID_PIN(pin_num), ("%s: invalid pin number %d", + __func__, pin_num)); + if ((pin_num >> 3) == 0) + return (NCT_LDF_GPIO0_OUTCFG); + else + return (NCT_LDF_GPIO1_OUTCFG); } -static bool -nct_pin_is_inverted(struct nct_softc *sc, uint32_t pin_num) -{ - uint8_t reg; - uint8_t inv; - - reg = nct_inv_addr(pin_num); - inv = superio_read(sc->dev, reg); - - return (inv & NCT_PIN_BIT(pin_num)); -} - +/* + * NB: PP/OD can be configured only via configuration registers. + * Also, the registers are in a different logical device. + * So, this is a special case. No caching too. + */ static void nct_set_pin_opendrain(struct nct_softc *sc, uint32_t pin_num) { @@ -353,6 +444,9 @@ static int nct_attach(device_t dev) { struct nct_softc *sc; + device_t dev_8; + uint16_t iobase; + int err; int i; sc = device_get_softc(dev); @@ -364,12 +458,67 @@ nct_attach(device_t dev) return (ENXIO); } + /* + * As strange as it may seem, I/O port base is configured in the + * Logical Device 8 which is primarily used for WDT, but also plays + * a role in GPIO configuration. + */ + iobase = 0; + dev_8 = superio_find_dev(device_get_parent(dev), SUPERIO_DEV_WDT, 8); + if (dev_8 != NULL) + iobase = superio_get_iobase(dev_8); + if (iobase != 0 && iobase != 0xffff) { + sc->curgrp = -1; + sc->iorid = 0; + err = bus_set_resource(dev, SYS_RES_IOPORT, sc->iorid, + iobase, 7); + if (err == 0) { + sc->iores = bus_alloc_resource_any(dev, SYS_RES_IOPORT, + &sc->iorid, RF_ACTIVE); + if (sc->iores == NULL) { + device_printf(dev, "can't map i/o space, " + "iobase=0x%04x\n", iobase); + } + } else { + device_printf(dev, + "failed to set io port resource at 0x%x\n", iobase); + } + } + /* Enable gpio0 and gpio1. */ superio_dev_enable(dev, 0x03); GPIO_LOCK_INIT(sc); GPIO_LOCK(sc); + sc->cache.inv[0] = nct_read_reg(sc, REG_INV, 0); + sc->cache.inv[1] = nct_read_reg(sc, REG_INV, 1); + sc->cache.ior[0] = nct_read_reg(sc, REG_IOR, 0); + sc->cache.ior[1] = nct_read_reg(sc, REG_IOR, 1); + + /* + * Caching input values is meaningless as an input can be changed at any + * time by an external agent. But outputs are controlled by this + * driver, so it can cache their state. Also, the hardware remembers + * the output state of a pin when the pin is switched to input mode and + * then back to output mode. So, the cache stays valid. + * The only problem is with pins that are in input mode at the attach + * time. For them the output state is not known until it is set by the + * driver for the first time. + * 'out' and 'out_known' bits form a tri-state output cache: + * |-----+-----------+---------| + * | out | out_known | cache | + * |-----+-----------+---------| + * | X | 0 | invalid | + * | 0 | 1 | 0 | + * | 1 | 1 | 1 | + * |-----+-----------+---------| + */ + sc->cache.out[0] = nct_read_reg(sc, REG_DAT, 0); + sc->cache.out[1] = nct_read_reg(sc, REG_DAT, 1); + sc->cache.out_known[0] = ~sc->cache.ior[0]; + sc->cache.out_known[1] = ~sc->cache.ior[1]; + for (i = 0; i <= NCT_MAX_PIN; i++) { struct gpio_pin *pin; @@ -398,7 +547,6 @@ nct_attach(device_t dev) sc->busdev = gpiobus_attach_bus(dev); if (sc->busdev == NULL) { - GPIO_ASSERT_UNLOCKED(sc); GPIO_LOCK_DESTROY(sc); return (ENXIO); } @@ -414,6 +562,8 @@ nct_detach(device_t dev) sc = device_get_softc(dev); gpiobus_detach_bus(dev); + if (sc->iores != NULL) + bus_release_resource(dev, SYS_RES_IOPORT, sc->iorid, sc->iores); GPIO_ASSERT_UNLOCKED(sc); GPIO_LOCK_DESTROY(sc); @@ -447,8 +597,11 @@ nct_gpio_pin_set(device_t dev, uint32_t pin_num, uint3 return (EINVAL); sc = device_get_softc(dev); - GPIO_ASSERT_UNLOCKED(sc); GPIO_LOCK(sc); + if ((sc->pins[pin_num].gp_flags & GPIO_PIN_OUTPUT) == 0) { + GPIO_UNLOCK(sc); + return (EINVAL); + } nct_write_pin(sc, pin_num, pin_value); GPIO_UNLOCK(sc); @@ -483,6 +636,10 @@ nct_gpio_pin_toggle(device_t dev, uint32_t pin_num) sc = device_get_softc(dev); GPIO_ASSERT_UNLOCKED(sc); GPIO_LOCK(sc); + if ((sc->pins[pin_num].gp_flags & GPIO_PIN_OUTPUT) == 0) { + GPIO_UNLOCK(sc); + return (EINVAL); + } if (nct_read_pin(sc, pin_num)) nct_write_pin(sc, pin_num, 0); else @@ -558,53 +715,41 @@ nct_gpio_pin_setflags(device_t dev, uint32_t pin_num, if ((flags & pin->gp_caps) != flags) return (EINVAL); - GPIO_ASSERT_UNLOCKED(sc); - GPIO_LOCK(sc); - if (flags & (GPIO_PIN_INPUT | GPIO_PIN_OUTPUT)) { - if ((flags & (GPIO_PIN_INPUT | GPIO_PIN_OUTPUT)) == - (GPIO_PIN_INPUT | GPIO_PIN_OUTPUT)) { - GPIO_UNLOCK(sc); - return (EINVAL); - } - - if (flags & GPIO_PIN_INPUT) - nct_set_pin_is_input(sc, pin_num); - else - nct_set_pin_is_output(sc, pin_num); + if ((flags & (GPIO_PIN_INPUT | GPIO_PIN_OUTPUT)) == + (GPIO_PIN_INPUT | GPIO_PIN_OUTPUT)) { + return (EINVAL); } - - if (flags & (GPIO_PIN_OPENDRAIN | GPIO_PIN_PUSHPULL)) { - if (flags & GPIO_PIN_INPUT) { - GPIO_UNLOCK(sc); + if ((flags & (GPIO_PIN_OPENDRAIN | GPIO_PIN_PUSHPULL)) == + (GPIO_PIN_OPENDRAIN | GPIO_PIN_PUSHPULL)) { return (EINVAL); - } + } + if ((flags & (GPIO_PIN_INVIN | GPIO_PIN_INVOUT)) == + (GPIO_PIN_INVIN | GPIO_PIN_INVOUT)) { + return (EINVAL); + } - if ((flags & (GPIO_PIN_OPENDRAIN | GPIO_PIN_PUSHPULL)) == - (GPIO_PIN_OPENDRAIN | GPIO_PIN_PUSHPULL)) { - GPIO_UNLOCK(sc); - return (EINVAL); - } - + GPIO_ASSERT_UNLOCKED(sc); + GPIO_LOCK(sc); + if ((flags & (GPIO_PIN_INPUT | GPIO_PIN_OUTPUT)) != 0) { + nct_set_pin_input(sc, pin_num, (flags & GPIO_PIN_INPUT) != 0); + pin->gp_flags &= ~(GPIO_PIN_INPUT | GPIO_PIN_OUTPUT); + pin->gp_flags |= flags & (GPIO_PIN_INPUT | GPIO_PIN_OUTPUT); + } + if ((flags & (GPIO_PIN_INVIN | GPIO_PIN_INVOUT)) != 0) { + nct_set_pin_inverted(sc, pin_num, + (flags & GPIO_PIN_INVIN) != 0); + pin->gp_flags &= ~(GPIO_PIN_INVIN | GPIO_PIN_INVOUT); + pin->gp_flags |= flags & (GPIO_PIN_INVIN | GPIO_PIN_INVOUT); + } + if ((flags & (GPIO_PIN_OPENDRAIN | GPIO_PIN_PUSHPULL)) != 0) { if (flags & GPIO_PIN_OPENDRAIN) nct_set_pin_opendrain(sc, pin_num); else nct_set_pin_pushpull(sc, pin_num); + pin->gp_flags &= ~(GPIO_PIN_OPENDRAIN | GPIO_PIN_PUSHPULL); + pin->gp_flags |= + flags & (GPIO_PIN_OPENDRAIN | GPIO_PIN_PUSHPULL); } - - if (flags & (GPIO_PIN_INVIN | GPIO_PIN_INVOUT)) { - if ((flags & (GPIO_PIN_INVIN | GPIO_PIN_INVOUT)) != - (GPIO_PIN_INVIN | GPIO_PIN_INVOUT)) { - GPIO_UNLOCK(sc); - return (EINVAL); - } - - if (flags & GPIO_PIN_INVIN) - nct_set_pin_is_inverted(sc, pin_num); - else - nct_set_pin_not_inverted(sc, pin_num); - } - - pin->gp_flags = flags; GPIO_UNLOCK(sc); return (0); From owner-svn-src-all@freebsd.org Wed Nov 20 08:44:30 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 778EB1AEC1D; Wed, 20 Nov 2019 08:44:30 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47Hx7y2S9Zz4Wh7; Wed, 20 Nov 2019 08:44:30 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 373842030F; Wed, 20 Nov 2019 08:44:30 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xAK8iULp002554; Wed, 20 Nov 2019 08:44:30 GMT (envelope-from avg@FreeBSD.org) Received: (from avg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xAK8iTDi002550; Wed, 20 Nov 2019 08:44:29 GMT (envelope-from avg@FreeBSD.org) Message-Id: <201911200844.xAK8iTDi002550@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avg set sender to avg@FreeBSD.org using -f From: Andriy Gapon Date: Wed, 20 Nov 2019 08:44:29 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r354884 - stable/12/usr.sbin/mpsutil X-SVN-Group: stable-12 X-SVN-Commit-Author: avg X-SVN-Commit-Paths: stable/12/usr.sbin/mpsutil X-SVN-Commit-Revision: 354884 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 20 Nov 2019 08:44:30 -0000 Author: avg Date: Wed Nov 20 08:44:29 2019 New Revision: 354884 URL: https://svnweb.freebsd.org/changeset/base/354884 Log: MFC r351812: mpsutil slot set status It allows to set the status of an enclosure slot. Practically, this means controlling whatever slot status LEDs the enclosure provides. At present, the new command does not have sanity checks or any conveniences. That means that it is possible to issue the command for an invalid slot and an enclosure. But the worst I have seen happening is either the command failing or simply being ignored. Also, at the moment, the status has to be specified as a numeric bit mask. The bit definitions can be found in sys/dev/mps/mpi/mpi2_init.h, they are prefixed with MPI2_SEP_REQ_SLOTSTATUS_. The only way to address a slot is by the enclosure handle and the slot number. Both are readily available from mpsutil show commands. The new command is useful alternative to 'sas2ircu locate' command. First, sas2ircu is a proprietary blob. Second, it supports setting only locate / identify status bit. Added: stable/12/usr.sbin/mpsutil/mps_slot.c - copied unchanged from r351812, head/usr.sbin/mpsutil/mps_slot.c Modified: stable/12/usr.sbin/mpsutil/Makefile stable/12/usr.sbin/mpsutil/mps_cmd.c stable/12/usr.sbin/mpsutil/mpsutil.h Directory Properties: stable/12/ (props changed) Modified: stable/12/usr.sbin/mpsutil/Makefile ============================================================================== --- stable/12/usr.sbin/mpsutil/Makefile Wed Nov 20 08:41:01 2019 (r354883) +++ stable/12/usr.sbin/mpsutil/Makefile Wed Nov 20 08:44:29 2019 (r354884) @@ -1,7 +1,7 @@ # $FreeBSD$ PROG= mpsutil -SRCS= mps_cmd.c mps_debug.c mps_flash.c mps_show.c mpsutil.c +SRCS= mps_cmd.c mps_debug.c mps_flash.c mps_show.c mps_slot.c mpsutil.c MAN= mpsutil.8 WARNS?= 3 Modified: stable/12/usr.sbin/mpsutil/mps_cmd.c ============================================================================== --- stable/12/usr.sbin/mpsutil/mps_cmd.c Wed Nov 20 08:41:01 2019 (r354883) +++ stable/12/usr.sbin/mpsutil/mps_cmd.c Wed Nov 20 08:44:29 2019 (r354884) @@ -283,6 +283,29 @@ mps_map_btdh(int fd, uint16_t *devhandle, uint16_t *bu } int +mps_set_slot_status(int fd, U16 handle, U16 slot, U32 status) +{ + MPI2_SEP_REQUEST req; + MPI2_SEP_REPLY reply; + + bzero(&req, sizeof(req)); + req.Function = MPI2_FUNCTION_SCSI_ENCLOSURE_PROCESSOR; + req.Action = MPI2_SEP_REQ_ACTION_WRITE_STATUS; + req.Flags = MPI2_SEP_REQ_FLAGS_ENCLOSURE_SLOT_ADDRESS; + req.EnclosureHandle = handle; + req.Slot = slot; + req.SlotStatus = status; + + if (mps_pass_command(fd, &req, sizeof(req), &reply, sizeof(reply), + NULL, 0, NULL, 0, 30) != 0) + return (errno); + + if (!IOC_STATUS_SUCCESS(reply.IOCStatus)) + return (EIO); + return (0); +} + +int mps_read_config_page_header(int fd, U8 PageType, U8 PageNumber, U32 PageAddress, MPI2_CONFIG_PAGE_HEADER *header, U16 *IOCStatus) { Copied: stable/12/usr.sbin/mpsutil/mps_slot.c (from r351812, head/usr.sbin/mpsutil/mps_slot.c) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/12/usr.sbin/mpsutil/mps_slot.c Wed Nov 20 08:44:29 2019 (r354884, copy of r351812, head/usr.sbin/mpsutil/mps_slot.c) @@ -0,0 +1,114 @@ +/*- + * SPDX-License-Identifier: BSD-2-Clause + * + * Copyright (c) 2019 Andriy Gapon + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include +__RCSID("$FreeBSD$"); + +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +#include "mpsutil.h" + +MPS_TABLE(top, slot); + +static int +slot_set(int argc, char **argv) +{ + char *endptr; + unsigned long ux; + long x; + int error; + int fd; + U32 status; + U16 handle; + U16 slot; + + if (argc != 5) { + warnx("Incorrect number of arguments"); + return (EINVAL); + } + + if (strcmp(argv[1], "status") != 0) { + warnx("Invalid argument '%s', expecting 'status'", + argv[1]); + return (EINVAL); + } + + errno = 0; + x = strtol(argv[2], &endptr, 0); + if (*endptr != '\0' || errno != 0 || x < 0 || x > UINT16_MAX) { + warnx("Invalid enclosure handle argument '%s'", argv[2]); + return (EINVAL); + } + handle = x; + + errno = 0; + x = strtol(argv[3], &endptr, 0); + if (*endptr != '\0' || errno != 0 || x < 0 || x > UINT16_MAX) { + warnx("Invalid slot argument '%s'", argv[3]); + return (EINVAL); + } + slot = x; + + errno = 0; + ux = strtoul(argv[4], &endptr, 0); + if (*endptr != '\0' || errno != 0 || ux > UINT32_MAX) { + warnx("Invalid status argument '%s'", argv[4]); + return (EINVAL); + } + status = ux; + + fd = mps_open(mps_unit); + if (fd < 0) { + error = errno; + warn("mps_open"); + return (error); + } + + if (mps_set_slot_status(fd, handle, slot, status) != 0) { + warnx("Failed to set status"); + close(fd); + return (1); + } + + close(fd); + printf("Successfully set slot status\n"); + return (0); +} + +MPS_COMMAND(slot, set, slot_set, "status " + "", "Set status of the slot in the directly attached enclosure"); Modified: stable/12/usr.sbin/mpsutil/mpsutil.h ============================================================================== --- stable/12/usr.sbin/mpsutil/mpsutil.h Wed Nov 20 08:41:01 2019 (r354883) +++ stable/12/usr.sbin/mpsutil/mpsutil.h Wed Nov 20 08:44:29 2019 (r354884) @@ -128,6 +128,7 @@ int mps_map_btdh(int fd, uint16_t *devhandle, uint16_t const char *mps_ioc_status(U16 IOCStatus); int mps_firmware_send(int fd, unsigned char *buf, uint32_t len, bool bios); int mps_firmware_get(int fd, unsigned char **buf, bool bios); +int mps_set_slot_status(int fd, U16 handle, U16 slot, U32 status); static __inline void * mps_read_man_page(int fd, U8 PageNumber, U16 *IOCStatus) From owner-svn-src-all@freebsd.org Wed Nov 20 08:49:14 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id C1AA31AEFA3; Wed, 20 Nov 2019 08:49:14 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47HxFQ3QYdz4WwD; Wed, 20 Nov 2019 08:49:14 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 5989720337; Wed, 20 Nov 2019 08:49:14 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xAK8nEcp002861; Wed, 20 Nov 2019 08:49:14 GMT (envelope-from avg@FreeBSD.org) Received: (from avg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xAK8nELp002860; Wed, 20 Nov 2019 08:49:14 GMT (envelope-from avg@FreeBSD.org) Message-Id: <201911200849.xAK8nELp002860@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avg set sender to avg@FreeBSD.org using -f From: Andriy Gapon Date: Wed, 20 Nov 2019 08:49:14 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354885 - head/cddl/contrib/opensolaris/cmd/zpool X-SVN-Group: head X-SVN-Commit-Author: avg X-SVN-Commit-Paths: head/cddl/contrib/opensolaris/cmd/zpool X-SVN-Commit-Revision: 354885 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 20 Nov 2019 08:49:14 -0000 Author: avg Date: Wed Nov 20 08:49:13 2019 New Revision: 354885 URL: https://svnweb.freebsd.org/changeset/base/354885 Log: fix up r354804, resolve merge conflicts in zpool.8 Somehow I managed to commit the manual page with unresolved conflicts in it. While here, I also replaced .sp with .Pp. MFC after: 3 weeks X-MFC with: r354804 Modified: head/cddl/contrib/opensolaris/cmd/zpool/zpool.8 Modified: head/cddl/contrib/opensolaris/cmd/zpool/zpool.8 ============================================================================== --- head/cddl/contrib/opensolaris/cmd/zpool/zpool.8 Wed Nov 20 08:44:29 2019 (r354884) +++ head/cddl/contrib/opensolaris/cmd/zpool/zpool.8 Wed Nov 20 08:49:13 2019 (r354885) @@ -829,13 +829,13 @@ When a pool is determined to be active it cannot be im option. This property is intended to be used in failover configurations where multiple hosts have access to a pool on shared storage. -.sp +.Pp Multihost provides protection on import only. It does not protect against an individual device being used in multiple pools, regardless of the type of vdev. See the discussion under .Sy zpool create. -.sp +.Pp When this property is on, periodic writes to storage occur to show the pool is in use. See @@ -975,9 +975,14 @@ Discards an existing checkpoint from .Op Ar device .Xc .Pp -Clears device errors in a pool. If no arguments are specified, all device -errors within the pool are cleared. If one or more devices is specified, only -those errors associated with the specified device or devices are cleared. +Clears device errors in a pool. +If no arguments are specified, all device errors within the pool are cleared. +If one or more devices is specified, only those errors associated with the +specified device or devices are cleared. +If multihost is enabled, and the pool has been suspended, this will not +resume I/O. +While the pool was suspended, it may have been imported on +another host, and resuming I/O could result in pool damage. .Bl -tag -width indent .It Fl F Initiates recovery mode for an unopenable pool. Attempts to discard the last @@ -988,22 +993,8 @@ discarded transactions is irretrievably lost. Used in combination with the .Fl F flag. Check whether discarding transactions would make the pool openable, but -<<<<<<< do not actually discard any transactions. .El -||||||| -If no arguments are specified, all device errors within the pool are cleared. -If one or more devices is specified, only those errors associated with the -specified device or devices are cleared. -======= -If no arguments are specified, all device errors within the pool are cleared. -If one or more devices is specified, only those errors associated with the -specified device or devices are cleared. -If multihost is enabled, and the pool has been suspended, this will not -resume I/O. -While the pool was suspended, it may have been imported on -another host, and resuming I/O could result in pool damage. ->>>>>>> .It Xo .Nm .Cm create @@ -1028,15 +1019,6 @@ specification is described in the .Qq Sx Virtual Devices section. .Pp -<<<<<<< -The command verifies that each device specified is accessible and not currently -||||||| -The command verifies that each device specified is accessible and not currently -in use by another subsystem. -There are some uses, such as being currently mounted, or specified as the -dedicated dump device, that prevents a device from ever being used by ZFS. -Other uses, such as having a preexisting UFS file system, can be overridden with -======= The command attempts to verify that each device specified is accessible and not currently in use by another subsystem. However this check is not robust enough @@ -1054,18 +1036,11 @@ or do not refer to the same device. Using the same device in two pools will result in pool corruption. -.sp +.Pp There are some uses, such as being currently mounted, or specified as the dedicated dump device, that prevents a device from ever being used by ZFS. -Other uses, such as having a preexisting UFS file system, can be overridden with ->>>>>>> -in use by another subsystem. There are some uses, such as being currently -mounted, or specified as the dedicated dump device, that prevents a device from -ever being used by -.Tn ZFS -Other uses, such as having a preexisting -.Sy UFS -file system, can be overridden with the +Other uses, such as having a preexisting UFS file system, can be overridden +with the .Fl f option. .Pp @@ -1720,7 +1695,7 @@ devices in this pool are online and healthy before per Removes the specified device from the pool. This command currently only supports removing hot spares, cache, log devices and mirrored top-level vdevs (mirror of leaf devices); but not raidz. -.sp +.Pp Removing a top-level vdev reduces the total amount of space in the storage pool. The specified device will be evacuated by copying all allocated space from it to the other devices in the pool. From owner-svn-src-all@freebsd.org Wed Nov 20 08:56:02 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 8D1291AF5D5; Wed, 20 Nov 2019 08:56:02 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47HxPG3BQDz4XXF; Wed, 20 Nov 2019 08:56:02 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 517FE204ED; Wed, 20 Nov 2019 08:56:02 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xAK8u2Ej008404; Wed, 20 Nov 2019 08:56:02 GMT (envelope-from avg@FreeBSD.org) Received: (from avg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xAK8u2rC008403; Wed, 20 Nov 2019 08:56:02 GMT (envelope-from avg@FreeBSD.org) Message-Id: <201911200856.xAK8u2rC008403@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avg set sender to avg@FreeBSD.org using -f From: Andriy Gapon Date: Wed, 20 Nov 2019 08:56:02 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354886 - head/cddl/contrib/opensolaris/cmd/zpool X-SVN-Group: head X-SVN-Commit-Author: avg X-SVN-Commit-Paths: head/cddl/contrib/opensolaris/cmd/zpool X-SVN-Commit-Revision: 354886 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 20 Nov 2019 08:56:02 -0000 Author: avg Date: Wed Nov 20 08:56:01 2019 New Revision: 354886 URL: https://svnweb.freebsd.org/changeset/base/354886 Log: zpool.8: remove a paragraph about quorum disks FreeBSD has no such thing. illumos and ZoL manuals do not talk about quorum disks either. Only Oracle ZFS mentions them. MFC after: 1 week Modified: head/cddl/contrib/opensolaris/cmd/zpool/zpool.8 Modified: head/cddl/contrib/opensolaris/cmd/zpool/zpool.8 ============================================================================== --- head/cddl/contrib/opensolaris/cmd/zpool/zpool.8 Wed Nov 20 08:49:13 2019 (r354885) +++ head/cddl/contrib/opensolaris/cmd/zpool/zpool.8 Wed Nov 20 08:56:01 2019 (r354886) @@ -896,10 +896,6 @@ Displays the configuration that would be used without .Ar vdev Ns s. The actual pool creation can still fail due to insufficient privileges or device sharing. -.Pp -Do not add a disk that is currently configured as a quorum device to a zpool. -After a disk is in the pool, that disk can then be configured as a quorum -device. .El .It Xo .Nm From owner-svn-src-all@freebsd.org Wed Nov 20 10:25:50 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id DF82E1B1BDD; Wed, 20 Nov 2019 10:25:50 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47HzNt5ZlDz4cML; Wed, 20 Nov 2019 10:25:50 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id A2F982151E; Wed, 20 Nov 2019 10:25:50 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xAKAPoKU061888; Wed, 20 Nov 2019 10:25:50 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xAKAPoxm061887; Wed, 20 Nov 2019 10:25:50 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201911201025.xAKAPoxm061887@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Wed, 20 Nov 2019 10:25:50 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r354887 - stable/12/sys/amd64/amd64 X-SVN-Group: stable-12 X-SVN-Commit-Author: kib X-SVN-Commit-Paths: stable/12/sys/amd64/amd64 X-SVN-Commit-Revision: 354887 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 20 Nov 2019 10:25:50 -0000 Author: kib Date: Wed Nov 20 10:25:50 2019 New Revision: 354887 URL: https://svnweb.freebsd.org/changeset/base/354887 Log: MFC r354788: amd64 copyout: remove irrelevant comment. Modified: stable/12/sys/amd64/amd64/support.S Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/amd64/amd64/support.S ============================================================================== --- stable/12/sys/amd64/amd64/support.S Wed Nov 20 08:56:01 2019 (r354886) +++ stable/12/sys/amd64/amd64/support.S Wed Nov 20 10:25:50 2019 (r354887) @@ -671,13 +671,7 @@ END(fillw) movq $copy_fault,PCB_ONFAULT(%r11) /* - * Check explicitly for non-user addresses. If 486 write protection - * is being used, this check is essential because we are in kernel - * mode so the h/w does not provide any protection against writing - * kernel addresses. - */ - - /* + * Check explicitly for non-user addresses. * First, prevent address wrapping. */ movq %rsi,%rax From owner-svn-src-all@freebsd.org Wed Nov 20 10:27:44 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 2286B1B1C9B; Wed, 20 Nov 2019 10:27:44 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47HzR409P9z4cVJ; Wed, 20 Nov 2019 10:27:44 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id DE3F321520; Wed, 20 Nov 2019 10:27:43 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xAKARho6062019; Wed, 20 Nov 2019 10:27:43 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xAKARhRq062018; Wed, 20 Nov 2019 10:27:43 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201911201027.xAKARhRq062018@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Wed, 20 Nov 2019 10:27:43 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r354888 - stable/12/lib/libc/gen X-SVN-Group: stable-12 X-SVN-Commit-Author: kib X-SVN-Commit-Paths: stable/12/lib/libc/gen X-SVN-Commit-Revision: 354888 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 20 Nov 2019 10:27:44 -0000 Author: kib Date: Wed Nov 20 10:27:43 2019 New Revision: 354888 URL: https://svnweb.freebsd.org/changeset/base/354888 Log: MFC r354787: Document required size of buffer for elf_aux_info(3). Modified: stable/12/lib/libc/gen/auxv.3 Directory Properties: stable/12/ (props changed) Modified: stable/12/lib/libc/gen/auxv.3 ============================================================================== --- stable/12/lib/libc/gen/auxv.3 Wed Nov 20 10:25:50 2019 (r354887) +++ stable/12/lib/libc/gen/auxv.3 Wed Nov 20 10:27:43 2019 (r354888) @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd April 25, 2019 +.Dd November 17, 2019 .Dt ELF_AUX_INFO 3 .Os .Sh NAME @@ -44,24 +44,35 @@ function retrieves the auxiliary info vector requested The information is stored into the provided buffer if it will fit. The following values, defined in .In sys/elf_common.h -can be requested: +can be requested (corresponding buffer sizes are specified in parenthesis): .Bl -tag -width AT_OSRELDATE .It AT_CANARY -The canary value for SSP. +The canary value for SSP (arbitrary sized buffer, as many bytes are +returned as it fits into it, rest is zeroed). .It AT_HWCAP -CPU / hardware feature flags. +CPU / hardware feature flags +.Dv (sizeof(u_long)). .It AT_HWCAP2 -CPU / hardware feature flags. +CPU / hardware feature flags +.Dv (sizeof(u_long)). .It AT_NCPUS -Number of CPUs. +Number of CPUs +.Dv (sizeof(int)). .It AT_OSRELDATE -Kernel OSRELDATE. +The +.Dv OSRELDATE +of the kernel or jail the program is running on +.Dv (sizeof(int)). .It AT_PAGESIZES -Vector of page sizes. +Vector of page sizes (arbitrary sized buffer, as many elements of the +.Dv pagesizes +array are returned as it fits). .It AT_PAGESZ -Page size in bytes. +Page size in bytes +.Dv (sizeof(int)). .It AT_TIMEKEEP -Pointer to VDSO timehands (for library internal use). +Pointer to VDSO timehands (for library internal use, +.Dv sizeof(void *)). .El .Sh RETURN VALUES Returns zero on success, or an error number on failure. From owner-svn-src-all@freebsd.org Wed Nov 20 11:12:20 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 25CC01B3028; Wed, 20 Nov 2019 11:12:20 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47J0QW6pGbz4ff7; Wed, 20 Nov 2019 11:12:19 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id CCE1C21CE3; Wed, 20 Nov 2019 11:12:19 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xAKBCJCS091117; Wed, 20 Nov 2019 11:12:19 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xAKBCJQd091115; Wed, 20 Nov 2019 11:12:19 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201911201112.xAKBCJQd091115@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Wed, 20 Nov 2019 11:12:19 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354889 - head/sys/amd64/amd64 X-SVN-Group: head X-SVN-Commit-Author: kib X-SVN-Commit-Paths: head/sys/amd64/amd64 X-SVN-Commit-Revision: 354889 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 20 Nov 2019 11:12:20 -0000 Author: kib Date: Wed Nov 20 11:12:19 2019 New Revision: 354889 URL: https://svnweb.freebsd.org/changeset/base/354889 Log: amd64: in double fault handler, do not rely on sane gsbase value. Typical reasons for doublefault faults are either kernel stack overflow or bugs in the code that manipulates protection CPU state. The later code is the code which often has to set up gsbase for kernel. Switching to explicit load of GSBASE MSR in the fault handler makes it more probable to output a useful information. Now all IST handlers have nmi_pcpu structure on top of their stacks. It would be even more useful to save gsbase value at the moment of the fault. I did not this because I do not want to modify PCB layout now. Tested by: pho Sponsored by: The FreeBSD Foundation MFC after: 1 week Modified: head/sys/amd64/amd64/exception.S head/sys/amd64/amd64/machdep.c head/sys/amd64/amd64/mp_machdep.c Modified: head/sys/amd64/amd64/exception.S ============================================================================== --- head/sys/amd64/amd64/exception.S Wed Nov 20 10:27:43 2019 (r354888) +++ head/sys/amd64/amd64/exception.S Wed Nov 20 11:12:19 2019 (r354889) @@ -345,10 +345,11 @@ IDTVEC(dblfault) pushfq andq $~(PSL_D | PSL_AC),(%rsp) popfq - testb $SEL_RPL_MASK,TF_CS(%rsp) /* Did we come from kernel? */ - jz 1f /* already running with kernel GS.base */ - swapgs -1: lfence + movq TF_SIZE(%rsp),%rdx + movl %edx,%eax + shrq $32,%rdx + movl $MSR_GSBASE,%ecx + wrmsr movq %cr3,%rax movq %rax,PCPU(SAVED_UCR3) movq PCPU(KCR3),%rax Modified: head/sys/amd64/amd64/machdep.c ============================================================================== --- head/sys/amd64/amd64/machdep.c Wed Nov 20 10:27:43 2019 (r354888) +++ head/sys/amd64/amd64/machdep.c Wed Nov 20 11:12:19 2019 (r354889) @@ -1575,7 +1575,9 @@ amd64_bsp_ist_init(struct pcpu *pc) tssp = &pc->pc_common_tss; /* doublefault stack space, runs on ist1 */ - tssp->tss_ist1 = (long)&dblfault_stack[sizeof(dblfault_stack)]; + np = ((struct nmi_pcpu *)&dblfault_stack[sizeof(dblfault_stack)]) - 1; + np->np_pcpu = (register_t)pc; + tssp->tss_ist1 = (long)np; /* * NMI stack, runs on ist2. The pcpu pointer is stored just Modified: head/sys/amd64/amd64/mp_machdep.c ============================================================================== --- head/sys/amd64/amd64/mp_machdep.c Wed Nov 20 10:27:43 2019 (r354888) +++ head/sys/amd64/amd64/mp_machdep.c Wed Nov 20 11:12:19 2019 (r354889) @@ -314,18 +314,24 @@ init_secondary(void) IOPERM_BITMAP_SIZE; pc->pc_common_tss.tss_rsp0 = 0; - pc->pc_common_tss.tss_ist1 = (long)&doublefault_stack[PAGE_SIZE]; + /* The doublefault stack runs on IST1. */ + np = ((struct nmi_pcpu *)&doublefault_stack[PAGE_SIZE]) - 1; + np->np_pcpu = (register_t)pc; + pc->pc_common_tss.tss_ist1 = (long)np; /* The NMI stack runs on IST2. */ np = ((struct nmi_pcpu *) &nmi_stack[PAGE_SIZE]) - 1; + np->np_pcpu = (register_t)pc; pc->pc_common_tss.tss_ist2 = (long)np; /* The MC# stack runs on IST3. */ np = ((struct nmi_pcpu *) &mce_stack[PAGE_SIZE]) - 1; + np->np_pcpu = (register_t)pc; pc->pc_common_tss.tss_ist3 = (long)np; /* The DB# stack runs on IST4. */ np = ((struct nmi_pcpu *) &dbg_stack[PAGE_SIZE]) - 1; + np->np_pcpu = (register_t)pc; pc->pc_common_tss.tss_ist4 = (long)np; /* Prepare private GDT */ @@ -340,18 +346,6 @@ init_secondary(void) ap_gdt.rd_limit = NGDT * sizeof(gdt[0]) - 1; ap_gdt.rd_base = (u_long)gdt; lgdt(&ap_gdt); /* does magic intra-segment return */ - - /* Save the per-cpu pointer for use by the NMI handler. */ - np = ((struct nmi_pcpu *) &nmi_stack[PAGE_SIZE]) - 1; - np->np_pcpu = (register_t)pc; - - /* Save the per-cpu pointer for use by the MC# handler. */ - np = ((struct nmi_pcpu *) &mce_stack[PAGE_SIZE]) - 1; - np->np_pcpu = (register_t)pc; - - /* Save the per-cpu pointer for use by the DB# handler. */ - np = ((struct nmi_pcpu *) &dbg_stack[PAGE_SIZE]) - 1; - np->np_pcpu = (register_t)pc; wrmsr(MSR_FSBASE, 0); /* User value */ wrmsr(MSR_GSBASE, (u_int64_t)pc); From owner-svn-src-all@freebsd.org Wed Nov 20 12:06:00 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id C626F1B5120; Wed, 20 Nov 2019 12:06:00 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47J1cS4v5xz3FFS; Wed, 20 Nov 2019 12:06:00 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 71316226EF; Wed, 20 Nov 2019 12:06:00 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xAKC60R7021909; Wed, 20 Nov 2019 12:06:00 GMT (envelope-from mjg@FreeBSD.org) Received: (from mjg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xAKC5xfj021902; Wed, 20 Nov 2019 12:05:59 GMT (envelope-from mjg@FreeBSD.org) Message-Id: <201911201205.xAKC5xfj021902@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mjg set sender to mjg@FreeBSD.org using -f From: Mateusz Guzik Date: Wed, 20 Nov 2019 12:05:59 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354890 - in head/sys: fs/devfs kern sys X-SVN-Group: head X-SVN-Commit-Author: mjg X-SVN-Commit-Paths: in head/sys: fs/devfs kern sys X-SVN-Commit-Revision: 354890 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 20 Nov 2019 12:06:00 -0000 Author: mjg Date: Wed Nov 20 12:05:59 2019 New Revision: 354890 URL: https://svnweb.freebsd.org/changeset/base/354890 Log: vfs: change si_usecount management to count used vnodes Currently si_usecount is effectively a sum of usecounts from all associated vnodes. This is maintained by special-casing for VCHR every time usecount is modified. Apart from complicating the code a little bit, it has a scalability impact since it forces a read from a cacheline shared with said count. There are no consumers of the feature in the ports tree. In head there are only 2: revoke and devfs_close. Both can get away with a weaker requirement than the exact usecount, namely just the count of active vnodes. Changing the meaning to the latter means we only need to modify it on 0<->1 transitions, avoiding the check plenty of times (and entirely in something like vrefact). Reviewed by: kib, jeff Tested by: pho Differential Revision: https://reviews.freebsd.org/D22202 Modified: head/sys/fs/devfs/devfs_vnops.c head/sys/kern/vfs_subr.c head/sys/kern/vfs_syscalls.c head/sys/sys/conf.h Modified: head/sys/fs/devfs/devfs_vnops.c ============================================================================== --- head/sys/fs/devfs/devfs_vnops.c Wed Nov 20 11:12:19 2019 (r354889) +++ head/sys/fs/devfs/devfs_vnops.c Wed Nov 20 12:05:59 2019 (r354890) @@ -481,7 +481,7 @@ loop: vp->v_rdev = dev; KASSERT(vp->v_usecount == 1, ("%s %d (%d)\n", __func__, __LINE__, vp->v_usecount)); - dev->si_usecount += vp->v_usecount; + dev->si_usecount++; /* Special casing of ttys for deadfs. Probably redundant. */ dsw = dev->si_devsw; if (dsw != NULL && (dsw->d_flags & D_TTY) != 0) @@ -581,7 +581,7 @@ devfs_close(struct vop_close_args *ap) * if the reference count is 2 (this last descriptor * plus the session), release the reference from the session. */ - if (td != NULL) { + if (vp->v_usecount == 2 && td != NULL) { p = td->td_proc; PROC_LOCK(p); if (vp == p->p_session->s_ttyvp) { @@ -591,7 +591,7 @@ devfs_close(struct vop_close_args *ap) if (vp == p->p_session->s_ttyvp) { SESS_LOCK(p->p_session); VI_LOCK(vp); - if (count_dev(dev) == 2 && + if (vp->v_usecount == 2 && vcount(vp) == 1 && (vp->v_iflag & VI_DOOMED) == 0) { p->p_session->s_ttyvp = NULL; p->p_session->s_ttydp = NULL; @@ -620,19 +620,19 @@ devfs_close(struct vop_close_args *ap) return (ENXIO); dflags = 0; VI_LOCK(vp); + if (vp->v_usecount == 1 && vcount(vp) == 1) + dflags |= FLASTCLOSE; if (vp->v_iflag & VI_DOOMED) { /* Forced close. */ dflags |= FREVOKE | FNONBLOCK; } else if (dsw->d_flags & D_TRACKCLOSE) { /* Keep device updated on status. */ - } else if (count_dev(dev) > 1) { + } else if ((dflags & FLASTCLOSE) == 0) { VI_UNLOCK(vp); dev_relthread(dev, ref); return (0); } - if (count_dev(dev) == 1) - dflags |= FLASTCLOSE; - vholdl(vp); + vholdnz(vp); VI_UNLOCK(vp); vp_locked = VOP_ISLOCKED(vp); VOP_UNLOCK(vp, 0); @@ -1425,7 +1425,7 @@ devfs_reclaim_vchr(struct vop_reclaim_args *ap) dev = vp->v_rdev; vp->v_rdev = NULL; if (dev != NULL) - dev->si_usecount -= vp->v_usecount; + dev->si_usecount -= (vp->v_usecount > 0); dev_unlock(); VI_UNLOCK(vp); if (dev != NULL) Modified: head/sys/kern/vfs_subr.c ============================================================================== --- head/sys/kern/vfs_subr.c Wed Nov 20 11:12:19 2019 (r354889) +++ head/sys/kern/vfs_subr.c Wed Nov 20 12:05:59 2019 (r354890) @@ -2714,26 +2714,11 @@ _vget_prep(struct vnode *vp, bool interlock) { enum vgetstate vs; - if (__predict_true(vp->v_type != VCHR)) { - if (refcount_acquire_if_not_zero(&vp->v_usecount)) { - vs = VGET_USECOUNT; - } else { - _vhold(vp, interlock); - vs = VGET_HOLDCNT; - } + if (refcount_acquire_if_not_zero(&vp->v_usecount)) { + vs = VGET_USECOUNT; } else { - if (!interlock) - VI_LOCK(vp); - if (vp->v_usecount == 0) { - vholdl(vp); - vs = VGET_HOLDCNT; - } else { - v_incr_devcount(vp); - refcount_acquire(&vp->v_usecount); - vs = VGET_USECOUNT; - } - if (!interlock) - VI_UNLOCK(vp); + _vhold(vp, interlock); + vs = VGET_HOLDCNT; } return (vs); } @@ -2796,8 +2781,7 @@ vget_finish(struct vnode *vp, int flags, enum vgetstat * the vnode around. Otherwise someone else lended their hold count and * we have to drop ours. */ - if (vp->v_type != VCHR && - refcount_acquire_if_not_zero(&vp->v_usecount)) { + if (refcount_acquire_if_not_zero(&vp->v_usecount)) { #ifdef INVARIANTS int old = atomic_fetchadd_int(&vp->v_holdcnt, -1) - 1; VNASSERT(old > 0, vp, ("%s: wrong hold count", __func__)); @@ -2823,24 +2807,19 @@ vget_finish(struct vnode *vp, int flags, enum vgetstat * See the previous section. By the time we get here we may find * ourselves in the same spot. */ - if (vp->v_type != VCHR) { - if (refcount_acquire_if_not_zero(&vp->v_usecount)) { + if (refcount_acquire_if_not_zero(&vp->v_usecount)) { #ifdef INVARIANTS - int old = atomic_fetchadd_int(&vp->v_holdcnt, -1) - 1; - VNASSERT(old > 0, vp, ("%s: wrong hold count", __func__)); + int old = atomic_fetchadd_int(&vp->v_holdcnt, -1) - 1; + VNASSERT(old > 0, vp, ("%s: wrong hold count", __func__)); #else - refcount_release(&vp->v_holdcnt); + refcount_release(&vp->v_holdcnt); #endif - VNODE_REFCOUNT_FENCE_ACQ(); - VNASSERT((vp->v_iflag & VI_OWEINACT) == 0, vp, - ("%s: vnode with usecount and VI_OWEINACT set", - __func__)); - VI_UNLOCK(vp); - return (0); - } - } else { - if (vp->v_usecount > 0) - refcount_release(&vp->v_holdcnt); + VNODE_REFCOUNT_FENCE_ACQ(); + VNASSERT((vp->v_iflag & VI_OWEINACT) == 0, vp, + ("%s: vnode with usecount and VI_OWEINACT set", + __func__)); + VI_UNLOCK(vp); + return (0); } if ((vp->v_iflag & VI_OWEINACT) == 0) { oweinact = 0; @@ -2868,8 +2847,7 @@ vref(struct vnode *vp) ASSERT_VI_UNLOCKED(vp, __func__); CTR2(KTR_VFS, "%s: vp %p", __func__, vp); - if (vp->v_type != VCHR && - refcount_acquire_if_not_zero(&vp->v_usecount)) { + if (refcount_acquire_if_not_zero(&vp->v_usecount)) { VNODE_REFCOUNT_FENCE_ACQ(); VNASSERT(vp->v_holdcnt > 0, vp, ("%s: active vnode not held", __func__)); @@ -2888,8 +2866,7 @@ vrefl(struct vnode *vp) ASSERT_VI_LOCKED(vp, __func__); CTR2(KTR_VFS, "%s: vp %p", __func__, vp); - if (vp->v_type != VCHR && - refcount_acquire_if_not_zero(&vp->v_usecount)) { + if (refcount_acquire_if_not_zero(&vp->v_usecount)) { VNODE_REFCOUNT_FENCE_ACQ(); VNASSERT(vp->v_holdcnt > 0, vp, ("%s: active vnode not held", __func__)); @@ -2897,8 +2874,7 @@ vrefl(struct vnode *vp) ("%s: vnode with usecount and VI_OWEINACT set", __func__)); return; } - if (vp->v_usecount == 0) - vholdl(vp); + vholdl(vp); if ((vp->v_iflag & VI_OWEINACT) != 0) { vp->v_iflag &= ~VI_OWEINACT; VNODE_REFCOUNT_FENCE_REL(); @@ -2912,12 +2888,6 @@ vrefact(struct vnode *vp) { CTR2(KTR_VFS, "%s: vp %p", __func__, vp); - if (__predict_false(vp->v_type == VCHR)) { - VNASSERT(vp->v_holdcnt > 0 && vp->v_usecount > 0, vp, - ("%s: wrong ref counts", __func__)); - vref(vp); - return; - } #ifdef INVARIANTS int old = atomic_fetchadd_int(&vp->v_usecount, 1); VNASSERT(old > 0, vp, ("%s: wrong use count", __func__)); @@ -2986,31 +2956,22 @@ vputx(struct vnode *vp, int func) * We want to hold the vnode until the inactive finishes to * prevent vgone() races. We drop the use count here and the * hold count below when we're done. + * + * If we release the last usecount we take ownership of the hold + * count which provides liveness of the vnode, in which case we + * have to vdrop. */ - if (vp->v_type != VCHR) { - /* - * If we release the last usecount we take ownership of the hold - * count which provides liveness of the vnode, in which case we - * have to vdrop. - */ - if (!refcount_release(&vp->v_usecount)) - return; - VI_LOCK(vp); - /* - * By the time we got here someone else might have transitioned - * the count back to > 0. - */ - if (vp->v_usecount > 0) { - vdropl(vp); - return; - } - } else { - VI_LOCK(vp); - v_decr_devcount(vp); - if (!refcount_release(&vp->v_usecount)) { - VI_UNLOCK(vp); - return; - } + if (!refcount_release(&vp->v_usecount)) + return; + VI_LOCK(vp); + v_decr_devcount(vp); + /* + * By the time we got here someone else might have transitioned + * the count back to > 0. + */ + if (vp->v_usecount > 0) { + vdropl(vp); + return; } if (vp->v_iflag & VI_DOINGINACT) { vdropl(vp); @@ -3737,20 +3698,6 @@ vcount(struct vnode *vp) count = vp->v_rdev->si_usecount; dev_unlock(); return (count); -} - -/* - * Same as above, but using the struct cdev *as argument - */ -int -count_dev(struct cdev *dev) -{ - int count; - - dev_lock(); - count = dev->si_usecount; - dev_unlock(); - return(count); } /* Modified: head/sys/kern/vfs_syscalls.c ============================================================================== --- head/sys/kern/vfs_syscalls.c Wed Nov 20 11:12:19 2019 (r354889) +++ head/sys/kern/vfs_syscalls.c Wed Nov 20 12:05:59 2019 (r354890) @@ -4148,7 +4148,7 @@ sys_revoke(struct thread *td, struct revoke_args *uap) if (error != 0) goto out; } - if (vcount(vp) > 1) + if (vp->v_usecount > 1 || vcount(vp) > 1) VOP_REVOKE(vp, REVOKEALL); out: vput(vp); Modified: head/sys/sys/conf.h ============================================================================== --- head/sys/sys/conf.h Wed Nov 20 11:12:19 2019 (r354889) +++ head/sys/sys/conf.h Wed Nov 20 12:05:59 2019 (r354890) @@ -256,7 +256,6 @@ void make_dev_args_init_impl(struct make_dev_args *_ar #define make_dev_args_init(a) \ make_dev_args_init_impl((a), sizeof(struct make_dev_args)) -int count_dev(struct cdev *_dev); void delist_dev(struct cdev *_dev); void destroy_dev(struct cdev *_dev); int destroy_dev_sched(struct cdev *dev); From owner-svn-src-all@freebsd.org Wed Nov 20 12:06:29 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id EC9921B51B3; Wed, 20 Nov 2019 12:06:29 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47J1d1622Rz3FNf; Wed, 20 Nov 2019 12:06:29 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id B32FE226F3; Wed, 20 Nov 2019 12:06:29 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xAKC6T0t021971; Wed, 20 Nov 2019 12:06:29 GMT (envelope-from mjg@FreeBSD.org) Received: (from mjg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xAKC6TKj021970; Wed, 20 Nov 2019 12:06:29 GMT (envelope-from mjg@FreeBSD.org) Message-Id: <201911201206.xAKC6TKj021970@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mjg set sender to mjg@FreeBSD.org using -f From: Mateusz Guzik Date: Wed, 20 Nov 2019 12:06:29 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354891 - head/sys/compat/linux X-SVN-Group: head X-SVN-Commit-Author: mjg X-SVN-Commit-Paths: head/sys/compat/linux X-SVN-Commit-Revision: 354891 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 20 Nov 2019 12:06:30 -0000 Author: mjg Date: Wed Nov 20 12:06:29 2019 New Revision: 354891 URL: https://svnweb.freebsd.org/changeset/base/354891 Log: linux: avoid overhead of P_CONTROLT checks if possible Sponsored by: The FreeBSD Foundation Modified: head/sys/compat/linux/linux_file.c Modified: head/sys/compat/linux/linux_file.c ============================================================================== --- head/sys/compat/linux/linux_file.c Wed Nov 20 12:05:59 2019 (r354890) +++ head/sys/compat/linux/linux_file.c Wed Nov 20 12:06:29 2019 (r354891) @@ -137,6 +137,8 @@ linux_common_open(struct thread *td, int dirfd, char * error = ELOOP; goto done; } + if (p->p_flag & P_CONTROLT) + goto done; if (bsd_flags & O_NOCTTY) goto done; From owner-svn-src-all@freebsd.org Wed Nov 20 12:07:54 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id EA6A51B529F; Wed, 20 Nov 2019 12:07:54 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47J1ff5qPhz3FXR; Wed, 20 Nov 2019 12:07:54 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id AC839226F4; Wed, 20 Nov 2019 12:07:54 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xAKC7sU9022080; Wed, 20 Nov 2019 12:07:54 GMT (envelope-from mjg@FreeBSD.org) Received: (from mjg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xAKC7s4J022079; Wed, 20 Nov 2019 12:07:54 GMT (envelope-from mjg@FreeBSD.org) Message-Id: <201911201207.xAKC7s4J022079@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mjg set sender to mjg@FreeBSD.org using -f From: Mateusz Guzik Date: Wed, 20 Nov 2019 12:07:54 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354892 - head/sys/kern X-SVN-Group: head X-SVN-Commit-Author: mjg X-SVN-Commit-Paths: head/sys/kern X-SVN-Commit-Revision: 354892 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 20 Nov 2019 12:07:55 -0000 Author: mjg Date: Wed Nov 20 12:07:54 2019 New Revision: 354892 URL: https://svnweb.freebsd.org/changeset/base/354892 Log: vfs: perform a more racy check in vfs_notify_upper Locking mp does not buy anything interms of correctness and only contributes to contention. Modified: head/sys/kern/vfs_subr.c Modified: head/sys/kern/vfs_subr.c ============================================================================== --- head/sys/kern/vfs_subr.c Wed Nov 20 12:06:29 2019 (r354891) +++ head/sys/kern/vfs_subr.c Wed Nov 20 12:07:54 2019 (r354892) @@ -3526,11 +3526,9 @@ vfs_notify_upper(struct vnode *vp, int event) mp = vp->v_mount; if (mp == NULL) return; - - MNT_ILOCK(mp); if (TAILQ_EMPTY(&mp->mnt_uppers)) - goto unlock; - MNT_IUNLOCK(mp); + return; + mmp = malloc(sizeof(struct mount), M_TEMP, M_WAITOK | M_ZERO); mmp->mnt_op = &vgonel_vfsops; mmp->mnt_kern_flag |= MNTK_MARKER; @@ -3564,7 +3562,6 @@ vfs_notify_upper(struct vnode *vp, int event) mp->mnt_kern_flag &= ~MNTK_VGONE_WAITER; wakeup(&mp->mnt_uppers); } -unlock: MNT_IUNLOCK(mp); } From owner-svn-src-all@freebsd.org Wed Nov 20 12:08:32 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id B5E211B533F; Wed, 20 Nov 2019 12:08:32 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47J1gN4QfSz3Fhw; Wed, 20 Nov 2019 12:08:32 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 7B60A226F6; Wed, 20 Nov 2019 12:08:32 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xAKC8WbJ022152; Wed, 20 Nov 2019 12:08:32 GMT (envelope-from mjg@FreeBSD.org) Received: (from mjg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xAKC8Whq022151; Wed, 20 Nov 2019 12:08:32 GMT (envelope-from mjg@FreeBSD.org) Message-Id: <201911201208.xAKC8Whq022151@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mjg set sender to mjg@FreeBSD.org using -f From: Mateusz Guzik Date: Wed, 20 Nov 2019 12:08:32 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354893 - head/sys/kern X-SVN-Group: head X-SVN-Commit-Author: mjg X-SVN-Commit-Paths: head/sys/kern X-SVN-Commit-Revision: 354893 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 20 Nov 2019 12:08:32 -0000 Author: mjg Date: Wed Nov 20 12:08:32 2019 New Revision: 354893 URL: https://svnweb.freebsd.org/changeset/base/354893 Log: cache: minor stat cleanup Remove duplicated stats and move numcachehv from debug to vfs.cache. Modified: head/sys/kern/vfs_cache.c Modified: head/sys/kern/vfs_cache.c ============================================================================== --- head/sys/kern/vfs_cache.c Wed Nov 20 12:07:54 2019 (r354892) +++ head/sys/kern/vfs_cache.c Wed Nov 20 12:08:32 2019 (r354893) @@ -204,14 +204,8 @@ static u_long __read_mostly ncnegfactor = 5; /* ratio SYSCTL_ULONG(_vfs, OID_AUTO, ncnegfactor, CTLFLAG_RW, &ncnegfactor, 0, "Ratio of negative namecache entries"); static u_long __exclusive_cache_line numneg; /* number of negative entries allocated */ -SYSCTL_ULONG(_debug, OID_AUTO, numneg, CTLFLAG_RD, &numneg, 0, - "Number of negative entries in namecache"); static u_long __exclusive_cache_line numcache;/* number of cache entries allocated */ -SYSCTL_ULONG(_debug, OID_AUTO, numcache, CTLFLAG_RD, &numcache, 0, - "Number of namecache entries"); static u_long __exclusive_cache_line numcachehv;/* number of cache entries with vnodes held */ -SYSCTL_ULONG(_debug, OID_AUTO, numcachehv, CTLFLAG_RD, &numcachehv, 0, - "Number of namecache entries with vnodes held"); u_int ncsizefactor = 2; SYSCTL_UINT(_vfs, OID_AUTO, ncsizefactor, CTLFLAG_RW, &ncsizefactor, 0, "Size factor for namecache"); @@ -356,6 +350,7 @@ static SYSCTL_NODE(_vfs, OID_AUTO, cache, CTLFLAG_RW, SYSCTL_COUNTER_U64(_vfs_cache, OID_AUTO, name, CTLFLAG_RD, &name, descr); STATNODE_ULONG(numneg, "Number of negative cache entries"); STATNODE_ULONG(numcache, "Number of cache entries"); +STATNODE_ULONG(numcachehv, "Number of namecache entries with vnodes held"); STATNODE_COUNTER(numcalls, "Number of cache lookups"); STATNODE_COUNTER(dothits, "Number of '.' hits"); STATNODE_COUNTER(dotdothits, "Number of '..' hits"); From owner-svn-src-all@freebsd.org Wed Nov 20 14:37:49 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 875431B881F; Wed, 20 Nov 2019 14:37:49 +0000 (UTC) (envelope-from andrew@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47J4zd3gcyz3NnK; Wed, 20 Nov 2019 14:37:49 +0000 (UTC) (envelope-from andrew@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4809C241CB; Wed, 20 Nov 2019 14:37:49 +0000 (UTC) (envelope-from andrew@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xAKEbnHn010922; Wed, 20 Nov 2019 14:37:49 GMT (envelope-from andrew@FreeBSD.org) Received: (from andrew@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xAKEbnYI010920; Wed, 20 Nov 2019 14:37:49 GMT (envelope-from andrew@FreeBSD.org) Message-Id: <201911201437.xAKEbnYI010920@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: andrew set sender to andrew@FreeBSD.org using -f From: Andrew Turner Date: Wed, 20 Nov 2019 14:37:49 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354894 - in head/sys: kern sys X-SVN-Group: head X-SVN-Commit-Author: andrew X-SVN-Commit-Paths: in head/sys: kern sys X-SVN-Commit-Revision: 354894 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 20 Nov 2019 14:37:49 -0000 Author: andrew Date: Wed Nov 20 14:37:48 2019 New Revision: 354894 URL: https://svnweb.freebsd.org/changeset/base/354894 Log: Import the NetBSD Kernel Concurrency Sanitizer (KCSAN) runtime. KCSAN is a tool to find concurrent memory access that may race each other. After a determined number of memory accesses a cell is created, this describes the current access. It will then delay for a short period to allow other CPUs a chance to race. If another CPU performs a memory access to an overlapping region during this delay the race is reported. This is a straight import of the NetBSD code, it will be adapted to FreeBSD in a future commit. Sponsored by: DARPA, AFRL Added: head/sys/kern/subr_csan.c (contents, props changed) head/sys/sys/csan.h (contents, props changed) Added: head/sys/kern/subr_csan.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/kern/subr_csan.c Wed Nov 20 14:37:48 2019 (r354894) @@ -0,0 +1,754 @@ +/* $NetBSD: subr_csan.c,v 1.5 2019/11/15 08:11:37 maxv Exp $ */ + +/* + * Copyright (c) 2019 The NetBSD Foundation, Inc. + * All rights reserved. + * + * This code is derived from software contributed to The NetBSD Foundation + * by Maxime Villard. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS + * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +#include +__KERNEL_RCSID(0, "$NetBSD: subr_csan.c,v 1.5 2019/11/15 08:11:37 maxv Exp $"); + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#ifdef KCSAN_PANIC +#define REPORT panic +#else +#define REPORT printf +#endif + +typedef struct { + uintptr_t addr; + uint32_t size; + bool write:1; + bool atomic:1; + uintptr_t pc; +} csan_cell_t; + +typedef struct { + bool inited; + uint32_t cnt; + csan_cell_t cell; +} csan_cpu_t; + +static csan_cpu_t kcsan_cpus[MAXCPUS]; +static bool kcsan_enabled __read_mostly; + +#define __RET_ADDR (uintptr_t)__builtin_return_address(0) + +#define KCSAN_NACCESSES 1024 +#define KCSAN_DELAY 10 /* 10 microseconds */ + +/* -------------------------------------------------------------------------- */ + +/* The MD code. */ +#include + +/* -------------------------------------------------------------------------- */ + +void +kcsan_init(void) +{ + kcsan_enabled = true; +} + +void +kcsan_cpu_init(struct cpu_info *ci) +{ + kcsan_cpus[cpu_index(ci)].inited = true; +} + +/* -------------------------------------------------------------------------- */ + +static inline void +kcsan_report(csan_cell_t *new, cpuid_t newcpu, csan_cell_t *old, cpuid_t oldcpu) +{ + const char *newsym, *oldsym; + + if (ksyms_getname(NULL, &newsym, (vaddr_t)new->pc, KSYMS_PROC) != 0) { + newsym = "Unknown"; + } + if (ksyms_getname(NULL, &oldsym, (vaddr_t)old->pc, KSYMS_PROC) != 0) { + oldsym = "Unknown"; + } + REPORT("CSan: Racy Access " + "[Cpu%lu %s%s Addr=%p Size=%u PC=%p<%s>] " + "[Cpu%lu %s%s Addr=%p Size=%u PC=%p<%s>]\n", + newcpu, + (new->atomic ? "Atomic " : ""), (new->write ? "Write" : "Read"), + (void *)new->addr, new->size, (void *)new->pc, newsym, + oldcpu, + (old->atomic ? "Atomic " : ""), (old->write ? "Write" : "Read"), + (void *)old->addr, old->size, (void *)old->pc, oldsym); + kcsan_md_unwind(); +} + +static inline bool +kcsan_access_is_atomic(csan_cell_t *new, csan_cell_t *old) +{ + if (new->write && !new->atomic) + return false; + if (old->write && !old->atomic) + return false; + return true; +} + +static inline void +kcsan_access(uintptr_t addr, size_t size, bool write, bool atomic, uintptr_t pc) +{ + csan_cell_t old, new; + csan_cpu_t *cpu; + uint64_t intr; + size_t i; + + if (__predict_false(!kcsan_enabled)) + return; + if (__predict_false(kcsan_md_unsupported((vaddr_t)addr))) + return; + + new.addr = addr; + new.size = size; + new.write = write; + new.atomic = atomic; + new.pc = pc; + + for (i = 0; i < ncpu; i++) { + __builtin_memcpy(&old, &kcsan_cpus[i].cell, sizeof(old)); + + if (old.addr + old.size <= new.addr) + continue; + if (new.addr + new.size <= old.addr) + continue; + if (__predict_true(!old.write && !new.write)) + continue; + if (__predict_true(kcsan_access_is_atomic(&new, &old))) + continue; + + kcsan_report(&new, cpu_number(), &old, i); + break; + } + + if (__predict_false(!kcsan_md_is_avail())) + return; + + kcsan_md_disable_intrs(&intr); + + cpu = &kcsan_cpus[cpu_number()]; + if (__predict_false(!cpu->inited)) + goto out; + cpu->cnt = (cpu->cnt + 1) % KCSAN_NACCESSES; + if (__predict_true(cpu->cnt != 0)) + goto out; + + __builtin_memcpy(&cpu->cell, &new, sizeof(new)); + kcsan_md_delay(KCSAN_DELAY); + __builtin_memset(&cpu->cell, 0, sizeof(new)); + +out: + kcsan_md_enable_intrs(&intr); +} + +#define CSAN_READ(size) \ + void __tsan_read##size(uintptr_t); \ + void __tsan_read##size(uintptr_t addr) \ + { \ + kcsan_access(addr, size, false, false, __RET_ADDR); \ + } + +CSAN_READ(1) +CSAN_READ(2) +CSAN_READ(4) +CSAN_READ(8) +CSAN_READ(16) + +#define CSAN_WRITE(size) \ + void __tsan_write##size(uintptr_t); \ + void __tsan_write##size(uintptr_t addr) \ + { \ + kcsan_access(addr, size, true, false, __RET_ADDR); \ + } + +CSAN_WRITE(1) +CSAN_WRITE(2) +CSAN_WRITE(4) +CSAN_WRITE(8) +CSAN_WRITE(16) + +void __tsan_read_range(uintptr_t, size_t); +void __tsan_write_range(uintptr_t, size_t); + +void +__tsan_read_range(uintptr_t addr, size_t size) +{ + kcsan_access(addr, size, false, false, __RET_ADDR); +} + +void +__tsan_write_range(uintptr_t addr, size_t size) +{ + kcsan_access(addr, size, true, false, __RET_ADDR); +} + +void __tsan_init(void); +void __tsan_func_entry(void *); +void __tsan_func_exit(void); + +void +__tsan_init(void) +{ +} + +void +__tsan_func_entry(void *call_pc) +{ +} + +void +__tsan_func_exit(void) +{ +} + +/* -------------------------------------------------------------------------- */ + +void * +kcsan_memcpy(void *dst, const void *src, size_t len) +{ + kcsan_access((uintptr_t)src, len, false, false, __RET_ADDR); + kcsan_access((uintptr_t)dst, len, true, false, __RET_ADDR); + return __builtin_memcpy(dst, src, len); +} + +int +kcsan_memcmp(const void *b1, const void *b2, size_t len) +{ + kcsan_access((uintptr_t)b1, len, false, false, __RET_ADDR); + kcsan_access((uintptr_t)b2, len, false, false, __RET_ADDR); + return __builtin_memcmp(b1, b2, len); +} + +void * +kcsan_memset(void *b, int c, size_t len) +{ + kcsan_access((uintptr_t)b, len, true, false, __RET_ADDR); + return __builtin_memset(b, c, len); +} + +void * +kcsan_memmove(void *dst, const void *src, size_t len) +{ + kcsan_access((uintptr_t)src, len, false, false, __RET_ADDR); + kcsan_access((uintptr_t)dst, len, true, false, __RET_ADDR); + return __builtin_memmove(dst, src, len); +} + +char * +kcsan_strcpy(char *dst, const char *src) +{ + char *save = dst; + + while (1) { + kcsan_access((uintptr_t)src, 1, false, false, __RET_ADDR); + kcsan_access((uintptr_t)dst, 1, true, false, __RET_ADDR); + *dst = *src; + if (*src == '\0') + break; + src++, dst++; + } + + return save; +} + +int +kcsan_strcmp(const char *s1, const char *s2) +{ + while (1) { + kcsan_access((uintptr_t)s1, 1, false, false, __RET_ADDR); + kcsan_access((uintptr_t)s2, 1, false, false, __RET_ADDR); + if (*s1 != *s2) + break; + if (*s1 == '\0') + return 0; + s1++, s2++; + } + + return (*(const unsigned char *)s1 - *(const unsigned char *)s2); +} + +size_t +kcsan_strlen(const char *str) +{ + const char *s; + + s = str; + while (1) { + kcsan_access((uintptr_t)s, 1, false, false, __RET_ADDR); + if (*s == '\0') + break; + s++; + } + + return (s - str); +} + +#undef kcopy +#undef copystr +#undef copyinstr +#undef copyoutstr +#undef copyin +#undef copyout + +int kcsan_kcopy(const void *, void *, size_t); +int kcsan_copystr(const void *, void *, size_t, size_t *); +int kcsan_copyinstr(const void *, void *, size_t, size_t *); +int kcsan_copyoutstr(const void *, void *, size_t, size_t *); +int kcsan_copyin(const void *, void *, size_t); +int kcsan_copyout(const void *, void *, size_t); +int kcopy(const void *, void *, size_t); +int copystr(const void *, void *, size_t, size_t *); +int copyinstr(const void *, void *, size_t, size_t *); +int copyoutstr(const void *, void *, size_t, size_t *); +int copyin(const void *, void *, size_t); +int copyout(const void *, void *, size_t); + +int +kcsan_kcopy(const void *src, void *dst, size_t len) +{ + kcsan_access((uintptr_t)src, len, false, false, __RET_ADDR); + kcsan_access((uintptr_t)dst, len, true, false, __RET_ADDR); + return kcopy(src, dst, len); +} + +int +kcsan_copystr(const void *kfaddr, void *kdaddr, size_t len, size_t *done) +{ + kcsan_access((uintptr_t)kdaddr, len, true, false, __RET_ADDR); + return copystr(kfaddr, kdaddr, len, done); +} + +int +kcsan_copyin(const void *uaddr, void *kaddr, size_t len) +{ + kcsan_access((uintptr_t)kaddr, len, true, false, __RET_ADDR); + return copyin(uaddr, kaddr, len); +} + +int +kcsan_copyout(const void *kaddr, void *uaddr, size_t len) +{ + kcsan_access((uintptr_t)kaddr, len, false, false, __RET_ADDR); + return copyout(kaddr, uaddr, len); +} + +int +kcsan_copyinstr(const void *uaddr, void *kaddr, size_t len, size_t *done) +{ + kcsan_access((uintptr_t)kaddr, len, true, false, __RET_ADDR); + return copyinstr(uaddr, kaddr, len, done); +} + +int +kcsan_copyoutstr(const void *kaddr, void *uaddr, size_t len, size_t *done) +{ + kcsan_access((uintptr_t)kaddr, len, false, false, __RET_ADDR); + return copyoutstr(kaddr, uaddr, len, done); +} + +/* -------------------------------------------------------------------------- */ + +#undef atomic_add_32 +#undef atomic_add_int +#undef atomic_add_long +#undef atomic_add_ptr +#undef atomic_add_64 +#undef atomic_add_32_nv +#undef atomic_add_int_nv +#undef atomic_add_long_nv +#undef atomic_add_ptr_nv +#undef atomic_add_64_nv +#undef atomic_and_32 +#undef atomic_and_uint +#undef atomic_and_ulong +#undef atomic_and_64 +#undef atomic_and_32_nv +#undef atomic_and_uint_nv +#undef atomic_and_ulong_nv +#undef atomic_and_64_nv +#undef atomic_or_32 +#undef atomic_or_uint +#undef atomic_or_ulong +#undef atomic_or_64 +#undef atomic_or_32_nv +#undef atomic_or_uint_nv +#undef atomic_or_ulong_nv +#undef atomic_or_64_nv +#undef atomic_cas_32 +#undef atomic_cas_uint +#undef atomic_cas_ulong +#undef atomic_cas_ptr +#undef atomic_cas_64 +#undef atomic_cas_32_ni +#undef atomic_cas_uint_ni +#undef atomic_cas_ulong_ni +#undef atomic_cas_ptr_ni +#undef atomic_cas_64_ni +#undef atomic_swap_32 +#undef atomic_swap_uint +#undef atomic_swap_ulong +#undef atomic_swap_ptr +#undef atomic_swap_64 +#undef atomic_dec_32 +#undef atomic_dec_uint +#undef atomic_dec_ulong +#undef atomic_dec_ptr +#undef atomic_dec_64 +#undef atomic_dec_32_nv +#undef atomic_dec_uint_nv +#undef atomic_dec_ulong_nv +#undef atomic_dec_ptr_nv +#undef atomic_dec_64_nv +#undef atomic_inc_32 +#undef atomic_inc_uint +#undef atomic_inc_ulong +#undef atomic_inc_ptr +#undef atomic_inc_64 +#undef atomic_inc_32_nv +#undef atomic_inc_uint_nv +#undef atomic_inc_ulong_nv +#undef atomic_inc_ptr_nv +#undef atomic_inc_64_nv + +#define CSAN_ATOMIC_FUNC_ADD(name, tret, targ1, targ2) \ + void atomic_add_##name(volatile targ1 *, targ2); \ + void kcsan_atomic_add_##name(volatile targ1 *, targ2); \ + void kcsan_atomic_add_##name(volatile targ1 *ptr, targ2 val) \ + { \ + kcsan_access((uintptr_t)ptr, sizeof(tret), true, true, \ + __RET_ADDR); \ + atomic_add_##name(ptr, val); \ + } \ + tret atomic_add_##name##_nv(volatile targ1 *, targ2); \ + tret kcsan_atomic_add_##name##_nv(volatile targ1 *, targ2); \ + tret kcsan_atomic_add_##name##_nv(volatile targ1 *ptr, targ2 val) \ + { \ + kcsan_access((uintptr_t)ptr, sizeof(tret), true, true, \ + __RET_ADDR); \ + return atomic_add_##name##_nv(ptr, val); \ + } + +#define CSAN_ATOMIC_FUNC_AND(name, tret, targ1, targ2) \ + void atomic_and_##name(volatile targ1 *, targ2); \ + void kcsan_atomic_and_##name(volatile targ1 *, targ2); \ + void kcsan_atomic_and_##name(volatile targ1 *ptr, targ2 val) \ + { \ + kcsan_access((uintptr_t)ptr, sizeof(tret), true, true, \ + __RET_ADDR); \ + atomic_and_##name(ptr, val); \ + } \ + tret atomic_and_##name##_nv(volatile targ1 *, targ2); \ + tret kcsan_atomic_and_##name##_nv(volatile targ1 *, targ2); \ + tret kcsan_atomic_and_##name##_nv(volatile targ1 *ptr, targ2 val) \ + { \ + kcsan_access((uintptr_t)ptr, sizeof(tret), true, true, \ + __RET_ADDR); \ + return atomic_and_##name##_nv(ptr, val); \ + } + +#define CSAN_ATOMIC_FUNC_OR(name, tret, targ1, targ2) \ + void atomic_or_##name(volatile targ1 *, targ2); \ + void kcsan_atomic_or_##name(volatile targ1 *, targ2); \ + void kcsan_atomic_or_##name(volatile targ1 *ptr, targ2 val) \ + { \ + kcsan_access((uintptr_t)ptr, sizeof(tret), true, true, \ + __RET_ADDR); \ + atomic_or_##name(ptr, val); \ + } \ + tret atomic_or_##name##_nv(volatile targ1 *, targ2); \ + tret kcsan_atomic_or_##name##_nv(volatile targ1 *, targ2); \ + tret kcsan_atomic_or_##name##_nv(volatile targ1 *ptr, targ2 val) \ + { \ + kcsan_access((uintptr_t)ptr, sizeof(tret), true, true, \ + __RET_ADDR); \ + return atomic_or_##name##_nv(ptr, val); \ + } + +#define CSAN_ATOMIC_FUNC_CAS(name, tret, targ1, targ2) \ + tret atomic_cas_##name(volatile targ1 *, targ2, targ2); \ + tret kcsan_atomic_cas_##name(volatile targ1 *, targ2, targ2); \ + tret kcsan_atomic_cas_##name(volatile targ1 *ptr, targ2 exp, targ2 new) \ + { \ + kcsan_access((uintptr_t)ptr, sizeof(tret), true, true, \ + __RET_ADDR); \ + return atomic_cas_##name(ptr, exp, new); \ + } \ + tret atomic_cas_##name##_ni(volatile targ1 *, targ2, targ2); \ + tret kcsan_atomic_cas_##name##_ni(volatile targ1 *, targ2, targ2); \ + tret kcsan_atomic_cas_##name##_ni(volatile targ1 *ptr, targ2 exp, targ2 new) \ + { \ + kcsan_access((uintptr_t)ptr, sizeof(tret), true, true, \ + __RET_ADDR); \ + return atomic_cas_##name##_ni(ptr, exp, new); \ + } + +#define CSAN_ATOMIC_FUNC_SWAP(name, tret, targ1, targ2) \ + tret atomic_swap_##name(volatile targ1 *, targ2); \ + tret kcsan_atomic_swap_##name(volatile targ1 *, targ2); \ + tret kcsan_atomic_swap_##name(volatile targ1 *ptr, targ2 val) \ + { \ + kcsan_access((uintptr_t)ptr, sizeof(tret), true, true, \ + __RET_ADDR); \ + return atomic_swap_##name(ptr, val); \ + } + +#define CSAN_ATOMIC_FUNC_DEC(name, tret, targ1) \ + void atomic_dec_##name(volatile targ1 *); \ + void kcsan_atomic_dec_##name(volatile targ1 *); \ + void kcsan_atomic_dec_##name(volatile targ1 *ptr) \ + { \ + kcsan_access((uintptr_t)ptr, sizeof(tret), true, true, \ + __RET_ADDR); \ + atomic_dec_##name(ptr); \ + } \ + tret atomic_dec_##name##_nv(volatile targ1 *); \ + tret kcsan_atomic_dec_##name##_nv(volatile targ1 *); \ + tret kcsan_atomic_dec_##name##_nv(volatile targ1 *ptr) \ + { \ + kcsan_access((uintptr_t)ptr, sizeof(tret), true, true, \ + __RET_ADDR); \ + return atomic_dec_##name##_nv(ptr); \ + } + +#define CSAN_ATOMIC_FUNC_INC(name, tret, targ1) \ + void atomic_inc_##name(volatile targ1 *); \ + void kcsan_atomic_inc_##name(volatile targ1 *); \ + void kcsan_atomic_inc_##name(volatile targ1 *ptr) \ + { \ + kcsan_access((uintptr_t)ptr, sizeof(tret), true, true, \ + __RET_ADDR); \ + atomic_inc_##name(ptr); \ + } \ + tret atomic_inc_##name##_nv(volatile targ1 *); \ + tret kcsan_atomic_inc_##name##_nv(volatile targ1 *); \ + tret kcsan_atomic_inc_##name##_nv(volatile targ1 *ptr) \ + { \ + kcsan_access((uintptr_t)ptr, sizeof(tret), true, true, \ + __RET_ADDR); \ + return atomic_inc_##name##_nv(ptr); \ + } + +CSAN_ATOMIC_FUNC_ADD(32, uint32_t, uint32_t, int32_t); +CSAN_ATOMIC_FUNC_ADD(64, uint64_t, uint64_t, int64_t); +CSAN_ATOMIC_FUNC_ADD(int, unsigned int, unsigned int, int); +CSAN_ATOMIC_FUNC_ADD(long, unsigned long, unsigned long, long); +CSAN_ATOMIC_FUNC_ADD(ptr, void *, void, ssize_t); + +CSAN_ATOMIC_FUNC_AND(32, uint32_t, uint32_t, uint32_t); +CSAN_ATOMIC_FUNC_AND(64, uint64_t, uint64_t, uint64_t); +CSAN_ATOMIC_FUNC_AND(uint, unsigned int, unsigned int, unsigned int); +CSAN_ATOMIC_FUNC_AND(ulong, unsigned long, unsigned long, unsigned long); + +CSAN_ATOMIC_FUNC_OR(32, uint32_t, uint32_t, uint32_t); +CSAN_ATOMIC_FUNC_OR(64, uint64_t, uint64_t, uint64_t); +CSAN_ATOMIC_FUNC_OR(uint, unsigned int, unsigned int, unsigned int); +CSAN_ATOMIC_FUNC_OR(ulong, unsigned long, unsigned long, unsigned long); + +CSAN_ATOMIC_FUNC_CAS(32, uint32_t, uint32_t, uint32_t); +CSAN_ATOMIC_FUNC_CAS(64, uint64_t, uint64_t, uint64_t); +CSAN_ATOMIC_FUNC_CAS(uint, unsigned int, unsigned int, unsigned int); +CSAN_ATOMIC_FUNC_CAS(ulong, unsigned long, unsigned long, unsigned long); +CSAN_ATOMIC_FUNC_CAS(ptr, void *, void, void *); + +CSAN_ATOMIC_FUNC_SWAP(32, uint32_t, uint32_t, uint32_t); +CSAN_ATOMIC_FUNC_SWAP(64, uint64_t, uint64_t, uint64_t); +CSAN_ATOMIC_FUNC_SWAP(uint, unsigned int, unsigned int, unsigned int); +CSAN_ATOMIC_FUNC_SWAP(ulong, unsigned long, unsigned long, unsigned long); +CSAN_ATOMIC_FUNC_SWAP(ptr, void *, void, void *); + +CSAN_ATOMIC_FUNC_DEC(32, uint32_t, uint32_t) +CSAN_ATOMIC_FUNC_DEC(64, uint64_t, uint64_t) +CSAN_ATOMIC_FUNC_DEC(uint, unsigned int, unsigned int); +CSAN_ATOMIC_FUNC_DEC(ulong, unsigned long, unsigned long); +CSAN_ATOMIC_FUNC_DEC(ptr, void *, void); + +CSAN_ATOMIC_FUNC_INC(32, uint32_t, uint32_t) +CSAN_ATOMIC_FUNC_INC(64, uint64_t, uint64_t) +CSAN_ATOMIC_FUNC_INC(uint, unsigned int, unsigned int); +CSAN_ATOMIC_FUNC_INC(ulong, unsigned long, unsigned long); +CSAN_ATOMIC_FUNC_INC(ptr, void *, void); + +/* -------------------------------------------------------------------------- */ + +#include + +#undef bus_space_read_multi_1 +#undef bus_space_read_multi_2 +#undef bus_space_read_multi_4 +#undef bus_space_read_multi_8 +#undef bus_space_read_multi_stream_1 +#undef bus_space_read_multi_stream_2 +#undef bus_space_read_multi_stream_4 +#undef bus_space_read_multi_stream_8 +#undef bus_space_read_region_1 +#undef bus_space_read_region_2 +#undef bus_space_read_region_4 +#undef bus_space_read_region_8 +#undef bus_space_read_region_stream_1 +#undef bus_space_read_region_stream_2 +#undef bus_space_read_region_stream_4 +#undef bus_space_read_region_stream_8 +#undef bus_space_write_multi_1 +#undef bus_space_write_multi_2 +#undef bus_space_write_multi_4 +#undef bus_space_write_multi_8 +#undef bus_space_write_multi_stream_1 +#undef bus_space_write_multi_stream_2 +#undef bus_space_write_multi_stream_4 +#undef bus_space_write_multi_stream_8 +#undef bus_space_write_region_1 +#undef bus_space_write_region_2 +#undef bus_space_write_region_4 +#undef bus_space_write_region_8 +#undef bus_space_write_region_stream_1 +#undef bus_space_write_region_stream_2 +#undef bus_space_write_region_stream_4 +#undef bus_space_write_region_stream_8 + +#define CSAN_BUS_READ_FUNC(bytes, bits) \ + void bus_space_read_multi_##bytes(bus_space_tag_t, bus_space_handle_t, \ + bus_size_t, uint##bits##_t *, bus_size_t); \ + void kcsan_bus_space_read_multi_##bytes(bus_space_tag_t, \ + bus_space_handle_t, bus_size_t, uint##bits##_t *, bus_size_t); \ + void kcsan_bus_space_read_multi_##bytes(bus_space_tag_t tag, \ + bus_space_handle_t hnd, bus_size_t size, uint##bits##_t *buf, \ + bus_size_t count) \ + { \ + kcsan_access((uintptr_t)buf, sizeof(uint##bits##_t) * count, \ + false, false, __RET_ADDR); \ + bus_space_read_multi_##bytes(tag, hnd, size, buf, count); \ + } \ + void bus_space_read_multi_stream_##bytes(bus_space_tag_t, \ + bus_space_handle_t, bus_size_t, uint##bits##_t *, bus_size_t); \ + void kcsan_bus_space_read_multi_stream_##bytes(bus_space_tag_t, \ + bus_space_handle_t, bus_size_t, uint##bits##_t *, bus_size_t); \ + void kcsan_bus_space_read_multi_stream_##bytes(bus_space_tag_t tag, \ + bus_space_handle_t hnd, bus_size_t size, uint##bits##_t *buf, \ + bus_size_t count) \ + { \ + kcsan_access((uintptr_t)buf, sizeof(uint##bits##_t) * count, \ + false, false, __RET_ADDR); \ + bus_space_read_multi_stream_##bytes(tag, hnd, size, buf, count);\ + } \ + void bus_space_read_region_##bytes(bus_space_tag_t, bus_space_handle_t, \ + bus_size_t, uint##bits##_t *, bus_size_t); \ + void kcsan_bus_space_read_region_##bytes(bus_space_tag_t, \ + bus_space_handle_t, bus_size_t, uint##bits##_t *, bus_size_t); \ + void kcsan_bus_space_read_region_##bytes(bus_space_tag_t tag, \ + bus_space_handle_t hnd, bus_size_t size, uint##bits##_t *buf, \ + bus_size_t count) \ + { \ + kcsan_access((uintptr_t)buf, sizeof(uint##bits##_t) * count, \ + false, false, __RET_ADDR); \ + bus_space_read_region_##bytes(tag, hnd, size, buf, count); \ + } \ + void bus_space_read_region_stream_##bytes(bus_space_tag_t, \ + bus_space_handle_t, bus_size_t, uint##bits##_t *, bus_size_t); \ + void kcsan_bus_space_read_region_stream_##bytes(bus_space_tag_t, \ + bus_space_handle_t, bus_size_t, uint##bits##_t *, bus_size_t); \ + void kcsan_bus_space_read_region_stream_##bytes(bus_space_tag_t tag, \ + bus_space_handle_t hnd, bus_size_t size, uint##bits##_t *buf, \ + bus_size_t count) \ + { \ + kcsan_access((uintptr_t)buf, sizeof(uint##bits##_t) * count, \ + false, false, __RET_ADDR); \ + bus_space_read_region_stream_##bytes(tag, hnd, size, buf, count);\ + } + +#define CSAN_BUS_WRITE_FUNC(bytes, bits) \ + void bus_space_write_multi_##bytes(bus_space_tag_t, bus_space_handle_t, \ + bus_size_t, const uint##bits##_t *, bus_size_t); \ + void kcsan_bus_space_write_multi_##bytes(bus_space_tag_t, \ + bus_space_handle_t, bus_size_t, const uint##bits##_t *, bus_size_t);\ + void kcsan_bus_space_write_multi_##bytes(bus_space_tag_t tag, \ + bus_space_handle_t hnd, bus_size_t size, const uint##bits##_t *buf, \ + bus_size_t count) \ + { \ + kcsan_access((uintptr_t)buf, sizeof(uint##bits##_t) * count, \ + true, false, __RET_ADDR); \ + bus_space_write_multi_##bytes(tag, hnd, size, buf, count); \ + } \ + void bus_space_write_multi_stream_##bytes(bus_space_tag_t, \ + bus_space_handle_t, bus_size_t, const uint##bits##_t *, bus_size_t);\ + void kcsan_bus_space_write_multi_stream_##bytes(bus_space_tag_t, \ + bus_space_handle_t, bus_size_t, const uint##bits##_t *, bus_size_t);\ + void kcsan_bus_space_write_multi_stream_##bytes(bus_space_tag_t tag, \ + bus_space_handle_t hnd, bus_size_t size, const uint##bits##_t *buf, \ + bus_size_t count) \ + { \ + kcsan_access((uintptr_t)buf, sizeof(uint##bits##_t) * count, \ + true, false, __RET_ADDR); \ + bus_space_write_multi_stream_##bytes(tag, hnd, size, buf, count);\ + } \ + void bus_space_write_region_##bytes(bus_space_tag_t, bus_space_handle_t,\ + bus_size_t, const uint##bits##_t *, bus_size_t); \ + void kcsan_bus_space_write_region_##bytes(bus_space_tag_t, \ + bus_space_handle_t, bus_size_t, const uint##bits##_t *, bus_size_t);\ + void kcsan_bus_space_write_region_##bytes(bus_space_tag_t tag, \ + bus_space_handle_t hnd, bus_size_t size, const uint##bits##_t *buf, \ + bus_size_t count) \ + { \ + kcsan_access((uintptr_t)buf, sizeof(uint##bits##_t) * count, \ + true, false, __RET_ADDR); \ + bus_space_write_region_##bytes(tag, hnd, size, buf, count); \ + } \ + void bus_space_write_region_stream_##bytes(bus_space_tag_t, \ + bus_space_handle_t, bus_size_t, const uint##bits##_t *, bus_size_t);\ + void kcsan_bus_space_write_region_stream_##bytes(bus_space_tag_t, \ + bus_space_handle_t, bus_size_t, const uint##bits##_t *, bus_size_t);\ + void kcsan_bus_space_write_region_stream_##bytes(bus_space_tag_t tag, \ + bus_space_handle_t hnd, bus_size_t size, const uint##bits##_t *buf, \ + bus_size_t count) \ + { \ + kcsan_access((uintptr_t)buf, sizeof(uint##bits##_t) * count, \ + true, false, __RET_ADDR); \ + bus_space_write_region_stream_##bytes(tag, hnd, size, buf, count);\ + } + +CSAN_BUS_READ_FUNC(1, 8) +CSAN_BUS_READ_FUNC(2, 16) +CSAN_BUS_READ_FUNC(4, 32) +CSAN_BUS_READ_FUNC(8, 64) + +CSAN_BUS_WRITE_FUNC(1, 8) +CSAN_BUS_WRITE_FUNC(2, 16) +CSAN_BUS_WRITE_FUNC(4, 32) +CSAN_BUS_WRITE_FUNC(8, 64) Added: head/sys/sys/csan.h ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/sys/csan.h Wed Nov 20 14:37:48 2019 (r354894) @@ -0,0 +1,49 @@ +/* $NetBSD: csan.h,v 1.1 2019/11/05 20:19:18 maxv Exp $ */ + +/* + * Copyright (c) 2019 The NetBSD Foundation, Inc. + * All rights reserved. + * + * This code is derived from software contributed to The NetBSD Foundation + * by Maxime Villard. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS + * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef _SYS_CSAN_H_ +#define _SYS_CSAN_H_ + +#ifdef _KERNEL_OPT +#include "opt_kcsan.h" +#endif + +#include + +#ifdef KCSAN +void kcsan_init(void); +void kcsan_cpu_init(struct cpu_info *); +#else +#define kcsan_init() __nothing +#define kcsan_cpu_init(ci) __nothing +#endif + +#endif /* !_SYS_CSAN_H_ */ From owner-svn-src-all@freebsd.org Wed Nov 20 16:06:49 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 2D7EE1BA881; Wed, 20 Nov 2019 16:06:49 +0000 (UTC) (envelope-from dougm@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47J6yK14FRz40CK; Wed, 20 Nov 2019 16:06:49 +0000 (UTC) (envelope-from dougm@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 092A7251F8; Wed, 20 Nov 2019 16:06:49 +0000 (UTC) (envelope-from dougm@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xAKG6no5064673; Wed, 20 Nov 2019 16:06:49 GMT (envelope-from dougm@FreeBSD.org) Received: (from dougm@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xAKG6moL064670; Wed, 20 Nov 2019 16:06:48 GMT (envelope-from dougm@FreeBSD.org) Message-Id: <201911201606.xAKG6moL064670@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dougm set sender to dougm@FreeBSD.org using -f From: Doug Moore Date: Wed, 20 Nov 2019 16:06:48 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354895 - in head/sys: security/mac vm X-SVN-Group: head X-SVN-Commit-Author: dougm X-SVN-Commit-Paths: in head/sys: security/mac vm X-SVN-Commit-Revision: 354895 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 20 Nov 2019 16:06:49 -0000 Author: dougm Date: Wed Nov 20 16:06:48 2019 New Revision: 354895 URL: https://svnweb.freebsd.org/changeset/base/354895 Log: Instead of looking up a predecessor or successor to the current map entry, when that entry has been seen already, keep the already-looked-up value in a variable and use that instead of looking it up again. Approved by: alc, markj (earlier version), kib (earlier version) Differential Revision: https://reviews.freebsd.org/D22348 Modified: head/sys/security/mac/mac_process.c head/sys/vm/vm_map.c head/sys/vm/vm_map.h Modified: head/sys/security/mac/mac_process.c ============================================================================== --- head/sys/security/mac/mac_process.c Wed Nov 20 14:37:48 2019 (r354894) +++ head/sys/security/mac/mac_process.c Wed Nov 20 16:06:48 2019 (r354895) @@ -252,7 +252,7 @@ static void mac_proc_vm_revoke_recurse(struct thread *td, struct ucred *cred, struct vm_map *map) { - vm_map_entry_t vme; + vm_map_entry_t prev, vme; int result; vm_prot_t revokeperms; vm_object_t backing_object, object; @@ -263,8 +263,10 @@ mac_proc_vm_revoke_recurse(struct thread *td, struct u if (!mac_mmap_revocation) return; + prev = &map->header; vm_map_lock(map); - VM_MAP_ENTRY_FOREACH(vme, map) { + for (vme = vm_map_entry_first(map); vme != &map->header; + prev = vme, vme = vm_map_entry_succ(prev)) { if (vme->eflags & MAP_ENTRY_IS_SUB_MAP) { mac_proc_vm_revoke_recurse(td, cred, vme->object.sub_map); @@ -363,8 +365,7 @@ mac_proc_vm_revoke_recurse(struct thread *td, struct u } pmap_protect(map->pmap, vme->start, vme->end, vme->protection & ~revokeperms); - vm_map_try_merge_entries(map, vm_map_entry_pred(vme), - vme); + vm_map_try_merge_entries(map, prev, vme); } } vm_map_unlock(map); Modified: head/sys/vm/vm_map.c ============================================================================== --- head/sys/vm/vm_map.c Wed Nov 20 14:37:48 2019 (r354894) +++ head/sys/vm/vm_map.c Wed Nov 20 16:06:48 2019 (r354895) @@ -978,6 +978,21 @@ vm_map_entry_max_free_right(vm_map_entry_t root, vm_ma root->right->max_free : right_ancestor->start - root->end); } +/* + * vm_map_entry_{pred,succ}: + * + * Find the {predecessor, successor} of the entry by taking one step + * in the appropriate direction and backtracking as much as necessary. + */ +static inline vm_map_entry_t +vm_map_entry_pred(vm_map_entry_t entry) +{ + + return (entry->prev); +} + +/* vm_map_entry_succ is defined in vm_map.h. */ + #define SPLAY_LEFT_STEP(root, y, rlist, test) do { \ vm_size_t max_free; \ \ @@ -1412,7 +1427,7 @@ int vm_map_insert(vm_map_t map, vm_object_t object, vm_ooffset_t offset, vm_offset_t start, vm_offset_t end, vm_prot_t prot, vm_prot_t max, int cow) { - vm_map_entry_t new_entry, prev_entry; + vm_map_entry_t new_entry, next_entry, prev_entry; struct ucred *cred; vm_eflags_t protoeflags; vm_inherit_t inheritance; @@ -1443,7 +1458,8 @@ vm_map_insert(vm_map_t map, vm_object_t object, vm_oof /* * Assert that the next entry doesn't overlap the end point. */ - if (vm_map_entry_succ(prev_entry)->start < end) + next_entry = vm_map_entry_succ(prev_entry); + if (next_entry->start < end) return (KERN_NO_SPACE); if ((cow & MAP_CREATE_GUARD) != 0 && (object != NULL || @@ -1538,8 +1554,7 @@ charged: map->size += end - prev_entry->end; vm_map_entry_resize(map, prev_entry, end - prev_entry->end); - vm_map_try_merge_entries(map, prev_entry, - vm_map_entry_succ(prev_entry)); + vm_map_try_merge_entries(map, prev_entry, next_entry); return (KERN_SUCCESS); } @@ -1600,7 +1615,7 @@ charged: * other cases, which are less common. */ vm_map_try_merge_entries(map, prev_entry, new_entry); - vm_map_try_merge_entries(map, new_entry, vm_map_entry_succ(new_entry)); + vm_map_try_merge_entries(map, new_entry, next_entry); if ((cow & (MAP_PREFAULT | MAP_PREFAULT_PARTIAL)) != 0) { vm_map_pmap_enter(map, start, prot, object, OFF_TO_IDX(offset), @@ -2430,7 +2445,7 @@ int vm_map_protect(vm_map_t map, vm_offset_t start, vm_offset_t end, vm_prot_t new_prot, boolean_t set_max) { - vm_map_entry_t current, entry, in_tran; + vm_map_entry_t current, entry, in_tran, prev_entry; vm_object_t obj; struct ucred *cred; vm_prot_t old_prot; @@ -2555,9 +2570,10 @@ again: * Otherwise, just simplify entries, since some may have been modified. * [Note that clipping is not necessary the second time.] */ - for (current = entry; current->start < end; - vm_map_try_merge_entries(map, vm_map_entry_pred(current), current), - current = vm_map_entry_succ(current)) { + for (prev_entry = vm_map_entry_pred(entry), current = entry; + current->start < end; + vm_map_try_merge_entries(map, prev_entry, current), + prev_entry = current, current = vm_map_entry_succ(current)) { if (rv != KERN_SUCCESS || (current->eflags & MAP_ENTRY_GUARD) != 0) continue; @@ -2595,7 +2611,7 @@ again: #undef MASK } } - vm_map_try_merge_entries(map, vm_map_entry_pred(current), current); + vm_map_try_merge_entries(map, prev_entry, current); vm_map_unlock(map); return (rv); } @@ -2615,7 +2631,7 @@ vm_map_madvise( vm_offset_t end, int behav) { - vm_map_entry_t current, entry; + vm_map_entry_t current, prev_entry; bool modify_map; /* @@ -2654,11 +2670,13 @@ vm_map_madvise( */ VM_MAP_RANGE_CHECK(map, start, end); - if (vm_map_lookup_entry(map, start, &entry)) { + if (vm_map_lookup_entry(map, start, ¤t)) { if (modify_map) - vm_map_clip_start(map, entry, start); + vm_map_clip_start(map, current, start); + prev_entry = vm_map_entry_pred(current); } else { - entry = vm_map_entry_succ(entry); + prev_entry = current; + current = vm_map_entry_succ(current); } if (modify_map) { @@ -2668,7 +2686,7 @@ vm_map_madvise( * We clip the vm_map_entry so that behavioral changes are * limited to the specified address range. */ - for (current = entry; current->start < end; + for (; current->start < end; prev_entry = current, current = vm_map_entry_succ(current)) { if (current->eflags & MAP_ENTRY_IS_SUB_MAP) continue; @@ -2700,11 +2718,9 @@ vm_map_madvise( default: break; } - vm_map_try_merge_entries(map, - vm_map_entry_pred(current), current); + vm_map_try_merge_entries(map, prev_entry, current); } - vm_map_try_merge_entries(map, vm_map_entry_pred(current), - current); + vm_map_try_merge_entries(map, prev_entry, current); vm_map_unlock(map); } else { vm_pindex_t pstart, pend; @@ -2716,7 +2732,7 @@ vm_map_madvise( * Since we don't clip the vm_map_entry, we have to clip * the vm_object pindex and count. */ - for (current = entry; current->start < end; + for (; current->start < end; current = vm_map_entry_succ(current)) { vm_offset_t useEnd, useStart; @@ -2804,8 +2820,7 @@ int vm_map_inherit(vm_map_t map, vm_offset_t start, vm_offset_t end, vm_inherit_t new_inheritance) { - vm_map_entry_t entry; - vm_map_entry_t temp_entry; + vm_map_entry_t entry, prev_entry; switch (new_inheritance) { case VM_INHERIT_NONE: @@ -2820,20 +2835,21 @@ vm_map_inherit(vm_map_t map, vm_offset_t start, vm_off return (KERN_SUCCESS); vm_map_lock(map); VM_MAP_RANGE_CHECK(map, start, end); - if (vm_map_lookup_entry(map, start, &temp_entry)) { - entry = temp_entry; + if (vm_map_lookup_entry(map, start, &prev_entry)) { + entry = prev_entry; vm_map_clip_start(map, entry, start); + prev_entry = vm_map_entry_pred(entry); } else - entry = vm_map_entry_succ(temp_entry); - while (entry->start < end) { + entry = vm_map_entry_succ(prev_entry); + for (; entry->start < end; + prev_entry = entry, entry = vm_map_entry_succ(entry)) { vm_map_clip_end(map, entry, end); if ((entry->eflags & MAP_ENTRY_GUARD) == 0 || new_inheritance != VM_INHERIT_ZERO) entry->inheritance = new_inheritance; - vm_map_try_merge_entries(map, vm_map_entry_pred(entry), entry); - entry = vm_map_entry_succ(entry); + vm_map_try_merge_entries(map, prev_entry, entry); } - vm_map_try_merge_entries(map, vm_map_entry_pred(entry), entry); + vm_map_try_merge_entries(map, prev_entry, entry); vm_map_unlock(map); return (KERN_SUCCESS); } @@ -2896,9 +2912,9 @@ int vm_map_unwire(vm_map_t map, vm_offset_t start, vm_offset_t end, int flags) { - vm_map_entry_t entry, first_entry; + vm_map_entry_t entry, first_entry, next_entry, prev_entry; int rv; - bool first_iteration, holes_ok, need_wakeup, user_unwire; + bool holes_ok, need_wakeup, user_unwire; if (start == end) return (KERN_SUCCESS); @@ -2914,28 +2930,26 @@ vm_map_unwire(vm_map_t map, vm_offset_t start, vm_offs return (KERN_INVALID_ADDRESS); } } - first_iteration = true; - entry = first_entry; rv = KERN_SUCCESS; - while (entry->start < end) { + for (entry = first_entry; entry->start < end; entry = next_entry) { if (entry->eflags & MAP_ENTRY_IN_TRANSITION) { /* * We have not yet clipped the entry. */ - entry = vm_map_entry_in_transition(map, start, &end, - holes_ok, entry); - if (entry == NULL) { - if (first_iteration) { + next_entry = vm_map_entry_in_transition(map, start, + &end, holes_ok, entry); + if (next_entry == NULL) { + if (entry == first_entry) { vm_map_unlock(map); return (KERN_INVALID_ADDRESS); } rv = KERN_INVALID_ADDRESS; break; } - first_entry = first_iteration ? entry : NULL; + first_entry = (entry == first_entry) ? + next_entry : NULL; continue; } - first_iteration = false; vm_map_clip_start(map, entry, start); vm_map_clip_end(map, entry, end); /* @@ -2947,13 +2961,13 @@ vm_map_unwire(vm_map_t map, vm_offset_t start, vm_offs ("owned map entry %p", entry)); entry->eflags |= MAP_ENTRY_IN_TRANSITION; entry->wiring_thread = curthread; + next_entry = vm_map_entry_succ(entry); /* * Check the map for holes in the specified region. * If holes_ok, skip this check. */ if (!holes_ok && - (entry->end < end && - vm_map_entry_succ(entry)->start > entry->end)) { + entry->end < end && next_entry->start > entry->end) { end = entry->end; rv = KERN_INVALID_ADDRESS; break; @@ -2967,16 +2981,19 @@ vm_map_unwire(vm_map_t map, vm_offset_t start, vm_offs rv = KERN_INVALID_ARGUMENT; break; } - entry = vm_map_entry_succ(entry); } need_wakeup = false; if (first_entry == NULL && !vm_map_lookup_entry(map, start, &first_entry)) { KASSERT(holes_ok, ("vm_map_unwire: lookup failed")); - first_entry = vm_map_entry_succ(first_entry); + prev_entry = first_entry; + entry = vm_map_entry_succ(first_entry); + } else { + prev_entry = vm_map_entry_pred(first_entry); + entry = first_entry; } - for (entry = first_entry; entry->start < end; - entry = vm_map_entry_succ(entry)) { + for (; entry->start < end; + prev_entry = entry, entry = vm_map_entry_succ(entry)) { /* * If holes_ok was specified, an empty * space in the unwired region could have been mapped @@ -3012,9 +3029,9 @@ vm_map_unwire(vm_map_t map, vm_offset_t start, vm_offs entry->eflags &= ~MAP_ENTRY_NEEDS_WAKEUP; need_wakeup = true; } - vm_map_try_merge_entries(map, vm_map_entry_pred(entry), entry); + vm_map_try_merge_entries(map, prev_entry, entry); } - vm_map_try_merge_entries(map, vm_map_entry_pred(entry), entry); + vm_map_try_merge_entries(map, prev_entry, entry); vm_map_unlock(map); if (need_wakeup) vm_map_wakeup(map); @@ -3100,12 +3117,12 @@ vm_map_wire(vm_map_t map, vm_offset_t start, vm_offset int vm_map_wire_locked(vm_map_t map, vm_offset_t start, vm_offset_t end, int flags) { - vm_map_entry_t entry, first_entry, tmp_entry; + vm_map_entry_t entry, first_entry, next_entry, prev_entry; vm_offset_t faddr, saved_end, saved_start; u_long npages; u_int last_timestamp; int rv; - bool first_iteration, holes_ok, need_wakeup, user_wire; + bool holes_ok, need_wakeup, user_wire; vm_prot_t prot; VM_MAP_ASSERT_LOCKED(map); @@ -3124,25 +3141,23 @@ vm_map_wire_locked(vm_map_t map, vm_offset_t start, vm else return (KERN_INVALID_ADDRESS); } - first_iteration = true; - entry = first_entry; - while (entry->start < end) { + for (entry = first_entry; entry->start < end; entry = next_entry) { if (entry->eflags & MAP_ENTRY_IN_TRANSITION) { /* * We have not yet clipped the entry. */ - entry = vm_map_entry_in_transition(map, start, &end, - holes_ok, entry); - if (entry == NULL) { - if (first_iteration) + next_entry = vm_map_entry_in_transition(map, start, + &end, holes_ok, entry); + if (next_entry == NULL) { + if (entry == first_entry) return (KERN_INVALID_ADDRESS); rv = KERN_INVALID_ADDRESS; goto done; } - first_entry = first_iteration ? entry : NULL; + first_entry = (entry == first_entry) ? + next_entry : NULL; continue; } - first_iteration = false; vm_map_clip_start(map, entry, start); vm_map_clip_end(map, entry, end); /* @@ -3205,15 +3220,13 @@ vm_map_wire_locked(vm_map_t map, vm_offset_t start, vm * deleted. */ if (!vm_map_lookup_entry(map, saved_start, - &tmp_entry)) + &next_entry)) KASSERT(false, ("vm_map_wire: lookup failed")); - if (entry == first_entry) - first_entry = tmp_entry; - else - first_entry = NULL; - entry = tmp_entry; - while (entry->end < saved_end) { + first_entry = (entry == first_entry) ? + next_entry : NULL; + for (entry = next_entry; entry->end < saved_end; + entry = vm_map_entry_succ(entry)) { /* * In case of failure, handle entries * that were not fully wired here; @@ -3224,7 +3237,6 @@ vm_map_wire_locked(vm_map_t map, vm_offset_t start, vm faddr < entry->end) vm_map_wire_entry_failure(map, entry, faddr); - entry = vm_map_entry_succ(entry); } } if (rv != KERN_SUCCESS) { @@ -3242,14 +3254,13 @@ vm_map_wire_locked(vm_map_t map, vm_offset_t start, vm * Check the map for holes in the specified region. * If holes_ok was specified, skip this check. */ + next_entry = vm_map_entry_succ(entry); if (!holes_ok && - entry->end < end && - vm_map_entry_succ(entry)->start > entry->end) { + entry->end < end && next_entry->start > entry->end) { end = entry->end; rv = KERN_INVALID_ADDRESS; goto done; } - entry = vm_map_entry_succ(entry); } rv = KERN_SUCCESS; done: @@ -3257,10 +3268,14 @@ done: if (first_entry == NULL && !vm_map_lookup_entry(map, start, &first_entry)) { KASSERT(holes_ok, ("vm_map_wire: lookup failed")); - first_entry = vm_map_entry_succ(first_entry); + prev_entry = first_entry; + entry = vm_map_entry_succ(first_entry); + } else { + prev_entry = vm_map_entry_pred(first_entry); + entry = first_entry; } - for (entry = first_entry; entry->start < end; - entry = vm_map_entry_succ(entry)) { + for (; entry->start < end; + prev_entry = entry, entry = vm_map_entry_succ(entry)) { /* * If holes_ok was specified, an empty * space in the unwired region could have been mapped @@ -3313,9 +3328,9 @@ done: entry->eflags &= ~MAP_ENTRY_NEEDS_WAKEUP; need_wakeup = true; } - vm_map_try_merge_entries(map, vm_map_entry_pred(entry), entry); + vm_map_try_merge_entries(map, prev_entry, entry); } - vm_map_try_merge_entries(map, vm_map_entry_pred(entry), entry); + vm_map_try_merge_entries(map, prev_entry, entry); if (need_wakeup) vm_map_wakeup(map); return (rv); @@ -3345,8 +3360,7 @@ vm_map_sync( boolean_t syncio, boolean_t invalidate) { - vm_map_entry_t current; - vm_map_entry_t entry; + vm_map_entry_t current, entry, next_entry; vm_size_t size; vm_object_t object; vm_ooffset_t offset; @@ -3366,13 +3380,14 @@ vm_map_sync( * Make a first pass to check for user-wired memory and holes. */ for (current = entry; current->start < end; - current = vm_map_entry_succ(current)) { + current = next_entry) { if (invalidate && (current->eflags & MAP_ENTRY_USER_WIRED)) { vm_map_unlock_read(map); return (KERN_INVALID_ARGUMENT); } + next_entry = vm_map_entry_succ(current); if (end > current->end && - current->end != vm_map_entry_succ(current)->start) { + current->end != next_entry->start) { vm_map_unlock_read(map); return (KERN_INVALID_ADDRESS); } @@ -3914,7 +3929,7 @@ vmspace_fork(struct vmspace *vm1, vm_ooffset_t *fork_c new_map->anon_loc = old_map->anon_loc; - old_entry = old_map->header.next; + old_entry = vm_map_entry_first(old_map); while (old_entry != &old_map->header) { if (old_entry->eflags & MAP_ENTRY_IS_SUB_MAP) Modified: head/sys/vm/vm_map.h ============================================================================== --- head/sys/vm/vm_map.h Wed Nov 20 14:37:48 2019 (r354894) +++ head/sys/vm/vm_map.h Wed Nov 20 16:06:48 2019 (r354895) @@ -421,21 +421,21 @@ void vm_map_lookup_done (vm_map_t, vm_map_entry_t); boolean_t vm_map_lookup_entry (vm_map_t, vm_offset_t, vm_map_entry_t *); static inline vm_map_entry_t -vm_map_entry_succ(vm_map_entry_t entry) +vm_map_entry_first(vm_map_t map) { - return (entry->next); + return (map->header.next); } static inline vm_map_entry_t -vm_map_entry_pred(vm_map_entry_t entry) +vm_map_entry_succ(vm_map_entry_t entry) { - return (entry->prev); + return (entry->next); } -#define VM_MAP_ENTRY_FOREACH(it, map) \ - for ((it) = (map)->header.next; \ +#define VM_MAP_ENTRY_FOREACH(it, map) \ + for ((it) = vm_map_entry_first(map); \ (it) != &(map)->header; \ (it) = vm_map_entry_succ(it)) int vm_map_protect (vm_map_t, vm_offset_t, vm_offset_t, vm_prot_t, boolean_t); From owner-svn-src-all@freebsd.org Wed Nov 20 16:20:50 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 1BFE51BADF2; Wed, 20 Nov 2019 16:20:50 +0000 (UTC) (envelope-from lwhsu@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47J7GV00lmz41Dg; Wed, 20 Nov 2019 16:20:50 +0000 (UTC) (envelope-from lwhsu@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id D80FA253EC; Wed, 20 Nov 2019 16:20:49 +0000 (UTC) (envelope-from lwhsu@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xAKGKnHQ072205; Wed, 20 Nov 2019 16:20:49 GMT (envelope-from lwhsu@FreeBSD.org) Received: (from lwhsu@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xAKGKn32072192; Wed, 20 Nov 2019 16:20:49 GMT (envelope-from lwhsu@FreeBSD.org) Message-Id: <201911201620.xAKGKn32072192@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: lwhsu set sender to lwhsu@FreeBSD.org using -f From: Li-Wen Hsu Date: Wed, 20 Nov 2019 16:20:49 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354896 - head/usr.sbin/jail X-SVN-Group: head X-SVN-Commit-Author: lwhsu X-SVN-Commit-Paths: head/usr.sbin/jail X-SVN-Commit-Revision: 354896 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 20 Nov 2019 16:20:50 -0000 Author: lwhsu Date: Wed Nov 20 16:20:49 2019 New Revision: 354896 URL: https://svnweb.freebsd.org/changeset/base/354896 Log: Workaround riscv64 build when using binutils 2.33.1 PR: 242109 Reviewed by: bapt Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D22457 Modified: head/usr.sbin/jail/Makefile Modified: head/usr.sbin/jail/Makefile ============================================================================== --- head/usr.sbin/jail/Makefile Wed Nov 20 16:06:48 2019 (r354895) +++ head/usr.sbin/jail/Makefile Wed Nov 20 16:20:49 2019 (r354896) @@ -15,6 +15,11 @@ NO_WMISSING_VARIABLE_DECLARATIONS= YFLAGS+=-v CFLAGS+=-I. -I${.CURDIR} +# workaround for GNU ld (GNU Binutils) 2.33.1: +# relocation truncated to fit: R_RISCV_GPREL_I against `.LANCHOR2' +# https://bugs.freebsd.org/242109 +CFLAGS+=-Wl,--no-relax + .if ${MK_INET6_SUPPORT} != "no" CFLAGS+= -DINET6 .endif From owner-svn-src-all@freebsd.org Wed Nov 20 16:30:38 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 2F1461BB20A; Wed, 20 Nov 2019 16:30:38 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47J7Tp0YkCz41rW; Wed, 20 Nov 2019 16:30:38 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id EBFC6255AA; Wed, 20 Nov 2019 16:30:37 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xAKGUblG076922; Wed, 20 Nov 2019 16:30:37 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xAKGUbbn076921; Wed, 20 Nov 2019 16:30:37 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201911201630.xAKGUbbn076921@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Wed, 20 Nov 2019 16:30:37 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354897 - head/crypto/openssh X-SVN-Group: head X-SVN-Commit-Author: emaste X-SVN-Commit-Paths: head/crypto/openssh X-SVN-Commit-Revision: 354897 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 20 Nov 2019 16:30:38 -0000 Author: emaste Date: Wed Nov 20 16:30:37 2019 New Revision: 354897 URL: https://svnweb.freebsd.org/changeset/base/354897 Log: sshd: make getpwclass wrapper MON_ISAUTH not MON_AUTH In r339216 a privsep wrapper was added for login_getpwclass to address PR 231172. Unfortunately the change used the MON_AUTH flag in the wrapper, and MON_AUTH includes MON_AUTHDECIDE which triggers an auth_log() on each invocation. getpwclass() does not participate in the authentication decision, so should be MON_ISAUTH instead. PR: 234793 Submitted by: Henry Hu Reviewed by: Yuichiro NAITO MFC after: 1 week Modified: head/crypto/openssh/monitor.c Modified: head/crypto/openssh/monitor.c ============================================================================== --- head/crypto/openssh/monitor.c Wed Nov 20 16:20:49 2019 (r354896) +++ head/crypto/openssh/monitor.c Wed Nov 20 16:30:37 2019 (r354897) @@ -193,7 +193,7 @@ struct mon_table mon_dispatch_proto20[] = { #endif {MONITOR_REQ_SIGN, MON_ONCE, mm_answer_sign}, #ifdef HAVE_LOGIN_CAP - {MONITOR_REQ_GETPWCLASS, MON_AUTH, mm_answer_login_getpwclass}, + {MONITOR_REQ_GETPWCLASS, MON_ISAUTH, mm_answer_login_getpwclass}, #endif {MONITOR_REQ_PWNAM, MON_ONCE, mm_answer_pwnamallow}, {MONITOR_REQ_AUTHSERV, MON_ONCE, mm_answer_authserv}, From owner-svn-src-all@freebsd.org Wed Nov 20 16:32:14 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 2EDD61BB4F1; Wed, 20 Nov 2019 16:32:14 +0000 (UTC) (envelope-from alc@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47J7Wf0Y55z42Fm; Wed, 20 Nov 2019 16:32:14 +0000 (UTC) (envelope-from alc@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id EB45E2575E; Wed, 20 Nov 2019 16:32:13 +0000 (UTC) (envelope-from alc@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xAKGWDnw082140; Wed, 20 Nov 2019 16:32:13 GMT (envelope-from alc@FreeBSD.org) Received: (from alc@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xAKGWD5Q082139; Wed, 20 Nov 2019 16:32:13 GMT (envelope-from alc@FreeBSD.org) Message-Id: <201911201632.xAKGWD5Q082139@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: alc set sender to alc@FreeBSD.org using -f From: Alan Cox Date: Wed, 20 Nov 2019 16:32:13 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354898 - head/sys/arm64/arm64 X-SVN-Group: head X-SVN-Commit-Author: alc X-SVN-Commit-Paths: head/sys/arm64/arm64 X-SVN-Commit-Revision: 354898 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 20 Nov 2019 16:32:14 -0000 Author: alc Date: Wed Nov 20 16:32:13 2019 New Revision: 354898 URL: https://svnweb.freebsd.org/changeset/base/354898 Log: Until every possible root cause for an "invalid ASID" assertion failure is resolved, assign every pmap a valid ASID when it is first initialized. Modified: head/sys/arm64/arm64/pmap.c Modified: head/sys/arm64/arm64/pmap.c ============================================================================== --- head/sys/arm64/arm64/pmap.c Wed Nov 20 16:30:37 2019 (r354897) +++ head/sys/arm64/arm64/pmap.c Wed Nov 20 16:32:13 2019 (r354898) @@ -1556,6 +1556,8 @@ pmap_pinit(pmap_t pmap) pmap->pm_root.rt_root = 0; bzero(&pmap->pm_stats, sizeof(pmap->pm_stats)); pmap->pm_cookie = COOKIE_FROM(-1, INT_MAX); + /* XXX Temporarily disable deferred ASID allocation. */ + pmap_alloc_asid(pmap); return (1); } From owner-svn-src-all@freebsd.org Wed Nov 20 16:35:59 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 3DAE21BB6FE; Wed, 20 Nov 2019 16:35:59 +0000 (UTC) (envelope-from lwhsu@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47J7bz0whfz42W7; Wed, 20 Nov 2019 16:35:59 +0000 (UTC) (envelope-from lwhsu@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 02FE42577F; Wed, 20 Nov 2019 16:35:59 +0000 (UTC) (envelope-from lwhsu@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xAKGZwLt082366; Wed, 20 Nov 2019 16:35:58 GMT (envelope-from lwhsu@FreeBSD.org) Received: (from lwhsu@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xAKGZwT4082365; Wed, 20 Nov 2019 16:35:58 GMT (envelope-from lwhsu@FreeBSD.org) Message-Id: <201911201635.xAKGZwT4082365@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: lwhsu set sender to lwhsu@FreeBSD.org using -f From: Li-Wen Hsu Date: Wed, 20 Nov 2019 16:35:58 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354899 - head/usr.sbin/jail X-SVN-Group: head X-SVN-Commit-Author: lwhsu X-SVN-Commit-Paths: head/usr.sbin/jail X-SVN-Commit-Revision: 354899 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 20 Nov 2019 16:35:59 -0000 Author: lwhsu Date: Wed Nov 20 16:35:58 2019 New Revision: 354899 URL: https://svnweb.freebsd.org/changeset/base/354899 Log: Limit the workaround to riscv only PR: 242109 Sponsored by: The FreeBSD Foundation Modified: head/usr.sbin/jail/Makefile Modified: head/usr.sbin/jail/Makefile ============================================================================== --- head/usr.sbin/jail/Makefile Wed Nov 20 16:32:13 2019 (r354898) +++ head/usr.sbin/jail/Makefile Wed Nov 20 16:35:58 2019 (r354899) @@ -18,7 +18,9 @@ CFLAGS+=-I. -I${.CURDIR} # workaround for GNU ld (GNU Binutils) 2.33.1: # relocation truncated to fit: R_RISCV_GPREL_I against `.LANCHOR2' # https://bugs.freebsd.org/242109 +.if ${MACHINE_ARCH} == "riscv" CFLAGS+=-Wl,--no-relax +.endif .if ${MK_INET6_SUPPORT} != "no" CFLAGS+= -DINET6 From owner-svn-src-all@freebsd.org Wed Nov 20 16:42:34 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 0FA611BBCEF; Wed, 20 Nov 2019 16:42:34 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from smtp.freebsd.org (smtp.freebsd.org [IPv6:2610:1c1:1:606c::24b:4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "smtp.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47J7lY632Gz43LK; Wed, 20 Nov 2019 16:42:33 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from John-Baldwins-MacBook-Pro-5.local (ralph.baldwin.cx [66.234.199.215]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client did not present a certificate) (Authenticated sender: jhb) by smtp.freebsd.org (Postfix) with ESMTPSA id 3F2311E891; Wed, 20 Nov 2019 16:42:33 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Subject: Re: svn commit: r354899 - head/usr.sbin/jail To: Li-Wen Hsu , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org References: <201911201635.xAKGZwT4082365@repo.freebsd.org> From: John Baldwin Openpgp: preference=signencrypt Autocrypt: addr=jhb@FreeBSD.org; keydata= mQGiBETQ+XcRBADMFybiq69u+fJRy/0wzqTNS8jFfWaBTs5/OfcV7wWezVmf9sgwn8TW0Dk0 c9MBl0pz+H01dA2ZSGZ5fXlmFIsee1WEzqeJzpiwd/pejPgSzXB9ijbLHZ2/E0jhGBcVy5Yo /Tw5+U/+laeYKu2xb0XPvM0zMNls1ah5OnP9a6Ql6wCgupaoMySb7DXm2LHD1Z9jTsHcAQMD /1jzh2BoHriy/Q2s4KzzjVp/mQO5DSm2z14BvbQRcXU48oAosHA1u3Wrov6LfPY+0U1tG47X 1BGfnQH+rNAaH0livoSBQ0IPI/8WfIW7ub4qV6HYwWKVqkDkqwcpmGNDbz3gfaDht6nsie5Z pcuCcul4M9CW7Md6zzyvktjnbz61BADGDCopfZC4of0Z3Ka0u8Wik6UJOuqShBt1WcFS8ya1 oB4rc4tXfSHyMF63aPUBMxHR5DXeH+EO2edoSwViDMqWk1jTnYza51rbGY+pebLQOVOxAY7k do5Ordl3wklBPMVEPWoZ61SdbcjhHVwaC5zfiskcxj5wwXd2E9qYlBqRg7QeSm9obiBCYWxk d2luIDxqaGJARnJlZUJTRC5vcmc+iGAEExECACAFAkTQ+awCGwMGCwkIBwMCBBUCCAMEFgID AQIeAQIXgAAKCRBy3lIGd+N/BI6RAJ9S97fvbME+3hxzE3JUyUZ6vTewDACdE1stFuSfqMvM jomvZdYxIYyTUpC5Ag0ERND5ghAIAPwsO0B7BL+bz8sLlLoQktGxXwXQfS5cInvL17Dsgnr3 1AKa94j9EnXQyPEj7u0d+LmEe6CGEGDh1OcGFTMVrof2ZzkSy4+FkZwMKJpTiqeaShMh+Goj XlwIMDxyADYvBIg3eN5YdFKaPQpfgSqhT+7El7w+wSZZD8pPQuLAnie5iz9C8iKy4/cMSOrH YUK/tO+Nhw8Jjlw94Ik0T80iEhI2t+XBVjwdfjbq3HrJ0ehqdBwukyeJRYKmbn298KOFQVHO EVbHA4rF/37jzaMadK43FgJ0SAhPPF5l4l89z5oPu0b/+5e2inA3b8J3iGZxywjM+Csq1tqz hltEc7Q+E08AAwUIAL+15XH8bPbjNJdVyg2CMl10JNW2wWg2Q6qdljeaRqeR6zFus7EZTwtX sNzs5bP8y51PSUDJbeiy2RNCNKWFMndM22TZnk3GNG45nQd4OwYK0RZVrikalmJY5Q6m7Z16 4yrZgIXFdKj2t8F+x613/SJW1lIr9/bDp4U9tw0V1g3l2dFtD3p3ZrQ3hpoDtoK70ioIAjjH aIXIAcm3FGZFXy503DOA0KaTWwvOVdYCFLm3zWuSOmrX/GsEc7ovasOWwjPn878qVjbUKWwx Q4QkF4OhUV9zPtf9tDSAZ3x7QSwoKbCoRCZ/xbyTUPyQ1VvNy/mYrBcYlzHodsaqUDjHuW+I SQQYEQIACQUCRND5ggIbDAAKCRBy3lIGd+N/BCO8AJ9j1dWVQWxw/YdTbEyrRKOY8YZNwwCf afMAg8QvmOWnHx3wl8WslCaXaE8= Message-ID: Date: Wed, 20 Nov 2019 08:42:28 -0800 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.12; rv:60.0) Gecko/20100101 Thunderbird/60.9.1 MIME-Version: 1.0 In-Reply-To: <201911201635.xAKGZwT4082365@repo.freebsd.org> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 20 Nov 2019 16:42:34 -0000 On 11/20/19 8:35 AM, Li-Wen Hsu wrote: > Author: lwhsu > Date: Wed Nov 20 16:35:58 2019 > New Revision: 354899 > URL: https://svnweb.freebsd.org/changeset/base/354899 > > Log: > Limit the workaround to riscv only > > PR: 242109 > Sponsored by: The FreeBSD Foundation > > Modified: > head/usr.sbin/jail/Makefile > > Modified: head/usr.sbin/jail/Makefile > ============================================================================== > --- head/usr.sbin/jail/Makefile Wed Nov 20 16:32:13 2019 (r354898) > +++ head/usr.sbin/jail/Makefile Wed Nov 20 16:35:58 2019 (r354899) > @@ -18,7 +18,9 @@ CFLAGS+=-I. -I${.CURDIR} > # workaround for GNU ld (GNU Binutils) 2.33.1: > # relocation truncated to fit: R_RISCV_GPREL_I against `.LANCHOR2' > # https://bugs.freebsd.org/242109 > +.if ${MACHINE_ARCH} == "riscv" > CFLAGS+=-Wl,--no-relax > +.endif Eh, will that work? I think MACHINE and MACHINE_CPUARCH are riscv, but MACHINE_ARCH is riscv64 and riscv64sf. Also, it would be good to wrap this in .if ${LINKER_TYPE} == "bfd" I think. (I was able to build a world + kernel with lld earlier this week, though it doesn't yet boot) -- John Baldwin From owner-svn-src-all@freebsd.org Wed Nov 20 16:54:22 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 6511C1BC07C; Wed, 20 Nov 2019 16:54:22 +0000 (UTC) (envelope-from lwhsu@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47J81B22B5z43tH; Wed, 20 Nov 2019 16:54:22 +0000 (UTC) (envelope-from lwhsu@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 28E1325B1A; Wed, 20 Nov 2019 16:54:22 +0000 (UTC) (envelope-from lwhsu@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xAKGsMOM094015; Wed, 20 Nov 2019 16:54:22 GMT (envelope-from lwhsu@FreeBSD.org) Received: (from lwhsu@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xAKGsMTv094014; Wed, 20 Nov 2019 16:54:22 GMT (envelope-from lwhsu@FreeBSD.org) Message-Id: <201911201654.xAKGsMTv094014@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: lwhsu set sender to lwhsu@FreeBSD.org using -f From: Li-Wen Hsu Date: Wed, 20 Nov 2019 16:54:22 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354900 - head/usr.sbin/jail X-SVN-Group: head X-SVN-Commit-Author: lwhsu X-SVN-Commit-Paths: head/usr.sbin/jail X-SVN-Commit-Revision: 354900 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 20 Nov 2019 16:54:22 -0000 Author: lwhsu Date: Wed Nov 20 16:54:21 2019 New Revision: 354900 URL: https://svnweb.freebsd.org/changeset/base/354900 Log: Use the correct variable, also limit the scope to bfd PR: 242109 Reported by: jhb Sponsored by: The FreeBSD Foundation Modified: head/usr.sbin/jail/Makefile Modified: head/usr.sbin/jail/Makefile ============================================================================== --- head/usr.sbin/jail/Makefile Wed Nov 20 16:35:58 2019 (r354899) +++ head/usr.sbin/jail/Makefile Wed Nov 20 16:54:21 2019 (r354900) @@ -18,7 +18,7 @@ CFLAGS+=-I. -I${.CURDIR} # workaround for GNU ld (GNU Binutils) 2.33.1: # relocation truncated to fit: R_RISCV_GPREL_I against `.LANCHOR2' # https://bugs.freebsd.org/242109 -.if ${MACHINE_ARCH} == "riscv" +.if ${LINKER_TYPE} == "bfd" && ${MACHINE} == "riscv" CFLAGS+=-Wl,--no-relax .endif From owner-svn-src-all@freebsd.org Wed Nov 20 16:58:20 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id B71471BC25A; Wed, 20 Nov 2019 16:58:20 +0000 (UTC) (envelope-from lwhsu.freebsd@gmail.com) Received: from mail-yw1-f68.google.com (mail-yw1-f68.google.com [209.85.161.68]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47J85m4WDnz449P; Wed, 20 Nov 2019 16:58:20 +0000 (UTC) (envelope-from lwhsu.freebsd@gmail.com) Received: by mail-yw1-f68.google.com with SMTP id y64so209213ywe.3; Wed, 20 Nov 2019 08:58:20 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=3E8tWrcdWSnY2EEhsL10JUvzgzrgXoNDi+Bh2vIaG50=; b=ECygpPE0E4OYmNdPOxVvczvWI6FBT+p1g1GNrz+8oRrKWIOfl4M+c7b6fmxiMty8v2 cGaz8pM3PAp6AgEya5rNZQUtTc0eisvJraGjdCw94u7z98wWTw+L0JssoyYFYadYYnA2 X5ez58hOOXVecIEcALVAenbmm3A1TOwjgBf/9xcN8YmwVnYiJbLltdvEfSyD+WR+bQGN go4HRp7mCRxIPRHlXBGtN0q+uNbG9O5o4WMy2vIV2K5UwQAQOr6XgWBjXFxvp6P82MH4 KB19Rtqvq73ZPT68H7IbyrXORUpSLwgCGeQ5KCgQdfE0aSZzTrShRrZiXVLB6AMU22fB Tovw== X-Gm-Message-State: APjAAAVbxBDoNgthvIAuTaooz1fxU1nUlfVD8KcSmK5o1fOtNVs2oxc6 jsoOteCtXldhVOQMwY6ldF5UH4EKw26+z2RChCcyYNCe X-Google-Smtp-Source: APXvYqx4cdTgIygqRP9xrsr0kKOmjG1cb/8VDb7G9+v2cQE3gM+0E3AIhe5Lw9IVfhGs6yK7aZ6aedwzrjwt5qLhUjk= X-Received: by 2002:a81:8301:: with SMTP id t1mr2326496ywf.400.1574269099002; Wed, 20 Nov 2019 08:58:19 -0800 (PST) MIME-Version: 1.0 References: <201911201635.xAKGZwT4082365@repo.freebsd.org> In-Reply-To: From: Li-Wen Hsu Date: Thu, 21 Nov 2019 00:58:07 +0800 Message-ID: Subject: Re: svn commit: r354899 - head/usr.sbin/jail To: John Baldwin Cc: src-committers , svn-src-all , svn-src-head Content-Type: text/plain; charset="UTF-8" X-Rspamd-Queue-Id: 47J85m4WDnz449P X-Spamd-Bar: ----- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-6.00 / 15.00]; NEURAL_HAM_MEDIUM(-1.00)[-0.999,0]; REPLY(-4.00)[]; TAGGED_FROM(0.00)[]; NEURAL_HAM_LONG(-1.00)[-0.999,0] X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 20 Nov 2019 16:58:20 -0000 On Thu, Nov 21, 2019 at 12:42 AM John Baldwin wrote: > > On 11/20/19 8:35 AM, Li-Wen Hsu wrote: > > Author: lwhsu > > Date: Wed Nov 20 16:35:58 2019 > > New Revision: 354899 > > URL: https://svnweb.freebsd.org/changeset/base/354899 > > > > Log: > > Limit the workaround to riscv only > > > > PR: 242109 > > Sponsored by: The FreeBSD Foundation > > > > Modified: > > head/usr.sbin/jail/Makefile > > > > Modified: head/usr.sbin/jail/Makefile > > ============================================================================== > > --- head/usr.sbin/jail/Makefile Wed Nov 20 16:32:13 2019 (r354898) > > +++ head/usr.sbin/jail/Makefile Wed Nov 20 16:35:58 2019 (r354899) > > @@ -18,7 +18,9 @@ CFLAGS+=-I. -I${.CURDIR} > > # workaround for GNU ld (GNU Binutils) 2.33.1: > > # relocation truncated to fit: R_RISCV_GPREL_I against `.LANCHOR2' > > # https://bugs.freebsd.org/242109 > > +.if ${MACHINE_ARCH} == "riscv" > > CFLAGS+=-Wl,--no-relax > > +.endif > > Eh, will that work? I think MACHINE and MACHINE_CPUARCH are riscv, > but MACHINE_ARCH is riscv64 and riscv64sf. No it doesn't. I was too lazy to do scp from test machine to commit machine and caused a copy-n-paste error, but ${MACHINE} should be better since it covers more. > Also, it would be good to wrap this in .if ${LINKER_TYPE} == "bfd" I think. Also added in r354900. Thanks for the suggestion. > (I was able to build a world + kernel with lld earlier this week, though it > doesn't yet boot) Looking forward to building world & kernel with llvm toolchain. Thanks, Li-Wen From owner-svn-src-all@freebsd.org Wed Nov 20 17:24:50 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id BD1A81BCFAE; Wed, 20 Nov 2019 17:24:50 +0000 (UTC) (envelope-from arichardson@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47J8hL4WQCz45th; Wed, 20 Nov 2019 17:24:50 +0000 (UTC) (envelope-from arichardson@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 7E29426093; Wed, 20 Nov 2019 17:24:50 +0000 (UTC) (envelope-from arichardson@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xAKHOoZ2012272; Wed, 20 Nov 2019 17:24:50 GMT (envelope-from arichardson@FreeBSD.org) Received: (from arichardson@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xAKHOo80012270; Wed, 20 Nov 2019 17:24:50 GMT (envelope-from arichardson@FreeBSD.org) Message-Id: <201911201724.xAKHOo80012270@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: arichardson set sender to arichardson@FreeBSD.org using -f From: Alex Richardson Date: Wed, 20 Nov 2019 17:24:50 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354901 - head/usr.bin/xinstall X-SVN-Group: head X-SVN-Commit-Author: arichardson X-SVN-Commit-Paths: head/usr.bin/xinstall X-SVN-Commit-Revision: 354901 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 20 Nov 2019 17:24:50 -0000 Author: arichardson Date: Wed Nov 20 17:24:49 2019 New Revision: 354901 URL: https://svnweb.freebsd.org/changeset/base/354901 Log: Allow boostrapping xinstall on Linux Linux does not have st_flags so we have to avoid using it there. Reviewed By: emaste, imp Differential Revision: https://reviews.freebsd.org/D22446 Modified: head/usr.bin/xinstall/Makefile head/usr.bin/xinstall/xinstall.c Modified: head/usr.bin/xinstall/Makefile ============================================================================== --- head/usr.bin/xinstall/Makefile Wed Nov 20 16:54:21 2019 (r354900) +++ head/usr.bin/xinstall/Makefile Wed Nov 20 17:24:49 2019 (r354901) @@ -11,7 +11,6 @@ MAN= install.1 .PATH: ${SRCTOP}/contrib/mtree CFLAGS+= -I${SRCTOP}/contrib/mtree CFLAGS+= -I${SRCTOP}/lib/libnetbsd -CFLAGS+= -DHAVE_STRUCT_STAT_ST_FLAGS=1 LIBADD= md Modified: head/usr.bin/xinstall/xinstall.c ============================================================================== --- head/usr.bin/xinstall/xinstall.c Wed Nov 20 16:54:21 2019 (r354900) +++ head/usr.bin/xinstall/xinstall.c Wed Nov 20 17:24:49 2019 (r354901) @@ -75,6 +75,17 @@ __FBSDID("$FreeBSD$"); #include "mtree.h" +/* + * We need to build xinstall during the bootstrap stage when building on a + * non-FreeBSD system. Linux does not have the st_flags and st_birthtime + * members in struct stat so we need to omit support for changing those fields. + */ +#ifdef UF_SETTABLE +#define HAVE_STRUCT_STAT_ST_FLAGS 1 +#else +#define HAVE_STRUCT_STAT_ST_FLAGS 0 +#endif + #define MAX_CMP_SIZE (16 * 1024 * 1024) #define LN_ABSOLUTE 0x01 From owner-svn-src-all@freebsd.org Wed Nov 20 17:37:46 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 6AF931BD38A; Wed, 20 Nov 2019 17:37:46 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47J8zG26l5z46nF; Wed, 20 Nov 2019 17:37:46 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 27AE026252; Wed, 20 Nov 2019 17:37:46 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xAKHbkj9018351; Wed, 20 Nov 2019 17:37:46 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xAKHbj2Z018349; Wed, 20 Nov 2019 17:37:45 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201911201737.xAKHbj2Z018349@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Wed, 20 Nov 2019 17:37:45 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354902 - in head: . share/mk X-SVN-Group: head X-SVN-Commit-Author: emaste X-SVN-Commit-Paths: in head: . share/mk X-SVN-Commit-Revision: 354902 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 20 Nov 2019 17:37:46 -0000 Author: emaste Date: Wed Nov 20 17:37:45 2019 New Revision: 354902 URL: https://svnweb.freebsd.org/changeset/base/354902 Log: disable amd(8) by default As of FreeBSD 10.1 the autofs(5) is available for automounting, and the amd man page has indicated that the in-tree copy of amd is obsolete. Disable it by default for now, with the expectation that it will be removed before FreeBSD 13.0. Reviewed by: kevans Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D22460 Modified: head/UPDATING head/share/mk/src.opts.mk Modified: head/UPDATING ============================================================================== --- head/UPDATING Wed Nov 20 17:24:49 2019 (r354901) +++ head/UPDATING Wed Nov 20 17:37:45 2019 (r354902) @@ -26,6 +26,11 @@ NOTE TO PEOPLE WHO THINK THAT FreeBSD 13.x IS SLOW: disable the most expensive debugging functionality run "ln -s 'abort:false,junk:false' /etc/malloc.conf".) +20191120: + The amd(8) automount daemon has been disabled by default, and will be + removed in the future. As of FreeBSD 10.1 the autofs(5) is available + for automounting. + 20191107: The nctgpio and wbwd drivers have been moved to the superio bus. If you have one of these drivers in a kernel configuration, then Modified: head/share/mk/src.opts.mk ============================================================================== --- head/share/mk/src.opts.mk Wed Nov 20 17:24:49 2019 (r354901) +++ head/share/mk/src.opts.mk Wed Nov 20 17:37:45 2019 (r354902) @@ -55,7 +55,6 @@ ____: __DEFAULT_YES_OPTIONS = \ ACCT \ ACPI \ - AMD \ APM \ AT \ ATM \ @@ -193,6 +192,7 @@ __DEFAULT_YES_OPTIONS = \ ZONEINFO __DEFAULT_NO_OPTIONS = \ + AMD \ BEARSSL \ BSD_GREP \ CLANG_EXTRAS \ From owner-svn-src-all@freebsd.org Wed Nov 20 17:45:32 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 66A181BD8D8; Wed, 20 Nov 2019 17:45:32 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47J98D26gNz47ZC; Wed, 20 Nov 2019 17:45:32 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 2C0892643B; Wed, 20 Nov 2019 17:45:32 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xAKHjWGR024247; Wed, 20 Nov 2019 17:45:32 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xAKHjWCS024246; Wed, 20 Nov 2019 17:45:32 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201911201745.xAKHjWCS024246@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Wed, 20 Nov 2019 17:45:32 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354903 - head/tools/build/options X-SVN-Group: head X-SVN-Commit-Author: emaste X-SVN-Commit-Paths: head/tools/build/options X-SVN-Commit-Revision: 354903 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 20 Nov 2019 17:45:32 -0000 Author: emaste Date: Wed Nov 20 17:45:31 2019 New Revision: 354903 URL: https://svnweb.freebsd.org/changeset/base/354903 Log: Add description for WITH_AMD WITHOUT_AMD is now the default as of r354902. Sponsored by: The FreeBSD Foundation Added: head/tools/build/options/WITH_AMD - copied, changed from r354901, head/tools/build/options/WITHOUT_AMD Copied and modified: head/tools/build/options/WITH_AMD (from r354901, head/tools/build/options/WITHOUT_AMD) ============================================================================== --- head/tools/build/options/WITHOUT_AMD Wed Nov 20 17:24:49 2019 (r354901, copy source) +++ head/tools/build/options/WITH_AMD Wed Nov 20 17:45:31 2019 (r354903) @@ -1,4 +1,4 @@ .\" $FreeBSD$ -Set to not build +Set to build .Xr amd 8 , and related programs. From owner-svn-src-all@freebsd.org Wed Nov 20 17:49:33 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 2579D1BDAFC; Wed, 20 Nov 2019 17:49:33 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47J9Ds0B52z47rl; Wed, 20 Nov 2019 17:49:33 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id D99C82643D; Wed, 20 Nov 2019 17:49:32 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xAKHnWYf024463; Wed, 20 Nov 2019 17:49:32 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xAKHnWWd024462; Wed, 20 Nov 2019 17:49:32 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201911201749.xAKHnWWd024462@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Wed, 20 Nov 2019 17:49:32 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354904 - head/share/man/man5 X-SVN-Group: head X-SVN-Commit-Author: emaste X-SVN-Commit-Paths: head/share/man/man5 X-SVN-Commit-Revision: 354904 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 20 Nov 2019 17:49:33 -0000 Author: emaste Date: Wed Nov 20 17:49:32 2019 New Revision: 354904 URL: https://svnweb.freebsd.org/changeset/base/354904 Log: src.conf.5: regen after r354902, WITHOUT_AMD by default Modified: head/share/man/man5/src.conf.5 Modified: head/share/man/man5/src.conf.5 ============================================================================== --- head/share/man/man5/src.conf.5 Wed Nov 20 17:45:31 2019 (r354903) +++ head/share/man/man5/src.conf.5 Wed Nov 20 17:49:32 2019 (r354904) @@ -1,6 +1,6 @@ .\" DO NOT EDIT-- this file is @generated by tools/build/options/makeman. .\" $FreeBSD$ -.Dd October 23, 2019 +.Dd November 20, 2019 .Dt SRC.CONF 5 .Os .Sh NAME @@ -100,8 +100,8 @@ Set to not build .Xr acpiconf 8 , .Xr acpidump 8 and related programs. -.It Va WITHOUT_AMD -Set to not build +.It Va WITH_AMD +Set to build .Xr amd 8 , and related programs. .It Va WITHOUT_APM From owner-svn-src-all@freebsd.org Wed Nov 20 17:49:59 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 56D4E1BDB9B; Wed, 20 Nov 2019 17:49:59 +0000 (UTC) (envelope-from andrew@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47J9FM1f6Sz4813; Wed, 20 Nov 2019 17:49:59 +0000 (UTC) (envelope-from andrew@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 1CA9C2643E; Wed, 20 Nov 2019 17:49:59 +0000 (UTC) (envelope-from andrew@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xAKHnw6O024526; Wed, 20 Nov 2019 17:49:58 GMT (envelope-from andrew@FreeBSD.org) Received: (from andrew@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xAKHnwIo024525; Wed, 20 Nov 2019 17:49:58 GMT (envelope-from andrew@FreeBSD.org) Message-Id: <201911201749.xAKHnwIo024525@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: andrew set sender to andrew@FreeBSD.org using -f From: Andrew Turner Date: Wed, 20 Nov 2019 17:49:58 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354905 - head/sys/vm X-SVN-Group: head X-SVN-Commit-Author: andrew X-SVN-Commit-Paths: head/sys/vm X-SVN-Commit-Revision: 354905 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 20 Nov 2019 17:49:59 -0000 Author: andrew Date: Wed Nov 20 17:49:58 2019 New Revision: 354905 URL: https://svnweb.freebsd.org/changeset/base/354905 Log: Use atomic_load_16 to load aflags as it's a uint16_t after r354820. Sponsored by: DARPA, AFRL Modified: head/sys/vm/vm_page.c Modified: head/sys/vm/vm_page.c ============================================================================== --- head/sys/vm/vm_page.c Wed Nov 20 17:49:32 2019 (r354904) +++ head/sys/vm/vm_page.c Wed Nov 20 17:49:58 2019 (r354905) @@ -3185,7 +3185,7 @@ vm_pqbatch_process_page(struct vm_pagequeue *pq, vm_pa * the page queue lock held. In this case it is about to free the page, * which must not have any queue state. */ - qflags = atomic_load_8(&m->aflags); + qflags = atomic_load_16(&m->aflags); KASSERT(pq == vm_page_pagequeue(m) || (qflags & PGA_QUEUE_STATE_MASK) == 0, ("page %p doesn't belong to queue %p but has aflags %#x", @@ -3433,7 +3433,7 @@ vm_page_dequeue(vm_page_t m) * vm_page_dequeue_complete(). Ensure that all queue * state is cleared before we return. */ - aflags = atomic_load_8(&m->aflags); + aflags = atomic_load_16(&m->aflags); if ((aflags & PGA_QUEUE_STATE_MASK) == 0) return; KASSERT((aflags & PGA_DEQUEUE) != 0, From owner-svn-src-all@freebsd.org Wed Nov 20 17:57:46 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id D7E5A1BDE4E; Wed, 20 Nov 2019 17:57:46 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47J9QL64rgz48Ry; Wed, 20 Nov 2019 17:57:46 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 99AF12660A; Wed, 20 Nov 2019 17:57:46 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xAKHvkc0030156; Wed, 20 Nov 2019 17:57:46 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xAKHvkCd030155; Wed, 20 Nov 2019 17:57:46 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201911201757.xAKHvkCd030155@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Wed, 20 Nov 2019 17:57:46 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354906 - head/share/man/man5 X-SVN-Group: head X-SVN-Commit-Author: emaste X-SVN-Commit-Paths: head/share/man/man5 X-SVN-Commit-Revision: 354906 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 20 Nov 2019 17:57:46 -0000 Author: emaste Date: Wed Nov 20 17:57:46 2019 New Revision: 354906 URL: https://svnweb.freebsd.org/changeset/base/354906 Log: src.conf.5: regen for several recent changes r354289 armv6: Switch to LLD by default r354290 Take arm.arm (armv5) out of universe r354348 armv6, armv7: Switch to llvm-libunwind by default r354660 Enable the RISC-V LLVM backend by default. as well as lib32 changes Sponsored by: The FreeBSD Foundation Modified: head/share/man/man5/src.conf.5 Modified: head/share/man/man5/src.conf.5 ============================================================================== --- head/share/man/man5/src.conf.5 Wed Nov 20 17:49:58 2019 (r354905) +++ head/share/man/man5/src.conf.5 Wed Nov 20 17:57:46 2019 (r354906) @@ -197,7 +197,7 @@ as part of the normal system build. .Pp This is a default setting on -amd64/amd64, arm/arm, arm/armv6, arm/armv7, i386/i386, mips/mipsel, mips/mips, mips/mips64el, mips/mips64, mips/mipsn32, mips/mipselhf, mips/mipshf, mips/mips64elhf, mips/mips64hf and sparc64/sparc64. +amd64/amd64, arm/armv6, arm/armv7, i386/i386, mips/mipsel, mips/mips, mips/mips64el, mips/mips64, mips/mipsn32, mips/mipselhf, mips/mipshf, mips/mips64elhf, mips/mips64hf and sparc64/sparc64. .It Va WITHOUT_BINUTILS_BOOTSTRAP Set to not build binutils (as, ld, and objdump) as part of the bootstrap process. @@ -213,7 +213,7 @@ Set build binutils (as, ld, and objdump) as part of the bootstrap process. .Pp This is a default setting on -amd64/amd64, arm/arm, arm/armv6, arm/armv7, i386/i386, mips/mipsel, mips/mips, mips/mips64el, mips/mips64, mips/mipsn32, mips/mipselhf, mips/mipshf, mips/mips64elhf, mips/mips64hf and sparc64/sparc64. +amd64/amd64, arm/armv6, arm/armv7, i386/i386, mips/mipsel, mips/mips, mips/mips64el, mips/mips64, mips/mipsn32, mips/mipselhf, mips/mipshf, mips/mips64elhf, mips/mips64hf and sparc64/sparc64. .It Va WITHOUT_BLACKLIST Set this if you do not want to build .Xr blacklistd 8 @@ -268,7 +268,7 @@ and .Pa crtend.o . .Pp This is a default setting on -amd64/amd64, arm/arm, arm/armv6, arm/armv7, arm64/aarch64, i386/i386, riscv/riscv64, mips/mipsel, mips/mips, mips/mips64el, mips/mips64, mips/mipsn32, mips/mipselhf, mips/mipshf, mips/mips64elhf and mips/mips64hf. +amd64/amd64, arm/armv6, arm/armv7, arm64/aarch64, i386/i386, riscv/riscv64, mips/mipsel, mips/mips, mips/mips64el, mips/mips64, mips/mipsn32, mips/mipselhf, mips/mipshf, mips/mips64elhf and mips/mips64hf. .It Va WITH_BSD_GREP Install BSD-licensed grep as '[ef]grep' instead of GNU grep. .It Va WITHOUT_BSNMP @@ -365,7 +365,7 @@ When set, it enforces these options: Set to not build the Clang C/C++ compiler during the regular phase of the build. .Pp This is a default setting on -riscv/riscv64 and sparc64/sparc64. +sparc64/sparc64. When set, it enforces these options: .Pp .Bl -item -compact @@ -400,6 +400,10 @@ is set explicitly) (unless .Va WITH_LLVM_TARGET_POWERPC is set explicitly) +.It Va WITHOUT_LLVM_TARGET_RISCV +(unless +.Va WITH_LLVM_TARGET_RISCV +is set explicitly) .It Va WITHOUT_LLVM_TARGET_SPARC (unless .Va WITH_LLVM_TARGET_SPARC @@ -413,7 +417,7 @@ is set explicitly) Set to build the Clang C/C++ compiler during the normal phase of the build. .Pp This is a default setting on -amd64/amd64, arm/arm, arm/armv6, arm/armv7, arm64/aarch64, i386/i386, mips/mipsel, mips/mips, mips/mips64el, mips/mips64, mips/mipsn32, mips/mipselhf, mips/mipshf, mips/mips64elhf and mips/mips64hf. +amd64/amd64, arm/armv6, arm/armv7, arm64/aarch64, i386/i386, riscv/riscv64, mips/mipsel, mips/mips, mips/mips64el, mips/mips64, mips/mipsn32, mips/mipselhf, mips/mipshf, mips/mips64elhf and mips/mips64hf. .It Va WITHOUT_CLANG_BOOTSTRAP Set to not build the Clang C/C++ compiler during the bootstrap phase of the build. @@ -426,7 +430,7 @@ riscv/riscv64, mips/mipsel, mips/mips, mips/mips64el, Set to build the Clang C/C++ compiler during the bootstrap phase of the build. .Pp This is a default setting on -amd64/amd64, arm/arm, arm/armv6, arm/armv7, arm64/aarch64 and i386/i386. +amd64/amd64, arm/armv6, arm/armv7, arm64/aarch64 and i386/i386. .It Va WITH_CLANG_EXTRAS Set to build additional clang and llvm tools, such as bugpoint and clang-format. @@ -435,13 +439,13 @@ Set to avoid building the ARCMigrate, Rewriter and Sta the Clang C/C++ compiler. .Pp This is a default setting on -riscv/riscv64 and sparc64/sparc64. +sparc64/sparc64. .It Va WITH_CLANG_FULL Set to build the ARCMigrate, Rewriter and StaticAnalyzer components of the Clang C/C++ compiler. .Pp This is a default setting on -amd64/amd64, arm/arm, arm/armv6, arm/armv7, arm64/aarch64, i386/i386, mips/mipsel, mips/mips, mips/mips64el, mips/mips64, mips/mipsn32, mips/mipselhf, mips/mipshf, mips/mips64elhf and mips/mips64hf. +amd64/amd64, arm/armv6, arm/armv7, arm64/aarch64, i386/i386, riscv/riscv64, mips/mipsel, mips/mips, mips/mips64el, mips/mips64, mips/mipsn32, mips/mipselhf, mips/mipshf, mips/mips64elhf and mips/mips64hf. .It Va WITHOUT_CLANG_IS_CC Set to install the GCC compiler as .Pa /usr/bin/cc , @@ -459,7 +463,7 @@ and .Pa /usr/bin/cpp . .Pp This is a default setting on -amd64/amd64, arm/arm, arm/armv6, arm/armv7, arm64/aarch64 and i386/i386. +amd64/amd64, arm/armv6, arm/armv7, arm64/aarch64 and i386/i386. .It Va WITHOUT_CPP Set to not build .Xr cpp 1 . @@ -522,7 +526,7 @@ Set to not build .Xr cxgbetool 8 .Pp This is a default setting on -arm/arm, arm/armv6, arm/armv7, riscv/riscv64, mips/mipsel, mips/mips, mips/mips64el, mips/mips64, mips/mipsn32, mips/mipselhf, mips/mipshf, mips/mips64elhf and mips/mips64hf. +arm/armv6, arm/armv7, riscv/riscv64, mips/mipsel, mips/mips, mips/mips64el, mips/mips64, mips/mipsn32, mips/mipselhf, mips/mipshf, mips/mips64elhf and mips/mips64hf. .It Va WITH_CXGBETOOL Set to build .Xr cxgbetool 8 @@ -691,7 +695,7 @@ and .Xr efivar 8 . .Pp This is a default setting on -amd64/amd64, arm/arm, arm/armv6, arm/armv7, arm64/aarch64 and i386/i386. +amd64/amd64, arm/armv6, arm/armv7, arm64/aarch64 and i386/i386. .It Va WITHOUT_ELFTOOLCHAIN_BOOTSTRAP Set to not build ELF Tool Chain tools (addr2line, nm, size, strings and strip) @@ -749,7 +753,7 @@ Set to not build games. Set to not build and install gcc and g++ as part of the normal build process. .Pp This is a default setting on -amd64/amd64, arm/arm, arm/armv6, arm/armv7, arm64/aarch64, i386/i386 and riscv/riscv64. +amd64/amd64, arm/armv6, arm/armv7, arm64/aarch64, i386/i386 and riscv/riscv64. .It Va WITH_GCC Set to build and install gcc and g++. .Pp @@ -762,7 +766,7 @@ unless an alternative compiler is provided via XCC. .Pp This is a default setting on -amd64/amd64, arm/arm, arm/armv6, arm/armv7, arm64/aarch64, i386/i386 and riscv/riscv64. +amd64/amd64, arm/armv6, arm/armv7, arm64/aarch64, i386/i386 and riscv/riscv64. .It Va WITH_GCC_BOOTSTRAP Set to build gcc and g++ as part of the bootstrap process. .Pp @@ -783,7 +787,7 @@ Set to build .Xr gdb 1 . .Pp This is a default setting on -amd64/amd64, arm/arm, arm/armv6, arm/armv7, i386/i386, mips/mipsel, mips/mips, mips/mips64el, mips/mips64, mips/mipsn32, mips/mipselhf, mips/mipshf, mips/mips64elhf, mips/mips64hf and sparc64/sparc64. +amd64/amd64, arm/armv6, arm/armv7, i386/i386, mips/mipsel, mips/mips, mips/mips64el, mips/mips64, mips/mipsn32, mips/mipselhf, mips/mipshf, mips/mips64elhf, mips/mips64hf and sparc64/sparc64. .It Va WITHOUT_GDB_LIBEXEC Set to install .Xr gdb 1 @@ -804,13 +808,13 @@ to be used as a fallback for if a newer version is not installed. .Pp This is a default setting on -amd64/amd64, arm/arm, arm/armv6, arm/armv7, arm64/aarch64, i386/i386, riscv/riscv64, mips/mipsel, mips/mips, mips/mips64el, mips/mips64, mips/mipsn32, mips/mipselhf, mips/mipshf, mips/mips64elhf and mips/mips64hf. +amd64/amd64, arm/armv6, arm/armv7, arm64/aarch64, i386/i386, riscv/riscv64, mips/mipsel, mips/mips, mips/mips64el, mips/mips64, mips/mipsn32, mips/mipselhf, mips/mipshf, mips/mips64elhf and mips/mips64hf. .It Va WITHOUT_GNUCXX Do not build the GNU C++ stack (g++, libstdc++). This is the default on platforms where clang is the system compiler. .Pp This is a default setting on -amd64/amd64, arm/arm, arm/armv6, arm/armv7, arm64/aarch64 and i386/i386. +amd64/amd64, arm/armv6, arm/armv7, arm64/aarch64 and i386/i386. .It Va WITH_GNUCXX Build the GNU C++ stack (g++, libstdc++). This is the default on platforms where gcc is the system compiler. @@ -844,7 +848,7 @@ Set to build and install and dependent tests. .Pp This is a default setting on -amd64/amd64, arm/arm, arm/armv6, arm/armv7, arm64/aarch64, i386/i386, riscv/riscv64 and sparc64/sparc64. +amd64/amd64, arm/armv6, arm/armv7, arm64/aarch64, i386/i386, riscv/riscv64 and sparc64/sparc64. .It Va WITHOUT_GPIO Set to not build .Xr gpioctl 8 @@ -854,7 +858,7 @@ Set to build the BSD licensed version of the device tr than the GPLed one from elinux.org. .Pp This is a default setting on -amd64/amd64, arm/arm, arm/armv6, arm/armv7, arm64/aarch64 and i386/i386. +amd64/amd64, arm/armv6, arm/armv7, arm64/aarch64 and i386/i386. .It Va WITH_GPL_DTC Set to build the GPL'd version of the device tree compiler from elinux.org, instead of the BSD licensed one. @@ -877,7 +881,7 @@ Set to build and install httpd Set to not build or install HyperV utilities. .Pp This is a default setting on -arm/arm, arm/armv6, arm/armv7, arm64/aarch64, riscv/riscv64, mips/mipsel, mips/mips, mips/mips64el, mips/mips64, mips/mipsn32, mips/mipselhf, mips/mipshf, mips/mips64elhf, mips/mips64hf and sparc64/sparc64. +arm/armv6, arm/armv7, arm64/aarch64, riscv/riscv64, mips/mipsel, mips/mips, mips/mips64el, mips/mips64, mips/mipsn32, mips/mipselhf, mips/mipshf, mips/mips64elhf, mips/mips64hf and sparc64/sparc64. .It Va WITH_HYPERV Set to build or install HyperV utilities. .Pp @@ -1029,6 +1033,9 @@ and On 64-bit platforms, set to not build 32-bit library set and a .Nm ld-elf32.so.1 runtime linker. +.Pp +This is a default setting on +arm/armv6, arm/armv7, arm64/aarch64, i386/i386, riscv/riscv64, mips/mipsel, mips/mips, mips/mipsn32, mips/mipselhf, mips/mipshf and sparc64/sparc64. .It Va WITHOUT_LIBCPLUSPLUS Set to avoid building libcxxrt and libc++. .It Va WITHOUT_LIBPTHREAD @@ -1054,17 +1061,17 @@ library. Set to not build LLVM's lld linker. .Pp This is a default setting on -riscv/riscv64 and sparc64/sparc64. +sparc64/sparc64. .It Va WITH_LLD Set to build LLVM's lld linker. .Pp This is a default setting on -amd64/amd64, arm/arm, arm/armv6, arm/armv7, arm64/aarch64, i386/i386, mips/mipsel, mips/mips, mips/mips64el, mips/mips64, mips/mipsn32, mips/mipselhf, mips/mipshf, mips/mips64elhf and mips/mips64hf. +amd64/amd64, arm/armv6, arm/armv7, arm64/aarch64, i386/i386, riscv/riscv64, mips/mipsel, mips/mips, mips/mips64el, mips/mips64, mips/mipsn32, mips/mipselhf, mips/mipshf, mips/mips64elhf and mips/mips64hf. .It Va WITHOUT_LLDB Set to not build the LLDB debugger. .Pp This is a default setting on -arm/arm, arm/armv6, arm/armv7, riscv/riscv64, mips/mipsel, mips/mips, mips/mips64el, mips/mips64, mips/mipsn32, mips/mipselhf, mips/mipshf, mips/mips64elhf, mips/mips64hf and sparc64/sparc64. +arm/armv6, arm/armv7, riscv/riscv64, mips/mipsel, mips/mips, mips/mips64el, mips/mips64, mips/mipsn32, mips/mipselhf, mips/mipshf, mips/mips64elhf, mips/mips64hf and sparc64/sparc64. .It Va WITH_LLDB Set to build the LLDB debugger. .Pp @@ -1077,47 +1084,47 @@ To be able to build the system, either Binutils or LLD enabled unless an alternate linker is provided via XLD. .Pp This is a default setting on -arm/arm, arm/armv6, riscv/riscv64, mips/mipsel, mips/mips, mips/mips64el, mips/mips64, mips/mipsn32, mips/mipselhf, mips/mipshf, mips/mips64elhf, mips/mips64hf and sparc64/sparc64. +riscv/riscv64, mips/mipsel, mips/mips, mips/mips64el, mips/mips64, mips/mipsn32, mips/mipselhf, mips/mipshf, mips/mips64elhf, mips/mips64hf and sparc64/sparc64. .It Va WITH_LLD_BOOTSTRAP Set to build the LLD linker during the bootstrap phase of the build, and use it during buildworld and buildkernel. .Pp This is a default setting on -amd64/amd64, arm/armv7, arm64/aarch64 and i386/i386. +amd64/amd64, arm/armv6, arm/armv7, arm64/aarch64 and i386/i386. .It Va WITHOUT_LLD_IS_LD Set to use GNU binutils ld as the system linker, instead of LLVM's LLD. .Pp This is a default setting on -arm/arm, arm/armv6, riscv/riscv64, mips/mipsel, mips/mips, mips/mips64el, mips/mips64, mips/mipsn32, mips/mipselhf, mips/mipshf, mips/mips64elhf, mips/mips64hf and sparc64/sparc64. +riscv/riscv64, mips/mipsel, mips/mips, mips/mips64el, mips/mips64, mips/mipsn32, mips/mipselhf, mips/mipshf, mips/mips64elhf, mips/mips64hf and sparc64/sparc64. .It Va WITH_LLD_IS_LD Set to use LLVM's LLD as the system linker, instead of GNU binutils ld. .Pp This is a default setting on -amd64/amd64, arm/armv7, arm64/aarch64 and i386/i386. +amd64/amd64, arm/armv6, arm/armv7, arm64/aarch64 and i386/i386. .It Va WITHOUT_LLVM_COV Set to not build the .Xr llvm-cov 1 tool. .Pp This is a default setting on -riscv/riscv64 and sparc64/sparc64. +sparc64/sparc64. .It Va WITH_LLVM_COV Set to build the .Xr llvm-cov 1 tool. .Pp This is a default setting on -amd64/amd64, arm/arm, arm/armv6, arm/armv7, arm64/aarch64, i386/i386, mips/mipsel, mips/mips, mips/mips64el, mips/mips64, mips/mipsn32, mips/mipselhf, mips/mipshf, mips/mips64elhf and mips/mips64hf. +amd64/amd64, arm/armv6, arm/armv7, arm64/aarch64, i386/i386, riscv/riscv64, mips/mipsel, mips/mips, mips/mips64el, mips/mips64, mips/mipsn32, mips/mipselhf, mips/mipshf, mips/mips64elhf and mips/mips64hf. .It Va WITHOUT_LLVM_LIBUNWIND Set to use GCC's stack unwinder (instead of LLVM's libunwind). .Pp This is a default setting on -arm/arm, arm/armv6, arm/armv7 and sparc64/sparc64. +sparc64/sparc64. .It Va WITH_LLVM_LIBUNWIND Set to use LLVM's libunwind stack unwinder (instead of GCC's unwinder). .Pp This is a default setting on -amd64/amd64, arm64/aarch64, i386/i386, riscv/riscv64, mips/mipsel, mips/mips, mips/mips64el, mips/mips64, mips/mipsn32, mips/mipselhf, mips/mipshf, mips/mips64elhf and mips/mips64hf. +amd64/amd64, arm/armv6, arm/armv7, arm64/aarch64, i386/i386, riscv/riscv64, mips/mipsel, mips/mips, mips/mips64el, mips/mips64, mips/mipsn32, mips/mipselhf, mips/mipshf, mips/mips64elhf and mips/mips64hf. .It Va WITHOUT_LLVM_TARGET_AARCH64 Set to not build LLVM target support for AArch64. The @@ -1125,7 +1132,7 @@ The option should be used rather than this in most cases. .Pp This is a default setting on -arm/arm, arm/armv6, riscv/riscv64 and sparc64/sparc64. +arm/armv6 and sparc64/sparc64. .It Va WITH_LLVM_TARGET_AARCH64 Set to build LLVM target support for AArch64. The @@ -1133,13 +1140,13 @@ The option should be used rather than this in most cases. .Pp This is a default setting on -amd64/amd64, arm/armv7, arm64/aarch64, i386/i386, mips/mipsel, mips/mips, mips/mips64el, mips/mips64, mips/mipsn32, mips/mipselhf, mips/mipshf, mips/mips64elhf and mips/mips64hf. +amd64/amd64, arm/armv7, arm64/aarch64, i386/i386, riscv/riscv64, mips/mipsel, mips/mips, mips/mips64el, mips/mips64, mips/mipsn32, mips/mipselhf, mips/mipshf, mips/mips64elhf and mips/mips64hf. .It Va WITHOUT_LLVM_TARGET_ALL Set to only build the required LLVM target support. This option is preferred to specific target support options. .Pp This is a default setting on -riscv/riscv64 and sparc64/sparc64. +sparc64/sparc64. When set, these options are also in effect: .Pp .Bl -inset -compact @@ -1159,6 +1166,10 @@ is set explicitly) (unless .Va WITH_LLVM_TARGET_POWERPC is set explicitly) +.It Va WITHOUT_LLVM_TARGET_RISCV +(unless +.Va WITH_LLVM_TARGET_RISCV +is set explicitly) .It Va WITHOUT_LLVM_TARGET_SPARC (unless .Va WITH_LLVM_TARGET_SPARC @@ -1170,7 +1181,7 @@ This option is always applied to the bootstrap compile LLVM is used. .Pp This is a default setting on -amd64/amd64, arm/arm, arm/armv6, arm/armv7, arm64/aarch64, i386/i386, mips/mipsel, mips/mips, mips/mips64el, mips/mips64, mips/mipsn32, mips/mipselhf, mips/mipshf, mips/mips64elhf and mips/mips64hf. +amd64/amd64, arm/armv6, arm/armv7, arm64/aarch64, i386/i386, riscv/riscv64, mips/mipsel, mips/mips, mips/mips64el, mips/mips64, mips/mipsn32, mips/mipselhf, mips/mipshf, mips/mips64elhf and mips/mips64hf. .It Va WITHOUT_LLVM_TARGET_ARM Set to not build LLVM target support for ARM. The @@ -1178,7 +1189,7 @@ The option should be used rather than this in most cases. .Pp This is a default setting on -riscv/riscv64 and sparc64/sparc64. +sparc64/sparc64. .It Va WITH_LLVM_TARGET_ARM Set to build LLVM target support for ARM. The @@ -1186,7 +1197,7 @@ The option should be used rather than this in most cases. .Pp This is a default setting on -amd64/amd64, arm/arm, arm/armv6, arm/armv7, arm64/aarch64, i386/i386, mips/mipsel, mips/mips, mips/mips64el, mips/mips64, mips/mipsn32, mips/mipselhf, mips/mipshf, mips/mips64elhf and mips/mips64hf. +amd64/amd64, arm/armv6, arm/armv7, arm64/aarch64, i386/i386, riscv/riscv64, mips/mipsel, mips/mips, mips/mips64el, mips/mips64, mips/mipsn32, mips/mipselhf, mips/mipshf, mips/mips64elhf and mips/mips64hf. .It Va WITH_LLVM_TARGET_BPF Set to build LLVM target support for BPF. The @@ -1199,7 +1210,7 @@ The option should be used rather than this in most cases. .Pp This is a default setting on -arm/arm, arm/armv6, riscv/riscv64 and sparc64/sparc64. +arm/armv6 and sparc64/sparc64. .It Va WITH_LLVM_TARGET_MIPS Set to build LLVM target support for MIPS. The @@ -1207,7 +1218,7 @@ The option should be used rather than this in most cases. .Pp This is a default setting on -amd64/amd64, arm/armv7, arm64/aarch64, i386/i386, mips/mipsel, mips/mips, mips/mips64el, mips/mips64, mips/mipsn32, mips/mipselhf, mips/mipshf, mips/mips64elhf and mips/mips64hf. +amd64/amd64, arm/armv7, arm64/aarch64, i386/i386, riscv/riscv64, mips/mipsel, mips/mips, mips/mips64el, mips/mips64, mips/mipsn32, mips/mipselhf, mips/mipshf, mips/mips64elhf and mips/mips64hf. .It Va WITHOUT_LLVM_TARGET_POWERPC Set to not build LLVM target support for PowerPC. The @@ -1215,7 +1226,7 @@ The option should be used rather than this in most cases. .Pp This is a default setting on -arm/arm, arm/armv6, riscv/riscv64 and sparc64/sparc64. +arm/armv6 and sparc64/sparc64. .It Va WITH_LLVM_TARGET_POWERPC Set to build LLVM target support for PowerPC. The @@ -1223,12 +1234,23 @@ The option should be used rather than this in most cases. .Pp This is a default setting on -amd64/amd64, arm/armv7, arm64/aarch64, i386/i386, mips/mipsel, mips/mips, mips/mips64el, mips/mips64, mips/mipsn32, mips/mipselhf, mips/mipshf, mips/mips64elhf and mips/mips64hf. +amd64/amd64, arm/armv7, arm64/aarch64, i386/i386, riscv/riscv64, mips/mipsel, mips/mips, mips/mips64el, mips/mips64, mips/mipsn32, mips/mipselhf, mips/mipshf, mips/mips64elhf and mips/mips64hf. +.It Va WITHOUT_LLVM_TARGET_RISCV +Set to not build LLVM target support for RISC-V. +The +.Va LLVM_TARGET_ALL +option should be used rather than this in most cases. +.Pp +This is a default setting on +arm/armv6 and sparc64/sparc64. .It Va WITH_LLVM_TARGET_RISCV Set to build LLVM target support for RISC-V. The .Va LLVM_TARGET_ALL option should be used rather than this in most cases. +.Pp +This is a default setting on +amd64/amd64, arm/armv7, arm64/aarch64, i386/i386, riscv/riscv64, mips/mipsel, mips/mips, mips/mips64el, mips/mips64, mips/mipsn32, mips/mipselhf, mips/mipshf, mips/mips64elhf and mips/mips64hf. .It Va WITHOUT_LLVM_TARGET_SPARC Set to not build LLVM target support for SPARC. The @@ -1236,7 +1258,7 @@ The option should be used rather than this in most cases. .Pp This is a default setting on -arm/arm, arm/armv6, riscv/riscv64 and sparc64/sparc64. +arm/armv6 and sparc64/sparc64. .It Va WITH_LLVM_TARGET_SPARC Set to build LLVM target support for SPARC. The @@ -1244,7 +1266,7 @@ The option should be used rather than this in most cases. .Pp This is a default setting on -amd64/amd64, arm/armv7, arm64/aarch64, i386/i386, mips/mipsel, mips/mips, mips/mips64el, mips/mips64, mips/mipsn32, mips/mipselhf, mips/mipshf, mips/mips64elhf and mips/mips64hf. +amd64/amd64, arm/armv7, arm64/aarch64, i386/i386, riscv/riscv64, mips/mipsel, mips/mips, mips/mips64el, mips/mips64, mips/mipsn32, mips/mipselhf, mips/mipshf, mips/mips64elhf and mips/mips64hf. .It Va WITHOUT_LLVM_TARGET_X86 Set to not build LLVM target support for X86. The @@ -1252,7 +1274,7 @@ The option should be used rather than this in most cases. .Pp This is a default setting on -arm/arm, arm/armv6, riscv/riscv64 and sparc64/sparc64. +arm/armv6 and sparc64/sparc64. .It Va WITH_LLVM_TARGET_X86 Set to build LLVM target support for X86. The @@ -1260,7 +1282,7 @@ The option should be used rather than this in most cases. .Pp This is a default setting on -amd64/amd64, arm/armv7, arm64/aarch64, i386/i386, mips/mipsel, mips/mips, mips/mips64el, mips/mips64, mips/mipsn32, mips/mipselhf, mips/mipshf, mips/mips64elhf and mips/mips64hf. +amd64/amd64, arm/armv7, arm64/aarch64, i386/i386, riscv/riscv64, mips/mipsel, mips/mips, mips/mips64el, mips/mips64, mips/mipsn32, mips/mipselhf, mips/mipshf, mips/mips64elhf and mips/mips64hf. .It Va WITH_LOADER_EFI_SECUREBOOT Enable building .Xr loader 8 @@ -1281,7 +1303,7 @@ sparc64/sparc64. Set to build GELI bootloader support. .Pp This is a default setting on -amd64/amd64, arm/arm, arm/armv6, arm/armv7, arm64/aarch64, i386/i386, riscv/riscv64, mips/mipsel, mips/mips, mips/mips64el, mips/mips64, mips/mipsn32, mips/mipselhf, mips/mipshf, mips/mips64elhf and mips/mips64hf. +amd64/amd64, arm/armv6, arm/armv7, arm64/aarch64, i386/i386, riscv/riscv64, mips/mipsel, mips/mips, mips/mips64el, mips/mips64, mips/mipsn32, mips/mipselhf, mips/mipshf, mips/mips64elhf and mips/mips64hf. .It Va WITHOUT_LOADER_LUA Set to not build LUA bindings for the boot loader. .Pp @@ -1291,12 +1313,12 @@ sparc64/sparc64. Set to build LUA bindings for the boot loader. .Pp This is a default setting on -amd64/amd64, arm/arm, arm/armv6, arm/armv7, arm64/aarch64, i386/i386, riscv/riscv64, mips/mipsel, mips/mips, mips/mips64el, mips/mips64, mips/mipsn32, mips/mipselhf, mips/mipshf, mips/mips64elhf and mips/mips64hf. +amd64/amd64, arm/armv6, arm/armv7, arm64/aarch64, i386/i386, riscv/riscv64, mips/mipsel, mips/mips, mips/mips64el, mips/mips64, mips/mipsn32, mips/mipselhf, mips/mipshf, mips/mips64elhf and mips/mips64hf. .It Va WITHOUT_LOADER_OFW Disable building of openfirmware bootloader components. .Pp This is a default setting on -amd64/amd64, arm/arm, arm/armv6, arm/armv7, arm64/aarch64, i386/i386, riscv/riscv64, mips/mipsel, mips/mips, mips/mips64el, mips/mips64, mips/mipsn32, mips/mipselhf, mips/mipshf, mips/mips64elhf and mips/mips64hf. +amd64/amd64, arm/armv6, arm/armv7, arm64/aarch64, i386/i386, riscv/riscv64, mips/mipsel, mips/mips, mips/mips64el, mips/mips64, mips/mipsn32, mips/mipselhf, mips/mipshf, mips/mips64elhf and mips/mips64hf. .It Va WITH_LOADER_OFW Set to build openfirmware bootloader components. .Pp @@ -1311,7 +1333,7 @@ amd64/amd64, arm64/aarch64, i386/i386, riscv/riscv64 a Set to build ubldr. .Pp This is a default setting on -arm/arm, arm/armv6, arm/armv7, mips/mipsel, mips/mips, mips/mips64el, mips/mips64, mips/mipsn32, mips/mipselhf, mips/mipshf, mips/mips64elhf and mips/mips64hf. +arm/armv6, arm/armv7, mips/mipsel, mips/mips, mips/mips64el, mips/mips64, mips/mipsn32, mips/mipselhf, mips/mipshf, mips/mips64elhf and mips/mips64hf. .It Va WITH_LOADER_VERBOSE Set to build with extra verbose debugging in the loader. May explode already nearly too large loader over the limit. @@ -1471,7 +1493,7 @@ Set to not build .Xr mlx5tool 8 .Pp This is a default setting on -arm/arm, arm/armv6, arm/armv7, riscv/riscv64, mips/mipsel, mips/mips, mips/mips64el, mips/mips64, mips/mipsn32, mips/mipselhf, mips/mipshf, mips/mips64elhf and mips/mips64hf. +arm/armv6, arm/armv7, riscv/riscv64, mips/mipsel, mips/mips, mips/mips64el, mips/mips64, mips/mipsn32, mips/mipselhf, mips/mipshf, mips/mips64elhf and mips/mips64hf. .It Va WITH_MLX5TOOL Set to build .Xr mlx5tool 8 @@ -1542,7 +1564,7 @@ and related programs. Set to not build nvme related tools and kernel modules. .Pp This is a default setting on -arm/arm, arm/armv6, arm/armv7, riscv/riscv64, mips/mipsel, mips/mips, mips/mips64el, mips/mips64, mips/mipsn32, mips/mipselhf, mips/mipshf, mips/mips64elhf, mips/mips64hf and sparc64/sparc64. +arm/armv6, arm/armv7, riscv/riscv64, mips/mipsel, mips/mips, mips/mips64el, mips/mips64, mips/mipsn32, mips/mipselhf, mips/mipshf, mips/mips64elhf, mips/mips64hf and sparc64/sparc64. .It Va WITH_NVME Set to build nvme related tools and kernel modules. @@ -1563,7 +1585,7 @@ Enable building openldap support for kerberos. Set to not build LLVM's OpenMP runtime. .Pp This is a default setting on -arm/arm, arm/armv6, arm/armv7, arm64/aarch64, riscv/riscv64, mips/mipsel, mips/mips, mips/mips64el, mips/mips64, mips/mipsn32, mips/mipselhf, mips/mipshf, mips/mips64elhf, mips/mips64hf and sparc64/sparc64. +arm/armv6, arm/armv7, arm64/aarch64, riscv/riscv64, mips/mipsel, mips/mips, mips/mips64el, mips/mips64, mips/mipsn32, mips/mipselhf, mips/mipshf, mips/mips64elhf, mips/mips64hf and sparc64/sparc64. .It Va WITH_OPENMP Set to build LLVM's OpenMP runtime. .Pp @@ -1652,7 +1674,7 @@ Set to build profiled libraries for use with .Xr gprof 8 . .Pp This is a default setting on -amd64/amd64, arm/arm, arm/armv6, arm/armv7, arm64/aarch64, i386/i386, riscv/riscv64, mips/mipsel, mips/mips, mips/mipsn32, mips/mipselhf, mips/mipshf and sparc64/sparc64. +amd64/amd64, arm/armv6, arm/armv7, arm64/aarch64, i386/i386, riscv/riscv64, mips/mipsel, mips/mips, mips/mipsn32, mips/mipselhf, mips/mipshf and sparc64/sparc64. .It Va WITHOUT_QUOTAS Set to not build .Xr quota 1 @@ -1742,7 +1764,7 @@ mips/mipsel, mips/mips, mips/mips64el, mips/mips64, mi Set to build world with propolice stack smashing protection. .Pp This is a default setting on -amd64/amd64, arm/arm, arm/armv6, arm/armv7, arm64/aarch64, i386/i386, riscv/riscv64 and sparc64/sparc64. +amd64/amd64, arm/armv6, arm/armv7, arm64/aarch64, i386/i386, riscv/riscv64 and sparc64/sparc64. .It Va WITH_STAGING Enable staging of files to a stage tree. This can be best thought of as auto-install to From owner-svn-src-all@freebsd.org Wed Nov 20 18:00:44 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 160BB1BE1AA; Wed, 20 Nov 2019 18:00:44 +0000 (UTC) (envelope-from andrew@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47J9Tl6qRkz490g; Wed, 20 Nov 2019 18:00:43 +0000 (UTC) (envelope-from andrew@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id CDF502672D; Wed, 20 Nov 2019 18:00:43 +0000 (UTC) (envelope-from andrew@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xAKI0hZP031394; Wed, 20 Nov 2019 18:00:43 GMT (envelope-from andrew@FreeBSD.org) Received: (from andrew@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xAKI0hD8031393; Wed, 20 Nov 2019 18:00:43 GMT (envelope-from andrew@FreeBSD.org) Message-Id: <201911201800.xAKI0hD8031393@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: andrew set sender to andrew@FreeBSD.org using -f From: Andrew Turner Date: Wed, 20 Nov 2019 18:00:43 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354907 - head/sys/vm X-SVN-Group: head X-SVN-Commit-Author: andrew X-SVN-Commit-Paths: head/sys/vm X-SVN-Commit-Revision: 354907 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 20 Nov 2019 18:00:44 -0000 Author: andrew Date: Wed Nov 20 18:00:43 2019 New Revision: 354907 URL: https://svnweb.freebsd.org/changeset/base/354907 Log: As with r354905 use uint16_t to store aflags on the stack and as function arguments as the aflags size in vm_page_t has increased. Sponsored by: DARPA, AFRL Modified: head/sys/vm/vm_page.c Modified: head/sys/vm/vm_page.c ============================================================================== --- head/sys/vm/vm_page.c Wed Nov 20 17:57:46 2019 (r354906) +++ head/sys/vm/vm_page.c Wed Nov 20 18:00:43 2019 (r354907) @@ -433,7 +433,7 @@ sysctl_vm_page_blacklist(SYSCTL_HANDLER_ARGS) * Nonetheless, it write busies the page as a safety precaution. */ static void -vm_page_init_marker(vm_page_t marker, int queue, uint8_t aflags) +vm_page_init_marker(vm_page_t marker, int queue, uint16_t aflags) { bzero(marker, sizeof(*marker)); @@ -3175,7 +3175,7 @@ static inline void vm_pqbatch_process_page(struct vm_pagequeue *pq, vm_page_t m) { struct vm_domain *vmd; - uint8_t qflags; + uint16_t qflags; CRITICAL_ASSERT(curthread); vm_pagequeue_assert_locked(pq); @@ -3421,7 +3421,7 @@ void vm_page_dequeue(vm_page_t m) { struct vm_pagequeue *pq, *pq1; - uint8_t aflags; + uint16_t aflags; KASSERT(mtx_owned(vm_page_lockptr(m)) || m->ref_count == 0, ("page %p is allocated and unlocked", m)); From owner-svn-src-all@freebsd.org Wed Nov 20 18:01:43 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id D37EC1BE38B for ; Wed, 20 Nov 2019 18:01:43 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: from mail-qk1-x735.google.com (mail-qk1-x735.google.com [IPv6:2607:f8b0:4864:20::735]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47J9Vt6trVz499r for ; Wed, 20 Nov 2019 18:01:42 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: by mail-qk1-x735.google.com with SMTP id e2so604347qkn.5 for ; Wed, 20 Nov 2019 10:01:42 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bsdimp-com.20150623.gappssmtp.com; s=20150623; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=hLqK5e+8scpHJfzIwvUCsujzQapWmK+PJNzlCIfxb10=; b=0SZ8jfEWk3l7xjWd+k4WAspfoQXMAX+Yy36xlV+xdEhPtog5xXZWwJTPrqy7NNhxy8 /2RoSvLrhugdVWaEOgK4/zsQkXBTyWPrei8wEAT7mXd0E6giVNmAYO9+pPi7s1u4R8Wk 8M3J5qNZY1KJWk3Smn5q9tf2BeuA5PzT9O8BosMKL+Sjq8IGy3pkEnIS2W0cN39kFz4e 3Ee/TJj6+qXgQW7TeUoAL7im/JhjwW1QCiACclE+jEv5rbVFI1UrTZKDSt1MlzT2sDVC uXW1zu5nh3K/hFllLs+fvwkBJHzxJ74ugKuXy94nOO8ThGgRIFIzpH7NpbOPHwAKj3fT z24g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=hLqK5e+8scpHJfzIwvUCsujzQapWmK+PJNzlCIfxb10=; b=h6GHdd7IASvoXJDm7sHpvW3vmnB57Bgepkcl2B1IeCLMLCl52ce7Q8xQcypbmjzbz5 37INmFMo9/2x2bJ72P9qKnQub2KeWpSmCzKmfcqeloY7vAjPlMTwWe5+2JOSwYQy3Ocp hQQYod0oUfw1ukoItXNx6K/j6EnJmEbQG9j9fOAFI1mH3OD3hBXeiG9Y9S0BHxjMc+iv H/AD3K+j3BmwQuwisRNRmWQe6UZTDiUw+UskQhtz7Sq0T5NAnNGCySI1m2yDmNWwRLHU DvTviZJ6foxUA4qtPbQN7oSEqrc8B6I7rajMl8SvAmgZxZn/AUgmVGIMxjEO17GDxHq1 czvw== X-Gm-Message-State: APjAAAXPJdSyfOTrZhoiqH01SS7YbY6R6SFNjkva5x0f7dyeeGnPDS7a 3otOUwuPGhOglb9NPUkYtVw5KEGOFNp4366TuAPqs4eG X-Google-Smtp-Source: APXvYqwEmYMci1ZePRH8++yBfupNxh/5NLPXYdxXCX4j2dTZZY3BFsWQV+5Rel/6O0c6rUsXoXKjtiS+48VcoYnrfbU= X-Received: by 2002:a37:b0c5:: with SMTP id z188mr3732612qke.215.1574272901685; Wed, 20 Nov 2019 10:01:41 -0800 (PST) MIME-Version: 1.0 References: <201911201654.xAKGsMTv094014@repo.freebsd.org> In-Reply-To: <201911201654.xAKGsMTv094014@repo.freebsd.org> From: Warner Losh Date: Wed, 20 Nov 2019 11:01:30 -0700 Message-ID: Subject: Re: svn commit: r354900 - head/usr.sbin/jail To: Li-Wen Hsu Cc: src-committers , svn-src-all , svn-src-head X-Rspamd-Queue-Id: 47J9Vt6trVz499r X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; dkim=pass header.d=bsdimp-com.20150623.gappssmtp.com header.s=20150623 header.b=0SZ8jfEW; dmarc=none; spf=none (mx1.freebsd.org: domain of wlosh@bsdimp.com has no SPF policy when checking 2607:f8b0:4864:20::735) smtp.mailfrom=wlosh@bsdimp.com X-Spamd-Result: default: False [-4.74 / 15.00]; ARC_NA(0.00)[]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; R_DKIM_ALLOW(-0.20)[bsdimp-com.20150623.gappssmtp.com:s=20150623]; FROM_HAS_DN(0.00)[]; RCPT_COUNT_THREE(0.00)[4]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; MIME_GOOD(-0.10)[multipart/alternative,text/plain]; PREVIOUSLY_DELIVERED(0.00)[svn-src-all@freebsd.org]; DMARC_NA(0.00)[bsdimp.com]; TO_MATCH_ENVRCPT_SOME(0.00)[]; TO_DN_ALL(0.00)[]; DKIM_TRACE(0.00)[bsdimp-com.20150623.gappssmtp.com:+]; RCVD_IN_DNSWL_NONE(0.00)[5.3.7.0.0.0.0.0.0.0.0.0.0.0.0.0.0.2.0.0.4.6.8.4.0.b.8.f.7.0.6.2.list.dnswl.org : 127.0.5.0]; R_SPF_NA(0.00)[]; FORGED_SENDER(0.30)[imp@bsdimp.com,wlosh@bsdimp.com]; MIME_TRACE(0.00)[0:+,1:+,2:~]; IP_SCORE(-2.74)[ip: (-9.36), ipnet: 2607:f8b0::/32(-2.30), asn: 15169(-1.97), country: US(-0.05)]; ASN(0.00)[asn:15169, ipnet:2607:f8b0::/32, country:US]; FROM_NEQ_ENVFROM(0.00)[imp@bsdimp.com,wlosh@bsdimp.com]; RCVD_TLS_ALL(0.00)[]; RCVD_COUNT_TWO(0.00)[2] Content-Type: text/plain; charset="UTF-8" X-Content-Filtered-By: Mailman/MimeDel 2.1.29 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 20 Nov 2019 18:01:43 -0000 On Wed, Nov 20, 2019 at 9:54 AM Li-Wen Hsu wrote: > Author: lwhsu > Date: Wed Nov 20 16:54:21 2019 > New Revision: 354900 > URL: https://svnweb.freebsd.org/changeset/base/354900 > > Log: > Use the correct variable, also limit the scope to bfd > > PR: 242109 > Reported by: jhb > Sponsored by: The FreeBSD Foundation > > Modified: > head/usr.sbin/jail/Makefile > > Modified: head/usr.sbin/jail/Makefile > > ============================================================================== > --- head/usr.sbin/jail/Makefile Wed Nov 20 16:35:58 2019 (r354899) > +++ head/usr.sbin/jail/Makefile Wed Nov 20 16:54:21 2019 (r354900) > @@ -18,7 +18,7 @@ CFLAGS+=-I. -I${.CURDIR} > # workaround for GNU ld (GNU Binutils) 2.33.1: > # relocation truncated to fit: R_RISCV_GPREL_I against `.LANCHOR2' > # https://bugs.freebsd.org/242109 > -.if ${MACHINE_ARCH} == "riscv" > +.if ${LINKER_TYPE} == "bfd" && ${MACHINE} == "riscv" > MACHINE isn't the right thing to use here. It's never the proper thing in userland makefiles, unless they are interfacing with the kernel. MACHINE_CPUARCH is what you want here. Warner > CFLAGS+=-Wl,--no-relax > .endif > > From owner-svn-src-all@freebsd.org Wed Nov 20 18:02:46 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 430FC1BE46B for ; Wed, 20 Nov 2019 18:02:46 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: from mail-qk1-x730.google.com (mail-qk1-x730.google.com [IPv6:2607:f8b0:4864:20::730]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47J9X516BCz49c1 for ; Wed, 20 Nov 2019 18:02:44 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: by mail-qk1-x730.google.com with SMTP id q70so560592qke.12 for ; Wed, 20 Nov 2019 10:02:44 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bsdimp-com.20150623.gappssmtp.com; s=20150623; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=b+64UMHSUDyRQfHTT3o2l/FNe558uwoowkF0LhPvDxE=; b=ArE25kUJTwgJrPqIg+3LcpPzCQhP5iANQH0RtavR+WTI75o12LCFXiUXJSM/ix5HWg MrBnNR2tIOakxLi8XZl8FcfPHf7a2GoByt0MtGx6ySrQVontWssBvqMxAcAHBbBGlJla tbLnYXeYBguQhltssVe54Nhr14y6Cj/R2fiCbUHlp8x+GvyZAVNU5sQDldKhXJVHGKhx MVo22hPF4g0lRESibUnrGQco/mcYAE/gikREBZC3p/TPgvZDCCpZ7GObPnTiO8tIU6GC Tb6a4IxCH9T72CaGw1S+gOEukoUDaXCTmIhK0yUATPeRJkbk+m977+537qKlIgyno3OX HY0A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=b+64UMHSUDyRQfHTT3o2l/FNe558uwoowkF0LhPvDxE=; b=ETa6HwdKsRvlRqmrR/9/G/MFpGtSIKc/feivzI77ojquJgI2e+sC7gVKt9ahf/Rd9v gJIN+gDYjFwA6i0soR3QSdepGtdeN0qET8HARBJp8sZi3B5hm70MJA0XcMmS2EE530Po FLwC8+nTa4+YNf1u6XybAzsfOwFm9/67Krd7W4sjRwW7oiye1XyGKMC0CY1oyQDZ7fxp Q+TQ5gE8oDH0SlCw4Bk8jLH8ytIsgZwgp31QLko30oxAl00SMvr2Qab7unCNS0vTaN6k sUvtx5JdOrbeMvBGsnQUS5qb9WGfwFlXg/SY4n3asUI4T/Zln6FpZDJz3SVxp/geZiIF 8Zlw== X-Gm-Message-State: APjAAAXFazsB8dLaeNKQSuJdvwOidPnVnLNrTjfQ+pqoF7XtK63OK+hQ TPkOCOieOH9kU32KfcMpEPf3ifeAfcFJ6BJkUtS41g== X-Google-Smtp-Source: APXvYqyDduqkyxXyd7QcDlGNA6hKcM3F4iclXYTV23cmm/SO1zDCGHqnhJgC7kBgR2iLIsAZOJ0FCR0a58wcRxoW16Y= X-Received: by 2002:a05:620a:200e:: with SMTP id c14mr3606840qka.380.1574272963884; Wed, 20 Nov 2019 10:02:43 -0800 (PST) MIME-Version: 1.0 References: <201911201635.xAKGZwT4082365@repo.freebsd.org> In-Reply-To: From: Warner Losh Date: Wed, 20 Nov 2019 11:02:32 -0700 Message-ID: Subject: Re: svn commit: r354899 - head/usr.sbin/jail To: Li-Wen Hsu Cc: John Baldwin , src-committers , svn-src-all , svn-src-head X-Rspamd-Queue-Id: 47J9X516BCz49c1 X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; dkim=pass header.d=bsdimp-com.20150623.gappssmtp.com header.s=20150623 header.b=ArE25kUJ; dmarc=none; spf=none (mx1.freebsd.org: domain of wlosh@bsdimp.com has no SPF policy when checking 2607:f8b0:4864:20::730) smtp.mailfrom=wlosh@bsdimp.com X-Spamd-Result: default: False [-4.73 / 15.00]; ARC_NA(0.00)[]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; R_DKIM_ALLOW(-0.20)[bsdimp-com.20150623.gappssmtp.com:s=20150623]; FROM_HAS_DN(0.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; MIME_GOOD(-0.10)[multipart/alternative,text/plain]; PREVIOUSLY_DELIVERED(0.00)[svn-src-all@freebsd.org]; DMARC_NA(0.00)[bsdimp.com]; RCPT_COUNT_FIVE(0.00)[5]; TO_MATCH_ENVRCPT_SOME(0.00)[]; TO_DN_ALL(0.00)[]; DKIM_TRACE(0.00)[bsdimp-com.20150623.gappssmtp.com:+]; RCVD_IN_DNSWL_NONE(0.00)[0.3.7.0.0.0.0.0.0.0.0.0.0.0.0.0.0.2.0.0.4.6.8.4.0.b.8.f.7.0.6.2.list.dnswl.org : 127.0.5.0]; R_SPF_NA(0.00)[]; FORGED_SENDER(0.30)[imp@bsdimp.com,wlosh@bsdimp.com]; MIME_TRACE(0.00)[0:+,1:+,2:~]; IP_SCORE(-2.73)[ip: (-9.33), ipnet: 2607:f8b0::/32(-2.30), asn: 15169(-1.97), country: US(-0.05)]; ASN(0.00)[asn:15169, ipnet:2607:f8b0::/32, country:US]; FROM_NEQ_ENVFROM(0.00)[imp@bsdimp.com,wlosh@bsdimp.com]; RCVD_TLS_ALL(0.00)[]; RCVD_COUNT_TWO(0.00)[2] Content-Type: text/plain; charset="UTF-8" X-Content-Filtered-By: Mailman/MimeDel 2.1.29 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 20 Nov 2019 18:02:46 -0000 On Wed, Nov 20, 2019 at 9:58 AM Li-Wen Hsu wrote: > On Thu, Nov 21, 2019 at 12:42 AM John Baldwin wrote: > > > > On 11/20/19 8:35 AM, Li-Wen Hsu wrote: > > > Author: lwhsu > > > Date: Wed Nov 20 16:35:58 2019 > > > New Revision: 354899 > > > URL: https://svnweb.freebsd.org/changeset/base/354899 > > > > > > Log: > > > Limit the workaround to riscv only > > > > > > PR: 242109 > > > Sponsored by: The FreeBSD Foundation > > > > > > Modified: > > > head/usr.sbin/jail/Makefile > > > > > > Modified: head/usr.sbin/jail/Makefile > > > > ============================================================================== > > > --- head/usr.sbin/jail/Makefile Wed Nov 20 16:32:13 2019 > (r354898) > > > +++ head/usr.sbin/jail/Makefile Wed Nov 20 16:35:58 2019 > (r354899) > > > @@ -18,7 +18,9 @@ CFLAGS+=-I. -I${.CURDIR} > > > # workaround for GNU ld (GNU Binutils) 2.33.1: > > > # relocation truncated to fit: R_RISCV_GPREL_I against `.LANCHOR2' > > > # https://bugs.freebsd.org/242109 > > > +.if ${MACHINE_ARCH} == "riscv" > > > CFLAGS+=-Wl,--no-relax > > > +.endif > > > > Eh, will that work? I think MACHINE and MACHINE_CPUARCH are riscv, > > but MACHINE_ARCH is riscv64 and riscv64sf. > > No it doesn't. I was too lazy to do scp from test machine to commit > machine and caused a copy-n-paste error, but ${MACHINE} should be > better since it covers more. > No. MACHINE_CPUARCH is better because it is userland. This isn't a kernel interface thing, so MACHINE is the wrong thing to use. Warner > > Also, it would be good to wrap this in .if ${LINKER_TYPE} == "bfd" I > think. > > Also added in r354900. Thanks for the suggestion. > > > (I was able to build a world + kernel with lld earlier this week, though > it > > doesn't yet boot) > > Looking forward to building world & kernel with llvm toolchain. > > Thanks, > Li-Wen > From owner-svn-src-all@freebsd.org Wed Nov 20 18:12:02 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 5C3C21BE89E; Wed, 20 Nov 2019 18:12:02 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47J9kp1LCMz4B8m; Wed, 20 Nov 2019 18:12:02 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id ED35A26958; Wed, 20 Nov 2019 18:12:01 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xAKIC1PO041182; Wed, 20 Nov 2019 18:12:01 GMT (envelope-from dim@FreeBSD.org) Received: (from dim@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xAKIC1HX041179; Wed, 20 Nov 2019 18:12:01 GMT (envelope-from dim@FreeBSD.org) Message-Id: <201911201812.xAKIC1HX041179@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dim set sender to dim@FreeBSD.org using -f From: Dimitry Andric Date: Wed, 20 Nov 2019 18:12:01 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354908 - in head/lib/clang: libclang libllvm libllvmminimal X-SVN-Group: head X-SVN-Commit-Author: dim X-SVN-Commit-Paths: in head/lib/clang: libclang libllvm libllvmminimal X-SVN-Commit-Revision: 354908 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 20 Nov 2019 18:12:02 -0000 Author: dim Date: Wed Nov 20 18:12:01 2019 New Revision: 354908 URL: https://svnweb.freebsd.org/changeset/base/354908 Log: Add explanatory comments for the different SRCS_xxx variables used in the Makefiles for libllvm and libclang. While here, cleanup a commented out SRCS entry in libllvmminimal's Makefile. MFC after: 3 days Modified: head/lib/clang/libclang/Makefile head/lib/clang/libllvm/Makefile head/lib/clang/libllvmminimal/Makefile Modified: head/lib/clang/libclang/Makefile ============================================================================== --- head/lib/clang/libclang/Makefile Wed Nov 20 18:00:43 2019 (r354907) +++ head/lib/clang/libclang/Makefile Wed Nov 20 18:12:01 2019 (r354908) @@ -20,6 +20,12 @@ CXXFLAGS.Module.cpp+= -fpermissive SRCDIR= tools/clang/lib +# Explanation of different SRCS variants below: +# SRCS_MIN: always required, even for bootstrap +# SRCS_EXT: required for MK_CLANG_EXTRAS +# SRCS_FUL: required for MK_CLANG_FULL +# SRCS_LDB: required for MK_LLDB + SRCS_FUL+= ARCMigrate/ARCMT.cpp SRCS_FUL+= ARCMigrate/ARCMTActions.cpp SRCS_FUL+= ARCMigrate/FileRemapper.cpp Modified: head/lib/clang/libllvm/Makefile ============================================================================== --- head/lib/clang/libllvm/Makefile Wed Nov 20 18:00:43 2019 (r354907) +++ head/lib/clang/libllvm/Makefile Wed Nov 20 18:12:01 2019 (r354908) @@ -26,6 +26,17 @@ CFLAGS+= -I${LLVM_SRCS}/lib/Target/${arch} SRCDIR= lib +# Explanation of different SRCS variants below: +# SRCS_MIN: always required, even for bootstrap +# SRCS_MIW: required for world stage (after cross-tools) +# SRCS_EXT: required for MK_CLANG_EXTRAS +# SRCS_EXL: required for MK_CLANG_EXTRAS and MK_LLD +# SRCS_FUL: required for MK_CLANG_FULL +# SRCS_LLD: required for MK_LLD +# SRCS_XDB: required for MK_CLANG_EXTRAS and MK_LLDB +# SRCS_XDL: required for MK_CLANG_EXTRAS, MK_LLD and MK_LLDB +# SRCS_XDW: required for MK_CLANG_EXTRAS and MK_LLDB in world stage + SRCS_MIN+= Analysis/AliasAnalysis.cpp SRCS_MIN+= Analysis/AliasAnalysisEvaluator.cpp SRCS_MIN+= Analysis/AliasAnalysisSummary.cpp Modified: head/lib/clang/libllvmminimal/Makefile ============================================================================== --- head/lib/clang/libllvmminimal/Makefile Wed Nov 20 18:00:43 2019 (r354907) +++ head/lib/clang/libllvmminimal/Makefile Wed Nov 20 18:12:01 2019 (r354908) @@ -10,7 +10,6 @@ SRCS+= Demangle/ItaniumDemangle.cpp SRCS+= Support/APFloat.cpp SRCS+= Support/APInt.cpp SRCS+= Support/ARMTargetParser.cpp -#SRCS+= Support/Atomic.cpp SRCS+= Support/CodeGenCoverage.cpp SRCS+= Support/CommandLine.cpp SRCS+= Support/ConvertUTF.cpp From owner-svn-src-all@freebsd.org Wed Nov 20 18:36:59 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 16D491BF0BF; Wed, 20 Nov 2019 18:36:59 +0000 (UTC) (envelope-from brooks@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47JBHZ6wHbz4CT0; Wed, 20 Nov 2019 18:36:58 +0000 (UTC) (envelope-from brooks@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id D0A6F26D54; Wed, 20 Nov 2019 18:36:58 +0000 (UTC) (envelope-from brooks@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xAKIaw86053875; Wed, 20 Nov 2019 18:36:58 GMT (envelope-from brooks@FreeBSD.org) Received: (from brooks@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xAKIawWt053874; Wed, 20 Nov 2019 18:36:58 GMT (envelope-from brooks@FreeBSD.org) Message-Id: <201911201836.xAKIawWt053874@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: brooks set sender to brooks@FreeBSD.org using -f From: Brooks Davis Date: Wed, 20 Nov 2019 18:36:58 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354909 - in head: . share/mk X-SVN-Group: head X-SVN-Commit-Author: brooks X-SVN-Commit-Paths: in head: . share/mk X-SVN-Commit-Revision: 354909 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 20 Nov 2019 18:36:59 -0000 Author: brooks Date: Wed Nov 20 18:36:58 2019 New Revision: 354909 URL: https://svnweb.freebsd.org/changeset/base/354909 Log: Make the warning for deprecated NO_ variables an error. Support for NO_CTF, NO_DEBUG_FILES, NO_INSTALLLIB, NO_MAN, NO_PROFILE, and NO_WARNS as deprecated in 2014 with a warning added for each one found. Turn these into error in preperation for removal of compatability support before FreeBSD 13. Reviewed by: imp Relnotes: yes Sponsored by: DARPA, AFRL Differential Revision: https://reviews.freebsd.org/D22448 Modified: head/UPDATING head/share/mk/bsd.opts.mk Modified: head/UPDATING ============================================================================== --- head/UPDATING Wed Nov 20 18:12:01 2019 (r354908) +++ head/UPDATING Wed Nov 20 18:36:58 2019 (r354909) @@ -31,6 +31,14 @@ NOTE TO PEOPLE WHO THINK THAT FreeBSD 13.x IS SLOW: removed in the future. As of FreeBSD 10.1 the autofs(5) is available for automounting. +20191120: + Defining the long deprected NO_CTF, NO_DEBUG_FILES, NO_INSTALLLIB, + NO_MAN, NO_PROFILE, and NO_WARNS variables is now an error. Update + your Makefiles and scripts to define MK_=no instead as required. + + One exception to this is that program or library Makefiles should + define MAN to empty rather than setting MK_MAN=no. + 20191107: The nctgpio and wbwd drivers have been moved to the superio bus. If you have one of these drivers in a kernel configuration, then Modified: head/share/mk/bsd.opts.mk ============================================================================== --- head/share/mk/bsd.opts.mk Wed Nov 20 18:12:01 2019 (r354908) +++ head/share/mk/bsd.opts.mk Wed Nov 20 18:36:58 2019 (r354909) @@ -100,7 +100,7 @@ __DEFAULT_DEPENDENT_OPTIONS = \ PROFILE \ WARNS .if defined(NO_${var}) -.warning "NO_${var} is defined, but deprecated. Please use MK_${var}=no instead." +.error "NO_${var} is defined, but deprecated. Please use MK_${var}=no instead." MK_${var}:=no .endif .endfor From owner-svn-src-all@freebsd.org Wed Nov 20 19:07:09 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id C41DC1BF79A; Wed, 20 Nov 2019 19:07:09 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47JByP4mSMz4DS3; Wed, 20 Nov 2019 19:07:09 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 832FF272A8; Wed, 20 Nov 2019 19:07:09 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xAKJ79cO072910; Wed, 20 Nov 2019 19:07:09 GMT (envelope-from dim@FreeBSD.org) Received: (from dim@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xAKJ79Ht072909; Wed, 20 Nov 2019 19:07:09 GMT (envelope-from dim@FreeBSD.org) Message-Id: <201911201907.xAKJ79Ht072909@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dim set sender to dim@FreeBSD.org using -f From: Dimitry Andric Date: Wed, 20 Nov 2019 19:07:09 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354910 - head X-SVN-Group: head X-SVN-Commit-Author: dim X-SVN-Commit-Paths: head X-SVN-Commit-Revision: 354910 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 20 Nov 2019 19:07:09 -0000 Author: dim Date: Wed Nov 20 19:07:08 2019 New Revision: 354910 URL: https://svnweb.freebsd.org/changeset/base/354910 Log: Fix typo: deprected -> deprecated. Modified: head/UPDATING Modified: head/UPDATING ============================================================================== --- head/UPDATING Wed Nov 20 18:36:58 2019 (r354909) +++ head/UPDATING Wed Nov 20 19:07:08 2019 (r354910) @@ -32,7 +32,7 @@ NOTE TO PEOPLE WHO THINK THAT FreeBSD 13.x IS SLOW: for automounting. 20191120: - Defining the long deprected NO_CTF, NO_DEBUG_FILES, NO_INSTALLLIB, + Defining the long deprecated NO_CTF, NO_DEBUG_FILES, NO_INSTALLLIB, NO_MAN, NO_PROFILE, and NO_WARNS variables is now an error. Update your Makefiles and scripts to define MK_=no instead as required. From owner-svn-src-all@freebsd.org Wed Nov 20 19:07:23 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 0C6921BF7E8; Wed, 20 Nov 2019 19:07:23 +0000 (UTC) (envelope-from cem@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47JByf69hHz4DZ4; Wed, 20 Nov 2019 19:07:22 +0000 (UTC) (envelope-from cem@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id B77CF272A9; Wed, 20 Nov 2019 19:07:22 +0000 (UTC) (envelope-from cem@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xAKJ7Mw9072966; Wed, 20 Nov 2019 19:07:22 GMT (envelope-from cem@FreeBSD.org) Received: (from cem@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xAKJ7M8N072964; Wed, 20 Nov 2019 19:07:22 GMT (envelope-from cem@FreeBSD.org) Message-Id: <201911201907.xAKJ7M8N072964@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: cem set sender to cem@FreeBSD.org using -f From: Conrad Meyer Date: Wed, 20 Nov 2019 19:07:22 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354911 - head/usr.bin/unifdef X-SVN-Group: head X-SVN-Commit-Author: cem X-SVN-Commit-Paths: head/usr.bin/unifdef X-SVN-Commit-Revision: 354911 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 20 Nov 2019 19:07:23 -0000 Author: cem Date: Wed Nov 20 19:07:22 2019 New Revision: 354911 URL: https://svnweb.freebsd.org/changeset/base/354911 Log: Revert r354847 for now It was broken. PR: 242095 Reported by: lwhsu Modified: head/usr.bin/unifdef/unifdef.c Modified: head/usr.bin/unifdef/unifdef.c ============================================================================== --- head/usr.bin/unifdef/unifdef.c Wed Nov 20 19:07:08 2019 (r354910) +++ head/usr.bin/unifdef/unifdef.c Wed Nov 20 19:07:22 2019 (r354911) @@ -45,11 +45,8 @@ * it possible to handle all "dodgy" directives correctly. */ -#include #include -#include -#include #include #include #include @@ -152,6 +149,7 @@ static char const * const linestate_name[] = { */ #define MAXDEPTH 64 /* maximum #if nesting */ #define MAXLINE 4096 /* maximum length of line */ +#define MAXSYMS 16384 /* maximum number of symbols */ /* * Sometimes when editing a keyword the replacement text is longer, so @@ -160,26 +158,6 @@ static char const * const linestate_name[] = { #define EDITSLOP 10 /* - * C17/18 allow 63 characters per macro name, but up to 127 arbitrarily large - * parameters. - */ -struct macro { - RB_ENTRY(macro) entry; - const char *name; - const char *value; - bool ignore; /* -iDsym or -iUsym */ -}; - -static int -macro_cmp(struct macro *a, struct macro *b) -{ - return (strcmp(a->name, b->name)); -} - -static RB_HEAD(macrohd, macro) macro_tree = RB_INITIALIZER(¯o_tree); -RB_GENERATE_STATIC(macrohd, macro, entry, macro_cmp); - -/* * Globals. */ @@ -196,6 +174,11 @@ static bool symlist; /* -s: output symbol static bool symdepth; /* -S: output symbol depth */ static bool text; /* -t: this is a text file */ +static const char *symname[MAXSYMS]; /* symbol name */ +static const char *value[MAXSYMS]; /* -Dsym=value */ +static bool ignore[MAXSYMS]; /* -iDsym or -iUsym */ +static int nsyms; /* number of symbols */ + static FILE *input; /* input file pointer */ static const char *filename; /* input file name */ static int linenum; /* current line number */ @@ -244,12 +227,12 @@ static char *astrcat(const char *, const ch static void cleantemp(void); static void closeio(void); static void debug(const char *, ...); -static void debugsym(const char *, const struct macro *); +static void debugsym(const char *, int); static bool defundef(void); static void defundefile(const char *); static void done(void); static void error(const char *); -static struct macro *findsym(const char **); +static int findsym(const char **); static void flushline(bool); static void hashline(void); static void help(void); @@ -824,7 +807,7 @@ static Linetype parseline(void) { const char *cp; - struct macro *cursym; + int cursym; Linetype retval; Comment_state wascomment; @@ -846,15 +829,15 @@ parseline(void) if ((cp = matchsym("ifdef", keyword)) != NULL || (cp = matchsym("ifndef", keyword)) != NULL) { cp = skipcomment(cp); - if ((cursym = findsym(&cp)) == NULL) + if ((cursym = findsym(&cp)) < 0) retval = LT_IF; else { retval = (keyword[2] == 'n') ? LT_FALSE : LT_TRUE; - if (cursym->value == NULL) + if (value[cursym] == NULL) retval = (retval == LT_TRUE) ? LT_FALSE : LT_TRUE; - if (cursym->ignore) + if (ignore[cursym]) retval = (retval == LT_TRUE) ? LT_TRUEI : LT_FALSEI; } @@ -1054,7 +1037,7 @@ eval_unary(const struct ops *ops, long *valp, const ch { const char *cp; char *ep; - struct macro *sym; + int sym; bool defparen; Linetype lt; @@ -1119,27 +1102,27 @@ eval_unary(const struct ops *ops, long *valp, const ch debug("eval%d defined missing ')'", prec(ops)); return (LT_ERROR); } - if (sym == NULL) { + if (sym < 0) { debug("eval%d defined unknown", prec(ops)); lt = LT_IF; } else { - debug("eval%d defined %s", prec(ops), sym->name); - *valp = (sym->value != NULL); + debug("eval%d defined %s", prec(ops), symname[sym]); + *valp = (value[sym] != NULL); lt = *valp ? LT_TRUE : LT_FALSE; } constexpr = false; } else if (!endsym(*cp)) { debug("eval%d symbol", prec(ops)); sym = findsym(&cp); - if (sym == NULL) { + if (sym < 0) { lt = LT_IF; cp = skipargs(cp); - } else if (sym->value == NULL) { + } else if (value[sym] == NULL) { *valp = 0; lt = LT_FALSE; } else { - *valp = strtol(sym->value, &ep, 0); - if (*ep != '\0' || ep == sym->value) + *valp = strtol(value[sym], &ep, 0); + if (*ep != '\0' || ep == value[sym]) return (LT_ERROR); lt = *valp ? LT_TRUE : LT_FALSE; cp = skipargs(cp); @@ -1456,17 +1439,17 @@ matchsym(const char *s, const char *t) * Look for the symbol in the symbol table. If it is found, we return * the symbol table index, else we return -1. */ -static struct macro * +static int findsym(const char **strp) { const char *str; - struct macro key, *res; + int symind; str = *strp; *strp = skipsym(str); if (symlist) { if (*strp == str) - return (NULL); + return (-1); if (symdepth && firstsym) printf("%s%3d", zerosyms ? "" : "\n", depth); firstsym = zerosyms = false; @@ -1475,14 +1458,15 @@ findsym(const char **strp) (int)(*strp-str), str, symdepth ? "" : "\n"); /* we don't care about the value of the symbol */ - return (NULL); + return (0); } - - key.name = str; - res = RB_FIND(macrohd, ¯o_tree, &key); - if (res != NULL) - debugsym("findsym", res); - return (res); + for (symind = 0; symind < nsyms; ++symind) { + if (matchsym(symname[symind], str) != NULL) { + debugsym("findsym", symind); + return (symind); + } + } + return (-1); } /* @@ -1492,23 +1476,22 @@ static void indirectsym(void) { const char *cp; - int changed; - struct macro *sym, *ind; + int changed, sym, ind; do { changed = 0; - RB_FOREACH(sym, macrohd, ¯o_tree) { - if (sym->value == NULL) + for (sym = 0; sym < nsyms; ++sym) { + if (value[sym] == NULL) continue; - cp = sym->value; + cp = value[sym]; ind = findsym(&cp); - if (ind == NULL || ind == sym || + if (ind == -1 || ind == sym || *cp != '\0' || - ind->value == NULL || - ind->value == sym->value) + value[ind] == NULL || + value[ind] == value[sym]) continue; debugsym("indir...", sym); - sym->value = ind->value; + value[sym] = value[ind]; debugsym("...ectsym", sym); changed++; } @@ -1540,29 +1523,29 @@ addsym1(bool ignorethis, bool definethis, char *symval * Add a symbol to the symbol table. */ static void -addsym2(bool ignorethis, const char *symname, const char *val) +addsym2(bool ignorethis, const char *sym, const char *val) { - const char *cp = symname; - struct macro *sym, *r; + const char *cp = sym; + int symind; - sym = findsym(&cp); - if (sym == NULL) { - sym = calloc(1, sizeof(*sym)); - sym->ignore = ignorethis; - sym->name = symname; - sym->value = val; - r = RB_INSERT(macrohd, ¯o_tree, sym); - assert(r == NULL); + symind = findsym(&cp); + if (symind < 0) { + if (nsyms >= MAXSYMS) + errx(2, "too many symbols"); + symind = nsyms++; } - debugsym("addsym", sym); + ignore[symind] = ignorethis; + symname[symind] = sym; + value[symind] = val; + debugsym("addsym", symind); } static void -debugsym(const char *why, const struct macro *sym) +debugsym(const char *why, int symind) { - debug("%s %s%c%s", why, sym->name, - sym->value ? '=' : ' ', - sym->value ? sym->value : "undef"); + debug("%s %s%c%s", why, symname[symind], + value[symind] ? '=' : ' ', + value[symind] ? value[symind] : "undef"); } /* From owner-svn-src-all@freebsd.org Wed Nov 20 19:43:35 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 8FE0F1C038D; Wed, 20 Nov 2019 19:43:35 +0000 (UTC) (envelope-from cem@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47JCmR3HjMz4GCH; Wed, 20 Nov 2019 19:43:35 +0000 (UTC) (envelope-from cem@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 54137279D4; Wed, 20 Nov 2019 19:43:35 +0000 (UTC) (envelope-from cem@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xAKJhZGO096460; Wed, 20 Nov 2019 19:43:35 GMT (envelope-from cem@FreeBSD.org) Received: (from cem@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xAKJhY2Z096458; Wed, 20 Nov 2019 19:43:34 GMT (envelope-from cem@FreeBSD.org) Message-Id: <201911201943.xAKJhY2Z096458@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: cem set sender to cem@FreeBSD.org using -f From: Conrad Meyer Date: Wed, 20 Nov 2019 19:43:34 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354912 - in head: contrib/netbsd-tests/usr.bin/unifdef usr.bin/unifdef X-SVN-Group: head X-SVN-Commit-Author: cem X-SVN-Commit-Paths: in head: contrib/netbsd-tests/usr.bin/unifdef usr.bin/unifdef X-SVN-Commit-Revision: 354912 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 20 Nov 2019 19:43:35 -0000 Author: cem Date: Wed Nov 20 19:43:34 2019 New Revision: 354912 URL: https://svnweb.freebsd.org/changeset/base/354912 Log: Re-apply fixed r354847 unifdef(1): Improve worst-case bound on symbol resolution Use RB_TREE to make some algorithms O(lg N) and O(N lg N) instead of O(N) and O(N^2). While here, remove arbitrarily limit on number of macros understood. Reverts r354877 and r354878, which disabled the (correct) test. PR: 242095 Reported by: lwhsu Modified: head/contrib/netbsd-tests/usr.bin/unifdef/t_basic.sh head/usr.bin/unifdef/unifdef.c Modified: head/contrib/netbsd-tests/usr.bin/unifdef/t_basic.sh ============================================================================== --- head/contrib/netbsd-tests/usr.bin/unifdef/t_basic.sh Wed Nov 20 19:07:22 2019 (r354911) +++ head/contrib/netbsd-tests/usr.bin/unifdef/t_basic.sh Wed Nov 20 19:43:34 2019 (r354912) @@ -35,9 +35,6 @@ basic_head() { } basic_body() { - if [ "$(atf_config_get ci false)" = "true" ]; then - atf_skip "https://bugs.freebsd.org/242095" - fi atf_check -s ignore -o file:$(atf_get_srcdir)/d_basic.out \ -x "unifdef -U__FreeBSD__ $(atf_get_srcdir)/d_basic.in" Modified: head/usr.bin/unifdef/unifdef.c ============================================================================== --- head/usr.bin/unifdef/unifdef.c Wed Nov 20 19:07:22 2019 (r354911) +++ head/usr.bin/unifdef/unifdef.c Wed Nov 20 19:43:34 2019 (r354912) @@ -45,8 +45,11 @@ * it possible to handle all "dodgy" directives correctly. */ +#include #include +#include +#include #include #include #include @@ -149,7 +152,6 @@ static char const * const linestate_name[] = { */ #define MAXDEPTH 64 /* maximum #if nesting */ #define MAXLINE 4096 /* maximum length of line */ -#define MAXSYMS 16384 /* maximum number of symbols */ /* * Sometimes when editing a keyword the replacement text is longer, so @@ -158,6 +160,26 @@ static char const * const linestate_name[] = { #define EDITSLOP 10 /* + * C17/18 allow 63 characters per macro name, but up to 127 arbitrarily large + * parameters. + */ +struct macro { + RB_ENTRY(macro) entry; + const char *name; + const char *value; + bool ignore; /* -iDsym or -iUsym */ +}; + +static int +macro_cmp(struct macro *a, struct macro *b) +{ + return (strcmp(a->name, b->name)); +} + +static RB_HEAD(MACROMAP, macro) macro_tree = RB_INITIALIZER(¯o_tree); +RB_GENERATE_STATIC(MACROMAP, macro, entry, macro_cmp); + +/* * Globals. */ @@ -174,11 +196,6 @@ static bool symlist; /* -s: output symbol static bool symdepth; /* -S: output symbol depth */ static bool text; /* -t: this is a text file */ -static const char *symname[MAXSYMS]; /* symbol name */ -static const char *value[MAXSYMS]; /* -Dsym=value */ -static bool ignore[MAXSYMS]; /* -iDsym or -iUsym */ -static int nsyms; /* number of symbols */ - static FILE *input; /* input file pointer */ static const char *filename; /* input file name */ static int linenum; /* current line number */ @@ -227,12 +244,12 @@ static char *astrcat(const char *, const ch static void cleantemp(void); static void closeio(void); static void debug(const char *, ...); -static void debugsym(const char *, int); +static void debugsym(const char *, const struct macro *); static bool defundef(void); static void defundefile(const char *); static void done(void); static void error(const char *); -static int findsym(const char **); +static struct macro *findsym(const char **); static void flushline(bool); static void hashline(void); static void help(void); @@ -807,7 +824,7 @@ static Linetype parseline(void) { const char *cp; - int cursym; + struct macro *cursym; Linetype retval; Comment_state wascomment; @@ -829,15 +846,15 @@ parseline(void) if ((cp = matchsym("ifdef", keyword)) != NULL || (cp = matchsym("ifndef", keyword)) != NULL) { cp = skipcomment(cp); - if ((cursym = findsym(&cp)) < 0) + if ((cursym = findsym(&cp)) == NULL) retval = LT_IF; else { retval = (keyword[2] == 'n') ? LT_FALSE : LT_TRUE; - if (value[cursym] == NULL) + if (cursym->value == NULL) retval = (retval == LT_TRUE) ? LT_FALSE : LT_TRUE; - if (ignore[cursym]) + if (cursym->ignore) retval = (retval == LT_TRUE) ? LT_TRUEI : LT_FALSEI; } @@ -1037,7 +1054,7 @@ eval_unary(const struct ops *ops, long *valp, const ch { const char *cp; char *ep; - int sym; + struct macro *sym; bool defparen; Linetype lt; @@ -1102,27 +1119,27 @@ eval_unary(const struct ops *ops, long *valp, const ch debug("eval%d defined missing ')'", prec(ops)); return (LT_ERROR); } - if (sym < 0) { + if (sym == NULL) { debug("eval%d defined unknown", prec(ops)); lt = LT_IF; } else { - debug("eval%d defined %s", prec(ops), symname[sym]); - *valp = (value[sym] != NULL); + debug("eval%d defined %s", prec(ops), sym->name); + *valp = (sym->value != NULL); lt = *valp ? LT_TRUE : LT_FALSE; } constexpr = false; } else if (!endsym(*cp)) { debug("eval%d symbol", prec(ops)); sym = findsym(&cp); - if (sym < 0) { + if (sym == NULL) { lt = LT_IF; cp = skipargs(cp); - } else if (value[sym] == NULL) { + } else if (sym->value == NULL) { *valp = 0; lt = LT_FALSE; } else { - *valp = strtol(value[sym], &ep, 0); - if (*ep != '\0' || ep == value[sym]) + *valp = strtol(sym->value, &ep, 0); + if (*ep != '\0' || ep == sym->value) return (LT_ERROR); lt = *valp ? LT_TRUE : LT_FALSE; cp = skipargs(cp); @@ -1439,17 +1456,18 @@ matchsym(const char *s, const char *t) * Look for the symbol in the symbol table. If it is found, we return * the symbol table index, else we return -1. */ -static int +static struct macro * findsym(const char **strp) { const char *str; - int symind; + char *strkey; + struct macro key, *res; str = *strp; *strp = skipsym(str); if (symlist) { if (*strp == str) - return (-1); + return (NULL); if (symdepth && firstsym) printf("%s%3d", zerosyms ? "" : "\n", depth); firstsym = zerosyms = false; @@ -1458,15 +1476,26 @@ findsym(const char **strp) (int)(*strp-str), str, symdepth ? "" : "\n"); /* we don't care about the value of the symbol */ - return (0); + return (NULL); } - for (symind = 0; symind < nsyms; ++symind) { - if (matchsym(symname[symind], str) != NULL) { - debugsym("findsym", symind); - return (symind); - } - } - return (-1); + + /* + * 'str' just points into the current mid-parse input and is not + * nul-terminated. We know the length of the symbol, *strp - str, but + * need to provide a nul-terminated lookup key for RB_FIND's comparison + * function. Create one here. + */ + strkey = malloc(*strp - str + 1); + memcpy(strkey, str, *strp - str); + strkey[*strp - str] = 0; + + key.name = strkey; + res = RB_FIND(MACROMAP, ¯o_tree, &key); + if (res != NULL) + debugsym("findsym", res); + + free(strkey); + return (res); } /* @@ -1476,22 +1505,23 @@ static void indirectsym(void) { const char *cp; - int changed, sym, ind; + int changed; + struct macro *sym, *ind; do { changed = 0; - for (sym = 0; sym < nsyms; ++sym) { - if (value[sym] == NULL) + RB_FOREACH(sym, MACROMAP, ¯o_tree) { + if (sym->value == NULL) continue; - cp = value[sym]; + cp = sym->value; ind = findsym(&cp); - if (ind == -1 || ind == sym || + if (ind == NULL || ind == sym || *cp != '\0' || - value[ind] == NULL || - value[ind] == value[sym]) + ind->value == NULL || + ind->value == sym->value) continue; debugsym("indir...", sym); - value[sym] = value[ind]; + sym->value = ind->value; debugsym("...ectsym", sym); changed++; } @@ -1523,29 +1553,29 @@ addsym1(bool ignorethis, bool definethis, char *symval * Add a symbol to the symbol table. */ static void -addsym2(bool ignorethis, const char *sym, const char *val) +addsym2(bool ignorethis, const char *symname, const char *val) { - const char *cp = sym; - int symind; + const char *cp = symname; + struct macro *sym, *r; - symind = findsym(&cp); - if (symind < 0) { - if (nsyms >= MAXSYMS) - errx(2, "too many symbols"); - symind = nsyms++; + sym = findsym(&cp); + if (sym == NULL) { + sym = calloc(1, sizeof(*sym)); + sym->ignore = ignorethis; + sym->name = symname; + sym->value = val; + r = RB_INSERT(MACROMAP, ¯o_tree, sym); + assert(r == NULL); } - ignore[symind] = ignorethis; - symname[symind] = sym; - value[symind] = val; - debugsym("addsym", symind); + debugsym("addsym", sym); } static void -debugsym(const char *why, int symind) +debugsym(const char *why, const struct macro *sym) { - debug("%s %s%c%s", why, symname[symind], - value[symind] ? '=' : ' ', - value[symind] ? value[symind] : "undef"); + debug("%s %s%c%s", why, sym->name, + sym->value ? '=' : ' ', + sym->value ? sym->value : "undef"); } /* From owner-svn-src-all@freebsd.org Wed Nov 20 19:55:44 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 630E41C0692; Wed, 20 Nov 2019 19:55:44 +0000 (UTC) (envelope-from cem@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47JD2S1jRpz4Ghv; Wed, 20 Nov 2019 19:55:44 +0000 (UTC) (envelope-from cem@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 1DDA427BB5; Wed, 20 Nov 2019 19:55:44 +0000 (UTC) (envelope-from cem@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xAKJthav002337; Wed, 20 Nov 2019 19:55:43 GMT (envelope-from cem@FreeBSD.org) Received: (from cem@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xAKJthPt002336; Wed, 20 Nov 2019 19:55:43 GMT (envelope-from cem@FreeBSD.org) Message-Id: <201911201955.xAKJthPt002336@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: cem set sender to cem@FreeBSD.org using -f From: Conrad Meyer Date: Wed, 20 Nov 2019 19:55:43 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354913 - head/sys/dev/random X-SVN-Group: head X-SVN-Commit-Author: cem X-SVN-Commit-Paths: head/sys/dev/random X-SVN-Commit-Revision: 354913 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 20 Nov 2019 19:55:44 -0000 Author: cem Date: Wed Nov 20 19:55:43 2019 New Revision: 354913 URL: https://svnweb.freebsd.org/changeset/base/354913 Log: random/ivy: Trivial refactoring It is clearer to me to return success/error (true/false) instead of some retry count linked to the inline assembly implementation. No functional change. Approved by: core(csprng) => csprng(markm) Differential Revision: https://reviews.freebsd.org/D22454 Modified: head/sys/dev/random/ivy.c Modified: head/sys/dev/random/ivy.c ============================================================================== --- head/sys/dev/random/ivy.c Wed Nov 20 19:43:34 2019 (r354912) +++ head/sys/dev/random/ivy.c Wed Nov 20 19:55:43 2019 (r354913) @@ -59,7 +59,7 @@ static struct random_source random_ivy = { .rs_read = random_ivy_read }; -static int +static bool x86_rdrand_store(u_long *buf) { u_long rndval; @@ -75,10 +75,10 @@ x86_rdrand_store(u_long *buf) "2:" : "+r" (retry), "=r" (rndval) : : "cc"); *buf = rndval; - return (retry); + return (retry != 0); } -static int +static bool x86_rdseed_store(u_long *buf) { u_long rndval; @@ -94,17 +94,17 @@ x86_rdseed_store(u_long *buf) "2:" : "+r" (retry), "=r" (rndval) : : "cc"); *buf = rndval; - return (retry); + return (retry != 0); } -static int +static bool x86_unimpl_store(u_long *buf __unused) { panic("%s called", __func__); } -DEFINE_IFUNC(static, int, x86_rng_store, (u_long *buf)) +DEFINE_IFUNC(static, bool, x86_rng_store, (u_long *buf)) { has_rdrand = (cpu_feature2 & CPUID2_RDRAND); has_rdseed = (cpu_stdext_feature & CPUID_STDEXT_RDSEED); @@ -127,7 +127,7 @@ random_ivy_read(void *buf, u_int c) KASSERT(c % sizeof(*b) == 0, ("partial read %d", c)); b = buf; for (count = c; count > 0; count -= sizeof(*b)) { - if (x86_rng_store(&rndval) == 0) + if (!x86_rng_store(&rndval)) break; *b++ = rndval; } From owner-svn-src-all@freebsd.org Wed Nov 20 20:00:04 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 5FB821C077C; Wed, 20 Nov 2019 20:00:04 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47JD7S1vSnz4GtV; Wed, 20 Nov 2019 20:00:04 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 2484327BDE; Wed, 20 Nov 2019 20:00:04 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xAKK04H1002635; Wed, 20 Nov 2019 20:00:04 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xAKK044g002634; Wed, 20 Nov 2019 20:00:04 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201911202000.xAKK044g002634@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Wed, 20 Nov 2019 20:00:04 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354914 - head/sys/cam/scsi X-SVN-Group: head X-SVN-Commit-Author: mav X-SVN-Commit-Paths: head/sys/cam/scsi X-SVN-Commit-Revision: 354914 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 20 Nov 2019 20:00:04 -0000 Author: mav Date: Wed Nov 20 20:00:03 2019 New Revision: 354914 URL: https://svnweb.freebsd.org/changeset/base/354914 Log: Set handling for some "Logical unit not ready" errors. MFC after: 2 weeks Sponsored by: iXsystems, Inc. Modified: head/sys/cam/scsi/scsi_all.c Modified: head/sys/cam/scsi/scsi_all.c ============================================================================== --- head/sys/cam/scsi/scsi_all.c Wed Nov 20 19:55:43 2019 (r354913) +++ head/sys/cam/scsi/scsi_all.c Wed Nov 20 20:00:03 2019 (r354914) @@ -1112,7 +1112,7 @@ static struct asc_table_entry asc_table[] = { { SST(0x04, 0x08, SS_FATAL | EBUSY, "Logical unit not ready, long write in progress") }, /* DTLPWROMAEBKVF */ - { SST(0x04, 0x09, SS_RDEF, /* XXX TBD */ + { SST(0x04, 0x09, SS_FATAL | EBUSY, "Logical unit not ready, self-test in progress") }, /* DTLPWROMAEBKVF */ { SST(0x04, 0x0A, SS_WAIT | ENXIO, @@ -1130,37 +1130,37 @@ static struct asc_table_entry asc_table[] = { { SST(0x04, 0x0E, SS_RDEF, /* XXX TBD */ "Logical unit not ready, security session in progress") }, /* DT WROM B */ - { SST(0x04, 0x10, SS_RDEF, /* XXX TBD */ + { SST(0x04, 0x10, SS_FATAL | ENODEV, "Logical unit not ready, auxiliary memory not accessible") }, /* DT WRO AEB VF */ - { SST(0x04, 0x11, SS_WAIT | EBUSY, + { SST(0x04, 0x11, SS_WAIT | ENXIO, "Logical unit not ready, notify (enable spinup) required") }, /* M V */ - { SST(0x04, 0x12, SS_RDEF, /* XXX TBD */ + { SST(0x04, 0x12, SS_FATAL | ENXIO, "Logical unit not ready, offline") }, /* DT R MAEBKV */ - { SST(0x04, 0x13, SS_RDEF, /* XXX TBD */ + { SST(0x04, 0x13, SS_WAIT | EBUSY, "Logical unit not ready, SA creation in progress") }, /* D B */ - { SST(0x04, 0x14, SS_RDEF, /* XXX TBD */ + { SST(0x04, 0x14, SS_WAIT | ENOSPC, "Logical unit not ready, space allocation in progress") }, /* M */ - { SST(0x04, 0x15, SS_RDEF, /* XXX TBD */ + { SST(0x04, 0x15, SS_FATAL | ENXIO, "Logical unit not ready, robotics disabled") }, /* M */ - { SST(0x04, 0x16, SS_RDEF, /* XXX TBD */ + { SST(0x04, 0x16, SS_FATAL | ENXIO, "Logical unit not ready, configuration required") }, /* M */ - { SST(0x04, 0x17, SS_RDEF, /* XXX TBD */ + { SST(0x04, 0x17, SS_FATAL | ENXIO, "Logical unit not ready, calibration required") }, /* M */ - { SST(0x04, 0x18, SS_RDEF, /* XXX TBD */ + { SST(0x04, 0x18, SS_FATAL | ENXIO, "Logical unit not ready, a door is open") }, /* M */ - { SST(0x04, 0x19, SS_RDEF, /* XXX TBD */ + { SST(0x04, 0x19, SS_FATAL | ENODEV, "Logical unit not ready, operating in sequential mode") }, /* DT B */ - { SST(0x04, 0x1A, SS_RDEF, /* XXX TBD */ + { SST(0x04, 0x1A, SS_WAIT | EBUSY, "Logical unit not ready, START/STOP UNIT command in progress") }, /* D B */ { SST(0x04, 0x1B, SS_WAIT | EBUSY, @@ -1169,7 +1169,7 @@ static struct asc_table_entry asc_table[] = { { SST(0x04, 0x1C, SS_START | SSQ_DECREMENT_COUNT | ENXIO, "Logical unit not ready, additional power use not yet granted") }, /* D */ - { SST(0x04, 0x1D, SS_RDEF, /* XXX TBD */ + { SST(0x04, 0x1D, SS_WAIT | EBUSY, "Logical unit not ready, configuration in progress") }, /* D */ { SST(0x04, 0x1E, SS_FATAL | ENXIO, @@ -1178,14 +1178,20 @@ static struct asc_table_entry asc_table[] = { { SST(0x04, 0x1F, SS_FATAL | ENXIO, "Logical unit not ready, microcode download required") }, /* DTLPWROMAEBKVF */ - { SST(0x04, 0x20, SS_RDEF, /* XXX TBD */ + { SST(0x04, 0x20, SS_FATAL | ENXIO, "Logical unit not ready, logical unit reset required") }, /* DTLPWROMAEBKVF */ - { SST(0x04, 0x21, SS_RDEF, /* XXX TBD */ + { SST(0x04, 0x21, SS_FATAL | ENXIO, "Logical unit not ready, hard reset required") }, /* DTLPWROMAEBKVF */ - { SST(0x04, 0x22, SS_RDEF, /* XXX TBD */ + { SST(0x04, 0x22, SS_FATAL | ENXIO, "Logical unit not ready, power cycle required") }, + /* D */ + { SST(0x04, 0x23, SS_FATAL | ENXIO, + "Logical unit not ready, affiliation required") }, + /* D */ + { SST(0x04, 0x24, SS_FATAL | EBUSY, + "Depopulation in progress") }, /* DTL WROMAEBKVF */ { SST(0x05, 0x00, SS_RDEF, "Logical unit does not respond to selection") }, @@ -3384,7 +3390,7 @@ scsi_error_action(struct ccb_scsiio *csio, struct scsi if (!scsi_extract_sense_ccb((union ccb *)csio, &error_code, &sense_key, &asc, &ascq)) { - action = SS_RETRY | SSQ_DECREMENT_COUNT | SSQ_PRINT_SENSE | EIO; + action = SS_RDEF; } else if ((error_code == SSD_DEFERRED_ERROR) || (error_code == SSD_DESC_DEFERRED_ERROR)) { /* From owner-svn-src-all@freebsd.org Wed Nov 20 21:06:30 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 7E2301C195A; Wed, 20 Nov 2019 21:06:30 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47JFc62XNGz4KnV; Wed, 20 Nov 2019 21:06:30 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 371598C1; Wed, 20 Nov 2019 21:06:30 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xAKL6T3A043544; Wed, 20 Nov 2019 21:06:29 GMT (envelope-from imp@FreeBSD.org) Received: (from imp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xAKL6T8U043541; Wed, 20 Nov 2019 21:06:29 GMT (envelope-from imp@FreeBSD.org) Message-Id: <201911202106.xAKL6T8U043541@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: imp set sender to imp@FreeBSD.org using -f From: Warner Losh Date: Wed, 20 Nov 2019 21:06:29 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354915 - in head: etc/mtree share/man/man7 share/mk X-SVN-Group: head X-SVN-Commit-Author: imp X-SVN-Commit-Paths: in head: etc/mtree share/man/man7 share/mk X-SVN-Commit-Revision: 354915 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 20 Nov 2019 21:06:30 -0000 Author: imp Date: Wed Nov 20 21:06:29 2019 New Revision: 354915 URL: https://svnweb.freebsd.org/changeset/base/354915 Log: Standardize EFI's ESP mount point. Mount the UEFI ESP on /boot/efi. No current system uses this by default, but there are many ad-hoc schemes that do this in /efi or /esp or /uefi and adding a new directory at the top-level would have a much higher likelihood of collision. Document this in /etc/mtree/BSD.root.mtree and create EFIDIR and related variables in bsd.own.mk. Differential Revision: https://reviews.freebsd.org/D21344 Modified: head/etc/mtree/BSD.root.dist head/share/man/man7/hier.7 head/share/mk/bsd.own.mk Modified: head/etc/mtree/BSD.root.dist ============================================================================== --- head/etc/mtree/BSD.root.dist Wed Nov 20 20:00:03 2019 (r354914) +++ head/etc/mtree/BSD.root.dist Wed Nov 20 21:06:29 2019 (r354915) @@ -18,6 +18,8 @@ rockchip tags=package=runtime .. .. + efi + .. firmware .. lua Modified: head/share/man/man7/hier.7 ============================================================================== --- head/share/man/man7/hier.7 Wed Nov 20 20:00:03 2019 (r354914) +++ head/share/man/man7/hier.7 Wed Nov 20 21:06:29 2019 (r354915) @@ -53,6 +53,8 @@ Compiled flattened device tree (FDT) files; see .Xr fdt 4 and .Xr dtc 1 +.It Pa efi/ +Mount point for EFI System Partition (ESP) on UEFI systems. .It Pa firmware/ loadable kernel modules containing binary firmware for hardware that needs firmware downloaded to it to function Modified: head/share/mk/bsd.own.mk ============================================================================== --- head/share/mk/bsd.own.mk Wed Nov 20 20:00:03 2019 (r354914) +++ head/share/mk/bsd.own.mk Wed Nov 20 21:06:29 2019 (r354915) @@ -56,6 +56,15 @@ # KMODMODE KLD mode. [${BINMODE}] # # +# EFIDIR Base path for the UEFI ESP [/boot/efi] +# +# EFIOWN EFIDIR owner. [root] +# +# EFIGRP EFIDIR group. [wheel] +# +# EFIMODE EFIDIR mode. [555] +# +# # SHAREDIR Base path for architecture-independent ascii # text files. [/usr/share] # @@ -169,6 +178,10 @@ DTBODIR?= /boot/dtb/overlays DTBOWN?= root DTBGRP?= wheel DTBMODE?= 444 +EFIDIR?= /boot/efi +EFIOWN?= root +EFIGRP?= wheel +EFIMODE?= 555 # Use make.conf / environment LIBDIR as default if set... .if !empty(_PREMK_LIBDIR) From owner-svn-src-all@freebsd.org Wed Nov 20 21:48:28 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 6F77F1C266D; Wed, 20 Nov 2019 21:48:28 +0000 (UTC) (envelope-from jrm@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47JGXX2MNnz4NSQ; Wed, 20 Nov 2019 21:48:28 +0000 (UTC) (envelope-from jrm@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 342081044; Wed, 20 Nov 2019 21:48:28 +0000 (UTC) (envelope-from jrm@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xAKLmRAq068045; Wed, 20 Nov 2019 21:48:27 GMT (envelope-from jrm@FreeBSD.org) Received: (from jrm@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xAKLmR2P068044; Wed, 20 Nov 2019 21:48:27 GMT (envelope-from jrm@FreeBSD.org) Message-Id: <201911202148.xAKLmR2P068044@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jrm set sender to jrm@FreeBSD.org using -f From: Joseph Mingrone Date: Wed, 20 Nov 2019 21:48:27 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-svnadmin@freebsd.org Subject: svn commit: r354916 - svnadmin/conf X-SVN-Group: svnadmin X-SVN-Commit-Author: jrm X-SVN-Commit-Paths: svnadmin/conf X-SVN-Commit-Revision: 354916 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 20 Nov 2019 21:48:28 -0000 Author: jrm (ports committer) Date: Wed Nov 20 21:48:27 2019 New Revision: 354916 URL: https://svnweb.freebsd.org/changeset/base/354916 Log: Allow csprng group to approve PRNG code changes Approved by: core (brooks), csprng (cem), so (emaste) Differential Revision: https://reviews.freebsd.org/D22468 Modified: svnadmin/conf/approvers Modified: svnadmin/conf/approvers ============================================================================== --- svnadmin/conf/approvers Wed Nov 20 21:06:29 2019 (r354915) +++ svnadmin/conf/approvers Wed Nov 20 21:48:27 2019 (r354916) @@ -34,7 +34,7 @@ ^svnadmin/conf/approvers (core|re) ^svnadmin/conf/access core ^head/LOCKS core -^head/sys/dev/random (security-officer|so|secteam|core) -^head/sys/libkern/arc4random.c (security-officer|so|secteam|core) -^stable/([7-9]|1[01])/sys/dev/random (security-officer|so|secteam|core) -^stable/([7-9]|1[01])/sys/libkern/arc4random.c (security-officer|so|secteam|core) +^head/sys/dev/random (security-officer|so|secteam|core|csprng) +^head/sys/libkern/arc4random.c (security-officer|so|secteam|core|csprng) +^stable/([7-9]|1[012])/sys/dev/random (security-officer|so|secteam|core|csprng) +^stable/([7-9]|1[012])/sys/libkern/arc4random.c (security-officer|so|secteam|core|csprng) From owner-svn-src-all@freebsd.org Wed Nov 20 22:09:24 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 7F2D01C2E75; Wed, 20 Nov 2019 22:09:24 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from smtp.freebsd.org (smtp.freebsd.org [IPv6:2610:1c1:1:606c::24b:4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "smtp.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47JH0h1sq8z4PwR; Wed, 20 Nov 2019 22:09:24 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from John-Baldwins-MacBook-Pro-5.local (ralph.baldwin.cx [66.234.199.215]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client did not present a certificate) (Authenticated sender: jhb) by smtp.freebsd.org (Postfix) with ESMTPSA id 86BCE10FF; Wed, 20 Nov 2019 22:09:23 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Subject: Re: svn commit: r354900 - head/usr.sbin/jail To: Warner Losh , Li-Wen Hsu Cc: src-committers , svn-src-all , svn-src-head References: <201911201654.xAKGsMTv094014@repo.freebsd.org> From: John Baldwin Openpgp: preference=signencrypt Autocrypt: addr=jhb@FreeBSD.org; keydata= mQGiBETQ+XcRBADMFybiq69u+fJRy/0wzqTNS8jFfWaBTs5/OfcV7wWezVmf9sgwn8TW0Dk0 c9MBl0pz+H01dA2ZSGZ5fXlmFIsee1WEzqeJzpiwd/pejPgSzXB9ijbLHZ2/E0jhGBcVy5Yo /Tw5+U/+laeYKu2xb0XPvM0zMNls1ah5OnP9a6Ql6wCgupaoMySb7DXm2LHD1Z9jTsHcAQMD /1jzh2BoHriy/Q2s4KzzjVp/mQO5DSm2z14BvbQRcXU48oAosHA1u3Wrov6LfPY+0U1tG47X 1BGfnQH+rNAaH0livoSBQ0IPI/8WfIW7ub4qV6HYwWKVqkDkqwcpmGNDbz3gfaDht6nsie5Z pcuCcul4M9CW7Md6zzyvktjnbz61BADGDCopfZC4of0Z3Ka0u8Wik6UJOuqShBt1WcFS8ya1 oB4rc4tXfSHyMF63aPUBMxHR5DXeH+EO2edoSwViDMqWk1jTnYza51rbGY+pebLQOVOxAY7k do5Ordl3wklBPMVEPWoZ61SdbcjhHVwaC5zfiskcxj5wwXd2E9qYlBqRg7QeSm9obiBCYWxk d2luIDxqaGJARnJlZUJTRC5vcmc+iGAEExECACAFAkTQ+awCGwMGCwkIBwMCBBUCCAMEFgID AQIeAQIXgAAKCRBy3lIGd+N/BI6RAJ9S97fvbME+3hxzE3JUyUZ6vTewDACdE1stFuSfqMvM jomvZdYxIYyTUpC5Ag0ERND5ghAIAPwsO0B7BL+bz8sLlLoQktGxXwXQfS5cInvL17Dsgnr3 1AKa94j9EnXQyPEj7u0d+LmEe6CGEGDh1OcGFTMVrof2ZzkSy4+FkZwMKJpTiqeaShMh+Goj XlwIMDxyADYvBIg3eN5YdFKaPQpfgSqhT+7El7w+wSZZD8pPQuLAnie5iz9C8iKy4/cMSOrH YUK/tO+Nhw8Jjlw94Ik0T80iEhI2t+XBVjwdfjbq3HrJ0ehqdBwukyeJRYKmbn298KOFQVHO EVbHA4rF/37jzaMadK43FgJ0SAhPPF5l4l89z5oPu0b/+5e2inA3b8J3iGZxywjM+Csq1tqz hltEc7Q+E08AAwUIAL+15XH8bPbjNJdVyg2CMl10JNW2wWg2Q6qdljeaRqeR6zFus7EZTwtX sNzs5bP8y51PSUDJbeiy2RNCNKWFMndM22TZnk3GNG45nQd4OwYK0RZVrikalmJY5Q6m7Z16 4yrZgIXFdKj2t8F+x613/SJW1lIr9/bDp4U9tw0V1g3l2dFtD3p3ZrQ3hpoDtoK70ioIAjjH aIXIAcm3FGZFXy503DOA0KaTWwvOVdYCFLm3zWuSOmrX/GsEc7ovasOWwjPn878qVjbUKWwx Q4QkF4OhUV9zPtf9tDSAZ3x7QSwoKbCoRCZ/xbyTUPyQ1VvNy/mYrBcYlzHodsaqUDjHuW+I SQQYEQIACQUCRND5ggIbDAAKCRBy3lIGd+N/BCO8AJ9j1dWVQWxw/YdTbEyrRKOY8YZNwwCf afMAg8QvmOWnHx3wl8WslCaXaE8= Message-ID: <59bf120c-2f35-1a22-b6fa-a9c9bb8cfdf4@FreeBSD.org> Date: Wed, 20 Nov 2019 14:09:22 -0800 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.12; rv:60.0) Gecko/20100101 Thunderbird/60.9.1 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 20 Nov 2019 22:09:24 -0000 On 11/20/19 10:01 AM, Warner Losh wrote: > On Wed, Nov 20, 2019 at 9:54 AM Li-Wen Hsu wrote: > >> Author: lwhsu >> Date: Wed Nov 20 16:54:21 2019 >> New Revision: 354900 >> URL: https://svnweb.freebsd.org/changeset/base/354900 >> >> Log: >> Use the correct variable, also limit the scope to bfd >> >> PR: 242109 >> Reported by: jhb >> Sponsored by: The FreeBSD Foundation >> >> Modified: >> head/usr.sbin/jail/Makefile >> >> Modified: head/usr.sbin/jail/Makefile >> >> ============================================================================== >> --- head/usr.sbin/jail/Makefile Wed Nov 20 16:35:58 2019 (r354899) >> +++ head/usr.sbin/jail/Makefile Wed Nov 20 16:54:21 2019 (r354900) >> @@ -18,7 +18,7 @@ CFLAGS+=-I. -I${.CURDIR} >> # workaround for GNU ld (GNU Binutils) 2.33.1: >> # relocation truncated to fit: R_RISCV_GPREL_I against `.LANCHOR2' >> # https://bugs.freebsd.org/242109 >> -.if ${MACHINE_ARCH} == "riscv" >> +.if ${LINKER_TYPE} == "bfd" && ${MACHINE} == "riscv" >> > > MACHINE isn't the right thing to use here. It's never the proper thing in > userland makefiles, unless they are interfacing with the kernel. > > MACHINE_CPUARCH is what you want here. Eh, that claim doesn't seem quite true. src.opts.mk only uses MACHINE and not MACHINE_CPUARCH for example (to set _TT that is then used all over the place in src.opts.mk). My experience is that uses of *_CPUARCH are in fact pretty rare. -- John Baldwin From owner-svn-src-all@freebsd.org Wed Nov 20 22:13:17 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 347D41C30BA; Wed, 20 Nov 2019 22:13:17 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47JH591JQ1z4QNK; Wed, 20 Nov 2019 22:13:17 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 10404162A; Wed, 20 Nov 2019 22:13:17 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xAKMDHAl085572; Wed, 20 Nov 2019 22:13:17 GMT (envelope-from pfg@FreeBSD.org) Received: (from pfg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xAKMDEF8085559; Wed, 20 Nov 2019 22:13:14 GMT (envelope-from pfg@FreeBSD.org) Message-Id: <201911202213.xAKMDEF8085559@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: pfg set sender to pfg@FreeBSD.org using -f From: "Pedro F. Giffuni" Date: Wed, 20 Nov 2019 22:13:14 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-vendor@freebsd.org Subject: svn commit: r354917 - vendor/openresolv/dist X-SVN-Group: vendor X-SVN-Commit-Author: pfg X-SVN-Commit-Paths: vendor/openresolv/dist X-SVN-Commit-Revision: 354917 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 20 Nov 2019 22:13:17 -0000 Author: pfg Date: Wed Nov 20 22:13:14 2019 New Revision: 354917 URL: https://svnweb.freebsd.org/changeset/base/354917 Log: Import openresolv 3.9.0 More information at: https://roy.marples.name/projects/openresolv Added: vendor/openresolv/dist/LICENSE vendor/openresolv/dist/README.md Deleted: vendor/openresolv/dist/README Modified: vendor/openresolv/dist/Makefile vendor/openresolv/dist/configure vendor/openresolv/dist/dnsmasq.in vendor/openresolv/dist/libc.in vendor/openresolv/dist/named.in vendor/openresolv/dist/pdns_recursor.in vendor/openresolv/dist/pdnsd.in vendor/openresolv/dist/resolvconf.conf vendor/openresolv/dist/resolvconf.conf.5.in vendor/openresolv/dist/resolvconf.in vendor/openresolv/dist/unbound.in Added: vendor/openresolv/dist/LICENSE ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ vendor/openresolv/dist/LICENSE Wed Nov 20 22:13:14 2019 (r354917) @@ -0,0 +1,23 @@ +Copyright (c) 2007-2019 Roy Marples +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions +are met: +1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. +2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + +THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND +ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE +FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +SUCH DAMAGE. Modified: vendor/openresolv/dist/Makefile ============================================================================== --- vendor/openresolv/dist/Makefile Wed Nov 20 21:48:27 2019 (r354916) +++ vendor/openresolv/dist/Makefile Wed Nov 20 22:13:14 2019 (r354917) @@ -10,6 +10,7 @@ SYSCONFDIR?= /etc LIBEXECDIR?= /libexec/resolvconf VARDIR?= /var/run/resolvconf +ECHO?= echo INSTALL?= install SED?= sed @@ -20,7 +21,7 @@ DOCMODE?= 0644 MANMODE?= 0444 RESOLVCONF= resolvconf resolvconf.8 resolvconf.conf.5 -SUBSCRIBERS= libc dnsmasq named pdnsd unbound +SUBSCRIBERS= libc dnsmasq named pdnsd pdns_recursor unbound TARGET= ${RESOLVCONF} ${SUBSCRIBERS} SRCS= ${TARGET:C,$,.in,} # pmake SRCS:= ${TARGET:=.in} # gmake @@ -42,7 +43,7 @@ DISTINFOSIGN= ${DISTINFO}.asc CKSUM?= cksum -a SHA256 PGP?= netpgp -FOSSILID?= current +GITREF?= HEAD .SUFFIXES: .in @@ -79,15 +80,17 @@ maninstall: install: proginstall maninstall -import: +dist-git: + git archive --prefix=${DISTPREFIX}/ ${GITREF} | xz >${DISTFILE} + +dist-inst: + mkdir /tmp/${DISTPREFIX} + cp -RPp * /tmp/${DISTPREFIX} + (cd /tmp/${DISTPREFIX}; make clean) + tar -cvjpf ${DISTFILE} -C /tmp ${DISTPREFIX} rm -rf /tmp/${DISTPREFIX} - ${INSTALL} -d /tmp/${DISTPREFIX} - cp README ${SRCS} /tmp/${DISTPREFIX} -dist: - fossil tarball --name ${DISTPREFIX} ${FOSSILID} ${DISTFILEGZ} - gunzip -c ${DISTFILEGZ} | xz >${DISTFILE} - rm ${DISTFILEGZ} +dist: dist-git distinfo: dist rm -f ${DISTINFO} ${DISTINFOSIGN} @@ -96,3 +99,20 @@ distinfo: dist ${PGP} --clearsign --output=${DISTINFOSIGN} ${DISTINFO} chmod 644 ${DISTINFOSIGN} ls -l ${DISTFILE} ${DISTINFO} ${DISTINFOSIGN} + +import: dist + rm -rf /tmp/${DISTPREFIX} + ${INSTALL} -d /tmp/${DISTPREFIX} + tar xvJpf ${DISTFILE} -C /tmp + +_import-src: + rm -rf ${DESTDIR}/* + ${INSTALL} -d ${DESTDIR} + cp LICENSE README.md ${SRCS} resolvconf.conf ${DESTDIR}; + cp resolvconf.8.in resolvconf.conf.5.in ${DESTDIR}; + @${ECHO} + @${ECHO} "=============================================================" + @${ECHO} "openresolv-${VERSION} imported to ${DESTDIR}" + +import-src: + ${MAKE} _import-src DESTDIR=`if [ -n "${DESTDIR}" ]; then echo "${DESTDIR}"; else echo /tmp/${DISTPREFIX}; fi` Added: vendor/openresolv/dist/README.md ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ vendor/openresolv/dist/README.md Wed Nov 20 22:13:14 2019 (r354917) @@ -0,0 +1,64 @@ +# openresolv + +openresolv is a [resolvconf](https://en.wikipedia.org/wiki/Resolvconf) +implementation which manages `/etc/resolv.conf`. + +`/etc/resolv.conf` is a file that holds the configuration for the local +resolution of domain names. +Normally this file is either static or maintained by a local daemon, +normally a DHCP daemon. But what happens if more than one thing wants to +control the file? +Say you have wired and wireless interfaces to different subnets and run a VPN +or two on top of that, how do you say which one controls the file? +It's also not as easy as just adding and removing the nameservers each client +knows about as different clients could add the same nameservers. + +Enter resolvconf, the middleman between the network configuration services and +`/etc/resolv.conf`. +resolvconf itself is just a script that stores, removes and lists a full +`resolv.conf` generated for the interface. It then calls all the helper scripts +it knows about so it can configure the real `/etc/resolv.conf` and optionally +any local nameservers other than libc. + +## Reasons for using openresolv + +Why openresolv over the +[Debian implementation](http://qref.sourceforge.net/Debian/reference/ch-gateway.en.html#s-dns-resolvconf)? +Here's some reasons: + * Works with + [POSIX shell and userland](http://www.opengroup.org/onlinepubs/009695399) + * Does not need awk, grep or sed which means we can work without `/usr` + mounted + * Works with other init systems than Debians' out of the box + * Available as a 2 clause + [BSD license](http://www.freebsd.org/copyright/freebsd-license.html) + * Prefer configs via IF_METRIC for dynamic ordering + * Configures zones for local resolvers other than libc + +The last point is quite important, especially when running VPN systems. +Take the following resolv.conf files which have been generated by a +[DHCP client](../dhcpcd) and sent to resolvconf: + +``` +# resolv.conf from bge0 +search foo.com +nameserver 1.2.3.4 + +# resolv.conf from tap0 +domain bar.org +nameserver 5.6.7.8 +``` + +In this instance, queries for foo.com will go to 1.2.3.4 and queries for +bar.org will go to 5.6.7.8. +This does require the resolvers to be configured to pickup the resolvconf +generated configuration for them though. +openresolv ships with helpers for: + * [unbound](http://www.unbound.net/) + * [dnsmasq](http://www.thekelleys.org.uk/dnsmasq/doc.html) + * [ISC BIND](http://www.isc.org/software/bind) + * [PowerDNS Recursor](http://wiki.powerdns.com/trac) + +See the +[configuration section](https://roy.marples.name/projects/openresolv/config) +for more details. Modified: vendor/openresolv/dist/configure ============================================================================== --- vendor/openresolv/dist/configure Wed Nov 20 21:48:27 2019 (r354916) +++ vendor/openresolv/dist/configure Wed Nov 20 22:13:14 2019 (r354917) @@ -44,42 +44,8 @@ for x do esac done -if [ -z "$LIBEXECDIR" ]; then - printf "Checking for directory /libexec ... " - if [ -d /libexec ]; then - echo "yes" - LIBEXECDIR=$PREFIX/libexec/resolvconf - else - echo "no" - LIBEXECDIR=$PREFIX/lib/resolvconf - fi -fi -if [ -z "$RUNDIR" ]; then - printf "Checking for directory /run ... " - if [ -d /run ]; then - echo "yes" - RUNDIR=/run - else - echo "no" - RUNDIR=/var/run - fi -fi - : ${SED:=sed} -: ${SYSCONFDIR:=$PREFIX/etc} -: ${SBINDIR:=$PREFIX/sbin} -: ${LIBEXECDIR:=$PREFIX/libexec/resolvconf} -: ${STATEDIR:=/var} -: ${RUNDIR:=$STATEDIR/run} -: ${MANDIR:=${PREFIX:-/usr}/share/man} - -eval SYSCONFDIR="$SYSCONFDIR" -eval SBINDIR="$SBINDIR" -eval LIBEXECDIR="$LIBEXECDIR" -eval VARDIR="$RUNDIR/resolvconf" -eval MANDIR="$MANDIR" - CONFIG_MK=config.mk if [ -z "$BUILD" ]; then @@ -121,7 +87,19 @@ rm -rf $CONFIG_MK echo "# $OS" >$CONFIG_MK case "$OS" in -freebsd*) +dragonfly*) + # This means /usr HAS to be mounted not via dhcpcd + : ${LIBEXECDIR:=${PREFIX:-/usr}/libexec/resolvconf} + ;; +linux*) + # cksum does't support -a and netpgp is rare + echo "CKSUM= sha256sum --tag" >>$CONFIG_MK + echo "PGP= gpg2" >>$CONFIG_MK + ;; +esac + +case "$OS" in +dragonfly*|freebsd*) # On FreeBSD, /etc/init.d/foo status returns 0 if foo is not enabled # regardless of if it's not running. # So we force onestatus to work around this silly bug. @@ -129,12 +107,42 @@ freebsd*) STATUSARG="onestatus" fi ;; -linux*) - # cksum does't support -a and netpgp is rare - echo "CKSUM= sha256sum --tag" >>$CONFIG_MK - echo "PGP= gpg2" >>$CONFIG_MK - ;; esac + + +if [ -z "$LIBEXECDIR" ]; then + printf "Checking for directory /libexec ... " + if [ -d /libexec ]; then + echo "yes" + LIBEXECDIR=$PREFIX/libexec/resolvconf + else + echo "no" + LIBEXECDIR=$PREFIX/lib/resolvconf + fi +fi +if [ -z "$RUNDIR" ]; then + printf "Checking for directory /run ... " + if [ -d /run ]; then + echo "yes" + RUNDIR=/run + else + echo "no" + RUNDIR=/var/run + fi +fi + +: ${SYSCONFDIR:=$PREFIX/etc} +: ${SBINDIR:=$PREFIX/sbin} +: ${LIBEXECDIR:=$PREFIX/libexec/resolvconf} +: ${STATEDIR:=/var} +: ${RUNDIR:=$STATEDIR/run} +: ${MANDIR:=${PREFIX:-/usr}/share/man} + +eval SYSCONFDIR="$SYSCONFDIR" +eval SBINDIR="$SBINDIR" +eval LIBEXECDIR="$LIBEXECDIR" +eval VARDIR="$RUNDIR/resolvconf" +eval MANDIR="$MANDIR" for x in SYSCONFDIR SBINDIR LIBEXECDIR VARDIR MANDIR RESTARTCMD RCDIR STATUSARG do Modified: vendor/openresolv/dist/dnsmasq.in ============================================================================== --- vendor/openresolv/dist/dnsmasq.in Wed Nov 20 21:48:27 2019 (r354916) +++ vendor/openresolv/dist/dnsmasq.in Wed Nov 20 22:13:14 2019 (r354917) @@ -1,5 +1,5 @@ #!/bin/sh -# Copyright (c) 2007-2016 Roy Marples +# Copyright (c) 2007-2019 Roy Marples # All rights reserved # dnsmasq subscriber for resolvconf @@ -28,7 +28,7 @@ [ -f "@SYSCONFDIR@"/resolvconf.conf ] || exit 0 . "@SYSCONFDIR@/resolvconf.conf" || exit 1 -[ -z "$dnsmasq_conf" -a -z "$dnsmasq_resolv" ] && exit 0 +[ -z "${dnsmasq_conf}${dnsmasq_resolv}" ] && exit 0 [ -z "$RESOLVCONF" ] && eval "$(@SBINDIR@/resolvconf -v)" NL=" " @@ -98,7 +98,7 @@ for d in $DOMAINS; do empty=false i=0 IFS=: set -- $n - while [ -n "$1" -o -n "$2" ]; do + while [ -n "$1" ] || [ -n "$2" ]; do addr="$1" shift if [ -z "$addr" ]; then @@ -184,7 +184,7 @@ if $changed; then eval $dnsmasq_restart elif [ -n "$RESTARTCMD" ]; then set -- ${dnsmasq_service} - eval $RESTARTCMD + eval "$RESTARTCMD" else @SBINDIR@/resolvconf -r ${dnsmasq_service} fi @@ -206,4 +206,6 @@ if $dbus; then dbus-send --system --dest=uk.org.thekelleys.dnsmasq \ /uk/org/thekelleys/dnsmasq uk.org.thekelleys.$method \ $dbusdest + dbus-send --system --dest=uk.org.thekelleys.dnsmasq \ + /uk/org/thekelleys/dnsmasq uk.org.thekelleys.ClearCache fi Modified: vendor/openresolv/dist/libc.in ============================================================================== --- vendor/openresolv/dist/libc.in Wed Nov 20 21:48:27 2019 (r354916) +++ vendor/openresolv/dist/libc.in Wed Nov 20 22:13:14 2019 (r354917) @@ -1,5 +1,5 @@ #!/bin/sh -# Copyright (c) 2007-2016 Roy Marples +# Copyright (c) 2007-2019 Roy Marples # All rights reserved # libc subscriber for resolvconf @@ -36,9 +36,9 @@ NL=" # sed may not be available, and this is faster on small files key_get_value() { - local key="$1" x= line= - + key="$1" shift + if [ $# -eq 0 ]; then while read -r line; do case "$line" in @@ -58,8 +58,6 @@ key_get_value() keys_remove() { - local key x line found - while read -r line; do found=false for key do @@ -79,7 +77,7 @@ local_nameservers="127.* 0.0.0.0 255.255.255.255 ::1" if [ -f "$SYSCONFDIR"/resolvconf.conf ]; then . "$SYSCONFDIR"/resolvconf.conf elif [ -d "$SYSCONFDIR"/resolvconf ]; then - SYSCONFDIR="$SYSCONFDIR/resolvconf/resolv.conf.d" + SYSCONFDIR="$SYSCONFDIR/resolvconf" base="$SYSCONFDIR/resolv.conf.d/base" if [ -f "$base" ]; then prepend_nameservers="$(key_get_value "nameserver " "$base")" @@ -98,10 +96,12 @@ fi : ${resolv_conf:=/etc/resolv.conf} : ${libc_service:=nscd} : ${list_resolv:=@SBINDIR@/resolvconf -l} -if [ "${resolv_conf_head-x}" = x -a -f "$SYSCONFDIR"/resolv.conf.head ]; then +if [ "${resolv_conf_head-x}" = x ] && [ -f "$SYSCONFDIR"/resolv.conf.head ] +then resolv_conf_head="$(cat "${SYSCONFDIR}"/resolv.conf.head)" fi -if [ "${resolv_conf_tail-x}" = x -a -f "$SYSCONFDIR"/resolv.conf.tail ]; then +if [ "${resolv_conf_tail-x}" = x ] && [ -f "$SYSCONFDIR"/resolv.conf.tail ] +then resolv_conf_tail="$(cat "$SYSCONFDIR"/resolv.conf.tail)" fi @@ -110,7 +110,7 @@ signature="# Generated by resolvconf" uniqify() { - local result= + result= while [ -n "$1" ]; do case " $result " in *" $1 "*);; @@ -126,7 +126,7 @@ case "${resolv_conf_passthrough:-NO}" in backup=false newest= for conf in "$IFACEDIR"/*; do - if [ -z "$newest" -o "$conf" -nt "$newest" ]; then + if [ -z "$newest" ] || [ "$conf" -nt "$newest" ]; then newest="$conf" fi done @@ -178,7 +178,7 @@ case "${resolv_conf_passthrough:-NO}" in fi [ -n "$domain" ] && newconf="${newconf}domain $domain$NL" - if [ -n "$newsearch" -a "$newsearch" != "$domain" ]; then + if [ -n "$newsearch" ] && [ "$newsearch" != "$domain" ]; then newconf="${newconf}search $newsearch$NL" fi for n in $newns; do @@ -232,7 +232,7 @@ if [ -n "$libc_restart" ]; then eval $libc_restart elif [ -n "$RESTARTCMD" ]; then set -- ${libc_service} - eval $RESTARTCMD + eval "$RESTARTCMD" else @SBINDIR@/resolvconf -r ${libc_service} fi Modified: vendor/openresolv/dist/named.in ============================================================================== --- vendor/openresolv/dist/named.in Wed Nov 20 21:48:27 2019 (r354916) +++ vendor/openresolv/dist/named.in Wed Nov 20 22:13:14 2019 (r354917) @@ -28,14 +28,14 @@ [ -f "@SYSCONFDIR@"/resolvconf.conf ] || exit 0 . "@SYSCONFDIR@/resolvconf.conf" || exit 1 -[ -z "$named_zones" -a -z "$named_options" ] && exit 0 +[ -z "${named_zones}${named_options}" ] && exit 0 [ -z "$RESOLVCONF" ] && eval "$(@SBINDIR@/resolvconf -v)" NL=" " # Platform specific kludges -if [ -z "$named_service" -a -z "$named_restart" -a \ - -d "$RCDIR" -a ! -x "$RCDIR"/named ] +if [ -z "${named_service}${named_restart}" ] && + [ -d "$RCDIR" ] && ! [ -x "$RCDIR"/named ] then if [ -x "$RCDIR"/bind9 ]; then # Debian and derivatives @@ -111,7 +111,7 @@ if $changed; then eval $named_restart elif [ -n "$RESTARTCMD" ]; then set -- ${named_service} - eval $RESTARTCMD + eval "$RESTARTCMD" else @SBINDIR@/resolvconf -r ${named_service} fi Modified: vendor/openresolv/dist/pdns_recursor.in ============================================================================== --- vendor/openresolv/dist/pdns_recursor.in Wed Nov 20 21:48:27 2019 (r354916) +++ vendor/openresolv/dist/pdns_recursor.in Wed Nov 20 22:13:14 2019 (r354917) @@ -1,5 +1,5 @@ #!/bin/sh -# Copyright (c) 2009-2011 Roy Marples +# Copyright (c) 2009-2019 Roy Marples # All rights reserved # PowerDNS Recursor subscriber for resolvconf @@ -33,17 +33,14 @@ NL=" " -: ${pdns_service:=pdns_recursor} +: ${pdns_service:=pdns-recursor} newzones= -# pds_recursor does not present support global forward servers, which -# does limit it's usefulness somewhat. -# If it did, the below code can be enabled, or something like it. -#for n in $NAMESERVERS; do -# newzones="$newzones${newzones:+,}$n" -#done -#[ -n "$newzones" ] && newzones=".=$newzones$NL" +for n in $NAMESERVERS; do + newzones="$newzones${newzones:+,}$n" +done +[ -n "$newzones" ] && newzones="+.=$newzones$NL" for d in $DOMAINS; do newns= @@ -71,7 +68,7 @@ then eval $pdns_restart elif [ -n "$RESTARTCMD" ]; then set -- ${pdns_service} - eval $RESTARTCMD + eval "$RESTARTCMD" else @SBINDIR@/resolvconf -r ${pdns_service} fi Modified: vendor/openresolv/dist/pdnsd.in ============================================================================== --- vendor/openresolv/dist/pdnsd.in Wed Nov 20 21:48:27 2019 (r354916) +++ vendor/openresolv/dist/pdnsd.in Wed Nov 20 22:13:14 2019 (r354917) @@ -1,5 +1,5 @@ #!/bin/sh -# Copyright (c) 2010-2013 Roy Marples +# Copyright (c) 2010-2018 Roy Marples # All rights reserved # pdnsd subscriber for resolvconf @@ -28,7 +28,7 @@ [ -f "@SYSCONFDIR@"/resolvconf.conf ] || exit 0 . "@SYSCONFDIR@/resolvconf.conf" || exit 1 -[ -z "$pdnsd_conf" -a -z "$pdnsd_resolv" ] && exit 0 +[ -z "${pdnsd_conf}${pdnsd_resolv}" ] && exit 0 [ -z "$RESOLVCONF" ] && eval "$(@SBINDIR@/resolvconf -v)" NL=" " @@ -41,14 +41,16 @@ signature_end="# End of resolvconf" # but sed may not always be available at the time. remove_markers() { - local m1="$1" m2="$2" x= line= in_marker=0 + m1="$1" + m2="$2" + in_marker=0 shift; shift if type sed >/dev/null 2>&1; then sed "/^$m1/,/^$m2/d" $@ else - for x; do - while read -r line; do + for x do + while read line; do case "$line" in "$m1"*) in_marker=1;; "$m2"*) in_marker=0;; Modified: vendor/openresolv/dist/resolvconf.conf ============================================================================== --- vendor/openresolv/dist/resolvconf.conf Wed Nov 20 21:48:27 2019 (r354916) +++ vendor/openresolv/dist/resolvconf.conf Wed Nov 20 22:13:14 2019 (r354917) @@ -4,4 +4,4 @@ resolv_conf=/etc/resolv.conf # If you run a local name server, you should uncomment the below line and # configure your subscribers configuration files below. -#name_servers=127.0.0.1 \ No newline at end of file +#name_servers=127.0.0.1 Modified: vendor/openresolv/dist/resolvconf.conf.5.in ============================================================================== --- vendor/openresolv/dist/resolvconf.conf.5.in Wed Nov 20 21:48:27 2019 (r354916) +++ vendor/openresolv/dist/resolvconf.conf.5.in Wed Nov 20 22:13:14 2019 (r354917) @@ -22,7 +22,7 @@ .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" -.Dd December 29, 2016 +.Dd September 8, 2019 .Dt RESOLVCONF.CONF 5 .Os .Sh NAME @@ -64,19 +64,25 @@ Defaults to YES. .It Sy interface_order These interfaces will always be processed first. If unset, defaults to the following:- -.D1 lo lo[0-9]* +.Bd -compact -literal -offset indent +lo lo[0-9]* +.Ed .It Sy dynamic_order These interfaces will be processed next, unless they have a metric. If unset, defaults to the following:- -.D1 tap[0-9]* tun[0-9]* vpn vpn[0-9]* ppp[0-9]* ippp[0-9]* +.Bd -compact -literal -offset indent +tap[0-9]* tun[0-9]* vpn vpn[0-9]* ppp[0-9]* ippp[0-9]* +.Ed .It Sy inclusive_interfaces -Ignore any exlcusive marking for these interfaces. +Ignore any exclusive marking for these interfaces. This is handy when 3rd party integrations force the .Nm resolvconf -x option and you want to disable it easily. .It Sy local_nameservers If unset, defaults to the following:- -.D1 127.* 0.0.0.0 255.255.255.255 ::1 +.Bd -compact -literal -offset indent +127.* 0.0.0.0 255.255.255.255 ::1 +.Ed .It Sy search_domains Prepend search domains to the dynamically generated list. .It Sy search_domains_append @@ -118,16 +124,24 @@ The syntax is this: .Va $keyword Ns / Ns Va $match Ns / Ns Va $replacement .Pp Example, given this resolv.conf: -.D1 domain foo.org -.D1 search foo.org dead.beef -.D1 nameserver 1.2.3.4 -.D1 nameserver 2.3.4.5 +.Bd -compact -literal -offset indent +domain foo.org +search foo.org dead.beef +nameserver 1.2.3.4 +nameserver 2.3.4.5 +.Ed and this configuaration: -.D1 replace="search/foo*/bar.com nameserver/1.2.3.4/5.6.7.8 nameserver/2.3.4.5/" +.Bd -compact -literal -offset indent +replace="search/foo*/bar.com" +replace="$replace nameserver/1.2.3.4/5.6.7.8" +replace="$replace nameserver/2.3.4.5/" +.Ed you would get this resolv.conf instead: -.D1 domain foo.org -.D1 search bar.com -.D1 nameserver 5.6.7.8 +.Bd -compact -literal -offset indent +domain foo.org +search bar.com +nameserver 5.6.7.8 +.Ed .It Sy replace_sub Works the same way as .Sy replace @@ -138,9 +152,11 @@ Using the same example resolv.conf and changing to .Sy replace_sub , you would get this resolv.conf instead: -.D1 domain foo.org -.D1 search bar.com dead.beef -.D1 nameserver 5.6.7.8 +.Bd -compact -literal -offset indent +domain foo.org +search bar.com dead.beef +nameserver 5.6.7.8 +.Ed .It Sy state_dir Override the default state directory of .Pa @VARDIR@ . @@ -195,7 +211,8 @@ Prepend search domains to the dynamically generated li openresolv ships with subscribers for the name servers .Xr dnsmasq 8 , .Xr named 8 , -.Xr pdnsd 8 +.Xr pdnsd 8 , +.Xr pdns_recursor 8 , and .Xr unbound 8 . Each subscriber can create configuration files which should be included in @@ -203,7 +220,9 @@ in the subscribers main configuration file. .Pp To disable a subscriber, simply set it's name to NO. For example, to disable the libc subscriber you would set: -.D1 libc=NO +.Bd -compact -literal -offset indent +libc=NO +.Ed .Bl -tag -width indent .It Sy dnsmasq_conf This file tells dnsmasq which name servers to use for specific domains. @@ -211,17 +230,21 @@ This file tells dnsmasq which name servers to use for This file tells dnsmasq which name servers to use for global lookups. .Pp Example resolvconf.conf for dnsmasq: -.D1 name_servers=127.0.0.1 -.D1 dnsmasq_conf=/etc/dnsmasq-conf.conf -.D1 dnsmasq_resolv=/etc/dnsmasq-resolv.conf +.Bd -compact -literal -offset indent +name_servers=127.0.0.1 +dnsmasq_conf=/etc/dnsmasq-conf.conf +dnsmasq_resolv=/etc/dnsmasq-resolv.conf +.Ed .Pp Example dnsmasq.conf: -.D1 listen-address=127.0.0.1 -.D1 # If dnsmasq is compiled for DBus then we can take -.D1 # advantage of not having to restart dnsmasq. -.D1 enable-dbus -.D1 conf-file=/etc/dnsmasq-conf.conf -.D1 resolv-file=/etc/dnsmasq-resolv.conf +.Bd -compact -literal -offset indent +listen-address=127.0.0.1 +# If dnsmasq is compiled for DBus then we can take +# advantage of not having to restart dnsmasq. +enable-dbus +conf-file=/etc/dnsmasq-conf.conf +resolv-file=/etc/dnsmasq-resolv.conf +.Ed .It Sy named_options Include this file in the named options block. This file tells named which name servers to use for global lookups. @@ -230,16 +253,21 @@ Include this file in the named global scope, after the This file tells named which name servers to use for specific domains. .Pp Example resolvconf.conf for named: -.D1 name_servers=127.0.0.1 -.D1 named_options=/etc/named-options.conf -.D1 named_zones=/etc/named-zones.conf +.Bd -compact -literal -offset indent +name_servers=127.0.0.1 +named_options=/etc/named-options.conf +named_zones=/etc/named-zones.conf +.Ed .Pp Example named.conf: -.D1 options { -.D1 listen-on { 127.0.0.1; }; -.D1 include "/etc/named-options.conf"; -.D1 }; -.D1 include "/etc/named-zones.conf"; +.Bd -compact -literal -offset indent +options { + listen-on { 127.0.0.1; }; + include "/etc/named-options.conf"; +}; + +include "/etc/named-zones.conf"; +.Ed .It Sy pdnsd_conf This is the main pdnsd configuration file which we modify to add our forward domains to. @@ -253,32 +281,54 @@ If this variable is not set then it's written to .Pa pdnsd_conf . .Pp Example resolvconf.conf for pdnsd: -.D1 name_servers=127.0.0.1 -.D1 pdnsd_conf=/etc/pdnsd.conf -.D1 # pdnsd_resolv=/etc/pdnsd-resolv.conf +.Bd -compact -literal -offset indent +name_servers=127.0.0.1 +pdnsd_conf=/etc/pdnsd.conf +# pdnsd_resolv=/etc/pdnsd-resolv.conf +.Ed .Pp Example pdnsd.conf: -.D1 global { -.D1 server_ip = 127.0.0.1; -.D1 status_ctl = on; -.D1 } -.D1 server { -.D1 # A server definition is required, even if emtpy. -.D1 label="empty"; -.D1 proxy_only=on; -.D1 # file="/etc/pdnsd-resolv.conf"; -.D1 } +.Bd -compact -literal -offset indent +global { + server_ip = 127.0.0.1; + status_ctl = on; +} +server { + # A server definition is required, even if empty. + label="empty"; + proxy_only=on; + # file="/etc/pdnsd-resolv.conf"; +} +.Ed +.It Sy pdns_zones +This file tells pdns_recursor about specific and global name servers. +.Pp +Example resolvconf.conf for pdns_recursor: +.Bd -compact -literal -offset indent +name_servers=127.0.0.1 +pdns_zones=/etc/pdns/recursor-zones.conf +.Ed +.Pp +Example recursor.conf: +.Bd -compact -literal -offset indent +allow-from=127.0.0.0/8, ::1/128 +forward-zones-file=/etc/pdns/recursor-zones.conf +.Ed .It Sy unbound_conf This file tells unbound about specific and global name servers. .It Sy unbound_insecure When set to YES, unbound marks the domains as insecure, thus ignoring DNSSEC. .Pp Example resolvconf.conf for unbound: -.D1 name_servers=127.0.0.1 -.D1 unbound_conf=/etc/unbound-resolvconf.conf +.Bd -compact -literal -offset indent +name_servers=127.0.0.1 +unbound_conf=/etc/unbound-resolvconf.conf +.Ed .Pp Example unbound.conf: -.D1 include: /etc/unbound-resolvconf.conf +.Bd -compact -literal -offset indent +include: /etc/unbound-resolvconf.conf +.Ed .El .Sh SUBSCRIBER INTEGRATION Not all distributions store the files the subscribers need in the same @@ -292,7 +342,6 @@ Also, users could equally want to use a different vers installed by default, such as bind8 and bind9. To accommodate this, the subscribers have these files in configurable variables, documented below. -.Pp .Bl -tag -width indent .It Sy dnsmasq_service Name of the dnsmasq service. @@ -310,6 +359,10 @@ Name of the named service. Command to restart the named service. .It Sy pdnsd_restart Command to restart the pdnsd service. +.It Sy pdns_service +Command to restart the pdns_recursor service. +.It Sy pdns_restart +Command to restart the pdns_recursor service. .It Sy unbound_service Name of the unbound service. .It Sy unbound_restart Modified: vendor/openresolv/dist/resolvconf.in ============================================================================== --- vendor/openresolv/dist/resolvconf.in Wed Nov 20 21:48:27 2019 (r354916) +++ vendor/openresolv/dist/resolvconf.in Wed Nov 20 22:13:14 2019 (r354917) @@ -1,5 +1,5 @@ #!/bin/sh -# Copyright (c) 2007-2016 Roy Marples +# Copyright (c) 2007-2019 Roy Marples # All rights reserved # Redistribution and use in source and binary forms, with or without @@ -25,7 +25,7 @@ # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. RESOLVCONF="$0" -OPENRESOLV_VERSION="3.9.0" +OPENRESOLV_VERSION="3.9.2" SYSCONFDIR=@SYSCONFDIR@ LIBEXECDIR=@LIBEXECDIR@ VARDIR=@VARDIR@ @@ -125,21 +125,22 @@ usage() # If you think otherwise, capture a DNS trace and you'll see libc # will strip it regardless. # This also solves setting up duplicate zones in our subscribers. -strip_trailing_dots() +# Also strip any comments denoted by #. +resolv_strip() { - local n= d= - - for n; do - printf "$d%s" "${n%.}" - d=" " + space= + for word; do + case "$word" in + \#*) break;; + esac + printf "%s%s" "$space${word%.}" + space=" " done printf "\n" } private_iface() { - local p - # Allow expansion cd "$IFACEDIR" @@ -168,12 +169,15 @@ private_iface() # for domain name servers, search name servers and global nameservers parse_resolv() { - local line= ns= ds= search= d= n= newns= - local new=true iface= private=false p= domain= l= islocal= - + domain= + new=true newns= + ns= + private=false + search= while read -r line; do + stripped_line="$(resolv_strip ${line#* })" case "$line" in "# resolv.conf from "*) if ${new}; then @@ -189,29 +193,32 @@ parse_resolv() "nameserver "*) islocal=false for l in $local_nameservers; do - case "${line#* }" in + case "$stripped_line" in $l) islocal=true - echo "LOCALNAMESERVERS=\"\$LOCALNAMESERVERS ${line#* }\"" break ;; esac done - $islocal || ns="$ns${line#* } " + if $islocal; then + echo "LOCALNAMESERVERS=\"\$LOCALNAMESERVERS $stripped_line\"" + else + ns="$ns$stripped_line " + fi ;; "domain "*) - search="$(strip_trailing_dots ${line#* })" + search="$stripped_line" if [ -z "$domain" ]; then domain="$search" echo "DOMAIN=\"$domain\"" fi ;; "search "*) - search="$(strip_trailing_dots ${line#* })" + search="$stripped_line" ;; *) [ -n "$line" ] && continue - if [ -n "$ns" -a -n "$search" ]; then + if [ -n "$ns" ] && [ -n "$search" ]; then newns= for n in $ns; do newns="$newns${newns:+,}$n" @@ -236,7 +243,7 @@ parse_resolv() uniqify() { - local result= + result= while [ -n "$1" ]; do case " $result " in *" $1 "*);; @@ -249,8 +256,8 @@ uniqify() dirname() { - local dir= OIFS="$IFS" - local IFS=/ + OIFS="$IFS" + IFS=/ set -- $@ IFS="$OIFS" if [ -n "$1" ]; then @@ -267,7 +274,7 @@ dirname() config_mkdirs() { - local e=0 f d + e=0 for f; do [ -n "$f" ] || continue d="$(dirname "$f")" @@ -295,66 +302,86 @@ detect_init() # Detect the running init system. # As systemd and OpenRC can be installed on top of legacy init # systems we try to detect them first. - local status="@STATUSARG@" + status="@STATUSARG@" : ${status:=status} - if [ -x /bin/systemctl -a -S /run/systemd/private ]; then - RESTARTCMD="if /bin/systemctl --quiet is-active \$1.service; then - /bin/systemctl restart \$1.service; -fi" - elif [ -x /usr/bin/systemctl -a -S /run/systemd/private ]; then - RESTARTCMD="if /usr/bin/systemctl --quiet is-active \$1.service; then - /usr/bin/systemctl restart \$1.service; -fi" - elif [ -x /sbin/rc-service -a \ - -s /libexec/rc/init.d/softlevel -o -s /run/openrc/softlevel ] + if [ -x /bin/systemctl ] && [ -S /run/systemd/private ]; then + RESTARTCMD=' + if /bin/systemctl --quiet is-active $1.service + then + /bin/systemctl restart $1.service + fi' + elif [ -x /usr/bin/systemctl ] && [ -S /run/systemd/private ]; then + RESTARTCMD=' + if /usr/bin/systemctl --quiet is-active $1.service + then + /usr/bin/systemctl restart $1.service + fi' + elif [ -x /sbin/rc-service ] && + { [ -s /libexec/rc/init.d/softlevel ] || + [ -s /run/openrc/softlevel ]; } then - RESTARTCMD="/sbin/rc-service -i \$1 -- -Ds restart" + RESTARTCMD='/sbin/rc-service -i $1 -- -Ds restart' elif [ -x /usr/sbin/invoke-rc.d ]; then RCDIR=/etc/init.d - RESTARTCMD="if /usr/sbin/invoke-rc.d --quiet \$1 status 1>/dev/null 2>&1; then - /usr/sbin/invoke-rc.d \$1 restart; -fi" + RESTARTCMD=' + if /usr/sbin/invoke-rc.d --quiet $1 status >/dev/null 2>&1 + then + /usr/sbin/invoke-rc.d $1 restart + fi' elif [ -x /sbin/service ]; then # Old RedHat RCDIR=/etc/init.d - RESTARTCMD="if /sbin/service \$1; then - /sbin/service \$1 restart; -fi" + RESTARTCMD=' + if /sbin/service $1; then + /sbin/service $1 restart + fi' elif [ -x /usr/sbin/service ]; then # Could be FreeBSD - RESTARTCMD="if /usr/sbin/service \$1 $status 1>/dev/null 2>&1; then - /usr/sbin/service \$1 restart; -fi" + RESTARTCMD=" + if /usr/sbin/service \$1 $status >/dev/null 2>&1 + then + /usr/sbin/service \$1 restart + fi" elif [ -x /bin/sv ]; then - RESTARTCMD="/bin/sv status \$1 >/dev/null 2>&1 && /bin/sv try-restart \$1" + RESTARTCMD='/bin/sv status $1 >/dev/null 2>&1 && + /bin/sv try-restart $1' elif [ -x /usr/bin/sv ]; then - RESTARTCMD="/usr/bin/sv status \$1 >/dev/null 2>&1 && /usr/bin/sv try-restart \$1" - elif [ -e /etc/arch-release -a -d /etc/rc.d ]; then *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-all@freebsd.org Wed Nov 20 22:20:14 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 495741C331A; Wed, 20 Nov 2019 22:20:14 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47JHFB1dXVz4QkM; Wed, 20 Nov 2019 22:20:14 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id F3D10163F; Wed, 20 Nov 2019 22:20:13 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xAKMKDoF085975; Wed, 20 Nov 2019 22:20:13 GMT (envelope-from pfg@FreeBSD.org) Received: (from pfg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xAKMKBIU085964; Wed, 20 Nov 2019 22:20:11 GMT (envelope-from pfg@FreeBSD.org) Message-Id: <201911202220.xAKMKBIU085964@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: pfg set sender to pfg@FreeBSD.org using -f From: "Pedro F. Giffuni" Date: Wed, 20 Nov 2019 22:20:11 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-vendor@freebsd.org Subject: svn commit: r354918 - vendor/openresolv/dist X-SVN-Group: vendor X-SVN-Commit-Author: pfg X-SVN-Commit-Paths: vendor/openresolv/dist X-SVN-Commit-Revision: 354918 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 20 Nov 2019 22:20:14 -0000 Author: pfg Date: Wed Nov 20 22:20:11 2019 New Revision: 354918 URL: https://svnweb.freebsd.org/changeset/base/354918 Log: Undo r354917 to correct the log: it was actually version 3.9.2 Added: vendor/openresolv/dist/README - copied unchanged from r354916, vendor/openresolv/dist/README Deleted: vendor/openresolv/dist/LICENSE vendor/openresolv/dist/README.md Modified: vendor/openresolv/dist/Makefile vendor/openresolv/dist/configure vendor/openresolv/dist/dnsmasq.in vendor/openresolv/dist/libc.in vendor/openresolv/dist/named.in vendor/openresolv/dist/pdns_recursor.in vendor/openresolv/dist/pdnsd.in vendor/openresolv/dist/resolvconf.conf vendor/openresolv/dist/resolvconf.conf.5.in vendor/openresolv/dist/resolvconf.in vendor/openresolv/dist/unbound.in Modified: vendor/openresolv/dist/Makefile ============================================================================== --- vendor/openresolv/dist/Makefile Wed Nov 20 22:13:14 2019 (r354917) +++ vendor/openresolv/dist/Makefile Wed Nov 20 22:20:11 2019 (r354918) @@ -10,7 +10,6 @@ SYSCONFDIR?= /etc LIBEXECDIR?= /libexec/resolvconf VARDIR?= /var/run/resolvconf -ECHO?= echo INSTALL?= install SED?= sed @@ -21,7 +20,7 @@ DOCMODE?= 0644 MANMODE?= 0444 RESOLVCONF= resolvconf resolvconf.8 resolvconf.conf.5 -SUBSCRIBERS= libc dnsmasq named pdnsd pdns_recursor unbound +SUBSCRIBERS= libc dnsmasq named pdnsd unbound TARGET= ${RESOLVCONF} ${SUBSCRIBERS} SRCS= ${TARGET:C,$,.in,} # pmake SRCS:= ${TARGET:=.in} # gmake @@ -43,7 +42,7 @@ DISTINFOSIGN= ${DISTINFO}.asc CKSUM?= cksum -a SHA256 PGP?= netpgp -GITREF?= HEAD +FOSSILID?= current .SUFFIXES: .in @@ -80,17 +79,15 @@ maninstall: install: proginstall maninstall -dist-git: - git archive --prefix=${DISTPREFIX}/ ${GITREF} | xz >${DISTFILE} - -dist-inst: - mkdir /tmp/${DISTPREFIX} - cp -RPp * /tmp/${DISTPREFIX} - (cd /tmp/${DISTPREFIX}; make clean) - tar -cvjpf ${DISTFILE} -C /tmp ${DISTPREFIX} +import: rm -rf /tmp/${DISTPREFIX} + ${INSTALL} -d /tmp/${DISTPREFIX} + cp README ${SRCS} /tmp/${DISTPREFIX} -dist: dist-git +dist: + fossil tarball --name ${DISTPREFIX} ${FOSSILID} ${DISTFILEGZ} + gunzip -c ${DISTFILEGZ} | xz >${DISTFILE} + rm ${DISTFILEGZ} distinfo: dist rm -f ${DISTINFO} ${DISTINFOSIGN} @@ -99,20 +96,3 @@ distinfo: dist ${PGP} --clearsign --output=${DISTINFOSIGN} ${DISTINFO} chmod 644 ${DISTINFOSIGN} ls -l ${DISTFILE} ${DISTINFO} ${DISTINFOSIGN} - -import: dist - rm -rf /tmp/${DISTPREFIX} - ${INSTALL} -d /tmp/${DISTPREFIX} - tar xvJpf ${DISTFILE} -C /tmp - -_import-src: - rm -rf ${DESTDIR}/* - ${INSTALL} -d ${DESTDIR} - cp LICENSE README.md ${SRCS} resolvconf.conf ${DESTDIR}; - cp resolvconf.8.in resolvconf.conf.5.in ${DESTDIR}; - @${ECHO} - @${ECHO} "=============================================================" - @${ECHO} "openresolv-${VERSION} imported to ${DESTDIR}" - -import-src: - ${MAKE} _import-src DESTDIR=`if [ -n "${DESTDIR}" ]; then echo "${DESTDIR}"; else echo /tmp/${DISTPREFIX}; fi` Copied: vendor/openresolv/dist/README (from r354916, vendor/openresolv/dist/README) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ vendor/openresolv/dist/README Wed Nov 20 22:20:11 2019 (r354918, copy of r354916, vendor/openresolv/dist/README) @@ -0,0 +1,11 @@ +openresolv is a resolvconf implementation which manages resolv.conf +You can find the latest version at http://roy.marples.name/projects/openresolv +It is written and maintained by Roy Marples + +This resolvconf implementation, along with its subscribers, work with a +POSIX compliant shell and userland utilities. It is designed to work without +tools such as sed as it *has* to work without /usr being available. + +On systems where resolvconf is expected to be used before /var/run is available +for writing, you can configure openresolv to write somewhere else, like say a +ramdisk. Modified: vendor/openresolv/dist/configure ============================================================================== --- vendor/openresolv/dist/configure Wed Nov 20 22:13:14 2019 (r354917) +++ vendor/openresolv/dist/configure Wed Nov 20 22:20:11 2019 (r354918) @@ -44,8 +44,42 @@ for x do esac done +if [ -z "$LIBEXECDIR" ]; then + printf "Checking for directory /libexec ... " + if [ -d /libexec ]; then + echo "yes" + LIBEXECDIR=$PREFIX/libexec/resolvconf + else + echo "no" + LIBEXECDIR=$PREFIX/lib/resolvconf + fi +fi +if [ -z "$RUNDIR" ]; then + printf "Checking for directory /run ... " + if [ -d /run ]; then + echo "yes" + RUNDIR=/run + else + echo "no" + RUNDIR=/var/run + fi +fi + : ${SED:=sed} +: ${SYSCONFDIR:=$PREFIX/etc} +: ${SBINDIR:=$PREFIX/sbin} +: ${LIBEXECDIR:=$PREFIX/libexec/resolvconf} +: ${STATEDIR:=/var} +: ${RUNDIR:=$STATEDIR/run} +: ${MANDIR:=${PREFIX:-/usr}/share/man} + +eval SYSCONFDIR="$SYSCONFDIR" +eval SBINDIR="$SBINDIR" +eval LIBEXECDIR="$LIBEXECDIR" +eval VARDIR="$RUNDIR/resolvconf" +eval MANDIR="$MANDIR" + CONFIG_MK=config.mk if [ -z "$BUILD" ]; then @@ -87,19 +121,7 @@ rm -rf $CONFIG_MK echo "# $OS" >$CONFIG_MK case "$OS" in -dragonfly*) - # This means /usr HAS to be mounted not via dhcpcd - : ${LIBEXECDIR:=${PREFIX:-/usr}/libexec/resolvconf} - ;; -linux*) - # cksum does't support -a and netpgp is rare - echo "CKSUM= sha256sum --tag" >>$CONFIG_MK - echo "PGP= gpg2" >>$CONFIG_MK - ;; -esac - -case "$OS" in -dragonfly*|freebsd*) +freebsd*) # On FreeBSD, /etc/init.d/foo status returns 0 if foo is not enabled # regardless of if it's not running. # So we force onestatus to work around this silly bug. @@ -107,42 +129,12 @@ dragonfly*|freebsd*) STATUSARG="onestatus" fi ;; +linux*) + # cksum does't support -a and netpgp is rare + echo "CKSUM= sha256sum --tag" >>$CONFIG_MK + echo "PGP= gpg2" >>$CONFIG_MK + ;; esac - - -if [ -z "$LIBEXECDIR" ]; then - printf "Checking for directory /libexec ... " - if [ -d /libexec ]; then - echo "yes" - LIBEXECDIR=$PREFIX/libexec/resolvconf - else - echo "no" - LIBEXECDIR=$PREFIX/lib/resolvconf - fi -fi -if [ -z "$RUNDIR" ]; then - printf "Checking for directory /run ... " - if [ -d /run ]; then - echo "yes" - RUNDIR=/run - else - echo "no" - RUNDIR=/var/run - fi -fi - -: ${SYSCONFDIR:=$PREFIX/etc} -: ${SBINDIR:=$PREFIX/sbin} -: ${LIBEXECDIR:=$PREFIX/libexec/resolvconf} -: ${STATEDIR:=/var} -: ${RUNDIR:=$STATEDIR/run} -: ${MANDIR:=${PREFIX:-/usr}/share/man} - -eval SYSCONFDIR="$SYSCONFDIR" -eval SBINDIR="$SBINDIR" -eval LIBEXECDIR="$LIBEXECDIR" -eval VARDIR="$RUNDIR/resolvconf" -eval MANDIR="$MANDIR" for x in SYSCONFDIR SBINDIR LIBEXECDIR VARDIR MANDIR RESTARTCMD RCDIR STATUSARG do Modified: vendor/openresolv/dist/dnsmasq.in ============================================================================== --- vendor/openresolv/dist/dnsmasq.in Wed Nov 20 22:13:14 2019 (r354917) +++ vendor/openresolv/dist/dnsmasq.in Wed Nov 20 22:20:11 2019 (r354918) @@ -1,5 +1,5 @@ #!/bin/sh -# Copyright (c) 2007-2019 Roy Marples +# Copyright (c) 2007-2016 Roy Marples # All rights reserved # dnsmasq subscriber for resolvconf @@ -28,7 +28,7 @@ [ -f "@SYSCONFDIR@"/resolvconf.conf ] || exit 0 . "@SYSCONFDIR@/resolvconf.conf" || exit 1 -[ -z "${dnsmasq_conf}${dnsmasq_resolv}" ] && exit 0 +[ -z "$dnsmasq_conf" -a -z "$dnsmasq_resolv" ] && exit 0 [ -z "$RESOLVCONF" ] && eval "$(@SBINDIR@/resolvconf -v)" NL=" " @@ -98,7 +98,7 @@ for d in $DOMAINS; do empty=false i=0 IFS=: set -- $n - while [ -n "$1" ] || [ -n "$2" ]; do + while [ -n "$1" -o -n "$2" ]; do addr="$1" shift if [ -z "$addr" ]; then @@ -184,7 +184,7 @@ if $changed; then eval $dnsmasq_restart elif [ -n "$RESTARTCMD" ]; then set -- ${dnsmasq_service} - eval "$RESTARTCMD" + eval $RESTARTCMD else @SBINDIR@/resolvconf -r ${dnsmasq_service} fi @@ -206,6 +206,4 @@ if $dbus; then dbus-send --system --dest=uk.org.thekelleys.dnsmasq \ /uk/org/thekelleys/dnsmasq uk.org.thekelleys.$method \ $dbusdest - dbus-send --system --dest=uk.org.thekelleys.dnsmasq \ - /uk/org/thekelleys/dnsmasq uk.org.thekelleys.ClearCache fi Modified: vendor/openresolv/dist/libc.in ============================================================================== --- vendor/openresolv/dist/libc.in Wed Nov 20 22:13:14 2019 (r354917) +++ vendor/openresolv/dist/libc.in Wed Nov 20 22:20:11 2019 (r354918) @@ -1,5 +1,5 @@ #!/bin/sh -# Copyright (c) 2007-2019 Roy Marples +# Copyright (c) 2007-2016 Roy Marples # All rights reserved # libc subscriber for resolvconf @@ -36,9 +36,9 @@ NL=" # sed may not be available, and this is faster on small files key_get_value() { - key="$1" - shift + local key="$1" x= line= + shift if [ $# -eq 0 ]; then while read -r line; do case "$line" in @@ -58,6 +58,8 @@ key_get_value() keys_remove() { + local key x line found + while read -r line; do found=false for key do @@ -77,7 +79,7 @@ local_nameservers="127.* 0.0.0.0 255.255.255.255 ::1" if [ -f "$SYSCONFDIR"/resolvconf.conf ]; then . "$SYSCONFDIR"/resolvconf.conf elif [ -d "$SYSCONFDIR"/resolvconf ]; then - SYSCONFDIR="$SYSCONFDIR/resolvconf" + SYSCONFDIR="$SYSCONFDIR/resolvconf/resolv.conf.d" base="$SYSCONFDIR/resolv.conf.d/base" if [ -f "$base" ]; then prepend_nameservers="$(key_get_value "nameserver " "$base")" @@ -96,12 +98,10 @@ fi : ${resolv_conf:=/etc/resolv.conf} : ${libc_service:=nscd} : ${list_resolv:=@SBINDIR@/resolvconf -l} -if [ "${resolv_conf_head-x}" = x ] && [ -f "$SYSCONFDIR"/resolv.conf.head ] -then +if [ "${resolv_conf_head-x}" = x -a -f "$SYSCONFDIR"/resolv.conf.head ]; then resolv_conf_head="$(cat "${SYSCONFDIR}"/resolv.conf.head)" fi -if [ "${resolv_conf_tail-x}" = x ] && [ -f "$SYSCONFDIR"/resolv.conf.tail ] -then +if [ "${resolv_conf_tail-x}" = x -a -f "$SYSCONFDIR"/resolv.conf.tail ]; then resolv_conf_tail="$(cat "$SYSCONFDIR"/resolv.conf.tail)" fi @@ -110,7 +110,7 @@ signature="# Generated by resolvconf" uniqify() { - result= + local result= while [ -n "$1" ]; do case " $result " in *" $1 "*);; @@ -126,7 +126,7 @@ case "${resolv_conf_passthrough:-NO}" in backup=false newest= for conf in "$IFACEDIR"/*; do - if [ -z "$newest" ] || [ "$conf" -nt "$newest" ]; then + if [ -z "$newest" -o "$conf" -nt "$newest" ]; then newest="$conf" fi done @@ -178,7 +178,7 @@ case "${resolv_conf_passthrough:-NO}" in fi [ -n "$domain" ] && newconf="${newconf}domain $domain$NL" - if [ -n "$newsearch" ] && [ "$newsearch" != "$domain" ]; then + if [ -n "$newsearch" -a "$newsearch" != "$domain" ]; then newconf="${newconf}search $newsearch$NL" fi for n in $newns; do @@ -232,7 +232,7 @@ if [ -n "$libc_restart" ]; then eval $libc_restart elif [ -n "$RESTARTCMD" ]; then set -- ${libc_service} - eval "$RESTARTCMD" + eval $RESTARTCMD else @SBINDIR@/resolvconf -r ${libc_service} fi Modified: vendor/openresolv/dist/named.in ============================================================================== --- vendor/openresolv/dist/named.in Wed Nov 20 22:13:14 2019 (r354917) +++ vendor/openresolv/dist/named.in Wed Nov 20 22:20:11 2019 (r354918) @@ -28,14 +28,14 @@ [ -f "@SYSCONFDIR@"/resolvconf.conf ] || exit 0 . "@SYSCONFDIR@/resolvconf.conf" || exit 1 -[ -z "${named_zones}${named_options}" ] && exit 0 +[ -z "$named_zones" -a -z "$named_options" ] && exit 0 [ -z "$RESOLVCONF" ] && eval "$(@SBINDIR@/resolvconf -v)" NL=" " # Platform specific kludges -if [ -z "${named_service}${named_restart}" ] && - [ -d "$RCDIR" ] && ! [ -x "$RCDIR"/named ] +if [ -z "$named_service" -a -z "$named_restart" -a \ + -d "$RCDIR" -a ! -x "$RCDIR"/named ] then if [ -x "$RCDIR"/bind9 ]; then # Debian and derivatives @@ -111,7 +111,7 @@ if $changed; then eval $named_restart elif [ -n "$RESTARTCMD" ]; then set -- ${named_service} - eval "$RESTARTCMD" + eval $RESTARTCMD else @SBINDIR@/resolvconf -r ${named_service} fi Modified: vendor/openresolv/dist/pdns_recursor.in ============================================================================== --- vendor/openresolv/dist/pdns_recursor.in Wed Nov 20 22:13:14 2019 (r354917) +++ vendor/openresolv/dist/pdns_recursor.in Wed Nov 20 22:20:11 2019 (r354918) @@ -1,5 +1,5 @@ #!/bin/sh -# Copyright (c) 2009-2019 Roy Marples +# Copyright (c) 2009-2011 Roy Marples # All rights reserved # PowerDNS Recursor subscriber for resolvconf @@ -33,14 +33,17 @@ NL=" " -: ${pdns_service:=pdns-recursor} +: ${pdns_service:=pdns_recursor} newzones= -for n in $NAMESERVERS; do - newzones="$newzones${newzones:+,}$n" -done -[ -n "$newzones" ] && newzones="+.=$newzones$NL" +# pds_recursor does not present support global forward servers, which +# does limit it's usefulness somewhat. +# If it did, the below code can be enabled, or something like it. +#for n in $NAMESERVERS; do +# newzones="$newzones${newzones:+,}$n" +#done +#[ -n "$newzones" ] && newzones=".=$newzones$NL" for d in $DOMAINS; do newns= @@ -68,7 +71,7 @@ then eval $pdns_restart elif [ -n "$RESTARTCMD" ]; then set -- ${pdns_service} - eval "$RESTARTCMD" + eval $RESTARTCMD else @SBINDIR@/resolvconf -r ${pdns_service} fi Modified: vendor/openresolv/dist/pdnsd.in ============================================================================== --- vendor/openresolv/dist/pdnsd.in Wed Nov 20 22:13:14 2019 (r354917) +++ vendor/openresolv/dist/pdnsd.in Wed Nov 20 22:20:11 2019 (r354918) @@ -1,5 +1,5 @@ #!/bin/sh -# Copyright (c) 2010-2018 Roy Marples +# Copyright (c) 2010-2013 Roy Marples # All rights reserved # pdnsd subscriber for resolvconf @@ -28,7 +28,7 @@ [ -f "@SYSCONFDIR@"/resolvconf.conf ] || exit 0 . "@SYSCONFDIR@/resolvconf.conf" || exit 1 -[ -z "${pdnsd_conf}${pdnsd_resolv}" ] && exit 0 +[ -z "$pdnsd_conf" -a -z "$pdnsd_resolv" ] && exit 0 [ -z "$RESOLVCONF" ] && eval "$(@SBINDIR@/resolvconf -v)" NL=" " @@ -41,16 +41,14 @@ signature_end="# End of resolvconf" # but sed may not always be available at the time. remove_markers() { - m1="$1" - m2="$2" - in_marker=0 + local m1="$1" m2="$2" x= line= in_marker=0 shift; shift if type sed >/dev/null 2>&1; then sed "/^$m1/,/^$m2/d" $@ else - for x do - while read line; do + for x; do + while read -r line; do case "$line" in "$m1"*) in_marker=1;; "$m2"*) in_marker=0;; Modified: vendor/openresolv/dist/resolvconf.conf ============================================================================== --- vendor/openresolv/dist/resolvconf.conf Wed Nov 20 22:13:14 2019 (r354917) +++ vendor/openresolv/dist/resolvconf.conf Wed Nov 20 22:20:11 2019 (r354918) @@ -4,4 +4,4 @@ resolv_conf=/etc/resolv.conf # If you run a local name server, you should uncomment the below line and # configure your subscribers configuration files below. -#name_servers=127.0.0.1 +#name_servers=127.0.0.1 \ No newline at end of file Modified: vendor/openresolv/dist/resolvconf.conf.5.in ============================================================================== --- vendor/openresolv/dist/resolvconf.conf.5.in Wed Nov 20 22:13:14 2019 (r354917) +++ vendor/openresolv/dist/resolvconf.conf.5.in Wed Nov 20 22:20:11 2019 (r354918) @@ -22,7 +22,7 @@ .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" -.Dd September 8, 2019 +.Dd December 29, 2016 .Dt RESOLVCONF.CONF 5 .Os .Sh NAME @@ -64,25 +64,19 @@ Defaults to YES. .It Sy interface_order These interfaces will always be processed first. If unset, defaults to the following:- -.Bd -compact -literal -offset indent -lo lo[0-9]* -.Ed +.D1 lo lo[0-9]* .It Sy dynamic_order These interfaces will be processed next, unless they have a metric. If unset, defaults to the following:- -.Bd -compact -literal -offset indent -tap[0-9]* tun[0-9]* vpn vpn[0-9]* ppp[0-9]* ippp[0-9]* -.Ed +.D1 tap[0-9]* tun[0-9]* vpn vpn[0-9]* ppp[0-9]* ippp[0-9]* .It Sy inclusive_interfaces -Ignore any exclusive marking for these interfaces. +Ignore any exlcusive marking for these interfaces. This is handy when 3rd party integrations force the .Nm resolvconf -x option and you want to disable it easily. .It Sy local_nameservers If unset, defaults to the following:- -.Bd -compact -literal -offset indent -127.* 0.0.0.0 255.255.255.255 ::1 -.Ed +.D1 127.* 0.0.0.0 255.255.255.255 ::1 .It Sy search_domains Prepend search domains to the dynamically generated list. .It Sy search_domains_append @@ -124,24 +118,16 @@ The syntax is this: .Va $keyword Ns / Ns Va $match Ns / Ns Va $replacement .Pp Example, given this resolv.conf: -.Bd -compact -literal -offset indent -domain foo.org -search foo.org dead.beef -nameserver 1.2.3.4 -nameserver 2.3.4.5 -.Ed +.D1 domain foo.org +.D1 search foo.org dead.beef +.D1 nameserver 1.2.3.4 +.D1 nameserver 2.3.4.5 and this configuaration: -.Bd -compact -literal -offset indent -replace="search/foo*/bar.com" -replace="$replace nameserver/1.2.3.4/5.6.7.8" -replace="$replace nameserver/2.3.4.5/" -.Ed +.D1 replace="search/foo*/bar.com nameserver/1.2.3.4/5.6.7.8 nameserver/2.3.4.5/" you would get this resolv.conf instead: -.Bd -compact -literal -offset indent -domain foo.org -search bar.com -nameserver 5.6.7.8 -.Ed +.D1 domain foo.org +.D1 search bar.com +.D1 nameserver 5.6.7.8 .It Sy replace_sub Works the same way as .Sy replace @@ -152,11 +138,9 @@ Using the same example resolv.conf and changing to .Sy replace_sub , you would get this resolv.conf instead: -.Bd -compact -literal -offset indent -domain foo.org -search bar.com dead.beef -nameserver 5.6.7.8 -.Ed +.D1 domain foo.org +.D1 search bar.com dead.beef +.D1 nameserver 5.6.7.8 .It Sy state_dir Override the default state directory of .Pa @VARDIR@ . @@ -211,8 +195,7 @@ Prepend search domains to the dynamically generated li openresolv ships with subscribers for the name servers .Xr dnsmasq 8 , .Xr named 8 , -.Xr pdnsd 8 , -.Xr pdns_recursor 8 , +.Xr pdnsd 8 and .Xr unbound 8 . Each subscriber can create configuration files which should be included in @@ -220,9 +203,7 @@ in the subscribers main configuration file. .Pp To disable a subscriber, simply set it's name to NO. For example, to disable the libc subscriber you would set: -.Bd -compact -literal -offset indent -libc=NO -.Ed +.D1 libc=NO .Bl -tag -width indent .It Sy dnsmasq_conf This file tells dnsmasq which name servers to use for specific domains. @@ -230,21 +211,17 @@ This file tells dnsmasq which name servers to use for This file tells dnsmasq which name servers to use for global lookups. .Pp Example resolvconf.conf for dnsmasq: -.Bd -compact -literal -offset indent -name_servers=127.0.0.1 -dnsmasq_conf=/etc/dnsmasq-conf.conf -dnsmasq_resolv=/etc/dnsmasq-resolv.conf -.Ed +.D1 name_servers=127.0.0.1 +.D1 dnsmasq_conf=/etc/dnsmasq-conf.conf +.D1 dnsmasq_resolv=/etc/dnsmasq-resolv.conf .Pp Example dnsmasq.conf: -.Bd -compact -literal -offset indent -listen-address=127.0.0.1 -# If dnsmasq is compiled for DBus then we can take -# advantage of not having to restart dnsmasq. -enable-dbus -conf-file=/etc/dnsmasq-conf.conf -resolv-file=/etc/dnsmasq-resolv.conf -.Ed +.D1 listen-address=127.0.0.1 +.D1 # If dnsmasq is compiled for DBus then we can take +.D1 # advantage of not having to restart dnsmasq. +.D1 enable-dbus +.D1 conf-file=/etc/dnsmasq-conf.conf +.D1 resolv-file=/etc/dnsmasq-resolv.conf .It Sy named_options Include this file in the named options block. This file tells named which name servers to use for global lookups. @@ -253,21 +230,16 @@ Include this file in the named global scope, after the This file tells named which name servers to use for specific domains. .Pp Example resolvconf.conf for named: -.Bd -compact -literal -offset indent -name_servers=127.0.0.1 -named_options=/etc/named-options.conf -named_zones=/etc/named-zones.conf -.Ed +.D1 name_servers=127.0.0.1 +.D1 named_options=/etc/named-options.conf +.D1 named_zones=/etc/named-zones.conf .Pp Example named.conf: -.Bd -compact -literal -offset indent -options { - listen-on { 127.0.0.1; }; - include "/etc/named-options.conf"; -}; - -include "/etc/named-zones.conf"; -.Ed +.D1 options { +.D1 listen-on { 127.0.0.1; }; +.D1 include "/etc/named-options.conf"; +.D1 }; +.D1 include "/etc/named-zones.conf"; .It Sy pdnsd_conf This is the main pdnsd configuration file which we modify to add our forward domains to. @@ -281,54 +253,32 @@ If this variable is not set then it's written to .Pa pdnsd_conf . .Pp Example resolvconf.conf for pdnsd: -.Bd -compact -literal -offset indent -name_servers=127.0.0.1 -pdnsd_conf=/etc/pdnsd.conf -# pdnsd_resolv=/etc/pdnsd-resolv.conf -.Ed +.D1 name_servers=127.0.0.1 +.D1 pdnsd_conf=/etc/pdnsd.conf +.D1 # pdnsd_resolv=/etc/pdnsd-resolv.conf .Pp Example pdnsd.conf: -.Bd -compact -literal -offset indent -global { - server_ip = 127.0.0.1; - status_ctl = on; -} -server { - # A server definition is required, even if empty. - label="empty"; - proxy_only=on; - # file="/etc/pdnsd-resolv.conf"; -} -.Ed -.It Sy pdns_zones -This file tells pdns_recursor about specific and global name servers. -.Pp -Example resolvconf.conf for pdns_recursor: -.Bd -compact -literal -offset indent -name_servers=127.0.0.1 -pdns_zones=/etc/pdns/recursor-zones.conf -.Ed -.Pp -Example recursor.conf: -.Bd -compact -literal -offset indent -allow-from=127.0.0.0/8, ::1/128 -forward-zones-file=/etc/pdns/recursor-zones.conf -.Ed +.D1 global { +.D1 server_ip = 127.0.0.1; +.D1 status_ctl = on; +.D1 } +.D1 server { +.D1 # A server definition is required, even if emtpy. +.D1 label="empty"; +.D1 proxy_only=on; +.D1 # file="/etc/pdnsd-resolv.conf"; +.D1 } .It Sy unbound_conf This file tells unbound about specific and global name servers. .It Sy unbound_insecure When set to YES, unbound marks the domains as insecure, thus ignoring DNSSEC. .Pp Example resolvconf.conf for unbound: -.Bd -compact -literal -offset indent -name_servers=127.0.0.1 -unbound_conf=/etc/unbound-resolvconf.conf -.Ed +.D1 name_servers=127.0.0.1 +.D1 unbound_conf=/etc/unbound-resolvconf.conf .Pp Example unbound.conf: -.Bd -compact -literal -offset indent -include: /etc/unbound-resolvconf.conf -.Ed +.D1 include: /etc/unbound-resolvconf.conf .El .Sh SUBSCRIBER INTEGRATION Not all distributions store the files the subscribers need in the same @@ -342,6 +292,7 @@ Also, users could equally want to use a different vers installed by default, such as bind8 and bind9. To accommodate this, the subscribers have these files in configurable variables, documented below. +.Pp .Bl -tag -width indent .It Sy dnsmasq_service Name of the dnsmasq service. @@ -359,10 +310,6 @@ Name of the named service. Command to restart the named service. .It Sy pdnsd_restart Command to restart the pdnsd service. -.It Sy pdns_service -Command to restart the pdns_recursor service. -.It Sy pdns_restart -Command to restart the pdns_recursor service. .It Sy unbound_service Name of the unbound service. .It Sy unbound_restart Modified: vendor/openresolv/dist/resolvconf.in ============================================================================== --- vendor/openresolv/dist/resolvconf.in Wed Nov 20 22:13:14 2019 (r354917) +++ vendor/openresolv/dist/resolvconf.in Wed Nov 20 22:20:11 2019 (r354918) @@ -1,5 +1,5 @@ #!/bin/sh -# Copyright (c) 2007-2019 Roy Marples +# Copyright (c) 2007-2016 Roy Marples # All rights reserved # Redistribution and use in source and binary forms, with or without @@ -25,7 +25,7 @@ # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. RESOLVCONF="$0" -OPENRESOLV_VERSION="3.9.2" +OPENRESOLV_VERSION="3.9.0" SYSCONFDIR=@SYSCONFDIR@ LIBEXECDIR=@LIBEXECDIR@ VARDIR=@VARDIR@ @@ -125,22 +125,21 @@ usage() # If you think otherwise, capture a DNS trace and you'll see libc # will strip it regardless. # This also solves setting up duplicate zones in our subscribers. -# Also strip any comments denoted by #. -resolv_strip() +strip_trailing_dots() { - space= - for word; do - case "$word" in - \#*) break;; - esac - printf "%s%s" "$space${word%.}" - space=" " + local n= d= + + for n; do + printf "$d%s" "${n%.}" + d=" " done printf "\n" } private_iface() { + local p + # Allow expansion cd "$IFACEDIR" @@ -169,15 +168,12 @@ private_iface() # for domain name servers, search name servers and global nameservers parse_resolv() { - domain= - new=true + local line= ns= ds= search= d= n= newns= + local new=true iface= private=false p= domain= l= islocal= + newns= - ns= - private=false - search= while read -r line; do - stripped_line="$(resolv_strip ${line#* })" case "$line" in "# resolv.conf from "*) if ${new}; then @@ -193,32 +189,29 @@ parse_resolv() "nameserver "*) islocal=false for l in $local_nameservers; do - case "$stripped_line" in + case "${line#* }" in $l) islocal=true + echo "LOCALNAMESERVERS=\"\$LOCALNAMESERVERS ${line#* }\"" break ;; esac done - if $islocal; then - echo "LOCALNAMESERVERS=\"\$LOCALNAMESERVERS $stripped_line\"" - else - ns="$ns$stripped_line " - fi + $islocal || ns="$ns${line#* } " ;; "domain "*) - search="$stripped_line" + search="$(strip_trailing_dots ${line#* })" if [ -z "$domain" ]; then domain="$search" echo "DOMAIN=\"$domain\"" fi ;; "search "*) - search="$stripped_line" + search="$(strip_trailing_dots ${line#* })" ;; *) [ -n "$line" ] && continue - if [ -n "$ns" ] && [ -n "$search" ]; then + if [ -n "$ns" -a -n "$search" ]; then newns= for n in $ns; do newns="$newns${newns:+,}$n" @@ -243,7 +236,7 @@ parse_resolv() uniqify() { - result= + local result= while [ -n "$1" ]; do case " $result " in *" $1 "*);; @@ -256,8 +249,8 @@ uniqify() dirname() { - OIFS="$IFS" - IFS=/ + local dir= OIFS="$IFS" + local IFS=/ set -- $@ IFS="$OIFS" if [ -n "$1" ]; then @@ -274,7 +267,7 @@ dirname() config_mkdirs() { - e=0 + local e=0 f d for f; do [ -n "$f" ] || continue d="$(dirname "$f")" @@ -302,86 +295,66 @@ detect_init() # Detect the running init system. # As systemd and OpenRC can be installed on top of legacy init # systems we try to detect them first. - status="@STATUSARG@" + local status="@STATUSARG@" : ${status:=status} - if [ -x /bin/systemctl ] && [ -S /run/systemd/private ]; then - RESTARTCMD=' - if /bin/systemctl --quiet is-active $1.service - then - /bin/systemctl restart $1.service - fi' - elif [ -x /usr/bin/systemctl ] && [ -S /run/systemd/private ]; then - RESTARTCMD=' - if /usr/bin/systemctl --quiet is-active $1.service - then - /usr/bin/systemctl restart $1.service - fi' - elif [ -x /sbin/rc-service ] && - { [ -s /libexec/rc/init.d/softlevel ] || - [ -s /run/openrc/softlevel ]; } + if [ -x /bin/systemctl -a -S /run/systemd/private ]; then + RESTARTCMD="if /bin/systemctl --quiet is-active \$1.service; then + /bin/systemctl restart \$1.service; +fi" + elif [ -x /usr/bin/systemctl -a -S /run/systemd/private ]; then + RESTARTCMD="if /usr/bin/systemctl --quiet is-active \$1.service; then + /usr/bin/systemctl restart \$1.service; +fi" + elif [ -x /sbin/rc-service -a \ + -s /libexec/rc/init.d/softlevel -o -s /run/openrc/softlevel ] then - RESTARTCMD='/sbin/rc-service -i $1 -- -Ds restart' + RESTARTCMD="/sbin/rc-service -i \$1 -- -Ds restart" elif [ -x /usr/sbin/invoke-rc.d ]; then RCDIR=/etc/init.d - RESTARTCMD=' - if /usr/sbin/invoke-rc.d --quiet $1 status >/dev/null 2>&1 - then - /usr/sbin/invoke-rc.d $1 restart - fi' + RESTARTCMD="if /usr/sbin/invoke-rc.d --quiet \$1 status 1>/dev/null 2>&1; then + /usr/sbin/invoke-rc.d \$1 restart; +fi" elif [ -x /sbin/service ]; then # Old RedHat RCDIR=/etc/init.d - RESTARTCMD=' - if /sbin/service $1; then - /sbin/service $1 restart - fi' + RESTARTCMD="if /sbin/service \$1; then + /sbin/service \$1 restart; +fi" elif [ -x /usr/sbin/service ]; then # Could be FreeBSD - RESTARTCMD=" - if /usr/sbin/service \$1 $status >/dev/null 2>&1 - then - /usr/sbin/service \$1 restart - fi" + RESTARTCMD="if /usr/sbin/service \$1 $status 1>/dev/null 2>&1; then + /usr/sbin/service \$1 restart; +fi" elif [ -x /bin/sv ]; then - RESTARTCMD='/bin/sv status $1 >/dev/null 2>&1 && - /bin/sv try-restart $1' + RESTARTCMD="/bin/sv status \$1 >/dev/null 2>&1 && /bin/sv try-restart \$1" elif [ -x /usr/bin/sv ]; then - RESTARTCMD='/usr/bin/sv status $1 >/dev/null 2>&1 && - /usr/bin/sv try-restart $1' - elif [ -e /etc/arch-release ] && [ -d /etc/rc.d ]; then + RESTARTCMD="/usr/bin/sv status \$1 >/dev/null 2>&1 && /usr/bin/sv try-restart \$1" + elif [ -e /etc/arch-release -a -d /etc/rc.d ]; then RCDIR=/etc/rc.d - RESTARTCMD=' - if [ -e /var/run/daemons/$1 ] - then - /etc/rc.d/$1 restart - fi' - elif [ -e /etc/slackware-version ] && [ -d /etc/rc.d ]; then - RESTARTCMD=' - if /etc/rc.d/rc.$1 status >/dev/null 2>&1 - then - /etc/rc.d/rc.$1 restart - fi' - elif [ -e /etc/rc.d/rc.subr ] && [ -d /etc/rc.d ]; then + RESTARTCMD="if [ -e /var/run/daemons/\$1 ]; then + /etc/rc.d/\$1 restart; +fi" + elif [ -e /etc/slackware-version -a -d /etc/rc.d ]; then + RESTARTCMD="if /etc/rc.d/rc.\$1 status 1>/dev/null 2>&1; then + /etc/rc.d/rc.\$1 restart; +fi" + elif [ -e /etc/rc.d/rc.subr -a -d /etc/rc.d ]; then # OpenBSD - RESTARTCMD=' - if /etc/rc.d/$1 check >/dev/null 2>&1 - then - /etc/rc.d/$1 restart - fi' + RESTARTCMD="if /etc/rc.d/\$1 check 1>/dev/null 2>&1; then + /etc/rc.d/\$1 restart; +fi" else for x in /etc/init.d/rc.d /etc/rc.d /etc/init.d; do [ -d $x ] || continue - RESTARTCMD=" - if $x/\$1 $status >/dev/null 2>&1 - then - $x/\$1 restart - fi" + RESTARTCMD="if $x/\$1 $status 1>/dev/null 2>&1; then + $x/\$1 restart; +fi" break done fi if [ -z "$RESTARTCMD" ]; then - if [ "$_NOINIT_WARNED" != true ]; then + if [ "$NOINIT_WARNED" != true ]; then warn "could not detect a useable init system" _NOINIT_WARNED=true fi @@ -393,9 +366,9 @@ detect_init() echo_resolv() { - OIFS="$IFS" + local line= OIFS="$IFS" - [ -n "$1" ] && [ -f "$IFACEDIR/$1" ] || return 1 + [ -n "$1" -a -f "$IFACEDIR/$1" ] || return 1 echo "# resolv.conf from $1" # Our variable maker works of the fact each resolv.conf per interface # is separated by blank lines. @@ -415,16 +388,11 @@ list_resolv() { [ -d "$IFACEDIR" ] || return 0 - cmd="$1" + local report=false list= retval=0 cmd="$1" excl= shift - excl=false - list= - report=false - retval=0 case "$IF_EXCLUSIVE" in *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-all@freebsd.org Wed Nov 20 22:23:53 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 3E9AB1C3535; Wed, 20 Nov 2019 22:23:53 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47JHKP1fFNz4R7S; Wed, 20 Nov 2019 22:23:53 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 1BAEC17F3; Wed, 20 Nov 2019 22:23:53 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xAKMNqbF091518; Wed, 20 Nov 2019 22:23:52 GMT (envelope-from pfg@FreeBSD.org) Received: (from pfg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xAKMNo3Y091505; Wed, 20 Nov 2019 22:23:50 GMT (envelope-from pfg@FreeBSD.org) Message-Id: <201911202223.xAKMNo3Y091505@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: pfg set sender to pfg@FreeBSD.org using -f From: "Pedro F. Giffuni" Date: Wed, 20 Nov 2019 22:23:50 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-vendor@freebsd.org Subject: svn commit: r354919 - vendor/openresolv/dist X-SVN-Group: vendor X-SVN-Commit-Author: pfg X-SVN-Commit-Paths: vendor/openresolv/dist X-SVN-Commit-Revision: 354919 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 20 Nov 2019 22:23:53 -0000 Author: pfg Date: Wed Nov 20 22:23:50 2019 New Revision: 354919 URL: https://svnweb.freebsd.org/changeset/base/354919 Log: Import openresolv 3.9.2 More information at: https://roy.marples.name/projects/openresolv Added: vendor/openresolv/dist/LICENSE - copied unchanged from r354917, vendor/openresolv/dist/LICENSE vendor/openresolv/dist/README.md - copied unchanged from r354917, vendor/openresolv/dist/README.md Deleted: vendor/openresolv/dist/README Modified: vendor/openresolv/dist/Makefile vendor/openresolv/dist/configure vendor/openresolv/dist/dnsmasq.in vendor/openresolv/dist/libc.in vendor/openresolv/dist/named.in vendor/openresolv/dist/pdns_recursor.in vendor/openresolv/dist/pdnsd.in vendor/openresolv/dist/resolvconf.conf vendor/openresolv/dist/resolvconf.conf.5.in vendor/openresolv/dist/resolvconf.in vendor/openresolv/dist/unbound.in Copied: vendor/openresolv/dist/LICENSE (from r354917, vendor/openresolv/dist/LICENSE) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ vendor/openresolv/dist/LICENSE Wed Nov 20 22:23:50 2019 (r354919, copy of r354917, vendor/openresolv/dist/LICENSE) @@ -0,0 +1,23 @@ +Copyright (c) 2007-2019 Roy Marples +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions +are met: +1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. +2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + +THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND +ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE +FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +SUCH DAMAGE. Modified: vendor/openresolv/dist/Makefile ============================================================================== --- vendor/openresolv/dist/Makefile Wed Nov 20 22:20:11 2019 (r354918) +++ vendor/openresolv/dist/Makefile Wed Nov 20 22:23:50 2019 (r354919) @@ -10,6 +10,7 @@ SYSCONFDIR?= /etc LIBEXECDIR?= /libexec/resolvconf VARDIR?= /var/run/resolvconf +ECHO?= echo INSTALL?= install SED?= sed @@ -20,7 +21,7 @@ DOCMODE?= 0644 MANMODE?= 0444 RESOLVCONF= resolvconf resolvconf.8 resolvconf.conf.5 -SUBSCRIBERS= libc dnsmasq named pdnsd unbound +SUBSCRIBERS= libc dnsmasq named pdnsd pdns_recursor unbound TARGET= ${RESOLVCONF} ${SUBSCRIBERS} SRCS= ${TARGET:C,$,.in,} # pmake SRCS:= ${TARGET:=.in} # gmake @@ -42,7 +43,7 @@ DISTINFOSIGN= ${DISTINFO}.asc CKSUM?= cksum -a SHA256 PGP?= netpgp -FOSSILID?= current +GITREF?= HEAD .SUFFIXES: .in @@ -79,15 +80,17 @@ maninstall: install: proginstall maninstall -import: +dist-git: + git archive --prefix=${DISTPREFIX}/ ${GITREF} | xz >${DISTFILE} + +dist-inst: + mkdir /tmp/${DISTPREFIX} + cp -RPp * /tmp/${DISTPREFIX} + (cd /tmp/${DISTPREFIX}; make clean) + tar -cvjpf ${DISTFILE} -C /tmp ${DISTPREFIX} rm -rf /tmp/${DISTPREFIX} - ${INSTALL} -d /tmp/${DISTPREFIX} - cp README ${SRCS} /tmp/${DISTPREFIX} -dist: - fossil tarball --name ${DISTPREFIX} ${FOSSILID} ${DISTFILEGZ} - gunzip -c ${DISTFILEGZ} | xz >${DISTFILE} - rm ${DISTFILEGZ} +dist: dist-git distinfo: dist rm -f ${DISTINFO} ${DISTINFOSIGN} @@ -96,3 +99,20 @@ distinfo: dist ${PGP} --clearsign --output=${DISTINFOSIGN} ${DISTINFO} chmod 644 ${DISTINFOSIGN} ls -l ${DISTFILE} ${DISTINFO} ${DISTINFOSIGN} + +import: dist + rm -rf /tmp/${DISTPREFIX} + ${INSTALL} -d /tmp/${DISTPREFIX} + tar xvJpf ${DISTFILE} -C /tmp + +_import-src: + rm -rf ${DESTDIR}/* + ${INSTALL} -d ${DESTDIR} + cp LICENSE README.md ${SRCS} resolvconf.conf ${DESTDIR}; + cp resolvconf.8.in resolvconf.conf.5.in ${DESTDIR}; + @${ECHO} + @${ECHO} "=============================================================" + @${ECHO} "openresolv-${VERSION} imported to ${DESTDIR}" + +import-src: + ${MAKE} _import-src DESTDIR=`if [ -n "${DESTDIR}" ]; then echo "${DESTDIR}"; else echo /tmp/${DISTPREFIX}; fi` Copied: vendor/openresolv/dist/README.md (from r354917, vendor/openresolv/dist/README.md) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ vendor/openresolv/dist/README.md Wed Nov 20 22:23:50 2019 (r354919, copy of r354917, vendor/openresolv/dist/README.md) @@ -0,0 +1,64 @@ +# openresolv + +openresolv is a [resolvconf](https://en.wikipedia.org/wiki/Resolvconf) +implementation which manages `/etc/resolv.conf`. + +`/etc/resolv.conf` is a file that holds the configuration for the local +resolution of domain names. +Normally this file is either static or maintained by a local daemon, +normally a DHCP daemon. But what happens if more than one thing wants to +control the file? +Say you have wired and wireless interfaces to different subnets and run a VPN +or two on top of that, how do you say which one controls the file? +It's also not as easy as just adding and removing the nameservers each client +knows about as different clients could add the same nameservers. + +Enter resolvconf, the middleman between the network configuration services and +`/etc/resolv.conf`. +resolvconf itself is just a script that stores, removes and lists a full +`resolv.conf` generated for the interface. It then calls all the helper scripts +it knows about so it can configure the real `/etc/resolv.conf` and optionally +any local nameservers other than libc. + +## Reasons for using openresolv + +Why openresolv over the +[Debian implementation](http://qref.sourceforge.net/Debian/reference/ch-gateway.en.html#s-dns-resolvconf)? +Here's some reasons: + * Works with + [POSIX shell and userland](http://www.opengroup.org/onlinepubs/009695399) + * Does not need awk, grep or sed which means we can work without `/usr` + mounted + * Works with other init systems than Debians' out of the box + * Available as a 2 clause + [BSD license](http://www.freebsd.org/copyright/freebsd-license.html) + * Prefer configs via IF_METRIC for dynamic ordering + * Configures zones for local resolvers other than libc + +The last point is quite important, especially when running VPN systems. +Take the following resolv.conf files which have been generated by a +[DHCP client](../dhcpcd) and sent to resolvconf: + +``` +# resolv.conf from bge0 +search foo.com +nameserver 1.2.3.4 + +# resolv.conf from tap0 +domain bar.org +nameserver 5.6.7.8 +``` + +In this instance, queries for foo.com will go to 1.2.3.4 and queries for +bar.org will go to 5.6.7.8. +This does require the resolvers to be configured to pickup the resolvconf +generated configuration for them though. +openresolv ships with helpers for: + * [unbound](http://www.unbound.net/) + * [dnsmasq](http://www.thekelleys.org.uk/dnsmasq/doc.html) + * [ISC BIND](http://www.isc.org/software/bind) + * [PowerDNS Recursor](http://wiki.powerdns.com/trac) + +See the +[configuration section](https://roy.marples.name/projects/openresolv/config) +for more details. Modified: vendor/openresolv/dist/configure ============================================================================== --- vendor/openresolv/dist/configure Wed Nov 20 22:20:11 2019 (r354918) +++ vendor/openresolv/dist/configure Wed Nov 20 22:23:50 2019 (r354919) @@ -44,42 +44,8 @@ for x do esac done -if [ -z "$LIBEXECDIR" ]; then - printf "Checking for directory /libexec ... " - if [ -d /libexec ]; then - echo "yes" - LIBEXECDIR=$PREFIX/libexec/resolvconf - else - echo "no" - LIBEXECDIR=$PREFIX/lib/resolvconf - fi -fi -if [ -z "$RUNDIR" ]; then - printf "Checking for directory /run ... " - if [ -d /run ]; then - echo "yes" - RUNDIR=/run - else - echo "no" - RUNDIR=/var/run - fi -fi - : ${SED:=sed} -: ${SYSCONFDIR:=$PREFIX/etc} -: ${SBINDIR:=$PREFIX/sbin} -: ${LIBEXECDIR:=$PREFIX/libexec/resolvconf} -: ${STATEDIR:=/var} -: ${RUNDIR:=$STATEDIR/run} -: ${MANDIR:=${PREFIX:-/usr}/share/man} - -eval SYSCONFDIR="$SYSCONFDIR" -eval SBINDIR="$SBINDIR" -eval LIBEXECDIR="$LIBEXECDIR" -eval VARDIR="$RUNDIR/resolvconf" -eval MANDIR="$MANDIR" - CONFIG_MK=config.mk if [ -z "$BUILD" ]; then @@ -121,7 +87,19 @@ rm -rf $CONFIG_MK echo "# $OS" >$CONFIG_MK case "$OS" in -freebsd*) +dragonfly*) + # This means /usr HAS to be mounted not via dhcpcd + : ${LIBEXECDIR:=${PREFIX:-/usr}/libexec/resolvconf} + ;; +linux*) + # cksum does't support -a and netpgp is rare + echo "CKSUM= sha256sum --tag" >>$CONFIG_MK + echo "PGP= gpg2" >>$CONFIG_MK + ;; +esac + +case "$OS" in +dragonfly*|freebsd*) # On FreeBSD, /etc/init.d/foo status returns 0 if foo is not enabled # regardless of if it's not running. # So we force onestatus to work around this silly bug. @@ -129,12 +107,42 @@ freebsd*) STATUSARG="onestatus" fi ;; -linux*) - # cksum does't support -a and netpgp is rare - echo "CKSUM= sha256sum --tag" >>$CONFIG_MK - echo "PGP= gpg2" >>$CONFIG_MK - ;; esac + + +if [ -z "$LIBEXECDIR" ]; then + printf "Checking for directory /libexec ... " + if [ -d /libexec ]; then + echo "yes" + LIBEXECDIR=$PREFIX/libexec/resolvconf + else + echo "no" + LIBEXECDIR=$PREFIX/lib/resolvconf + fi +fi +if [ -z "$RUNDIR" ]; then + printf "Checking for directory /run ... " + if [ -d /run ]; then + echo "yes" + RUNDIR=/run + else + echo "no" + RUNDIR=/var/run + fi +fi + +: ${SYSCONFDIR:=$PREFIX/etc} +: ${SBINDIR:=$PREFIX/sbin} +: ${LIBEXECDIR:=$PREFIX/libexec/resolvconf} +: ${STATEDIR:=/var} +: ${RUNDIR:=$STATEDIR/run} +: ${MANDIR:=${PREFIX:-/usr}/share/man} + +eval SYSCONFDIR="$SYSCONFDIR" +eval SBINDIR="$SBINDIR" +eval LIBEXECDIR="$LIBEXECDIR" +eval VARDIR="$RUNDIR/resolvconf" +eval MANDIR="$MANDIR" for x in SYSCONFDIR SBINDIR LIBEXECDIR VARDIR MANDIR RESTARTCMD RCDIR STATUSARG do Modified: vendor/openresolv/dist/dnsmasq.in ============================================================================== --- vendor/openresolv/dist/dnsmasq.in Wed Nov 20 22:20:11 2019 (r354918) +++ vendor/openresolv/dist/dnsmasq.in Wed Nov 20 22:23:50 2019 (r354919) @@ -1,5 +1,5 @@ #!/bin/sh -# Copyright (c) 2007-2016 Roy Marples +# Copyright (c) 2007-2019 Roy Marples # All rights reserved # dnsmasq subscriber for resolvconf @@ -28,7 +28,7 @@ [ -f "@SYSCONFDIR@"/resolvconf.conf ] || exit 0 . "@SYSCONFDIR@/resolvconf.conf" || exit 1 -[ -z "$dnsmasq_conf" -a -z "$dnsmasq_resolv" ] && exit 0 +[ -z "${dnsmasq_conf}${dnsmasq_resolv}" ] && exit 0 [ -z "$RESOLVCONF" ] && eval "$(@SBINDIR@/resolvconf -v)" NL=" " @@ -98,7 +98,7 @@ for d in $DOMAINS; do empty=false i=0 IFS=: set -- $n - while [ -n "$1" -o -n "$2" ]; do + while [ -n "$1" ] || [ -n "$2" ]; do addr="$1" shift if [ -z "$addr" ]; then @@ -184,7 +184,7 @@ if $changed; then eval $dnsmasq_restart elif [ -n "$RESTARTCMD" ]; then set -- ${dnsmasq_service} - eval $RESTARTCMD + eval "$RESTARTCMD" else @SBINDIR@/resolvconf -r ${dnsmasq_service} fi @@ -206,4 +206,6 @@ if $dbus; then dbus-send --system --dest=uk.org.thekelleys.dnsmasq \ /uk/org/thekelleys/dnsmasq uk.org.thekelleys.$method \ $dbusdest + dbus-send --system --dest=uk.org.thekelleys.dnsmasq \ + /uk/org/thekelleys/dnsmasq uk.org.thekelleys.ClearCache fi Modified: vendor/openresolv/dist/libc.in ============================================================================== --- vendor/openresolv/dist/libc.in Wed Nov 20 22:20:11 2019 (r354918) +++ vendor/openresolv/dist/libc.in Wed Nov 20 22:23:50 2019 (r354919) @@ -1,5 +1,5 @@ #!/bin/sh -# Copyright (c) 2007-2016 Roy Marples +# Copyright (c) 2007-2019 Roy Marples # All rights reserved # libc subscriber for resolvconf @@ -36,9 +36,9 @@ NL=" # sed may not be available, and this is faster on small files key_get_value() { - local key="$1" x= line= - + key="$1" shift + if [ $# -eq 0 ]; then while read -r line; do case "$line" in @@ -58,8 +58,6 @@ key_get_value() keys_remove() { - local key x line found - while read -r line; do found=false for key do @@ -79,7 +77,7 @@ local_nameservers="127.* 0.0.0.0 255.255.255.255 ::1" if [ -f "$SYSCONFDIR"/resolvconf.conf ]; then . "$SYSCONFDIR"/resolvconf.conf elif [ -d "$SYSCONFDIR"/resolvconf ]; then - SYSCONFDIR="$SYSCONFDIR/resolvconf/resolv.conf.d" + SYSCONFDIR="$SYSCONFDIR/resolvconf" base="$SYSCONFDIR/resolv.conf.d/base" if [ -f "$base" ]; then prepend_nameservers="$(key_get_value "nameserver " "$base")" @@ -98,10 +96,12 @@ fi : ${resolv_conf:=/etc/resolv.conf} : ${libc_service:=nscd} : ${list_resolv:=@SBINDIR@/resolvconf -l} -if [ "${resolv_conf_head-x}" = x -a -f "$SYSCONFDIR"/resolv.conf.head ]; then +if [ "${resolv_conf_head-x}" = x ] && [ -f "$SYSCONFDIR"/resolv.conf.head ] +then resolv_conf_head="$(cat "${SYSCONFDIR}"/resolv.conf.head)" fi -if [ "${resolv_conf_tail-x}" = x -a -f "$SYSCONFDIR"/resolv.conf.tail ]; then +if [ "${resolv_conf_tail-x}" = x ] && [ -f "$SYSCONFDIR"/resolv.conf.tail ] +then resolv_conf_tail="$(cat "$SYSCONFDIR"/resolv.conf.tail)" fi @@ -110,7 +110,7 @@ signature="# Generated by resolvconf" uniqify() { - local result= + result= while [ -n "$1" ]; do case " $result " in *" $1 "*);; @@ -126,7 +126,7 @@ case "${resolv_conf_passthrough:-NO}" in backup=false newest= for conf in "$IFACEDIR"/*; do - if [ -z "$newest" -o "$conf" -nt "$newest" ]; then + if [ -z "$newest" ] || [ "$conf" -nt "$newest" ]; then newest="$conf" fi done @@ -178,7 +178,7 @@ case "${resolv_conf_passthrough:-NO}" in fi [ -n "$domain" ] && newconf="${newconf}domain $domain$NL" - if [ -n "$newsearch" -a "$newsearch" != "$domain" ]; then + if [ -n "$newsearch" ] && [ "$newsearch" != "$domain" ]; then newconf="${newconf}search $newsearch$NL" fi for n in $newns; do @@ -232,7 +232,7 @@ if [ -n "$libc_restart" ]; then eval $libc_restart elif [ -n "$RESTARTCMD" ]; then set -- ${libc_service} - eval $RESTARTCMD + eval "$RESTARTCMD" else @SBINDIR@/resolvconf -r ${libc_service} fi Modified: vendor/openresolv/dist/named.in ============================================================================== --- vendor/openresolv/dist/named.in Wed Nov 20 22:20:11 2019 (r354918) +++ vendor/openresolv/dist/named.in Wed Nov 20 22:23:50 2019 (r354919) @@ -28,14 +28,14 @@ [ -f "@SYSCONFDIR@"/resolvconf.conf ] || exit 0 . "@SYSCONFDIR@/resolvconf.conf" || exit 1 -[ -z "$named_zones" -a -z "$named_options" ] && exit 0 +[ -z "${named_zones}${named_options}" ] && exit 0 [ -z "$RESOLVCONF" ] && eval "$(@SBINDIR@/resolvconf -v)" NL=" " # Platform specific kludges -if [ -z "$named_service" -a -z "$named_restart" -a \ - -d "$RCDIR" -a ! -x "$RCDIR"/named ] +if [ -z "${named_service}${named_restart}" ] && + [ -d "$RCDIR" ] && ! [ -x "$RCDIR"/named ] then if [ -x "$RCDIR"/bind9 ]; then # Debian and derivatives @@ -111,7 +111,7 @@ if $changed; then eval $named_restart elif [ -n "$RESTARTCMD" ]; then set -- ${named_service} - eval $RESTARTCMD + eval "$RESTARTCMD" else @SBINDIR@/resolvconf -r ${named_service} fi Modified: vendor/openresolv/dist/pdns_recursor.in ============================================================================== --- vendor/openresolv/dist/pdns_recursor.in Wed Nov 20 22:20:11 2019 (r354918) +++ vendor/openresolv/dist/pdns_recursor.in Wed Nov 20 22:23:50 2019 (r354919) @@ -1,5 +1,5 @@ #!/bin/sh -# Copyright (c) 2009-2011 Roy Marples +# Copyright (c) 2009-2019 Roy Marples # All rights reserved # PowerDNS Recursor subscriber for resolvconf @@ -33,17 +33,14 @@ NL=" " -: ${pdns_service:=pdns_recursor} +: ${pdns_service:=pdns-recursor} newzones= -# pds_recursor does not present support global forward servers, which -# does limit it's usefulness somewhat. -# If it did, the below code can be enabled, or something like it. -#for n in $NAMESERVERS; do -# newzones="$newzones${newzones:+,}$n" -#done -#[ -n "$newzones" ] && newzones=".=$newzones$NL" +for n in $NAMESERVERS; do + newzones="$newzones${newzones:+,}$n" +done +[ -n "$newzones" ] && newzones="+.=$newzones$NL" for d in $DOMAINS; do newns= @@ -71,7 +68,7 @@ then eval $pdns_restart elif [ -n "$RESTARTCMD" ]; then set -- ${pdns_service} - eval $RESTARTCMD + eval "$RESTARTCMD" else @SBINDIR@/resolvconf -r ${pdns_service} fi Modified: vendor/openresolv/dist/pdnsd.in ============================================================================== --- vendor/openresolv/dist/pdnsd.in Wed Nov 20 22:20:11 2019 (r354918) +++ vendor/openresolv/dist/pdnsd.in Wed Nov 20 22:23:50 2019 (r354919) @@ -1,5 +1,5 @@ #!/bin/sh -# Copyright (c) 2010-2013 Roy Marples +# Copyright (c) 2010-2018 Roy Marples # All rights reserved # pdnsd subscriber for resolvconf @@ -28,7 +28,7 @@ [ -f "@SYSCONFDIR@"/resolvconf.conf ] || exit 0 . "@SYSCONFDIR@/resolvconf.conf" || exit 1 -[ -z "$pdnsd_conf" -a -z "$pdnsd_resolv" ] && exit 0 +[ -z "${pdnsd_conf}${pdnsd_resolv}" ] && exit 0 [ -z "$RESOLVCONF" ] && eval "$(@SBINDIR@/resolvconf -v)" NL=" " @@ -41,14 +41,16 @@ signature_end="# End of resolvconf" # but sed may not always be available at the time. remove_markers() { - local m1="$1" m2="$2" x= line= in_marker=0 + m1="$1" + m2="$2" + in_marker=0 shift; shift if type sed >/dev/null 2>&1; then sed "/^$m1/,/^$m2/d" $@ else - for x; do - while read -r line; do + for x do + while read line; do case "$line" in "$m1"*) in_marker=1;; "$m2"*) in_marker=0;; Modified: vendor/openresolv/dist/resolvconf.conf ============================================================================== --- vendor/openresolv/dist/resolvconf.conf Wed Nov 20 22:20:11 2019 (r354918) +++ vendor/openresolv/dist/resolvconf.conf Wed Nov 20 22:23:50 2019 (r354919) @@ -4,4 +4,4 @@ resolv_conf=/etc/resolv.conf # If you run a local name server, you should uncomment the below line and # configure your subscribers configuration files below. -#name_servers=127.0.0.1 \ No newline at end of file +#name_servers=127.0.0.1 Modified: vendor/openresolv/dist/resolvconf.conf.5.in ============================================================================== --- vendor/openresolv/dist/resolvconf.conf.5.in Wed Nov 20 22:20:11 2019 (r354918) +++ vendor/openresolv/dist/resolvconf.conf.5.in Wed Nov 20 22:23:50 2019 (r354919) @@ -22,7 +22,7 @@ .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" -.Dd December 29, 2016 +.Dd September 8, 2019 .Dt RESOLVCONF.CONF 5 .Os .Sh NAME @@ -64,19 +64,25 @@ Defaults to YES. .It Sy interface_order These interfaces will always be processed first. If unset, defaults to the following:- -.D1 lo lo[0-9]* +.Bd -compact -literal -offset indent +lo lo[0-9]* +.Ed .It Sy dynamic_order These interfaces will be processed next, unless they have a metric. If unset, defaults to the following:- -.D1 tap[0-9]* tun[0-9]* vpn vpn[0-9]* ppp[0-9]* ippp[0-9]* +.Bd -compact -literal -offset indent +tap[0-9]* tun[0-9]* vpn vpn[0-9]* ppp[0-9]* ippp[0-9]* +.Ed .It Sy inclusive_interfaces -Ignore any exlcusive marking for these interfaces. +Ignore any exclusive marking for these interfaces. This is handy when 3rd party integrations force the .Nm resolvconf -x option and you want to disable it easily. .It Sy local_nameservers If unset, defaults to the following:- -.D1 127.* 0.0.0.0 255.255.255.255 ::1 +.Bd -compact -literal -offset indent +127.* 0.0.0.0 255.255.255.255 ::1 +.Ed .It Sy search_domains Prepend search domains to the dynamically generated list. .It Sy search_domains_append @@ -118,16 +124,24 @@ The syntax is this: .Va $keyword Ns / Ns Va $match Ns / Ns Va $replacement .Pp Example, given this resolv.conf: -.D1 domain foo.org -.D1 search foo.org dead.beef -.D1 nameserver 1.2.3.4 -.D1 nameserver 2.3.4.5 +.Bd -compact -literal -offset indent +domain foo.org +search foo.org dead.beef +nameserver 1.2.3.4 +nameserver 2.3.4.5 +.Ed and this configuaration: -.D1 replace="search/foo*/bar.com nameserver/1.2.3.4/5.6.7.8 nameserver/2.3.4.5/" +.Bd -compact -literal -offset indent +replace="search/foo*/bar.com" +replace="$replace nameserver/1.2.3.4/5.6.7.8" +replace="$replace nameserver/2.3.4.5/" +.Ed you would get this resolv.conf instead: -.D1 domain foo.org -.D1 search bar.com -.D1 nameserver 5.6.7.8 +.Bd -compact -literal -offset indent +domain foo.org +search bar.com +nameserver 5.6.7.8 +.Ed .It Sy replace_sub Works the same way as .Sy replace @@ -138,9 +152,11 @@ Using the same example resolv.conf and changing to .Sy replace_sub , you would get this resolv.conf instead: -.D1 domain foo.org -.D1 search bar.com dead.beef -.D1 nameserver 5.6.7.8 +.Bd -compact -literal -offset indent +domain foo.org +search bar.com dead.beef +nameserver 5.6.7.8 +.Ed .It Sy state_dir Override the default state directory of .Pa @VARDIR@ . @@ -195,7 +211,8 @@ Prepend search domains to the dynamically generated li openresolv ships with subscribers for the name servers .Xr dnsmasq 8 , .Xr named 8 , -.Xr pdnsd 8 +.Xr pdnsd 8 , +.Xr pdns_recursor 8 , and .Xr unbound 8 . Each subscriber can create configuration files which should be included in @@ -203,7 +220,9 @@ in the subscribers main configuration file. .Pp To disable a subscriber, simply set it's name to NO. For example, to disable the libc subscriber you would set: -.D1 libc=NO +.Bd -compact -literal -offset indent +libc=NO +.Ed .Bl -tag -width indent .It Sy dnsmasq_conf This file tells dnsmasq which name servers to use for specific domains. @@ -211,17 +230,21 @@ This file tells dnsmasq which name servers to use for This file tells dnsmasq which name servers to use for global lookups. .Pp Example resolvconf.conf for dnsmasq: -.D1 name_servers=127.0.0.1 -.D1 dnsmasq_conf=/etc/dnsmasq-conf.conf -.D1 dnsmasq_resolv=/etc/dnsmasq-resolv.conf +.Bd -compact -literal -offset indent +name_servers=127.0.0.1 +dnsmasq_conf=/etc/dnsmasq-conf.conf +dnsmasq_resolv=/etc/dnsmasq-resolv.conf +.Ed .Pp Example dnsmasq.conf: -.D1 listen-address=127.0.0.1 -.D1 # If dnsmasq is compiled for DBus then we can take -.D1 # advantage of not having to restart dnsmasq. -.D1 enable-dbus -.D1 conf-file=/etc/dnsmasq-conf.conf -.D1 resolv-file=/etc/dnsmasq-resolv.conf +.Bd -compact -literal -offset indent +listen-address=127.0.0.1 +# If dnsmasq is compiled for DBus then we can take +# advantage of not having to restart dnsmasq. +enable-dbus +conf-file=/etc/dnsmasq-conf.conf +resolv-file=/etc/dnsmasq-resolv.conf +.Ed .It Sy named_options Include this file in the named options block. This file tells named which name servers to use for global lookups. @@ -230,16 +253,21 @@ Include this file in the named global scope, after the This file tells named which name servers to use for specific domains. .Pp Example resolvconf.conf for named: -.D1 name_servers=127.0.0.1 -.D1 named_options=/etc/named-options.conf -.D1 named_zones=/etc/named-zones.conf +.Bd -compact -literal -offset indent +name_servers=127.0.0.1 +named_options=/etc/named-options.conf +named_zones=/etc/named-zones.conf +.Ed .Pp Example named.conf: -.D1 options { -.D1 listen-on { 127.0.0.1; }; -.D1 include "/etc/named-options.conf"; -.D1 }; -.D1 include "/etc/named-zones.conf"; +.Bd -compact -literal -offset indent +options { + listen-on { 127.0.0.1; }; + include "/etc/named-options.conf"; +}; + +include "/etc/named-zones.conf"; +.Ed .It Sy pdnsd_conf This is the main pdnsd configuration file which we modify to add our forward domains to. @@ -253,32 +281,54 @@ If this variable is not set then it's written to .Pa pdnsd_conf . .Pp Example resolvconf.conf for pdnsd: -.D1 name_servers=127.0.0.1 -.D1 pdnsd_conf=/etc/pdnsd.conf -.D1 # pdnsd_resolv=/etc/pdnsd-resolv.conf +.Bd -compact -literal -offset indent +name_servers=127.0.0.1 +pdnsd_conf=/etc/pdnsd.conf +# pdnsd_resolv=/etc/pdnsd-resolv.conf +.Ed .Pp Example pdnsd.conf: -.D1 global { -.D1 server_ip = 127.0.0.1; -.D1 status_ctl = on; -.D1 } -.D1 server { -.D1 # A server definition is required, even if emtpy. -.D1 label="empty"; -.D1 proxy_only=on; -.D1 # file="/etc/pdnsd-resolv.conf"; -.D1 } +.Bd -compact -literal -offset indent +global { + server_ip = 127.0.0.1; + status_ctl = on; +} +server { + # A server definition is required, even if empty. + label="empty"; + proxy_only=on; + # file="/etc/pdnsd-resolv.conf"; +} +.Ed +.It Sy pdns_zones +This file tells pdns_recursor about specific and global name servers. +.Pp +Example resolvconf.conf for pdns_recursor: +.Bd -compact -literal -offset indent +name_servers=127.0.0.1 +pdns_zones=/etc/pdns/recursor-zones.conf +.Ed +.Pp +Example recursor.conf: +.Bd -compact -literal -offset indent +allow-from=127.0.0.0/8, ::1/128 +forward-zones-file=/etc/pdns/recursor-zones.conf +.Ed .It Sy unbound_conf This file tells unbound about specific and global name servers. .It Sy unbound_insecure When set to YES, unbound marks the domains as insecure, thus ignoring DNSSEC. .Pp Example resolvconf.conf for unbound: -.D1 name_servers=127.0.0.1 -.D1 unbound_conf=/etc/unbound-resolvconf.conf +.Bd -compact -literal -offset indent +name_servers=127.0.0.1 +unbound_conf=/etc/unbound-resolvconf.conf +.Ed .Pp Example unbound.conf: -.D1 include: /etc/unbound-resolvconf.conf +.Bd -compact -literal -offset indent +include: /etc/unbound-resolvconf.conf +.Ed .El .Sh SUBSCRIBER INTEGRATION Not all distributions store the files the subscribers need in the same @@ -292,7 +342,6 @@ Also, users could equally want to use a different vers installed by default, such as bind8 and bind9. To accommodate this, the subscribers have these files in configurable variables, documented below. -.Pp .Bl -tag -width indent .It Sy dnsmasq_service Name of the dnsmasq service. @@ -310,6 +359,10 @@ Name of the named service. Command to restart the named service. .It Sy pdnsd_restart Command to restart the pdnsd service. +.It Sy pdns_service +Command to restart the pdns_recursor service. +.It Sy pdns_restart +Command to restart the pdns_recursor service. .It Sy unbound_service Name of the unbound service. .It Sy unbound_restart Modified: vendor/openresolv/dist/resolvconf.in ============================================================================== --- vendor/openresolv/dist/resolvconf.in Wed Nov 20 22:20:11 2019 (r354918) +++ vendor/openresolv/dist/resolvconf.in Wed Nov 20 22:23:50 2019 (r354919) @@ -1,5 +1,5 @@ #!/bin/sh -# Copyright (c) 2007-2016 Roy Marples +# Copyright (c) 2007-2019 Roy Marples # All rights reserved # Redistribution and use in source and binary forms, with or without @@ -25,7 +25,7 @@ # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. RESOLVCONF="$0" -OPENRESOLV_VERSION="3.9.0" +OPENRESOLV_VERSION="3.9.2" SYSCONFDIR=@SYSCONFDIR@ LIBEXECDIR=@LIBEXECDIR@ VARDIR=@VARDIR@ @@ -125,21 +125,22 @@ usage() # If you think otherwise, capture a DNS trace and you'll see libc # will strip it regardless. # This also solves setting up duplicate zones in our subscribers. -strip_trailing_dots() +# Also strip any comments denoted by #. +resolv_strip() { - local n= d= - - for n; do - printf "$d%s" "${n%.}" - d=" " + space= + for word; do + case "$word" in + \#*) break;; + esac + printf "%s%s" "$space${word%.}" + space=" " done printf "\n" } private_iface() { - local p - # Allow expansion cd "$IFACEDIR" @@ -168,12 +169,15 @@ private_iface() # for domain name servers, search name servers and global nameservers parse_resolv() { - local line= ns= ds= search= d= n= newns= - local new=true iface= private=false p= domain= l= islocal= - + domain= + new=true newns= + ns= + private=false + search= while read -r line; do + stripped_line="$(resolv_strip ${line#* })" case "$line" in "# resolv.conf from "*) if ${new}; then @@ -189,29 +193,32 @@ parse_resolv() "nameserver "*) islocal=false for l in $local_nameservers; do - case "${line#* }" in + case "$stripped_line" in $l) islocal=true - echo "LOCALNAMESERVERS=\"\$LOCALNAMESERVERS ${line#* }\"" break ;; esac done - $islocal || ns="$ns${line#* } " + if $islocal; then + echo "LOCALNAMESERVERS=\"\$LOCALNAMESERVERS $stripped_line\"" + else + ns="$ns$stripped_line " + fi ;; "domain "*) - search="$(strip_trailing_dots ${line#* })" + search="$stripped_line" if [ -z "$domain" ]; then domain="$search" echo "DOMAIN=\"$domain\"" fi ;; "search "*) - search="$(strip_trailing_dots ${line#* })" + search="$stripped_line" ;; *) [ -n "$line" ] && continue - if [ -n "$ns" -a -n "$search" ]; then + if [ -n "$ns" ] && [ -n "$search" ]; then newns= for n in $ns; do newns="$newns${newns:+,}$n" @@ -236,7 +243,7 @@ parse_resolv() uniqify() { - local result= + result= while [ -n "$1" ]; do case " $result " in *" $1 "*);; @@ -249,8 +256,8 @@ uniqify() dirname() { - local dir= OIFS="$IFS" - local IFS=/ + OIFS="$IFS" + IFS=/ set -- $@ IFS="$OIFS" if [ -n "$1" ]; then @@ -267,7 +274,7 @@ dirname() config_mkdirs() { - local e=0 f d + e=0 for f; do [ -n "$f" ] || continue d="$(dirname "$f")" @@ -295,66 +302,86 @@ detect_init() # Detect the running init system. # As systemd and OpenRC can be installed on top of legacy init # systems we try to detect them first. - local status="@STATUSARG@" + status="@STATUSARG@" : ${status:=status} - if [ -x /bin/systemctl -a -S /run/systemd/private ]; then - RESTARTCMD="if /bin/systemctl --quiet is-active \$1.service; then - /bin/systemctl restart \$1.service; -fi" - elif [ -x /usr/bin/systemctl -a -S /run/systemd/private ]; then - RESTARTCMD="if /usr/bin/systemctl --quiet is-active \$1.service; then - /usr/bin/systemctl restart \$1.service; -fi" - elif [ -x /sbin/rc-service -a \ - -s /libexec/rc/init.d/softlevel -o -s /run/openrc/softlevel ] + if [ -x /bin/systemctl ] && [ -S /run/systemd/private ]; then + RESTARTCMD=' + if /bin/systemctl --quiet is-active $1.service + then + /bin/systemctl restart $1.service + fi' + elif [ -x /usr/bin/systemctl ] && [ -S /run/systemd/private ]; then + RESTARTCMD=' + if /usr/bin/systemctl --quiet is-active $1.service + then + /usr/bin/systemctl restart $1.service + fi' + elif [ -x /sbin/rc-service ] && + { [ -s /libexec/rc/init.d/softlevel ] || + [ -s /run/openrc/softlevel ]; } then - RESTARTCMD="/sbin/rc-service -i \$1 -- -Ds restart" + RESTARTCMD='/sbin/rc-service -i $1 -- -Ds restart' elif [ -x /usr/sbin/invoke-rc.d ]; then RCDIR=/etc/init.d - RESTARTCMD="if /usr/sbin/invoke-rc.d --quiet \$1 status 1>/dev/null 2>&1; then - /usr/sbin/invoke-rc.d \$1 restart; -fi" + RESTARTCMD=' + if /usr/sbin/invoke-rc.d --quiet $1 status >/dev/null 2>&1 + then + /usr/sbin/invoke-rc.d $1 restart + fi' elif [ -x /sbin/service ]; then # Old RedHat RCDIR=/etc/init.d - RESTARTCMD="if /sbin/service \$1; then - /sbin/service \$1 restart; -fi" + RESTARTCMD=' + if /sbin/service $1; then + /sbin/service $1 restart + fi' elif [ -x /usr/sbin/service ]; then # Could be FreeBSD - RESTARTCMD="if /usr/sbin/service \$1 $status 1>/dev/null 2>&1; then - /usr/sbin/service \$1 restart; -fi" + RESTARTCMD=" + if /usr/sbin/service \$1 $status >/dev/null 2>&1 + then + /usr/sbin/service \$1 restart + fi" elif [ -x /bin/sv ]; then - RESTARTCMD="/bin/sv status \$1 >/dev/null 2>&1 && /bin/sv try-restart \$1" + RESTARTCMD='/bin/sv status $1 >/dev/null 2>&1 && + /bin/sv try-restart $1' elif [ -x /usr/bin/sv ]; then - RESTARTCMD="/usr/bin/sv status \$1 >/dev/null 2>&1 && /usr/bin/sv try-restart \$1" - elif [ -e /etc/arch-release -a -d /etc/rc.d ]; then *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-all@freebsd.org Wed Nov 20 22:25:51 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 345151C35C0; Wed, 20 Nov 2019 22:25:51 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47JHMg1H2kz4RG9; Wed, 20 Nov 2019 22:25:51 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 0E1CB17FD; Wed, 20 Nov 2019 22:25:51 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xAKMPpg3091663; Wed, 20 Nov 2019 22:25:51 GMT (envelope-from pfg@FreeBSD.org) Received: (from pfg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xAKMPn6u091655; Wed, 20 Nov 2019 22:25:49 GMT (envelope-from pfg@FreeBSD.org) Message-Id: <201911202225.xAKMPn6u091655@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: pfg set sender to pfg@FreeBSD.org using -f From: "Pedro F. Giffuni" Date: Wed, 20 Nov 2019 22:25:49 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-vendor@freebsd.org Subject: svn commit: r354920 - vendor/openresolv/3.9.2 X-SVN-Group: vendor X-SVN-Commit-Author: pfg X-SVN-Commit-Paths: vendor/openresolv/3.9.2 X-SVN-Commit-Revision: 354920 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 20 Nov 2019 22:25:51 -0000 Author: pfg Date: Wed Nov 20 22:25:49 2019 New Revision: 354920 URL: https://svnweb.freebsd.org/changeset/base/354920 Log: Tag openresolv 3.9.2. More information at: https://roy.marples.name/projects/openresolv Added: vendor/openresolv/3.9.2/ - copied from r354918, vendor/openresolv/dist/ vendor/openresolv/3.9.2/LICENSE - copied unchanged from r354919, vendor/openresolv/dist/LICENSE vendor/openresolv/3.9.2/README.md - copied unchanged from r354919, vendor/openresolv/dist/README.md Replaced: vendor/openresolv/3.9.2/Makefile - copied unchanged from r354919, vendor/openresolv/dist/Makefile vendor/openresolv/3.9.2/configure - copied unchanged from r354919, vendor/openresolv/dist/configure vendor/openresolv/3.9.2/dnsmasq.in - copied unchanged from r354919, vendor/openresolv/dist/dnsmasq.in vendor/openresolv/3.9.2/libc.in - copied unchanged from r354919, vendor/openresolv/dist/libc.in vendor/openresolv/3.9.2/named.in - copied unchanged from r354919, vendor/openresolv/dist/named.in vendor/openresolv/3.9.2/pdns_recursor.in - copied unchanged from r354919, vendor/openresolv/dist/pdns_recursor.in vendor/openresolv/3.9.2/pdnsd.in - copied unchanged from r354919, vendor/openresolv/dist/pdnsd.in vendor/openresolv/3.9.2/resolvconf.conf - copied unchanged from r354919, vendor/openresolv/dist/resolvconf.conf vendor/openresolv/3.9.2/resolvconf.conf.5.in - copied unchanged from r354919, vendor/openresolv/dist/resolvconf.conf.5.in vendor/openresolv/3.9.2/resolvconf.in - copied unchanged from r354919, vendor/openresolv/dist/resolvconf.in vendor/openresolv/3.9.2/unbound.in - copied unchanged from r354919, vendor/openresolv/dist/unbound.in Deleted: vendor/openresolv/3.9.2/README Copied: vendor/openresolv/3.9.2/LICENSE (from r354919, vendor/openresolv/dist/LICENSE) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ vendor/openresolv/3.9.2/LICENSE Wed Nov 20 22:25:49 2019 (r354920, copy of r354919, vendor/openresolv/dist/LICENSE) @@ -0,0 +1,23 @@ +Copyright (c) 2007-2019 Roy Marples +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions +are met: +1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. +2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + +THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND +ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE +FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +SUCH DAMAGE. Copied: vendor/openresolv/3.9.2/Makefile (from r354919, vendor/openresolv/dist/Makefile) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ vendor/openresolv/3.9.2/Makefile Wed Nov 20 22:25:49 2019 (r354920, copy of r354919, vendor/openresolv/dist/Makefile) @@ -0,0 +1,118 @@ +PKG= openresolv + +# Nasty hack so that make clean works without configure being run +_CONFIG_MK!= test -e config.mk && echo config.mk || echo config-null.mk +CONFIG_MK?= ${_CONFIG_MK} +include ${CONFIG_MK} + +SBINDIR?= /sbin +SYSCONFDIR?= /etc +LIBEXECDIR?= /libexec/resolvconf +VARDIR?= /var/run/resolvconf + +ECHO?= echo +INSTALL?= install +SED?= sed + +VERSION!= ${SED} -n 's/OPENRESOLV_VERSION="\(.*\)".*/\1/p' resolvconf.in + +BINMODE?= 0755 +DOCMODE?= 0644 +MANMODE?= 0444 + +RESOLVCONF= resolvconf resolvconf.8 resolvconf.conf.5 +SUBSCRIBERS= libc dnsmasq named pdnsd pdns_recursor unbound +TARGET= ${RESOLVCONF} ${SUBSCRIBERS} +SRCS= ${TARGET:C,$,.in,} # pmake +SRCS:= ${TARGET:=.in} # gmake + +SED_SBINDIR= -e 's:@SBINDIR@:${SBINDIR}:g' +SED_SYSCONFDIR= -e 's:@SYSCONFDIR@:${SYSCONFDIR}:g' +SED_LIBEXECDIR= -e 's:@LIBEXECDIR@:${LIBEXECDIR}:g' +SED_VARDIR= -e 's:@VARDIR@:${VARDIR}:g' +SED_RCDIR= -e 's:@RCDIR@:${RCDIR}:g' +SED_RESTARTCMD= -e 's:@RESTARTCMD@:${RESTARTCMD}:g' +SED_RCDIR= -e 's:@RCDIR@:${RCDIR}:g' +SED_STATUSARG= -e 's:@STATUSARG@:${STATUSARG}:g' + +DISTPREFIX?= ${PKG}-${VERSION} +DISTFILEGZ?= ${DISTPREFIX}.tar.gz +DISTFILE?= ${DISTPREFIX}.tar.xz +DISTINFO= ${DISTFILE}.distinfo +DISTINFOSIGN= ${DISTINFO}.asc +CKSUM?= cksum -a SHA256 +PGP?= netpgp + +GITREF?= HEAD + +.SUFFIXES: .in + +all: ${TARGET} + +.in: Makefile ${CONFIG_MK} + ${SED} ${SED_SBINDIR} ${SED_SYSCONFDIR} ${SED_LIBEXECDIR} \ + ${SED_VARDIR} \ + ${SED_RCDIR} ${SED_RESTARTCMD} ${SED_RCDIR} ${SED_STATUSARG} \ + $< > $@ + +clean: + rm -f ${TARGET} + +distclean: clean + rm -f config.mk ${DISTFILE} ${DISTINFO} ${DISTINFOSIGN} + +installdirs: + +proginstall: ${TARGET} + ${INSTALL} -d ${DESTDIR}${SBINDIR} + ${INSTALL} -m ${BINMODE} resolvconf ${DESTDIR}${SBINDIR} + ${INSTALL} -d ${DESTDIR}${SYSCONFDIR} + test -e ${DESTDIR}${SYSCONFDIR}/resolvconf.conf || \ + ${INSTALL} -m ${DOCMODE} resolvconf.conf ${DESTDIR}${SYSCONFDIR} + ${INSTALL} -d ${DESTDIR}${LIBEXECDIR} + ${INSTALL} -m ${DOCMODE} ${SUBSCRIBERS} ${DESTDIR}${LIBEXECDIR} + +maninstall: + ${INSTALL} -d ${DESTDIR}${MANDIR}/man8 + ${INSTALL} -m ${MANMODE} resolvconf.8 ${DESTDIR}${MANDIR}/man8 + ${INSTALL} -d ${DESTDIR}${MANDIR}/man5 + ${INSTALL} -m ${MANMODE} resolvconf.conf.5 ${DESTDIR}${MANDIR}/man5 + +install: proginstall maninstall + +dist-git: + git archive --prefix=${DISTPREFIX}/ ${GITREF} | xz >${DISTFILE} + +dist-inst: + mkdir /tmp/${DISTPREFIX} + cp -RPp * /tmp/${DISTPREFIX} + (cd /tmp/${DISTPREFIX}; make clean) + tar -cvjpf ${DISTFILE} -C /tmp ${DISTPREFIX} + rm -rf /tmp/${DISTPREFIX} + +dist: dist-git + +distinfo: dist + rm -f ${DISTINFO} ${DISTINFOSIGN} + ${CKSUM} ${DISTFILE} >${DISTINFO} + #printf "SIZE (${DISTFILE}) = %s\n" $$(wc -c <${DISTFILE}) >>${DISTINFO} + ${PGP} --clearsign --output=${DISTINFOSIGN} ${DISTINFO} + chmod 644 ${DISTINFOSIGN} + ls -l ${DISTFILE} ${DISTINFO} ${DISTINFOSIGN} + +import: dist + rm -rf /tmp/${DISTPREFIX} + ${INSTALL} -d /tmp/${DISTPREFIX} + tar xvJpf ${DISTFILE} -C /tmp + +_import-src: + rm -rf ${DESTDIR}/* + ${INSTALL} -d ${DESTDIR} + cp LICENSE README.md ${SRCS} resolvconf.conf ${DESTDIR}; + cp resolvconf.8.in resolvconf.conf.5.in ${DESTDIR}; + @${ECHO} + @${ECHO} "=============================================================" + @${ECHO} "openresolv-${VERSION} imported to ${DESTDIR}" + +import-src: + ${MAKE} _import-src DESTDIR=`if [ -n "${DESTDIR}" ]; then echo "${DESTDIR}"; else echo /tmp/${DISTPREFIX}; fi` Copied: vendor/openresolv/3.9.2/README.md (from r354919, vendor/openresolv/dist/README.md) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ vendor/openresolv/3.9.2/README.md Wed Nov 20 22:25:49 2019 (r354920, copy of r354919, vendor/openresolv/dist/README.md) @@ -0,0 +1,64 @@ +# openresolv + +openresolv is a [resolvconf](https://en.wikipedia.org/wiki/Resolvconf) +implementation which manages `/etc/resolv.conf`. + +`/etc/resolv.conf` is a file that holds the configuration for the local +resolution of domain names. +Normally this file is either static or maintained by a local daemon, +normally a DHCP daemon. But what happens if more than one thing wants to +control the file? +Say you have wired and wireless interfaces to different subnets and run a VPN +or two on top of that, how do you say which one controls the file? +It's also not as easy as just adding and removing the nameservers each client +knows about as different clients could add the same nameservers. + +Enter resolvconf, the middleman between the network configuration services and +`/etc/resolv.conf`. +resolvconf itself is just a script that stores, removes and lists a full +`resolv.conf` generated for the interface. It then calls all the helper scripts +it knows about so it can configure the real `/etc/resolv.conf` and optionally +any local nameservers other than libc. + +## Reasons for using openresolv + +Why openresolv over the +[Debian implementation](http://qref.sourceforge.net/Debian/reference/ch-gateway.en.html#s-dns-resolvconf)? +Here's some reasons: + * Works with + [POSIX shell and userland](http://www.opengroup.org/onlinepubs/009695399) + * Does not need awk, grep or sed which means we can work without `/usr` + mounted + * Works with other init systems than Debians' out of the box + * Available as a 2 clause + [BSD license](http://www.freebsd.org/copyright/freebsd-license.html) + * Prefer configs via IF_METRIC for dynamic ordering + * Configures zones for local resolvers other than libc + +The last point is quite important, especially when running VPN systems. +Take the following resolv.conf files which have been generated by a +[DHCP client](../dhcpcd) and sent to resolvconf: + +``` +# resolv.conf from bge0 +search foo.com +nameserver 1.2.3.4 + +# resolv.conf from tap0 +domain bar.org +nameserver 5.6.7.8 +``` + +In this instance, queries for foo.com will go to 1.2.3.4 and queries for +bar.org will go to 5.6.7.8. +This does require the resolvers to be configured to pickup the resolvconf +generated configuration for them though. +openresolv ships with helpers for: + * [unbound](http://www.unbound.net/) + * [dnsmasq](http://www.thekelleys.org.uk/dnsmasq/doc.html) + * [ISC BIND](http://www.isc.org/software/bind) + * [PowerDNS Recursor](http://wiki.powerdns.com/trac) + +See the +[configuration section](https://roy.marples.name/projects/openresolv/config) +for more details. Copied: vendor/openresolv/3.9.2/configure (from r354919, vendor/openresolv/dist/configure) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ vendor/openresolv/3.9.2/configure Wed Nov 20 22:25:49 2019 (r354920, copy of r354919, vendor/openresolv/dist/configure) @@ -0,0 +1,167 @@ +#!/bin/sh +# Try and be like autotools configure, but without autotools + +# Ensure that we do not inherit these from env +OS= +BUILD= +HOST= +TARGET= +RESTARTCMD= +RCDIR= +STATUSARG= + +for x do + opt=${x%%=*} + var=${x#*=} + case "$opt" in + --os|OS) OS=$var;; + --with-cc|CC) CC=$var;; + --debug) DEBUG=$var;; + --disable-debug) DEBUG=no;; + --enable-debug) DEBUG=yes;; + --prefix) PREFIX=$var;; + --sysconfdir) SYSCONFDIR=$var;; + --bindir|--sbindir) SBINDIR=$var;; + --libexecdir) LIBEXECDIR=$var;; + --statedir|--localstatedir) STATEDIR=$var;; + --dbdir) DBDIR=$var;; + --rundir) RUNDIR=$var;; + --mandir) MANDIR=$var;; + --with-ccopts|CFLAGS) CFLAGS=$var;; + CPPFLAGS) CPPFLAGS=$var;; + --build) BUILD=$var;; + --host) HOST=$var;; + --target) TARGET=$var;; + --libdir) LIBDIR=$var;; + --restartcmd) RESTARTCMD=$var;; + --rcdir) RCDIR=$var;; + --statusarg) STATUSARG=$var;; + --includedir) eval INCLUDEDIR="$INCLUDEDIR${INCLUDEDIR:+ }$var";; + --datadir|--infodir) ;; # ignore autotools + --disable-maintainer-mode|--disable-dependency-tracking) ;; + --help) echo "See the README file for available options"; exit 0;; + *) echo "$0: WARNING: unknown option $opt" >&2;; + esac +done + +: ${SED:=sed} + +CONFIG_MK=config.mk + +if [ -z "$BUILD" ]; then + # autoconf target triplet: cpu-vendor-os + BUILD=$(uname -m)-unknown-$(uname -s | tr '[:upper:]' '[:lower:]') +fi +: ${HOST:=$BUILD} + +if [ -z "$OS" ]; then + echo "Deriving operating system from ... $HOST" + # Derive OS from cpu-vendor-[kernel-]os + CPU=${HOST%%-*} + REST=${HOST#*-} + if [ "$CPU" != "$REST" ]; then + VENDOR=${REST%%-*} + REST=${REST#*-} + if [ "$VENDOR" != "$REST" ]; then + # Use kernel if given, otherwise os + OS=${REST%%-*} + else + # 2 tupple + OS=$VENDOR + VENDOR= + fi + fi + + # Work with cpu-kernel-os, ie Debian + case "$VENDOR" in + linux*|kfreebsd*) OS=$VENDOR; VENDOR= ;; + esac + # Special case + case "$OS" in + gnu*) OS=hurd;; # No HURD support as yet + esac +fi + +echo "Configuring openresolv for ... $OS" +rm -rf $CONFIG_MK +echo "# $OS" >$CONFIG_MK + +case "$OS" in +dragonfly*) + # This means /usr HAS to be mounted not via dhcpcd + : ${LIBEXECDIR:=${PREFIX:-/usr}/libexec/resolvconf} + ;; +linux*) + # cksum does't support -a and netpgp is rare + echo "CKSUM= sha256sum --tag" >>$CONFIG_MK + echo "PGP= gpg2" >>$CONFIG_MK + ;; +esac + +case "$OS" in +dragonfly*|freebsd*) + # On FreeBSD, /etc/init.d/foo status returns 0 if foo is not enabled + # regardless of if it's not running. + # So we force onestatus to work around this silly bug. + if [ -z "$STATUSARG" ]; then + STATUSARG="onestatus" + fi + ;; +esac + + +if [ -z "$LIBEXECDIR" ]; then + printf "Checking for directory /libexec ... " + if [ -d /libexec ]; then + echo "yes" + LIBEXECDIR=$PREFIX/libexec/resolvconf + else + echo "no" + LIBEXECDIR=$PREFIX/lib/resolvconf + fi +fi +if [ -z "$RUNDIR" ]; then + printf "Checking for directory /run ... " + if [ -d /run ]; then + echo "yes" + RUNDIR=/run + else + echo "no" + RUNDIR=/var/run + fi +fi + +: ${SYSCONFDIR:=$PREFIX/etc} +: ${SBINDIR:=$PREFIX/sbin} +: ${LIBEXECDIR:=$PREFIX/libexec/resolvconf} +: ${STATEDIR:=/var} +: ${RUNDIR:=$STATEDIR/run} +: ${MANDIR:=${PREFIX:-/usr}/share/man} + +eval SYSCONFDIR="$SYSCONFDIR" +eval SBINDIR="$SBINDIR" +eval LIBEXECDIR="$LIBEXECDIR" +eval VARDIR="$RUNDIR/resolvconf" +eval MANDIR="$MANDIR" + +for x in SYSCONFDIR SBINDIR LIBEXECDIR VARDIR MANDIR RESTARTCMD RCDIR STATUSARG +do + eval v=\$$x + # Make files look nice for import + l=$((10 - ${#x})) + unset t + [ $l -gt 3 ] && t=" " + echo "$x=$t $v" >>$CONFIG_MK +done + +echo +echo " SYSCONFDIR = $SYSCONFDIR" +echo " SBINDIR = $SBINDIR" +echo " LIBEXECDIR = $LIBEXECDIR" +echo " VARDIR = $RUNDIR" +echo " MANDIR = $MANDIR" +echo +echo " RESTARTCMD = $RESTARTCMD" +echo " RCDIR = $RCDIR" +echo " STATUSARG = $STATUSARG" +echo Copied: vendor/openresolv/3.9.2/dnsmasq.in (from r354919, vendor/openresolv/dist/dnsmasq.in) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ vendor/openresolv/3.9.2/dnsmasq.in Wed Nov 20 22:25:49 2019 (r354920, copy of r354919, vendor/openresolv/dist/dnsmasq.in) @@ -0,0 +1,211 @@ +#!/bin/sh +# Copyright (c) 2007-2019 Roy Marples +# All rights reserved + +# dnsmasq subscriber for resolvconf + +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# * Redistributions in binary form must reproduce the above +# copyright notice, this list of conditions and the following +# disclaimer in the documentation and/or other materials provided +# with the distribution. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +[ -f "@SYSCONFDIR@"/resolvconf.conf ] || exit 0 +. "@SYSCONFDIR@/resolvconf.conf" || exit 1 +[ -z "${dnsmasq_conf}${dnsmasq_resolv}" ] && exit 0 +[ -z "$RESOLVCONF" ] && eval "$(@SBINDIR@/resolvconf -v)" +NL=" +" + +: ${dnsmasq_pid:=/var/run/dnsmasq.pid} +[ -s "$dnsmasq_pid" ] || dnsmasq_pid=/var/run/dnsmasq/dnsmasq.pid +[ -s "$dnsmasq_pid" ] || unset dnsmasq_pid +: ${dnsmasq_service:=dnsmasq} +newconf="# Generated by resolvconf$NL" +newresolv="$newconf" + +# Using dbus means that we never have to restart the daemon +# This is important as it means we should not drop DNS queries +# whilst changing DNS options around. However, dbus support is optional +# so we need to validate a few things first. +# Check for DBus support in the binary +dbus=false +dbus_ex=false +dbus_introspect=$(dbus-send --print-reply --system \ + --dest=uk.org.thekelleys.dnsmasq \ + /uk/org/thekelleys/dnsmasq \ + org.freedesktop.DBus.Introspectable.Introspect \ + 2>/dev/null) +if [ $? = 0 ]; then + dbus=true + if printf %s "$dbus_introspect" | \ + grep -q '' + then + dbus_ex=true + fi +fi + +for n in $NAMESERVERS; do + newresolv="${newresolv}nameserver $n$NL" +done + +dbusdest= +dbusdest_ex= +conf= +for d in $DOMAINS; do + dn="${d%%:*}" + ns="${d#*:}" + while [ -n "$ns" ]; do + n="${ns%%,*}" + if $dbus && ! $dbus_ex; then + case "$n" in + *.*.*.*) + SIFS=${IFS-y} OIFS=$IFS + IFS=. + set -- $n + num="0x$(printf %02x $1 $2 $3 $4)" + if [ "$SIFS" = y ]; then + unset IFS + else + IFS=$OIFS + fi + dbusdest="$dbusdest uint32:$(printf %u $num)" + dbusdest="$dbusdest string:$dn" + ;; + *:*%*) + # This version of dnsmasq won't accept + # scoped IPv6 addresses + dbus=false + ;; + *:*) + SIFS=${IFS-y} OIFS=$IFS bytes= front= back= + empty=false i=0 + IFS=: + set -- $n + while [ -n "$1" ] || [ -n "$2" ]; do + addr="$1" + shift + if [ -z "$addr" ]; then + empty=true + continue + fi + i=$(($i + 1)) + while [ ${#addr} -lt 4 ]; do + addr="0${addr}" + done + byte1="$(printf %d 0x${addr%??})" + byte2="$(printf %d 0x${addr#??})" + if $empty; then + back="$back byte:$byte1 byte:$byte2" + else + front="$front byte:$byte1 byte:$byte2" + fi + done + while [ $i != 8 ]; do + i=$(($i + 1)) + front="$front byte:0 byte:0" + done + front="${front}$back" + if [ "$SIFS" = y ]; then + unset IFS + else + IFS=$OIFS + fi + dbusdest="${dbusdest}$front string:$dn" + ;; + *) + if ! $dbus_ex; then + dbus=false + fi + ;; + esac + fi + dbusdest_ex="$dbusdest_ex${dbusdest_ex:+,}/$dn/$n" + conf="${conf}server=/$dn/$n$NL" + [ "$ns" = "${ns#*,}" ] && break + ns="${ns#*,}" + done +done + +if $dbus; then + newconf="$newconf$NL# Domain specific servers will" + newconf="$newconf be sent over dbus${NL}" +else + newconf="$newconf$conf" +fi + +# Try to ensure that config dirs exist +if type config_mkdirs >/dev/null 2>&1; then + config_mkdirs "$dnsmasq_conf" "$dnsmasq_resolv" +else + @SBINDIR@/resolvconf -D "$dnsmasq_conf" "$dnsmasq_resolv" +fi + +changed=false +if [ -n "$dnsmasq_conf" ]; then + if [ ! -f "$dnsmasq_conf" ] || \ + [ "$(cat "$dnsmasq_conf")" != "$(printf %s "$newconf")" ] + then + changed=true + printf %s "$newconf" >"$dnsmasq_conf" + fi +fi +if [ -n "$dnsmasq_resolv" ]; then + # dnsmasq polls this file so no need to set changed=true + if [ -f "$dnsmasq_resolv" ]; then + if [ "$(cat "$dnsmasq_resolv")" != "$(printf %s "$newresolv")" ] + then + printf %s "$newresolv" >"$dnsmasq_resolv" + fi + else + printf %s "$newresolv" >"$dnsmasq_resolv" + fi +fi + +if $changed; then + # dnsmasq does not re-read the configuration file on SIGHUP + if [ -n "$dnsmasq_restart" ]; then + eval $dnsmasq_restart + elif [ -n "$RESTARTCMD" ]; then + set -- ${dnsmasq_service} + eval "$RESTARTCMD" + else + @SBINDIR@/resolvconf -r ${dnsmasq_service} + fi +fi +if $dbus; then + if [ -s "$dnsmasq_pid" ]; then + $changed || kill -HUP $(cat "$dnsmasq_pid") + fi + # Send even if empty so old servers are cleared + if $dbus_ex; then + method=SetDomainServers + if [ -n "$dbusdest_ex" ]; then + dbusdest_ex="array:string:$dbusdest_ex" + fi + dbusdest="$dbusdest_ex" + else + method=SetServers + fi + dbus-send --system --dest=uk.org.thekelleys.dnsmasq \ + /uk/org/thekelleys/dnsmasq uk.org.thekelleys.$method \ + $dbusdest + dbus-send --system --dest=uk.org.thekelleys.dnsmasq \ + /uk/org/thekelleys/dnsmasq uk.org.thekelleys.ClearCache +fi Copied: vendor/openresolv/3.9.2/libc.in (from r354919, vendor/openresolv/dist/libc.in) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ vendor/openresolv/3.9.2/libc.in Wed Nov 20 22:25:49 2019 (r354920, copy of r354919, vendor/openresolv/dist/libc.in) @@ -0,0 +1,252 @@ +#!/bin/sh +# Copyright (c) 2007-2019 Roy Marples +# All rights reserved + +# libc subscriber for resolvconf + +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# * Redistributions in binary form must reproduce the above +# copyright notice, this list of conditions and the following +# disclaimer in the documentation and/or other materials provided +# with the distribution. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +SYSCONFDIR=@SYSCONFDIR@ +LIBEXECDIR=@LIBEXECDIR@ +VARDIR=@VARDIR@ +IFACEDIR="$VARDIR/interfaces" +NL=" +" + +# sed may not be available, and this is faster on small files +key_get_value() +{ + key="$1" + shift + + if [ $# -eq 0 ]; then + while read -r line; do + case "$line" in + "$key"*) echo "${line##$key}";; + esac + done + else + for x do + while read -r line; do + case "$line" in + "$key"*) echo "${line##$key}";; + esac + done < "$x" + done + fi +} + +keys_remove() +{ + while read -r line; do + found=false + for key do + case "$line" in + "$key"*|"#"*|" "*|" "*|"") found=true;; + esac + $found && break + done + $found || echo "$line" + done +} + +local_nameservers="127.* 0.0.0.0 255.255.255.255 ::1" + +# Support original resolvconf configuration layout +# as well as the openresolv config file +if [ -f "$SYSCONFDIR"/resolvconf.conf ]; then + . "$SYSCONFDIR"/resolvconf.conf +elif [ -d "$SYSCONFDIR"/resolvconf ]; then + SYSCONFDIR="$SYSCONFDIR/resolvconf" + base="$SYSCONFDIR/resolv.conf.d/base" + if [ -f "$base" ]; then + prepend_nameservers="$(key_get_value "nameserver " "$base")" + domain="$(key_get_value "domain " "$base")" + prepend_search="$(key_get_value "search " "$base")" + resolv_conf_options="$(key_get_value "options " "$base")" + resolv_conf_sortlist="$(key_get_value "sortlist " "$base")" + fi + if [ -f "$SYSCONFDIR"/resolv.conf.d/head ]; then + resolv_conf_head="$(cat "${SYSCONFDIR}"/resolv.conf.d/head)" + fi + if [ -f "$SYSCONFDIR"/resolv.conf.d/tail ]; then + resolv_conf_tail="$(cat "$SYSCONFDIR"/resolv.conf.d/tail)" + fi +fi +: ${resolv_conf:=/etc/resolv.conf} +: ${libc_service:=nscd} +: ${list_resolv:=@SBINDIR@/resolvconf -l} +if [ "${resolv_conf_head-x}" = x ] && [ -f "$SYSCONFDIR"/resolv.conf.head ] +then + resolv_conf_head="$(cat "${SYSCONFDIR}"/resolv.conf.head)" +fi +if [ "${resolv_conf_tail-x}" = x ] && [ -f "$SYSCONFDIR"/resolv.conf.tail ] +then + resolv_conf_tail="$(cat "$SYSCONFDIR"/resolv.conf.tail)" +fi + +backup=true +signature="# Generated by resolvconf" + +uniqify() +{ + result= + while [ -n "$1" ]; do + case " $result " in + *" $1 "*);; + *) result="$result $1";; + esac + shift + done + echo "${result# *}" +} + +case "${resolv_conf_passthrough:-NO}" in +[Yy][Ee][Ss]|[Tt][Rr][Uu][Ee]|[Oo][Nn]|1) + backup=false + newest= + for conf in "$IFACEDIR"/*; do + if [ -z "$newest" ] || [ "$conf" -nt "$newest" ]; then + newest="$conf" + fi + done + [ -z "$newest" ] && exit 0 + newconf="$(cat "$newest")$NL" + ;; +/dev/null|[Nn][Uu][Ll][Ll]) + : ${resolv_conf_local_only:=NO} + if [ "$local_nameservers" = "127.* 0.0.0.0 255.255.255.255 ::1" ]; then + local_nameservers= + fi + # Need to overwrite our variables. + eval "$(@SBINDIR@/resolvconf -V)" + ;; + +*) + [ -z "$RESOLVCONF" ] && eval "$(@SBINDIR@/resolvconf -v)" + ;; +esac +case "${resolv_conf_passthrough:-NO}" in +[Yy][Ee][Ss]|[Tt][Rr][Uu][Ee]|[Oo][Nn]|1) ;; +*) + : ${domain:=$DOMAIN} + newsearch="$(uniqify $prepend_search $SEARCH $append_search)" + NS="$LOCALNAMESERVERS $NAMESERVERS" + newns= + gotlocal=false + for n in $(uniqify $prepend_nameservers $NS $append_nameservers); do + add=true + islocal=false + for l in $local_nameservers; do + case "$n" in + $l) islocal=true; gotlocal=true; break;; + esac + done + if ! $islocal; then + case "${resolv_conf_local_only:-YES}" in + [Yy][Ee][Ss]|[Tt][Rr][Uu][Ee]|[Oo][Nn]|1) + $gotlocal && add=false;; + esac + fi + $add && newns="$newns $n" + done + + # Hold our new resolv.conf in a variable to save on temporary files + newconf="$signature$NL" + if [ -n "$resolv_conf_head" ]; then + newconf="$newconf$resolv_conf_head$NL" + fi + + [ -n "$domain" ] && newconf="${newconf}domain $domain$NL" + if [ -n "$newsearch" ] && [ "$newsearch" != "$domain" ]; then + newconf="${newconf}search $newsearch$NL" + fi + for n in $newns; do + newconf="${newconf}nameserver $n$NL" + done + + # Now add anything we don't care about such as sortlist and options + stuff="$($list_resolv | keys_remove nameserver domain search)" + if [ -n "$stuff" ]; then + newconf="$newconf$stuff$NL" + fi + + # Append any user defined ones + if [ -n "$resolv_conf_options" ]; then + newconf="${newconf}options $resolv_conf_options$NL" + fi + if [ -n "$resolv_conf_sortlist" ]; then + newconf="${newconf}sortlist $resolv_conf_sortlist$NL" + fi + + if [ -n "$resolv_conf_tail" ]; then + newconf="$newconf$resolv_conf_tail$NL" + fi + ;; +esac + +# Check if the file has actually changed or not +if [ -e "$resolv_conf" ]; then + [ "$(cat "$resolv_conf")" = "$(printf %s "$newconf")" ] && exit 0 +fi + +# Change is good. +# If the old file does not have our signature, back it up. +# If the new file just has our signature, restore the backup. +if $backup; then + if [ "$newconf" = "$signature$NL" ]; then + if [ -e "$resolv_conf.bak" ]; then + newconf="$(cat "$resolv_conf.bak")$NL" + fi + elif [ -e "$resolv_conf" ]; then + read line <"$resolv_conf" + if [ "$line" != "$signature" ]; then + cp "$resolv_conf" "$resolv_conf.bak" + fi + fi +fi + +# Create our resolv.conf now +(umask 022; printf %s "$newconf" >"$resolv_conf") +if [ -n "$libc_restart" ]; then + eval $libc_restart +elif [ -n "$RESTARTCMD" ]; then + set -- ${libc_service} + eval "$RESTARTCMD" +else + @SBINDIR@/resolvconf -r ${libc_service} +fi + +retval=0 +# Notify users of the resolver +for script in "$LIBEXECDIR"/libc.d/*; do + if [ -f "$script" ]; then + if [ -x "$script" ]; then + "$script" "$@" + else + (. "$script") + fi + retval=$(($retval + $?)) + fi +done +exit $retval Copied: vendor/openresolv/3.9.2/named.in (from r354919, vendor/openresolv/dist/named.in) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ vendor/openresolv/3.9.2/named.in Wed Nov 20 22:25:49 2019 (r354920, copy of r354919, vendor/openresolv/dist/named.in) @@ -0,0 +1,118 @@ +#!/bin/sh +# Copyright (c) 2007-2016 Roy Marples +# All rights reserved + +# named subscriber for resolvconf + +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# * Redistributions in binary form must reproduce the above +# copyright notice, this list of conditions and the following +# disclaimer in the documentation and/or other materials provided +# with the distribution. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +[ -f "@SYSCONFDIR@"/resolvconf.conf ] || exit 0 +. "@SYSCONFDIR@/resolvconf.conf" || exit 1 +[ -z "${named_zones}${named_options}" ] && exit 0 +[ -z "$RESOLVCONF" ] && eval "$(@SBINDIR@/resolvconf -v)" +NL=" +" + +# Platform specific kludges +if [ -z "${named_service}${named_restart}" ] && + [ -d "$RCDIR" ] && ! [ -x "$RCDIR"/named ] +then + if [ -x "$RCDIR"/bind9 ]; then + # Debian and derivatives + named_service=bind9 + elif [ -x "$RCDIR"/rc.bind ]; then + # Slackware + named_service=rc.bind + fi +fi +: ${named_service:=named} + +: ${named_pid:=/var/run/$named_service.pid} +[ -s "$named_pid" ] || named_pid=/var/run/$named_service/$named_service.pid +[ -s "$named_pid" ] || unset named_pid + +newoptions="# Generated by resolvconf$NL" +newzones="$newoptions" + +forward= +for n in $NAMESERVERS; do + case "$forward" in + *"$NL $n;"*);; + *) forward="$forward$NL $n;";; + esac +done +if [ -n "$forward" ]; then + newoptions="${newoptions}forward first;${NL}forwarders {$forward${NL}};$NL" +fi + +for d in $DOMAINS; do + newzones="${newzones}zone \"${d%%:*}\" {$NL" + newzones="$newzones type forward;$NL" + newzones="$newzones forward first;$NL forwarders {$NL" + ns="${d#*:}" + while [ -n "$ns" ]; do + newzones="$newzones ${ns%%,*};$NL" + [ "$ns" = "${ns#*,}" ] && break + ns="${ns#*,}" + done + newzones="$newzones };$NL};$NL" +done + +# Try to ensure that config dirs exist +if type config_mkdirs >/dev/null 2>&1; then + config_mkdirs "$named_options" "$named_zones" +else + @SBINDIR@/resolvconf -D "$named_options" "$named_zones" +fi + +# No point in changing files or reloading bind if the end result has not +# changed +changed=false +if [ -n "$named_options" ]; then + if [ ! -f "$named_options" ] || \ + [ "$(cat "$named_options")" != "$(printf %s "$newoptions")" ] + then + printf %s "$newoptions" >"$named_options" + changed=true + fi +fi +if [ -n "$named_zones" ]; then + if [ ! -f "$named_zones" ] || \ + [ "$(cat "$named_zones")" != "$(printf %s "$newzones")" ] + then + printf %s "$newzones" >"$named_zones" + changed=true + fi +fi + +# named does not seem to work with SIGHUP which is a same +if $changed; then + if [ -n "$named_restart" ]; then + eval $named_restart + elif [ -n "$RESTARTCMD" ]; then + set -- ${named_service} + eval "$RESTARTCMD" + else + @SBINDIR@/resolvconf -r ${named_service} + fi +fi Copied: vendor/openresolv/3.9.2/pdns_recursor.in (from r354919, vendor/openresolv/dist/pdns_recursor.in) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ vendor/openresolv/3.9.2/pdns_recursor.in Wed Nov 20 22:25:49 2019 (r354920, copy of r354919, vendor/openresolv/dist/pdns_recursor.in) @@ -0,0 +1,75 @@ +#!/bin/sh +# Copyright (c) 2009-2019 Roy Marples +# All rights reserved + +# PowerDNS Recursor subscriber for resolvconf + +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# * Redistributions in binary form must reproduce the above +# copyright notice, this list of conditions and the following +# disclaimer in the documentation and/or other materials provided +# with the distribution. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-all@freebsd.org Wed Nov 20 23:04:57 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 4ABC21C4CC8 for ; Wed, 20 Nov 2019 23:04:57 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: from mail-qt1-x831.google.com (mail-qt1-x831.google.com [IPv6:2607:f8b0:4864:20::831]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47JJDm2Rg3z4V46 for ; Wed, 20 Nov 2019 23:04:56 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: by mail-qt1-x831.google.com with SMTP id g50so1485088qtb.4 for ; Wed, 20 Nov 2019 15:04:56 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bsdimp-com.20150623.gappssmtp.com; s=20150623; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=C/VV1ml/kxFYUkSJI/j06bqIzkro3A3+asaRfEEUXKk=; b=DS2oT1qrA0Z1oY91Iiu6YDHWzQM3tIgdMLNbbUgJ1wIlogewcsio2HrEsKQ6I1L1pF Hrs3oguekXcaaRQsa3XGwT2bEGBHjb/9sdHMGmJPF/pFWltOLkmGlJtr67E+LXUzSRaq oiOilX54yA42QUaiviUGcLnaIB840GF3Wm7/l5zblkfTdlpjGFyIlIQuDCoat3BXFjC3 78235fQ2oq2n/hwcDeGiBPXjqJ/k0tWCNf479RcpW9cpTgD2rhV3uEW//lWS8ldO5b1y 3zOnzNEaf+mtn6T2sxnC+25L9nHShma7lH3VUBcXuMCPxdn2gro00YbQuL52DGFRUjlg Tl7Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=C/VV1ml/kxFYUkSJI/j06bqIzkro3A3+asaRfEEUXKk=; b=SzjtBpMo57GteLHWqWtMLOWds+L0ZFiljO8OH2yez1d0f+AdzTVcpw2Y4J//vZh3Jc n6IFd2Y9CwQsEyIGjTRMUDp6yTyW+QWE7k7k0NKN8qng5t70tS8MFC+kQUtmeMn4z/SG CqST4ElQfVeiy8Ic10MOMooNGRgr+3beS5mIssz2xCiF1I+JtwnHD5GCQHFwmdJoaXC4 Bkmniwfh3PHyqEjbyDZqIficBXHSAKgX6UUsmOcNIUSnPpAGeJd7cOlw56kFWs/qQhay yB9Ty0UOdzrxcONyXIMiKq0h0t6KxdRHHPbnTKeRcrVnR2voMG4JEdpRyCnSM3/Gfa+0 4KVg== X-Gm-Message-State: APjAAAWIDEn+jmK0CoLpypFvKmsZK8iTBFMglfDmCMNnsDoaY8WUoAKt 6EsdqCx5icJ2RBtLOGy+ReKdN97t9d1rOrCx7jJPDw== X-Google-Smtp-Source: APXvYqxHnhH2HeWogyH9gWY/x2XsKncDd6nLjWaCxmnUAwAUoDJQcX8q6vaoJW1WQW4YS9ezWCKP8NTkezvw4LT9T6o= X-Received: by 2002:ac8:754c:: with SMTP id b12mr5365284qtr.291.1574291094946; Wed, 20 Nov 2019 15:04:54 -0800 (PST) MIME-Version: 1.0 References: <201911201654.xAKGsMTv094014@repo.freebsd.org> <59bf120c-2f35-1a22-b6fa-a9c9bb8cfdf4@FreeBSD.org> In-Reply-To: <59bf120c-2f35-1a22-b6fa-a9c9bb8cfdf4@FreeBSD.org> From: Warner Losh Date: Wed, 20 Nov 2019 16:04:44 -0700 Message-ID: Subject: Re: svn commit: r354900 - head/usr.sbin/jail To: John Baldwin Cc: Li-Wen Hsu , src-committers , svn-src-all , svn-src-head X-Rspamd-Queue-Id: 47JJDm2Rg3z4V46 X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; dkim=pass header.d=bsdimp-com.20150623.gappssmtp.com header.s=20150623 header.b=DS2oT1qr; dmarc=none; spf=none (mx1.freebsd.org: domain of wlosh@bsdimp.com has no SPF policy when checking 2607:f8b0:4864:20::831) smtp.mailfrom=wlosh@bsdimp.com X-Spamd-Result: default: False [-4.72 / 15.00]; ARC_NA(0.00)[]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; R_DKIM_ALLOW(-0.20)[bsdimp-com.20150623.gappssmtp.com:s=20150623]; FROM_HAS_DN(0.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; MIME_GOOD(-0.10)[multipart/alternative,text/plain]; PREVIOUSLY_DELIVERED(0.00)[svn-src-all@freebsd.org]; DMARC_NA(0.00)[bsdimp.com]; RCPT_COUNT_FIVE(0.00)[5]; TO_MATCH_ENVRCPT_SOME(0.00)[]; TO_DN_ALL(0.00)[]; DKIM_TRACE(0.00)[bsdimp-com.20150623.gappssmtp.com:+]; RCVD_IN_DNSWL_NONE(0.00)[1.3.8.0.0.0.0.0.0.0.0.0.0.0.0.0.0.2.0.0.4.6.8.4.0.b.8.f.7.0.6.2.list.dnswl.org : 127.0.5.0]; R_SPF_NA(0.00)[]; FORGED_SENDER(0.30)[imp@bsdimp.com,wlosh@bsdimp.com]; MIME_TRACE(0.00)[0:+,1:+,2:~]; IP_SCORE(-2.72)[ip: (-9.26), ipnet: 2607:f8b0::/32(-2.29), asn: 15169(-1.97), country: US(-0.05)]; ASN(0.00)[asn:15169, ipnet:2607:f8b0::/32, country:US]; FROM_NEQ_ENVFROM(0.00)[imp@bsdimp.com,wlosh@bsdimp.com]; RCVD_TLS_ALL(0.00)[]; RCVD_COUNT_TWO(0.00)[2] Content-Type: text/plain; charset="UTF-8" X-Content-Filtered-By: Mailman/MimeDel 2.1.29 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 20 Nov 2019 23:04:57 -0000 On Wed, Nov 20, 2019 at 3:09 PM John Baldwin wrote: > On 11/20/19 10:01 AM, Warner Losh wrote: > > On Wed, Nov 20, 2019 at 9:54 AM Li-Wen Hsu wrote: > > > >> Author: lwhsu > >> Date: Wed Nov 20 16:54:21 2019 > >> New Revision: 354900 > >> URL: https://svnweb.freebsd.org/changeset/base/354900 > >> > >> Log: > >> Use the correct variable, also limit the scope to bfd > >> > >> PR: 242109 > >> Reported by: jhb > >> Sponsored by: The FreeBSD Foundation > >> > >> Modified: > >> head/usr.sbin/jail/Makefile > >> > >> Modified: head/usr.sbin/jail/Makefile > >> > >> > ============================================================================== > >> --- head/usr.sbin/jail/Makefile Wed Nov 20 16:35:58 2019 > (r354899) > >> +++ head/usr.sbin/jail/Makefile Wed Nov 20 16:54:21 2019 > (r354900) > >> @@ -18,7 +18,7 @@ CFLAGS+=-I. -I${.CURDIR} > >> # workaround for GNU ld (GNU Binutils) 2.33.1: > >> # relocation truncated to fit: R_RISCV_GPREL_I against `.LANCHOR2' > >> # https://bugs.freebsd.org/242109 > >> -.if ${MACHINE_ARCH} == "riscv" > >> +.if ${LINKER_TYPE} == "bfd" && ${MACHINE} == "riscv" > >> > > > > MACHINE isn't the right thing to use here. It's never the proper thing in > > userland makefiles, unless they are interfacing with the kernel. > > > > MACHINE_CPUARCH is what you want here. > > Eh, that claim doesn't seem quite true. src.opts.mk only uses MACHINE > and not > MACHINE_CPUARCH for example (to set _TT that is then used all over the > place in src.opts.mk). My experience is that uses of *_CPUARCH are in > fact > pretty rare. > However, __TT is used bogusly in many places in src.opts.mk. They are all relatively new related to llvm (and one for google test). MACHINE has always been for the kernel and MACHINE_ARCH for userland. MACHINE_CPUARCH was created for those architectures where we have a number of MACHINE_ARCH to make things easier to cope with. I've done several sweeps of the tree over the years to keep this enforced, so I'm quite sure of the dichotomy... Warner From owner-svn-src-all@freebsd.org Wed Nov 20 23:09:22 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 7FA721C4DE2; Wed, 20 Nov 2019 23:09:22 +0000 (UTC) (envelope-from brooks@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47JJKt2lV1z4VD2; Wed, 20 Nov 2019 23:09:22 +0000 (UTC) (envelope-from brooks@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 419F41F6E; Wed, 20 Nov 2019 23:09:22 +0000 (UTC) (envelope-from brooks@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xAKN9MJv015463; Wed, 20 Nov 2019 23:09:22 GMT (envelope-from brooks@FreeBSD.org) Received: (from brooks@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xAKN9Mha015462; Wed, 20 Nov 2019 23:09:22 GMT (envelope-from brooks@FreeBSD.org) Message-Id: <201911202309.xAKN9Mha015462@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: brooks set sender to brooks@FreeBSD.org using -f From: Brooks Davis Date: Wed, 20 Nov 2019 23:09:22 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r354921 - stable/12/sys/mips/mips X-SVN-Group: stable-12 X-SVN-Commit-Author: brooks X-SVN-Commit-Paths: stable/12/sys/mips/mips X-SVN-Commit-Revision: 354921 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 20 Nov 2019 23:09:22 -0000 Author: brooks Date: Wed Nov 20 23:09:21 2019 New Revision: 354921 URL: https://svnweb.freebsd.org/changeset/base/354921 Log: MFC r354688: Fix a typo in the PMAP_PTE_SET_CACHE_BITS macro. The second argument should have been "pa" not "ps". It worked by accident because the argument was always "pa" which was an in-scope local variable. Submitted by: sson Reviewed by: jhb, kevans Obtained from: CheriBSD Sponsored by: DARPA, AFRL Differential Revision: https://reviews.freebsd.org/D22338 Modified: stable/12/sys/mips/mips/pmap.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/mips/mips/pmap.c ============================================================================== --- stable/12/sys/mips/mips/pmap.c Wed Nov 20 22:25:49 2019 (r354920) +++ stable/12/sys/mips/mips/pmap.c Wed Nov 20 23:09:21 2019 (r354921) @@ -323,7 +323,7 @@ pmap_pte_cache_bits(vm_paddr_t pa, vm_page_t m) ma = VM_MEMATTR_UNCACHEABLE; return PTE_C(ma); } -#define PMAP_PTE_SET_CACHE_BITS(pte, ps, m) { \ +#define PMAP_PTE_SET_CACHE_BITS(pte, pa, m) { \ pte &= ~PTE_C_MASK; \ pte |= pmap_pte_cache_bits(pa, m); \ } From owner-svn-src-all@freebsd.org Wed Nov 20 23:32:34 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 0CF8F1C572B; Wed, 20 Nov 2019 23:32:34 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from smtp.freebsd.org (smtp.freebsd.org [96.47.72.83]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "smtp.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47JJrd6PYcz4WRm; Wed, 20 Nov 2019 23:32:33 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from John-Baldwins-MacBook-Pro-5.local (ralph.baldwin.cx [66.234.199.215]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client did not present a certificate) (Authenticated sender: jhb) by smtp.freebsd.org (Postfix) with ESMTPSA id 1801A1B49; Wed, 20 Nov 2019 23:32:33 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Subject: Re: svn commit: r354900 - head/usr.sbin/jail To: Warner Losh Cc: Li-Wen Hsu , src-committers , svn-src-all , svn-src-head References: <201911201654.xAKGsMTv094014@repo.freebsd.org> <59bf120c-2f35-1a22-b6fa-a9c9bb8cfdf4@FreeBSD.org> From: John Baldwin Openpgp: preference=signencrypt Autocrypt: addr=jhb@FreeBSD.org; keydata= mQGiBETQ+XcRBADMFybiq69u+fJRy/0wzqTNS8jFfWaBTs5/OfcV7wWezVmf9sgwn8TW0Dk0 c9MBl0pz+H01dA2ZSGZ5fXlmFIsee1WEzqeJzpiwd/pejPgSzXB9ijbLHZ2/E0jhGBcVy5Yo /Tw5+U/+laeYKu2xb0XPvM0zMNls1ah5OnP9a6Ql6wCgupaoMySb7DXm2LHD1Z9jTsHcAQMD /1jzh2BoHriy/Q2s4KzzjVp/mQO5DSm2z14BvbQRcXU48oAosHA1u3Wrov6LfPY+0U1tG47X 1BGfnQH+rNAaH0livoSBQ0IPI/8WfIW7ub4qV6HYwWKVqkDkqwcpmGNDbz3gfaDht6nsie5Z pcuCcul4M9CW7Md6zzyvktjnbz61BADGDCopfZC4of0Z3Ka0u8Wik6UJOuqShBt1WcFS8ya1 oB4rc4tXfSHyMF63aPUBMxHR5DXeH+EO2edoSwViDMqWk1jTnYza51rbGY+pebLQOVOxAY7k do5Ordl3wklBPMVEPWoZ61SdbcjhHVwaC5zfiskcxj5wwXd2E9qYlBqRg7QeSm9obiBCYWxk d2luIDxqaGJARnJlZUJTRC5vcmc+iGAEExECACAFAkTQ+awCGwMGCwkIBwMCBBUCCAMEFgID AQIeAQIXgAAKCRBy3lIGd+N/BI6RAJ9S97fvbME+3hxzE3JUyUZ6vTewDACdE1stFuSfqMvM jomvZdYxIYyTUpC5Ag0ERND5ghAIAPwsO0B7BL+bz8sLlLoQktGxXwXQfS5cInvL17Dsgnr3 1AKa94j9EnXQyPEj7u0d+LmEe6CGEGDh1OcGFTMVrof2ZzkSy4+FkZwMKJpTiqeaShMh+Goj XlwIMDxyADYvBIg3eN5YdFKaPQpfgSqhT+7El7w+wSZZD8pPQuLAnie5iz9C8iKy4/cMSOrH YUK/tO+Nhw8Jjlw94Ik0T80iEhI2t+XBVjwdfjbq3HrJ0ehqdBwukyeJRYKmbn298KOFQVHO EVbHA4rF/37jzaMadK43FgJ0SAhPPF5l4l89z5oPu0b/+5e2inA3b8J3iGZxywjM+Csq1tqz hltEc7Q+E08AAwUIAL+15XH8bPbjNJdVyg2CMl10JNW2wWg2Q6qdljeaRqeR6zFus7EZTwtX sNzs5bP8y51PSUDJbeiy2RNCNKWFMndM22TZnk3GNG45nQd4OwYK0RZVrikalmJY5Q6m7Z16 4yrZgIXFdKj2t8F+x613/SJW1lIr9/bDp4U9tw0V1g3l2dFtD3p3ZrQ3hpoDtoK70ioIAjjH aIXIAcm3FGZFXy503DOA0KaTWwvOVdYCFLm3zWuSOmrX/GsEc7ovasOWwjPn878qVjbUKWwx Q4QkF4OhUV9zPtf9tDSAZ3x7QSwoKbCoRCZ/xbyTUPyQ1VvNy/mYrBcYlzHodsaqUDjHuW+I SQQYEQIACQUCRND5ggIbDAAKCRBy3lIGd+N/BCO8AJ9j1dWVQWxw/YdTbEyrRKOY8YZNwwCf afMAg8QvmOWnHx3wl8WslCaXaE8= Message-ID: <991bdc33-516d-6e6d-1880-44930441893d@FreeBSD.org> Date: Wed, 20 Nov 2019 15:32:28 -0800 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.12; rv:60.0) Gecko/20100101 Thunderbird/60.9.1 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 20 Nov 2019 23:32:34 -0000 On 11/20/19 3:04 PM, Warner Losh wrote: > On Wed, Nov 20, 2019 at 3:09 PM John Baldwin wrote: > >> On 11/20/19 10:01 AM, Warner Losh wrote: >>> On Wed, Nov 20, 2019 at 9:54 AM Li-Wen Hsu wrote: >>> >>>> Author: lwhsu >>>> Date: Wed Nov 20 16:54:21 2019 >>>> New Revision: 354900 >>>> URL: https://svnweb.freebsd.org/changeset/base/354900 >>>> >>>> Log: >>>> Use the correct variable, also limit the scope to bfd >>>> >>>> PR: 242109 >>>> Reported by: jhb >>>> Sponsored by: The FreeBSD Foundation >>>> >>>> Modified: >>>> head/usr.sbin/jail/Makefile >>>> >>>> Modified: head/usr.sbin/jail/Makefile >>>> >>>> >> ============================================================================== >>>> --- head/usr.sbin/jail/Makefile Wed Nov 20 16:35:58 2019 >> (r354899) >>>> +++ head/usr.sbin/jail/Makefile Wed Nov 20 16:54:21 2019 >> (r354900) >>>> @@ -18,7 +18,7 @@ CFLAGS+=-I. -I${.CURDIR} >>>> # workaround for GNU ld (GNU Binutils) 2.33.1: >>>> # relocation truncated to fit: R_RISCV_GPREL_I against `.LANCHOR2' >>>> # https://bugs.freebsd.org/242109 >>>> -.if ${MACHINE_ARCH} == "riscv" >>>> +.if ${LINKER_TYPE} == "bfd" && ${MACHINE} == "riscv" >>>> >>> >>> MACHINE isn't the right thing to use here. It's never the proper thing in >>> userland makefiles, unless they are interfacing with the kernel. >>> >>> MACHINE_CPUARCH is what you want here. >> >> Eh, that claim doesn't seem quite true. src.opts.mk only uses MACHINE >> and not >> MACHINE_CPUARCH for example (to set _TT that is then used all over the >> place in src.opts.mk). My experience is that uses of *_CPUARCH are in >> fact >> pretty rare. >> > > However, __TT is used bogusly in many places in src.opts.mk. They are all > relatively new related to llvm (and one for google test). MACHINE has > always been for the kernel and MACHINE_ARCH for userland. MACHINE_CPUARCH > was created for those architectures where we have a number of MACHINE_ARCH > to make things easier to cope with. > > I've done several sweeps of the tree over the years to keep this enforced, > so I'm quite sure of the dichotomy... Here are some to fix then: :) sbin/reboot/Makefile:.if exists(${.CURDIR}/boot_${MACHINE}.8) sbin/reboot/Makefile:MAN+= boot_${MACHINE}.8 sbin/reboot/Makefile:MLINKS+= boot_${MACHINE}.8 boot.8 sbin/reboot/Makefile:.if ${MACHINE} == "amd64" usr.sbin/bsdinstall/partedit/Makefile:PARTEDIT_ARCH= ${MACHINE} usr.sbin/bsdinstall/partedit/Makefile:.if ${MACHINE} == "i386" || ${MACHINE} == "amd64" usr.sbin/pkg/Makefile:. if ${MACHINE} != "amd64" && ${MACHINE} != "i386" This one also seems dubious, but in a different way: usr.bin/Makefile: # ARM64TODO gprof does not build # RISCVTODO gprof does not build .if ${MACHINE_ARCH} != "aarch64" && ${MACHINE_CPUARCH} != "riscv" SUBDIR.${MK_TOOLCHAIN}+= gprof .endif Somewhat exacerbated by the whole aarch64 vs arm64 thing and probably confusion on when to use CPUARCH vs ARCH. BTW, MACHINE_ARCH seems to matter just as much for the kernel. 64-bit mips runs a "mips64" kernel, not a "mips" kernel. With PC-98 removed, I don't think we have any cases where MACHINE != MACHINE_CPUARCH now? -- John Baldwin From owner-svn-src-all@freebsd.org Wed Nov 20 23:42:21 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id A9BF71C5A4C; Wed, 20 Nov 2019 23:42:21 +0000 (UTC) (envelope-from bzeeb-lists@lists.zabbadoz.net) Received: from mx1.sbone.de (mx1.sbone.de [IPv6:2a01:4f8:13b:39f::9f:25]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mx1.sbone.de", Issuer "SBone.DE" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 47JK3x42mpz4WwX; Wed, 20 Nov 2019 23:42:21 +0000 (UTC) (envelope-from bzeeb-lists@lists.zabbadoz.net) Received: from mail.sbone.de (mail.sbone.de [IPv6:fde9:577b:c1a9:31::2013:587]) (using TLSv1 with cipher ADH-CAMELLIA256-SHA (256/256 bits)) (No client certificate requested) by mx1.sbone.de (Postfix) with ESMTPS id 543078D4A15E; Wed, 20 Nov 2019 23:42:13 +0000 (UTC) Received: from content-filter.sbone.de (content-filter.sbone.de [IPv6:fde9:577b:c1a9:31::2013:2742]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.sbone.de (Postfix) with ESMTPS id 8A11CE707FD; Wed, 20 Nov 2019 23:42:12 +0000 (UTC) X-Virus-Scanned: amavisd-new at sbone.de Received: from mail.sbone.de ([IPv6:fde9:577b:c1a9:31::2013:587]) by content-filter.sbone.de (content-filter.sbone.de [fde9:577b:c1a9:31::2013:2742]) (amavisd-new, port 10024) with ESMTP id V4TRTEip5W0n; Wed, 20 Nov 2019 23:42:10 +0000 (UTC) Received: from [192.168.2.110] (unknown [IPv6:fde9:577b:c1a9:31:a48e:25c1:a165:8cd7]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.sbone.de (Postfix) with ESMTPSA id 41280E707AC; Wed, 20 Nov 2019 23:42:09 +0000 (UTC) From: "Bjoern A. Zeeb" To: "John Baldwin" Cc: "Warner Losh" , src-committers , svn-src-all , svn-src-head Subject: Re: svn commit: r354900 - head/usr.sbin/jail Date: Wed, 20 Nov 2019 23:42:08 +0000 X-Mailer: MailMate (2.0BETAr6142) Message-ID: In-Reply-To: <991bdc33-516d-6e6d-1880-44930441893d@FreeBSD.org> References: <201911201654.xAKGsMTv094014@repo.freebsd.org> <59bf120c-2f35-1a22-b6fa-a9c9bb8cfdf4@FreeBSD.org> <991bdc33-516d-6e6d-1880-44930441893d@FreeBSD.org> MIME-Version: 1.0 Content-Type: text/plain; format=flowed X-Rspamd-Queue-Id: 47JK3x42mpz4WwX X-Spamd-Bar: ----- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-5.99 / 15.00]; NEURAL_HAM_MEDIUM(-1.00)[-0.997,0]; REPLY(-4.00)[]; NEURAL_HAM_LONG(-0.99)[-0.994,0] X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 20 Nov 2019 23:42:21 -0000 On 20 Nov 2019, at 23:32, John Baldwin wrote: Hijacking a side-thread: PreS: I think we have way too many of these options and should just remove 3/4 of them again or someone build a proper matrix documenting them all and in which case to use in the developers handbook ;-) > This one also seems dubious, but in a different way: > > usr.bin/Makefile: > > # ARM64TODO gprof does not build > # RISCVTODO gprof does not build > .if ${MACHINE_ARCH} != "aarch64" && ${MACHINE_CPUARCH} != "riscv" > SUBDIR.${MK_TOOLCHAIN}+= gprof > .endif > > Somewhat exacerbated by the whole aarch64 vs arm64 thing and probably > confusion on when to use CPUARCH vs ARCH. This particular case could actually be removed as I thought I made that at least compile when I was working on s390x: https://svnweb.freebsd.org/base?view=revision&revision=351329 You can however find more of these elsewhere: ../lib/libc/tests/sys/Makefile:.if ${MACHINE_CPUARCH} != "aarch64" && ${MACHINE_CPUARCH} != "riscv" ../lib/libcompiler_rt/Makefile.inc:.if ${MACHINE_CPUARCH} == "aarch64" || ${MACHINE_CPUARCH} == "riscv" ../stand/libsa/Makefile:.if ${MACHINE_CPUARCH} == "aarch64" || ${MACHINE_CPUARCH} == "riscv" ../usr.bin/Makefile:.if ${MACHINE_ARCH} != "aarch64" && ${MACHINE_CPUARCH} != "riscv" ../usr.bin/gprof/Makefile:.if ${MACHINE_ARCH} != "aarch64" && ${MACHINE_ARCH} != "riscv" && \ From owner-svn-src-all@freebsd.org Wed Nov 20 23:45:33 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 8E9FE1C5B31; Wed, 20 Nov 2019 23:45:33 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47JK7d36JVz4X5F; Wed, 20 Nov 2019 23:45:33 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4A8F22671; Wed, 20 Nov 2019 23:45:33 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xAKNjXgU038820; Wed, 20 Nov 2019 23:45:33 GMT (envelope-from imp@FreeBSD.org) Received: (from imp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xAKNjVEl038814; Wed, 20 Nov 2019 23:45:31 GMT (envelope-from imp@FreeBSD.org) Message-Id: <201911202345.xAKNjVEl038814@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: imp set sender to imp@FreeBSD.org using -f From: Warner Losh Date: Wed, 20 Nov 2019 23:45:31 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354922 - in head: etc libexec/rc libexec/rc/rc.d share/man/man5 sys/sys X-SVN-Group: head X-SVN-Commit-Author: imp X-SVN-Commit-Paths: in head: etc libexec/rc libexec/rc/rc.d share/man/man5 sys/sys X-SVN-Commit-Revision: 354922 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 20 Nov 2019 23:45:33 -0000 Author: imp Date: Wed Nov 20 23:45:31 2019 New Revision: 354922 URL: https://svnweb.freebsd.org/changeset/base/354922 Log: Create /etc/os-release file. Each boot, regenerate /var/run/os-release based on the currently running system. Create a /etc/os-release symlink pointing to this file (so that this doesn't create a new reason /etc can not be mounted read-only). This is compatible with what other systems do and is what the sysutil/os-release port attempted to do, but in an incomplete way. Linux, Solaris and DragonFly all implement this natively as well. The complete standard can be found at https://www.freedesktop.org/software/systemd/man/os-release.html Moving this to the base solves both the non-standard location problem with the port, as well as the lack of update of this file on system update. Bump __FreeBSD_version to 1300060 PR: 238953 Differential Revision: https://reviews.freebsd.org/D22271 Added: head/libexec/rc/rc.d/os-release (contents, props changed) head/share/man/man5/os-release.5 (contents, props changed) Modified: head/etc/Makefile head/libexec/rc/rc.conf head/libexec/rc/rc.d/Makefile head/share/man/man5/Makefile head/sys/sys/param.h Modified: head/etc/Makefile ============================================================================== --- head/etc/Makefile Wed Nov 20 23:09:21 2019 (r354921) +++ head/etc/Makefile Wed Nov 20 23:45:31 2019 (r354922) @@ -57,6 +57,8 @@ distribution: ${_+_}cd ${.CURDIR}/mtree; ${MAKE} install ${_+_}cd ${SRCTOP}/share/termcap; ${MAKE} etc-termcap ${_+_}cd ${SRCTOP}/usr.sbin/rmt; ${MAKE} etc-rmt + ${INSTALL_SYMLINK} ../var/run/os-release \ + ${DESTDIR}/etc/os-release .if ${MK_UNBOUND} != "no" if [ ! -e ${DESTDIR}/etc/unbound ]; then \ ${INSTALL_SYMLINK} -T "package=unbound" \ Modified: head/libexec/rc/rc.conf ============================================================================== --- head/libexec/rc/rc.conf Wed Nov 20 23:09:21 2019 (r354921) +++ head/libexec/rc/rc.conf Wed Nov 20 23:45:31 2019 (r354922) @@ -678,6 +678,9 @@ entropy_save_sz="4096" # Size of the entropy cache fil entropy_save_num="8" # Number of entropy cache files to save. harvest_mask="511" # Entropy device harvests all but the very invasive sources. # (See 'sysctl kern.random.harvest' and random(4)) +osrelease_enable="YES" # Update /var/run/os-release on boot (or NO). +osrelease_file="/var/run/os-release" # File to update for os-release. +osrelease_perms="444" # Default permission for os-release file. dmesg_enable="YES" # Save dmesg(8) to /var/run/dmesg.boot watchdogd_enable="NO" # Start the software watchdog daemon watchdogd_flags="" # Flags to watchdogd (if enabled) Modified: head/libexec/rc/rc.d/Makefile ============================================================================== --- head/libexec/rc/rc.d/Makefile Wed Nov 20 23:09:21 2019 (r354921) +++ head/libexec/rc/rc.d/Makefile Wed Nov 20 23:45:31 2019 (r354922) @@ -77,6 +77,7 @@ CONFS= DAEMON \ nsswitch \ ntpdate \ ${_opensm} \ + os-release \ pf \ pflog \ pfsync \ Added: head/libexec/rc/rc.d/os-release ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/libexec/rc/rc.d/os-release Wed Nov 20 23:45:31 2019 (r354922) @@ -0,0 +1,44 @@ +#!/bin/sh +# +# $FreeBSD$ +# + +# PROVIDE: os-release +# REQUIRE: mountcritremote FILESYSTEMS +# BEFORE: LOGIN + +. /etc/rc.subr + +: ${osrelease_file:=/var/run/os-release} +: ${osrelease_perms:=444} +name="osrelease" +desc="Update ${osrelease_file}" +start_cmd="osrelease_start" +stop_cmd=":" + +osrelease_start() +{ + local _version _version_id + + check_startmsgs && echo -n "Updating ${osrelease_file} " + _version=$(freebsd-version -u) + _version_id=${_version%%[^0-9.]*} + t=$(mktemp -t os-release) + cat > "$t" <<-__EOF__ + NAME=FreeBSD + VERSION=$_version + VERSION_ID=$_version_id + ID=freebsd + ANSI_COLOR="0;31" + PRETTY_NAME="FreeBSD $_version" + CPE_NAME=cpe:/o:freebsd:freebsd:$_version_id + HOME_URL=https://FreeBSD.org/ + BUG_REPORT_URL=https://bugs.FreeBSD.org/ +__EOF__ + install -C -o root -g wheel -m ${osrelease_perms} "$t" "${osrelease_file}" + rm -f "$t" + check_startmsgs && echo 'done.' +} + +load_rc_config $name +run_rc_command "$1" Modified: head/share/man/man5/Makefile ============================================================================== --- head/share/man/man5/Makefile Wed Nov 20 23:09:21 2019 (r354921) +++ head/share/man/man5/Makefile Wed Nov 20 23:45:31 2019 (r354922) @@ -46,6 +46,7 @@ MAN= acct.5 \ nsmb.conf.5 \ nsswitch.conf.5 \ nullfs.5 \ + os-release.5 \ passwd.5 \ pbm.5 \ periodic.conf.5 \ Added: head/share/man/man5/os-release.5 ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/share/man/man5/os-release.5 Wed Nov 20 23:45:31 2019 (r354922) @@ -0,0 +1,130 @@ +.\" Copyright (c) 2019 M. Warner Losh. +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in the +.\" documentation and/or other materials provided with the distribution. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND +.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE +.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +.\" SUCH DAMAGE. +.\" +.\" $FreeBSD$ +.\" +.Dd November 9, 2019 +.Dt OS-RELEASE 5 +.Os +.Sh NAME +.Nm os-release +.Nd file describing the current OS and some of its attributes +.Sh DESCRIPTION +The +.Nm +file is a new-line separated list of key value pairs. +The syntax of this file is a reduced +.Xr sh 1 +variable assignment with the +following restrictions: +.Bl -bullet +.It +Strings cannot be concatenated together +.It +No variable expansion is done +.It +All shell special characters must be quoted as documented in +.Xr sh 1 +.It +Variable assignments must be included inside of double quotes +if they contain characters outside of A-Z, a-z and 0-9 +.It +All strings should be UTF-8 format +.It +Non-printable characters should not be used in the strings +.El +.Pp +Lines starting with the character +.Ql # +are ignored as comments. +.Sh VARIABLES +The following variables are defined by the standard. +.Bl -tag -width XXXXXXXXXX -compact +.It Dv NAME +A string describing the preferred OS name. +.It Dv VERSION +Version string for the OS, in its usual and customary format. +.It Dv ID +Lower case version of the name with only a-z, 0-9, +.Ql . , +.Ql - , +and +.Ql _ . +.It Dv VERSION_ID +Lower case version of the version with only a-z, 0-9, +.Ql . , +.Ql - , +and +.Ql _ . +.It Dv PRETTY_NAME +A pretty version of the name presented to the user. +May contain release information. +.It Dv ANSI_COLOR +Suggested color presentation for the OS. +This string should be suitable for inclusion within an ESC [ m ANSI/ECMA-48 +escape sequence to render the OS in its preferred color. +This variable is optional. +.It Dv CPE_NAME +A CPE name for the operating system. +This field shall follow the NIST Common Platform Enumeration specification. +.It Dv HOME_URL +.It Dv SUPPORT_URL +.It Dv BUG_REPORT_URL +.It Dv PRIVACY_POLICY_URL +Links on the internet, in RFC 3986 format for different aspects of this OS. +These variables are optional. +.It Dv BUILD_ID +A string identifying the build. +This variable is optional. +.It Dv VARIANT +A string describing the variant of this operating system. +This variable is optional. +.It Dv VARIANT_ID +Lower case version of the variant with only a-z, 0-9, +.Ql . , +.Ql - , +and +.Ql _ . +This variable is optional. +.El +.Pp +All other variables have no standard-defined meaning. +.Sh FILES +.Bl -tag -width XXXXXXXXXX -compact +.It Pa /etc/os-release +Symbolic link to actual +.Pa os-release +file. +.It Pa /var/run/os-release +Generated os-release file describing the currently running system. +.Sh SEE ALSO +.Bl -tag -width XXXXXXXXXX -compact +.It CPE Specification +.Lk https://csrc.nist.gov/projects/security-content-automation-protocol/scap-specifications/cpe +.It RFC 3986 +.Lk https://tools.ietf.org/html/rfc3986 +.It os-release Specification +.Lk https://www.linux.org/docs/man5/os-release.html +.Sh HISTORY +This file first appeared in +.Fx 13.0 . Modified: head/sys/sys/param.h ============================================================================== --- head/sys/sys/param.h Wed Nov 20 23:09:21 2019 (r354921) +++ head/sys/sys/param.h Wed Nov 20 23:45:31 2019 (r354922) @@ -60,7 +60,7 @@ * in the range 5 to 9. */ #undef __FreeBSD_version -#define __FreeBSD_version 1300059 /* Master, propagated to newvers */ +#define __FreeBSD_version 1300060 /* Master, propagated to newvers */ /* * __FreeBSD_kernel__ indicates that this system uses the kernel of FreeBSD, From owner-svn-src-all@freebsd.org Wed Nov 20 23:49:48 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id DAD851C5BFC; Wed, 20 Nov 2019 23:49:48 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47JKDX5Bssz4XG9; Wed, 20 Nov 2019 23:49:48 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 912A42695; Wed, 20 Nov 2019 23:49:48 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xAKNnmXk039061; Wed, 20 Nov 2019 23:49:48 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xAKNnmu3039059; Wed, 20 Nov 2019 23:49:48 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201911202349.xAKNnmu3039059@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Wed, 20 Nov 2019 23:49:48 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r354923 - stable/12/sys/dev/ahci X-SVN-Group: stable-12 X-SVN-Commit-Author: mav X-SVN-Commit-Paths: stable/12/sys/dev/ahci X-SVN-Commit-Revision: 354923 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 20 Nov 2019 23:49:48 -0000 Author: mav Date: Wed Nov 20 23:49:47 2019 New Revision: 354923 URL: https://svnweb.freebsd.org/changeset/base/354923 Log: MFC r351589: Fix AHCI Enclosure Management, broken by r351356. ivars value of -1 was used to distinguish EM device, and r351356 left some wrong checks for it. Give EM device separate flag there instead. Modified: stable/12/sys/dev/ahci/ahci.c stable/12/sys/dev/ahci/ahci.h Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/dev/ahci/ahci.c ============================================================================== --- stable/12/sys/dev/ahci/ahci.c Wed Nov 20 23:45:31 2019 (r354922) +++ stable/12/sys/dev/ahci/ahci.c Wed Nov 20 23:49:47 2019 (r354923) @@ -362,7 +362,7 @@ ahci_attach(device_t dev) if (child == NULL) device_printf(dev, "failed to add enclosure device\n"); else - device_set_ivars(child, (void *)(intptr_t)-1); + device_set_ivars(child, (void *)(intptr_t)AHCI_EM_UNIT); } bus_generic_attach(dev); return (0); @@ -562,23 +562,25 @@ ahci_alloc_resource(device_t dev, device_t child, int struct resource *res; rman_res_t st; int offset, size, unit; - bool is_remapped; + bool is_em, is_remapped; unit = (intptr_t)device_get_ivars(child); + is_em = is_remapped = false; if (unit & AHCI_REMAPPED_UNIT) { - unit &= ~AHCI_REMAPPED_UNIT; + unit &= AHCI_UNIT; unit -= ctlr->channels; is_remapped = true; - } else - is_remapped = false; + } else if (unit & AHCI_EM_UNIT) { + unit &= AHCI_UNIT; + is_em = true; + } res = NULL; switch (type) { case SYS_RES_MEMORY: if (is_remapped) { offset = ctlr->remap_offset + unit * ctlr->remap_size; size = ctlr->remap_size; - } - else if (unit >= 0) { + } else if (!is_em) { offset = AHCI_OFFSET + (unit << 7); size = 128; } else if (*rid == 0) { @@ -639,7 +641,7 @@ ahci_setup_intr(device_t dev, device_t child, struct r void *argument, void **cookiep) { struct ahci_controller *ctlr = device_get_softc(dev); - int unit = (intptr_t)device_get_ivars(child) & ~AHCI_REMAPPED_UNIT; + int unit = (intptr_t)device_get_ivars(child) & AHCI_UNIT; if (filter != NULL) { printf("ahci.c: we cannot use a filter here\n"); @@ -655,7 +657,7 @@ ahci_teardown_intr(device_t dev, device_t child, struc void *cookie) { struct ahci_controller *ctlr = device_get_softc(dev); - int unit = (intptr_t)device_get_ivars(child) & ~AHCI_REMAPPED_UNIT; + int unit = (intptr_t)device_get_ivars(child) & AHCI_UNIT; ctlr->interrupt[unit].function = NULL; ctlr->interrupt[unit].argument = NULL; @@ -665,12 +667,13 @@ ahci_teardown_intr(device_t dev, device_t child, struc int ahci_print_child(device_t dev, device_t child) { - int retval, channel; + intptr_t ivars; + int retval; retval = bus_print_child_header(dev, child); - channel = (int)(intptr_t)device_get_ivars(child) & ~AHCI_REMAPPED_UNIT; - if (channel >= 0) - retval += printf(" at channel %d", channel); + ivars = (intptr_t)device_get_ivars(child); + if ((ivars & AHCI_EM_UNIT) == 0) + retval += printf(" at channel %d", (int)ivars & AHCI_UNIT); retval += bus_print_child_footer(dev, child); return (retval); } @@ -679,11 +682,11 @@ int ahci_child_location_str(device_t dev, device_t child, char *buf, size_t buflen) { - int channel; + intptr_t ivars; - channel = (int)(intptr_t)device_get_ivars(child) & ~AHCI_REMAPPED_UNIT; - if (channel >= 0) - snprintf(buf, buflen, "channel=%d", channel); + ivars = (intptr_t)device_get_ivars(child); + if ((ivars & AHCI_EM_UNIT) == 0) + snprintf(buf, buflen, "channel=%d", (int)ivars & AHCI_UNIT); return (0); } Modified: stable/12/sys/dev/ahci/ahci.h ============================================================================== --- stable/12/sys/dev/ahci/ahci.h Wed Nov 20 23:45:31 2019 (r354922) +++ stable/12/sys/dev/ahci/ahci.h Wed Nov 20 23:49:47 2019 (r354923) @@ -319,9 +319,10 @@ /* Total main work area. */ #define AHCI_WORK_SIZE (AHCI_CT_OFFSET + AHCI_CT_SIZE * ch->numslots) - -/* NVMe remapped device */ -#define AHCI_REMAPPED_UNIT (1 << 31) +/* ivars value fields */ +#define AHCI_REMAPPED_UNIT (1 << 31) /* NVMe remapped device. */ +#define AHCI_EM_UNIT (1 << 30) /* Enclosure Mgmt device. */ +#define AHCI_UNIT 0xff /* Channel number. */ struct ahci_dma_prd { u_int64_t dba; From owner-svn-src-all@freebsd.org Wed Nov 20 23:56:22 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id A8C551C5E6D; Wed, 20 Nov 2019 23:56:22 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47JKN64Zqxz4Xcd; Wed, 20 Nov 2019 23:56:22 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 7BC41284B; Wed, 20 Nov 2019 23:56:22 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xAKNuMTq045014; Wed, 20 Nov 2019 23:56:22 GMT (envelope-from pfg@FreeBSD.org) Received: (from pfg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xAKNuKNO044999; Wed, 20 Nov 2019 23:56:20 GMT (envelope-from pfg@FreeBSD.org) Message-Id: <201911202356.xAKNuKNO044999@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: pfg set sender to pfg@FreeBSD.org using -f From: "Pedro F. Giffuni" Date: Wed, 20 Nov 2019 23:56:20 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354924 - head/contrib/openresolv X-SVN-Group: head X-SVN-Commit-Author: pfg X-SVN-Commit-Paths: head/contrib/openresolv X-SVN-Commit-Revision: 354924 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 20 Nov 2019 23:56:22 -0000 Author: pfg Date: Wed Nov 20 23:56:20 2019 New Revision: 354924 URL: https://svnweb.freebsd.org/changeset/base/354924 Log: MFV 354917, 354918, 354919 openresolv: update to version 3.9.2 MFC after: 3 weeks Added: head/contrib/openresolv/LICENSE - copied unchanged from r354917, vendor/openresolv/dist/LICENSE head/contrib/openresolv/README.md - copied unchanged from r354917, vendor/openresolv/dist/README.md Deleted: head/contrib/openresolv/README Modified: head/contrib/openresolv/Makefile head/contrib/openresolv/configure head/contrib/openresolv/dnsmasq.in head/contrib/openresolv/libc.in head/contrib/openresolv/named.in head/contrib/openresolv/pdns_recursor.in head/contrib/openresolv/pdnsd.in head/contrib/openresolv/resolvconf.conf head/contrib/openresolv/resolvconf.conf.5.in head/contrib/openresolv/resolvconf.in head/contrib/openresolv/unbound.in Directory Properties: head/contrib/openresolv/ (props changed) Copied: head/contrib/openresolv/LICENSE (from r354917, vendor/openresolv/dist/LICENSE) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/contrib/openresolv/LICENSE Wed Nov 20 23:56:20 2019 (r354924, copy of r354917, vendor/openresolv/dist/LICENSE) @@ -0,0 +1,23 @@ +Copyright (c) 2007-2019 Roy Marples +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions +are met: +1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. +2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + +THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND +ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE +FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +SUCH DAMAGE. Modified: head/contrib/openresolv/Makefile ============================================================================== --- head/contrib/openresolv/Makefile Wed Nov 20 23:49:47 2019 (r354923) +++ head/contrib/openresolv/Makefile Wed Nov 20 23:56:20 2019 (r354924) @@ -10,6 +10,7 @@ SYSCONFDIR?= /etc LIBEXECDIR?= /libexec/resolvconf VARDIR?= /var/run/resolvconf +ECHO?= echo INSTALL?= install SED?= sed @@ -20,7 +21,7 @@ DOCMODE?= 0644 MANMODE?= 0444 RESOLVCONF= resolvconf resolvconf.8 resolvconf.conf.5 -SUBSCRIBERS= libc dnsmasq named pdnsd unbound +SUBSCRIBERS= libc dnsmasq named pdnsd pdns_recursor unbound TARGET= ${RESOLVCONF} ${SUBSCRIBERS} SRCS= ${TARGET:C,$,.in,} # pmake SRCS:= ${TARGET:=.in} # gmake @@ -42,7 +43,7 @@ DISTINFOSIGN= ${DISTINFO}.asc CKSUM?= cksum -a SHA256 PGP?= netpgp -FOSSILID?= current +GITREF?= HEAD .SUFFIXES: .in @@ -79,15 +80,17 @@ maninstall: install: proginstall maninstall -import: +dist-git: + git archive --prefix=${DISTPREFIX}/ ${GITREF} | xz >${DISTFILE} + +dist-inst: + mkdir /tmp/${DISTPREFIX} + cp -RPp * /tmp/${DISTPREFIX} + (cd /tmp/${DISTPREFIX}; make clean) + tar -cvjpf ${DISTFILE} -C /tmp ${DISTPREFIX} rm -rf /tmp/${DISTPREFIX} - ${INSTALL} -d /tmp/${DISTPREFIX} - cp README ${SRCS} /tmp/${DISTPREFIX} -dist: - fossil tarball --name ${DISTPREFIX} ${FOSSILID} ${DISTFILEGZ} - gunzip -c ${DISTFILEGZ} | xz >${DISTFILE} - rm ${DISTFILEGZ} +dist: dist-git distinfo: dist rm -f ${DISTINFO} ${DISTINFOSIGN} @@ -96,3 +99,20 @@ distinfo: dist ${PGP} --clearsign --output=${DISTINFOSIGN} ${DISTINFO} chmod 644 ${DISTINFOSIGN} ls -l ${DISTFILE} ${DISTINFO} ${DISTINFOSIGN} + +import: dist + rm -rf /tmp/${DISTPREFIX} + ${INSTALL} -d /tmp/${DISTPREFIX} + tar xvJpf ${DISTFILE} -C /tmp + +_import-src: + rm -rf ${DESTDIR}/* + ${INSTALL} -d ${DESTDIR} + cp LICENSE README.md ${SRCS} resolvconf.conf ${DESTDIR}; + cp resolvconf.8.in resolvconf.conf.5.in ${DESTDIR}; + @${ECHO} + @${ECHO} "=============================================================" + @${ECHO} "openresolv-${VERSION} imported to ${DESTDIR}" + +import-src: + ${MAKE} _import-src DESTDIR=`if [ -n "${DESTDIR}" ]; then echo "${DESTDIR}"; else echo /tmp/${DISTPREFIX}; fi` Copied: head/contrib/openresolv/README.md (from r354917, vendor/openresolv/dist/README.md) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/contrib/openresolv/README.md Wed Nov 20 23:56:20 2019 (r354924, copy of r354917, vendor/openresolv/dist/README.md) @@ -0,0 +1,64 @@ +# openresolv + +openresolv is a [resolvconf](https://en.wikipedia.org/wiki/Resolvconf) +implementation which manages `/etc/resolv.conf`. + +`/etc/resolv.conf` is a file that holds the configuration for the local +resolution of domain names. +Normally this file is either static or maintained by a local daemon, +normally a DHCP daemon. But what happens if more than one thing wants to +control the file? +Say you have wired and wireless interfaces to different subnets and run a VPN +or two on top of that, how do you say which one controls the file? +It's also not as easy as just adding and removing the nameservers each client +knows about as different clients could add the same nameservers. + +Enter resolvconf, the middleman between the network configuration services and +`/etc/resolv.conf`. +resolvconf itself is just a script that stores, removes and lists a full +`resolv.conf` generated for the interface. It then calls all the helper scripts +it knows about so it can configure the real `/etc/resolv.conf` and optionally +any local nameservers other than libc. + +## Reasons for using openresolv + +Why openresolv over the +[Debian implementation](http://qref.sourceforge.net/Debian/reference/ch-gateway.en.html#s-dns-resolvconf)? +Here's some reasons: + * Works with + [POSIX shell and userland](http://www.opengroup.org/onlinepubs/009695399) + * Does not need awk, grep or sed which means we can work without `/usr` + mounted + * Works with other init systems than Debians' out of the box + * Available as a 2 clause + [BSD license](http://www.freebsd.org/copyright/freebsd-license.html) + * Prefer configs via IF_METRIC for dynamic ordering + * Configures zones for local resolvers other than libc + +The last point is quite important, especially when running VPN systems. +Take the following resolv.conf files which have been generated by a +[DHCP client](../dhcpcd) and sent to resolvconf: + +``` +# resolv.conf from bge0 +search foo.com +nameserver 1.2.3.4 + +# resolv.conf from tap0 +domain bar.org +nameserver 5.6.7.8 +``` + +In this instance, queries for foo.com will go to 1.2.3.4 and queries for +bar.org will go to 5.6.7.8. +This does require the resolvers to be configured to pickup the resolvconf +generated configuration for them though. +openresolv ships with helpers for: + * [unbound](http://www.unbound.net/) + * [dnsmasq](http://www.thekelleys.org.uk/dnsmasq/doc.html) + * [ISC BIND](http://www.isc.org/software/bind) + * [PowerDNS Recursor](http://wiki.powerdns.com/trac) + +See the +[configuration section](https://roy.marples.name/projects/openresolv/config) +for more details. Modified: head/contrib/openresolv/configure ============================================================================== --- head/contrib/openresolv/configure Wed Nov 20 23:49:47 2019 (r354923) +++ head/contrib/openresolv/configure Wed Nov 20 23:56:20 2019 (r354924) @@ -44,42 +44,8 @@ for x do esac done -if [ -z "$LIBEXECDIR" ]; then - printf "Checking for directory /libexec ... " - if [ -d /libexec ]; then - echo "yes" - LIBEXECDIR=$PREFIX/libexec/resolvconf - else - echo "no" - LIBEXECDIR=$PREFIX/lib/resolvconf - fi -fi -if [ -z "$RUNDIR" ]; then - printf "Checking for directory /run ... " - if [ -d /run ]; then - echo "yes" - RUNDIR=/run - else - echo "no" - RUNDIR=/var/run - fi -fi - : ${SED:=sed} -: ${SYSCONFDIR:=$PREFIX/etc} -: ${SBINDIR:=$PREFIX/sbin} -: ${LIBEXECDIR:=$PREFIX/libexec/resolvconf} -: ${STATEDIR:=/var} -: ${RUNDIR:=$STATEDIR/run} -: ${MANDIR:=${PREFIX:-/usr}/share/man} - -eval SYSCONFDIR="$SYSCONFDIR" -eval SBINDIR="$SBINDIR" -eval LIBEXECDIR="$LIBEXECDIR" -eval VARDIR="$RUNDIR/resolvconf" -eval MANDIR="$MANDIR" - CONFIG_MK=config.mk if [ -z "$BUILD" ]; then @@ -121,7 +87,19 @@ rm -rf $CONFIG_MK echo "# $OS" >$CONFIG_MK case "$OS" in -freebsd*) +dragonfly*) + # This means /usr HAS to be mounted not via dhcpcd + : ${LIBEXECDIR:=${PREFIX:-/usr}/libexec/resolvconf} + ;; +linux*) + # cksum does't support -a and netpgp is rare + echo "CKSUM= sha256sum --tag" >>$CONFIG_MK + echo "PGP= gpg2" >>$CONFIG_MK + ;; +esac + +case "$OS" in +dragonfly*|freebsd*) # On FreeBSD, /etc/init.d/foo status returns 0 if foo is not enabled # regardless of if it's not running. # So we force onestatus to work around this silly bug. @@ -129,12 +107,42 @@ freebsd*) STATUSARG="onestatus" fi ;; -linux*) - # cksum does't support -a and netpgp is rare - echo "CKSUM= sha256sum --tag" >>$CONFIG_MK - echo "PGP= gpg2" >>$CONFIG_MK - ;; esac + + +if [ -z "$LIBEXECDIR" ]; then + printf "Checking for directory /libexec ... " + if [ -d /libexec ]; then + echo "yes" + LIBEXECDIR=$PREFIX/libexec/resolvconf + else + echo "no" + LIBEXECDIR=$PREFIX/lib/resolvconf + fi +fi +if [ -z "$RUNDIR" ]; then + printf "Checking for directory /run ... " + if [ -d /run ]; then + echo "yes" + RUNDIR=/run + else + echo "no" + RUNDIR=/var/run + fi +fi + +: ${SYSCONFDIR:=$PREFIX/etc} +: ${SBINDIR:=$PREFIX/sbin} +: ${LIBEXECDIR:=$PREFIX/libexec/resolvconf} +: ${STATEDIR:=/var} +: ${RUNDIR:=$STATEDIR/run} +: ${MANDIR:=${PREFIX:-/usr}/share/man} + +eval SYSCONFDIR="$SYSCONFDIR" +eval SBINDIR="$SBINDIR" +eval LIBEXECDIR="$LIBEXECDIR" +eval VARDIR="$RUNDIR/resolvconf" +eval MANDIR="$MANDIR" for x in SYSCONFDIR SBINDIR LIBEXECDIR VARDIR MANDIR RESTARTCMD RCDIR STATUSARG do Modified: head/contrib/openresolv/dnsmasq.in ============================================================================== --- head/contrib/openresolv/dnsmasq.in Wed Nov 20 23:49:47 2019 (r354923) +++ head/contrib/openresolv/dnsmasq.in Wed Nov 20 23:56:20 2019 (r354924) @@ -1,5 +1,5 @@ #!/bin/sh -# Copyright (c) 2007-2016 Roy Marples +# Copyright (c) 2007-2019 Roy Marples # All rights reserved # dnsmasq subscriber for resolvconf @@ -28,7 +28,7 @@ [ -f "@SYSCONFDIR@"/resolvconf.conf ] || exit 0 . "@SYSCONFDIR@/resolvconf.conf" || exit 1 -[ -z "$dnsmasq_conf" -a -z "$dnsmasq_resolv" ] && exit 0 +[ -z "${dnsmasq_conf}${dnsmasq_resolv}" ] && exit 0 [ -z "$RESOLVCONF" ] && eval "$(@SBINDIR@/resolvconf -v)" NL=" " @@ -98,7 +98,7 @@ for d in $DOMAINS; do empty=false i=0 IFS=: set -- $n - while [ -n "$1" -o -n "$2" ]; do + while [ -n "$1" ] || [ -n "$2" ]; do addr="$1" shift if [ -z "$addr" ]; then @@ -184,7 +184,7 @@ if $changed; then eval $dnsmasq_restart elif [ -n "$RESTARTCMD" ]; then set -- ${dnsmasq_service} - eval $RESTARTCMD + eval "$RESTARTCMD" else @SBINDIR@/resolvconf -r ${dnsmasq_service} fi @@ -206,4 +206,6 @@ if $dbus; then dbus-send --system --dest=uk.org.thekelleys.dnsmasq \ /uk/org/thekelleys/dnsmasq uk.org.thekelleys.$method \ $dbusdest + dbus-send --system --dest=uk.org.thekelleys.dnsmasq \ + /uk/org/thekelleys/dnsmasq uk.org.thekelleys.ClearCache fi Modified: head/contrib/openresolv/libc.in ============================================================================== --- head/contrib/openresolv/libc.in Wed Nov 20 23:49:47 2019 (r354923) +++ head/contrib/openresolv/libc.in Wed Nov 20 23:56:20 2019 (r354924) @@ -1,5 +1,5 @@ #!/bin/sh -# Copyright (c) 2007-2016 Roy Marples +# Copyright (c) 2007-2019 Roy Marples # All rights reserved # libc subscriber for resolvconf @@ -36,9 +36,9 @@ NL=" # sed may not be available, and this is faster on small files key_get_value() { - local key="$1" x= line= - + key="$1" shift + if [ $# -eq 0 ]; then while read -r line; do case "$line" in @@ -58,8 +58,6 @@ key_get_value() keys_remove() { - local key x line found - while read -r line; do found=false for key do @@ -79,7 +77,7 @@ local_nameservers="127.* 0.0.0.0 255.255.255.255 ::1" if [ -f "$SYSCONFDIR"/resolvconf.conf ]; then . "$SYSCONFDIR"/resolvconf.conf elif [ -d "$SYSCONFDIR"/resolvconf ]; then - SYSCONFDIR="$SYSCONFDIR/resolvconf/resolv.conf.d" + SYSCONFDIR="$SYSCONFDIR/resolvconf" base="$SYSCONFDIR/resolv.conf.d/base" if [ -f "$base" ]; then prepend_nameservers="$(key_get_value "nameserver " "$base")" @@ -98,10 +96,12 @@ fi : ${resolv_conf:=/etc/resolv.conf} : ${libc_service:=nscd} : ${list_resolv:=@SBINDIR@/resolvconf -l} -if [ "${resolv_conf_head-x}" = x -a -f "$SYSCONFDIR"/resolv.conf.head ]; then +if [ "${resolv_conf_head-x}" = x ] && [ -f "$SYSCONFDIR"/resolv.conf.head ] +then resolv_conf_head="$(cat "${SYSCONFDIR}"/resolv.conf.head)" fi -if [ "${resolv_conf_tail-x}" = x -a -f "$SYSCONFDIR"/resolv.conf.tail ]; then +if [ "${resolv_conf_tail-x}" = x ] && [ -f "$SYSCONFDIR"/resolv.conf.tail ] +then resolv_conf_tail="$(cat "$SYSCONFDIR"/resolv.conf.tail)" fi @@ -110,7 +110,7 @@ signature="# Generated by resolvconf" uniqify() { - local result= + result= while [ -n "$1" ]; do case " $result " in *" $1 "*);; @@ -126,7 +126,7 @@ case "${resolv_conf_passthrough:-NO}" in backup=false newest= for conf in "$IFACEDIR"/*; do - if [ -z "$newest" -o "$conf" -nt "$newest" ]; then + if [ -z "$newest" ] || [ "$conf" -nt "$newest" ]; then newest="$conf" fi done @@ -178,7 +178,7 @@ case "${resolv_conf_passthrough:-NO}" in fi [ -n "$domain" ] && newconf="${newconf}domain $domain$NL" - if [ -n "$newsearch" -a "$newsearch" != "$domain" ]; then + if [ -n "$newsearch" ] && [ "$newsearch" != "$domain" ]; then newconf="${newconf}search $newsearch$NL" fi for n in $newns; do @@ -232,7 +232,7 @@ if [ -n "$libc_restart" ]; then eval $libc_restart elif [ -n "$RESTARTCMD" ]; then set -- ${libc_service} - eval $RESTARTCMD + eval "$RESTARTCMD" else @SBINDIR@/resolvconf -r ${libc_service} fi Modified: head/contrib/openresolv/named.in ============================================================================== --- head/contrib/openresolv/named.in Wed Nov 20 23:49:47 2019 (r354923) +++ head/contrib/openresolv/named.in Wed Nov 20 23:56:20 2019 (r354924) @@ -28,14 +28,14 @@ [ -f "@SYSCONFDIR@"/resolvconf.conf ] || exit 0 . "@SYSCONFDIR@/resolvconf.conf" || exit 1 -[ -z "$named_zones" -a -z "$named_options" ] && exit 0 +[ -z "${named_zones}${named_options}" ] && exit 0 [ -z "$RESOLVCONF" ] && eval "$(@SBINDIR@/resolvconf -v)" NL=" " # Platform specific kludges -if [ -z "$named_service" -a -z "$named_restart" -a \ - -d "$RCDIR" -a ! -x "$RCDIR"/named ] +if [ -z "${named_service}${named_restart}" ] && + [ -d "$RCDIR" ] && ! [ -x "$RCDIR"/named ] then if [ -x "$RCDIR"/bind9 ]; then # Debian and derivatives @@ -111,7 +111,7 @@ if $changed; then eval $named_restart elif [ -n "$RESTARTCMD" ]; then set -- ${named_service} - eval $RESTARTCMD + eval "$RESTARTCMD" else @SBINDIR@/resolvconf -r ${named_service} fi Modified: head/contrib/openresolv/pdns_recursor.in ============================================================================== --- head/contrib/openresolv/pdns_recursor.in Wed Nov 20 23:49:47 2019 (r354923) +++ head/contrib/openresolv/pdns_recursor.in Wed Nov 20 23:56:20 2019 (r354924) @@ -1,5 +1,5 @@ #!/bin/sh -# Copyright (c) 2009-2011 Roy Marples +# Copyright (c) 2009-2019 Roy Marples # All rights reserved # PowerDNS Recursor subscriber for resolvconf @@ -33,17 +33,14 @@ NL=" " -: ${pdns_service:=pdns_recursor} +: ${pdns_service:=pdns-recursor} newzones= -# pds_recursor does not present support global forward servers, which -# does limit it's usefulness somewhat. -# If it did, the below code can be enabled, or something like it. -#for n in $NAMESERVERS; do -# newzones="$newzones${newzones:+,}$n" -#done -#[ -n "$newzones" ] && newzones=".=$newzones$NL" +for n in $NAMESERVERS; do + newzones="$newzones${newzones:+,}$n" +done +[ -n "$newzones" ] && newzones="+.=$newzones$NL" for d in $DOMAINS; do newns= @@ -71,7 +68,7 @@ then eval $pdns_restart elif [ -n "$RESTARTCMD" ]; then set -- ${pdns_service} - eval $RESTARTCMD + eval "$RESTARTCMD" else @SBINDIR@/resolvconf -r ${pdns_service} fi Modified: head/contrib/openresolv/pdnsd.in ============================================================================== --- head/contrib/openresolv/pdnsd.in Wed Nov 20 23:49:47 2019 (r354923) +++ head/contrib/openresolv/pdnsd.in Wed Nov 20 23:56:20 2019 (r354924) @@ -1,5 +1,5 @@ #!/bin/sh -# Copyright (c) 2010-2013 Roy Marples +# Copyright (c) 2010-2018 Roy Marples # All rights reserved # pdnsd subscriber for resolvconf @@ -28,7 +28,7 @@ [ -f "@SYSCONFDIR@"/resolvconf.conf ] || exit 0 . "@SYSCONFDIR@/resolvconf.conf" || exit 1 -[ -z "$pdnsd_conf" -a -z "$pdnsd_resolv" ] && exit 0 +[ -z "${pdnsd_conf}${pdnsd_resolv}" ] && exit 0 [ -z "$RESOLVCONF" ] && eval "$(@SBINDIR@/resolvconf -v)" NL=" " @@ -41,14 +41,16 @@ signature_end="# End of resolvconf" # but sed may not always be available at the time. remove_markers() { - local m1="$1" m2="$2" x= line= in_marker=0 + m1="$1" + m2="$2" + in_marker=0 shift; shift if type sed >/dev/null 2>&1; then sed "/^$m1/,/^$m2/d" $@ else - for x; do - while read -r line; do + for x do + while read line; do case "$line" in "$m1"*) in_marker=1;; "$m2"*) in_marker=0;; Modified: head/contrib/openresolv/resolvconf.conf ============================================================================== --- head/contrib/openresolv/resolvconf.conf Wed Nov 20 23:49:47 2019 (r354923) +++ head/contrib/openresolv/resolvconf.conf Wed Nov 20 23:56:20 2019 (r354924) @@ -4,4 +4,4 @@ resolv_conf=/etc/resolv.conf # If you run a local name server, you should uncomment the below line and # configure your subscribers configuration files below. -#name_servers=127.0.0.1 \ No newline at end of file +#name_servers=127.0.0.1 Modified: head/contrib/openresolv/resolvconf.conf.5.in ============================================================================== --- head/contrib/openresolv/resolvconf.conf.5.in Wed Nov 20 23:49:47 2019 (r354923) +++ head/contrib/openresolv/resolvconf.conf.5.in Wed Nov 20 23:56:20 2019 (r354924) @@ -22,7 +22,7 @@ .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" -.Dd December 29, 2016 +.Dd September 8, 2019 .Dt RESOLVCONF.CONF 5 .Os .Sh NAME @@ -64,19 +64,25 @@ Defaults to YES. .It Sy interface_order These interfaces will always be processed first. If unset, defaults to the following:- -.D1 lo lo[0-9]* +.Bd -compact -literal -offset indent +lo lo[0-9]* +.Ed .It Sy dynamic_order These interfaces will be processed next, unless they have a metric. If unset, defaults to the following:- -.D1 tap[0-9]* tun[0-9]* vpn vpn[0-9]* ppp[0-9]* ippp[0-9]* +.Bd -compact -literal -offset indent +tap[0-9]* tun[0-9]* vpn vpn[0-9]* ppp[0-9]* ippp[0-9]* +.Ed .It Sy inclusive_interfaces -Ignore any exlcusive marking for these interfaces. +Ignore any exclusive marking for these interfaces. This is handy when 3rd party integrations force the .Nm resolvconf -x option and you want to disable it easily. .It Sy local_nameservers If unset, defaults to the following:- -.D1 127.* 0.0.0.0 255.255.255.255 ::1 +.Bd -compact -literal -offset indent +127.* 0.0.0.0 255.255.255.255 ::1 +.Ed .It Sy search_domains Prepend search domains to the dynamically generated list. .It Sy search_domains_append @@ -118,16 +124,24 @@ The syntax is this: .Va $keyword Ns / Ns Va $match Ns / Ns Va $replacement .Pp Example, given this resolv.conf: -.D1 domain foo.org -.D1 search foo.org dead.beef -.D1 nameserver 1.2.3.4 -.D1 nameserver 2.3.4.5 +.Bd -compact -literal -offset indent +domain foo.org +search foo.org dead.beef +nameserver 1.2.3.4 +nameserver 2.3.4.5 +.Ed and this configuaration: -.D1 replace="search/foo*/bar.com nameserver/1.2.3.4/5.6.7.8 nameserver/2.3.4.5/" +.Bd -compact -literal -offset indent +replace="search/foo*/bar.com" +replace="$replace nameserver/1.2.3.4/5.6.7.8" +replace="$replace nameserver/2.3.4.5/" +.Ed you would get this resolv.conf instead: -.D1 domain foo.org -.D1 search bar.com -.D1 nameserver 5.6.7.8 +.Bd -compact -literal -offset indent +domain foo.org +search bar.com +nameserver 5.6.7.8 +.Ed .It Sy replace_sub Works the same way as .Sy replace @@ -138,9 +152,11 @@ Using the same example resolv.conf and changing to .Sy replace_sub , you would get this resolv.conf instead: -.D1 domain foo.org -.D1 search bar.com dead.beef -.D1 nameserver 5.6.7.8 +.Bd -compact -literal -offset indent +domain foo.org +search bar.com dead.beef +nameserver 5.6.7.8 +.Ed .It Sy state_dir Override the default state directory of .Pa @VARDIR@ . @@ -195,7 +211,8 @@ Prepend search domains to the dynamically generated li openresolv ships with subscribers for the name servers .Xr dnsmasq 8 , .Xr named 8 , -.Xr pdnsd 8 +.Xr pdnsd 8 , +.Xr pdns_recursor 8 , and .Xr unbound 8 . Each subscriber can create configuration files which should be included in @@ -203,7 +220,9 @@ in the subscribers main configuration file. .Pp To disable a subscriber, simply set it's name to NO. For example, to disable the libc subscriber you would set: -.D1 libc=NO +.Bd -compact -literal -offset indent +libc=NO +.Ed .Bl -tag -width indent .It Sy dnsmasq_conf This file tells dnsmasq which name servers to use for specific domains. @@ -211,17 +230,21 @@ This file tells dnsmasq which name servers to use for This file tells dnsmasq which name servers to use for global lookups. .Pp Example resolvconf.conf for dnsmasq: -.D1 name_servers=127.0.0.1 -.D1 dnsmasq_conf=/etc/dnsmasq-conf.conf -.D1 dnsmasq_resolv=/etc/dnsmasq-resolv.conf +.Bd -compact -literal -offset indent +name_servers=127.0.0.1 +dnsmasq_conf=/etc/dnsmasq-conf.conf +dnsmasq_resolv=/etc/dnsmasq-resolv.conf +.Ed .Pp Example dnsmasq.conf: -.D1 listen-address=127.0.0.1 -.D1 # If dnsmasq is compiled for DBus then we can take -.D1 # advantage of not having to restart dnsmasq. -.D1 enable-dbus -.D1 conf-file=/etc/dnsmasq-conf.conf -.D1 resolv-file=/etc/dnsmasq-resolv.conf +.Bd -compact -literal -offset indent +listen-address=127.0.0.1 +# If dnsmasq is compiled for DBus then we can take +# advantage of not having to restart dnsmasq. +enable-dbus +conf-file=/etc/dnsmasq-conf.conf +resolv-file=/etc/dnsmasq-resolv.conf +.Ed .It Sy named_options Include this file in the named options block. This file tells named which name servers to use for global lookups. @@ -230,16 +253,21 @@ Include this file in the named global scope, after the This file tells named which name servers to use for specific domains. .Pp Example resolvconf.conf for named: -.D1 name_servers=127.0.0.1 -.D1 named_options=/etc/named-options.conf -.D1 named_zones=/etc/named-zones.conf +.Bd -compact -literal -offset indent +name_servers=127.0.0.1 +named_options=/etc/named-options.conf +named_zones=/etc/named-zones.conf +.Ed .Pp Example named.conf: -.D1 options { -.D1 listen-on { 127.0.0.1; }; -.D1 include "/etc/named-options.conf"; -.D1 }; -.D1 include "/etc/named-zones.conf"; +.Bd -compact -literal -offset indent +options { + listen-on { 127.0.0.1; }; + include "/etc/named-options.conf"; +}; + +include "/etc/named-zones.conf"; +.Ed .It Sy pdnsd_conf This is the main pdnsd configuration file which we modify to add our forward domains to. @@ -253,32 +281,54 @@ If this variable is not set then it's written to .Pa pdnsd_conf . .Pp Example resolvconf.conf for pdnsd: -.D1 name_servers=127.0.0.1 -.D1 pdnsd_conf=/etc/pdnsd.conf -.D1 # pdnsd_resolv=/etc/pdnsd-resolv.conf +.Bd -compact -literal -offset indent +name_servers=127.0.0.1 +pdnsd_conf=/etc/pdnsd.conf +# pdnsd_resolv=/etc/pdnsd-resolv.conf +.Ed .Pp Example pdnsd.conf: -.D1 global { -.D1 server_ip = 127.0.0.1; -.D1 status_ctl = on; -.D1 } -.D1 server { -.D1 # A server definition is required, even if emtpy. -.D1 label="empty"; -.D1 proxy_only=on; -.D1 # file="/etc/pdnsd-resolv.conf"; -.D1 } +.Bd -compact -literal -offset indent +global { + server_ip = 127.0.0.1; + status_ctl = on; +} +server { + # A server definition is required, even if empty. + label="empty"; + proxy_only=on; + # file="/etc/pdnsd-resolv.conf"; +} +.Ed +.It Sy pdns_zones +This file tells pdns_recursor about specific and global name servers. +.Pp +Example resolvconf.conf for pdns_recursor: +.Bd -compact -literal -offset indent +name_servers=127.0.0.1 +pdns_zones=/etc/pdns/recursor-zones.conf +.Ed +.Pp +Example recursor.conf: +.Bd -compact -literal -offset indent +allow-from=127.0.0.0/8, ::1/128 +forward-zones-file=/etc/pdns/recursor-zones.conf +.Ed .It Sy unbound_conf This file tells unbound about specific and global name servers. .It Sy unbound_insecure When set to YES, unbound marks the domains as insecure, thus ignoring DNSSEC. .Pp Example resolvconf.conf for unbound: -.D1 name_servers=127.0.0.1 -.D1 unbound_conf=/etc/unbound-resolvconf.conf +.Bd -compact -literal -offset indent +name_servers=127.0.0.1 +unbound_conf=/etc/unbound-resolvconf.conf +.Ed .Pp Example unbound.conf: -.D1 include: /etc/unbound-resolvconf.conf +.Bd -compact -literal -offset indent +include: /etc/unbound-resolvconf.conf +.Ed .El .Sh SUBSCRIBER INTEGRATION Not all distributions store the files the subscribers need in the same @@ -292,7 +342,6 @@ Also, users could equally want to use a different vers installed by default, such as bind8 and bind9. To accommodate this, the subscribers have these files in configurable variables, documented below. -.Pp .Bl -tag -width indent .It Sy dnsmasq_service Name of the dnsmasq service. @@ -310,6 +359,10 @@ Name of the named service. Command to restart the named service. .It Sy pdnsd_restart Command to restart the pdnsd service. +.It Sy pdns_service +Command to restart the pdns_recursor service. +.It Sy pdns_restart +Command to restart the pdns_recursor service. .It Sy unbound_service Name of the unbound service. .It Sy unbound_restart Modified: head/contrib/openresolv/resolvconf.in ============================================================================== --- head/contrib/openresolv/resolvconf.in Wed Nov 20 23:49:47 2019 (r354923) +++ head/contrib/openresolv/resolvconf.in Wed Nov 20 23:56:20 2019 (r354924) @@ -1,5 +1,5 @@ #!/bin/sh -# Copyright (c) 2007-2016 Roy Marples +# Copyright (c) 2007-2019 Roy Marples # All rights reserved # Redistribution and use in source and binary forms, with or without @@ -25,7 +25,7 @@ # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. RESOLVCONF="$0" -OPENRESOLV_VERSION="3.9.0" +OPENRESOLV_VERSION="3.9.2" SYSCONFDIR=@SYSCONFDIR@ LIBEXECDIR=@LIBEXECDIR@ VARDIR=@VARDIR@ @@ -125,21 +125,22 @@ usage() # If you think otherwise, capture a DNS trace and you'll see libc # will strip it regardless. # This also solves setting up duplicate zones in our subscribers. -strip_trailing_dots() +# Also strip any comments denoted by #. +resolv_strip() { - local n= d= - - for n; do - printf "$d%s" "${n%.}" - d=" " + space= + for word; do + case "$word" in + \#*) break;; + esac + printf "%s%s" "$space${word%.}" + space=" " done printf "\n" } private_iface() { - local p - # Allow expansion cd "$IFACEDIR" @@ -168,12 +169,15 @@ private_iface() # for domain name servers, search name servers and global nameservers parse_resolv() { - local line= ns= ds= search= d= n= newns= - local new=true iface= private=false p= domain= l= islocal= - + domain= + new=true newns= + ns= + private=false + search= while read -r line; do + stripped_line="$(resolv_strip ${line#* })" case "$line" in "# resolv.conf from "*) if ${new}; then @@ -189,29 +193,32 @@ parse_resolv() "nameserver "*) islocal=false for l in $local_nameservers; do - case "${line#* }" in + case "$stripped_line" in $l) islocal=true - echo "LOCALNAMESERVERS=\"\$LOCALNAMESERVERS ${line#* }\"" break ;; esac done - $islocal || ns="$ns${line#* } " + if $islocal; then + echo "LOCALNAMESERVERS=\"\$LOCALNAMESERVERS $stripped_line\"" + else + ns="$ns$stripped_line " + fi ;; "domain "*) - search="$(strip_trailing_dots ${line#* })" + search="$stripped_line" if [ -z "$domain" ]; then domain="$search" echo "DOMAIN=\"$domain\"" fi ;; "search "*) - search="$(strip_trailing_dots ${line#* })" + search="$stripped_line" ;; *) [ -n "$line" ] && continue - if [ -n "$ns" -a -n "$search" ]; then + if [ -n "$ns" ] && [ -n "$search" ]; then newns= for n in $ns; do newns="$newns${newns:+,}$n" @@ -236,7 +243,7 @@ parse_resolv() uniqify() { - local result= + result= while [ -n "$1" ]; do case " $result " in *" $1 "*);; @@ -249,8 +256,8 @@ uniqify() dirname() { - local dir= OIFS="$IFS" - local IFS=/ + OIFS="$IFS" + IFS=/ set -- $@ IFS="$OIFS" if [ -n "$1" ]; then @@ -267,7 +274,7 @@ dirname() config_mkdirs() { - local e=0 f d + e=0 for f; do [ -n "$f" ] || continue d="$(dirname "$f")" @@ -295,66 +302,86 @@ detect_init() # Detect the running init system. # As systemd and OpenRC can be installed on top of legacy init # systems we try to detect them first. - local status="@STATUSARG@" + status="@STATUSARG@" : ${status:=status} - if [ -x /bin/systemctl -a -S /run/systemd/private ]; then - RESTARTCMD="if /bin/systemctl --quiet is-active \$1.service; then - /bin/systemctl restart \$1.service; -fi" - elif [ -x /usr/bin/systemctl -a -S /run/systemd/private ]; then - RESTARTCMD="if /usr/bin/systemctl --quiet is-active \$1.service; then - /usr/bin/systemctl restart \$1.service; -fi" - elif [ -x /sbin/rc-service -a \ - -s /libexec/rc/init.d/softlevel -o -s /run/openrc/softlevel ] + if [ -x /bin/systemctl ] && [ -S /run/systemd/private ]; then + RESTARTCMD=' + if /bin/systemctl --quiet is-active $1.service + then + /bin/systemctl restart $1.service + fi' + elif [ -x /usr/bin/systemctl ] && [ -S /run/systemd/private ]; then + RESTARTCMD=' + if /usr/bin/systemctl --quiet is-active $1.service + then + /usr/bin/systemctl restart $1.service + fi' + elif [ -x /sbin/rc-service ] && + { [ -s /libexec/rc/init.d/softlevel ] || + [ -s /run/openrc/softlevel ]; } then - RESTARTCMD="/sbin/rc-service -i \$1 -- -Ds restart" + RESTARTCMD='/sbin/rc-service -i $1 -- -Ds restart' elif [ -x /usr/sbin/invoke-rc.d ]; then RCDIR=/etc/init.d - RESTARTCMD="if /usr/sbin/invoke-rc.d --quiet \$1 status 1>/dev/null 2>&1; then - /usr/sbin/invoke-rc.d \$1 restart; -fi" + RESTARTCMD=' + if /usr/sbin/invoke-rc.d --quiet $1 status >/dev/null 2>&1 + then + /usr/sbin/invoke-rc.d $1 restart + fi' elif [ -x /sbin/service ]; then # Old RedHat RCDIR=/etc/init.d - RESTARTCMD="if /sbin/service \$1; then - /sbin/service \$1 restart; -fi" + RESTARTCMD=' + if /sbin/service $1; then + /sbin/service $1 restart + fi' elif [ -x /usr/sbin/service ]; then # Could be FreeBSD - RESTARTCMD="if /usr/sbin/service \$1 $status 1>/dev/null 2>&1; then - /usr/sbin/service \$1 restart; -fi" + RESTARTCMD=" + if /usr/sbin/service \$1 $status >/dev/null 2>&1 + then + /usr/sbin/service \$1 restart + fi" elif [ -x /bin/sv ]; then - RESTARTCMD="/bin/sv status \$1 >/dev/null 2>&1 && /bin/sv try-restart \$1" + RESTARTCMD='/bin/sv status $1 >/dev/null 2>&1 && + /bin/sv try-restart $1' elif [ -x /usr/bin/sv ]; then - RESTARTCMD="/usr/bin/sv status \$1 >/dev/null 2>&1 && /usr/bin/sv try-restart \$1" - elif [ -e /etc/arch-release -a -d /etc/rc.d ]; then *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-all@freebsd.org Wed Nov 20 23:58:37 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 5979A1C621D; Wed, 20 Nov 2019 23:58:37 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47JKQj1pH4z4Y0R; Wed, 20 Nov 2019 23:58:37 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 21657284E; Wed, 20 Nov 2019 23:58:37 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xAKNwbbI045156; Wed, 20 Nov 2019 23:58:37 GMT (envelope-from imp@FreeBSD.org) Received: (from imp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xAKNwaUP045154; Wed, 20 Nov 2019 23:58:36 GMT (envelope-from imp@FreeBSD.org) Message-Id: <201911202358.xAKNwaUP045154@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: imp set sender to imp@FreeBSD.org using -f From: Warner Losh Date: Wed, 20 Nov 2019 23:58:36 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354925 - head/usr.sbin/efibootmgr X-SVN-Group: head X-SVN-Commit-Author: imp X-SVN-Commit-Paths: head/usr.sbin/efibootmgr X-SVN-Commit-Revision: 354925 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 20 Nov 2019 23:58:37 -0000 Author: imp Date: Wed Nov 20 23:58:36 2019 New Revision: 354925 URL: https://svnweb.freebsd.org/changeset/base/354925 Log: Add --esp/-E argument to print the currently booted ESP Add code to decode the BootCurrent and BootXXXX variable it points at to deduce the ESP used to boot the system. By default, it prints the path to that device. With --unix-path (-p) it will instead print the current mount point for the ESP, if any (or an error). With --device-path (-d) it wil print the UEFI device path for the ESP. Note: This is the best guess based on the UEFI variables. If the ESP is part of a gmirror, etc, that won't be reported. If by some weird chance there was a complicated series of chain boots, this may not be what you want. For setups that don't add layers on top of the raw devices, it is accurate. Differential Revision: https://reviews.freebsd.org/D22432 Modified: head/usr.sbin/efibootmgr/efibootmgr.8 head/usr.sbin/efibootmgr/efibootmgr.c Modified: head/usr.sbin/efibootmgr/efibootmgr.8 ============================================================================== --- head/usr.sbin/efibootmgr/efibootmgr.8 Wed Nov 20 23:56:20 2019 (r354924) +++ head/usr.sbin/efibootmgr/efibootmgr.8 Wed Nov 20 23:58:36 2019 (r354925) @@ -49,7 +49,12 @@ .Op Fl b Ar bootnum .Op Fl k Ar kernel .Op Fl L Ar label +.Op Fl e Ar env .Nm +.Fl E +.Op Fl d +.Op Fl p +.Nm .Fl n .Fl b Ar bootnum .Nm @@ -111,6 +116,21 @@ Create a new variable. .It Fl D -dry-run Process but do not change any variables. +.It Fl E -esp +Print the +.Fx +path to the ESP device, derived from the EFI variables +.Va BootCurrent +and +.Va BootXXXX . +This is the ESP partition used by UEFI to boot the current +instance of the system. +If +.Fl d -device-path +is specified, the UEFI device path to the ESP is reported instead. +If +.Fl p -unix-path +is specified, the mount point of the ESP is reported instead. .It Fl k -kernel Ar kernel The path to and name of the kernel. .It Fl l -loader Ar loader Modified: head/usr.sbin/efibootmgr/efibootmgr.c ============================================================================== --- head/usr.sbin/efibootmgr/efibootmgr.c Wed Nov 20 23:56:20 2019 (r354924) +++ head/usr.sbin/efibootmgr/efibootmgr.c Wed Nov 20 23:58:36 2019 (r354925) @@ -81,6 +81,8 @@ typedef struct _bmgr_opts { bool delete_bootnext; bool del_timeout; bool dry_run; + bool device_path; + bool esp_device; bool has_bootnum; bool once; int cp_src; @@ -89,6 +91,7 @@ typedef struct _bmgr_opts { bool set_inactive; bool set_timeout; int timeout; + bool unix_path; bool verbose; } bmgr_opts_t; @@ -103,14 +106,17 @@ static struct option lopts[] = { {"del-timout", no_argument, NULL, 'T'}, {"delete", no_argument, NULL, 'B'}, {"delete-bootnext", no_argument, NULL, 'N'}, + {"device-path", no_argument, NULL, 'd'}, {"dry-run", no_argument, NULL, 'D'}, {"env", required_argument, NULL, 'e'}, + {"esp", no_argument, NULL, 'E'}, {"help", no_argument, NULL, 'h'}, {"kernel", required_argument, NULL, 'k'}, {"label", required_argument, NULL, 'L'}, {"loader", required_argument, NULL, 'l'}, {"once", no_argument, NULL, 'O'}, {"set-timeout", required_argument, NULL, 't'}, + {"unix-path", no_argument, NULL, 'p'}, {"verbose", no_argument, NULL, 'v'}, { NULL, 0, NULL, 0} }; @@ -191,7 +197,7 @@ parse_args(int argc, char *argv[]) { int ch; - while ((ch = getopt_long(argc, argv, "AaBb:C:cDe:hk:L:l:NnOo:Tt:v", + while ((ch = getopt_long(argc, argv, "AaBb:C:cdDe:Ehk:L:l:NnOo:pTt:v", lopts, NULL)) != -1) { switch (ch) { case 'A': @@ -216,10 +222,16 @@ parse_args(int argc, char *argv[]) case 'D': /* should be remove dups XXX */ opts.dry_run = true; break; + case 'd': + opts.device_path = true; + break; case 'e': free(opts.env); opts.env = strdup(optarg); break; + case 'E': + opts.esp_device = true; + break; case 'h': default: errx(1, "%s", USAGE); @@ -250,6 +262,9 @@ parse_args(int argc, char *argv[]) free(opts.order); opts.order = strdup(optarg); break; + case 'p': + opts.unix_path = true; + break; case 'T': opts.del_timeout = true; break; @@ -906,6 +921,72 @@ handle_timeout(int to) errx(1, "Can't set Timeout for booting."); } +static void +report_esp_device(bool do_dp, bool do_unix) +{ + uint8_t *data; + size_t size, len; + uint32_t attrs; + int ret; + uint16_t current, fplen; + char *name, *dev, *relpath, *abspath; + uint8_t *walker, *ep; + efi_char *descr; + efidp dp, edp; + char buf[PATH_MAX]; + + if (do_dp && do_unix) + errx(1, "Can't report both UEFI device-path and Unix path together"); + + ret = efi_get_variable(EFI_GLOBAL_GUID, "BootCurrent", &data, &size,&attrs); + if (ret < 0) + err(1, "Can't get BootCurrent"); + current = le16dec(data); + if (asprintf(&name, "Boot%04X", current) < 0) + err(1, "Can't format boot var\n"); + if (efi_get_variable(EFI_GLOBAL_GUID, name, &data, &size, NULL) < 0) + err(1, "Can't retrieve EFI var %s", name); + // First 4 bytes are attribute flags + walker = data; + ep = walker + size; + walker += sizeof(uint32_t); + // Next two bytes are length of the file paths + fplen = le16dec(walker); + walker += sizeof(fplen); + // Next we have a 0 terminated UCS2 string that we know to be aligned + descr = (efi_char *)(intptr_t)(void *)walker; + len = ucs2len(descr); // XXX need to sanity check that len < (datalen - (ep - walker) / 2) + walker += (len + 1) * sizeof(efi_char); + if (walker > ep) + errx(1, "malformed boot variable %s", name); + // Now we have fplen bytes worth of file path stuff + dp = (efidp)walker; + walker += fplen; + edp = (efidp)walker; + if (walker > ep) + errx(1, "malformed boot variable %s", name); + if (do_dp) { + efidp_format_device_path_node(buf, sizeof(buf), dp); + printf("%s\n", buf); + exit(0); + } + if (efivar_device_path_to_unix_path(dp, &dev, &relpath, &abspath) < 0) + errx(1, "Can't convert to unix path"); + if (do_unix) { + if (abspath == NULL) + errx(1, "Can't find where %s:%s is mounted", + dev, relpath); + abspath[strlen(abspath) - strlen(relpath) - 1] = '\0'; + printf("%s\n", abspath); + } else { + printf("%s\n", dev); + } + free(dev); + free(relpath); + free(abspath); + exit(0); +} + int main(int argc, char *argv[]) { @@ -938,6 +1019,8 @@ main(int argc, char *argv[]) delete_timeout(); else if (opts.set_timeout) handle_timeout(opts.timeout); + else if (opts.esp_device) + report_esp_device(opts.device_path, opts.unix_path); print_boot_vars(opts.verbose); } From owner-svn-src-all@freebsd.org Thu Nov 21 00:17:15 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 546A01C6BD9; Thu, 21 Nov 2019 00:17:15 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47JKrC1bWrz4Z7C; Thu, 21 Nov 2019 00:17:15 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 180C02C0F; Thu, 21 Nov 2019 00:17:15 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xAL0HEvE056822; Thu, 21 Nov 2019 00:17:14 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xAL0HEaU056821; Thu, 21 Nov 2019 00:17:14 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201911210017.xAL0HEaU056821@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Thu, 21 Nov 2019 00:17:14 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354926 - head/usr.sbin/rtsold X-SVN-Group: head X-SVN-Commit-Author: markj X-SVN-Commit-Paths: head/usr.sbin/rtsold X-SVN-Commit-Revision: 354926 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 21 Nov 2019 00:17:15 -0000 Author: markj Date: Thu Nov 21 00:17:14 2019 New Revision: 354926 URL: https://svnweb.freebsd.org/changeset/base/354926 Log: Avoid relying on pollution from libcasper.h. Reported by: sjg Sponsored by: The FreeBSD Foundation Modified: head/usr.sbin/rtsold/cap_llflags.c Modified: head/usr.sbin/rtsold/cap_llflags.c ============================================================================== --- head/usr.sbin/rtsold/cap_llflags.c Wed Nov 20 23:58:36 2019 (r354925) +++ head/usr.sbin/rtsold/cap_llflags.c Thu Nov 21 00:17:14 2019 (r354926) @@ -44,6 +44,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include From owner-svn-src-all@freebsd.org Thu Nov 21 00:34:41 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 2D5ED1C719D; Thu, 21 Nov 2019 00:34:41 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47JLDK18B9z4Zqt; Thu, 21 Nov 2019 00:34:41 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 09E202F98; Thu, 21 Nov 2019 00:34:41 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xAL0Yes7068457; Thu, 21 Nov 2019 00:34:40 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xAL0YeFW068452; Thu, 21 Nov 2019 00:34:40 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201911210034.xAL0YeFW068452@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Thu, 21 Nov 2019 00:34:40 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r354927 - in stable/12: share/man/man4 sys/conf sys/contrib/dev/iwm sys/dev/iwm sys/modules/iwm sys/modules/iwmfw sys/modules/iwmfw/iwm9000fw sys/modules/iwmfw/iwm9260fw X-SVN-Group: stable-12 X-SVN-Commit-Author: markj X-SVN-Commit-Paths: in stable/12: share/man/man4 sys/conf sys/contrib/dev/iwm sys/dev/iwm sys/modules/iwm sys/modules/iwmfw sys/modules/iwmfw/iwm9000fw sys/modules/iwmfw/iwm9260fw X-SVN-Commit-Revision: 354927 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 21 Nov 2019 00:34:41 -0000 Author: markj Date: Thu Nov 21 00:34:39 2019 New Revision: 354927 URL: https://svnweb.freebsd.org/changeset/base/354927 Log: MFC r354201, r354276, r354492-r354517, r354562: Add firmware images and support for Intel 9000-series devices. Added: stable/12/sys/contrib/dev/iwm/iwm-9000-34.fw.uu - copied unchanged from r354276, head/sys/contrib/dev/iwm/iwm-9000-34.fw.uu stable/12/sys/contrib/dev/iwm/iwm-9260-34.fw.uu - copied unchanged from r354276, head/sys/contrib/dev/iwm/iwm-9260-34.fw.uu stable/12/sys/dev/iwm/if_iwm_9000.c - copied, changed from r354504, head/sys/dev/iwm/if_iwm_9000.c stable/12/sys/dev/iwm/if_iwm_9260.c - copied, changed from r354504, head/sys/dev/iwm/if_iwm_9260.c stable/12/sys/modules/iwmfw/iwm9000fw/ - copied from r354201, head/sys/modules/iwmfw/iwm9000fw/ stable/12/sys/modules/iwmfw/iwm9260fw/ - copied from r354201, head/sys/modules/iwmfw/iwm9260fw/ Modified: stable/12/share/man/man4/iwm.4 stable/12/share/man/man4/iwmfw.4 stable/12/sys/conf/files stable/12/sys/dev/iwm/if_iwm.c stable/12/sys/dev/iwm/if_iwm_config.h stable/12/sys/dev/iwm/if_iwm_pcie_trans.c stable/12/sys/dev/iwm/if_iwm_pcie_trans.h stable/12/sys/dev/iwm/if_iwm_scan.c stable/12/sys/dev/iwm/if_iwm_sta.c stable/12/sys/dev/iwm/if_iwmreg.h stable/12/sys/dev/iwm/if_iwmvar.h stable/12/sys/modules/iwm/Makefile stable/12/sys/modules/iwmfw/Makefile stable/12/sys/modules/iwmfw/iwm9000fw/Makefile stable/12/sys/modules/iwmfw/iwm9260fw/Makefile Directory Properties: stable/12/ (props changed) Modified: stable/12/share/man/man4/iwm.4 ============================================================================== --- stable/12/share/man/man4/iwm.4 Thu Nov 21 00:17:14 2019 (r354926) +++ stable/12/share/man/man4/iwm.4 Thu Nov 21 00:34:39 2019 (r354927) @@ -25,7 +25,7 @@ .\" .\" $FreeBSD$ .\" -.Dd October 29, 2017 +.Dd November 7, 2019 .Dt IWM 4 .Os .Sh NAME @@ -51,6 +51,8 @@ Choose one from: .Cd "device iwm7265fw" .Cd "device iwm8000Cfw" .Cd "device iwm8265fw" +.Cd "device iwm9000fw" +.Cd "device iwm9260fw" .Ed .Pp Or you can use @@ -71,6 +73,8 @@ iwm7260fw_load="YES" iwm7265fw_load="YES" iwm8000Cfw_load="YES" iwm8265fw_load="YES" +iwm9000fw_load="YES" +iwm9260fw_load="YES" .Ed .Sh DESCRIPTION The @@ -84,6 +88,10 @@ driver provides support for: .It Intel Dual Band Wireless AC 7260 .It Intel Dual Band Wireless AC 7265 .It Intel Dual Band Wireless AC 8260 +.It Intel Dual Band Wireless AC 9260 +.It Intel Dual Band Wireless AC 9270 +.It Intel Dual Band Wireless AC 946X +.It Intel Dual Band Wireless AC 9560 .El .Pp .Nm Modified: stable/12/share/man/man4/iwmfw.4 ============================================================================== --- stable/12/share/man/man4/iwmfw.4 Thu Nov 21 00:17:14 2019 (r354926) +++ stable/12/share/man/man4/iwmfw.4 Thu Nov 21 00:34:39 2019 (r354927) @@ -22,7 +22,7 @@ .\" .\" $FreeBSD$ .\" -.Dd October 29, 2017 +.Dd November 7, 2019 .Dt IWMFW 4 .Os .Sh NAME @@ -48,10 +48,12 @@ of the following: .Cd "device iwm7265fw" .Cd "device iwm8000Cfw" .Cd "device iwm8265fw" +.Cd "device iwm9000fw" +.Cd "device iwm9260fw" .Ed .Pp Alternatively, to load the driver as a -module at boot time, place the following line in +module at boot time, place one of the following lines in .Xr loader.conf 5 : .Bd -literal -offset indent iwm3160fw_load="YES" @@ -61,13 +63,14 @@ iwm7265fw_load="YES" iwm7265Dfw_load="YES" iwm8000Cfw_load="YES" iwm8265fw_load="YES" +iwm9000fw_load="YES" +iwm9260fw_load="YES" .Ed .Sh DESCRIPTION This module provides access to firmware sets for the -Intel Dual Band Wireless WiFi 3160, 3165, 3168, 7260, 7265, 8000, and 8260 series of -IEEE 802.11n/11ac adapters. -It may be -statically linked into the kernel, or loaded as a module. +Intel Dual Band Wireless WiFi 3160, 3165, 3168, 7260, 7265, 8000, 8260, +9000 and 9260 series of IEEE 802.11n/11ac adapters. +It may be statically linked into the kernel, or loaded as a module. .Sh SEE ALSO .Xr iwm 4 , .Xr firmware 9 Modified: stable/12/sys/conf/files ============================================================================== --- stable/12/sys/conf/files Thu Nov 21 00:17:14 2019 (r354926) +++ stable/12/sys/conf/files Thu Nov 21 00:34:39 2019 (r354927) @@ -1989,6 +1989,8 @@ iwi_monitor.fw optional iwimonitorfw | iwifw \ dev/iwm/if_iwm.c optional iwm dev/iwm/if_iwm_7000.c optional iwm dev/iwm/if_iwm_8000.c optional iwm +dev/iwm/if_iwm_9000.c optional iwm +dev/iwm/if_iwm_9260.c optional iwm dev/iwm/if_iwm_binding.c optional iwm dev/iwm/if_iwm_fw.c optional iwm dev/iwm/if_iwm_led.c optional iwm Copied: stable/12/sys/contrib/dev/iwm/iwm-9000-34.fw.uu (from r354276, head/sys/contrib/dev/iwm/iwm-9000-34.fw.uu) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/12/sys/contrib/dev/iwm/iwm-9000-34.fw.uu Thu Nov 21 00:34:39 2019 (r354927, copy of r354276, head/sys/contrib/dev/iwm/iwm-9000-34.fw.uu) @@ -0,0 +1,59521 @@ +begin 644 iwm-9000-34.fw.uu +M`````$E73`I.+W)E;&5A````"`````````!_,\^='@````@````!```` +M9@(``!X````(`````@```-]N$P`>````"`````,`````````'````!`````` +M````````````````````&P````0````"````(`````0`````L`,`,P````P` +M``````````"```"``0`S````#`````$``````(@``(```#,````,`````@`` +M````0```\`@`$P```+P"````0$``!@```*$```````$``````(:````H`A@@ +M!N0!`$````!``````0```!$;4+H````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````=MVF>*UJ,X$=>E_#W#VH;^Y5X_")L7/N5&48I:=UN +M=OPMR]FQQ%&!P_PF,A#PO7[_+OHX#*W0W$5"LNL7A_V-1"Y%N?O6$_R?,_,Q +MH7!AQ7JCM2"8+L(&I4Q2(YO'@MBVP2/M6BT*$ +MWS3'.%W">-0+NW6P<'ZIQ_]GT*9T>$%]>%ZQ9J`9P0 +MD=26W:3.O3:.C=I+DJBO!S/(O!91O.M[V6-#)B#L6&0TXBL7=G +M9X@.6_26K`M&JWRN,LXA-S@-"P]LO+"VZ$AKL6>KEOQ4%O13B:NU[Q46=^"W +M53'<&XEQ<\.SX^^YYN:99<,S0`\/ST$+DA.L\KJVKUNMF*Y1IVLR!9IWZ@N^ +M>TMC(Y6^OR01P3]2J%J%:MSKO&%[-JGYNT7L'FGZ:NI0O'"/,A.C%?92ZZ:< +MPL==[*>`XX"8_;]G*S4?%%(NAS/M"!;>H?\0=P!&(!^$8'P`( +M8@``&R4!`!LD```%)0$`!20`"`4Y`0`%8H@@P!$"``4D``@%.0$`!6*,(,`1 +M!``%)``(!3D!``5BD"#`$0@`!20`"`4Y`0`%8I0@P!$0``4D``@%.0$`!6*8 +M(,`1(``%)``(!3D!``5BG"#`$4``!20`"`4Y`0`%8J`@P!$```@E```()(@' +MX1F$!^$9/`?`$@$`&W`#``!AZ!W`$!``&S#H'<`1+`?`$@$`&W`%``!A#QP= +M(@0`'2;H'<`0`0`;,.@=P!&V#P!A```;)(``&R7D'<`1"`!?<`D``&'0!L`2 +M``D;*,P&@($``,`7U`;`$@`)&RC(!H"!``#`%Z@/`&',!L`2X`:`@0``P!?( +M!L`2W`:`@0``P!>A#P!A```;)``!&R7D'<`1"`!?<)P/`&$```4EX@0%)-0& +MP!(`"1LH``4;*=P&@($``,`7T`;`$@`)&R@`!1LIX`:`@0``P!>/#P!A```; +M)``"&R7D'<`1"`!?<`P``&'8'<`0__\;,]@=P!'.[@TE@ID-)`\--R)L(,`0 +M#QLW(O__#24._PTD#PTW(GX/`&'8'<`0```;,=@=P!'.[@TE@ID-)`\--R)L +M(,`0#QLW(O__#26._PTD#PTW(G(/`&$```!A```;(S@XP!$```!AW!W`$``` +M'20````A`0`3(P3\S1$#`!,D!"#,$>P*P!),(@=P!#F_Q,R__\3,^@=P!$```$D"``!)0\!8R(!`%(D"``';@(` +M`&$``!4D````(0X``&'H'<`0$/@!)/__`24``1,Y#Q,!(BP'P!(``1,XZ!W` +M$0$`4B1X1<`0`0`3<`(``&$(`&0QX0\`8>0*P!(!`!-N1@``8<[N#24!@`TD +M#PTW(@]<-R(L#("!``#`%@8!$V($",`0!``39`]<`"(*``!```8``*P!(``,T1 +M#TT3(@00Q1$"`!,D\!S`$0$`$R3L',`1```3)'``$R40',`1```3(^`[[ZMWN^^K=[O +MOJW>[[ZMWN^^K=[OOJW>[[ZMWN^^K=[OOJW>```````````````````````` +M````````````````````````X@0``-`'``````````````$!`0$!`0$!O1\` +M`&,N``#_____``````````````````````(`````````,@`````````````` +M```````````(```````````````````````````````````````````````` +M`````````````````````````````````````````````````````0`````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````S +M$`(`$1`````````````````@```````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M`````$0`@``````````````````````````````````\#(`````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M`````````````````````````````````````````#0XL+ +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M````````````````````````````````````V'D```4```($````\$Z````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M````````@``````````````````````````````````````````````````` +M``````````````````````````````````````````````````9D```````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M``````````````````````````````````````````````````````````IQ +MR;Z\```````````````````````````````````````````````````````` +M`````````````````/]_````````_W\```````#_?P```````/]_```````` +M_W\```````#_?P```````/]_````````_W\```````#_?P````#_?P`````` +M``````````$```````````````````````````````8``````````````"3@ +M@-(5T@S2%=$3T1+1$-(1TA31@](0T1'1"1$1$0[2`.`!T!+2$])0T`1#`40/ +MT`""(($IX`;0`````#\`/P``````/P`_```````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M``````````````"8'@````"<'@````"D'@````"H'@````#`'@````"X'@`` +M``"\'@``````'0`````@'0````!`'0````!@'0````"`'0````"@'0````#` +M'0````#@'0`````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M````````````````````````````````````````````````````````$`@` +M``#_`P#L"0```/\%`'`(````_RT`3`@```#_/0"X!P```/\$`-P'````_R4` +M,`@```#_/``8R````/_=```)````_TP`U`D```#_(@"4"````/\F`'0)```` +M_R@`],<````@``#X!P```/\'`"@)````_R`````````````````````````` +M```````````````````````````````````````````````````````````` +M`````````````0````$````````````````````````````````````````` +M``````````````````````````````````````````````````````$````" +M`````P````````#_````_P```/\```#_```````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M``````````````````````````````````````````````````!,"*``2`B@ +M`$0(H`"0"8`````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M``````````````````````````````````````````````````````````\` +M#P`/``\`#P`/``\`#P`````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M`````````````````)@`````!)@`````*)@`````+)@`````#)@`````()@` +M`````0`````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````@```````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````!``$``````,``D`#0```````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M````````````0$(/`,#&+0`#S@,4`P```````````````````)!9`0`%```` +M`````/!.@`````````````````"L6`$`!0````````#P3H``D%D!`*Q8`0`< +M60$`J%@!`.18`0`````````````````````````````````````````````` +M```````````````````!_P`````````````````````````````````````` +M`````````````?\```````````````````````````````````D````-```` +M```````````````````````````````````````````````````````````` +M``````````'_```````````````````````````````````````````````` +M```!_P``````````````````````````````````"0````T````````````` +M```````````````````````````````````````````````````````````` +M`?\```````````````````````````````````````````````````'_```` +M```````````````````````````````)````#0`````````````````````` +M```````````````````````````````````````````````````!_P`````` +M`````````````````````````````````````````````?\````````````` +M``````````````````````D````-````````````````````!`````````#_ +M____6!&`````````````````````````$````-````!`````P`````````!@ +M`@``X`(``-`!``"``0``@````$````!@`````````*`!``#@`@``T`$`@``` +M```````````````````"````````````````````_P``````````@``````` +M_P```````````@```````````````````/\``````````(```````/\````` +M``````(```````````````````#_``````````"```````#_```````````" +M````````````````````_P``````````@```````_P```````````@`````` +M`````````````/\``````````(```````/\```````````(````````````` +M``````#_``````````"```````#_```````````"```````````````````` +M_P``````````@```````_P```````````@```````````````````/\````` +M`````(```````/\```````````(```````````````````#_``````````"` +M``````#_```````````"````````````````````_P``````````@``````` +M_P```````````@```````````````````/\``````````(```````/\````` +M``````(```````````````````#_``````````"```````#_```````````" +M````````````````````_P``````````@```````_P```````````@`````` +M`````````````/\``````````(```````/\```````````(````````````` +M``````#_``````````"```````#_```````````"```````````````````` +M_P``````````@```````_P`````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````8(*``'""@`"@@H``L(*`` +M.""@`"`@H``D(*``,""@`#0@H``\(*``0"&@`$0AH`!H(:``;"&@`'@AH`!( +M(:``3"&@`'`AH`!T(:``?"&@````````````_P`````````````````````` +M``#_`````````````````````````/\`````````````````````````_P`` +M``````````````````````````````````````````````````````!$(``` +M!0````0```#P3H``\$Z``/!.@`"`(:``M""@`&P@H```,````'`````````` +M````%$^``!1/@`"`(:``I""@`#@@H``!````!P``````````````.$^``#A/ +M@`"`(:``J""@`#P@H``0````.```````````````7$^``%Q/@`"`(:``K""@ +M`'@AH`!``0``P`$`````````````@$^``(!/@`"`(:``L""@`'PAH```#``` +M``X`````````````_P```/\````````````````````````````````````` +M````````````````````````````````````````````````````_P`````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M``#__P``__\````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M````````````````````````````````````````'``P`#``(``4``P`!H`! +M``(`"(````````````L`(``@``L`"P`+``:``0`"``B````````````*``H` +M"@`*``D`"P`&@`$``@`(@``````````#`````@````````````````````8` +M````````!@````(!``"````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M`````/\`````````````````````````````````````````6%0!`!!4`0"P +M5`$`9%8!``16`0`,50$`G%4!`-!5`0#D4P$`````````````````3$4```4` +M```$````\$Z``````````````````/Q>```%````!````/!.@``````````` +M``````"`8```!0````0```#P3H`````````````````````````````````` +M`````````````````````````````@(``@("``("`@`"`@("``````0%!00" +M`@``!``'!P<'!P<````````````(+IZ>-D6>GIZ>GHF>;W="9Y>!3)Z>GIZ> +M15]%&9Z/CT)^GIY%16QL;```!`4%!`("``!R96%D(&UE;6]R>2!B;&]C:SH@ +M4D9(7T=%3E]#1D<`2!B;&]C:SH@4D9(7U%?55)"1$-"7U=)1%@`@`X`!X`$`!R`#H`'@`"`P0%``#@(@0` +MI448`,KT)P#*]"<`.@$"`=4`WP`Z`:(`=0!_`,H!2@'B`/D`R@'J`((`F0`! +M`P\'?'Q\?&=G9V<%!0H*``````H4-VYJ`1H!V0#H`&H!N@!Y`(@`=-%%%^BB +MBRX0&*``#!B@``@0$`(0"```$!F@``P9H``0&$`&$"```#``"``-#0T-#@X. +M#@X/#P\/#Q`0$!`1$1$1$A(2$A,3$Q,4%!05%145%A86%Q<7&!@8&1D:&AH; +M&QL<'!T='1X>'Q\@("$A(B(C(R0D)24F)BWQ^@(*$AHB*C(Z0DI26F)J=GZ&CIJBKK;"RM;>Z +MO<#"Q0` +MF`#D`)@`Y`"8`-P"W`)N`=P";@'H`6X!]`!N`?0`;@'T`+(%L@79`K(%V0+, +M`]D"Y@'9`N8!V0+F`40!1`'F`40!Y@&P`>8!'`+F`1P"Y@$<`H@"B`+,`X@" +MS`-@`\P#.`3,`S@$S`,X!,P#S`.R!$AX2'@`!`@$#!@````0(!!`0```H`"@`,``L`"P`*``\`#0`+``L`#P` +M-``P`"P`5`!$`'__!P\?/P$#!0`'`@,$!@8-!04)"0D)"0D)"0D!!P\?/W__ +M____________````@%55554```!`T%Y">V@OH3V:'Q8IM)?0'CB.XS@PG'<1P'`0$!`0$!`0%!P0$!`0$!`0$!0<$! +M`0$!`0$!`4%!`0$!`0$!`0%!P0$!`0$!`0$!04$!`0$!`0$!`4%!`0$!`0$! +M`0%!00$!`0$!`0$!0D)!04%!04%!04%!04%!04%!04)"0D%!04%!0L)"0D-! +M04%!0D)"0T-#04%!04%!04)"0D%!04%"0D)#0T-!04%"0D-#1$3$04%"0D-$ +M1,1&1@$"`P29F0,`G=B)G4[LQ$XT2(,T)W9B)QJD01H3.[$3$1B!$0_\P`\- +MTB`-"[W0"S0`:`!H`-``T``X`3@!.`&@`:`!;`#8`-@`L`&P`8@"B`*(`F`# +M8`/J`-0!U`&H`Z@#?`5\!7P%4`=0!]0!J`.H`U`'4`?X"O@*^`J@#J`.&@`T +M`$X`:`"<`-``Z@`$`3@!6P&&`;$!-@!L`*(`V`!$`;`!Y@$<`H@"T`(J`X0# +M=0#J`%\!U`&^`J@#'022!'P%&`;;!IX'Z@#4`;X"J`-\!5`'.@@D"?@*,`RV +M#3P/"0D%!0D)#0T%!@$"`P0``)*-C(J*BHF(B(B2BHB'AX:&AH:&CHF(AX:& +MAH6%A9*.C8R,C(R,C(PM+34V-S@^0D9&+3,U.S]`0$='1S(V.#HZ04!'1T<] +M/CY(2$=*4%!0#0\%!PD+`0,H`"@`-``P`"P`+`!$`#P`5555`4MH+P%5554% +MXSB.`ZJJJ@)Q',GI[?'Q]?7U^?GY^ +M?W]_?W]_?W^`!`P,"!04!`1`````@``````!`````@````0```!```!````` +M0````#0#4`-[`[H#%02;!/0$_@,?!$@$@P3;!&(%NP6Z!NP&.`>Q!W@(FPE: +M"J$'WP'@<```(``@8&!@8&!@8&!@0`````!O8& +M]O;V&P`(6QM;(0`````````!`````0```````````````0`````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M````!%R!``0````$````!`````0````$```````````````````````````` +M``````````````````````````````````````````````\`"``&``,``P`` +M```1`!````````````````````````````$``````````````$`````````` +M```````````!````````$`````!``````````````````````0```,R%@``` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M`````````````````````````````````%]?8@`````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M``````````````````````````````````````````````````````````#_ +M______\````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M``#_______\````````````````````````````````````````````````` +M`````````@`0`````$`````````````````````!````V'B````````````` +M`````````````````````````````0$"`0("`P$"`@,"`P,$``()`0,```#P +M10(`9$$"`"SX`@`L^`(`+/@"`"SX`@`L^`(`^$<"`%CX`@!81P(`+/@"`"SX +M`@`L^`(`+/@"`"SX`@`L^`(`+/@"`"SX`@`L^`(`!````"SX`@`L^`(`+/@" +M`"SX`@`L^`(`+/@"`"SX`@`L^`(```````\`/P`"````#P`_``(````/`#\` +M`@````\`/P`"````#P`_``(@```````````$"`P,````````!`@,#``````` +M``0(#`P````````$"`P,!@`-`$(`8P"&`*``_P```*JJJJJJJJJJJJJJ[JJJ +MJJHH_P#,JJH``*JJ`,RJJ@```$``P`!``,``4`#P`%``\``````````````` +M`````````````````````````````````````````````````*JJJJJJJJJJ +MJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJ``````````````````````!L;6YO +M<'%R+<"``"E10`@Q$4`+/@"`"SX`@`L^`(` +M$````%B@10#8K$4`,*U%`*3#10`L^`(`+/@"`(2?10`0GT4`+/@"`"SX`@`L +M^`(`+/@"`"SX`@`L^`(`+/@"`%3X`@!8^`(`,/@"`"SX`@`L^`(`+/@"`"SX +M`@`L^`(`+/@"`"SX`@`L^`(`+/@"``0````L^`(`+/@"`"SX`@`L^`(````` +M`````````````````!A,1@!4048`H#Y&`+!(1@`L2T8`K#]&`$!01@`,2$8` +M6/@"`&A"1@"0148`S$=&`*1"1@`H1$8`0$E&`/A01@!<2$8`W$I&`&!"1@`( +M`0``+/@"`"SX`@`L^`(`+/@"``1!1@!02T8`+/@"`"SX`@`!`04!`P$!`0@! +M`@$(``@``0$#`0$!`P`#`0(!!0$!`00````0!48`+/@"`(`!1@`L!$8`+/@" +M`#`"1@`D!D8`!`1&`%CX`@`P^`(`+/@"`"SX`@!<`D8`1`-&`"SX`@`L^`(` +M+/@"`"SX`@`L^`(`$````"SX`@`L^`(`+/@"`"SX`@`L^`(`+/@"`"SX`@#\ +M`D8```````\`/P`!````#P`_``$````/`#\``0````\`/P`!````#P`_``$` +M```"`````@````8````&````!0````4````$````!`````,````#`````0`` +M`````````````````*!)10!T244`<$E%`)A)10"<244`+/@"`"SX`@"4244` +M6/@"`)!)10`L^`(`+/@"`"SX`@`L^`(`+/@"`"SX`@`L^`(`+/@"`"SX`@`0 +M````+/@"````````````+/@"```````````````````````L^`(`+/@"`.P] +M1@`D/D8`=#Y&`"SX`@`L^`(`5/@"`%CX`@`P^`(`+/@"`"SX`@`L^`(`+/@" +M`"SX`@`L^`(`+/@"`"SX`@`L^`(`$````"SX`@`L^`(`+/@"`"SX`@`L^`(` +M+/@"`"SX`@`L^`(``.<0YR#G,.<`[Q#O(.\P[P#B`.,`Y`#E`.H`ZP#L`.TL +M^`(`+/@"`%121@`L^`(`+/@"`%A21@`L^`(`5/@"`%CX`@`P^`(`+/@"`"SX +M`@`L^`(`+/@"`"SX`@`L^`(`+/@"`"SX`@`L^`(`$````"SX`@`L^`(`+/@" +M`"SX`@`L^`(`+/@"`"SX`@`L^`(``0$!``(```"<_QC\``!D`&(```!O`&,` +ML`1P`&T`T`=Q`&\`H`]R`'$`0!]S`'(`$"=T`',`X"YU`&``F#H``)69G:&E +M````_T%55555`0````("`B````"`B(B(B```$0```#16`@`#````?'8"``$` +M```D,0,``````-2I`@`8````)(,"``P```!@?@(`'````(Q?`@`$````,)0` +M`!,```#86P(`&P```!Q7`@`1````<%8"`!@```!`A0(`&0```-"9`@`:```` +M/*,"``<````PB@(``P```"AY`@`,````-($"``0```"$G0``-*D"`#A7`@#D +M5@(`N)H"`-RC`@#47P(`2'T"`/B'`@`X6@(`L)0``*1V`@#46@(`!C!0<(2A +M```&,`````#__P`!`/\```$$```$_P``_@`!`/\!`0((`P$#"0,!`03_`0`& +M"`$!!P$!`0`"`0`!!`(`_P8"`P7_`@("!P("`P<"`@3_`@(``@(``00"`0?_ +M`@`&"`,`__\#`P0%`P(#_P,!!_\#``8(`P,``@,``00``@`````%_P```?\" +M`/\"`@,%_P(`!@$"``$!`P#_`P,#!00#`0/_`P("!0,`!@$#``$!`0#_!P$! +M!P8!`07_`00!_P$#"`@$`/\)!`0%_P0`"`H$!`/_)````"@````L````,``` +M`#0````X````/````$````!$````2````$P```!0````5````%@```!<```` +M8````&0```!H````;````'````!T````>````'P```"`````A````(@```", +M````D````)4```"9````G0```*$```"E````J0```*T```"Q````*@```#H` +M``!*````6@```&H```!Z````B@```)L```"K`````@````0````&`````P`` +M``L````3````&P```",````K````,P```#H```!"`````0`````````$```` +M!0``````````````````````_P```/X!```"_P```_\``0#_`0`!`@$"`O\" +M`/\#`@#^!`(``_\```````````````"@;44`"@````0```#P3H`````````` +M````````M&U%``H````$````\$Z````````````````````````````````` +M```````````````````````>````'H@>B%H```!6````5HA6B`(!``"J```` +MJHBJB/X!``","@``5(Q4C*0?```````````````````H"@(`"@````0```#P +M3H``````````````````K`H"``4````$````\$Z``````````````````-2[ +M10`DOD4`4+U%`-B]10!(N44`'+E%`/`T10#8N$4`C#5%``@S10!@,T4`!$T" +M````````````````````````````````````_PD```#_```'_P`!"0H```K_ +M`0#_!@$"```!`P'_`0,"_P$#`_\!`0W_`0$$_P$"!0`!`0O_`0(,_P$$!@@! +M`0?_`0`(_P$`"O\"`@#_`@,!_P(#`O\"`P/_`@$-`0(!!`$"`@4``@$+`0(" +M#`$"!`8(`@('``(`"`$"``H!`P#_`@,#`/\#`P'_`P,"_P,#`P0#`00%`P$- +M!P,"!0`#`0L%`P(,!0,$!@@#`P?_`P`(!0,`"@4#`/X#!`0`_P0$`?\$!`+_ +M!`0#_P0$#?\$!`3_!`0%_P0$"_\$!`S_!`0&"`0$!P@$``C_!``*_P`````` +M``````#_`````0,``@("``,``@``!?\```;_```$_P``!P0```S_`0#_`0$! +M``,!`@$"`0("`@$`!/\!`0<$`0`,_P("``4"`@(%`@`%_P(`!O\"`@0%`@(' +M!0(#"@("`@D"`@`(_P(`#`4#`P`%`P,!!0,#`@4#`07_`P`&_P,#!`4#`P<% +M`P()`@,#"@(#``L#`P`(_P,`#`4``````!```/8/``#8#P``I@\``&$/```) +M#P``G0X``"`.``"1#0``\0P``$$,``"""P``M`H``-D)``#R"`````@```,' +M``#^!0``\00``-X#``#'`@``K`$``(X```````````````````````````$` +M```!```````````````!`````0````$```````````````$``!CA@``>``'4 +MY@(``0`$T.4"``$`!````/!#@``0``&H#H```@`!``"```$` +M`SA\@``!``&DX(```0`#J."```$``Z3F`@`"``0``"`````@```````````` +M`````````````(A>`P`%```"!````/!.@`#_`````'F``+SK@``````````` +M````````````````````````````````````````````U0#6``$`+0"`!Q`* +M_0#^`"8`@0J""J$(,0L``/\````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M``````````````````````````````````````````"DJ@(`,S,#````!``R +M504````(`*NJ"@````P`S@````````1J`````` +M``0\H```````"#R@```````8/*```````!P\H```````(#R@```````D/*`` +M`````"@\H```````+#R@```````P/*```````#0\H```````.#R@```````\ +M/*```````$`\H```````1#R@``````!(/*```````$P\H```````4#R@```` +M``!4/*```````%@\H```````7#R@``````!@/*```````&0\H```````:#R@ +M``````!\/*```````'@\H````````````````````````````)C=`0!0W0$` +M`````.A[@`#H>X```````````````````````````````````````,#!@`#` +MP8``P,&``,#!@``````````````````````````````````````````````` +M``#^RJVK`````````````````````"`"`````"$"`````"("`````","```` +M`"0"`````"4"`````"($`````",$`````"0$`````"4$`````"8$`````"<$ +M`````"@$`````"D$`````"H$`````"L$`````"P$`````"T$`````"X$```` +M`"\$`````#`$`````#$$``````D$`````!<``0```!@P8,`````````````` +M`````````````*!O10`*`````````/!.@`````````````````````````#_ +M```!`_\```D!```*_P`#!`(```#_``#^`P$`_P0!`0D%`0$*!0$``?\!`P0" +M`0$"_P$!"/\!``#_`0#^!@(`_P<"`@D(`@(*"`("!PD"``'_`@$#_P(#!`H" +M`@+_`@``"P,#"0P#`PH,`P0%#0,#`@X#```/!`#_$`0$"1$$!`H1!`(&_P0" +M`A($!`C_!```_P0`_A,```````````````#X)$4`"@````````#P3H`````` +M``````#4.D4`8#M%`/0A10!8.T4`O&Y%`"AO10`0;T4`,")%`&PC10#$(D4` +M)")%`&0C10`8(D4``")%``@B10`0(D4`C&M%`/AK10#$:T4`O&M%`/______ +M______________\$````________________`P```/____\``````````/__ +M__\``````````/____\```````````,````0`````P```/\```#_````_P`` +M`/\````#```````````````````````````````````````````````````` +M````````````````_P```/\````>```````````````````````````````` +M``````````````````````````````````````````````!D````9````&0` +M``!D````R````)`!``#H`P``T`<```#_`````````````/\`````!@$#`@`` +M```````#0>```` +M`#@>`````#P>`````$P>`````%`>`````%0>`````%@>`````%P>`````&0> +M`````'@>`````'P>`````(P>`````)`>`````)0>`````)@>`````)P>```` +M`*`>`````,`>`````,0>`````-`>`````-0>``````0?`````-P>`````'0? +M`````'@?`````'P?`````/@?`````"8`````````````````````````$``` +M`!\````````````````````````````````````````````````````````` +M````````````````````````````````$``````````````````````````` +M```````````````0```````````````4```````````````E````Y?____G_ +M__\O````W?____C___\```````````$````````````````````````````` +M`````````````````````````````````````````````````/\````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M````````````````````/SP```````````````````,`````````_P`````` +M````````````````````````````````````````__\````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````( +M`````````````````````````````````````````````````````````/__ +M________````````````````C`0"``H````$````\$Z`````````````Z`8" +M```(`@`X!P(`0`8"`#`(`@#$!P(`E`8"`/`%`@```0````$$`0$!``(!`0$# +M`0`"!P$!!`0!`04%`0(#_P(!`08"``('B!,````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-all@freebsd.org Thu Nov 21 00:40:14 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 0585A1C72F3; Thu, 21 Nov 2019 00:40:14 +0000 (UTC) (envelope-from brooks@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47JLLj6L75z4b1c; Thu, 21 Nov 2019 00:40:13 +0000 (UTC) (envelope-from brooks@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id B86B12F9D; Thu, 21 Nov 2019 00:40:13 +0000 (UTC) (envelope-from brooks@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xAL0eD6B068781; Thu, 21 Nov 2019 00:40:13 GMT (envelope-from brooks@FreeBSD.org) Received: (from brooks@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xAL0eD7P068779; Thu, 21 Nov 2019 00:40:13 GMT (envelope-from brooks@FreeBSD.org) Message-Id: <201911210040.xAL0eD7P068779@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: brooks set sender to brooks@FreeBSD.org using -f From: Brooks Davis Date: Thu, 21 Nov 2019 00:40:13 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r354928 - in stable/12: lib/libc/gen sys/sys X-SVN-Group: stable-12 X-SVN-Commit-Author: brooks X-SVN-Commit-Paths: in stable/12: lib/libc/gen sys/sys X-SVN-Commit-Revision: 354928 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 21 Nov 2019 00:40:14 -0000 Author: brooks Date: Thu Nov 21 00:40:12 2019 New Revision: 354928 URL: https://svnweb.freebsd.org/changeset/base/354928 Log: MFC r354694, r354699 r354694: elf_aux_info: Add support for AT_EXECPATH. Reviewed by: emaste, sef Sponsored by: DARPA, AFRL Differential Revision: https://reviews.freebsd.org/D22353 r354699: Improve the description of AT_EXECPATH availability. Reported by: kib Sponsored by: DARPA, AFRL Modified: stable/12/lib/libc/gen/auxv.3 stable/12/lib/libc/gen/auxv.c stable/12/sys/sys/param.h Directory Properties: stable/12/ (props changed) Modified: stable/12/lib/libc/gen/auxv.3 ============================================================================== --- stable/12/lib/libc/gen/auxv.3 Thu Nov 21 00:34:39 2019 (r354927) +++ stable/12/lib/libc/gen/auxv.3 Thu Nov 21 00:40:12 2019 (r354928) @@ -49,6 +49,12 @@ can be requested (corresponding buffer sizes are speci .It AT_CANARY The canary value for SSP (arbitrary sized buffer, as many bytes are returned as it fits into it, rest is zeroed). +.It AT_EXECPATH +The path of executed program +.Dv (MAXPATHLEN). +This may not be present if the process was initialized by +.Xr fexecve 2 +and the namecache no longer contains the file's name. .It AT_HWCAP CPU / hardware feature flags .Dv (sizeof(u_long)). Modified: stable/12/lib/libc/gen/auxv.c ============================================================================== --- stable/12/lib/libc/gen/auxv.c Thu Nov 21 00:34:39 2019 (r354927) +++ stable/12/lib/libc/gen/auxv.c Thu Nov 21 00:40:12 2019 (r354928) @@ -69,7 +69,7 @@ __init_elf_aux_vector(void) static pthread_once_t aux_once = PTHREAD_ONCE_INIT; static int pagesize, osreldate, canary_len, ncpus, pagesizes_len; static int hwcap_present, hwcap2_present; -static char *canary, *pagesizes; +static char *canary, *pagesizes, *execpath; static void *timekeep; static u_long hwcap, hwcap2; @@ -88,6 +88,10 @@ init_aux(void) canary_len = aux->a_un.a_val; break; + case AT_EXECPATH: + execpath = (char *)(aux->a_un.a_ptr); + break; + case AT_HWCAP: hwcap_present = 1; hwcap = (u_long)(aux->a_un.a_val); @@ -146,6 +150,18 @@ _elf_aux_info(int aux, void *buf, int buflen) res = 0; } else res = ENOENT; + break; + case AT_EXECPATH: + if (execpath == NULL) + res = ENOENT; + else if (buf == NULL) + res = EINVAL; + else { + if (strlcpy(buf, execpath, buflen) >= buflen) + res = EINVAL; + else + res = 0; + } break; case AT_HWCAP: if (hwcap_present && buflen == sizeof(u_long)) { Modified: stable/12/sys/sys/param.h ============================================================================== --- stable/12/sys/sys/param.h Thu Nov 21 00:34:39 2019 (r354927) +++ stable/12/sys/sys/param.h Thu Nov 21 00:40:12 2019 (r354928) @@ -60,7 +60,7 @@ * in the range 5 to 9. */ #undef __FreeBSD_version -#define __FreeBSD_version 1201502 /* Master, propagated to newvers */ +#define __FreeBSD_version 1201503 /* Master, propagated to newvers */ /* * __FreeBSD_kernel__ indicates that this system uses the kernel of FreeBSD, From owner-svn-src-all@freebsd.org Thu Nov 21 00:45:04 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 055101C74F3; Thu, 21 Nov 2019 00:45:04 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from smtp.freebsd.org (smtp.freebsd.org [96.47.72.83]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "smtp.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47JLSH65Xxz4bMx; Thu, 21 Nov 2019 00:45:03 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from John-Baldwins-MacBook-Pro-5.local (ralph.baldwin.cx [66.234.199.215]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client did not present a certificate) (Authenticated sender: jhb) by smtp.freebsd.org (Postfix) with ESMTPSA id DA4952330; Thu, 21 Nov 2019 00:45:02 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Subject: Re: svn commit: r354900 - head/usr.sbin/jail To: "Bjoern A. Zeeb" Cc: Warner Losh , src-committers , svn-src-all , svn-src-head References: <201911201654.xAKGsMTv094014@repo.freebsd.org> <59bf120c-2f35-1a22-b6fa-a9c9bb8cfdf4@FreeBSD.org> <991bdc33-516d-6e6d-1880-44930441893d@FreeBSD.org> From: John Baldwin Openpgp: preference=signencrypt Autocrypt: addr=jhb@FreeBSD.org; keydata= mQGiBETQ+XcRBADMFybiq69u+fJRy/0wzqTNS8jFfWaBTs5/OfcV7wWezVmf9sgwn8TW0Dk0 c9MBl0pz+H01dA2ZSGZ5fXlmFIsee1WEzqeJzpiwd/pejPgSzXB9ijbLHZ2/E0jhGBcVy5Yo /Tw5+U/+laeYKu2xb0XPvM0zMNls1ah5OnP9a6Ql6wCgupaoMySb7DXm2LHD1Z9jTsHcAQMD /1jzh2BoHriy/Q2s4KzzjVp/mQO5DSm2z14BvbQRcXU48oAosHA1u3Wrov6LfPY+0U1tG47X 1BGfnQH+rNAaH0livoSBQ0IPI/8WfIW7ub4qV6HYwWKVqkDkqwcpmGNDbz3gfaDht6nsie5Z pcuCcul4M9CW7Md6zzyvktjnbz61BADGDCopfZC4of0Z3Ka0u8Wik6UJOuqShBt1WcFS8ya1 oB4rc4tXfSHyMF63aPUBMxHR5DXeH+EO2edoSwViDMqWk1jTnYza51rbGY+pebLQOVOxAY7k do5Ordl3wklBPMVEPWoZ61SdbcjhHVwaC5zfiskcxj5wwXd2E9qYlBqRg7QeSm9obiBCYWxk d2luIDxqaGJARnJlZUJTRC5vcmc+iGAEExECACAFAkTQ+awCGwMGCwkIBwMCBBUCCAMEFgID AQIeAQIXgAAKCRBy3lIGd+N/BI6RAJ9S97fvbME+3hxzE3JUyUZ6vTewDACdE1stFuSfqMvM jomvZdYxIYyTUpC5Ag0ERND5ghAIAPwsO0B7BL+bz8sLlLoQktGxXwXQfS5cInvL17Dsgnr3 1AKa94j9EnXQyPEj7u0d+LmEe6CGEGDh1OcGFTMVrof2ZzkSy4+FkZwMKJpTiqeaShMh+Goj XlwIMDxyADYvBIg3eN5YdFKaPQpfgSqhT+7El7w+wSZZD8pPQuLAnie5iz9C8iKy4/cMSOrH YUK/tO+Nhw8Jjlw94Ik0T80iEhI2t+XBVjwdfjbq3HrJ0ehqdBwukyeJRYKmbn298KOFQVHO EVbHA4rF/37jzaMadK43FgJ0SAhPPF5l4l89z5oPu0b/+5e2inA3b8J3iGZxywjM+Csq1tqz hltEc7Q+E08AAwUIAL+15XH8bPbjNJdVyg2CMl10JNW2wWg2Q6qdljeaRqeR6zFus7EZTwtX sNzs5bP8y51PSUDJbeiy2RNCNKWFMndM22TZnk3GNG45nQd4OwYK0RZVrikalmJY5Q6m7Z16 4yrZgIXFdKj2t8F+x613/SJW1lIr9/bDp4U9tw0V1g3l2dFtD3p3ZrQ3hpoDtoK70ioIAjjH aIXIAcm3FGZFXy503DOA0KaTWwvOVdYCFLm3zWuSOmrX/GsEc7ovasOWwjPn878qVjbUKWwx Q4QkF4OhUV9zPtf9tDSAZ3x7QSwoKbCoRCZ/xbyTUPyQ1VvNy/mYrBcYlzHodsaqUDjHuW+I SQQYEQIACQUCRND5ggIbDAAKCRBy3lIGd+N/BCO8AJ9j1dWVQWxw/YdTbEyrRKOY8YZNwwCf afMAg8QvmOWnHx3wl8WslCaXaE8= Message-ID: <5d4541f5-fe6c-ecc7-c383-0dfd9596ec0f@FreeBSD.org> Date: Wed, 20 Nov 2019 16:44:58 -0800 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.12; rv:60.0) Gecko/20100101 Thunderbird/60.9.1 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 21 Nov 2019 00:45:04 -0000 On 11/20/19 3:42 PM, Bjoern A. Zeeb wrote: > On 20 Nov 2019, at 23:32, John Baldwin wrote: > > Hijacking a side-thread: > > PreS: I think we have way too many of these options and should just > remove 3/4 of them again or someone build a proper matrix documenting > them all and in which case to use in the developers handbook ;-) > >> This one also seems dubious, but in a different way: >> >> usr.bin/Makefile: >> >> # ARM64TODO gprof does not build >> # RISCVTODO gprof does not build >> .if ${MACHINE_ARCH} != "aarch64" && ${MACHINE_CPUARCH} != "riscv" >> SUBDIR.${MK_TOOLCHAIN}+= gprof >> .endif >> >> Somewhat exacerbated by the whole aarch64 vs arm64 thing and probably >> confusion on when to use CPUARCH vs ARCH. > > This particular case could actually be removed as I thought I made that > at least compile when I was working on s390x: > https://svnweb.freebsd.org/base?view=revision&revision=351329 > > > You can however find more of these elsewhere: > > ../lib/libc/tests/sys/Makefile:.if ${MACHINE_CPUARCH} != "aarch64" && > ${MACHINE_CPUARCH} != "riscv" > ../lib/libcompiler_rt/Makefile.inc:.if ${MACHINE_CPUARCH} == "aarch64" > || ${MACHINE_CPUARCH} == "riscv" > ../stand/libsa/Makefile:.if ${MACHINE_CPUARCH} == "aarch64" || > ${MACHINE_CPUARCH} == "riscv" > ../usr.bin/Makefile:.if ${MACHINE_ARCH} != "aarch64" && > ${MACHINE_CPUARCH} != "riscv" > ../usr.bin/gprof/Makefile:.if ${MACHINE_ARCH} != "aarch64" && > ${MACHINE_ARCH} != "riscv" && \ The tests comparing MACHINE_CPUARCH against aarch64 are confusing indeed. My understanding is that MACHINE_CPUARCH is arm64 for aarch64? It's kind of hard to guess since arch(7) goes to great length to try to describe these variables but doesn't give a handy table of what they actually are for the various architectures. -- John Baldwin From owner-svn-src-all@freebsd.org Thu Nov 21 01:24:52 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 8B8B51A88B6; Thu, 21 Nov 2019 01:24:52 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47JMLD37Ffz4fGK; Thu, 21 Nov 2019 01:24:52 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4E8413ADA; Thu, 21 Nov 2019 01:24:52 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xAL1OqSv099302; Thu, 21 Nov 2019 01:24:52 GMT (envelope-from glebius@FreeBSD.org) Received: (from glebius@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xAL1Oo7v099292; Thu, 21 Nov 2019 01:24:50 GMT (envelope-from glebius@FreeBSD.org) Message-Id: <201911210124.xAL1Oo7v099292@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: glebius set sender to glebius@FreeBSD.org using -f From: Gleb Smirnoff Date: Thu, 21 Nov 2019 01:24:50 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354929 - in head: sbin/comcontrol sbin/conscontrol sbin/reboot share/man/man4 share/man/man5 sys/conf sys/dev/sio sys/modules/sio usr.sbin/watch X-SVN-Group: head X-SVN-Commit-Author: glebius X-SVN-Commit-Paths: in head: sbin/comcontrol sbin/conscontrol sbin/reboot share/man/man4 share/man/man5 sys/conf sys/dev/sio sys/modules/sio usr.sbin/watch X-SVN-Commit-Revision: 354929 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 21 Nov 2019 01:24:52 -0000 Author: glebius Date: Thu Nov 21 01:24:49 2019 New Revision: 354929 URL: https://svnweb.freebsd.org/changeset/base/354929 Log: Remove sio(4). It had been disconnected from build in r181233 in 2008. Reviewed by: imp Deleted: head/share/man/man4/sio.4 head/sys/dev/sio/ head/sys/modules/sio/ Modified: head/sbin/comcontrol/comcontrol.8 head/sbin/conscontrol/conscontrol.8 head/sbin/reboot/boot_i386.8 head/share/man/man4/Makefile head/share/man/man4/rc.4 head/share/man/man4/snp.4 head/share/man/man5/device.hints.5 head/sys/conf/files.amd64 head/sys/conf/files.i386 head/usr.sbin/watch/watch.8 Modified: head/sbin/comcontrol/comcontrol.8 ============================================================================== --- head/sbin/comcontrol/comcontrol.8 Thu Nov 21 00:40:12 2019 (r354928) +++ head/sbin/comcontrol/comcontrol.8 Thu Nov 21 01:24:49 2019 (r354929) @@ -54,7 +54,6 @@ dialout devices .El .Sh SEE ALSO .Xr stty 1 , -.Xr sio 4 .Sh HISTORY Originally part of cgd's com package patches, version 0.2.1, to .Bx 386 0.1 . Modified: head/sbin/conscontrol/conscontrol.8 ============================================================================== --- head/sbin/conscontrol/conscontrol.8 Thu Nov 21 00:40:12 2019 (r354928) +++ head/sbin/conscontrol/conscontrol.8 Thu Nov 21 01:24:49 2019 (r354929) @@ -101,7 +101,6 @@ This is an interface to the tty ioctl .Dv TIOCCONS . .El .Sh SEE ALSO -.Xr sio 4 , .Xr syscons 4 , .Xr tty 4 , .Xr vt 4 , Modified: head/sbin/reboot/boot_i386.8 ============================================================================== --- head/sbin/reboot/boot_i386.8 Thu Nov 21 00:40:12 2019 (r354928) +++ head/sbin/reboot/boot_i386.8 Thu Nov 21 01:24:49 2019 (r354929) @@ -36,7 +36,7 @@ .\" .\" $FreeBSD$ .\" -.Dd April 30, 2019 +.Dd November 19, 2019 .Dt BOOT 8 i386 .Os .Sh NAME @@ -223,15 +223,6 @@ you can use the .Fl h option to force the kernel to use the serial port as its console device. -The serial port driver -.Xr sio 4 -(but not -.Xr uart 4 ) -has a flag (0x20) to override this option. -If that flag is set, the serial port will always be used as the console, -regardless of the -.Fl h -option described here. .It Fl m mute the console to suppress all kernel console input and output during the boot. Modified: head/share/man/man4/Makefile ============================================================================== --- head/share/man/man4/Makefile Thu Nov 21 00:40:12 2019 (r354928) +++ head/share/man/man4/Makefile Thu Nov 21 01:24:49 2019 (r354929) @@ -461,7 +461,6 @@ MAN= aac.4 \ siftr.4 \ siis.4 \ simplebus.4 \ - sio.4 \ sis.4 \ sk.4 \ ${_smartpqi.4} \ Modified: head/share/man/man4/rc.4 ============================================================================== --- head/share/man/man4/rc.4 Thu Nov 21 00:40:12 2019 (r354928) +++ head/share/man/man4/rc.4 Thu Nov 21 01:24:49 2019 (r354929) @@ -91,7 +91,6 @@ file can be consulted for more information. .Sh SEE ALSO .Xr tty 1 , .Xr ttyname 3 , -.Xr sio 4 , .Xr tty 4 , .Xr device.hints 5 , .Xr comcontrol 8 , Modified: head/share/man/man4/snp.4 ============================================================================== --- head/share/man/man4/snp.4 Thu Nov 21 00:40:12 2019 (r354928) +++ head/share/man/man4/snp.4 Thu Nov 21 01:24:49 2019 (r354929) @@ -69,7 +69,6 @@ and detached. .El .Sh SEE ALSO .Xr pty 4 , -.Xr sio 4 , .Xr kldload 8 , .Xr watch 8 .Sh HISTORY Modified: head/share/man/man5/device.hints.5 ============================================================================== --- head/share/man/man5/device.hints.5 Thu Nov 21 00:40:12 2019 (r354928) +++ head/share/man/man5/device.hints.5 Thu Nov 21 01:24:49 2019 (r354929) @@ -25,7 +25,7 @@ .\" .\" $FreeBSD$ .\" -.Dd July 23, 2015 +.Dd November 19, 2019 .Dt DEVICE.HINTS 5 .Os .Sh NAME @@ -138,13 +138,13 @@ Notes on the kernel configuration file and device reso .El .Sh EXAMPLES The following example sets up resources for the -.Xr sio 4 +.Xr uart 4 driver on the ISA bus: .Bd -literal -offset indent -hint.sio.0.at="isa" -hint.sio.0.port="0x3F8" -hint.sio.0.flags="0x10" -hint.sio.0.irq="4" +hint.uart.0.at="isa" +hint.uart.0.port="0x3F8" +hint.uart.0.flags="0x10" +hint.uart.0.irq="4" .Ed .Pp The following example disables the ACPI driver: Modified: head/sys/conf/files.amd64 ============================================================================== --- head/sys/conf/files.amd64 Thu Nov 21 00:40:12 2019 (r354928) +++ head/sys/conf/files.amd64 Thu Nov 21 01:24:49 2019 (r354929) @@ -300,11 +300,6 @@ dev/sfxge/sfxge_nvram.c optional sfxge pci dev/sfxge/sfxge_port.c optional sfxge pci dev/sfxge/sfxge_rx.c optional sfxge pci dev/sfxge/sfxge_tx.c optional sfxge pci -dev/sio/sio.c optional sio -dev/sio/sio_isa.c optional sio isa -dev/sio/sio_pccard.c optional sio pccard -dev/sio/sio_pci.c optional sio pci -dev/sio/sio_puc.c optional sio puc dev/smartpqi/smartpqi_cam.c optional smartpqi dev/smartpqi/smartpqi_cmd.c optional smartpqi dev/smartpqi/smartpqi_discovery.c optional smartpqi Modified: head/sys/conf/files.i386 ============================================================================== --- head/sys/conf/files.i386 Thu Nov 21 00:40:12 2019 (r354928) +++ head/sys/conf/files.i386 Thu Nov 21 01:24:49 2019 (r354929) @@ -136,11 +136,6 @@ dev/random/nehemiah.c optional padlock_rng !random_lo dev/sbni/if_sbni.c optional sbni dev/sbni/if_sbni_isa.c optional sbni isa dev/sbni/if_sbni_pci.c optional sbni pci -dev/sio/sio.c optional sio -dev/sio/sio_isa.c optional sio isa -dev/sio/sio_pccard.c optional sio pccard -dev/sio/sio_pci.c optional sio pci -dev/sio/sio_puc.c optional sio puc dev/speaker/spkr.c optional speaker dev/superio/superio.c optional superio isa dev/syscons/apm/apm_saver.c optional apm_saver apm Modified: head/usr.sbin/watch/watch.8 ============================================================================== --- head/usr.sbin/watch/watch.8 Thu Nov 21 00:40:12 2019 (r354928) +++ head/usr.sbin/watch/watch.8 Thu Nov 21 01:24:49 2019 (r354929) @@ -105,7 +105,6 @@ control-X is passed to the terminal as with other cont .El .Sh SEE ALSO .Xr pty 4 , -.Xr sio 4 , .Xr snp 4 , .Xr kldload 8 .Sh HISTORY From owner-svn-src-all@freebsd.org Thu Nov 21 01:46:37 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id E3DD01A8EA9; Thu, 21 Nov 2019 01:46:37 +0000 (UTC) (envelope-from gjb@freebsd.org) Received: from freefall.freebsd.org (freefall.freebsd.org [96.47.72.132]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "freefall.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47JMqK5V54z4g0r; Thu, 21 Nov 2019 01:46:37 +0000 (UTC) (envelope-from gjb@freebsd.org) Received: from FreeBSD.org (freefall.freebsd.org [IPv6:2610:1c1:1:6074::16:84]) (using TLSv1 with cipher ECDHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by freefall.freebsd.org (Postfix) with ESMTPS id 1CC3E6818; Thu, 21 Nov 2019 01:46:37 +0000 (UTC) (envelope-from gjb@freebsd.org) Date: Thu, 21 Nov 2019 01:46:34 +0000 From: Glen Barber To: John Baldwin Cc: "Bjoern A. Zeeb" , Warner Losh , src-committers , svn-src-all , svn-src-head Subject: Re: svn commit: r354900 - head/usr.sbin/jail Message-ID: <20191121014634.GK5599@FreeBSD.org> References: <201911201654.xAKGsMTv094014@repo.freebsd.org> <59bf120c-2f35-1a22-b6fa-a9c9bb8cfdf4@FreeBSD.org> <991bdc33-516d-6e6d-1880-44930441893d@FreeBSD.org> <5d4541f5-fe6c-ecc7-c383-0dfd9596ec0f@FreeBSD.org> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="A/JKaSqKPqQLCbw0" Content-Disposition: inline In-Reply-To: <5d4541f5-fe6c-ecc7-c383-0dfd9596ec0f@FreeBSD.org> User-Agent: Mutt/1.12.1 (2019-06-15) X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 21 Nov 2019 01:46:38 -0000 --A/JKaSqKPqQLCbw0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Wed, Nov 20, 2019 at 04:44:58PM -0800, John Baldwin wrote: > On 11/20/19 3:42 PM, Bjoern A. Zeeb wrote: > > On 20 Nov 2019, at 23:32, John Baldwin wrote: > >=20 > > Hijacking a side-thread: > >=20 > > PreS: I think we have way too many of these options and should just=20 > > remove 3/4 of them again or someone build a proper matrix documenting= =20 > > them all and in which case to use in the developers handbook ;-) > >=20 > >> This one also seems dubious, but in a different way: > >> > >> usr.bin/Makefile: > >> > >> # ARM64TODO gprof does not build > >> # RISCVTODO gprof does not build > >> .if ${MACHINE_ARCH} !=3D "aarch64" && ${MACHINE_CPUARCH} !=3D "riscv" > >> SUBDIR.${MK_TOOLCHAIN}+=3D gprof > >> .endif > >> > >> Somewhat exacerbated by the whole aarch64 vs arm64 thing and probably > >> confusion on when to use CPUARCH vs ARCH. > >=20 > > This particular case could actually be removed as I thought I made that= =20 > > at least compile when I was working on s390x: > > https://svnweb.freebsd.org/base?view=3Drevision&revision=3D351329 > >=20 > >=20 > > You can however find more of these elsewhere: > >=20 > > ../lib/libc/tests/sys/Makefile:.if ${MACHINE_CPUARCH} !=3D "aarch64" &&= =20 > > ${MACHINE_CPUARCH} !=3D "riscv" > > ../lib/libcompiler_rt/Makefile.inc:.if ${MACHINE_CPUARCH} =3D=3D "aarch= 64"=20 > > || ${MACHINE_CPUARCH} =3D=3D "riscv" > > ../stand/libsa/Makefile:.if ${MACHINE_CPUARCH} =3D=3D "aarch64" ||=20 > > ${MACHINE_CPUARCH} =3D=3D "riscv" > > ../usr.bin/Makefile:.if ${MACHINE_ARCH} !=3D "aarch64" &&=20 > > ${MACHINE_CPUARCH} !=3D "riscv" > > ../usr.bin/gprof/Makefile:.if ${MACHINE_ARCH} !=3D "aarch64" &&=20 > > ${MACHINE_ARCH} !=3D "riscv" && \ >=20 > The tests comparing MACHINE_CPUARCH against aarch64 are confusing indeed. > My understanding is that MACHINE_CPUARCH is arm64 for aarch64? It's kind > of hard to guess since arch(7) goes to great length to try to describe > these variables but doesn't give a handy table of what they actually are > for the various architectures. >=20 This breaks the build, regardless. =3D=3D=3D> usr.sbin/jail (cleandir) =3D=3D=3D> usr.bin/procstat/tests (cleandir) make[4]: "/releng/13-amd64-GENERIC-snap/usr/src/usr.sbin/jail/Makefile" li= ne 21: Malformed conditional (${LINKER_TYPE} =3D=3D "bfd" && ${MACHINE} =3D= =3D "riscv") =3D=3D=3D> usr.bin/rctl (cleandir) make[4]: Fatal errors encountered -- cannot continue make[4]: stopped in /releng/13-amd64-GENERIC-snap/usr/src/usr.sbin/jail --- cleandir_subdir_usr.sbin/jail --- *** [cleandir_subdir_usr.sbin/jail] Error code 1 Glen --A/JKaSqKPqQLCbw0 Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAEBCAAdFiEEjRJAPC5sqwhs9k2jAxRYpUeP4pMFAl3V7GcACgkQAxRYpUeP 4pMqcw/+Palor+xFakid/tF3JE2fDSiKJxLrm/1uoZPJhZaYT4IZamOVBaJrWcW6 aHndBOU0fwKMVaTGxNQCqQOUwkv+D5EnaK84hAfjUZa+MNh4aJ1jXh2H5QSQE87f xeV4Dytk0MUULdOXyerz+b72ZfL7lOybx8J53JlrMapmv2cMqqIjShhPDvzJ68+q 9851AXFCXqvdr2TQpY/sJLVrODi4w3UaqsKyIeJlhUrgwEiknw+M9ceFP801V2Yf QPr+xZmOY3sRq6KOG7MtYc/V/nomBC6oCF1AR9jLOrnAdgKSoza01W7tvZpc4ehg nGiqPWoiJ6Q6LRGPwHdr2uvytnGsOwHnLhK+h3DrjrVswnxKpnahcTzoLyP0UHvo BhgVltMK/62Zg13IhpbGR/QWaf6xRlB5zh6zlntNoJOEW1KmqW2fDZIuHuEv7zKK S1w8OlYio7VksxiV41zJXCLCsy6ijlHZhy1LbZM3xbWpUOfd1eUDeE49oIFhxjYX 6vEFjhsc7YEYD9V8xtNKeYfBWZlXqIqEEoGIJ8rd2fsgmaX+uEimN5Qpt+5JutZy 1dNdcsQy6//iR/vua7d80e00KDaiX+r1dkFvVvfpQfDWVFy2+IdZRa8VLzvb3hsu P5MDlq2XLTLCpnCgQBiHIqzjH0hiCn4QQANPhWJxAE663Dmvln4= =X0MP -----END PGP SIGNATURE----- --A/JKaSqKPqQLCbw0-- From owner-svn-src-all@freebsd.org Thu Nov 21 02:41:23 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 515941AA4EB; Thu, 21 Nov 2019 02:41:23 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47JP2W08vRz3Dqh; Thu, 21 Nov 2019 02:41:23 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id DCFCF492E; Thu, 21 Nov 2019 02:41:22 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xAL2fMCf042943; Thu, 21 Nov 2019 02:41:22 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xAL2fMCZ042942; Thu, 21 Nov 2019 02:41:22 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201911210241.xAL2fMCZ042942@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Thu, 21 Nov 2019 02:41:22 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354930 - head/sys/arm/broadcom/bcm2835 X-SVN-Group: head X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: head/sys/arm/broadcom/bcm2835 X-SVN-Commit-Revision: 354930 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 21 Nov 2019 02:41:23 -0000 Author: kevans Date: Thu Nov 21 02:41:22 2019 New Revision: 354930 URL: https://svnweb.freebsd.org/changeset/base/354930 Log: bcm2835_sdhci: clean up DMA segments in error handling path Later parts assume that this would've been done if interrupts are enabled, but this is the only case in which that wouldn't have been true. This commit also reorders operations such that we're done touching slot/slot->intmask before we call back into the SDHCI framework and exit. Modified: head/sys/arm/broadcom/bcm2835/bcm2835_sdhci.c Modified: head/sys/arm/broadcom/bcm2835/bcm2835_sdhci.c ============================================================================== --- head/sys/arm/broadcom/bcm2835/bcm2835_sdhci.c Thu Nov 21 01:24:49 2019 (r354929) +++ head/sys/arm/broadcom/bcm2835/bcm2835_sdhci.c Thu Nov 21 02:41:22 2019 (r354930) @@ -87,6 +87,7 @@ __FBSDID("$FreeBSD$"); rounddown(BCM_SDHCI_SLOT_LEFT(slot), BCM_SDHCI_BUFFER_SIZE)) #define DATA_PENDING_MASK (SDHCI_INT_DATA_AVAIL | SDHCI_INT_SPACE_AVAIL) +#define DATA_XFER_MASK (DATA_PENDING_MASK | SDHCI_INT_DATA_END) #ifdef DEBUG static int bcm2835_sdhci_debug = 0; @@ -579,7 +580,7 @@ bcm_sdhci_start_dma_seg(struct bcm_sdhci_softc *sc) if (idx == 0) { bus_dmamap_sync(sc->sc_dma_tag, sc->sc_dma_map, sync_op); - slot->intmask &= ~DATA_PENDING_MASK; + slot->intmask &= ~DATA_XFER_MASK; bcm_sdhci_write_4(sc->sc_dev, slot, SDHCI_SIGNAL_ENABLE, slot->intmask); } @@ -600,7 +601,7 @@ bcm_sdhci_dma_exit(struct bcm_sdhci_softc *sc) mtx_assert(&slot->mtx, MA_OWNED); /* Re-enable interrupts */ - slot->intmask |= DATA_PENDING_MASK; + slot->intmask |= DATA_XFER_MASK; bcm_sdhci_write_4(slot->bus, slot, SDHCI_SIGNAL_ENABLE, slot->intmask); } @@ -654,6 +655,12 @@ bcm_sdhci_dma_intr(int ch, void *arg) sdhci_finish_data(slot); bcm_sdhci_dma_exit(sc); } + } else if ((reg & SDHCI_INT_DATA_END) != 0) { + bcm_sdhci_dma_exit(sc); + bcm_sdhci_write_4(slot->bus, slot, SDHCI_INT_STATUS, + reg); + slot->flags &= ~PLATFORM_DATA_STARTED; + sdhci_finish_data(slot); } else { bcm_sdhci_dma_exit(sc); } @@ -732,7 +739,11 @@ bcm_sdhci_finish_transfer(device_t dev, struct sdhci_s { struct bcm_sdhci_softc *sc = device_get_softc(slot->bus); - /* Clean up */ + /* + * Clean up. Interrupts are clearly enabled, because we received an + * SDHCI_INT_DATA_END to get this far -- just make sure we don't leave + * anything laying around. + */ if (sc->dmamap_seg_count != 0) { /* * Our segment math should have worked out such that we would @@ -753,7 +764,6 @@ bcm_sdhci_finish_transfer(device_t dev, struct sdhci_s sc->dmamap_seg_index = 0; } - bcm_sdhci_dma_exit(sc); sdhci_finish_data(slot); } From owner-svn-src-all@freebsd.org Thu Nov 21 02:44:06 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 180F51AA63D; Thu, 21 Nov 2019 02:44:06 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47JP5d6qjLz3FBB; Thu, 21 Nov 2019 02:44:05 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id CD5BE49A3; Thu, 21 Nov 2019 02:44:05 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xAL2i5j2046012; Thu, 21 Nov 2019 02:44:05 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xAL2i5uM046011; Thu, 21 Nov 2019 02:44:05 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201911210244.xAL2i5uM046011@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Thu, 21 Nov 2019 02:44:05 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354931 - head/sys/arm/broadcom/bcm2835 X-SVN-Group: head X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: head/sys/arm/broadcom/bcm2835 X-SVN-Commit-Revision: 354931 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 21 Nov 2019 02:44:06 -0000 Author: kevans Date: Thu Nov 21 02:44:05 2019 New Revision: 354931 URL: https://svnweb.freebsd.org/changeset/base/354931 Log: Revert r354930: wrong diff, right message. Modified: head/sys/arm/broadcom/bcm2835/bcm2835_sdhci.c Modified: head/sys/arm/broadcom/bcm2835/bcm2835_sdhci.c ============================================================================== --- head/sys/arm/broadcom/bcm2835/bcm2835_sdhci.c Thu Nov 21 02:41:22 2019 (r354930) +++ head/sys/arm/broadcom/bcm2835/bcm2835_sdhci.c Thu Nov 21 02:44:05 2019 (r354931) @@ -87,7 +87,6 @@ __FBSDID("$FreeBSD$"); rounddown(BCM_SDHCI_SLOT_LEFT(slot), BCM_SDHCI_BUFFER_SIZE)) #define DATA_PENDING_MASK (SDHCI_INT_DATA_AVAIL | SDHCI_INT_SPACE_AVAIL) -#define DATA_XFER_MASK (DATA_PENDING_MASK | SDHCI_INT_DATA_END) #ifdef DEBUG static int bcm2835_sdhci_debug = 0; @@ -580,7 +579,7 @@ bcm_sdhci_start_dma_seg(struct bcm_sdhci_softc *sc) if (idx == 0) { bus_dmamap_sync(sc->sc_dma_tag, sc->sc_dma_map, sync_op); - slot->intmask &= ~DATA_XFER_MASK; + slot->intmask &= ~DATA_PENDING_MASK; bcm_sdhci_write_4(sc->sc_dev, slot, SDHCI_SIGNAL_ENABLE, slot->intmask); } @@ -601,7 +600,7 @@ bcm_sdhci_dma_exit(struct bcm_sdhci_softc *sc) mtx_assert(&slot->mtx, MA_OWNED); /* Re-enable interrupts */ - slot->intmask |= DATA_XFER_MASK; + slot->intmask |= DATA_PENDING_MASK; bcm_sdhci_write_4(slot->bus, slot, SDHCI_SIGNAL_ENABLE, slot->intmask); } @@ -655,12 +654,6 @@ bcm_sdhci_dma_intr(int ch, void *arg) sdhci_finish_data(slot); bcm_sdhci_dma_exit(sc); } - } else if ((reg & SDHCI_INT_DATA_END) != 0) { - bcm_sdhci_dma_exit(sc); - bcm_sdhci_write_4(slot->bus, slot, SDHCI_INT_STATUS, - reg); - slot->flags &= ~PLATFORM_DATA_STARTED; - sdhci_finish_data(slot); } else { bcm_sdhci_dma_exit(sc); } @@ -739,11 +732,7 @@ bcm_sdhci_finish_transfer(device_t dev, struct sdhci_s { struct bcm_sdhci_softc *sc = device_get_softc(slot->bus); - /* - * Clean up. Interrupts are clearly enabled, because we received an - * SDHCI_INT_DATA_END to get this far -- just make sure we don't leave - * anything laying around. - */ + /* Clean up */ if (sc->dmamap_seg_count != 0) { /* * Our segment math should have worked out such that we would @@ -764,6 +753,7 @@ bcm_sdhci_finish_transfer(device_t dev, struct sdhci_s sc->dmamap_seg_index = 0; } + bcm_sdhci_dma_exit(sc); sdhci_finish_data(slot); } From owner-svn-src-all@freebsd.org Thu Nov 21 02:47:55 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id CF3211AA727; Thu, 21 Nov 2019 02:47:55 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47JPB3571hz3FLr; Thu, 21 Nov 2019 02:47:55 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 79FD249A6; Thu, 21 Nov 2019 02:47:55 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xAL2ltoN046219; Thu, 21 Nov 2019 02:47:55 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xAL2ltl8046218; Thu, 21 Nov 2019 02:47:55 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201911210247.xAL2ltl8046218@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Thu, 21 Nov 2019 02:47:55 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354932 - head/sys/arm/broadcom/bcm2835 X-SVN-Group: head X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: head/sys/arm/broadcom/bcm2835 X-SVN-Commit-Revision: 354932 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 21 Nov 2019 02:47:55 -0000 Author: kevans Date: Thu Nov 21 02:47:55 2019 New Revision: 354932 URL: https://svnweb.freebsd.org/changeset/base/354932 Log: bcm2835_sdhci: roll back r354823 r354823 kicked DATA_END handling out of the DMA interrupt path "to make things easy", but this was likely a mistake -- if we know we're done after we've finished pending DMA operations, we should go ahead and acknowledge it rather than waiting for the controller to finalize it. If it's not ready, we'll simply re-enable interrupts and wait for it anyways, to be re-entered in sdhci_data_intr. Modified: head/sys/arm/broadcom/bcm2835/bcm2835_sdhci.c Modified: head/sys/arm/broadcom/bcm2835/bcm2835_sdhci.c ============================================================================== --- head/sys/arm/broadcom/bcm2835/bcm2835_sdhci.c Thu Nov 21 02:44:05 2019 (r354931) +++ head/sys/arm/broadcom/bcm2835/bcm2835_sdhci.c Thu Nov 21 02:47:55 2019 (r354932) @@ -87,6 +87,7 @@ __FBSDID("$FreeBSD$"); rounddown(BCM_SDHCI_SLOT_LEFT(slot), BCM_SDHCI_BUFFER_SIZE)) #define DATA_PENDING_MASK (SDHCI_INT_DATA_AVAIL | SDHCI_INT_SPACE_AVAIL) +#define DATA_XFER_MASK (DATA_PENDING_MASK | SDHCI_INT_DATA_END) #ifdef DEBUG static int bcm2835_sdhci_debug = 0; @@ -579,7 +580,7 @@ bcm_sdhci_start_dma_seg(struct bcm_sdhci_softc *sc) if (idx == 0) { bus_dmamap_sync(sc->sc_dma_tag, sc->sc_dma_map, sync_op); - slot->intmask &= ~DATA_PENDING_MASK; + slot->intmask &= ~DATA_XFER_MASK; bcm_sdhci_write_4(sc->sc_dev, slot, SDHCI_SIGNAL_ENABLE, slot->intmask); } @@ -600,7 +601,7 @@ bcm_sdhci_dma_exit(struct bcm_sdhci_softc *sc) mtx_assert(&slot->mtx, MA_OWNED); /* Re-enable interrupts */ - slot->intmask |= DATA_PENDING_MASK; + slot->intmask |= DATA_XFER_MASK; bcm_sdhci_write_4(slot->bus, slot, SDHCI_SIGNAL_ENABLE, slot->intmask); } @@ -625,6 +626,8 @@ bcm_sdhci_dma_intr(int ch, void *arg) goto out; } + if (sc->dmamap_seg_count == 0) + return; if ((slot->curcmd->data->flags & MMC_DATA_READ) != 0) bus_dmamap_sync(sc->sc_dma_tag, sc->sc_dma_map, BUS_DMASYNC_POSTREAD); @@ -654,6 +657,12 @@ bcm_sdhci_dma_intr(int ch, void *arg) sdhci_finish_data(slot); bcm_sdhci_dma_exit(sc); } + } else if ((reg & SDHCI_INT_DATA_END) != 0) { + bcm_sdhci_dma_exit(sc); + bcm_sdhci_write_4(slot->bus, slot, SDHCI_INT_STATUS, + reg); + slot->flags &= ~PLATFORM_DATA_STARTED; + sdhci_finish_data(slot); } else { bcm_sdhci_dma_exit(sc); } @@ -732,7 +741,11 @@ bcm_sdhci_finish_transfer(device_t dev, struct sdhci_s { struct bcm_sdhci_softc *sc = device_get_softc(slot->bus); - /* Clean up */ + /* + * Clean up. Interrupts are clearly enabled, because we received an + * SDHCI_INT_DATA_END to get this far -- just make sure we don't leave + * anything laying around. + */ if (sc->dmamap_seg_count != 0) { /* * Our segment math should have worked out such that we would @@ -753,7 +766,6 @@ bcm_sdhci_finish_transfer(device_t dev, struct sdhci_s sc->dmamap_seg_index = 0; } - bcm_sdhci_dma_exit(sc); sdhci_finish_data(slot); } From owner-svn-src-all@freebsd.org Thu Nov 21 02:49:42 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 8667B1AA80D; Thu, 21 Nov 2019 02:49:42 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47JPD62xrbz3FV5; Thu, 21 Nov 2019 02:49:42 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 2B92649A7; Thu, 21 Nov 2019 02:49:42 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xAL2ngn1046334; Thu, 21 Nov 2019 02:49:42 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xAL2ngIp046333; Thu, 21 Nov 2019 02:49:42 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201911210249.xAL2ngIp046333@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Thu, 21 Nov 2019 02:49:41 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354933 - head/sys/arm/broadcom/bcm2835 X-SVN-Group: head X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: head/sys/arm/broadcom/bcm2835 X-SVN-Commit-Revision: 354933 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 21 Nov 2019 02:49:42 -0000 Author: kevans Date: Thu Nov 21 02:49:41 2019 New Revision: 354933 URL: https://svnweb.freebsd.org/changeset/base/354933 Log: bcm2835_sdhci: clean up DMA segments in error handling path Later parts assume that this would've been done if interrupts are enabled, but this is the only case in which that wouldn't have been true. This commit also reorders operations such that we're done touching slot/slot->intmask before we call back into the SDHCI framework and exit. Modified: head/sys/arm/broadcom/bcm2835/bcm2835_sdhci.c Modified: head/sys/arm/broadcom/bcm2835/bcm2835_sdhci.c ============================================================================== --- head/sys/arm/broadcom/bcm2835/bcm2835_sdhci.c Thu Nov 21 02:47:55 2019 (r354932) +++ head/sys/arm/broadcom/bcm2835/bcm2835_sdhci.c Thu Nov 21 02:49:41 2019 (r354933) @@ -607,6 +607,25 @@ bcm_sdhci_dma_exit(struct bcm_sdhci_softc *sc) } static void +bcm_sdhci_dma_unload(struct bcm_sdhci_softc *sc) +{ + struct sdhci_slot *slot = &sc->sc_slot; + + if (sc->dmamap_seg_count == 0) + return; + if ((slot->curcmd->data->flags & MMC_DATA_READ) != 0) + bus_dmamap_sync(sc->sc_dma_tag, sc->sc_dma_map, + BUS_DMASYNC_POSTREAD); + else + bus_dmamap_sync(sc->sc_dma_tag, sc->sc_dma_map, + BUS_DMASYNC_POSTWRITE); + bus_dmamap_unload(sc->sc_dma_tag, sc->sc_dma_map); + + sc->dmamap_seg_count = 0; + sc->dmamap_seg_index = 0; +} + +static void bcm_sdhci_dma_intr(int ch, void *arg) { struct bcm_sdhci_softc *sc = (struct bcm_sdhci_softc *)arg; @@ -626,19 +645,8 @@ bcm_sdhci_dma_intr(int ch, void *arg) goto out; } - if (sc->dmamap_seg_count == 0) - return; - if ((slot->curcmd->data->flags & MMC_DATA_READ) != 0) - bus_dmamap_sync(sc->sc_dma_tag, sc->sc_dma_map, - BUS_DMASYNC_POSTREAD); - else - bus_dmamap_sync(sc->sc_dma_tag, sc->sc_dma_map, - BUS_DMASYNC_POSTWRITE); - bus_dmamap_unload(sc->sc_dma_tag, sc->sc_dma_map); + bcm_sdhci_dma_unload(sc); - sc->dmamap_seg_count = 0; - sc->dmamap_seg_index = 0; - /* * If we had no further segments pending, we need to determine how to * proceed next. If the 'data/space pending' bit is already set and we @@ -654,8 +662,10 @@ bcm_sdhci_dma_intr(int ch, void *arg) bcm_sdhci_start_dma(slot); if (slot->curcmd->error != 0) { - sdhci_finish_data(slot); + /* We won't recover from this error for this command. */ + bcm_sdhci_dma_unload(sc); bcm_sdhci_dma_exit(sc); + sdhci_finish_data(slot); } } else if ((reg & SDHCI_INT_DATA_END) != 0) { bcm_sdhci_dma_exit(sc); @@ -754,16 +764,7 @@ bcm_sdhci_finish_transfer(device_t dev, struct sdhci_s * regressed to SDHCI-driven PIO to finish the operation and * this is certainly caused by developer-error. */ - if (slot->curcmd->data->flags & MMC_DATA_READ) - bus_dmamap_sync(sc->sc_dma_tag, sc->sc_dma_map, - BUS_DMASYNC_POSTREAD); - else - bus_dmamap_sync(sc->sc_dma_tag, sc->sc_dma_map, - BUS_DMASYNC_POSTWRITE); - bus_dmamap_unload(sc->sc_dma_tag, sc->sc_dma_map); - - sc->dmamap_seg_count = 0; - sc->dmamap_seg_index = 0; + bcm_sdhci_dma_unload(sc); } sdhci_finish_data(slot); From owner-svn-src-all@freebsd.org Thu Nov 21 03:10:04 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 0A8041AB1BB; Thu, 21 Nov 2019 03:10:04 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47JPgb6H0Wz3Gll; Thu, 21 Nov 2019 03:10:03 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id BB7544DB6; Thu, 21 Nov 2019 03:10:03 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xAL3A3Tl059618; Thu, 21 Nov 2019 03:10:03 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xAL3A2QZ059614; Thu, 21 Nov 2019 03:10:02 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201911210310.xAL3A2QZ059614@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Thu, 21 Nov 2019 03:10:02 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354934 - head/sys/arm/conf X-SVN-Group: head X-SVN-Commit-Author: emaste X-SVN-Commit-Paths: head/sys/arm/conf X-SVN-Commit-Revision: 354934 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 21 Nov 2019 03:10:04 -0000 Author: emaste Date: Thu Nov 21 03:10:02 2019 New Revision: 354934 URL: https://svnweb.freebsd.org/changeset/base/354934 Log: mark arm.arm (v4/v5) kernels as NO_UNIVERSE for now r354290 removed arm.arm from universe, but arm.arm kernels were still found and built during the kernel stage. I'm not aware of a better way to address this at the moment, but since there aren't many arm.arm kernels anyhow just add an explicit NO_UNIVERSE to them. Reported by: rpokala Modified: head/sys/arm/conf/DB-78XXX head/sys/arm/conf/DB-88F5XXX head/sys/arm/conf/DB-88F6XXX head/sys/arm/conf/RT1310 head/sys/arm/conf/TS7800 Modified: head/sys/arm/conf/DB-78XXX ============================================================================== --- head/sys/arm/conf/DB-78XXX Thu Nov 21 02:49:41 2019 (r354933) +++ head/sys/arm/conf/DB-78XXX Thu Nov 21 03:10:02 2019 (r354934) @@ -3,6 +3,7 @@ # # $FreeBSD$ # +#NO_UNIVERSE ident DB-88F78XX include "std.arm" Modified: head/sys/arm/conf/DB-88F5XXX ============================================================================== --- head/sys/arm/conf/DB-88F5XXX Thu Nov 21 02:49:41 2019 (r354933) +++ head/sys/arm/conf/DB-88F5XXX Thu Nov 21 03:10:02 2019 (r354934) @@ -3,6 +3,7 @@ # # $FreeBSD$ # +#NO_UNIVERSE ident DB-88F5XXX include "std.arm" Modified: head/sys/arm/conf/DB-88F6XXX ============================================================================== --- head/sys/arm/conf/DB-88F6XXX Thu Nov 21 02:49:41 2019 (r354933) +++ head/sys/arm/conf/DB-88F6XXX Thu Nov 21 03:10:02 2019 (r354934) @@ -3,6 +3,7 @@ # # $FreeBSD$ # +#NO_UNIVERSE ident DB-88F6XXX include "std.arm" Modified: head/sys/arm/conf/RT1310 ============================================================================== --- head/sys/arm/conf/RT1310 Thu Nov 21 02:49:41 2019 (r354933) +++ head/sys/arm/conf/RT1310 Thu Nov 21 03:10:02 2019 (r354934) @@ -3,6 +3,7 @@ # # $FreeBSD$ # +#NO_UNIVERSE ident RT1310 include "std.arm" Modified: head/sys/arm/conf/TS7800 ============================================================================== --- head/sys/arm/conf/TS7800 Thu Nov 21 02:49:41 2019 (r354933) +++ head/sys/arm/conf/TS7800 Thu Nov 21 03:10:02 2019 (r354934) @@ -3,6 +3,7 @@ # # $FreeBSD$ # +#NO_UNIVERSE ident TS7800 include "std.arm" From owner-svn-src-all@freebsd.org Thu Nov 21 04:12:09 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 99C901ACB21; Thu, 21 Nov 2019 04:12:09 +0000 (UTC) (envelope-from gjb@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47JR3F3c1qz3KTZ; Thu, 21 Nov 2019 04:12:09 +0000 (UTC) (envelope-from gjb@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 5EC515A65; Thu, 21 Nov 2019 04:12:09 +0000 (UTC) (envelope-from gjb@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xAL4C9ZW000257; Thu, 21 Nov 2019 04:12:09 GMT (envelope-from gjb@FreeBSD.org) Received: (from gjb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xAL4C9YR000256; Thu, 21 Nov 2019 04:12:09 GMT (envelope-from gjb@FreeBSD.org) Message-Id: <201911210412.xAL4C9YR000256@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: gjb set sender to gjb@FreeBSD.org using -f From: Glen Barber Date: Thu, 21 Nov 2019 04:12:09 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354935 - head/usr.sbin/jail X-SVN-Group: head X-SVN-Commit-Author: gjb X-SVN-Commit-Paths: head/usr.sbin/jail X-SVN-Commit-Revision: 354935 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 21 Nov 2019 04:12:09 -0000 Author: gjb Date: Thu Nov 21 04:12:08 2019 New Revision: 354935 URL: https://svnweb.freebsd.org/changeset/base/354935 Log: Revert r354896, r354899, r354900: Fix build. Sponsored by: Rubicon Communications, LLC (netgate.com) Modified: head/usr.sbin/jail/Makefile Modified: head/usr.sbin/jail/Makefile ============================================================================== --- head/usr.sbin/jail/Makefile Thu Nov 21 03:10:02 2019 (r354934) +++ head/usr.sbin/jail/Makefile Thu Nov 21 04:12:08 2019 (r354935) @@ -15,13 +15,6 @@ NO_WMISSING_VARIABLE_DECLARATIONS= YFLAGS+=-v CFLAGS+=-I. -I${.CURDIR} -# workaround for GNU ld (GNU Binutils) 2.33.1: -# relocation truncated to fit: R_RISCV_GPREL_I against `.LANCHOR2' -# https://bugs.freebsd.org/242109 -.if ${LINKER_TYPE} == "bfd" && ${MACHINE} == "riscv" -CFLAGS+=-Wl,--no-relax -.endif - .if ${MK_INET6_SUPPORT} != "no" CFLAGS+= -DINET6 .endif From owner-svn-src-all@freebsd.org Thu Nov 21 05:23:54 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 67CA91AEAC4; Thu, 21 Nov 2019 05:23:54 +0000 (UTC) (envelope-from rpokala@freebsd.org) Received: from smtp.freebsd.org (smtp.freebsd.org [96.47.72.83]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "smtp.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47JSf222zsz3NQk; Thu, 21 Nov 2019 05:23:54 +0000 (UTC) (envelope-from rpokala@freebsd.org) Received: from [192.168.1.10] (unknown [IPv6:2601:641:300:6e9f:d102:fa20:71bd:aa36]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) (Authenticated sender: rpokala) by smtp.freebsd.org (Postfix) with ESMTPSA id 9D7FF4589; Thu, 21 Nov 2019 05:23:53 +0000 (UTC) (envelope-from rpokala@freebsd.org) User-Agent: Microsoft-MacOutlook/10.1f.0.191110 Date: Wed, 20 Nov 2019 21:23:48 -0800 Subject: Re: svn commit: r354934 - head/sys/arm/conf From: Ravi Pokala To: Ed Maste , , , Message-ID: Thread-Topic: svn commit: r354934 - head/sys/arm/conf References: <201911210310.xAL3A2QZ059614@repo.freebsd.org> In-Reply-To: <201911210310.xAL3A2QZ059614@repo.freebsd.org> Mime-version: 1.0 Content-type: text/plain; charset="UTF-8" Content-transfer-encoding: 7bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 21 Nov 2019 05:23:54 -0000 -----Original Message----- From: on behalf of Ed Maste Date: 2019-11-20, Wednesday at 19:10 To: , , Subject: svn commit: r354934 - head/sys/arm/conf Author: emaste Date: Thu Nov 21 03:10:02 2019 New Revision: 354934 URL: https://svnweb.freebsd.org/changeset/base/354934 Log: mark arm.arm (v4/v5) kernels as NO_UNIVERSE for now r354290 removed arm.arm from universe, but arm.arm kernels were still found and built during the kernel stage. I'm not aware of a better way to address this at the moment, but since there aren't many arm.arm kernels anyhow just add an explicit NO_UNIVERSE to them. Reported by: rpokala Thanks Ed! -Ravi Modified: head/sys/arm/conf/DB-78XXX head/sys/arm/conf/DB-88F5XXX head/sys/arm/conf/DB-88F6XXX head/sys/arm/conf/RT1310 head/sys/arm/conf/TS7800 Modified: head/sys/arm/conf/DB-78XXX ============================================================================== --- head/sys/arm/conf/DB-78XXX Thu Nov 21 02:49:41 2019 (r354933) +++ head/sys/arm/conf/DB-78XXX Thu Nov 21 03:10:02 2019 (r354934) @@ -3,6 +3,7 @@ # # $FreeBSD$ # +#NO_UNIVERSE ident DB-88F78XX include "std.arm" Modified: head/sys/arm/conf/DB-88F5XXX ============================================================================== --- head/sys/arm/conf/DB-88F5XXX Thu Nov 21 02:49:41 2019 (r354933) +++ head/sys/arm/conf/DB-88F5XXX Thu Nov 21 03:10:02 2019 (r354934) @@ -3,6 +3,7 @@ # # $FreeBSD$ # +#NO_UNIVERSE ident DB-88F5XXX include "std.arm" Modified: head/sys/arm/conf/DB-88F6XXX ============================================================================== --- head/sys/arm/conf/DB-88F6XXX Thu Nov 21 02:49:41 2019 (r354933) +++ head/sys/arm/conf/DB-88F6XXX Thu Nov 21 03:10:02 2019 (r354934) @@ -3,6 +3,7 @@ # # $FreeBSD$ # +#NO_UNIVERSE ident DB-88F6XXX include "std.arm" Modified: head/sys/arm/conf/RT1310 ============================================================================== --- head/sys/arm/conf/RT1310 Thu Nov 21 02:49:41 2019 (r354933) +++ head/sys/arm/conf/RT1310 Thu Nov 21 03:10:02 2019 (r354934) @@ -3,6 +3,7 @@ # # $FreeBSD$ # +#NO_UNIVERSE ident RT1310 include "std.arm" Modified: head/sys/arm/conf/TS7800 ============================================================================== --- head/sys/arm/conf/TS7800 Thu Nov 21 02:49:41 2019 (r354933) +++ head/sys/arm/conf/TS7800 Thu Nov 21 03:10:02 2019 (r354934) @@ -3,6 +3,7 @@ # # $FreeBSD$ # +#NO_UNIVERSE ident TS7800 include "std.arm" From owner-svn-src-all@freebsd.org Thu Nov 21 06:19:24 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 22BB21AFC44; Thu, 21 Nov 2019 06:19:24 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from springbank.echomania.com (springbank.echomania.com [IPv6:2a01:7c8:aab2:81::1]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "springbank.echomania.com", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47JTt406J4z3QJf; Thu, 21 Nov 2019 06:19:23 +0000 (UTC) (envelope-from dim@FreeBSD.org) X-Virus-Scanned: Debian amavisd-new at springbank.echomania.com Received: from [IPv6:2001:470:7a58::b153:8141:8ff8:6b7b] (unknown [IPv6:2001:470:7a58:0:b153:8141:8ff8:6b7b]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by springbank.echomania.com (Postfix) with ESMTPSA id EA62F5801C2; Thu, 21 Nov 2019 07:19:14 +0100 (CET) From: Dimitry Andric Message-Id: <5E3130FE-7763-4942-997C-0E325DCF48E6@FreeBSD.org> Content-Type: multipart/signed; boundary="Apple-Mail=_D34CCDE7-29F5-481C-9F62-2041A39A7771"; protocol="application/pgp-signature"; micalg=pgp-sha1 Mime-Version: 1.0 (Mac OS X Mail 12.4 \(3445.104.11\)) Subject: Re: svn commit: r354900 - head/usr.sbin/jail Date: Thu, 21 Nov 2019 07:19:08 +0100 In-Reply-To: <5d4541f5-fe6c-ecc7-c383-0dfd9596ec0f@FreeBSD.org> Cc: "Bjoern A. Zeeb" , Warner Losh , src-committers , svn-src-all , svn-src-head To: John Baldwin References: <201911201654.xAKGsMTv094014@repo.freebsd.org> <59bf120c-2f35-1a22-b6fa-a9c9bb8cfdf4@FreeBSD.org> <991bdc33-516d-6e6d-1880-44930441893d@FreeBSD.org> <5d4541f5-fe6c-ecc7-c383-0dfd9596ec0f@FreeBSD.org> X-Mailer: Apple Mail (2.3445.104.11) X-Rspamd-Queue-Id: 47JTt406J4z3QJf X-Spamd-Bar: ----- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-5.97 / 15.00]; NEURAL_HAM_MEDIUM(-0.98)[-0.985,0]; NEURAL_HAM_LONG(-0.99)[-0.988,0]; REPLY(-4.00)[] X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 21 Nov 2019 06:19:24 -0000 --Apple-Mail=_D34CCDE7-29F5-481C-9F62-2041A39A7771 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=us-ascii On 21 Nov 2019, at 01:44, John Baldwin wrote: > > On 11/20/19 3:42 PM, Bjoern A. Zeeb wrote: >> On 20 Nov 2019, at 23:32, John Baldwin wrote: ... >> You can however find more of these elsewhere: >> >> ../lib/libc/tests/sys/Makefile:.if ${MACHINE_CPUARCH} != "aarch64" && >> ${MACHINE_CPUARCH} != "riscv" >> ../lib/libcompiler_rt/Makefile.inc:.if ${MACHINE_CPUARCH} == "aarch64" >> || ${MACHINE_CPUARCH} == "riscv" >> ../stand/libsa/Makefile:.if ${MACHINE_CPUARCH} == "aarch64" || >> ${MACHINE_CPUARCH} == "riscv" >> ../usr.bin/Makefile:.if ${MACHINE_ARCH} != "aarch64" && >> ${MACHINE_CPUARCH} != "riscv" >> ../usr.bin/gprof/Makefile:.if ${MACHINE_ARCH} != "aarch64" && >> ${MACHINE_ARCH} != "riscv" && \ > > The tests comparing MACHINE_CPUARCH against aarch64 are confusing indeed. > My understanding is that MACHINE_CPUARCH is arm64 for aarch64? It's kind > of hard to guess since arch(7) goes to great length to try to describe > these variables but doesn't give a handy table of what they actually are > for the various architectures. Yes, such a table would be extremely helpful. :) -Dimitry --Apple-Mail=_D34CCDE7-29F5-481C-9F62-2041A39A7771 Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename=signature.asc Content-Type: application/pgp-signature; name=signature.asc Content-Description: Message signed with OpenPGP -----BEGIN PGP SIGNATURE----- Version: GnuPG/MacGPG2 v2.2 iF0EARECAB0WIQR6tGLSzjX8bUI5T82wXqMKLiCWowUCXdYsXAAKCRCwXqMKLiCW o3gYAJ9ZVQ6eCBvDnLVXRgtVMw/JHHbFWwCgp7y9yIphOvEsqIn2vZURojoJ0Mg= =MmwS -----END PGP SIGNATURE----- --Apple-Mail=_D34CCDE7-29F5-481C-9F62-2041A39A7771-- From owner-svn-src-all@freebsd.org Thu Nov 21 06:28:29 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id DC6A91AFFA7 for ; Thu, 21 Nov 2019 06:28:29 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: from mail-qt1-x831.google.com (mail-qt1-x831.google.com [IPv6:2607:f8b0:4864:20::831]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47JV4X6NS1z3Qjx for ; Thu, 21 Nov 2019 06:28:28 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: by mail-qt1-x831.google.com with SMTP id o49so2490673qta.7 for ; Wed, 20 Nov 2019 22:28:28 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bsdimp-com.20150623.gappssmtp.com; s=20150623; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=WzVtbKm6TR3zrjsZv1jMKAKIPgXfrDr49t4GoSRhSes=; b=Z9BoU+1QFmS8nh7ose3bmUkwPKdcbz0TKmc5ZtS8GjD5u5wVloCl5uAU+2q1QFP4XW e1a455xhU1MGsQfucJb6+lg6hamJlVOo1E6TVnbbXy+sCPruGAa6xJ4JgJpd9ajo5FnQ 6dExdwTnsMhZCicmwtWMGAqJAVGXLSFtSl5C+KCiBEn4MMMQ9TLo0H2dFEsMuQhsvc0W YLcr8Rbm1oIZDaojZvpNwF7qlmzG11eCr2ju91/003Hh1OxI0Xb/1AZvrMnsypTHbZ3u oIHZjmXCkjNH+rQN6GTDEjUlavyus6CiJLygS5NxUoB/LU5b3GmF+SW3wiFlHxDms3yp zaAQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=WzVtbKm6TR3zrjsZv1jMKAKIPgXfrDr49t4GoSRhSes=; b=ucnTdp2RrzbSX+UPd4Q6jh5yeIIhC2WXv6ErULZSuG48TttioZNpHz1EP3xAgDwHQv UZrmlStn4C4Q0mh8FL4QlBacyTDrI2WB0k2CN+CvGELSxFh5YLWaphNbdafTluRa3vD4 uTgaUYO2t6T99mptyU1myTJgVct5B/zDBDXh86xHCSiQfz+TAMaBZ2OgCDKiAwKDHoNU 94eOGObelpIxRQBO/GvUo8p6nYNWDtklnxdLmQxE5NniOS8XZ3YUODZjP8ydeBwWqjLy UZylfXJ2eCNhvPVDePhTWSqkYQWumu5qvsOV65IES4urEn9D3hHFoqLTjexO0EnBUL86 fZ0Q== X-Gm-Message-State: APjAAAXcnVLUyOILK6HooBUBg8a/4gyjv+/rFqdRifJkti/lqtSR4Iyx nDZ1/PhMExV79baYq88mZpvNfsvZu8uY2dQIZorB0itm X-Google-Smtp-Source: APXvYqzXcKRlcz0VW5rtyZx6Bd9kp1o7n2fSua8qfywKocOniCouIa37giHRogUXEK2J1bEJr2nzPUk6a5ZivtYUnik= X-Received: by 2002:ac8:754c:: with SMTP id b12mr6927242qtr.291.1574317707322; Wed, 20 Nov 2019 22:28:27 -0800 (PST) MIME-Version: 1.0 References: <201911201654.xAKGsMTv094014@repo.freebsd.org> <59bf120c-2f35-1a22-b6fa-a9c9bb8cfdf4@FreeBSD.org> <991bdc33-516d-6e6d-1880-44930441893d@FreeBSD.org> In-Reply-To: <991bdc33-516d-6e6d-1880-44930441893d@FreeBSD.org> From: Warner Losh Date: Wed, 20 Nov 2019 23:28:16 -0700 Message-ID: Subject: Re: svn commit: r354900 - head/usr.sbin/jail To: John Baldwin Cc: Li-Wen Hsu , src-committers , svn-src-all , svn-src-head X-Rspamd-Queue-Id: 47JV4X6NS1z3Qjx X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; dkim=pass header.d=bsdimp-com.20150623.gappssmtp.com header.s=20150623 header.b=Z9BoU+1Q; dmarc=none; spf=none (mx1.freebsd.org: domain of wlosh@bsdimp.com has no SPF policy when checking 2607:f8b0:4864:20::831) smtp.mailfrom=wlosh@bsdimp.com X-Spamd-Result: default: False [-4.72 / 15.00]; ARC_NA(0.00)[]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; R_DKIM_ALLOW(-0.20)[bsdimp-com.20150623.gappssmtp.com:s=20150623]; FROM_HAS_DN(0.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; MIME_GOOD(-0.10)[multipart/alternative,text/plain]; PREVIOUSLY_DELIVERED(0.00)[svn-src-all@freebsd.org]; DMARC_NA(0.00)[bsdimp.com]; RCPT_COUNT_FIVE(0.00)[5]; TO_MATCH_ENVRCPT_SOME(0.00)[]; TO_DN_ALL(0.00)[]; DKIM_TRACE(0.00)[bsdimp-com.20150623.gappssmtp.com:+]; RCVD_IN_DNSWL_NONE(0.00)[1.3.8.0.0.0.0.0.0.0.0.0.0.0.0.0.0.2.0.0.4.6.8.4.0.b.8.f.7.0.6.2.list.dnswl.org : 127.0.5.0]; R_SPF_NA(0.00)[]; FORGED_SENDER(0.30)[imp@bsdimp.com,wlosh@bsdimp.com]; MIME_TRACE(0.00)[0:+,1:+,2:~]; IP_SCORE(-2.72)[ip: (-9.26), ipnet: 2607:f8b0::/32(-2.29), asn: 15169(-1.97), country: US(-0.05)]; ASN(0.00)[asn:15169, ipnet:2607:f8b0::/32, country:US]; FROM_NEQ_ENVFROM(0.00)[imp@bsdimp.com,wlosh@bsdimp.com]; RCVD_TLS_ALL(0.00)[]; RCVD_COUNT_TWO(0.00)[2] Content-Type: text/plain; charset="UTF-8" X-Content-Filtered-By: Mailman/MimeDel 2.1.29 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 21 Nov 2019 06:28:29 -0000 On Wed, Nov 20, 2019 at 4:32 PM John Baldwin wrote: > On 11/20/19 3:04 PM, Warner Losh wrote: > > On Wed, Nov 20, 2019 at 3:09 PM John Baldwin wrote: > > > >> On 11/20/19 10:01 AM, Warner Losh wrote: > >>> On Wed, Nov 20, 2019 at 9:54 AM Li-Wen Hsu wrote: > >>> > >>>> Author: lwhsu > >>>> Date: Wed Nov 20 16:54:21 2019 > >>>> New Revision: 354900 > >>>> URL: https://svnweb.freebsd.org/changeset/base/354900 > >>>> > >>>> Log: > >>>> Use the correct variable, also limit the scope to bfd > >>>> > >>>> PR: 242109 > >>>> Reported by: jhb > >>>> Sponsored by: The FreeBSD Foundation > >>>> > >>>> Modified: > >>>> head/usr.sbin/jail/Makefile > >>>> > >>>> Modified: head/usr.sbin/jail/Makefile > >>>> > >>>> > >> > ============================================================================== > >>>> --- head/usr.sbin/jail/Makefile Wed Nov 20 16:35:58 2019 > >> (r354899) > >>>> +++ head/usr.sbin/jail/Makefile Wed Nov 20 16:54:21 2019 > >> (r354900) > >>>> @@ -18,7 +18,7 @@ CFLAGS+=-I. -I${.CURDIR} > >>>> # workaround for GNU ld (GNU Binutils) 2.33.1: > >>>> # relocation truncated to fit: R_RISCV_GPREL_I against `.LANCHOR2' > >>>> # https://bugs.freebsd.org/242109 > >>>> -.if ${MACHINE_ARCH} == "riscv" > >>>> +.if ${LINKER_TYPE} == "bfd" && ${MACHINE} == "riscv" > >>>> > >>> > >>> MACHINE isn't the right thing to use here. It's never the proper thing > in > >>> userland makefiles, unless they are interfacing with the kernel. > >>> > >>> MACHINE_CPUARCH is what you want here. > >> > >> Eh, that claim doesn't seem quite true. src.opts.mk only uses MACHINE > >> and not > >> MACHINE_CPUARCH for example (to set _TT that is then used all over the > >> place in src.opts.mk). My experience is that uses of *_CPUARCH are in > >> fact > >> pretty rare. > >> > > > > However, __TT is used bogusly in many places in src.opts.mk. They are > all > > relatively new related to llvm (and one for google test). MACHINE has > > always been for the kernel and MACHINE_ARCH for userland. MACHINE_CPUARCH > > was created for those architectures where we have a number of > MACHINE_ARCH > > to make things easier to cope with. > > > > I've done several sweeps of the tree over the years to keep this > enforced, > > so I'm quite sure of the dichotomy... > > Here are some to fix then: :) > > sbin/reboot/Makefile:.if exists(${.CURDIR}/boot_${MACHINE}.8) > sbin/reboot/Makefile:MAN+= boot_${MACHINE}.8 > sbin/reboot/Makefile:MLINKS+= boot_${MACHINE}.8 boot.8 > sbin/reboot/Makefile:.if ${MACHINE} == "amd64" > usr.sbin/bsdinstall/partedit/Makefile:PARTEDIT_ARCH= ${MACHINE} > usr.sbin/bsdinstall/partedit/Makefile:.if ${MACHINE} == "i386" || > ${MACHINE} == "amd64" > usr.sbin/pkg/Makefile:. if ${MACHINE} != "amd64" && ${MACHINE} != "i386" > I'm not sure these are wrong... reboot is based on the kernel we're running, though. partedit is based on what kind of partition scheme the kernel wants. pkg is just wrong, though. Traditionally in BSD, different ways of booting usually went hand and hand with needing different kernels. Though after BSD passed from mini/micro computers where this was true into embedded things got blurrier. Likewise with the partitioning schemes: those used to be different for every type of computer, but now have standardized around GPT with a few legacy systems like MBR and APM lingering on. BSD labels were originally invented to have a standard way to label a disk, but even that grew a lot of variations. > This one also seems dubious, but in a different way: > > usr.bin/Makefile: > > # ARM64TODO gprof does not build > # RISCVTODO gprof does not build > .if ${MACHINE_ARCH} != "aarch64" && ${MACHINE_CPUARCH} != "riscv" > SUBDIR.${MK_TOOLCHAIN}+= gprof > .endif > Yes. That's likely incorrect. > Somewhat exacerbated by the whole aarch64 vs arm64 thing and probably confusion on when to use CPUARCH vs ARCH. When I invented CPUARCH, I didn't make it as clean as I'd like. It's always for 'what directory do we use in the tree' and is also convenient for other things. It was thought you'd use CPUARCH when you are testing generically for an arch. You'd use MACHINE_ARCH when you needed a specific one (so both of these should be MACHINE_CPUARCH). The notion was you'd only need to use MACHINE_ARCH rarely in ifdefs and usually only inside of system-wide .mk files. > BTW, MACHINE_ARCH seems to matter just as much for the kernel. 64-bit > mips runs a "mips64" kernel, not a "mips" kernel. > It does. With PC-98 removed, I don't think we have any cases where MACHINE != > MACHINE_CPUARCH now? > Well, there's arm64 / aarch64. I'm not at all opposed to changing the definitions, but they are what I've been saying. I've done a lot of cleanup of mis-uses over the last 10 or 15 years, so these characterizations are correct. I'll admit I've done not the best job at documenting it, though. Coming up with new definitions is fraught, I'd think, since it's easy to have a notion of what the right thing is, but harder to cast it into good prose that's clear to a wide audience. Warner From owner-svn-src-all@freebsd.org Thu Nov 21 06:31:10 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 91A5C1B0092 for ; Thu, 21 Nov 2019 06:31:10 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: from mail-qk1-x72d.google.com (mail-qk1-x72d.google.com [IPv6:2607:f8b0:4864:20::72d]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47JV7d3Z6Nz3R1D for ; Thu, 21 Nov 2019 06:31:09 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: by mail-qk1-x72d.google.com with SMTP id d13so2151451qko.3 for ; Wed, 20 Nov 2019 22:31:09 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bsdimp-com.20150623.gappssmtp.com; s=20150623; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=FtvyhhHNUipD17B3ywLWmSa2zqTNvNYGJhgDS3ApjL4=; b=sfoGbgZf+SswcF3KmGUV8ITFP756iyvgyiH4sWSA7tUc3fYIe4C0rkbaoIPG7J//Ci J87uFpC2j2j/1V9QrCVBnO/D5bc3OORnadTk0kc5kD3E1hAX+X4BT6FT10/UbRGzNz1T TlF2sXEsykirV9whdsk9L8RmVHjmDpJ/TKGgwZZXLGW+TB7lptHmEeHP/sc9ml4vshJJ oRywVhMDsll0K+uR2eZd3ukiD7daz4fZb+GIglq6Zac1DoweHFpkN77IEdDNAIBPF+Sk /9aByuMmnAGietl32LhZKSO8De/g8I5Qbc8RwoJ7K8EmWS+fsJIFGPkvC5UyK/4UUYMI cB4g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=FtvyhhHNUipD17B3ywLWmSa2zqTNvNYGJhgDS3ApjL4=; b=nLENqXUwVMCFdRCJ4cHEKj/vn75pfv+R5Xd57cVn/1gmoouYZvrT+q+Q4pCUh2u6Jv F1Q3pc+1lAhdP8E9H+RSdxxcw50uX5NxM/Soi/Z4ItBX+z9f185Aowj0gftoJoAiOZQJ TqW2DAoE4GfSvJzCi58fa9KmTbZHbbTiPvkW6ALNfFRPiNrlkq/ZjyCrwzv3q5Cp/C/Z FHKHRY7wdtHJBKU583IVX4xPyCsJnKrcIXPgQ+mKALO2QvISvcWfIRzceeajoExfq3jE RuF/7bqLwEIEzr9cOegMMBPJzyIowUDsL6IZ8O+MaQp5MUZTmngtXevmYopLXG5GtpA1 MjAQ== X-Gm-Message-State: APjAAAXdiIWX4NYI26SiTG391MXrXRTi+AMvWWx3rWQdbyOoMyFodvgU /Ae6jZZxHsq4uFikPBY11BgHytESFbqZjBBxI0BUMw== X-Google-Smtp-Source: APXvYqwDdh4TVOZiJkt0l5osC+zasJDZ+V3/ZC0mSJL7LW+nOqR5H9qVp/X3Nyfem0U7kX9Y0XRYuf967pk2CZ+0y8U= X-Received: by 2002:a05:620a:144:: with SMTP id e4mr2339171qkn.240.1574317868126; Wed, 20 Nov 2019 22:31:08 -0800 (PST) MIME-Version: 1.0 References: <201911201654.xAKGsMTv094014@repo.freebsd.org> <59bf120c-2f35-1a22-b6fa-a9c9bb8cfdf4@FreeBSD.org> <991bdc33-516d-6e6d-1880-44930441893d@FreeBSD.org> <5d4541f5-fe6c-ecc7-c383-0dfd9596ec0f@FreeBSD.org> <5E3130FE-7763-4942-997C-0E325DCF48E6@FreeBSD.org> In-Reply-To: <5E3130FE-7763-4942-997C-0E325DCF48E6@FreeBSD.org> From: Warner Losh Date: Wed, 20 Nov 2019 23:30:57 -0700 Message-ID: Subject: Re: svn commit: r354900 - head/usr.sbin/jail To: Dimitry Andric Cc: John Baldwin , "Bjoern A. Zeeb" , src-committers , svn-src-all , svn-src-head X-Rspamd-Queue-Id: 47JV7d3Z6Nz3R1D X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; dkim=pass header.d=bsdimp-com.20150623.gappssmtp.com header.s=20150623 header.b=sfoGbgZf; dmarc=none; spf=none (mx1.freebsd.org: domain of wlosh@bsdimp.com has no SPF policy when checking 2607:f8b0:4864:20::72d) smtp.mailfrom=wlosh@bsdimp.com X-Spamd-Result: default: False [-4.73 / 15.00]; ARC_NA(0.00)[]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; R_DKIM_ALLOW(-0.20)[bsdimp-com.20150623.gappssmtp.com:s=20150623]; FROM_HAS_DN(0.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; MIME_GOOD(-0.10)[multipart/alternative,text/plain]; PREVIOUSLY_DELIVERED(0.00)[svn-src-all@freebsd.org]; DMARC_NA(0.00)[bsdimp.com]; RCPT_COUNT_FIVE(0.00)[6]; TO_MATCH_ENVRCPT_SOME(0.00)[]; TO_DN_ALL(0.00)[]; DKIM_TRACE(0.00)[bsdimp-com.20150623.gappssmtp.com:+]; RCVD_IN_DNSWL_NONE(0.00)[d.2.7.0.0.0.0.0.0.0.0.0.0.0.0.0.0.2.0.0.4.6.8.4.0.b.8.f.7.0.6.2.list.dnswl.org : 127.0.5.0]; R_SPF_NA(0.00)[]; FORGED_SENDER(0.30)[imp@bsdimp.com,wlosh@bsdimp.com]; MIME_TRACE(0.00)[0:+,1:+,2:~]; IP_SCORE(-2.73)[ip: (-9.33), ipnet: 2607:f8b0::/32(-2.29), asn: 15169(-1.97), country: US(-0.05)]; ASN(0.00)[asn:15169, ipnet:2607:f8b0::/32, country:US]; FROM_NEQ_ENVFROM(0.00)[imp@bsdimp.com,wlosh@bsdimp.com]; RCVD_TLS_ALL(0.00)[]; RCVD_COUNT_TWO(0.00)[2] Content-Type: text/plain; charset="UTF-8" X-Content-Filtered-By: Mailman/MimeDel 2.1.29 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 21 Nov 2019 06:31:10 -0000 On Wed, Nov 20, 2019 at 11:19 PM Dimitry Andric wrote: > On 21 Nov 2019, at 01:44, John Baldwin wrote: > > > > On 11/20/19 3:42 PM, Bjoern A. Zeeb wrote: > >> On 20 Nov 2019, at 23:32, John Baldwin wrote: > ... > >> You can however find more of these elsewhere: > >> > >> ../lib/libc/tests/sys/Makefile:.if ${MACHINE_CPUARCH} != "aarch64" && > >> ${MACHINE_CPUARCH} != "riscv" > >> ../lib/libcompiler_rt/Makefile.inc:.if ${MACHINE_CPUARCH} == "aarch64" > >> || ${MACHINE_CPUARCH} == "riscv" > >> ../stand/libsa/Makefile:.if ${MACHINE_CPUARCH} == "aarch64" || > >> ${MACHINE_CPUARCH} == "riscv" > >> ../usr.bin/Makefile:.if ${MACHINE_ARCH} != "aarch64" && > >> ${MACHINE_CPUARCH} != "riscv" > >> ../usr.bin/gprof/Makefile:.if ${MACHINE_ARCH} != "aarch64" && > >> ${MACHINE_ARCH} != "riscv" && \ > > > > The tests comparing MACHINE_CPUARCH against aarch64 are confusing indeed. > > My understanding is that MACHINE_CPUARCH is arm64 for aarch64? It's kind > > of hard to guess since arch(7) goes to great length to try to describe > > these variables but doesn't give a handy table of what they actually are > > for the various architectures. > > Yes, such a table would be extremely helpful. :) > Fair point. It does go on at length for all the MACHINE_ARCH types, but doesn't list the plain MACHINE_CPUARCH. In all cases, it is either the one MACHINE_ARCH supported, or the common prefix of all the MACHINE_ARCH supported (though when we delete armv5, that will become slightly inaccurate, so a table is likely good). Warner From owner-svn-src-all@freebsd.org Thu Nov 21 06:31:30 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id BEFAB1B00FF; Thu, 21 Nov 2019 06:31:30 +0000 (UTC) (envelope-from danfe@freebsd.org) Received: from freefall.freebsd.org (freefall.freebsd.org [96.47.72.132]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "freefall.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47JV824jXdz3R8W; Thu, 21 Nov 2019 06:31:30 +0000 (UTC) (envelope-from danfe@freebsd.org) Received: by freefall.freebsd.org (Postfix, from userid 1033) id 8193C931A; Thu, 21 Nov 2019 06:31:30 +0000 (UTC) Date: Thu, 21 Nov 2019 06:31:30 +0000 From: Alexey Dokuchaev To: Warner Losh Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r354922 - in head: etc libexec/rc libexec/rc/rc.d share/man/man5 sys/sys Message-ID: <20191121063130.GA64098@FreeBSD.org> References: <201911202345.xAKNjVEl038814@repo.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <201911202345.xAKNjVEl038814@repo.freebsd.org> User-Agent: Mutt/1.11.4 (2019-03-13) X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 21 Nov 2019 06:31:30 -0000 On Wed, Nov 20, 2019 at 11:45:31PM +0000, Warner Losh wrote: > New Revision: 354922 > URL: https://svnweb.freebsd.org/changeset/base/354922 > > Log: > Create /etc/os-release file. > > Each boot, regenerate /var/run/os-release based on the currently > running system. Create a /etc/os-release symlink pointing to this > file (so that this doesn't create a new reason /etc can not be > mounted read-only). > > This is compatible with what other systems do and is what the > sysutil/os-release port attempted to do, but in an incomplete way. Thanks! Hopefully, `sysutil/os-release' can be wiped out soon: not just it was placed under wrong category, but it was badly and quite unreadably coded. ./danfe From owner-svn-src-all@freebsd.org Thu Nov 21 06:44:20 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 5CB041B0838; Thu, 21 Nov 2019 06:44:20 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47JVQr1kG4z3x2v; Thu, 21 Nov 2019 06:44:20 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 1A4E974FA; Thu, 21 Nov 2019 06:44:20 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xAL6iJkW087733; Thu, 21 Nov 2019 06:44:19 GMT (envelope-from imp@FreeBSD.org) Received: (from imp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xAL6iJPW087732; Thu, 21 Nov 2019 06:44:19 GMT (envelope-from imp@FreeBSD.org) Message-Id: <201911210644.xAL6iJPW087732@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: imp set sender to imp@FreeBSD.org using -f From: Warner Losh Date: Thu, 21 Nov 2019 06:44:19 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354936 - head/share/man/man7 X-SVN-Group: head X-SVN-Commit-Author: imp X-SVN-Commit-Paths: head/share/man/man7 X-SVN-Commit-Revision: 354936 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 21 Nov 2019 06:44:20 -0000 Author: imp Date: Thu Nov 21 06:44:19 2019 New Revision: 354936 URL: https://svnweb.freebsd.org/changeset/base/354936 Log: Add table for MACHINE_CPUARCH Add table and also some additional verbage of which one to use. Modified: head/share/man/man7/arch.7 Modified: head/share/man/man7/arch.7 ============================================================================== --- head/share/man/man7/arch.7 Thu Nov 21 04:12:08 2019 (r354935) +++ head/share/man/man7/arch.7 Thu Nov 21 06:44:19 2019 (r354936) @@ -26,7 +26,7 @@ .\" .\" $FreeBSD$ .\" -.Dd November 7, 2019 +.Dd November 20, 2019 .Dt ARCH 7 .Os .Sh NAME @@ -347,6 +347,24 @@ Unless the make variable is defined, make universe will not build mips, powerpc, nor sparc64 architectures unless the xtoolchain binaries have been installed for the architecture. +.Ss MACHINE_ARCH vs MACHINE_CPUARCH +.Dv MACHINE_CPUARCH +should be preferred in Makefiles when the generic +architecture is being tested. +.Dv MACHINE_ARCH +should be preferred when there is something specific to a particular type of +architecture where there is a choice of many, or could be a choice of many. +.Bl -column -offset indent "Dv MACHINE" "Dv MACHINE_CPUARCH" "Dv MACHINE_ARCH" +.It Dv MACHINE Ta Dv MACHINE_CPUARCH Ta Dv MACHINE_ARCH +.It arm64 Ta aarch64 Ta aarch64 +.It amd64 Ta amd64 Ta amd64 +.It arm Ta arm Ta arm, armv6, armv7 +.It i386 Ta i386 Ta i386 +.It mips Ta mips Ta mips, mipsel, mips64, mips64el, mipshf, mipselhf, mips64elhf, mipsn32 +.It powerpc Ta powerpc Ta powerpc, powerpcspe, powerpc64 +.It riscv Ta riscv Ta riscv64, riscv64sf +.It sparc64 Ta sparc64 Ta sparc64 +.El .Ss Predefined Macros The compiler provides a number of predefined macros. Some of these provide architecture-specific details and are explained below. @@ -473,6 +491,8 @@ There is no standard name for the processor: each OS s conventions. .It Dv MACHINE_CPUARCH Represents the source location for a given .Dv MACHINE_ARCH . +It is generally the common prefix for all the MACHINE_ARCH that +share the same implementation, though 'riscv' breaks this rule. For example, .Dv MACHINE_CPUARCH is defined to be mips for all the flavors of mips that we support From owner-svn-src-all@freebsd.org Thu Nov 21 06:45:43 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id CC2381B0942 for ; Thu, 21 Nov 2019 06:45:43 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: from mail-qk1-x733.google.com (mail-qk1-x733.google.com [IPv6:2607:f8b0:4864:20::733]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47JVSQ5VbNz3xB6 for ; Thu, 21 Nov 2019 06:45:42 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: by mail-qk1-x733.google.com with SMTP id m16so2118005qki.11 for ; Wed, 20 Nov 2019 22:45:42 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bsdimp-com.20150623.gappssmtp.com; s=20150623; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=BxyU4JTlTtM6HNpVB68ncn9fhtKx444zW183xRVARLE=; b=QHh5cUb3VB+WqmKB4lP+zf9u1BSFbMZTsNU7oN9GAtTecxviS0UpnnWbITTCc56Jn8 tIYis2P7XNMtuPeUzxc1VhXr4O9UzjsRma5kpjJb3SO+7wBjIxdz1LsWRCEosndnia/2 FV9q5Zb2t66y3P2hBwhO1kMFelj38TJ4KXOBACT5ddmsTdXVi3ShOUzKPBuVqYxmKVCD 0HHXhh+yCkpBvZ8qbDLbKcw4KNKJdD0wNIbWUZVJgHRDylaHXlQMhVhQ9DSiNwihqAZn TprC8VRyMXQjZTxaUmncAmkgqvU+bbBSMBif8dIMLRlOv1p+vIkrvMw7xHn4zvzVLaLG FIaQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=BxyU4JTlTtM6HNpVB68ncn9fhtKx444zW183xRVARLE=; b=suJTVobTzGviyIJ7RwnLvkK84zzSlLHPNPS0C89boFZUpW0U2WMKhS5+sIDL2mpql1 1r+MFKNFwH6X5pGP+S/dzO5n0iI2BGenSdEnsxtxu2I4LwgAHoQfa59J+t2jD3mICHW2 4chc6P+6O+/abWOdrlFWH3G+fhtH/3K8gDdiVLrHde8ynv2gk0mP4e3C1kEwLzz6G1vd tkYQF3wIN4zyOxMQ6pNnppAcJ1dOEkSLPxT87l7q9sexJSkqNPA3Bg/uNDs7qoGB0eVT ddYZD5HacGqJntkBQHXwsFZqAkfHEs3vM0YJS5wE6rlrFUzBJm2/vMU61CoZ+wwICMSJ Stsg== X-Gm-Message-State: APjAAAVmuq3qAe6oa8P4hzbmTi0Fy7r2UDjRIlcQmtZdjzRnKNahl4c1 l12SaipL1p+KFMxbxdIIrKXkV+BYwbzab0sx+Bkr2yAs X-Google-Smtp-Source: APXvYqyJLaNkQ0BWyb6sJejyNdLhgIuCc7wPFSO73VtMo0oaKwo78MDDg+P68lhFuDoEIzy4RYIJJI1oVt9UDxLkawU= X-Received: by 2002:a37:aa11:: with SMTP id t17mr1888758qke.60.1574318741441; Wed, 20 Nov 2019 22:45:41 -0800 (PST) MIME-Version: 1.0 References: <201911201654.xAKGsMTv094014@repo.freebsd.org> <59bf120c-2f35-1a22-b6fa-a9c9bb8cfdf4@FreeBSD.org> <991bdc33-516d-6e6d-1880-44930441893d@FreeBSD.org> In-Reply-To: From: Warner Losh Date: Wed, 20 Nov 2019 23:45:30 -0700 Message-ID: Subject: Re: svn commit: r354900 - head/usr.sbin/jail To: John Baldwin Cc: Li-Wen Hsu , src-committers , svn-src-all , svn-src-head X-Rspamd-Queue-Id: 47JVSQ5VbNz3xB6 X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; dkim=pass header.d=bsdimp-com.20150623.gappssmtp.com header.s=20150623 header.b=QHh5cUb3; dmarc=none; spf=none (mx1.freebsd.org: domain of wlosh@bsdimp.com has no SPF policy when checking 2607:f8b0:4864:20::733) smtp.mailfrom=wlosh@bsdimp.com X-Spamd-Result: default: False [-4.71 / 15.00]; ARC_NA(0.00)[]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; R_DKIM_ALLOW(-0.20)[bsdimp-com.20150623.gappssmtp.com:s=20150623]; FROM_HAS_DN(0.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; MIME_GOOD(-0.10)[multipart/alternative,text/plain]; PREVIOUSLY_DELIVERED(0.00)[svn-src-all@freebsd.org]; DMARC_NA(0.00)[bsdimp.com]; RCPT_COUNT_FIVE(0.00)[5]; TO_MATCH_ENVRCPT_SOME(0.00)[]; TO_DN_ALL(0.00)[]; DKIM_TRACE(0.00)[bsdimp-com.20150623.gappssmtp.com:+]; RCVD_IN_DNSWL_NONE(0.00)[3.3.7.0.0.0.0.0.0.0.0.0.0.0.0.0.0.2.0.0.4.6.8.4.0.b.8.f.7.0.6.2.list.dnswl.org : 127.0.5.0]; R_SPF_NA(0.00)[]; FORGED_SENDER(0.30)[imp@bsdimp.com,wlosh@bsdimp.com]; MIME_TRACE(0.00)[0:+,1:+,2:~]; IP_SCORE(-2.71)[ip: (-9.25), ipnet: 2607:f8b0::/32(-2.29), asn: 15169(-1.97), country: US(-0.05)]; ASN(0.00)[asn:15169, ipnet:2607:f8b0::/32, country:US]; FROM_NEQ_ENVFROM(0.00)[imp@bsdimp.com,wlosh@bsdimp.com]; RCVD_TLS_ALL(0.00)[]; RCVD_COUNT_TWO(0.00)[2] Content-Type: text/plain; charset="UTF-8" X-Content-Filtered-By: Mailman/MimeDel 2.1.29 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 21 Nov 2019 06:45:43 -0000 I write: > jhb writes: > >> With PC-98 removed, I don't think we have any cases where MACHINE != >> MACHINE_CPUARCH now? >> > > Well, there's arm64 / aarch64. > And riscv / riscv64. Warner From owner-svn-src-all@freebsd.org Thu Nov 21 06:46:28 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 77CA01B0A16 for ; Thu, 21 Nov 2019 06:46:28 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: from mail-qk1-x732.google.com (mail-qk1-x732.google.com [IPv6:2607:f8b0:4864:20::732]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47JVTH45W3z3xLv for ; Thu, 21 Nov 2019 06:46:27 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: by mail-qk1-x732.google.com with SMTP id h15so2109492qka.13 for ; Wed, 20 Nov 2019 22:46:27 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bsdimp-com.20150623.gappssmtp.com; s=20150623; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=NdY3NgtM8nHckLWlLS6QyxOewM05AKrOxD/TahHDL6s=; b=a29K0F02fvN3HG1qhMnj0DkZ7Jw5tY8nRuLJT605yvIA6ly1wX20fqHO+0NEjxKSex 3l6UHGBHSNqUkXGMFTPJyWTFqd0lCLCVuRvJieKa6a02gymdBpUwEEESVEQOQydD+AuB 4AyBufbjPRgl1zdvbmSwDCGWyC5Vh+SVB2fKrR0xHzdX2NBeaC7CDdXtON51eOGAp3D8 qb8nHIWPwbB0E4NPTuUDzisjXMvKi+PCjwqPCf85A4aYBFl1tbN9wqoE18agQD1TP3Hb i0G8F2xvmuYZHuSicIGWE/yjp+1KvRkcsi5b2Hg2rgjVtAhhmVBNsqP9T7Cbkzp7ZljY y8YA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=NdY3NgtM8nHckLWlLS6QyxOewM05AKrOxD/TahHDL6s=; b=Mj/E0Fs99rpL570dPdYUmdCfTWsI0nj/jNj5P/7G+pCZjSlvf8mSHEDsJhpfXjXrIN 261yuZn7SoSW5XlxCKSEfZbXzURS3TOKU56hq189S3/GsODqAyzmEA/XfoyBuSlvekdb N5tN+nZ7QO8IjtjF+WQWMFxudpi8F+RznfsYO5yHNcWtyGvR5K/i+o4f2tEXCqCw3qYM dJ4ytYzb/KEc3AnMwgIgOVlr3em8VraIEU2ZWogip6cstC9c8owy1Y2gHkGIa7gvcMcl etYZYusoBarccwIJWqWA0BK/4NDCe7k1gS0pSy91Wegi5uGrmexDo+0+JlDFhqSWFfUU 3YtA== X-Gm-Message-State: APjAAAXJzW0K3T5BhqNPOyip9myIpe8tZPz/Va6nxxtEiWscRHTMFD3/ j20Gqn5DGwY++IGqELJMApdGZ4wKUciNEhxNn2UBJQ== X-Google-Smtp-Source: APXvYqw269RWbwxJohKb11qfpRLK7tWQ+TNZsAMhJWpFJUQMAzD67V24KAtI2Er+L44Vo3cTsUrjWVC20jw3QY4kM4s= X-Received: by 2002:a05:620a:144:: with SMTP id e4mr2378455qkn.240.1574318786463; Wed, 20 Nov 2019 22:46:26 -0800 (PST) MIME-Version: 1.0 References: <201911201654.xAKGsMTv094014@repo.freebsd.org> <59bf120c-2f35-1a22-b6fa-a9c9bb8cfdf4@FreeBSD.org> <991bdc33-516d-6e6d-1880-44930441893d@FreeBSD.org> <5d4541f5-fe6c-ecc7-c383-0dfd9596ec0f@FreeBSD.org> <5E3130FE-7763-4942-997C-0E325DCF48E6@FreeBSD.org> In-Reply-To: <5E3130FE-7763-4942-997C-0E325DCF48E6@FreeBSD.org> From: Warner Losh Date: Wed, 20 Nov 2019 23:46:15 -0700 Message-ID: Subject: Re: svn commit: r354900 - head/usr.sbin/jail To: Dimitry Andric Cc: John Baldwin , "Bjoern A. Zeeb" , src-committers , svn-src-all , svn-src-head X-Rspamd-Queue-Id: 47JVTH45W3z3xLv X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; dkim=pass header.d=bsdimp-com.20150623.gappssmtp.com header.s=20150623 header.b=a29K0F02; dmarc=none; spf=none (mx1.freebsd.org: domain of wlosh@bsdimp.com has no SPF policy when checking 2607:f8b0:4864:20::732) smtp.mailfrom=wlosh@bsdimp.com X-Spamd-Result: default: False [-4.74 / 15.00]; ARC_NA(0.00)[]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; R_DKIM_ALLOW(-0.20)[bsdimp-com.20150623.gappssmtp.com:s=20150623]; FROM_HAS_DN(0.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; MIME_GOOD(-0.10)[multipart/alternative,text/plain]; PREVIOUSLY_DELIVERED(0.00)[svn-src-all@freebsd.org]; DMARC_NA(0.00)[bsdimp.com]; RCPT_COUNT_FIVE(0.00)[6]; TO_MATCH_ENVRCPT_SOME(0.00)[]; TO_DN_ALL(0.00)[]; DKIM_TRACE(0.00)[bsdimp-com.20150623.gappssmtp.com:+]; RCVD_IN_DNSWL_NONE(0.00)[2.3.7.0.0.0.0.0.0.0.0.0.0.0.0.0.0.2.0.0.4.6.8.4.0.b.8.f.7.0.6.2.list.dnswl.org : 127.0.5.0]; R_SPF_NA(0.00)[]; FORGED_SENDER(0.30)[imp@bsdimp.com,wlosh@bsdimp.com]; MIME_TRACE(0.00)[0:+,1:+,2:~]; IP_SCORE(-2.74)[ip: (-9.39), ipnet: 2607:f8b0::/32(-2.29), asn: 15169(-1.97), country: US(-0.05)]; ASN(0.00)[asn:15169, ipnet:2607:f8b0::/32, country:US]; FROM_NEQ_ENVFROM(0.00)[imp@bsdimp.com,wlosh@bsdimp.com]; RCVD_TLS_ALL(0.00)[]; RCVD_COUNT_TWO(0.00)[2] Content-Type: text/plain; charset="UTF-8" X-Content-Filtered-By: Mailman/MimeDel 2.1.29 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 21 Nov 2019 06:46:28 -0000 On Wed, Nov 20, 2019 at 11:19 PM Dimitry Andric wrote: > Yes, such a table would be extremely helpful. :) > Yes. Committed. Great idea. Committed with some verbage about which one to use to. Warner From owner-svn-src-all@freebsd.org Thu Nov 21 06:48:31 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 3C1311B0C11; Thu, 21 Nov 2019 06:48:31 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47JVWg0vm6z3xVR; Thu, 21 Nov 2019 06:48:31 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 0257D7511; Thu, 21 Nov 2019 06:48:31 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xAL6mUcP087959; Thu, 21 Nov 2019 06:48:30 GMT (envelope-from imp@FreeBSD.org) Received: (from imp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xAL6mUwL087958; Thu, 21 Nov 2019 06:48:30 GMT (envelope-from imp@FreeBSD.org) Message-Id: <201911210648.xAL6mUwL087958@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: imp set sender to imp@FreeBSD.org using -f From: Warner Losh Date: Thu, 21 Nov 2019 06:48:30 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354937 - head/share/man/man7 X-SVN-Group: head X-SVN-Commit-Author: imp X-SVN-Commit-Paths: head/share/man/man7 X-SVN-Commit-Revision: 354937 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 21 Nov 2019 06:48:31 -0000 Author: imp Date: Thu Nov 21 06:48:30 2019 New Revision: 354937 URL: https://svnweb.freebsd.org/changeset/base/354937 Log: Include MACHINE in the which variable selection to use section. Modified: head/share/man/man7/arch.7 Modified: head/share/man/man7/arch.7 ============================================================================== --- head/share/man/man7/arch.7 Thu Nov 21 06:44:19 2019 (r354936) +++ head/share/man/man7/arch.7 Thu Nov 21 06:48:30 2019 (r354937) @@ -347,13 +347,17 @@ Unless the make variable is defined, make universe will not build mips, powerpc, nor sparc64 architectures unless the xtoolchain binaries have been installed for the architecture. -.Ss MACHINE_ARCH vs MACHINE_CPUARCH +.Ss MACHINE_ARCH vs MACHINE_CPUARCH vs MACHINE .Dv MACHINE_CPUARCH should be preferred in Makefiles when the generic architecture is being tested. .Dv MACHINE_ARCH should be preferred when there is something specific to a particular type of architecture where there is a choice of many, or could be a choice of many. +Use +.Dv MACHINE +when referring to the kernel, interfaces dependent on a specific type of kernel +or similar things like boot sequences. .Bl -column -offset indent "Dv MACHINE" "Dv MACHINE_CPUARCH" "Dv MACHINE_ARCH" .It Dv MACHINE Ta Dv MACHINE_CPUARCH Ta Dv MACHINE_ARCH .It arm64 Ta aarch64 Ta aarch64 From owner-svn-src-all@freebsd.org Thu Nov 21 07:01:43 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id C3E101B1190; Thu, 21 Nov 2019 07:01:43 +0000 (UTC) (envelope-from lwhsu.freebsd@gmail.com) Received: from mail-yb1-f180.google.com (mail-yb1-f180.google.com [209.85.219.180]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47JVpt4tnsz3y2p; Thu, 21 Nov 2019 07:01:42 +0000 (UTC) (envelope-from lwhsu.freebsd@gmail.com) Received: by mail-yb1-f180.google.com with SMTP id q7so1065436ybk.4; Wed, 20 Nov 2019 23:01:42 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=G8LJFpZBmsUW/eHAMcuiBhmqxEsw6FDr0iv5/9aZ2yo=; b=T8zE5cyYfGcxu72M5/Ld5n3BCaL9sEyT480VYUp8xosBVy9wigXqzgaGgcBsUsUZYW 9LXlxr4laT+T4ho8J9IlOzYnTbzAhUmhD51u+m7VihpbqN8xEmEEi8p+OZDEzaBB55up IIHsimDnyDd4HfD46jsp4oNY8Ni3S1n4Co/j+GnK7FxqCops2+g/p4O+Atv6VSKwrhgm rNlTm7Pa5eSTBgMzyTz7M/Hd6pufBq68jO+Vx9ecmSlYs3isH9CR3cKVxcfRS8bVHLS7 /NKzbNaEgslQfwgb4J3bAEAEON/SsAub8ITc4Si+j+KkgaxecMND5aD0jFsxtmaxa3Ue bvkQ== X-Gm-Message-State: APjAAAUirLMuz4dYZxEjen7FYniEGLiK13f8UvxAUMEWIyt20SxZgE2F 46Gm5Z3sFd3n1XpfOQ50jf1J2ecfyyT8papnsPQ= X-Google-Smtp-Source: APXvYqxC2CSbor+GM09v7vwgcH9vUvjWmhxscU4SHuooZmDJeRPGE92vmcLjlzujtPJusDgh+NoAuW12DAuyVJYI/9o= X-Received: by 2002:a25:bd8c:: with SMTP id f12mr5303530ybh.405.1574319700959; Wed, 20 Nov 2019 23:01:40 -0800 (PST) MIME-Version: 1.0 References: <201911201654.xAKGsMTv094014@repo.freebsd.org> <59bf120c-2f35-1a22-b6fa-a9c9bb8cfdf4@FreeBSD.org> <991bdc33-516d-6e6d-1880-44930441893d@FreeBSD.org> <5d4541f5-fe6c-ecc7-c383-0dfd9596ec0f@FreeBSD.org> <5E3130FE-7763-4942-997C-0E325DCF48E6@FreeBSD.org> In-Reply-To: From: Li-Wen Hsu Date: Thu, 21 Nov 2019 15:01:28 +0800 Message-ID: Subject: Re: svn commit: r354900 - head/usr.sbin/jail To: Warner Losh Cc: Dimitry Andric , John Baldwin , "Bjoern A. Zeeb" , src-committers , svn-src-all , svn-src-head Content-Type: multipart/mixed; boundary="00000000000089ff810597d5def7" X-Rspamd-Queue-Id: 47JVpt4tnsz3y2p X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; dkim=none; dmarc=none; spf=pass (mx1.freebsd.org: domain of lwhsufreebsd@gmail.com designates 209.85.219.180 as permitted sender) smtp.mailfrom=lwhsufreebsd@gmail.com X-Spamd-Result: default: False [-4.87 / 15.00]; ARC_NA(0.00)[]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; RCVD_TLS_ALL(0.00)[]; FROM_HAS_DN(0.00)[]; R_SPF_ALLOW(-0.20)[+ip4:209.85.128.0/17]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; HAS_ATTACHMENT(0.00)[]; MIME_GOOD(-0.10)[multipart/mixed,text/plain]; DMARC_NA(0.00)[freebsd.org]; MIME_TRACE(0.00)[0:+,1:+,2:~]; TO_DN_ALL(0.00)[]; TO_MATCH_ENVRCPT_SOME(0.00)[]; RCVD_IN_DNSWL_NONE(0.00)[180.219.85.209.list.dnswl.org : 127.0.5.0]; RCPT_COUNT_SEVEN(0.00)[7]; MIME_BASE64_TEXT(0.10)[]; IP_SCORE(-2.97)[ip: (-9.68), ipnet: 209.85.128.0/17(-3.17), asn: 15169(-1.97), country: US(-0.05)]; FORGED_SENDER(0.30)[lwhsu@freebsd.org,lwhsufreebsd@gmail.com]; R_DKIM_NA(0.00)[]; FREEMAIL_ENVFROM(0.00)[gmail.com]; ASN(0.00)[asn:15169, ipnet:209.85.128.0/17, country:US]; TAGGED_FROM(0.00)[]; FROM_NEQ_ENVFROM(0.00)[lwhsu@freebsd.org,lwhsufreebsd@gmail.com]; RCVD_COUNT_TWO(0.00)[2] X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 21 Nov 2019 07:01:43 -0000 --00000000000089ff810597d5def7 Content-Type: text/plain; charset="UTF-8" Thanks for the fixes and sorry for the breakage. While others might work on more proper fixes. Does it make sense to have the attached patch to fix riscv* build? BTW, ${LINKER_TYPE} == "bfd" seems causing failure in the clean stage, that's why it didn't be caught in my test and CI, they have "-DNO_CLEAN" Li-Wen --00000000000089ff810597d5def7 Content-Type: text/x-patch; charset="US-ASCII"; name="riscv-no-relax.diff" Content-Disposition: attachment; filename="riscv-no-relax.diff" Content-Transfer-Encoding: base64 Content-ID: X-Attachment-Id: f_k38dab1i0 SW5kZXg6IHVzci5zYmluL2phaWwvTWFrZWZpbGUKPT09PT09PT09PT09PT09PT09PT09PT09PT09 PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PQotLS0gdXNyLnNiaW4vamFp bC9NYWtlZmlsZQkocmV2aXNpb24gMzU0OTM1KQorKysgdXNyLnNiaW4vamFpbC9NYWtlZmlsZQko d29ya2luZyBjb3B5KQpAQCAtMTUsNiArMTUsMTMgQEAKIFlGTEFHUys9LXYKIENGTEFHUys9LUku IC1JJHsuQ1VSRElSfQogCisjIHdvcmthcm91bmQgZm9yIHJpc2N2KiB3aXRoIEdOVSBsZCAoR05V IEJpbnV0aWxzKSAyLjMzLjE6CisjICAgcmVsb2NhdGlvbiB0cnVuY2F0ZWQgdG8gZml0OiBSX1JJ U0NWX0dQUkVMX0kgYWdhaW5zdCBgLkxBTkNIT1IyJworIyBodHRwczovL2J1Z3MuZnJlZWJzZC5v cmcvMjQyMTA5CisuaWYgJHtNQUNISU5FX0NQVUFSQ0g6TXJpc2N2Kn0KK0NGTEFHUys9LVdsLC0t bm8tcmVsYXgKKy5lbmRpZgorCiAuaWYgJHtNS19JTkVUNl9TVVBQT1JUfSAhPSAibm8iCiBDRkxB R1MrPSAtRElORVQ2CiAuZW5kaWYK --00000000000089ff810597d5def7-- From owner-svn-src-all@freebsd.org Thu Nov 21 07:29:29 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id E48B41B1EF0; Thu, 21 Nov 2019 07:29:29 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47JWQx5z1Lz40mn; Thu, 21 Nov 2019 07:29:29 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 95A4B7C6D; Thu, 21 Nov 2019 07:29:29 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xAL7TT8t011430; Thu, 21 Nov 2019 07:29:29 GMT (envelope-from delphij@FreeBSD.org) Received: (from delphij@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xAL7TQa5011412; Thu, 21 Nov 2019 07:29:26 GMT (envelope-from delphij@FreeBSD.org) Message-Id: <201911210729.xAL7TQa5011412@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: delphij set sender to delphij@FreeBSD.org using -f From: Xin LI Date: Thu, 21 Nov 2019 07:29:26 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r354938 - in stable/12: contrib/file contrib/file/doc contrib/file/magic contrib/file/magic/Magdir contrib/file/src contrib/file/tests lib/libmagic X-SVN-Group: stable-12 X-SVN-Commit-Author: delphij X-SVN-Commit-Paths: in stable/12: contrib/file contrib/file/doc contrib/file/magic contrib/file/magic/Magdir contrib/file/src contrib/file/tests lib/libmagic X-SVN-Commit-Revision: 354938 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 21 Nov 2019 07:29:30 -0000 Author: delphij Date: Thu Nov 21 07:29:25 2019 New Revision: 354938 URL: https://svnweb.freebsd.org/changeset/base/354938 Log: MFC r354595, r354802: MFV r354582: file 5.37 MFV r354798: Apply vendor fixes: 06de62c Detect multiplication overflow when computing sector position 46a8443 Limit the number of elements in a vector (found by oss-fuzz) Security: CVE-2019-18218 Added: stable/12/contrib/file/magic/Magdir/biosig - copied unchanged from r354595, head/contrib/file/magic/Magdir/biosig stable/12/contrib/file/magic/Magdir/clojure - copied unchanged from r354595, head/contrib/file/magic/Magdir/clojure stable/12/contrib/file/magic/Magdir/edid - copied unchanged from r354595, head/contrib/file/magic/Magdir/edid stable/12/contrib/file/magic/Magdir/espressif - copied unchanged from r354595, head/contrib/file/magic/Magdir/espressif stable/12/contrib/file/magic/Magdir/glibc - copied unchanged from r354595, head/contrib/file/magic/Magdir/glibc stable/12/contrib/file/magic/Magdir/hardware - copied unchanged from r354595, head/contrib/file/magic/Magdir/hardware stable/12/contrib/file/magic/Magdir/kicad - copied unchanged from r354595, head/contrib/file/magic/Magdir/kicad stable/12/contrib/file/magic/Magdir/numpy - copied unchanged from r354595, head/contrib/file/magic/Magdir/numpy stable/12/contrib/file/magic/Magdir/rpmsg - copied unchanged from r354595, head/contrib/file/magic/Magdir/rpmsg stable/12/contrib/file/src/is_json.c - copied unchanged from r354595, head/contrib/file/src/is_json.c stable/12/contrib/file/tests/CVE-2014-1943.result - copied unchanged from r354595, head/contrib/file/tests/CVE-2014-1943.result stable/12/contrib/file/tests/CVE-2014-1943.testfile - copied unchanged from r354595, head/contrib/file/tests/CVE-2014-1943.testfile stable/12/contrib/file/tests/fit-map-data.result - copied unchanged from r354595, head/contrib/file/tests/fit-map-data.result stable/12/contrib/file/tests/fit-map-data.testfile - copied unchanged from r354595, head/contrib/file/tests/fit-map-data.testfile stable/12/contrib/file/tests/issue359xlsx.result - copied unchanged from r354595, head/contrib/file/tests/issue359xlsx.result stable/12/contrib/file/tests/issue359xlsx.testfile - copied unchanged from r354595, head/contrib/file/tests/issue359xlsx.testfile stable/12/contrib/file/tests/json1.result - copied unchanged from r354595, head/contrib/file/tests/json1.result stable/12/contrib/file/tests/json1.testfile - copied unchanged from r354595, head/contrib/file/tests/json1.testfile stable/12/contrib/file/tests/json2.result - copied unchanged from r354595, head/contrib/file/tests/json2.result stable/12/contrib/file/tests/json2.testfile - copied unchanged from r354595, head/contrib/file/tests/json2.testfile stable/12/contrib/file/tests/json3.result - copied unchanged from r354595, head/contrib/file/tests/json3.result stable/12/contrib/file/tests/json3.testfile - copied unchanged from r354595, head/contrib/file/tests/json3.testfile stable/12/contrib/file/tests/regex-eol.magic - copied unchanged from r354595, head/contrib/file/tests/regex-eol.magic stable/12/contrib/file/tests/regex-eol.result - copied unchanged from r354595, head/contrib/file/tests/regex-eol.result stable/12/contrib/file/tests/regex-eol.testfile - copied unchanged from r354595, head/contrib/file/tests/regex-eol.testfile stable/12/contrib/file/tests/zstd-3-skippable-frames.result - copied unchanged from r354595, head/contrib/file/tests/zstd-3-skippable-frames.result stable/12/contrib/file/tests/zstd-dictionary-0.result - copied unchanged from r354595, head/contrib/file/tests/zstd-dictionary-0.result stable/12/contrib/file/tests/zstd-dictionary-1.result - copied unchanged from r354595, head/contrib/file/tests/zstd-dictionary-1.result stable/12/contrib/file/tests/zstd-dictionary-2.result - copied unchanged from r354595, head/contrib/file/tests/zstd-dictionary-2.result stable/12/contrib/file/tests/zstd-skippable-frame-0.result - copied unchanged from r354595, head/contrib/file/tests/zstd-skippable-frame-0.result stable/12/contrib/file/tests/zstd-skippable-frame-4.result - copied unchanged from r354595, head/contrib/file/tests/zstd-skippable-frame-4.result stable/12/contrib/file/tests/zstd-skippable-frame-8.result - copied unchanged from r354595, head/contrib/file/tests/zstd-skippable-frame-8.result stable/12/contrib/file/tests/zstd-skippable-frame-C.result - copied unchanged from r354595, head/contrib/file/tests/zstd-skippable-frame-C.result stable/12/contrib/file/tests/zstd-v0.2-FF.result - copied unchanged from r354595, head/contrib/file/tests/zstd-v0.2-FF.result stable/12/contrib/file/tests/zstd-v0.2-FF.testfile - copied unchanged from r354595, head/contrib/file/tests/zstd-v0.2-FF.testfile stable/12/contrib/file/tests/zstd-v0.3-FF.result - copied unchanged from r354595, head/contrib/file/tests/zstd-v0.3-FF.result stable/12/contrib/file/tests/zstd-v0.3-FF.testfile - copied unchanged from r354595, head/contrib/file/tests/zstd-v0.3-FF.testfile stable/12/contrib/file/tests/zstd-v0.4-FF.result - copied unchanged from r354595, head/contrib/file/tests/zstd-v0.4-FF.result stable/12/contrib/file/tests/zstd-v0.4-FF.testfile - copied unchanged from r354595, head/contrib/file/tests/zstd-v0.4-FF.testfile stable/12/contrib/file/tests/zstd-v0.5-FF.result - copied unchanged from r354595, head/contrib/file/tests/zstd-v0.5-FF.result stable/12/contrib/file/tests/zstd-v0.5-FF.testfile - copied unchanged from r354595, head/contrib/file/tests/zstd-v0.5-FF.testfile stable/12/contrib/file/tests/zstd-v0.6-FF.result - copied unchanged from r354595, head/contrib/file/tests/zstd-v0.6-FF.result stable/12/contrib/file/tests/zstd-v0.6-FF.testfile - copied unchanged from r354595, head/contrib/file/tests/zstd-v0.6-FF.testfile stable/12/contrib/file/tests/zstd-v0.7-00.result - copied unchanged from r354595, head/contrib/file/tests/zstd-v0.7-00.result stable/12/contrib/file/tests/zstd-v0.7-21.result - copied unchanged from r354595, head/contrib/file/tests/zstd-v0.7-21.result stable/12/contrib/file/tests/zstd-v0.7-21.testfile - copied unchanged from r354595, head/contrib/file/tests/zstd-v0.7-21.testfile stable/12/contrib/file/tests/zstd-v0.7-22.result - copied unchanged from r354595, head/contrib/file/tests/zstd-v0.7-22.result stable/12/contrib/file/tests/zstd-v0.7-22.testfile - copied unchanged from r354595, head/contrib/file/tests/zstd-v0.7-22.testfile stable/12/contrib/file/tests/zstd-v0.8-00.result - copied unchanged from r354595, head/contrib/file/tests/zstd-v0.8-00.result stable/12/contrib/file/tests/zstd-v0.8-01.result - copied unchanged from r354595, head/contrib/file/tests/zstd-v0.8-01.result stable/12/contrib/file/tests/zstd-v0.8-01.testfile - copied unchanged from r354595, head/contrib/file/tests/zstd-v0.8-01.testfile stable/12/contrib/file/tests/zstd-v0.8-02.result - copied unchanged from r354595, head/contrib/file/tests/zstd-v0.8-02.result stable/12/contrib/file/tests/zstd-v0.8-02.testfile - copied unchanged from r354595, head/contrib/file/tests/zstd-v0.8-02.testfile stable/12/contrib/file/tests/zstd-v0.8-03.result - copied unchanged from r354595, head/contrib/file/tests/zstd-v0.8-03.result stable/12/contrib/file/tests/zstd-v0.8-03.testfile - copied unchanged from r354595, head/contrib/file/tests/zstd-v0.8-03.testfile stable/12/contrib/file/tests/zstd-v0.8-16.result - copied unchanged from r354595, head/contrib/file/tests/zstd-v0.8-16.result stable/12/contrib/file/tests/zstd-v0.8-16.testfile - copied unchanged from r354595, head/contrib/file/tests/zstd-v0.8-16.testfile stable/12/contrib/file/tests/zstd-v0.8-20.result - copied unchanged from r354595, head/contrib/file/tests/zstd-v0.8-20.result stable/12/contrib/file/tests/zstd-v0.8-20.testfile - copied unchanged from r354595, head/contrib/file/tests/zstd-v0.8-20.testfile stable/12/contrib/file/tests/zstd-v0.8-21.result - copied unchanged from r354595, head/contrib/file/tests/zstd-v0.8-21.result stable/12/contrib/file/tests/zstd-v0.8-21.testfile - copied unchanged from r354595, head/contrib/file/tests/zstd-v0.8-21.testfile stable/12/contrib/file/tests/zstd-v0.8-22.result - copied unchanged from r354595, head/contrib/file/tests/zstd-v0.8-22.result stable/12/contrib/file/tests/zstd-v0.8-22.testfile - copied unchanged from r354595, head/contrib/file/tests/zstd-v0.8-22.testfile stable/12/contrib/file/tests/zstd-v0.8-23.result - copied unchanged from r354595, head/contrib/file/tests/zstd-v0.8-23.result stable/12/contrib/file/tests/zstd-v0.8-23.testfile - copied unchanged from r354595, head/contrib/file/tests/zstd-v0.8-23.testfile stable/12/contrib/file/tests/zstd-v0.8-F4.result - copied unchanged from r354595, head/contrib/file/tests/zstd-v0.8-F4.result stable/12/contrib/file/tests/zstd-v0.8-F4.testfile - copied unchanged from r354595, head/contrib/file/tests/zstd-v0.8-F4.testfile stable/12/contrib/file/tests/zstd-v0.8-FF.result - copied unchanged from r354595, head/contrib/file/tests/zstd-v0.8-FF.result stable/12/contrib/file/tests/zstd-v0.8-FF.testfile - copied unchanged from r354595, head/contrib/file/tests/zstd-v0.8-FF.testfile Modified: stable/12/contrib/file/AUTHORS stable/12/contrib/file/COPYING stable/12/contrib/file/ChangeLog stable/12/contrib/file/NEWS stable/12/contrib/file/README stable/12/contrib/file/config.h.in stable/12/contrib/file/configure stable/12/contrib/file/configure.ac stable/12/contrib/file/doc/file.man stable/12/contrib/file/doc/libmagic.man stable/12/contrib/file/doc/magic.man stable/12/contrib/file/magic/Header stable/12/contrib/file/magic/Magdir/acorn stable/12/contrib/file/magic/Magdir/adventure stable/12/contrib/file/magic/Magdir/algol68 stable/12/contrib/file/magic/Magdir/amigaos stable/12/contrib/file/magic/Magdir/android stable/12/contrib/file/magic/Magdir/animation stable/12/contrib/file/magic/Magdir/apple stable/12/contrib/file/magic/Magdir/archive stable/12/contrib/file/magic/Magdir/audio stable/12/contrib/file/magic/Magdir/basis stable/12/contrib/file/magic/Magdir/ber stable/12/contrib/file/magic/Magdir/bioinformatics stable/12/contrib/file/magic/Magdir/blcr stable/12/contrib/file/magic/Magdir/blender stable/12/contrib/file/magic/Magdir/c-lang stable/12/contrib/file/magic/Magdir/cad stable/12/contrib/file/magic/Magdir/cafebabe stable/12/contrib/file/magic/Magdir/coff stable/12/contrib/file/magic/Magdir/commands stable/12/contrib/file/magic/Magdir/compress stable/12/contrib/file/magic/Magdir/console stable/12/contrib/file/magic/Magdir/coverage stable/12/contrib/file/magic/Magdir/ctf stable/12/contrib/file/magic/Magdir/cups stable/12/contrib/file/magic/Magdir/database stable/12/contrib/file/magic/Magdir/dataone stable/12/contrib/file/magic/Magdir/dbpf stable/12/contrib/file/magic/Magdir/dolby stable/12/contrib/file/magic/Magdir/dyadic stable/12/contrib/file/magic/Magdir/ebml stable/12/contrib/file/magic/Magdir/elf stable/12/contrib/file/magic/Magdir/erlang stable/12/contrib/file/magic/Magdir/esri stable/12/contrib/file/magic/Magdir/filesystems stable/12/contrib/file/magic/Magdir/finger stable/12/contrib/file/magic/Magdir/flash stable/12/contrib/file/magic/Magdir/fonts stable/12/contrib/file/magic/Magdir/fsav stable/12/contrib/file/magic/Magdir/games stable/12/contrib/file/magic/Magdir/geo stable/12/contrib/file/magic/Magdir/gnome stable/12/contrib/file/magic/Magdir/gnu stable/12/contrib/file/magic/Magdir/graphviz stable/12/contrib/file/magic/Magdir/guile stable/12/contrib/file/magic/Magdir/hitachi-sh stable/12/contrib/file/magic/Magdir/hp stable/12/contrib/file/magic/Magdir/ibm6000 stable/12/contrib/file/magic/Magdir/images stable/12/contrib/file/magic/Magdir/intel stable/12/contrib/file/magic/Magdir/isz stable/12/contrib/file/magic/Magdir/java stable/12/contrib/file/magic/Magdir/jpeg stable/12/contrib/file/magic/Magdir/keepass stable/12/contrib/file/magic/Magdir/kerberos stable/12/contrib/file/magic/Magdir/kml stable/12/contrib/file/magic/Magdir/linux stable/12/contrib/file/magic/Magdir/lisp stable/12/contrib/file/magic/Magdir/llvm stable/12/contrib/file/magic/Magdir/lua stable/12/contrib/file/magic/Magdir/m4 stable/12/contrib/file/magic/Magdir/macintosh stable/12/contrib/file/magic/Magdir/mail.news stable/12/contrib/file/magic/Magdir/map stable/12/contrib/file/magic/Magdir/marc21 stable/12/contrib/file/magic/Magdir/matroska stable/12/contrib/file/magic/Magdir/mercurial stable/12/contrib/file/magic/Magdir/metastore stable/12/contrib/file/magic/Magdir/microfocus stable/12/contrib/file/magic/Magdir/misctools stable/12/contrib/file/magic/Magdir/modem stable/12/contrib/file/magic/Magdir/mozilla stable/12/contrib/file/magic/Magdir/msdos stable/12/contrib/file/magic/Magdir/msooxml stable/12/contrib/file/magic/Magdir/msvc stable/12/contrib/file/magic/Magdir/neko stable/12/contrib/file/magic/Magdir/netbsd stable/12/contrib/file/magic/Magdir/nitpicker stable/12/contrib/file/magic/Magdir/ole2compounddocs stable/12/contrib/file/magic/Magdir/palm stable/12/contrib/file/magic/Magdir/parrot stable/12/contrib/file/magic/Magdir/pbf stable/12/contrib/file/magic/Magdir/pc98 stable/12/contrib/file/magic/Magdir/pgp stable/12/contrib/file/magic/Magdir/polyml stable/12/contrib/file/magic/Magdir/printer stable/12/contrib/file/magic/Magdir/psl stable/12/contrib/file/magic/Magdir/pwsafe stable/12/contrib/file/magic/Magdir/python stable/12/contrib/file/magic/Magdir/qt stable/12/contrib/file/magic/Magdir/revision stable/12/contrib/file/magic/Magdir/riff stable/12/contrib/file/magic/Magdir/ruby stable/12/contrib/file/magic/Magdir/scientific stable/12/contrib/file/magic/Magdir/selinux stable/12/contrib/file/magic/Magdir/sendmail stable/12/contrib/file/magic/Magdir/sequent stable/12/contrib/file/magic/Magdir/sgml stable/12/contrib/file/magic/Magdir/sniffer stable/12/contrib/file/magic/Magdir/sql stable/12/contrib/file/magic/Magdir/sun stable/12/contrib/file/magic/Magdir/sysex stable/12/contrib/file/magic/Magdir/tcl stable/12/contrib/file/magic/Magdir/terminfo stable/12/contrib/file/magic/Magdir/tex stable/12/contrib/file/magic/Magdir/tplink stable/12/contrib/file/magic/Magdir/unicode stable/12/contrib/file/magic/Magdir/varied.script stable/12/contrib/file/magic/Magdir/virtual stable/12/contrib/file/magic/Magdir/warc stable/12/contrib/file/magic/Magdir/webassembly stable/12/contrib/file/magic/Magdir/windows stable/12/contrib/file/magic/Magdir/wordprocessors stable/12/contrib/file/magic/Magdir/wsdl stable/12/contrib/file/magic/Magdir/xwindows stable/12/contrib/file/magic/Magdir/yara stable/12/contrib/file/magic/Magdir/zip stable/12/contrib/file/magic/Makefile.am stable/12/contrib/file/magic/Makefile.in stable/12/contrib/file/src/Makefile.am stable/12/contrib/file/src/Makefile.in stable/12/contrib/file/src/apprentice.c stable/12/contrib/file/src/apptype.c stable/12/contrib/file/src/ascmagic.c stable/12/contrib/file/src/asprintf.c stable/12/contrib/file/src/buffer.c stable/12/contrib/file/src/cdf.c stable/12/contrib/file/src/cdf.h stable/12/contrib/file/src/cdf_time.c stable/12/contrib/file/src/compress.c stable/12/contrib/file/src/der.c stable/12/contrib/file/src/dprintf.c stable/12/contrib/file/src/elfclass.h stable/12/contrib/file/src/encoding.c stable/12/contrib/file/src/file.c stable/12/contrib/file/src/file.h stable/12/contrib/file/src/fmtcheck.c stable/12/contrib/file/src/fsmagic.c stable/12/contrib/file/src/funcs.c stable/12/contrib/file/src/getopt_long.c stable/12/contrib/file/src/is_tar.c stable/12/contrib/file/src/magic.c stable/12/contrib/file/src/magic.h.in stable/12/contrib/file/src/mygetopt.h stable/12/contrib/file/src/print.c stable/12/contrib/file/src/readcdf.c stable/12/contrib/file/src/readelf.c stable/12/contrib/file/src/readelf.h stable/12/contrib/file/src/seccomp.c stable/12/contrib/file/src/softmagic.c stable/12/contrib/file/src/vasprintf.c stable/12/contrib/file/tests/Makefile.am stable/12/contrib/file/tests/Makefile.in stable/12/lib/libmagic/Makefile stable/12/lib/libmagic/config.h Directory Properties: stable/12/ (props changed) Modified: stable/12/contrib/file/AUTHORS ============================================================================== --- stable/12/contrib/file/AUTHORS Thu Nov 21 06:48:30 2019 (r354937) +++ stable/12/contrib/file/AUTHORS Thu Nov 21 07:29:25 2019 (r354938) @@ -1 +1 @@ -See COPYING. \ No newline at end of file +See COPYING. Modified: stable/12/contrib/file/COPYING ============================================================================== --- stable/12/contrib/file/COPYING Thu Nov 21 06:48:30 2019 (r354937) +++ stable/12/contrib/file/COPYING Thu Nov 21 07:29:25 2019 (r354938) @@ -1,4 +1,4 @@ -$File: COPYING,v 1.1 2008/02/05 19:08:11 christos Exp $ +$File: COPYING,v 1.2 2018/09/09 20:33:28 christos Exp $ Copyright (c) Ian F. Darwin 1986, 1987, 1989, 1990, 1991, 1992, 1994, 1995. Software written by Ian F. Darwin and others; maintained 1994- Christos Zoulas. @@ -15,7 +15,7 @@ are met: 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. - + THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE Modified: stable/12/contrib/file/ChangeLog ============================================================================== --- stable/12/contrib/file/ChangeLog Thu Nov 21 06:48:30 2019 (r354937) +++ stable/12/contrib/file/ChangeLog Thu Nov 21 07:29:25 2019 (r354938) @@ -1,3 +1,75 @@ +2019-05-14 22:26 Christos Zoulas + + * release 5.37 + +2019-05-09 22:27 Christos Zoulas + + * Make sure that continuation separators are printed + with -k within softmagic + +2019-05-06 22:27 Christos Zoulas + + * Change SIGPIPE saving and restoring during compression to use + sigaction(2) instead of signal(3) and cache it. (Denys Vlasenko) + * Cache stat(2) calls more to reduce number of calls (Denys Vlasenko) + +2019-05-06 17:25 Christos Zoulas + + * PR/77: Handle --mime-type and -k correctly. + +2019-05-03 15:26 Christos Zoulas + + * Switch decompression code to use vfork() because + tools like rpmdiff and rpmbuild call libmagic + with large process footprints (Denys Vlasenko) + +2019-04-07 14:05 Christos Zoulas + + * PR/75: --enable-zlib, did not work. + +2019-02-27 11:54 Christos Zoulas + + * Improve regex efficiency (Michael Schroeder) by: + 1. Prefixing regex searches with regular search + for keywords where possible + 2. Using memmem(3) where available + +2019-02-20 10:16 Christos Zoulas + + * release 5.36 + +2019-02-19 15:30 Christos Zoulas + + * Fix cast to use cast macros + * Add UCS-32 builtin detection (PR/61) reported by tmc + +2019-02-18 18:24 Christos Zoulas + + * Fix stack read (PR/62) and write (PR/64) stack overflows + reported by spinpx + +2018-10-18 19:32 Christos Zoulas + + * release 5.35 + +2018-09-10 20:38 Christos Zoulas + + * Add FreeBSD ELF core file support (John Baldwin) + +2018-08-20 18:40 Christos Zoulas + + * PR/30: Allow all parameter values to be set (don't treat 0 specially) + * handle default annotations on the softmagic match instead at the + end. + +2018-07-25 10:17 Christos Zoulas + + * PR/23: Recognize JSON files + +2018-07-25 10:17 Christos Zoulas + + * PR/18: file --mime-encoding should not print mime-type + 2018-07-25 8:50 Christos Zoulas * release 5.34 @@ -14,11 +86,11 @@ * release 5.33 -2018-02-24 14:50 Christos Zoulas +2018-02-24 14:50 Christos Zoulas * extend the support for ${x?:} expansions for magic descriptions -2018-02-21 16:25 Christos Zoulas +2018-02-21 16:25 Christos Zoulas * add support for ${x?:} in mime types to handle pie binaries. @@ -90,7 +162,7 @@ * Add missing overflow check in der magic (Jonas Wagner) 2016-10-25 10:40 Christos Zoulas - + * release 5.29 2016-10-24 11:20 Christos Zoulas @@ -131,11 +203,11 @@ - set offset to 0 on failure. 2016-05-13 12:00 Christos Zoulas - + * release 5.27 2016-04-18 9:35 Christos Zoulas - + * Errors comparing DER entries or computing offsets are just indications of malformed non-DER files. Don't print them. @@ -144,7 +216,7 @@ * Put new bytes constant in the right file (not the generated one) 2016-04-16 18:34 Christos Zoulas - + * release 5.26 2016-03-31 13:50 Christos Zoulas @@ -190,7 +262,7 @@ * PR/492: compression forking was broken with magic_buffer. 2015-09-16 9:50 Christos Zoulas - + * release 5.25 2015-09-11 13:25 Christos Zoulas @@ -218,7 +290,7 @@ * release 5.23 2015-06-09 16:10 Christos Zoulas - + * Fix issue with regex range for magic with offset * Always return true from mget with USE (success to mget not match indication). Fixes mime evaluation after USE magic @@ -271,12 +343,12 @@ * add indirect relative for TIFF/Exif 2014-12-16 18:10 Christos Zoulas - + * restructure elf note printing to avoid repeated messages * add note limit, suggested by Alexander Cherepanov 2014-12-16 16:53 Christos Zoulas - + * Bail out on partial pread()'s (Alexander Cherepanov) * Fix incorrect bounds check in file_printable (Alexander Cherepanov) @@ -287,7 +359,7 @@ more places for safety * in ELF, instead of "(uses dynamic libraries)" when PT_INTERP is present print the interpreter name. - + 2014-12-10 20:01 Christos Zoulas * release 5.21 @@ -330,7 +402,7 @@ on a byte by byte basis, so that we don't get issues with locale's trying to interpret random byte streams as UTF-8 and having printf error out with EILSEQ. - + 2014-10-17 11:48 Christos Zoulas * fix bounds in note reading (Francisco Alonso / Red Hat) @@ -361,7 +433,7 @@ * release 5.19 2014-06-09 9:04 Christos Zoulas - + * Misc buffer overruns and missing buffer size tests in cdf parsing (Francisco Alonso, Jan Kaluza) @@ -391,7 +463,7 @@ 2014-05-04 14:55 Christos Zoulas - * PR/351: Fix compilation of empty files + * PR/351: Fix compilation of empty files 2014-04-30 17:39 Christos Zoulas @@ -495,7 +567,7 @@ * Don't treat magic as an error if offset was past EOF (Christoph Biedl) 2013-05-28 17:25 Christos Zoulas - + * Fix spacing issues in softmagic and elf (Jan Kaluza) 2013-05-02 18:00 Christos Zoulas @@ -551,7 +623,7 @@ * Make getline public so that file can link against it. Perhaps it is better to rename it, or hide it differently. Fixes builds on platforms that do not provide it. - + 2013-01-07 16:30 Christos Zoulas * Add SuS d{,1,2,4,8}, u{,1,2,4,8} and document @@ -901,7 +973,7 @@ (Cheng Renquan) 2009-05-08 13:40 Christos Zoulas - + * lint fixes and more from NetBSD 2009-05-06 10:25 Christos Zoulas @@ -921,7 +993,7 @@ 2009-03-27 18:43 Christos Zoulas - * don't print \012- separators in the same magic entry + * don't print \012- separators in the same magic entry if it consists of multiple magic printing lines. 2009-03-23 10:20 Christos Zoulas Modified: stable/12/contrib/file/NEWS ============================================================================== --- stable/12/contrib/file/NEWS Thu Nov 21 06:48:30 2019 (r354937) +++ stable/12/contrib/file/NEWS Thu Nov 21 07:29:25 2019 (r354938) @@ -1 +1 @@ -See ChangeLog. \ No newline at end of file +See ChangeLog. Modified: stable/12/contrib/file/README ============================================================================== --- stable/12/contrib/file/README Thu Nov 21 06:48:30 2019 (r354937) +++ stable/12/contrib/file/README Thu Nov 21 07:29:25 2019 (r354938) @@ -1,6 +1,6 @@ -## README for file(1) Command ## +## README for file(1) Command and the libmagic(3) library ## - @(#) $File: README,v 1.54 2018/05/30 03:06:56 christos Exp $ + @(#) $File: README,v 1.57 2019/02/06 00:20:56 christos Exp $ Mailing List: file@astron.com Mailing List archives: http://mailman.astron.com/pipermail/file/ @@ -63,53 +63,54 @@ magic numbers assigned to all sorts of data files that are in reasonable circulation. Send your magic numbers, in magic(5) format please, to the maintainer, Christos Zoulas. -COPYING - read this first. -README - read this second (you are currently reading this file). +COPYING - read this first. +README - read this second (you are currently reading this file). INSTALL - read on how to install -src/apprentice.c - parses /etc/magic to learn magic -src/apptype.c - used for OS/2 specific application type magic -src/ascmagic.c - third & last set of tests, based on hardwired assumptions. -src/asctime_r.c - replacement for OS's that don't have it. -src/asprintf.c - replacement for OS's that don't have it. -src/asctime_r.c - replacement for OS's that don't have it. -src/asprintf.c - replacement for OS's that don't have it. +src/apprentice.c - parses /etc/magic to learn magic +src/apptype.c - used for OS/2 specific application type magic +src/ascmagic.c - third & last set of tests, based on hardwired assumptions. +src/asctime_r.c - replacement for OS's that don't have it. +src/asprintf.c - replacement for OS's that don't have it. +src/asctime_r.c - replacement for OS's that don't have it. +src/asprintf.c - replacement for OS's that don't have it. src/buffer.c - buffer handling functions. -src/cdf.[ch] - parser for Microsoft Compound Document Files -src/cdf_time.c - time converter for CDF. -src/compress.c - handles decompressing files to look inside. -src/ctime_r.c - replacement for OS's that don't have it. +src/cdf.[ch] - parser for Microsoft Compound Document Files +src/cdf_time.c - time converter for CDF. +src/compress.c - handles decompressing files to look inside. +src/ctime_r.c - replacement for OS's that don't have it. src/der.[ch] - parser for Distinguished Encoding Rules src/dprintf.c - replacement for OS's that don't have it. src/elfclass.h - common code for elf 32/64. -src/encoding.c - handles unicode encodings -src/file.c - the main program -src/file.h - header file +src/encoding.c - handles unicode encodings +src/file.c - the main program +src/file.h - header file src/file_opts.h - list of options -src/fmtcheck.c - replacement for OS's that don't have it. -src/fsmagic.c - first set of tests the program runs, based on filesystem info -src/funcs.c - utilility functions -src/getline.c - replacement for OS's that don't have it. -src/getopt_long.c - replacement for OS's that don't have it. -src/gmtime_r.c - replacement for OS's that don't have it. -src/is_tar.c, tar.h - knows about Tape ARchive format (courtesy John Gilmore). -src/localtime_r.c - replacement for OS's that don't have it. +src/fmtcheck.c - replacement for OS's that don't have it. +src/fsmagic.c - first set of tests the program runs, based on filesystem info +src/funcs.c - utilility functions +src/getline.c - replacement for OS's that don't have it. +src/getopt_long.c - replacement for OS's that don't have it. +src/gmtime_r.c - replacement for OS's that don't have it. +src/is_json.c - knows about JavaScript Object Notation format (RFC 8259). +src/is_tar.c, tar.h - knows about Tape ARchive format (courtesy John Gilmore). +src/localtime_r.c - replacement for OS's that don't have it. src/magic.h.in - source file for magic.h -src/mygetopt.h - replacement for OS's that don't have it. -src/magic.c - the libmagic api -src/names.h - header file for ascmagic.c -src/pread.c - replacement for OS's that don't have it. -src/print.c - print results, errors, warnings. -src/readcdf.c - CDF wrapper. -src/readelf.[ch] - Stand-alone elf parsing code. -src/softmagic.c - 2nd set of tests, based on /etc/magic -src/mygetopt.h - replacement for OS's that don't have it. -src/strcasestr.c - replacement for OS's that don't have it. -src/strlcat.c - replacement for OS's that don't have it. -src/strlcpy.c - replacement for OS's that don't have it. -src/strndup.c - replacement for OS's that don't have it. +src/mygetopt.h - replacement for OS's that don't have it. +src/magic.c - the libmagic api +src/names.h - header file for ascmagic.c +src/pread.c - replacement for OS's that don't have it. +src/print.c - print results, errors, warnings. +src/readcdf.c - CDF wrapper. +src/readelf.[ch] - Stand-alone elf parsing code. +src/softmagic.c - 2nd set of tests, based on /etc/magic +src/mygetopt.h - replacement for OS's that don't have it. +src/strcasestr.c - replacement for OS's that don't have it. +src/strlcat.c - replacement for OS's that don't have it. +src/strlcpy.c - replacement for OS's that don't have it. +src/strndup.c - replacement for OS's that don't have it. src/tar.h - tar file definitions -src/vasprintf.c - for systems that don't have it. -doc/file.man - man page for the command +src/vasprintf.c - for systems that don't have it. +doc/file.man - man page for the command doc/magic.man - man page for the magic file, courtesy Guy Harris. Install as magic.4 on USG and magic.5 on V7 or Berkeley; cf Makefile. Modified: stable/12/contrib/file/config.h.in ============================================================================== --- stable/12/contrib/file/config.h.in Thu Nov 21 06:48:30 2019 (r354937) +++ stable/12/contrib/file/config.h.in Thu Nov 21 07:29:25 2019 (r354938) @@ -83,12 +83,6 @@ /* Define to 1 if you have the `z' library (-lz). */ #undef HAVE_LIBZ -/* Define to 1 if you have the header file. */ -#undef HAVE_LIMITS_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_LOCALE_H - /* Define to 1 if you have the `localtime_r' function. */ #undef HAVE_LOCALTIME_R @@ -98,6 +92,9 @@ /* Define to 1 if declares mbstate_t. */ #undef HAVE_MBSTATE_T +/* Define to 1 if you have the `memmem' function. */ +#undef HAVE_MEMMEM + /* Define to 1 if you have the header file. */ #undef HAVE_MEMORY_H @@ -116,18 +113,9 @@ /* Define to 1 if you have the `pread' function. */ #undef HAVE_PREAD -/* Define to 1 if you have the `setlocale' function. */ -#undef HAVE_SETLOCALE - -/* Define to 1 if you have the header file. */ -#undef HAVE_SIGNAL_H - /* Have sig_t type */ #undef HAVE_SIG_T -/* Define to 1 if you have the header file. */ -#undef HAVE_STDDEF_H - /* Define to 1 if you have the header file. */ #undef HAVE_STDINT_H @@ -137,9 +125,6 @@ /* Define to 1 if you have the `strcasestr' function. */ #undef HAVE_STRCASESTR -/* Define to 1 if you have the `strerror' function. */ -#undef HAVE_STRERROR - /* Define to 1 if you have the header file. */ #undef HAVE_STRINGS_H @@ -158,9 +143,6 @@ /* Define to 1 if you have the `strtof' function. */ #undef HAVE_STRTOF -/* Define to 1 if you have the `strtoul' function. */ -#undef HAVE_STRTOUL - /* HAVE_STRUCT_OPTION */ #undef HAVE_STRUCT_OPTION @@ -181,6 +163,9 @@ /* Define to 1 if you have the header file. */ #undef HAVE_SYS_STAT_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_SYS_SYSMACROS_H /* Define to 1 if you have the header file. */ #undef HAVE_SYS_TIME_H Modified: stable/12/contrib/file/configure ============================================================================== --- stable/12/contrib/file/configure Thu Nov 21 06:48:30 2019 (r354937) +++ stable/12/contrib/file/configure Thu Nov 21 07:29:25 2019 (r354938) @@ -1,6 +1,6 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.69 for file 5.34. +# Generated by GNU Autoconf 2.69 for file 5.37. # # Report bugs to . # @@ -590,8 +590,8 @@ MAKEFLAGS= # Identity of this package. PACKAGE_NAME='file' PACKAGE_TARNAME='file' -PACKAGE_VERSION='5.34' -PACKAGE_STRING='file 5.34' +PACKAGE_VERSION='5.37' +PACKAGE_STRING='file 5.37' PACKAGE_BUGREPORT='christos@astron.com' PACKAGE_URL='' @@ -1329,7 +1329,7 @@ if test "$ac_init_help" = "long"; then # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF -\`configure' configures file 5.34 to adapt to many kinds of systems. +\`configure' configures file 5.37 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -1399,7 +1399,7 @@ fi if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of file 5.34:";; + short | recursive ) echo "Configuration of file 5.37:";; esac cat <<\_ACEOF @@ -1511,7 +1511,7 @@ fi test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF -file configure 5.34 +file configure 5.37 generated by GNU Autoconf 2.69 Copyright (C) 2012 Free Software Foundation, Inc. @@ -2167,7 +2167,7 @@ cat >config.log <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. -It was created by file $as_me 5.34, which was +It was created by file $as_me 5.37, which was generated by GNU Autoconf 2.69. Invocation command line was $ $0 $@ @@ -3033,7 +3033,7 @@ fi # Define the identity of the package. PACKAGE='file' - VERSION='5.34' + VERSION='5.37' cat >>confdefs.h <<_ACEOF @@ -12784,7 +12784,7 @@ $as_echo "#define HAVE_SYS_WAIT_H 1" >>confdefs.h fi -for ac_header in stdint.h fcntl.h locale.h stdint.h inttypes.h unistd.h +for ac_header in stdint.h fcntl.h inttypes.h unistd.h do : as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` ac_fn_c_check_header_mongrel "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default" @@ -12797,7 +12797,7 @@ fi done -for ac_header in stddef.h utime.h wchar.h wctype.h limits.h +for ac_header in utime.h wchar.h wctype.h do : as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` ac_fn_c_check_header_mongrel "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default" @@ -12810,7 +12810,7 @@ fi done -for ac_header in getopt.h err.h xlocale.h signal.h +for ac_header in getopt.h err.h xlocale.h do : as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` ac_fn_c_check_header_mongrel "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default" @@ -12823,7 +12823,7 @@ fi done -for ac_header in sys/mman.h sys/stat.h sys/types.h sys/utime.h sys/time.h +for ac_header in sys/mman.h sys/stat.h sys/types.h sys/utime.h sys/time.h sys/sysmacros.h do : as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` ac_fn_c_check_header_mongrel "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default" @@ -12850,10 +12850,7 @@ fi done fi -ac_fn_c_check_type "$LINENO" "sig_t" "ac_cv_type_sig_t" " -#ifdef HAVE_SIGNAL_H -#include -#endif +ac_fn_c_check_type "$LINENO" "sig_t" "ac_cv_type_sig_t" "#include " if test "x$ac_cv_type_sig_t" = xyes; then : @@ -12976,7 +12973,8 @@ _ACEOF fi -ac_fn_c_check_member "$LINENO" "struct tm" "tm_gmtoff" "ac_cv_member_struct_tm_tm_gmtoff" "$ac_includes_default" +ac_fn_c_check_member "$LINENO" "struct tm" "tm_gmtoff" "ac_cv_member_struct_tm_tm_gmtoff" "#include +" if test "x$ac_cv_member_struct_tm_tm_gmtoff" = xyes; then : cat >>confdefs.h <<_ACEOF @@ -14229,7 +14227,7 @@ fi fi -for ac_func in strerror strndup strtoul mkstemp mkostemp utimes utime wcwidth strtof newlocale uselocale freelocale setlocale +for ac_func in strndup mkstemp mkostemp utimes utime wcwidth strtof newlocale uselocale freelocale memmem do : as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh` ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var" @@ -14583,7 +14581,8 @@ if test "$enable_zlib" = "yes"; then if test "$ac_cv_header_zlib_h$ac_cv_lib_z_gzopen" != "yesyes"; then as_fn_error $? "zlib support requested but not found" "$LINENO" 5 fi -elif test "$ac_cv_header_zlib_h$ac_cv_lib_z_gzopen" = "yesyes"; then +fi +if test "$ac_cv_header_zlib_h$ac_cv_lib_z_gzopen" = "yesyes"; then $as_echo "#define ZLIBSUPPORT 1" >>confdefs.h @@ -15134,7 +15133,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" -This file was extended by file $as_me 5.34, which was +This file was extended by file $as_me 5.37, which was generated by GNU Autoconf 2.69. Invocation command line was CONFIG_FILES = $CONFIG_FILES @@ -15200,7 +15199,7 @@ _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" ac_cs_version="\\ -file config.status 5.34 +file config.status 5.37 configured by $0, generated by GNU Autoconf 2.69, with options \\"\$ac_cs_config\\" Modified: stable/12/contrib/file/configure.ac ============================================================================== --- stable/12/contrib/file/configure.ac Thu Nov 21 06:48:30 2019 (r354937) +++ stable/12/contrib/file/configure.ac Thu Nov 21 07:29:25 2019 (r354938) @@ -1,5 +1,5 @@ dnl Process this file with autoconf to produce a configure script. -AC_INIT([file],[5.34],[christos@astron.com]) +AC_INIT([file],[5.37],[christos@astron.com]) AM_INIT_AUTOMAKE([subdir-objects foreign]) m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])]) @@ -35,12 +35,12 @@ fi], [ ]) AC_MSG_CHECKING(for zlib support) -AC_ARG_ENABLE(zlib, +AC_ARG_ENABLE([zlib], [AS_HELP_STRING([--disable-zlib], [disable zlib compression support @<:@default=auto@:>@])]) AC_MSG_RESULT($enable_zlib) AC_MSG_CHECKING(for libseccomp support) -AC_ARG_ENABLE(libseccomp, +AC_ARG_ENABLE([libseccomp], [AS_HELP_STRING([--disable-libseccomp], [disable libseccomp sandboxing @<:@default=auto@:>@])]) AC_MSG_RESULT($enable_libseccomp) @@ -90,17 +90,14 @@ dnl Checks for headers AC_HEADER_STDC AC_HEADER_MAJOR AC_HEADER_SYS_WAIT -AC_CHECK_HEADERS(stdint.h fcntl.h locale.h stdint.h inttypes.h unistd.h) -AC_CHECK_HEADERS(stddef.h utime.h wchar.h wctype.h limits.h) -AC_CHECK_HEADERS(getopt.h err.h xlocale.h signal.h) -AC_CHECK_HEADERS(sys/mman.h sys/stat.h sys/types.h sys/utime.h sys/time.h) +AC_CHECK_HEADERS(stdint.h fcntl.h inttypes.h unistd.h) +AC_CHECK_HEADERS(utime.h wchar.h wctype.h) +AC_CHECK_HEADERS(getopt.h err.h xlocale.h) +AC_CHECK_HEADERS(sys/mman.h sys/stat.h sys/types.h sys/utime.h sys/time.h sys/sysmacros.h) if test "$enable_zlib" != "no"; then AC_CHECK_HEADERS(zlib.h) fi -AC_CHECK_TYPE([sig_t],[AC_DEFINE([HAVE_SIG_T],1,[Have sig_t type])],,[ -#ifdef HAVE_SIGNAL_H -#include -#endif]) +AC_CHECK_TYPE([sig_t],[AC_DEFINE([HAVE_SIG_T],1,[Have sig_t type])],,[#include ]) dnl Checks for typedefs, structures, and compiler characteristics. AC_C_CONST @@ -108,7 +105,7 @@ AC_TYPE_OFF_T AC_TYPE_SIZE_T AC_CHECK_MEMBERS([struct stat.st_rdev]) -AC_CHECK_MEMBERS([struct tm.tm_gmtoff]) +AC_CHECK_MEMBERS([struct tm.tm_gmtoff],,,[#include ]) AC_STRUCT_TIMEZONE AC_STRUCT_TIMEZONE_DAYLIGHT AC_SYS_LARGEFILE @@ -154,7 +151,7 @@ else fi]) dnl Checks for functions -AC_CHECK_FUNCS(strerror strndup strtoul mkstemp mkostemp utimes utime wcwidth strtof newlocale uselocale freelocale setlocale) +AC_CHECK_FUNCS(strndup mkstemp mkostemp utimes utime wcwidth strtof newlocale uselocale freelocale memmem) dnl Provide implementation of some required functions if necessary AC_REPLACE_FUNCS(getopt_long asprintf vasprintf strlcpy strlcat getline ctime_r asctime_r localtime_r gmtime_r pread strcasestr fmtcheck dprintf) @@ -178,7 +175,8 @@ if test "$enable_zlib" = "yes"; then if test "$ac_cv_header_zlib_h$ac_cv_lib_z_gzopen" != "yesyes"; then AC_MSG_ERROR([zlib support requested but not found]) fi -elif test "$ac_cv_header_zlib_h$ac_cv_lib_z_gzopen" = "yesyes"; then +fi +if test "$ac_cv_header_zlib_h$ac_cv_lib_z_gzopen" = "yesyes"; then AC_DEFINE([ZLIBSUPPORT], 1, [Enable zlib compression support]) fi Modified: stable/12/contrib/file/doc/file.man ============================================================================== --- stable/12/contrib/file/doc/file.man Thu Nov 21 06:48:30 2019 (r354937) +++ stable/12/contrib/file/doc/file.man Thu Nov 21 07:29:25 2019 (r354938) @@ -1,5 +1,5 @@ -.\" $File: file.man,v 1.131 2018/07/24 21:33:56 christos Exp $ -.Dd July 25, 2018 +.\" $File: file.man,v 1.135 2019/03/03 02:32:40 christos Exp $ +.Dd February 18, 2019 .Dt FILE __CSECTION__ .Os .Sh NAME @@ -159,7 +159,7 @@ two groups, so they are performed last. The language test routines also test for some miscellany (such as .Xr tar 1 -archives). +archives, JSON files). .Pp Any file that cannot be identified as having been written in any of the character sets listed above is simply said to be @@ -171,6 +171,8 @@ Causes the file command to output the file type and cr used by older MacOS versions. The code consists of eight letters, the first describing the file type, the latter the creator. +This option works properly only for file formats that have the +apple-style output defined. .It Fl b , Fl Fl brief Do not prepend filenames to output lines (brief mode). .It Fl C , Fl Fl compile @@ -213,6 +215,8 @@ Checks for, and looks inside, compressed files. .It elf Prints ELF file details, provided soft magic tests are enabled and the elf magic is found. +.It json +Examines JSON (RFC-7159) files by parsing them for compliance. .It soft Consults magic files. .It tar @@ -629,11 +633,11 @@ were written by John Gilmore from his public-domain program, and are not covered by the above license. .Sh BUGS Please report bugs and send patches to the bug tracker at -.Pa http://bugs.astron.com/ +.Pa https://bugs.astron.com/ or the mailing list at .Aq file@astron.com (visit -.Pa http://mailman.astron.com/mailman/listinfo/file +.Pa https://mailman.astron.com/mailman/listinfo/file first to subscribe). .Sh TODO Fix output so that tests for MIME and APPLE flags are not needed all Modified: stable/12/contrib/file/doc/libmagic.man ============================================================================== --- stable/12/contrib/file/doc/libmagic.man Thu Nov 21 06:48:30 2019 (r354937) +++ stable/12/contrib/file/doc/libmagic.man Thu Nov 21 07:29:25 2019 (r354938) @@ -1,6 +1,6 @@ -.\" $File: libmagic.man,v 1.41 2017/05/23 21:54:07 christos Exp $ +.\" $File: libmagic.man,v 1.44 2018/09/09 20:33:28 christos Exp $ .\" -.\" Copyright (c) Christos Zoulas 2003. +.\" Copyright (c) Christos Zoulas 2003, 2018. .\" All Rights Reserved. .\" .\" Redistribution and use in source and binary forms, with or without @@ -25,7 +25,7 @@ .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" -.Dd May 23, 2017 +.Dd August 18, 2018 .Dt LIBMAGIC 3 .Os .Sh NAME @@ -159,6 +159,8 @@ Don't examine tar files. Don't check for various types of text files. .It Dv MAGIC_NO_CHECK_TOKENS Don't look for known tokens inside ascii files. +.It Dv MAGIC_NO_CHECK_JSON +Don't example JSON files. .El .Pp The @@ -391,6 +393,19 @@ The compiled default magic database. .Sh SEE ALSO .Xr file __CSECTION__ , .Xr magic __FSECTION__ +.Sh BUGS +The results from +.Fn magic_buffer +and +.Fn magic_file +where the buffer and the file contain the same data +can produce different results, because in the +.Fn magic_file +case, the program can +.Xr lseek 2 +and +.Xr stat 2 +the file descriptor. .Sh AUTHORS .An M\(oans Rullg\(oard Initial libmagic implementation, and configuration. Modified: stable/12/contrib/file/doc/magic.man ============================================================================== --- stable/12/contrib/file/doc/magic.man Thu Nov 21 06:48:30 2019 (r354937) +++ stable/12/contrib/file/doc/magic.man Thu Nov 21 07:29:25 2019 (r354938) @@ -1,6 +1,5 @@ -.It S2 -.\" $File: magic.man,v 1.93 2018/06/22 20:39:49 christos Exp $ -.Dd June 22, 2018 +.\" $File: magic.man,v 1.96 2019/01/21 14:56:53 christos Exp $ +.Dd January 21, 2019 .Dt MAGIC __FSECTION__ .Os .\" install as magic.4 on USG, magic.5 on V7, Berkeley and Linux systems. @@ -117,13 +116,13 @@ The following modifiers are supported: .It B A byte length (default). .It H -A 4 byte big endian length. -.It h A 2 byte big endian length. +.It h +A 2 byte little endian length. .It L -A 4 byte little endian length. +A 4 byte big endian length. .It l -A 2 byte little endian length. +A 4 byte little endian length. .It J The length includes itself in its count. .El Modified: stable/12/contrib/file/magic/Header ============================================================================== --- stable/12/contrib/file/magic/Header Thu Nov 21 06:48:30 2019 (r354937) +++ stable/12/contrib/file/magic/Header Thu Nov 21 07:29:25 2019 (r354938) @@ -2,4 +2,4 @@ # Format is described in magic(files), where: # files is 5 on V7 and BSD, 4 on SV, and ?? on SVID. # Don't edit this file, edit /etc/magic or send your magic improvements -# to the maintainers, at file@mx.gw.com +# to the maintainers, at file@astron.com Modified: stable/12/contrib/file/magic/Magdir/acorn ============================================================================== --- stable/12/contrib/file/magic/Magdir/acorn Thu Nov 21 06:48:30 2019 (r354937) +++ stable/12/contrib/file/magic/Magdir/acorn Thu Nov 21 07:29:25 2019 (r354938) @@ -1,6 +1,6 @@ #------------------------------------------------------------------------------ -# $File: acorn,v 1.6 2017/10/19 16:40:37 christos Exp $ +# $File: acorn,v 1.7 2019/04/19 00:42:27 christos Exp $ # acorn: file(1) magic for files found on Acorn systems # @@ -83,7 +83,7 @@ # compression mode y (0 - 4) for GIF LZW with a maximum n bits # (y~n,0~12,1~13,2~14,3~15,4~16) >>>5 ulelong+12 x \b, LZW %u-bits compression -# http://www.filebase.org.uk/filetypes +# https://www.filebase.org.uk/filetypes # !Packdir compressed archive has three hexadecimal digits code 68E !:mime application/x-acorn-68E !:ext pkd/bin Modified: stable/12/contrib/file/magic/Magdir/adventure ============================================================================== --- stable/12/contrib/file/magic/Magdir/adventure Thu Nov 21 06:48:30 2019 (r354937) +++ stable/12/contrib/file/magic/Magdir/adventure Thu Nov 21 07:29:25 2019 (r354938) @@ -1,6 +1,6 @@ #------------------------------------------------------------------------------ -# $File: adventure,v 1.17 2017/07/03 16:03:40 christos Exp $ +# $File: adventure,v 1.18 2019/04/19 00:42:27 christos Exp $ # adventure: file(1) magic for Adventure game files # # from Allen Garvin @@ -21,8 +21,8 @@ # Updated by Adam Buchbinder # #http://www.gnelson.demon.co.uk/zspec/sect11.html -#http://www.jczorkmid.net/~jpenney/ZSpec11-latest.txt -#http://en.wikipedia.org/wiki/Z-machine +#https://www.jczorkmid.net/~jpenney/ZSpec11-latest.txt +#https://en.wikipedia.org/wiki/Z-machine # The first byte is the Z-machine revision; it is always between 1 and 8. We # had false matches (for instance, inbig5.ocp from the Omega TeX extension as # well as an occasional MP3 file), so we sanity-check the version number. @@ -111,7 +111,7 @@ # Danny Milosavljevic # These are ADRIFT (adventure game standard) game files, extension .taf # Checked from source at (http://www.adrift.co/) and various taf files -# found at the Interactive Fiction Archive (http://ifarchive.org/) +# found at the Interactive Fiction Archive (https://ifarchive.org/) 0 belong 0x3C423FC9 >4 belong 0x6A87C2CF Adrift game file version >>8 belong 0x94453661 3.80 Modified: stable/12/contrib/file/magic/Magdir/algol68 ============================================================================== --- stable/12/contrib/file/magic/Magdir/algol68 Thu Nov 21 06:48:30 2019 (r354937) +++ stable/12/contrib/file/magic/Magdir/algol68 Thu Nov 21 07:29:25 2019 (r354938) @@ -1,17 +1,17 @@ #------------------------------------------------------------------------------ -# $File: algol68,v 1.2 2016/10/17 14:17:48 christos Exp $ +# $File: algol68,v 1.3 2018/10/19 01:04:21 christos Exp $ # algol68: file(1) magic for Algol 68 source # 0 search/8192 (input, Algol 68 source text !:mime text/x-Algol68 -0 regex \^PROC Algol 68 source text +0 regex/1024 \^PROC Algol 68 source text !:mime text/x-Algol68 -0 regex MODE[\t\ ] Algol 68 source text +0 regex/1024 \bMODE[\t\ ] Algol 68 source text !:mime text/x-Algol68 -0 regex REF[\t\ ] Algol 68 source text +0 regex/1024 \bREF[\t\ ] Algol 68 source text !:mime text/x-Algol68 -0 regex FLEX[\t\ ]\*\\[ Algol 68 source text +0 regex/1024 \bFLEX[\t\ ]\*\\[ Algol 68 source text !:mime text/x-Algol68 #0 regex [\t\ ]OD Algol 68 source text #!:mime text/x-Algol68 Modified: stable/12/contrib/file/magic/Magdir/amigaos ============================================================================== --- stable/12/contrib/file/magic/Magdir/amigaos Thu Nov 21 06:48:30 2019 (r354937) +++ stable/12/contrib/file/magic/Magdir/amigaos Thu Nov 21 07:29:25 2019 (r354938) @@ -1,6 +1,6 @@ #------------------------------------------------------------------------------ -# $File: amigaos,v 1.16 2017/03/17 21:35:28 christos Exp $ +# $File: amigaos,v 1.17 2018/10/16 18:57:19 christos Exp $ # amigaos: file(1) magic for AmigaOS binary formats: # @@ -66,3 +66,22 @@ # From: Przemek Kramarczyk 0 string .KEY AmigaDOS script 0 string .key AmigaDOS script + +# AMOS Basic file formats +# https://www.exotica.org.uk/wiki/AMOS_file_formats +0 string AMOS\040Basic\040 AMOS Basic source code +>11 byte =0x56 \b, tested +>11 byte =0x76 \b, untested +0 string AMOS\040Pro AMOS Basic source code +>11 byte =0x56 \b, tested +>11 byte =0x76 \b, untested +0 string AmSp AMOS Basic sprite bank +>4 beshort x \b, %d sprites +0 string AmIc AMOS Basic icon bank +>4 beshort x \b, %d icons +0 string AmBk AMOS Basic memory bank +>4 beshort x \b, bank number %d +>8 belong&0xFFFFFFF x \b, length %d +>12 regex .{8} \b, type %s +0 string AmBs AMOS Basic memory banks +>4 beshort x \b, %d banks Modified: stable/12/contrib/file/magic/Magdir/android ============================================================================== --- stable/12/contrib/file/magic/Magdir/android Thu Nov 21 06:48:30 2019 (r354937) +++ stable/12/contrib/file/magic/Magdir/android Thu Nov 21 07:29:25 2019 (r354938) @@ -1,6 +1,6 @@ #------------------------------------------------------------ -# $File: android,v 1.10 2017/03/17 21:35:28 christos Exp $ +# $File: android,v 1.12 2019/04/19 00:42:27 christos Exp $ # Various android related magic entries #------------------------------------------------------------ @@ -32,33 +32,68 @@ # Android Backup archive # From: Ariel Shkedi -# File extension: .ab -# No mime-type defined +# Update: Joerg Jenderek # URL: https://github.com/android/platform_frameworks_base/blob/\ # 0bacfd2ba68d21a68a3df345b830bc2a1e515b5a/services/java/com/\ # android/server/BackupManagerService.java#L2367 +# Reference: https://sourceforge.net/projects/adbextractor/ +# android-backup-extractor/perl/backupencrypt.pl +# Note: only unix line feeds "\n" found # After the header comes a tar file # If compressed, the entire tar file is compressed with JAVA deflate # # Include the version number hardcoded with the magic string to avoid # false positives -0 string/b ANDROID\ BACKUP\n1\n Android Backup +0 string/b ANDROID\ BACKUP\n Android Backup +# maybe look for some more characteristics like linefeed '\n' or version +#>16 string \n +# No mime-type defined offically +!:mime application/x-google-ab +!:ext ab +# on 2nd line version (often 1, 2 on kitkat 4.4.3+, 4 on 7.1.2) +>15 string >\0 \b, version %s +# "1" on 3rd line means compressed >17 string 0\n \b, Not-Compressed >17 string 1\n \b, Compressed +# The 4th line is encryption "none" or "AES-256" # any string as long as it's not the word none (which is matched below) +>19 string none\n \b, Not-Encrypted +# look for backup content after line with encryption info +#>>19 search/7 \n +# data part after header for not encrypted Android Backup +#>>>&0 ubequad x \b, content 0x%16.16llx... +# look for zlib compressed by ./compress after message with 1 space at end +#>>>&0 indirect x \b; contains +# look for tar archive block by ./archive for package name manifest +>>288 string ustar \b; contains +>>>31 use tar-file +# look for zip/jar archive by ./archive ./zip after message with 1 space at end +#>>2079 search/1025/s PK\003\004 \b; contains +#>>>&0 indirect x +>19 string !none >>19 regex/1l \^([^n\n]|n[^o]|no[^n]|non[^e]|none.+).* \b, Encrypted (%s) ->>19 string none\n \b, Not-Encrypted # Commented out because they don't seem useful to print # (but they are part of the header - the tar file comes after them): +# The 5th line is User Password Salt (128 Hex) +# string length too high with standard src configuration +#>>>&1 string >\0 \b, PASSWORD salt: "%-128.128s" #>>>&1 regex/1l .* \b, Password salt: %s +# The 6th line is Master Key Checksum Salt (128 Hex) #>>>>&1 regex/1l .* \b, Master salt: %s +# The 7th line is Number of PBDKF2 Rounds (10000) #>>>>>&1 regex/1l .* \b, PBKDF2 rounds: %s +# The 8th line is User key Initialization Vector (IV) (32 Hex) #>>>>>>&1 regex/1l .* \b, IV: %s +#>>>>>>&1 regex/1l .* \b, IV: %s +# The 9th line is Master IV+Key+Checksum (192 Hex) #>>>>>>>&1 regex/1l .* \b, Key: %s +# look for new line separator char after line number 9 +#>>>0x204 ubyte 0x0a NL found +#>>>>&1 ubequad x \b, Content magic %16.16llx # *.pit files by Joerg Jenderek -# http://forum.xda-developers.com/showthread.php?p=9122369 -# http://forum.xda-developers.com/showthread.php?t=816449 +# https://forum.xda-developers.com/showthread.php?p=9122369 +# https://forum.xda-developers.com/showthread.php?t=816449 # Partition Information Table for Samsung's smartphone with Android *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-all@freebsd.org Thu Nov 21 07:39:38 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 01CAD1B25FE; Thu, 21 Nov 2019 07:39:38 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47JWfd6w6Bz41bD; Thu, 21 Nov 2019 07:39:37 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id D13607E86; Thu, 21 Nov 2019 07:39:37 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xAL7dba2017445; Thu, 21 Nov 2019 07:39:37 GMT (envelope-from delphij@FreeBSD.org) Received: (from delphij@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xAL7dYcU017427; Thu, 21 Nov 2019 07:39:34 GMT (envelope-from delphij@FreeBSD.org) Message-Id: <201911210739.xAL7dYcU017427@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: delphij set sender to delphij@FreeBSD.org using -f From: Xin LI Date: Thu, 21 Nov 2019 07:39:34 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r354939 - in stable/11: contrib/file contrib/file/doc contrib/file/magic contrib/file/magic/Magdir contrib/file/src contrib/file/tests lib/libmagic X-SVN-Group: stable-11 X-SVN-Commit-Author: delphij X-SVN-Commit-Paths: in stable/11: contrib/file contrib/file/doc contrib/file/magic contrib/file/magic/Magdir contrib/file/src contrib/file/tests lib/libmagic X-SVN-Commit-Revision: 354939 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 21 Nov 2019 07:39:38 -0000 Author: delphij Date: Thu Nov 21 07:39:33 2019 New Revision: 354939 URL: https://svnweb.freebsd.org/changeset/base/354939 Log: MFC r333923, r354595, r354802: MFV r354582: file 5.37 MFV r354798: Apply vendor fixes: 06de62c Detect multiplication overflow when computing sector position 46a8443 Limit the number of elements in a vector (found by oss-fuzz) Security: CVE-2019-18218 Added: stable/11/contrib/file/magic/Magdir/biosig - copied unchanged from r354595, head/contrib/file/magic/Magdir/biosig stable/11/contrib/file/magic/Magdir/clojure - copied unchanged from r354595, head/contrib/file/magic/Magdir/clojure stable/11/contrib/file/magic/Magdir/edid - copied unchanged from r354595, head/contrib/file/magic/Magdir/edid stable/11/contrib/file/magic/Magdir/espressif - copied unchanged from r354595, head/contrib/file/magic/Magdir/espressif stable/11/contrib/file/magic/Magdir/glibc - copied unchanged from r354595, head/contrib/file/magic/Magdir/glibc stable/11/contrib/file/magic/Magdir/hardware - copied unchanged from r354595, head/contrib/file/magic/Magdir/hardware stable/11/contrib/file/magic/Magdir/kicad - copied unchanged from r354595, head/contrib/file/magic/Magdir/kicad stable/11/contrib/file/magic/Magdir/numpy - copied unchanged from r354595, head/contrib/file/magic/Magdir/numpy stable/11/contrib/file/magic/Magdir/rpmsg - copied unchanged from r354595, head/contrib/file/magic/Magdir/rpmsg stable/11/contrib/file/src/is_json.c - copied unchanged from r354595, head/contrib/file/src/is_json.c stable/11/contrib/file/tests/CVE-2014-1943.result - copied unchanged from r354595, head/contrib/file/tests/CVE-2014-1943.result stable/11/contrib/file/tests/CVE-2014-1943.testfile - copied unchanged from r354595, head/contrib/file/tests/CVE-2014-1943.testfile stable/11/contrib/file/tests/fit-map-data.result - copied unchanged from r354595, head/contrib/file/tests/fit-map-data.result stable/11/contrib/file/tests/fit-map-data.testfile - copied unchanged from r354595, head/contrib/file/tests/fit-map-data.testfile stable/11/contrib/file/tests/issue359xlsx.result - copied unchanged from r354595, head/contrib/file/tests/issue359xlsx.result stable/11/contrib/file/tests/issue359xlsx.testfile - copied unchanged from r354595, head/contrib/file/tests/issue359xlsx.testfile stable/11/contrib/file/tests/json1.result - copied unchanged from r354595, head/contrib/file/tests/json1.result stable/11/contrib/file/tests/json1.testfile - copied unchanged from r354595, head/contrib/file/tests/json1.testfile stable/11/contrib/file/tests/json2.result - copied unchanged from r354595, head/contrib/file/tests/json2.result stable/11/contrib/file/tests/json2.testfile - copied unchanged from r354595, head/contrib/file/tests/json2.testfile stable/11/contrib/file/tests/json3.result - copied unchanged from r354595, head/contrib/file/tests/json3.result stable/11/contrib/file/tests/json3.testfile - copied unchanged from r354595, head/contrib/file/tests/json3.testfile stable/11/contrib/file/tests/regex-eol.magic - copied unchanged from r354595, head/contrib/file/tests/regex-eol.magic stable/11/contrib/file/tests/regex-eol.result - copied unchanged from r354595, head/contrib/file/tests/regex-eol.result stable/11/contrib/file/tests/regex-eol.testfile - copied unchanged from r354595, head/contrib/file/tests/regex-eol.testfile stable/11/contrib/file/tests/zstd-3-skippable-frames.result - copied unchanged from r354595, head/contrib/file/tests/zstd-3-skippable-frames.result stable/11/contrib/file/tests/zstd-dictionary-0.result - copied unchanged from r354595, head/contrib/file/tests/zstd-dictionary-0.result stable/11/contrib/file/tests/zstd-dictionary-1.result - copied unchanged from r354595, head/contrib/file/tests/zstd-dictionary-1.result stable/11/contrib/file/tests/zstd-dictionary-2.result - copied unchanged from r354595, head/contrib/file/tests/zstd-dictionary-2.result stable/11/contrib/file/tests/zstd-skippable-frame-0.result - copied unchanged from r354595, head/contrib/file/tests/zstd-skippable-frame-0.result stable/11/contrib/file/tests/zstd-skippable-frame-4.result - copied unchanged from r354595, head/contrib/file/tests/zstd-skippable-frame-4.result stable/11/contrib/file/tests/zstd-skippable-frame-8.result - copied unchanged from r354595, head/contrib/file/tests/zstd-skippable-frame-8.result stable/11/contrib/file/tests/zstd-skippable-frame-C.result - copied unchanged from r354595, head/contrib/file/tests/zstd-skippable-frame-C.result stable/11/contrib/file/tests/zstd-v0.2-FF.result - copied unchanged from r354595, head/contrib/file/tests/zstd-v0.2-FF.result stable/11/contrib/file/tests/zstd-v0.2-FF.testfile - copied unchanged from r354595, head/contrib/file/tests/zstd-v0.2-FF.testfile stable/11/contrib/file/tests/zstd-v0.3-FF.result - copied unchanged from r354595, head/contrib/file/tests/zstd-v0.3-FF.result stable/11/contrib/file/tests/zstd-v0.3-FF.testfile - copied unchanged from r354595, head/contrib/file/tests/zstd-v0.3-FF.testfile stable/11/contrib/file/tests/zstd-v0.4-FF.result - copied unchanged from r354595, head/contrib/file/tests/zstd-v0.4-FF.result stable/11/contrib/file/tests/zstd-v0.4-FF.testfile - copied unchanged from r354595, head/contrib/file/tests/zstd-v0.4-FF.testfile stable/11/contrib/file/tests/zstd-v0.5-FF.result - copied unchanged from r354595, head/contrib/file/tests/zstd-v0.5-FF.result stable/11/contrib/file/tests/zstd-v0.5-FF.testfile - copied unchanged from r354595, head/contrib/file/tests/zstd-v0.5-FF.testfile stable/11/contrib/file/tests/zstd-v0.6-FF.result - copied unchanged from r354595, head/contrib/file/tests/zstd-v0.6-FF.result stable/11/contrib/file/tests/zstd-v0.6-FF.testfile - copied unchanged from r354595, head/contrib/file/tests/zstd-v0.6-FF.testfile stable/11/contrib/file/tests/zstd-v0.7-00.result - copied unchanged from r354595, head/contrib/file/tests/zstd-v0.7-00.result stable/11/contrib/file/tests/zstd-v0.7-21.result - copied unchanged from r354595, head/contrib/file/tests/zstd-v0.7-21.result stable/11/contrib/file/tests/zstd-v0.7-21.testfile - copied unchanged from r354595, head/contrib/file/tests/zstd-v0.7-21.testfile stable/11/contrib/file/tests/zstd-v0.7-22.result - copied unchanged from r354595, head/contrib/file/tests/zstd-v0.7-22.result stable/11/contrib/file/tests/zstd-v0.7-22.testfile - copied unchanged from r354595, head/contrib/file/tests/zstd-v0.7-22.testfile stable/11/contrib/file/tests/zstd-v0.8-00.result - copied unchanged from r354595, head/contrib/file/tests/zstd-v0.8-00.result stable/11/contrib/file/tests/zstd-v0.8-01.result - copied unchanged from r354595, head/contrib/file/tests/zstd-v0.8-01.result stable/11/contrib/file/tests/zstd-v0.8-01.testfile - copied unchanged from r354595, head/contrib/file/tests/zstd-v0.8-01.testfile stable/11/contrib/file/tests/zstd-v0.8-02.result - copied unchanged from r354595, head/contrib/file/tests/zstd-v0.8-02.result stable/11/contrib/file/tests/zstd-v0.8-02.testfile - copied unchanged from r354595, head/contrib/file/tests/zstd-v0.8-02.testfile stable/11/contrib/file/tests/zstd-v0.8-03.result - copied unchanged from r354595, head/contrib/file/tests/zstd-v0.8-03.result stable/11/contrib/file/tests/zstd-v0.8-03.testfile - copied unchanged from r354595, head/contrib/file/tests/zstd-v0.8-03.testfile stable/11/contrib/file/tests/zstd-v0.8-16.result - copied unchanged from r354595, head/contrib/file/tests/zstd-v0.8-16.result stable/11/contrib/file/tests/zstd-v0.8-16.testfile - copied unchanged from r354595, head/contrib/file/tests/zstd-v0.8-16.testfile stable/11/contrib/file/tests/zstd-v0.8-20.result - copied unchanged from r354595, head/contrib/file/tests/zstd-v0.8-20.result stable/11/contrib/file/tests/zstd-v0.8-20.testfile - copied unchanged from r354595, head/contrib/file/tests/zstd-v0.8-20.testfile stable/11/contrib/file/tests/zstd-v0.8-21.result - copied unchanged from r354595, head/contrib/file/tests/zstd-v0.8-21.result stable/11/contrib/file/tests/zstd-v0.8-21.testfile - copied unchanged from r354595, head/contrib/file/tests/zstd-v0.8-21.testfile stable/11/contrib/file/tests/zstd-v0.8-22.result - copied unchanged from r354595, head/contrib/file/tests/zstd-v0.8-22.result stable/11/contrib/file/tests/zstd-v0.8-22.testfile - copied unchanged from r354595, head/contrib/file/tests/zstd-v0.8-22.testfile stable/11/contrib/file/tests/zstd-v0.8-23.result - copied unchanged from r354595, head/contrib/file/tests/zstd-v0.8-23.result stable/11/contrib/file/tests/zstd-v0.8-23.testfile - copied unchanged from r354595, head/contrib/file/tests/zstd-v0.8-23.testfile stable/11/contrib/file/tests/zstd-v0.8-F4.result - copied unchanged from r354595, head/contrib/file/tests/zstd-v0.8-F4.result stable/11/contrib/file/tests/zstd-v0.8-F4.testfile - copied unchanged from r354595, head/contrib/file/tests/zstd-v0.8-F4.testfile stable/11/contrib/file/tests/zstd-v0.8-FF.result - copied unchanged from r354595, head/contrib/file/tests/zstd-v0.8-FF.result stable/11/contrib/file/tests/zstd-v0.8-FF.testfile - copied unchanged from r354595, head/contrib/file/tests/zstd-v0.8-FF.testfile Modified: stable/11/contrib/file/AUTHORS stable/11/contrib/file/COPYING stable/11/contrib/file/ChangeLog stable/11/contrib/file/NEWS stable/11/contrib/file/README stable/11/contrib/file/config.h.in stable/11/contrib/file/configure stable/11/contrib/file/configure.ac stable/11/contrib/file/doc/file.man stable/11/contrib/file/doc/libmagic.man stable/11/contrib/file/doc/magic.man stable/11/contrib/file/magic/Header stable/11/contrib/file/magic/Magdir/acorn stable/11/contrib/file/magic/Magdir/adventure stable/11/contrib/file/magic/Magdir/algol68 stable/11/contrib/file/magic/Magdir/amigaos stable/11/contrib/file/magic/Magdir/android stable/11/contrib/file/magic/Magdir/animation stable/11/contrib/file/magic/Magdir/apple stable/11/contrib/file/magic/Magdir/archive stable/11/contrib/file/magic/Magdir/audio stable/11/contrib/file/magic/Magdir/basis stable/11/contrib/file/magic/Magdir/ber stable/11/contrib/file/magic/Magdir/bioinformatics stable/11/contrib/file/magic/Magdir/blcr stable/11/contrib/file/magic/Magdir/blender stable/11/contrib/file/magic/Magdir/c-lang stable/11/contrib/file/magic/Magdir/cad stable/11/contrib/file/magic/Magdir/cafebabe stable/11/contrib/file/magic/Magdir/coff stable/11/contrib/file/magic/Magdir/commands stable/11/contrib/file/magic/Magdir/compress stable/11/contrib/file/magic/Magdir/console stable/11/contrib/file/magic/Magdir/coverage stable/11/contrib/file/magic/Magdir/ctf stable/11/contrib/file/magic/Magdir/cups stable/11/contrib/file/magic/Magdir/database stable/11/contrib/file/magic/Magdir/dataone stable/11/contrib/file/magic/Magdir/dbpf stable/11/contrib/file/magic/Magdir/dolby stable/11/contrib/file/magic/Magdir/dyadic stable/11/contrib/file/magic/Magdir/ebml stable/11/contrib/file/magic/Magdir/elf stable/11/contrib/file/magic/Magdir/erlang stable/11/contrib/file/magic/Magdir/esri stable/11/contrib/file/magic/Magdir/filesystems stable/11/contrib/file/magic/Magdir/finger stable/11/contrib/file/magic/Magdir/flash stable/11/contrib/file/magic/Magdir/fonts stable/11/contrib/file/magic/Magdir/fsav stable/11/contrib/file/magic/Magdir/games stable/11/contrib/file/magic/Magdir/geo stable/11/contrib/file/magic/Magdir/gnome stable/11/contrib/file/magic/Magdir/gnu stable/11/contrib/file/magic/Magdir/graphviz stable/11/contrib/file/magic/Magdir/guile stable/11/contrib/file/magic/Magdir/hitachi-sh stable/11/contrib/file/magic/Magdir/hp stable/11/contrib/file/magic/Magdir/ibm6000 stable/11/contrib/file/magic/Magdir/images stable/11/contrib/file/magic/Magdir/intel stable/11/contrib/file/magic/Magdir/isz stable/11/contrib/file/magic/Magdir/java stable/11/contrib/file/magic/Magdir/jpeg stable/11/contrib/file/magic/Magdir/keepass stable/11/contrib/file/magic/Magdir/kerberos stable/11/contrib/file/magic/Magdir/kml stable/11/contrib/file/magic/Magdir/linux stable/11/contrib/file/magic/Magdir/lisp stable/11/contrib/file/magic/Magdir/llvm stable/11/contrib/file/magic/Magdir/lua stable/11/contrib/file/magic/Magdir/m4 stable/11/contrib/file/magic/Magdir/macintosh stable/11/contrib/file/magic/Magdir/mail.news stable/11/contrib/file/magic/Magdir/map stable/11/contrib/file/magic/Magdir/marc21 stable/11/contrib/file/magic/Magdir/matroska stable/11/contrib/file/magic/Magdir/mercurial stable/11/contrib/file/magic/Magdir/metastore stable/11/contrib/file/magic/Magdir/microfocus stable/11/contrib/file/magic/Magdir/misctools stable/11/contrib/file/magic/Magdir/modem stable/11/contrib/file/magic/Magdir/mozilla stable/11/contrib/file/magic/Magdir/msdos stable/11/contrib/file/magic/Magdir/msooxml stable/11/contrib/file/magic/Magdir/msvc stable/11/contrib/file/magic/Magdir/neko stable/11/contrib/file/magic/Magdir/netbsd stable/11/contrib/file/magic/Magdir/nitpicker stable/11/contrib/file/magic/Magdir/ole2compounddocs stable/11/contrib/file/magic/Magdir/palm stable/11/contrib/file/magic/Magdir/parrot stable/11/contrib/file/magic/Magdir/pbf stable/11/contrib/file/magic/Magdir/pc98 stable/11/contrib/file/magic/Magdir/pgp stable/11/contrib/file/magic/Magdir/polyml stable/11/contrib/file/magic/Magdir/printer stable/11/contrib/file/magic/Magdir/psl stable/11/contrib/file/magic/Magdir/pwsafe stable/11/contrib/file/magic/Magdir/python stable/11/contrib/file/magic/Magdir/qt stable/11/contrib/file/magic/Magdir/revision stable/11/contrib/file/magic/Magdir/riff stable/11/contrib/file/magic/Magdir/ruby stable/11/contrib/file/magic/Magdir/scientific stable/11/contrib/file/magic/Magdir/selinux stable/11/contrib/file/magic/Magdir/sendmail stable/11/contrib/file/magic/Magdir/sequent stable/11/contrib/file/magic/Magdir/sgml stable/11/contrib/file/magic/Magdir/sniffer stable/11/contrib/file/magic/Magdir/sql stable/11/contrib/file/magic/Magdir/sun stable/11/contrib/file/magic/Magdir/sysex stable/11/contrib/file/magic/Magdir/tcl stable/11/contrib/file/magic/Magdir/terminfo stable/11/contrib/file/magic/Magdir/tex stable/11/contrib/file/magic/Magdir/tplink stable/11/contrib/file/magic/Magdir/unicode stable/11/contrib/file/magic/Magdir/varied.script stable/11/contrib/file/magic/Magdir/virtual stable/11/contrib/file/magic/Magdir/warc stable/11/contrib/file/magic/Magdir/webassembly stable/11/contrib/file/magic/Magdir/windows stable/11/contrib/file/magic/Magdir/wordprocessors stable/11/contrib/file/magic/Magdir/wsdl stable/11/contrib/file/magic/Magdir/xwindows stable/11/contrib/file/magic/Magdir/yara stable/11/contrib/file/magic/Magdir/zip stable/11/contrib/file/magic/Makefile.am stable/11/contrib/file/magic/Makefile.in stable/11/contrib/file/src/Makefile.am stable/11/contrib/file/src/Makefile.in stable/11/contrib/file/src/apprentice.c stable/11/contrib/file/src/apptype.c stable/11/contrib/file/src/ascmagic.c stable/11/contrib/file/src/asprintf.c stable/11/contrib/file/src/buffer.c stable/11/contrib/file/src/cdf.c stable/11/contrib/file/src/cdf.h stable/11/contrib/file/src/cdf_time.c stable/11/contrib/file/src/compress.c stable/11/contrib/file/src/der.c stable/11/contrib/file/src/dprintf.c stable/11/contrib/file/src/elfclass.h stable/11/contrib/file/src/encoding.c stable/11/contrib/file/src/file.c stable/11/contrib/file/src/file.h stable/11/contrib/file/src/fmtcheck.c stable/11/contrib/file/src/fsmagic.c stable/11/contrib/file/src/funcs.c stable/11/contrib/file/src/getopt_long.c stable/11/contrib/file/src/is_tar.c stable/11/contrib/file/src/magic.c stable/11/contrib/file/src/magic.h.in stable/11/contrib/file/src/mygetopt.h stable/11/contrib/file/src/print.c stable/11/contrib/file/src/readcdf.c stable/11/contrib/file/src/readelf.c stable/11/contrib/file/src/readelf.h stable/11/contrib/file/src/seccomp.c stable/11/contrib/file/src/softmagic.c stable/11/contrib/file/src/vasprintf.c stable/11/contrib/file/tests/Makefile.am stable/11/contrib/file/tests/Makefile.in stable/11/lib/libmagic/Makefile stable/11/lib/libmagic/config.h Directory Properties: stable/11/ (props changed) Modified: stable/11/contrib/file/AUTHORS ============================================================================== --- stable/11/contrib/file/AUTHORS Thu Nov 21 07:29:25 2019 (r354938) +++ stable/11/contrib/file/AUTHORS Thu Nov 21 07:39:33 2019 (r354939) @@ -1 +1 @@ -See COPYING. \ No newline at end of file +See COPYING. Modified: stable/11/contrib/file/COPYING ============================================================================== --- stable/11/contrib/file/COPYING Thu Nov 21 07:29:25 2019 (r354938) +++ stable/11/contrib/file/COPYING Thu Nov 21 07:39:33 2019 (r354939) @@ -1,4 +1,4 @@ -$File: COPYING,v 1.1 2008/02/05 19:08:11 christos Exp $ +$File: COPYING,v 1.2 2018/09/09 20:33:28 christos Exp $ Copyright (c) Ian F. Darwin 1986, 1987, 1989, 1990, 1991, 1992, 1994, 1995. Software written by Ian F. Darwin and others; maintained 1994- Christos Zoulas. @@ -15,7 +15,7 @@ are met: 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. - + THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE Modified: stable/11/contrib/file/ChangeLog ============================================================================== --- stable/11/contrib/file/ChangeLog Thu Nov 21 07:29:25 2019 (r354938) +++ stable/11/contrib/file/ChangeLog Thu Nov 21 07:39:33 2019 (r354939) @@ -1,3 +1,75 @@ +2019-05-14 22:26 Christos Zoulas + + * release 5.37 + +2019-05-09 22:27 Christos Zoulas + + * Make sure that continuation separators are printed + with -k within softmagic + +2019-05-06 22:27 Christos Zoulas + + * Change SIGPIPE saving and restoring during compression to use + sigaction(2) instead of signal(3) and cache it. (Denys Vlasenko) + * Cache stat(2) calls more to reduce number of calls (Denys Vlasenko) + +2019-05-06 17:25 Christos Zoulas + + * PR/77: Handle --mime-type and -k correctly. + +2019-05-03 15:26 Christos Zoulas + + * Switch decompression code to use vfork() because + tools like rpmdiff and rpmbuild call libmagic + with large process footprints (Denys Vlasenko) + +2019-04-07 14:05 Christos Zoulas + + * PR/75: --enable-zlib, did not work. + +2019-02-27 11:54 Christos Zoulas + + * Improve regex efficiency (Michael Schroeder) by: + 1. Prefixing regex searches with regular search + for keywords where possible + 2. Using memmem(3) where available + +2019-02-20 10:16 Christos Zoulas + + * release 5.36 + +2019-02-19 15:30 Christos Zoulas + + * Fix cast to use cast macros + * Add UCS-32 builtin detection (PR/61) reported by tmc + +2019-02-18 18:24 Christos Zoulas + + * Fix stack read (PR/62) and write (PR/64) stack overflows + reported by spinpx + +2018-10-18 19:32 Christos Zoulas + + * release 5.35 + +2018-09-10 20:38 Christos Zoulas + + * Add FreeBSD ELF core file support (John Baldwin) + +2018-08-20 18:40 Christos Zoulas + + * PR/30: Allow all parameter values to be set (don't treat 0 specially) + * handle default annotations on the softmagic match instead at the + end. + +2018-07-25 10:17 Christos Zoulas + + * PR/23: Recognize JSON files + +2018-07-25 10:17 Christos Zoulas + + * PR/18: file --mime-encoding should not print mime-type + 2018-07-25 8:50 Christos Zoulas * release 5.34 @@ -14,11 +86,11 @@ * release 5.33 -2018-02-24 14:50 Christos Zoulas +2018-02-24 14:50 Christos Zoulas * extend the support for ${x?:} expansions for magic descriptions -2018-02-21 16:25 Christos Zoulas +2018-02-21 16:25 Christos Zoulas * add support for ${x?:} in mime types to handle pie binaries. @@ -90,7 +162,7 @@ * Add missing overflow check in der magic (Jonas Wagner) 2016-10-25 10:40 Christos Zoulas - + * release 5.29 2016-10-24 11:20 Christos Zoulas @@ -131,11 +203,11 @@ - set offset to 0 on failure. 2016-05-13 12:00 Christos Zoulas - + * release 5.27 2016-04-18 9:35 Christos Zoulas - + * Errors comparing DER entries or computing offsets are just indications of malformed non-DER files. Don't print them. @@ -144,7 +216,7 @@ * Put new bytes constant in the right file (not the generated one) 2016-04-16 18:34 Christos Zoulas - + * release 5.26 2016-03-31 13:50 Christos Zoulas @@ -190,7 +262,7 @@ * PR/492: compression forking was broken with magic_buffer. 2015-09-16 9:50 Christos Zoulas - + * release 5.25 2015-09-11 13:25 Christos Zoulas @@ -218,7 +290,7 @@ * release 5.23 2015-06-09 16:10 Christos Zoulas - + * Fix issue with regex range for magic with offset * Always return true from mget with USE (success to mget not match indication). Fixes mime evaluation after USE magic @@ -271,12 +343,12 @@ * add indirect relative for TIFF/Exif 2014-12-16 18:10 Christos Zoulas - + * restructure elf note printing to avoid repeated messages * add note limit, suggested by Alexander Cherepanov 2014-12-16 16:53 Christos Zoulas - + * Bail out on partial pread()'s (Alexander Cherepanov) * Fix incorrect bounds check in file_printable (Alexander Cherepanov) @@ -287,7 +359,7 @@ more places for safety * in ELF, instead of "(uses dynamic libraries)" when PT_INTERP is present print the interpreter name. - + 2014-12-10 20:01 Christos Zoulas * release 5.21 @@ -330,7 +402,7 @@ on a byte by byte basis, so that we don't get issues with locale's trying to interpret random byte streams as UTF-8 and having printf error out with EILSEQ. - + 2014-10-17 11:48 Christos Zoulas * fix bounds in note reading (Francisco Alonso / Red Hat) @@ -361,7 +433,7 @@ * release 5.19 2014-06-09 9:04 Christos Zoulas - + * Misc buffer overruns and missing buffer size tests in cdf parsing (Francisco Alonso, Jan Kaluza) @@ -391,7 +463,7 @@ 2014-05-04 14:55 Christos Zoulas - * PR/351: Fix compilation of empty files + * PR/351: Fix compilation of empty files 2014-04-30 17:39 Christos Zoulas @@ -495,7 +567,7 @@ * Don't treat magic as an error if offset was past EOF (Christoph Biedl) 2013-05-28 17:25 Christos Zoulas - + * Fix spacing issues in softmagic and elf (Jan Kaluza) 2013-05-02 18:00 Christos Zoulas @@ -551,7 +623,7 @@ * Make getline public so that file can link against it. Perhaps it is better to rename it, or hide it differently. Fixes builds on platforms that do not provide it. - + 2013-01-07 16:30 Christos Zoulas * Add SuS d{,1,2,4,8}, u{,1,2,4,8} and document @@ -901,7 +973,7 @@ (Cheng Renquan) 2009-05-08 13:40 Christos Zoulas - + * lint fixes and more from NetBSD 2009-05-06 10:25 Christos Zoulas @@ -921,7 +993,7 @@ 2009-03-27 18:43 Christos Zoulas - * don't print \012- separators in the same magic entry + * don't print \012- separators in the same magic entry if it consists of multiple magic printing lines. 2009-03-23 10:20 Christos Zoulas Modified: stable/11/contrib/file/NEWS ============================================================================== --- stable/11/contrib/file/NEWS Thu Nov 21 07:29:25 2019 (r354938) +++ stable/11/contrib/file/NEWS Thu Nov 21 07:39:33 2019 (r354939) @@ -1 +1 @@ -See ChangeLog. \ No newline at end of file +See ChangeLog. Modified: stable/11/contrib/file/README ============================================================================== --- stable/11/contrib/file/README Thu Nov 21 07:29:25 2019 (r354938) +++ stable/11/contrib/file/README Thu Nov 21 07:39:33 2019 (r354939) @@ -1,6 +1,6 @@ -## README for file(1) Command ## +## README for file(1) Command and the libmagic(3) library ## - @(#) $File: README,v 1.54 2018/05/30 03:06:56 christos Exp $ + @(#) $File: README,v 1.57 2019/02/06 00:20:56 christos Exp $ Mailing List: file@astron.com Mailing List archives: http://mailman.astron.com/pipermail/file/ @@ -63,53 +63,54 @@ magic numbers assigned to all sorts of data files that are in reasonable circulation. Send your magic numbers, in magic(5) format please, to the maintainer, Christos Zoulas. -COPYING - read this first. -README - read this second (you are currently reading this file). +COPYING - read this first. +README - read this second (you are currently reading this file). INSTALL - read on how to install -src/apprentice.c - parses /etc/magic to learn magic -src/apptype.c - used for OS/2 specific application type magic -src/ascmagic.c - third & last set of tests, based on hardwired assumptions. -src/asctime_r.c - replacement for OS's that don't have it. -src/asprintf.c - replacement for OS's that don't have it. -src/asctime_r.c - replacement for OS's that don't have it. -src/asprintf.c - replacement for OS's that don't have it. +src/apprentice.c - parses /etc/magic to learn magic +src/apptype.c - used for OS/2 specific application type magic +src/ascmagic.c - third & last set of tests, based on hardwired assumptions. +src/asctime_r.c - replacement for OS's that don't have it. +src/asprintf.c - replacement for OS's that don't have it. +src/asctime_r.c - replacement for OS's that don't have it. +src/asprintf.c - replacement for OS's that don't have it. src/buffer.c - buffer handling functions. -src/cdf.[ch] - parser for Microsoft Compound Document Files -src/cdf_time.c - time converter for CDF. -src/compress.c - handles decompressing files to look inside. -src/ctime_r.c - replacement for OS's that don't have it. +src/cdf.[ch] - parser for Microsoft Compound Document Files +src/cdf_time.c - time converter for CDF. +src/compress.c - handles decompressing files to look inside. +src/ctime_r.c - replacement for OS's that don't have it. src/der.[ch] - parser for Distinguished Encoding Rules src/dprintf.c - replacement for OS's that don't have it. src/elfclass.h - common code for elf 32/64. -src/encoding.c - handles unicode encodings -src/file.c - the main program -src/file.h - header file +src/encoding.c - handles unicode encodings +src/file.c - the main program +src/file.h - header file src/file_opts.h - list of options -src/fmtcheck.c - replacement for OS's that don't have it. -src/fsmagic.c - first set of tests the program runs, based on filesystem info -src/funcs.c - utilility functions -src/getline.c - replacement for OS's that don't have it. -src/getopt_long.c - replacement for OS's that don't have it. -src/gmtime_r.c - replacement for OS's that don't have it. -src/is_tar.c, tar.h - knows about Tape ARchive format (courtesy John Gilmore). -src/localtime_r.c - replacement for OS's that don't have it. +src/fmtcheck.c - replacement for OS's that don't have it. +src/fsmagic.c - first set of tests the program runs, based on filesystem info +src/funcs.c - utilility functions +src/getline.c - replacement for OS's that don't have it. +src/getopt_long.c - replacement for OS's that don't have it. +src/gmtime_r.c - replacement for OS's that don't have it. +src/is_json.c - knows about JavaScript Object Notation format (RFC 8259). +src/is_tar.c, tar.h - knows about Tape ARchive format (courtesy John Gilmore). +src/localtime_r.c - replacement for OS's that don't have it. src/magic.h.in - source file for magic.h -src/mygetopt.h - replacement for OS's that don't have it. -src/magic.c - the libmagic api -src/names.h - header file for ascmagic.c -src/pread.c - replacement for OS's that don't have it. -src/print.c - print results, errors, warnings. -src/readcdf.c - CDF wrapper. -src/readelf.[ch] - Stand-alone elf parsing code. -src/softmagic.c - 2nd set of tests, based on /etc/magic -src/mygetopt.h - replacement for OS's that don't have it. -src/strcasestr.c - replacement for OS's that don't have it. -src/strlcat.c - replacement for OS's that don't have it. -src/strlcpy.c - replacement for OS's that don't have it. -src/strndup.c - replacement for OS's that don't have it. +src/mygetopt.h - replacement for OS's that don't have it. +src/magic.c - the libmagic api +src/names.h - header file for ascmagic.c +src/pread.c - replacement for OS's that don't have it. +src/print.c - print results, errors, warnings. +src/readcdf.c - CDF wrapper. +src/readelf.[ch] - Stand-alone elf parsing code. +src/softmagic.c - 2nd set of tests, based on /etc/magic +src/mygetopt.h - replacement for OS's that don't have it. +src/strcasestr.c - replacement for OS's that don't have it. +src/strlcat.c - replacement for OS's that don't have it. +src/strlcpy.c - replacement for OS's that don't have it. +src/strndup.c - replacement for OS's that don't have it. src/tar.h - tar file definitions -src/vasprintf.c - for systems that don't have it. -doc/file.man - man page for the command +src/vasprintf.c - for systems that don't have it. +doc/file.man - man page for the command doc/magic.man - man page for the magic file, courtesy Guy Harris. Install as magic.4 on USG and magic.5 on V7 or Berkeley; cf Makefile. Modified: stable/11/contrib/file/config.h.in ============================================================================== --- stable/11/contrib/file/config.h.in Thu Nov 21 07:29:25 2019 (r354938) +++ stable/11/contrib/file/config.h.in Thu Nov 21 07:39:33 2019 (r354939) @@ -83,12 +83,6 @@ /* Define to 1 if you have the `z' library (-lz). */ #undef HAVE_LIBZ -/* Define to 1 if you have the header file. */ -#undef HAVE_LIMITS_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_LOCALE_H - /* Define to 1 if you have the `localtime_r' function. */ #undef HAVE_LOCALTIME_R @@ -98,6 +92,9 @@ /* Define to 1 if declares mbstate_t. */ #undef HAVE_MBSTATE_T +/* Define to 1 if you have the `memmem' function. */ +#undef HAVE_MEMMEM + /* Define to 1 if you have the header file. */ #undef HAVE_MEMORY_H @@ -116,18 +113,9 @@ /* Define to 1 if you have the `pread' function. */ #undef HAVE_PREAD -/* Define to 1 if you have the `setlocale' function. */ -#undef HAVE_SETLOCALE - -/* Define to 1 if you have the header file. */ -#undef HAVE_SIGNAL_H - /* Have sig_t type */ #undef HAVE_SIG_T -/* Define to 1 if you have the header file. */ -#undef HAVE_STDDEF_H - /* Define to 1 if you have the header file. */ #undef HAVE_STDINT_H @@ -137,9 +125,6 @@ /* Define to 1 if you have the `strcasestr' function. */ #undef HAVE_STRCASESTR -/* Define to 1 if you have the `strerror' function. */ -#undef HAVE_STRERROR - /* Define to 1 if you have the header file. */ #undef HAVE_STRINGS_H @@ -158,9 +143,6 @@ /* Define to 1 if you have the `strtof' function. */ #undef HAVE_STRTOF -/* Define to 1 if you have the `strtoul' function. */ -#undef HAVE_STRTOUL - /* HAVE_STRUCT_OPTION */ #undef HAVE_STRUCT_OPTION @@ -181,6 +163,9 @@ /* Define to 1 if you have the header file. */ #undef HAVE_SYS_STAT_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_SYS_SYSMACROS_H /* Define to 1 if you have the header file. */ #undef HAVE_SYS_TIME_H Modified: stable/11/contrib/file/configure ============================================================================== --- stable/11/contrib/file/configure Thu Nov 21 07:29:25 2019 (r354938) +++ stable/11/contrib/file/configure Thu Nov 21 07:39:33 2019 (r354939) @@ -1,6 +1,6 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.69 for file 5.34. +# Generated by GNU Autoconf 2.69 for file 5.37. # # Report bugs to . # @@ -590,8 +590,8 @@ MAKEFLAGS= # Identity of this package. PACKAGE_NAME='file' PACKAGE_TARNAME='file' -PACKAGE_VERSION='5.34' -PACKAGE_STRING='file 5.34' +PACKAGE_VERSION='5.37' +PACKAGE_STRING='file 5.37' PACKAGE_BUGREPORT='christos@astron.com' PACKAGE_URL='' @@ -1329,7 +1329,7 @@ if test "$ac_init_help" = "long"; then # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF -\`configure' configures file 5.34 to adapt to many kinds of systems. +\`configure' configures file 5.37 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -1399,7 +1399,7 @@ fi if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of file 5.34:";; + short | recursive ) echo "Configuration of file 5.37:";; esac cat <<\_ACEOF @@ -1511,7 +1511,7 @@ fi test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF -file configure 5.34 +file configure 5.37 generated by GNU Autoconf 2.69 Copyright (C) 2012 Free Software Foundation, Inc. @@ -2167,7 +2167,7 @@ cat >config.log <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. -It was created by file $as_me 5.34, which was +It was created by file $as_me 5.37, which was generated by GNU Autoconf 2.69. Invocation command line was $ $0 $@ @@ -3033,7 +3033,7 @@ fi # Define the identity of the package. PACKAGE='file' - VERSION='5.34' + VERSION='5.37' cat >>confdefs.h <<_ACEOF @@ -12784,7 +12784,7 @@ $as_echo "#define HAVE_SYS_WAIT_H 1" >>confdefs.h fi -for ac_header in stdint.h fcntl.h locale.h stdint.h inttypes.h unistd.h +for ac_header in stdint.h fcntl.h inttypes.h unistd.h do : as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` ac_fn_c_check_header_mongrel "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default" @@ -12797,7 +12797,7 @@ fi done -for ac_header in stddef.h utime.h wchar.h wctype.h limits.h +for ac_header in utime.h wchar.h wctype.h do : as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` ac_fn_c_check_header_mongrel "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default" @@ -12810,7 +12810,7 @@ fi done -for ac_header in getopt.h err.h xlocale.h signal.h +for ac_header in getopt.h err.h xlocale.h do : as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` ac_fn_c_check_header_mongrel "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default" @@ -12823,7 +12823,7 @@ fi done -for ac_header in sys/mman.h sys/stat.h sys/types.h sys/utime.h sys/time.h +for ac_header in sys/mman.h sys/stat.h sys/types.h sys/utime.h sys/time.h sys/sysmacros.h do : as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` ac_fn_c_check_header_mongrel "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default" @@ -12850,10 +12850,7 @@ fi done fi -ac_fn_c_check_type "$LINENO" "sig_t" "ac_cv_type_sig_t" " -#ifdef HAVE_SIGNAL_H -#include -#endif +ac_fn_c_check_type "$LINENO" "sig_t" "ac_cv_type_sig_t" "#include " if test "x$ac_cv_type_sig_t" = xyes; then : @@ -12976,7 +12973,8 @@ _ACEOF fi -ac_fn_c_check_member "$LINENO" "struct tm" "tm_gmtoff" "ac_cv_member_struct_tm_tm_gmtoff" "$ac_includes_default" +ac_fn_c_check_member "$LINENO" "struct tm" "tm_gmtoff" "ac_cv_member_struct_tm_tm_gmtoff" "#include +" if test "x$ac_cv_member_struct_tm_tm_gmtoff" = xyes; then : cat >>confdefs.h <<_ACEOF @@ -14229,7 +14227,7 @@ fi fi -for ac_func in strerror strndup strtoul mkstemp mkostemp utimes utime wcwidth strtof newlocale uselocale freelocale setlocale +for ac_func in strndup mkstemp mkostemp utimes utime wcwidth strtof newlocale uselocale freelocale memmem do : as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh` ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var" @@ -14583,7 +14581,8 @@ if test "$enable_zlib" = "yes"; then if test "$ac_cv_header_zlib_h$ac_cv_lib_z_gzopen" != "yesyes"; then as_fn_error $? "zlib support requested but not found" "$LINENO" 5 fi -elif test "$ac_cv_header_zlib_h$ac_cv_lib_z_gzopen" = "yesyes"; then +fi +if test "$ac_cv_header_zlib_h$ac_cv_lib_z_gzopen" = "yesyes"; then $as_echo "#define ZLIBSUPPORT 1" >>confdefs.h @@ -15134,7 +15133,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" -This file was extended by file $as_me 5.34, which was +This file was extended by file $as_me 5.37, which was generated by GNU Autoconf 2.69. Invocation command line was CONFIG_FILES = $CONFIG_FILES @@ -15200,7 +15199,7 @@ _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" ac_cs_version="\\ -file config.status 5.34 +file config.status 5.37 configured by $0, generated by GNU Autoconf 2.69, with options \\"\$ac_cs_config\\" Modified: stable/11/contrib/file/configure.ac ============================================================================== --- stable/11/contrib/file/configure.ac Thu Nov 21 07:29:25 2019 (r354938) +++ stable/11/contrib/file/configure.ac Thu Nov 21 07:39:33 2019 (r354939) @@ -1,5 +1,5 @@ dnl Process this file with autoconf to produce a configure script. -AC_INIT([file],[5.34],[christos@astron.com]) +AC_INIT([file],[5.37],[christos@astron.com]) AM_INIT_AUTOMAKE([subdir-objects foreign]) m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])]) @@ -35,12 +35,12 @@ fi], [ ]) AC_MSG_CHECKING(for zlib support) -AC_ARG_ENABLE(zlib, +AC_ARG_ENABLE([zlib], [AS_HELP_STRING([--disable-zlib], [disable zlib compression support @<:@default=auto@:>@])]) AC_MSG_RESULT($enable_zlib) AC_MSG_CHECKING(for libseccomp support) -AC_ARG_ENABLE(libseccomp, +AC_ARG_ENABLE([libseccomp], [AS_HELP_STRING([--disable-libseccomp], [disable libseccomp sandboxing @<:@default=auto@:>@])]) AC_MSG_RESULT($enable_libseccomp) @@ -90,17 +90,14 @@ dnl Checks for headers AC_HEADER_STDC AC_HEADER_MAJOR AC_HEADER_SYS_WAIT -AC_CHECK_HEADERS(stdint.h fcntl.h locale.h stdint.h inttypes.h unistd.h) -AC_CHECK_HEADERS(stddef.h utime.h wchar.h wctype.h limits.h) -AC_CHECK_HEADERS(getopt.h err.h xlocale.h signal.h) -AC_CHECK_HEADERS(sys/mman.h sys/stat.h sys/types.h sys/utime.h sys/time.h) +AC_CHECK_HEADERS(stdint.h fcntl.h inttypes.h unistd.h) +AC_CHECK_HEADERS(utime.h wchar.h wctype.h) +AC_CHECK_HEADERS(getopt.h err.h xlocale.h) +AC_CHECK_HEADERS(sys/mman.h sys/stat.h sys/types.h sys/utime.h sys/time.h sys/sysmacros.h) if test "$enable_zlib" != "no"; then AC_CHECK_HEADERS(zlib.h) fi -AC_CHECK_TYPE([sig_t],[AC_DEFINE([HAVE_SIG_T],1,[Have sig_t type])],,[ -#ifdef HAVE_SIGNAL_H -#include -#endif]) +AC_CHECK_TYPE([sig_t],[AC_DEFINE([HAVE_SIG_T],1,[Have sig_t type])],,[#include ]) dnl Checks for typedefs, structures, and compiler characteristics. AC_C_CONST @@ -108,7 +105,7 @@ AC_TYPE_OFF_T AC_TYPE_SIZE_T AC_CHECK_MEMBERS([struct stat.st_rdev]) -AC_CHECK_MEMBERS([struct tm.tm_gmtoff]) +AC_CHECK_MEMBERS([struct tm.tm_gmtoff],,,[#include ]) AC_STRUCT_TIMEZONE AC_STRUCT_TIMEZONE_DAYLIGHT AC_SYS_LARGEFILE @@ -154,7 +151,7 @@ else fi]) dnl Checks for functions -AC_CHECK_FUNCS(strerror strndup strtoul mkstemp mkostemp utimes utime wcwidth strtof newlocale uselocale freelocale setlocale) +AC_CHECK_FUNCS(strndup mkstemp mkostemp utimes utime wcwidth strtof newlocale uselocale freelocale memmem) dnl Provide implementation of some required functions if necessary AC_REPLACE_FUNCS(getopt_long asprintf vasprintf strlcpy strlcat getline ctime_r asctime_r localtime_r gmtime_r pread strcasestr fmtcheck dprintf) @@ -178,7 +175,8 @@ if test "$enable_zlib" = "yes"; then if test "$ac_cv_header_zlib_h$ac_cv_lib_z_gzopen" != "yesyes"; then AC_MSG_ERROR([zlib support requested but not found]) fi -elif test "$ac_cv_header_zlib_h$ac_cv_lib_z_gzopen" = "yesyes"; then +fi +if test "$ac_cv_header_zlib_h$ac_cv_lib_z_gzopen" = "yesyes"; then AC_DEFINE([ZLIBSUPPORT], 1, [Enable zlib compression support]) fi Modified: stable/11/contrib/file/doc/file.man ============================================================================== --- stable/11/contrib/file/doc/file.man Thu Nov 21 07:29:25 2019 (r354938) +++ stable/11/contrib/file/doc/file.man Thu Nov 21 07:39:33 2019 (r354939) @@ -1,5 +1,5 @@ -.\" $File: file.man,v 1.131 2018/07/24 21:33:56 christos Exp $ -.Dd July 25, 2018 +.\" $File: file.man,v 1.135 2019/03/03 02:32:40 christos Exp $ +.Dd February 18, 2019 .Dt FILE __CSECTION__ .Os .Sh NAME @@ -159,7 +159,7 @@ two groups, so they are performed last. The language test routines also test for some miscellany (such as .Xr tar 1 -archives). +archives, JSON files). .Pp Any file that cannot be identified as having been written in any of the character sets listed above is simply said to be @@ -171,6 +171,8 @@ Causes the file command to output the file type and cr used by older MacOS versions. The code consists of eight letters, the first describing the file type, the latter the creator. +This option works properly only for file formats that have the +apple-style output defined. .It Fl b , Fl Fl brief Do not prepend filenames to output lines (brief mode). .It Fl C , Fl Fl compile @@ -213,6 +215,8 @@ Checks for, and looks inside, compressed files. .It elf Prints ELF file details, provided soft magic tests are enabled and the elf magic is found. +.It json +Examines JSON (RFC-7159) files by parsing them for compliance. .It soft Consults magic files. .It tar @@ -629,11 +633,11 @@ were written by John Gilmore from his public-domain program, and are not covered by the above license. .Sh BUGS Please report bugs and send patches to the bug tracker at -.Pa http://bugs.astron.com/ +.Pa https://bugs.astron.com/ or the mailing list at .Aq file@astron.com (visit -.Pa http://mailman.astron.com/mailman/listinfo/file +.Pa https://mailman.astron.com/mailman/listinfo/file first to subscribe). .Sh TODO Fix output so that tests for MIME and APPLE flags are not needed all Modified: stable/11/contrib/file/doc/libmagic.man ============================================================================== --- stable/11/contrib/file/doc/libmagic.man Thu Nov 21 07:29:25 2019 (r354938) +++ stable/11/contrib/file/doc/libmagic.man Thu Nov 21 07:39:33 2019 (r354939) @@ -1,6 +1,6 @@ -.\" $File: libmagic.man,v 1.41 2017/05/23 21:54:07 christos Exp $ +.\" $File: libmagic.man,v 1.44 2018/09/09 20:33:28 christos Exp $ .\" -.\" Copyright (c) Christos Zoulas 2003. +.\" Copyright (c) Christos Zoulas 2003, 2018. .\" All Rights Reserved. .\" .\" Redistribution and use in source and binary forms, with or without @@ -25,7 +25,7 @@ .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" -.Dd May 23, 2017 +.Dd August 18, 2018 .Dt LIBMAGIC 3 .Os .Sh NAME @@ -159,6 +159,8 @@ Don't examine tar files. Don't check for various types of text files. .It Dv MAGIC_NO_CHECK_TOKENS Don't look for known tokens inside ascii files. +.It Dv MAGIC_NO_CHECK_JSON +Don't example JSON files. .El .Pp The @@ -391,6 +393,19 @@ The compiled default magic database. .Sh SEE ALSO .Xr file __CSECTION__ , .Xr magic __FSECTION__ +.Sh BUGS +The results from +.Fn magic_buffer +and +.Fn magic_file +where the buffer and the file contain the same data +can produce different results, because in the +.Fn magic_file +case, the program can +.Xr lseek 2 +and +.Xr stat 2 +the file descriptor. .Sh AUTHORS .An M\(oans Rullg\(oard Initial libmagic implementation, and configuration. Modified: stable/11/contrib/file/doc/magic.man ============================================================================== --- stable/11/contrib/file/doc/magic.man Thu Nov 21 07:29:25 2019 (r354938) +++ stable/11/contrib/file/doc/magic.man Thu Nov 21 07:39:33 2019 (r354939) @@ -1,6 +1,5 @@ -.It S2 -.\" $File: magic.man,v 1.93 2018/06/22 20:39:49 christos Exp $ -.Dd June 22, 2018 +.\" $File: magic.man,v 1.96 2019/01/21 14:56:53 christos Exp $ +.Dd January 21, 2019 .Dt MAGIC __FSECTION__ .Os .\" install as magic.4 on USG, magic.5 on V7, Berkeley and Linux systems. @@ -117,13 +116,13 @@ The following modifiers are supported: .It B A byte length (default). .It H -A 4 byte big endian length. -.It h A 2 byte big endian length. +.It h +A 2 byte little endian length. .It L -A 4 byte little endian length. +A 4 byte big endian length. .It l -A 2 byte little endian length. +A 4 byte little endian length. .It J The length includes itself in its count. .El Modified: stable/11/contrib/file/magic/Header ============================================================================== --- stable/11/contrib/file/magic/Header Thu Nov 21 07:29:25 2019 (r354938) +++ stable/11/contrib/file/magic/Header Thu Nov 21 07:39:33 2019 (r354939) @@ -2,4 +2,4 @@ # Format is described in magic(files), where: # files is 5 on V7 and BSD, 4 on SV, and ?? on SVID. # Don't edit this file, edit /etc/magic or send your magic improvements -# to the maintainers, at file@mx.gw.com +# to the maintainers, at file@astron.com Modified: stable/11/contrib/file/magic/Magdir/acorn ============================================================================== --- stable/11/contrib/file/magic/Magdir/acorn Thu Nov 21 07:29:25 2019 (r354938) +++ stable/11/contrib/file/magic/Magdir/acorn Thu Nov 21 07:39:33 2019 (r354939) @@ -1,6 +1,6 @@ #------------------------------------------------------------------------------ -# $File: acorn,v 1.6 2017/10/19 16:40:37 christos Exp $ +# $File: acorn,v 1.7 2019/04/19 00:42:27 christos Exp $ # acorn: file(1) magic for files found on Acorn systems # @@ -83,7 +83,7 @@ # compression mode y (0 - 4) for GIF LZW with a maximum n bits # (y~n,0~12,1~13,2~14,3~15,4~16) >>>5 ulelong+12 x \b, LZW %u-bits compression -# http://www.filebase.org.uk/filetypes +# https://www.filebase.org.uk/filetypes # !Packdir compressed archive has three hexadecimal digits code 68E !:mime application/x-acorn-68E !:ext pkd/bin Modified: stable/11/contrib/file/magic/Magdir/adventure ============================================================================== --- stable/11/contrib/file/magic/Magdir/adventure Thu Nov 21 07:29:25 2019 (r354938) +++ stable/11/contrib/file/magic/Magdir/adventure Thu Nov 21 07:39:33 2019 (r354939) @@ -1,6 +1,6 @@ #------------------------------------------------------------------------------ -# $File: adventure,v 1.17 2017/07/03 16:03:40 christos Exp $ +# $File: adventure,v 1.18 2019/04/19 00:42:27 christos Exp $ # adventure: file(1) magic for Adventure game files # # from Allen Garvin @@ -21,8 +21,8 @@ # Updated by Adam Buchbinder # #http://www.gnelson.demon.co.uk/zspec/sect11.html -#http://www.jczorkmid.net/~jpenney/ZSpec11-latest.txt -#http://en.wikipedia.org/wiki/Z-machine +#https://www.jczorkmid.net/~jpenney/ZSpec11-latest.txt +#https://en.wikipedia.org/wiki/Z-machine # The first byte is the Z-machine revision; it is always between 1 and 8. We # had false matches (for instance, inbig5.ocp from the Omega TeX extension as # well as an occasional MP3 file), so we sanity-check the version number. @@ -111,7 +111,7 @@ # Danny Milosavljevic # These are ADRIFT (adventure game standard) game files, extension .taf # Checked from source at (http://www.adrift.co/) and various taf files -# found at the Interactive Fiction Archive (http://ifarchive.org/) +# found at the Interactive Fiction Archive (https://ifarchive.org/) 0 belong 0x3C423FC9 >4 belong 0x6A87C2CF Adrift game file version >>8 belong 0x94453661 3.80 Modified: stable/11/contrib/file/magic/Magdir/algol68 ============================================================================== --- stable/11/contrib/file/magic/Magdir/algol68 Thu Nov 21 07:29:25 2019 (r354938) +++ stable/11/contrib/file/magic/Magdir/algol68 Thu Nov 21 07:39:33 2019 (r354939) @@ -1,17 +1,17 @@ #------------------------------------------------------------------------------ -# $File: algol68,v 1.2 2016/10/17 14:17:48 christos Exp $ +# $File: algol68,v 1.3 2018/10/19 01:04:21 christos Exp $ # algol68: file(1) magic for Algol 68 source # 0 search/8192 (input, Algol 68 source text !:mime text/x-Algol68 -0 regex \^PROC Algol 68 source text +0 regex/1024 \^PROC Algol 68 source text !:mime text/x-Algol68 -0 regex MODE[\t\ ] Algol 68 source text +0 regex/1024 \bMODE[\t\ ] Algol 68 source text !:mime text/x-Algol68 -0 regex REF[\t\ ] Algol 68 source text +0 regex/1024 \bREF[\t\ ] Algol 68 source text !:mime text/x-Algol68 -0 regex FLEX[\t\ ]\*\\[ Algol 68 source text +0 regex/1024 \bFLEX[\t\ ]\*\\[ Algol 68 source text !:mime text/x-Algol68 #0 regex [\t\ ]OD Algol 68 source text #!:mime text/x-Algol68 Modified: stable/11/contrib/file/magic/Magdir/amigaos ============================================================================== --- stable/11/contrib/file/magic/Magdir/amigaos Thu Nov 21 07:29:25 2019 (r354938) +++ stable/11/contrib/file/magic/Magdir/amigaos Thu Nov 21 07:39:33 2019 (r354939) @@ -1,6 +1,6 @@ #------------------------------------------------------------------------------ -# $File: amigaos,v 1.16 2017/03/17 21:35:28 christos Exp $ +# $File: amigaos,v 1.17 2018/10/16 18:57:19 christos Exp $ # amigaos: file(1) magic for AmigaOS binary formats: # @@ -66,3 +66,22 @@ # From: Przemek Kramarczyk 0 string .KEY AmigaDOS script 0 string .key AmigaDOS script + +# AMOS Basic file formats +# https://www.exotica.org.uk/wiki/AMOS_file_formats +0 string AMOS\040Basic\040 AMOS Basic source code +>11 byte =0x56 \b, tested +>11 byte =0x76 \b, untested +0 string AMOS\040Pro AMOS Basic source code +>11 byte =0x56 \b, tested +>11 byte =0x76 \b, untested +0 string AmSp AMOS Basic sprite bank +>4 beshort x \b, %d sprites +0 string AmIc AMOS Basic icon bank +>4 beshort x \b, %d icons +0 string AmBk AMOS Basic memory bank +>4 beshort x \b, bank number %d +>8 belong&0xFFFFFFF x \b, length %d +>12 regex .{8} \b, type %s +0 string AmBs AMOS Basic memory banks +>4 beshort x \b, %d banks Modified: stable/11/contrib/file/magic/Magdir/android ============================================================================== --- stable/11/contrib/file/magic/Magdir/android Thu Nov 21 07:29:25 2019 (r354938) +++ stable/11/contrib/file/magic/Magdir/android Thu Nov 21 07:39:33 2019 (r354939) @@ -1,6 +1,6 @@ #------------------------------------------------------------ -# $File: android,v 1.10 2017/03/17 21:35:28 christos Exp $ +# $File: android,v 1.12 2019/04/19 00:42:27 christos Exp $ # Various android related magic entries #------------------------------------------------------------ @@ -32,33 +32,68 @@ # Android Backup archive # From: Ariel Shkedi -# File extension: .ab -# No mime-type defined +# Update: Joerg Jenderek # URL: https://github.com/android/platform_frameworks_base/blob/\ # 0bacfd2ba68d21a68a3df345b830bc2a1e515b5a/services/java/com/\ # android/server/BackupManagerService.java#L2367 +# Reference: https://sourceforge.net/projects/adbextractor/ +# android-backup-extractor/perl/backupencrypt.pl +# Note: only unix line feeds "\n" found # After the header comes a tar file # If compressed, the entire tar file is compressed with JAVA deflate # # Include the version number hardcoded with the magic string to avoid # false positives -0 string/b ANDROID\ BACKUP\n1\n Android Backup +0 string/b ANDROID\ BACKUP\n Android Backup +# maybe look for some more characteristics like linefeed '\n' or version +#>16 string \n +# No mime-type defined offically +!:mime application/x-google-ab +!:ext ab +# on 2nd line version (often 1, 2 on kitkat 4.4.3+, 4 on 7.1.2) +>15 string >\0 \b, version %s +# "1" on 3rd line means compressed >17 string 0\n \b, Not-Compressed >17 string 1\n \b, Compressed +# The 4th line is encryption "none" or "AES-256" # any string as long as it's not the word none (which is matched below) +>19 string none\n \b, Not-Encrypted +# look for backup content after line with encryption info +#>>19 search/7 \n +# data part after header for not encrypted Android Backup +#>>>&0 ubequad x \b, content 0x%16.16llx... +# look for zlib compressed by ./compress after message with 1 space at end +#>>>&0 indirect x \b; contains +# look for tar archive block by ./archive for package name manifest +>>288 string ustar \b; contains +>>>31 use tar-file +# look for zip/jar archive by ./archive ./zip after message with 1 space at end +#>>2079 search/1025/s PK\003\004 \b; contains +#>>>&0 indirect x +>19 string !none >>19 regex/1l \^([^n\n]|n[^o]|no[^n]|non[^e]|none.+).* \b, Encrypted (%s) ->>19 string none\n \b, Not-Encrypted # Commented out because they don't seem useful to print # (but they are part of the header - the tar file comes after them): +# The 5th line is User Password Salt (128 Hex) +# string length too high with standard src configuration +#>>>&1 string >\0 \b, PASSWORD salt: "%-128.128s" #>>>&1 regex/1l .* \b, Password salt: %s +# The 6th line is Master Key Checksum Salt (128 Hex) #>>>>&1 regex/1l .* \b, Master salt: %s +# The 7th line is Number of PBDKF2 Rounds (10000) #>>>>>&1 regex/1l .* \b, PBKDF2 rounds: %s +# The 8th line is User key Initialization Vector (IV) (32 Hex) #>>>>>>&1 regex/1l .* \b, IV: %s +#>>>>>>&1 regex/1l .* \b, IV: %s +# The 9th line is Master IV+Key+Checksum (192 Hex) #>>>>>>>&1 regex/1l .* \b, Key: %s +# look for new line separator char after line number 9 +#>>>0x204 ubyte 0x0a NL found +#>>>>&1 ubequad x \b, Content magic %16.16llx # *.pit files by Joerg Jenderek -# http://forum.xda-developers.com/showthread.php?p=9122369 -# http://forum.xda-developers.com/showthread.php?t=816449 +# https://forum.xda-developers.com/showthread.php?p=9122369 +# https://forum.xda-developers.com/showthread.php?t=816449 # Partition Information Table for Samsung's smartphone with Android *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-all@freebsd.org Thu Nov 21 07:48:04 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 3AD541B3D45; Thu, 21 Nov 2019 07:48:04 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47JWrN0lCBz42wd; Thu, 21 Nov 2019 07:48:04 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id F0E94804B; Thu, 21 Nov 2019 07:48:03 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xAL7m3O3023581; Thu, 21 Nov 2019 07:48:03 GMT (envelope-from avg@FreeBSD.org) Received: (from avg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xAL7m3mv023580; Thu, 21 Nov 2019 07:48:03 GMT (envelope-from avg@FreeBSD.org) Message-Id: <201911210748.xAL7m3mv023580@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avg set sender to avg@FreeBSD.org using -f From: Andriy Gapon Date: Thu, 21 Nov 2019 07:48:03 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r354940 - stable/12/sys/dev/iicbus X-SVN-Group: stable-12 X-SVN-Commit-Author: avg X-SVN-Commit-Paths: stable/12/sys/dev/iicbus X-SVN-Commit-Revision: 354940 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 21 Nov 2019 07:48:04 -0000 Author: avg Date: Thu Nov 21 07:48:03 2019 New Revision: 354940 URL: https://svnweb.freebsd.org/changeset/base/354940 Log: MFC r354212: iicbb: allow longer SCL low timeout and other improvements First, SCL low timeout is set to 25 milliseconds by default as opposed to 1 millisecond before. The new value is based on the SMBus specification. The timeout can be changed on a per bus basis using dev.iicbb.N.scl_low_timeout sysctl. The driver uses DELAY to wait for high SCL up to 1 millisecond, then it switches to pause_sbt(SBT_1MS) for the rest of the timeout. While here I made a number of other changes. 'udelay' that's used for timing clock and data signals is now calculated based on the requested bus frequency (dev.iicbus.N.frequency) instead of being hardcoded to 10 microseconds. The calculations are done in such a fashion that the default bus frequency of 100000 is converted to udelay of 10 us. This is for backward compatibility. The actual frequency will be less than a quarter (I think) of the requested frequency. Also, I added detection of stuck low SCL in a few places. Previously, the code would just carry on after the SCL low timeout and that might potentially lead to misinterpreted bits. Finally, I fixed several style issues near the code that I changed. Many more are still remaining. Modified: stable/12/sys/dev/iicbus/iicbb.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/dev/iicbus/iicbb.c ============================================================================== --- stable/12/sys/dev/iicbus/iicbb.c Thu Nov 21 07:39:33 2019 (r354939) +++ stable/12/sys/dev/iicbus/iicbb.c Thu Nov 21 07:48:03 2019 (r354940) @@ -52,6 +52,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #ifdef FDT @@ -68,9 +69,13 @@ __FBSDID("$FreeBSD$"); #include "iicbus_if.h" #include "iicbb_if.h" +/* Based on the SMBus specification. */ +#define DEFAULT_SCL_LOW_TIMEOUT (25 * 1000) + struct iicbb_softc { device_t iicbus; - int udelay; /* signal toggle delay in usec */ + u_int udelay; /* signal toggle delay in usec */ + u_int scl_low_timeout; }; static int iicbb_attach(device_t); @@ -86,6 +91,7 @@ static int iicbb_write(device_t, const char *, int, in static int iicbb_read(device_t, char *, int, int *, int, int); static int iicbb_reset(device_t, u_char, u_char, u_char *); static int iicbb_transfer(device_t dev, struct iic_msg *msgs, uint32_t nmsgs); +static void iicbb_set_speed(struct iicbb_softc *sc, u_char); #ifdef FDT static phandle_t iicbb_get_node(device_t, device_t); #endif @@ -142,9 +148,19 @@ iicbb_attach(device_t dev) sc->iicbus = device_add_child(dev, "iicbus", -1); if (!sc->iicbus) return (ENXIO); - sc->udelay = 10; /* 10 uS default */ - bus_generic_attach(dev); + sc->scl_low_timeout = DEFAULT_SCL_LOW_TIMEOUT; + + SYSCTL_ADD_UINT(device_get_sysctl_ctx(dev), + SYSCTL_CHILDREN(device_get_sysctl_tree(dev)), OID_AUTO, + "delay", CTLFLAG_RD, &sc->udelay, + 0, "Signal change delay controlled by bus frequency, microseconds"); + + SYSCTL_ADD_UINT(device_get_sysctl_ctx(dev), + SYSCTL_CHILDREN(device_get_sysctl_tree(dev)), OID_AUTO, + "scl_low_timeout", CTLFLAG_RWTUN, &sc->scl_low_timeout, + 0, "SCL low timeout, microseconds"); + bus_generic_attach(dev); return (0); } @@ -201,24 +217,17 @@ iicbb_print_child(device_t bus, device_t dev) return (retval); } -#define I2C_SETSDA(sc,dev,val) do { \ - IICBB_SETSDA(device_get_parent(dev), val); \ +#define I2C_GETSDA(dev) (IICBB_GETSDA(device_get_parent(dev))) +#define I2C_SETSDA(dev, x) (IICBB_SETSDA(device_get_parent(dev), x)) +#define I2C_GETSCL(dev) (IICBB_GETSCL(device_get_parent(dev))) +#define I2C_SETSCL(dev, x) (IICBB_SETSCL(device_get_parent(dev), x)) + +#define I2C_SET(sc, dev, ctrl, val) do { \ + iicbb_setscl(dev, ctrl); \ + I2C_SETSDA(dev, val); \ DELAY(sc->udelay); \ } while (0) -#define I2C_SETSCL(dev,val) do { \ - iicbb_setscl(dev, val, 100); \ - } while (0) - -#define I2C_SET(sc,dev,ctrl,data) do { \ - I2C_SETSCL(dev, ctrl); \ - I2C_SETSDA(sc, dev, data); \ - } while (0) - -#define I2C_GETSDA(dev) (IICBB_GETSDA(device_get_parent(dev))) - -#define I2C_GETSCL(dev) (IICBB_GETSCL(device_get_parent(dev))) - static int i2c_debug = 0; #define I2C_DEBUG(x) do { \ if (i2c_debug) (x); \ @@ -229,20 +238,37 @@ static int i2c_debug = 0; } while (0) static void -iicbb_setscl(device_t dev, int val, int timeout) +iicbb_setscl(device_t dev, int val) { struct iicbb_softc *sc = device_get_softc(dev); - int k = 0; + sbintime_t now, end; + int fast_timeout; - IICBB_SETSCL(device_get_parent(dev), val); + I2C_SETSCL(dev, val); DELAY(sc->udelay); - while (val && !I2C_GETSCL(dev) && k++ < timeout) { - IICBB_SETSCL(device_get_parent(dev), val); + /* Pulling low cannot fail. */ + if (!val) + return; + + /* Use DELAY for up to 1 ms, then switch to pause. */ + end = sbinuptime() + sc->scl_low_timeout * SBT_1US; + fast_timeout = MIN(sc->scl_low_timeout, 1000); + while (fast_timeout > 0) { + if (I2C_GETSCL(dev)) + return; + I2C_SETSCL(dev, 1); /* redundant ? */ DELAY(sc->udelay); + fast_timeout -= sc->udelay; } - return; + while (!I2C_GETSCL(dev)) { + now = sbinuptime(); + if (now >= end) + break; + pause_sbt("iicbb-scl-low", SBT_1MS, C_PREL(8), 0); + } + } static void @@ -290,6 +316,11 @@ iicbb_ack(device_t dev, int timeout) I2C_SET(sc,dev,0,1); I2C_SET(sc,dev,1,1); + + /* SCL must be high now. */ + if (!I2C_GETSCL(dev)) + return (IIC_ETIMEOUT); + do { noack = I2C_GETSDA(dev); if (!noack) @@ -301,14 +332,14 @@ iicbb_ack(device_t dev, int timeout) I2C_SET(sc,dev,0,1); I2C_DEBUG(printf("%c ",noack?'-':'+')); - return (noack); + return (noack ? IIC_ENOACK : 0); } static void iicbb_sendbyte(device_t dev, u_char data, int timeout) { int i; - + for (i=7; i>=0; i--) { if (data&(1<")); I2C_DEBUG(printf("\n")); + + /* SCL must be high now. */ + if (!I2C_GETSCL(dev)) + return (IIC_ETIMEOUT); return (0); } @@ -408,15 +445,13 @@ iicbb_write(device_t dev, const char *buf, int len, in iicbb_sendbyte(dev,(u_char)*buf++, timeout); /* check for ack */ - if (iicbb_ack(dev, timeout)) { - error = IIC_ENOACK; - goto error; - } - bytes ++; - len --; + error = iicbb_ack(dev, timeout); + if (error != 0) + break; + bytes++; + len--; } -error: *sent = bytes; return (error); } @@ -452,6 +487,24 @@ iicbb_transfer(device_t dev, struct iic_msg *msgs, uin IICBB_POST_XFER(device_get_parent(dev)); return (error); +} + +static void +iicbb_set_speed(struct iicbb_softc *sc, u_char speed) +{ + u_int busfreq, period; + + /* + * NB: the resulting frequency will be a quarter (even less) of the + * configured bus frequency. This is for historic reasons. The default + * bus frequency is 100 kHz. And the historic default udelay is 10 + * microseconds. The cycle of sending a bit takes four udelay-s plus + * SCL is kept low for extra two udelay-s. The actual I/O toggling also + * has an overhead. + */ + busfreq = IICBUS_GET_FREQUENCY(sc->iicbus, speed); + period = 1000000 / busfreq; /* Hz -> uS */ + sc->udelay = MAX(period, 1); } DRIVER_MODULE(iicbus, iicbb, iicbus_driver, iicbus_devclass, 0, 0); From owner-svn-src-all@freebsd.org Thu Nov 21 08:20:07 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 71A491B533A; Thu, 21 Nov 2019 08:20:07 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47JXYM39SSz44QM; Thu, 21 Nov 2019 08:20:07 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 32A9185B7; Thu, 21 Nov 2019 08:20:07 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xAL8K7Kc041670; Thu, 21 Nov 2019 08:20:07 GMT (envelope-from avg@FreeBSD.org) Received: (from avg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xAL8K6DF041664; Thu, 21 Nov 2019 08:20:06 GMT (envelope-from avg@FreeBSD.org) Message-Id: <201911210820.xAL8K6DF041664@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avg set sender to avg@FreeBSD.org using -f From: Andriy Gapon Date: Thu, 21 Nov 2019 08:20:06 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354941 - in head: cddl/contrib/opensolaris/cmd/zdb cddl/contrib/opensolaris/cmd/zfs cddl/contrib/opensolaris/cmd/zpool cddl/contrib/opensolaris/cmd/ztest cddl/contrib/opensolaris/lib/l... X-SVN-Group: head X-SVN-Commit-Author: avg X-SVN-Commit-Paths: in head: cddl/contrib/opensolaris/cmd/zdb cddl/contrib/opensolaris/cmd/zfs cddl/contrib/opensolaris/cmd/zpool cddl/contrib/opensolaris/cmd/ztest cddl/contrib/opensolaris/lib/libzfs/common cddl/contrib... X-SVN-Commit-Revision: 354941 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 21 Nov 2019 08:20:07 -0000 Author: avg Date: Thu Nov 21 08:20:05 2019 New Revision: 354941 URL: https://svnweb.freebsd.org/changeset/base/354941 Log: MFV r354382,r354385: 10601 10757 Pool allocation classes illumos/illumos-gate@663207adb1669640c01c5ec6949ce78fd806efae https://github.com/illumos/illumos-gate/commit/663207adb1669640c01c5ec6949ce78fd806efae 10601 Pool allocation classes https://www.illumos.org/issues/10601 illumos port of ZoL Pool allocation classes. Includes at least these two commits: 441709695 Pool allocation classes misplacing small file blocks cc99f275a Pool allocation classes 10757 Add -gLp to zpool subcommands for alt vdev names https://www.illumos.org/issues/10757 Port from ZoL of d2f3e292d Add -gLp to zpool subcommands for alt vdev names Note that a subsequent ZoL commit changed -p to -P a77f29f93 Change full path subcommand flag from -p to -P Portions contributed by: Jerry Jelinek Portions contributed by: HĂ¥kan Johansson Portions contributed by: Richard Yao Portions contributed by: Chunwei Chen Portions contributed by: loli10K Author: Don Brady 11541 allocation_classes feature must be enabled to add log device illumos/illumos-gate@c1064fd7ce62fe763a4475e9988ffea3b22137de https://github.com/illumos/illumos-gate/commit/c1064fd7ce62fe763a4475e9988ffea3b22137de https://www.illumos.org/issues/11541 After the allocation_classes feature was integrated, one can no longer add a log device to a pool unless that feature is enabled. There is an explicit check for this, but it is unnecessary in the case of log devices, so we should handle this better instead of forcing the feature to be enabled. Author: Jerry Jelinek FreeBSD notes. I faithfully added the new -g, -L, -P flags, but only -g does something: vdev GUIDs are displayed instead of device names. -L, resolve symlinks, and -P, display full disk paths, do nothing at the moment. The use of special vdevs is backward compatible for read-only access, so root pools should be bootable, but exercise caution. MFC after: 4 weeks Modified: head/cddl/contrib/opensolaris/cmd/zdb/zdb.c head/cddl/contrib/opensolaris/cmd/zfs/zfs.8 head/cddl/contrib/opensolaris/cmd/zpool/zpool-features.7 head/cddl/contrib/opensolaris/cmd/zpool/zpool.8 head/cddl/contrib/opensolaris/cmd/zpool/zpool_main.c head/cddl/contrib/opensolaris/cmd/zpool/zpool_vdev.c head/cddl/contrib/opensolaris/cmd/ztest/ztest.c head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs.h head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_dataset.c head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_pool.c head/cddl/contrib/opensolaris/lib/libzpool/common/util.c head/stand/libsa/zfs/zfsimpl.c head/sys/cddl/contrib/opensolaris/common/zfs/zfeature_common.c head/sys/cddl/contrib/opensolaris/common/zfs/zfeature_common.h head/sys/cddl/contrib/opensolaris/common/zfs/zfs_prop.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_objset.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/metaslab.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa_misc.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dmu.h head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dmu_objset.h head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/metaslab.h head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/spa.h head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/spa_impl.h head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/vdev.h head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/vdev_impl.h head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zio.h head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_label.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_removal.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zio.c head/sys/cddl/contrib/opensolaris/uts/common/sys/fs/zfs.h Directory Properties: head/cddl/contrib/opensolaris/ (props changed) head/cddl/contrib/opensolaris/cmd/zdb/ (props changed) head/cddl/contrib/opensolaris/lib/libzfs/ (props changed) head/sys/cddl/contrib/opensolaris/ (props changed) Modified: head/cddl/contrib/opensolaris/cmd/zdb/zdb.c ============================================================================== --- head/cddl/contrib/opensolaris/cmd/zdb/zdb.c Thu Nov 21 07:48:03 2019 (r354940) +++ head/cddl/contrib/opensolaris/cmd/zdb/zdb.c Thu Nov 21 08:20:05 2019 (r354941) @@ -21,7 +21,7 @@ /* * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. - * Copyright (c) 2011, 2017 by Delphix. All rights reserved. + * Copyright (c) 2011, 2018 by Delphix. All rights reserved. * Copyright (c) 2014 Integros [integros.com] * Copyright 2017 Nexenta Systems, Inc. * Copyright (c) 2017, 2018 Lawrence Livermore National Security, LLC. @@ -931,13 +931,23 @@ dump_metaslab(metaslab_t *msp) static void print_vdev_metaslab_header(vdev_t *vd) { - (void) printf("\tvdev %10llu\n\t%-10s%5llu %-19s %-15s %-10s\n", - (u_longlong_t)vd->vdev_id, + vdev_alloc_bias_t alloc_bias = vd->vdev_alloc_bias; + const char *bias_str; + + bias_str = (alloc_bias == VDEV_BIAS_LOG || vd->vdev_islog) ? + VDEV_ALLOC_BIAS_LOG : + (alloc_bias == VDEV_BIAS_SPECIAL) ? VDEV_ALLOC_BIAS_SPECIAL : + (alloc_bias == VDEV_BIAS_DEDUP) ? VDEV_ALLOC_BIAS_DEDUP : + vd->vdev_islog ? "log" : ""; + + (void) printf("\tvdev %10llu %s\n" + "\t%-10s%5llu %-19s %-15s %-12s\n", + (u_longlong_t)vd->vdev_id, bias_str, "metaslabs", (u_longlong_t)vd->vdev_ms_count, "offset", "spacemap", "free"); - (void) printf("\t%15s %19s %15s %10s\n", + (void) printf("\t%15s %19s %15s %12s\n", "---------------", "-------------------", - "---------------", "-------------"); + "---------------", "------------"); } static void @@ -953,7 +963,7 @@ dump_metaslab_groups(spa_t *spa) vdev_t *tvd = rvd->vdev_child[c]; metaslab_group_t *mg = tvd->vdev_mg; - if (mg->mg_class != mc) + if (mg == NULL || mg->mg_class != mc) continue; metaslab_group_histogram_verify(mg); @@ -2807,6 +2817,7 @@ typedef struct zdb_blkstats { uint64_t zb_count; uint64_t zb_gangs; uint64_t zb_ditto_samevdev; + uint64_t zb_ditto_same_ms; uint64_t zb_psize_histogram[PSIZE_HISTO_SIZE]; } zdb_blkstats_t; @@ -2846,6 +2857,16 @@ typedef struct zdb_cb { uint32_t **zcb_vd_obsolete_counts; } zdb_cb_t; +/* test if two DVA offsets from same vdev are within the same metaslab */ +static boolean_t +same_metaslab(spa_t *spa, uint64_t vdev, uint64_t off1, uint64_t off2) +{ + vdev_t *vd = vdev_lookup_top(spa, vdev); + uint64_t ms_shift = vd->vdev_ms_shift; + + return ((off1 >> ms_shift) == (off2 >> ms_shift)); +} + static void zdb_count_block(zdb_cb_t *zcb, zilog_t *zilog, const blkptr_t *bp, dmu_object_type_t type) @@ -2857,6 +2878,8 @@ zdb_count_block(zdb_cb_t *zcb, zilog_t *zilog, const b if (zilog && zil_bp_tree_add(zilog, bp) != 0) return; + spa_config_enter(zcb->zcb_spa, SCL_CONFIG, FTAG, RW_READER); + for (int i = 0; i < 4; i++) { int l = (i < 2) ? BP_GET_LEVEL(bp) : ZB_TOTAL; int t = (i & 1) ? type : ZDB_OT_TOTAL; @@ -2882,8 +2905,15 @@ zdb_count_block(zdb_cb_t *zcb, zilog_t *zilog, const b switch (BP_GET_NDVAS(bp)) { case 2: if (DVA_GET_VDEV(&bp->blk_dva[0]) == - DVA_GET_VDEV(&bp->blk_dva[1])) + DVA_GET_VDEV(&bp->blk_dva[1])) { zb->zb_ditto_samevdev++; + + if (same_metaslab(zcb->zcb_spa, + DVA_GET_VDEV(&bp->blk_dva[0]), + DVA_GET_OFFSET(&bp->blk_dva[0]), + DVA_GET_OFFSET(&bp->blk_dva[1]))) + zb->zb_ditto_same_ms++; + } break; case 3: equal = (DVA_GET_VDEV(&bp->blk_dva[0]) == @@ -2892,13 +2922,37 @@ zdb_count_block(zdb_cb_t *zcb, zilog_t *zilog, const b DVA_GET_VDEV(&bp->blk_dva[2])) + (DVA_GET_VDEV(&bp->blk_dva[1]) == DVA_GET_VDEV(&bp->blk_dva[2])); - if (equal != 0) + if (equal != 0) { zb->zb_ditto_samevdev++; + + if (DVA_GET_VDEV(&bp->blk_dva[0]) == + DVA_GET_VDEV(&bp->blk_dva[1]) && + same_metaslab(zcb->zcb_spa, + DVA_GET_VDEV(&bp->blk_dva[0]), + DVA_GET_OFFSET(&bp->blk_dva[0]), + DVA_GET_OFFSET(&bp->blk_dva[1]))) + zb->zb_ditto_same_ms++; + else if (DVA_GET_VDEV(&bp->blk_dva[0]) == + DVA_GET_VDEV(&bp->blk_dva[2]) && + same_metaslab(zcb->zcb_spa, + DVA_GET_VDEV(&bp->blk_dva[0]), + DVA_GET_OFFSET(&bp->blk_dva[0]), + DVA_GET_OFFSET(&bp->blk_dva[2]))) + zb->zb_ditto_same_ms++; + else if (DVA_GET_VDEV(&bp->blk_dva[1]) == + DVA_GET_VDEV(&bp->blk_dva[2]) && + same_metaslab(zcb->zcb_spa, + DVA_GET_VDEV(&bp->blk_dva[1]), + DVA_GET_OFFSET(&bp->blk_dva[1]), + DVA_GET_OFFSET(&bp->blk_dva[2]))) + zb->zb_ditto_same_ms++; + } break; } - } + spa_config_exit(zcb->zcb_spa, SCL_CONFIG, FTAG); + if (BP_IS_EMBEDDED(bp)) { zcb->zcb_embedded_blocks[BPE_GET_ETYPE(bp)]++; zcb->zcb_embedded_histogram[BPE_GET_ETYPE(bp)] @@ -3709,6 +3763,7 @@ dump_block_stats(spa_t *spa) uint64_t norm_alloc, norm_space, total_alloc, total_found; int flags = TRAVERSE_PRE | TRAVERSE_PREFETCH_METADATA | TRAVERSE_HARD; boolean_t leaks = B_FALSE; + int err; bzero(&zcb, sizeof (zcb)); (void) printf("\nTraversing all blocks %s%s%s%s%s...\n\n", @@ -3751,8 +3806,10 @@ dump_block_stats(spa_t *spa) flags |= TRAVERSE_PREFETCH_DATA; zcb.zcb_totalasize = metaslab_class_get_alloc(spa_normal_class(spa)); + zcb.zcb_totalasize += metaslab_class_get_alloc(spa_special_class(spa)); + zcb.zcb_totalasize += metaslab_class_get_alloc(spa_dedup_class(spa)); zcb.zcb_start = zcb.zcb_lastprint = gethrtime(); - zcb.zcb_haderrors |= traverse_pool(spa, 0, flags, zdb_blkptr_cb, &zcb); + err = traverse_pool(spa, 0, flags, zdb_blkptr_cb, &zcb); /* * If we've traversed the data blocks then we need to wait for those @@ -3768,6 +3825,12 @@ dump_block_stats(spa_t *spa) } } + /* + * Done after zio_wait() since zcb_haderrors is modified in + * zdb_blkptr_done() + */ + zcb.zcb_haderrors |= err; + if (zcb.zcb_haderrors) { (void) printf("\nError counts:\n\n"); (void) printf("\t%5s %s\n", "errno", "count"); @@ -3789,7 +3852,10 @@ dump_block_stats(spa_t *spa) norm_alloc = metaslab_class_get_alloc(spa_normal_class(spa)); norm_space = metaslab_class_get_space(spa_normal_class(spa)); - total_alloc = norm_alloc + metaslab_class_get_alloc(spa_log_class(spa)); + total_alloc = norm_alloc + + metaslab_class_get_alloc(spa_log_class(spa)) + + metaslab_class_get_alloc(spa_special_class(spa)) + + metaslab_class_get_alloc(spa_dedup_class(spa)); total_found = tzb->zb_asize - zcb.zcb_dedup_asize + zcb.zcb_removing_size + zcb.zcb_checkpoint_size; @@ -3811,31 +3877,50 @@ dump_block_stats(spa_t *spa) return (2); (void) printf("\n"); - (void) printf("\tbp count: %10llu\n", + (void) printf("\t%-16s %14llu\n", "bp count:", (u_longlong_t)tzb->zb_count); - (void) printf("\tganged count: %10llu\n", + (void) printf("\t%-16s %14llu\n", "ganged count:", (longlong_t)tzb->zb_gangs); - (void) printf("\tbp logical: %10llu avg: %6llu\n", + (void) printf("\t%-16s %14llu avg: %6llu\n", "bp logical:", (u_longlong_t)tzb->zb_lsize, (u_longlong_t)(tzb->zb_lsize / tzb->zb_count)); - (void) printf("\tbp physical: %10llu avg:" - " %6llu compression: %6.2f\n", - (u_longlong_t)tzb->zb_psize, + (void) printf("\t%-16s %14llu avg: %6llu compression: %6.2f\n", + "bp physical:", (u_longlong_t)tzb->zb_psize, (u_longlong_t)(tzb->zb_psize / tzb->zb_count), (double)tzb->zb_lsize / tzb->zb_psize); - (void) printf("\tbp allocated: %10llu avg:" - " %6llu compression: %6.2f\n", - (u_longlong_t)tzb->zb_asize, + (void) printf("\t%-16s %14llu avg: %6llu compression: %6.2f\n", + "bp allocated:", (u_longlong_t)tzb->zb_asize, (u_longlong_t)(tzb->zb_asize / tzb->zb_count), (double)tzb->zb_lsize / tzb->zb_asize); - (void) printf("\tbp deduped: %10llu ref>1:" - " %6llu deduplication: %6.2f\n", - (u_longlong_t)zcb.zcb_dedup_asize, + (void) printf("\t%-16s %14llu ref>1: %6llu deduplication: %6.2f\n", + "bp deduped:", (u_longlong_t)zcb.zcb_dedup_asize, (u_longlong_t)zcb.zcb_dedup_blocks, (double)zcb.zcb_dedup_asize / tzb->zb_asize + 1.0); - (void) printf("\tSPA allocated: %10llu used: %5.2f%%\n", + (void) printf("\t%-16s %14llu used: %5.2f%%\n", "Normal class:", (u_longlong_t)norm_alloc, 100.0 * norm_alloc / norm_space); + if (spa_special_class(spa)->mc_rotor != NULL) { + uint64_t alloc = metaslab_class_get_alloc( + spa_special_class(spa)); + uint64_t space = metaslab_class_get_space( + spa_special_class(spa)); + + (void) printf("\t%-16s %14llu used: %5.2f%%\n", + "Special class", (u_longlong_t)alloc, + 100.0 * alloc / space); + } + + if (spa_dedup_class(spa)->mc_rotor != NULL) { + uint64_t alloc = metaslab_class_get_alloc( + spa_dedup_class(spa)); + uint64_t space = metaslab_class_get_space( + spa_dedup_class(spa)); + + (void) printf("\t%-16s %14llu used: %5.2f%%\n", + "Dedup class", (u_longlong_t)alloc, + 100.0 * alloc / space); + } + for (bp_embedded_type_t i = 0; i < NUM_BP_EMBEDDED_TYPES; i++) { if (zcb.zcb_embedded_blocks[i] == 0) continue; @@ -3856,6 +3941,10 @@ dump_block_stats(spa_t *spa) if (tzb->zb_ditto_samevdev != 0) { (void) printf("\tDittoed blocks on same vdev: %llu\n", (longlong_t)tzb->zb_ditto_samevdev); + } + if (tzb->zb_ditto_same_ms != 0) { + (void) printf("\tDittoed blocks in same metaslab: %llu\n", + (longlong_t)tzb->zb_ditto_same_ms); } for (uint64_t v = 0; v < spa->spa_root_vdev->vdev_children; v++) { Modified: head/cddl/contrib/opensolaris/cmd/zfs/zfs.8 ============================================================================== --- head/cddl/contrib/opensolaris/cmd/zfs/zfs.8 Thu Nov 21 07:48:03 2019 (r354940) +++ head/cddl/contrib/opensolaris/cmd/zfs/zfs.8 Thu Nov 21 08:20:05 2019 (r354941) @@ -1134,8 +1134,23 @@ This feature must be enabled to be used .Po see .Xr zpool-features 7 .Pc . +.It Sy special_small_blocks Ns = Ns Ar size +This value represents the threshold block size for including small file +blocks into the special allocation class. +Blocks smaller than or equal to this value will be assigned to the special +allocation class while greater blocks will be assigned to the regular class. +Valid values are zero or a power of two from 512B up to 128K. +The default size is 0 which means no small file blocks will be allocated in +the special class. +.Pp +Before setting this property, a special class vdev must be added to the +pool. +See +.Xr zpool 8 +for more details on the special allocation class. .It Sy mountpoint Ns = Ns Ar path | Cm none | legacy -Controls the mount point used for this file system. See the +Controls the mount point used for this file system. +See the .Qq Sx Mount Points section for more information on how this property is used. .Pp @@ -3023,7 +3038,7 @@ property of the filesystem or volume which is received To use this flag, the storage pool must have the .Sy extensible_dataset feature enabled. See -.Xr zpool-features 5 +.Xr zpool-features 7 for details on ZFS feature flags. .El .It Xo Modified: head/cddl/contrib/opensolaris/cmd/zpool/zpool-features.7 ============================================================================== --- head/cddl/contrib/opensolaris/cmd/zpool/zpool-features.7 Thu Nov 21 07:48:03 2019 (r354940) +++ head/cddl/contrib/opensolaris/cmd/zpool/zpool-features.7 Thu Nov 21 08:20:05 2019 (r354941) @@ -632,6 +632,25 @@ and will return to being once all filesystems that have ever had their checksum set to .Sy skein are destroyed. +.It Sy allocation_classes +.Bl -column "READ\-ONLY COMPATIBLE" "com.intel:allocation_classes" +.It GUID Ta com.intel:allocation_classes +.It READ\-ONLY COMPATIBLE Ta yes +.It DEPENDENCIES Ta none +.El +.Pp +This feature enables support for separate allocation classes. +.Pp +This feature becomes +.Sy active +when a dedicated allocation class vdev +(dedup or special) is created with +.Dq zpool create +or +.Dq zpool add . +With device removal, it can be returned to the +.Sy enabled +state if all the top-level vdevs from an allocation class are removed. .El .Sh SEE ALSO .Xr zpool 8 Modified: head/cddl/contrib/opensolaris/cmd/zpool/zpool.8 ============================================================================== --- head/cddl/contrib/opensolaris/cmd/zpool/zpool.8 Thu Nov 21 07:48:03 2019 (r354940) +++ head/cddl/contrib/opensolaris/cmd/zpool/zpool.8 Thu Nov 21 08:20:05 2019 (r354941) @@ -24,6 +24,8 @@ .\" Copyright (c) 2012, 2017 by Delphix. All Rights Reserved. .\" Copyright 2017 Nexenta Systems, Inc. .\" Copyright (c) 2017 Datto Inc. +.\" Copyright (c) 2017 George Melikov. All Rights Reserved. +.\" Copyright 2019 Joyent, Inc. .\" .\" $FreeBSD$ .\" @@ -38,7 +40,7 @@ .Op Fl \&? .Nm .Cm add -.Op Fl fn +.Op Fl fgLnP .Ar pool vdev ... .Nm .Cm attach @@ -127,17 +129,19 @@ .Op Ar device Ns ... .Nm .Cm iostat -.Op Fl T Cm d Ns | Ns Cm u .Op Fl v +.Op Fl T Cm d Ns | Ns Cm u +.Op Fl gLP .Op Ar pool .Ar ... +.Op Ar inverval Op Ar count .Nm .Cm labelclear .Op Fl f .Ar device .Nm .Cm list -.Op Fl Hpv +.Op Fl HgLpPv .Op Fl o Ar property Ns Op , Ns Ar ... .Op Fl T Cm d Ns | Ns Cm u .Op Ar pool @@ -179,7 +183,7 @@ .Ar property Ns = Ns Ar value pool .Nm .Cm split -.Op Fl n +.Op Fl gLnP .Op Fl R Ar altroot .Op Fl o Ar mntopts .Op Fl o Ar property Ns = Ns Ar value @@ -187,7 +191,7 @@ .Op Ar device ... .Nm .Cm status -.Op Fl Dvx +.Op Fl DgLPvx .Op Fl T Cm d Ns | Ns Cm u .Op Ar pool .Ar ... @@ -320,11 +324,27 @@ types are not supported for the intent log. For more i see the .Qq Sx Intent Log section. +.It Sy dedup +A device dedicated solely for allocating dedup data. +The redundancy of this device should match the redundancy of the other normal +devices in the pool. +If more than one dedup device is specified, then allocations are load-balanced +between devices. +.It Sy special +A device dedicated solely for allocating various kinds of internal metadata, +and optionally small file data. +The redundancy of this device should match the redundancy of the other normal +devices in the pool. +If more than one special device is specified, then allocations are +load-balanced between devices. +.Pp +For more information on special allocations, see the +.Sx Special Allocation Class +section. .It Sy cache -A device used to cache storage pool data. A cache device cannot be configured -as a mirror or -.No raidz -group. For more information, see the +A device used to cache storage pool data. +A cache device cannot be configured as a mirror or raidz group. +For more information, see the .Qq Sx Cache Devices section. .El @@ -602,6 +622,31 @@ zfs properties) may be unenforceable while a checkpoin checkpoint is allowed to consume the dataset's reservation. Finally, data that is part of the checkpoint but has been freed in the current state of the pool won't be scanned during a scrub. +.Ss Special Allocation Class +The allocations in the special class are dedicated to specific block types. +By default this includes all metadata, the indirect blocks of user data, and +any dedup data. +The class can also be provisioned to accept a limited percentage of small file +data blocks. +.Pp +A pool must always have at least one general (non-specified) vdev before +other devices can be assigned to the special class. +If the special class becomes full, then allocations intended for it will spill +back into the normal class. +.Pp +Dedup data can be excluded from the special class by setting the +.Sy vfs.zfs.ddt_data_is_special +sysctl to false (0). +.Pp +Inclusion of small file blocks in the special class is opt-in. +Each dataset can control the size of small file blocks allowed in the special +class by setting the +.Sy special_small_blocks +dataset property. +It defaults to zero so you must opt-in by setting it to a non-zero value. +See +.Xr zfs 1M +for more info on setting this property. .Ss Properties Each pool has several properties associated with it. Some properties are read-only statistics while others are configurable and change the behavior of @@ -872,7 +917,7 @@ Displays a help message. .It Xo .Nm .Cm add -.Op Fl fn +.Op Fl fgLnP .Ar pool vdev ... .Xc .Pp @@ -891,11 +936,30 @@ Forces use of .Ar vdev , even if they appear in use or specify a conflicting replication level. Not all devices can be overridden in this manner. +.It Fl g +Display +.Ar vdev , +GUIDs instead of the normal device names. +These GUIDs can be used in place of +device names for the zpool detach/offline/remove/replace commands. +.It Fl L +Display real paths for +.Ar vdev Ns s +resolving all symbolic links. +This can be used to look up the current block +device name regardless of the /dev/disk/ path used to open it. .It Fl n Displays the configuration that would be used without actually adding the .Ar vdev Ns s. -The actual pool creation can still fail due to insufficient privileges or device -sharing. +The actual pool creation can still fail due to insufficient privileges or +device sharing. +.It Fl P +Display real paths for +.Ar vdev Ns s +instead of only the last component of the path. +This can be used in conjunction with the +.Fl L +flag. .El .It Xo .Nm @@ -1512,7 +1576,7 @@ with no flags on the relevant target devices. .Nm .Cm iostat .Op Fl T Cm d Ns | Ns Cm u -.Op Fl v +.Op Fl gLPv .Op Ar pool .Ar ... .Op Ar interval Op Ar count @@ -1544,10 +1608,25 @@ Use modifier .Cm u for unixtime .Pq equals Qq Ic date +%s . +.It Fl g +Display vdev GUIDs instead of the normal device names. +These GUIDs can be used in place of device names for the zpool +detach/offline/remove/replace commands. +.It Fl L +Display real paths for vdevs resolving all symbolic links. +This can be used to look up the current block device name regardless of the +.Pa /dev/disk/ +path used to open it. +.It Fl P +Display full paths for vdevs instead of only the last component of +the path. +This can be used in conjunction with the +.Fl L +flag. .It Fl v -Verbose statistics. Reports usage statistics for individual -.No vdev Ns s -within the pool, in addition to the pool-wide statistics. +Verbose statistics. +Reports usage statistics for individual vdevs within the +pool, in addition to the pool-wide statistics. .El .It Xo .Nm @@ -1570,7 +1649,7 @@ Treat exported or foreign devices as inactive. .It Xo .Nm .Cm list -.Op Fl Hpv +.Op Fl HgLpPv .Op Fl o Ar property Ns Op , Ns Ar ... .Op Fl T Cm d Ns | Ns Cm u .Op Ar pool @@ -1603,11 +1682,27 @@ Use modifier .Cm u for unixtime .Pq equals Qq Ic date +%s . +.It Fl g +Display vdev GUIDs instead of the normal device names. +These GUIDs can be used in place of device names for the zpool +detach/offline/remove/replace commands. .It Fl H Scripted mode. Do not display headers, and separate fields by a single tab instead of arbitrary space. +.It Fl L +Display real paths for vdevs resolving all symbolic links. +This can be used to look up the current block device name regardless of the +/dev/disk/ path used to open it. .It Fl p -Display numbers in parsable (exact) values. +Display numbers in parsable +.Pq exact +values. +.It Fl P +Display full paths for vdevs instead of only the last component of +the path. +This can be used in conjunction with the +.Fl L +flag. .It Fl v Verbose statistics. Reports usage statistics for individual .Em vdevs @@ -1702,7 +1797,7 @@ the background. The removal progress can be monitored with .Nm zpool Cm status. This feature must be enabled to be used, see -.Xr zpool-features 5 +.Xr zpool-features 7 .Pp A mirrored top-level device (log or data) can be removed by specifying the top-level mirror for the same. @@ -1844,7 +1939,7 @@ values. .It Xo .Nm .Cm split -.Op Fl n +.Op Fl gLnP .Op Fl R Ar altroot .Op Fl o Ar mntopts .Op Fl o Ar property Ns = Ns Ar value @@ -1884,6 +1979,15 @@ parameter for the new pool's alternate root. See the description in the .Qq Sx Properties section, above. +.It Fl g +Display vdev GUIDs instead of the normal device names. +These GUIDs can be used in place of device names for the zpool +detach/offline/remove/replace commands. +.It Fl L +Display real paths for vdevs resolving all symbolic links. +This can be used to look up the current block device name regardless of the +.Pa /dev/disk/ +path used to open it. .It Fl n Displays the configuration that would be created without actually splitting the pool. The actual pool split could still fail due to insufficient privileges or @@ -1900,11 +2004,17 @@ option. Sets the specified property on the new pool. See the .Qq Sx Properties section, above, for more information on the available pool properties. +.It Fl P +Display full paths for vdevs instead of only the last component of +the path. +This can be used in conjunction with the +.Fl L +flag. .El .It Xo .Nm .Cm status -.Op Fl Dvx +.Op Fl DgLPvx .Op Fl T Cm d Ns | Ns Cm u .Op Ar pool .Ar ... @@ -1939,6 +2049,21 @@ Display a histogram of deduplication statistics, showi and referenced .Pq logically referenced in the pool block counts and sizes by reference count. +.It Fl g +Display vdev GUIDs instead of the normal device names. +These GUIDs can be used in place of device names for the zpool +detach/offline/remove/replace commands. +.It Fl L +Display real paths for vdevs resolving all symbolic links. +This can be used to look up the current block device name regardless of the +.Pa /dev/disk/ +path used to open it. +.It Fl P +Display full paths for vdevs instead of only the last component of +the path. +This can be used in conjunction with the +.Fl L +flag. .It Fl T Cm d Ns | Ns Cm u Print a timestamp. .Pp @@ -2029,6 +2154,30 @@ Successful completion. An error occurred. .It 2 Invalid command line options were specified. +.El +.Sh ENVIRONMENT VARIABLES +.Bl -tag -width "ZPOOL_VDEV_NAME_FOLLOW_LINKS" +.It Ev ZPOOL_VDEV_NAME_GUID +Cause +.Nm zpool +subcommands to output vdev guids by default. +This behavior is identical to the +.Nm zpool status -g +command line option. +.It Ev ZPOOL_VDEV_NAME_FOLLOW_LINKS +Cause +.Nm zpool +subcommands to follow links for vdev names by default. +This behavior is identical to the +.Nm zpool status -L +command line option. +.It Ev ZPOOL_VDEV_NAME_PATH +Cause +.Nm zpool +subcommands to output full vdev path names by default. +This behavior is identical to the +.Nm zpool status -P +command line option. .El .Sh EXAMPLES .Bl -tag -width 0n Modified: head/cddl/contrib/opensolaris/cmd/zpool/zpool_main.c ============================================================================== --- head/cddl/contrib/opensolaris/cmd/zpool/zpool_main.c Thu Nov 21 07:48:03 2019 (r354940) +++ head/cddl/contrib/opensolaris/cmd/zpool/zpool_main.c Thu Nov 21 08:20:05 2019 (r354941) @@ -28,6 +28,7 @@ * Copyright 2016 Igor Kozhukhov . * Copyright 2016 Nexenta Systems, Inc. * Copyright (c) 2017 Datto Inc. + * Copyright (c) 2017, Intel Corporation. */ #include @@ -209,6 +210,8 @@ static zpool_command_t command_table[] = { #define NCOMMAND (sizeof (command_table) / sizeof (command_table[0])) +#define VDEV_ALLOC_CLASS_LOGS "logs" + static zpool_command_t *current_command; static char history_str[HIS_MAX_RECORD_LEN]; static boolean_t log_history = B_TRUE; @@ -219,7 +222,7 @@ get_usage(zpool_help_t idx) { switch (idx) { case HELP_ADD: - return (gettext("\tadd [-fn] ...\n")); + return (gettext("\tadd [-fgLnP] ...\n")); case HELP_ATTACH: return (gettext("\tattach [-f] " "\n")); @@ -251,12 +254,12 @@ get_usage(zpool_help_t idx) "[-R root] [-F [-n]] [-t]\n" "\t [--rewind-to-checkpoint] [newpool]\n")); case HELP_IOSTAT: - return (gettext("\tiostat [-v] [-T d|u] [pool] ... [interval " - "[count]]\n")); + return (gettext("\tiostat [-gLPv] [-T d|u] [pool] ... " + "[interval [count]]\n")); case HELP_LABELCLEAR: return (gettext("\tlabelclear [-f] \n")); case HELP_LIST: - return (gettext("\tlist [-Hpv] [-o property[,...]] " + return (gettext("\tlist [-gHLpPv] [-o property[,...]] " "[-T d|u] [pool] ... [interval [count]]\n")); case HELP_OFFLINE: return (gettext("\toffline [-t] ...\n")); @@ -274,8 +277,8 @@ get_usage(zpool_help_t idx) case HELP_SCRUB: return (gettext("\tscrub [-s | -p] ...\n")); case HELP_STATUS: - return (gettext("\tstatus [-vx] [-T d|u] [pool] ... [interval " - "[count]]\n")); + return (gettext("\tstatus [-DgLPvx] [-T d|u] [pool] ... " + "[interval [count]]\n")); case HELP_UPGRADE: return (gettext("\tupgrade [-v]\n" "\tupgrade [-V version] <-a | pool ...>\n")); @@ -285,7 +288,7 @@ get_usage(zpool_help_t idx) case HELP_SET: return (gettext("\tset \n")); case HELP_SPLIT: - return (gettext("\tsplit [-n] [-R altroot] [-o mntopts]\n" + return (gettext("\tsplit [-gLnP] [-R altroot] [-o mntopts]\n" "\t [-o property=value] " "[ ...]\n")); case HELP_REGUID: @@ -307,7 +310,7 @@ print_prop_cb(int prop, void *cb) { FILE *fp = cb; - (void) fprintf(fp, "\t%-15s ", zpool_prop_to_name(prop)); + (void) fprintf(fp, "\t%-19s ", zpool_prop_to_name(prop)); if (zpool_prop_readonly(prop)) (void) fprintf(fp, " NO "); @@ -359,14 +362,14 @@ usage(boolean_t requested) (void) fprintf(fp, gettext("\nthe following properties are supported:\n")); - (void) fprintf(fp, "\n\t%-15s %s %s\n\n", + (void) fprintf(fp, "\n\t%-19s %s %s\n\n", "PROPERTY", "EDIT", "VALUES"); /* Iterate over all properties */ (void) zprop_iter(print_prop_cb, fp, B_FALSE, B_TRUE, ZFS_TYPE_POOL); - (void) fprintf(fp, "\t%-15s ", "feature@..."); + (void) fprintf(fp, "\t%-19s ", "feature@..."); (void) fprintf(fp, "YES disabled | enabled | active\n"); (void) fprintf(fp, gettext("\nThe feature@ properties must be " @@ -384,32 +387,45 @@ usage(boolean_t requested) exit(requested ? 0 : 2); } -void +/* + * print a pool vdev config for dry runs + */ +static void print_vdev_tree(zpool_handle_t *zhp, const char *name, nvlist_t *nv, int indent, - boolean_t print_logs) + const char *match, int name_flags) { nvlist_t **child; uint_t c, children; char *vname; + boolean_t printed = B_FALSE; - if (name != NULL) - (void) printf("\t%*s%s\n", indent, "", name); - if (nvlist_lookup_nvlist_array(nv, ZPOOL_CONFIG_CHILDREN, - &child, &children) != 0) + &child, &children) != 0) { + if (name != NULL) + (void) printf("\t%*s%s\n", indent, "", name); return; + } for (c = 0; c < children; c++) { uint64_t is_log = B_FALSE; + char *class = ""; (void) nvlist_lookup_uint64(child[c], ZPOOL_CONFIG_IS_LOG, &is_log); - if ((is_log && !print_logs) || (!is_log && print_logs)) + if (is_log) + class = VDEV_ALLOC_BIAS_LOG; + (void) nvlist_lookup_string(child[c], + ZPOOL_CONFIG_ALLOCATION_BIAS, &class); + if (strcmp(match, class) != 0) continue; - vname = zpool_vdev_name(g_zfs, zhp, child[c], B_FALSE); - print_vdev_tree(zhp, vname, child[c], indent + 2, - B_FALSE); + if (!printed && name != NULL) { + (void) printf("\t%*s%s\n", indent, "", name); + printed = B_TRUE; + } + vname = zpool_vdev_name(g_zfs, zhp, child[c], name_flags); + print_vdev_tree(zhp, vname, child[c], indent + 2, "", + name_flags); free(vname); } } @@ -517,11 +533,14 @@ add_prop_list_default(const char *propname, char *prop } /* - * zpool add [-fn] ... + * zpool add [-fgLnP] [-o property=value] ... * * -f Force addition of devices, even if they appear in use + * -g Display guid for individual vdev name. + * -L Follow links when resolving vdev path name. * -n Do not add the devices, but display the resulting layout if * they were to be added. + * -P Display full path for vdev name. * * Adds the given vdevs to 'pool'. As with create, the bulk of this work is * handled by get_vdev_spec(), which constructs the nvlist needed to pass to @@ -532,6 +551,7 @@ zpool_do_add(int argc, char **argv) { boolean_t force = B_FALSE; boolean_t dryrun = B_FALSE; + int name_flags = 0; int c; nvlist_t *nvroot; char *poolname; @@ -542,14 +562,23 @@ zpool_do_add(int argc, char **argv) nvlist_t *config; /* check options */ - while ((c = getopt(argc, argv, "fn")) != -1) { + while ((c = getopt(argc, argv, "fgLnP")) != -1) { switch (c) { case 'f': force = B_TRUE; break; + case 'g': + name_flags |= VDEV_NAME_GUID; + break; + case 'L': + name_flags |= VDEV_NAME_FOLLOW_LINKS; + break; case 'n': dryrun = B_TRUE; break; + case 'P': + name_flags |= VDEV_NAME_PATH; + break; case '?': (void) fprintf(stderr, gettext("invalid option '%c'\n"), optopt); @@ -609,17 +638,26 @@ zpool_do_add(int argc, char **argv) "configuration:\n"), zpool_get_name(zhp)); /* print original main pool and new tree */ - print_vdev_tree(zhp, poolname, poolnvroot, 0, B_FALSE); - print_vdev_tree(zhp, NULL, nvroot, 0, B_FALSE); + print_vdev_tree(zhp, poolname, poolnvroot, 0, "", + name_flags | VDEV_NAME_TYPE_ID); + print_vdev_tree(zhp, NULL, nvroot, 0, "", name_flags); - /* Do the same for the logs */ - if (num_logs(poolnvroot) > 0) { - print_vdev_tree(zhp, "logs", poolnvroot, 0, B_TRUE); - print_vdev_tree(zhp, NULL, nvroot, 0, B_TRUE); - } else if (num_logs(nvroot) > 0) { - print_vdev_tree(zhp, "logs", nvroot, 0, B_TRUE); - } + /* print other classes: 'dedup', 'special', and 'log' */ + print_vdev_tree(zhp, "dedup", poolnvroot, 0, + VDEV_ALLOC_BIAS_DEDUP, name_flags); + print_vdev_tree(zhp, NULL, nvroot, 0, VDEV_ALLOC_BIAS_DEDUP, + name_flags); + print_vdev_tree(zhp, "special", poolnvroot, 0, + VDEV_ALLOC_BIAS_SPECIAL, name_flags); + print_vdev_tree(zhp, NULL, nvroot, 0, VDEV_ALLOC_BIAS_SPECIAL, + name_flags); + + print_vdev_tree(zhp, "logs", poolnvroot, 0, VDEV_ALLOC_BIAS_LOG, + name_flags); + print_vdev_tree(zhp, NULL, nvroot, 0, VDEV_ALLOC_BIAS_LOG, + name_flags); + ret = 0; } else { ret = (zpool_add(zhp, nvroot) != 0); @@ -1217,9 +1255,13 @@ zpool_do_create(int argc, char **argv) (void) printf(gettext("would create '%s' with the " "following layout:\n\n"), poolname); - print_vdev_tree(NULL, poolname, nvroot, 0, B_FALSE); - if (num_logs(nvroot) > 0) - print_vdev_tree(NULL, "logs", nvroot, 0, B_TRUE); + print_vdev_tree(NULL, poolname, nvroot, 0, "", 0); + print_vdev_tree(NULL, "dedup", nvroot, 0, + VDEV_ALLOC_BIAS_DEDUP, 0); + print_vdev_tree(NULL, "special", nvroot, 0, + VDEV_ALLOC_BIAS_SPECIAL, 0); + print_vdev_tree(NULL, "logs", nvroot, 0, + VDEV_ALLOC_BIAS_LOG, 0); ret = 0; } else { @@ -1426,13 +1468,15 @@ zpool_do_export(int argc, char **argv) * name column. */ static int -max_width(zpool_handle_t *zhp, nvlist_t *nv, int depth, int max) +max_width(zpool_handle_t *zhp, nvlist_t *nv, int depth, int max, + int name_flags) { - char *name = zpool_vdev_name(g_zfs, zhp, nv, B_TRUE); + char *name; nvlist_t **child; uint_t c, children; int ret; + name = zpool_vdev_name(g_zfs, zhp, nv, name_flags | VDEV_NAME_TYPE_ID); if (strlen(name) + depth > max) max = strlen(name) + depth; @@ -1442,7 +1486,7 @@ max_width(zpool_handle_t *zhp, nvlist_t *nv, int depth &child, &children) == 0) { for (c = 0; c < children; c++) if ((ret = max_width(zhp, child[c], depth + 2, - max)) > max) + max, name_flags)) > max) max = ret; } @@ -1450,7 +1494,7 @@ max_width(zpool_handle_t *zhp, nvlist_t *nv, int depth &child, &children) == 0) { for (c = 0; c < children; c++) if ((ret = max_width(zhp, child[c], depth + 2, - max)) > max) + max, name_flags)) > max) max = ret; } @@ -1458,11 +1502,10 @@ max_width(zpool_handle_t *zhp, nvlist_t *nv, int depth &child, &children) == 0) { for (c = 0; c < children; c++) if ((ret = max_width(zhp, child[c], depth + 2, - max)) > max) + max, name_flags)) > max) max = ret; } - return (max); } @@ -1511,12 +1554,24 @@ find_spare(zpool_handle_t *zhp, void *data) return (0); } +typedef struct status_cbdata { + int cb_count; + int cb_name_flags; + int cb_namewidth; + boolean_t cb_allpools; + boolean_t cb_verbose; + boolean_t cb_explain; + boolean_t cb_first; + boolean_t cb_dedup_stats; + boolean_t cb_print_status; +} status_cbdata_t; + /* * Print out configuration state as requested by status_callback. */ -void -print_status_config(zpool_handle_t *zhp, const char *name, nvlist_t *nv, - int namewidth, int depth, boolean_t isspare) +static void +print_status_config(zpool_handle_t *zhp, status_cbdata_t *cb, const char *name, + nvlist_t *nv, int depth, boolean_t isspare) { nvlist_t **child; uint_t c, vsc, children; @@ -1526,7 +1581,7 @@ print_status_config(zpool_handle_t *zhp, const char *n char *vname; uint64_t notpresent; uint64_t ashift; *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-all@freebsd.org Thu Nov 21 11:15:51 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 28B321B9EEA; Thu, 21 Nov 2019 11:15:51 +0000 (UTC) (envelope-from tcberner@gmail.com) Received: from mail-qt1-x842.google.com (mail-qt1-x842.google.com [IPv6:2607:f8b0:4864:20::842]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47JcS702MRz4Dwq; Thu, 21 Nov 2019 11:15:50 +0000 (UTC) (envelope-from tcberner@gmail.com) Received: by mail-qt1-x842.google.com with SMTP id y39so3269204qty.0; Thu, 21 Nov 2019 03:15:50 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=eENdwDUXsqa67vsmUe22+n9I72vlGVCrgEnmGa3eH2A=; b=REQ7zyY8V5TW3YVG2wbGDRzL/6+ZZPQ5Ve4wSxDO2+cku+STz95tPai3SLafRS5l8I a7WzNlVnHcTQxtmweP+18WYJ45cbstMNikMLOHa+KI5mL2vk8vSDoaQ5nS6O+GOc4J9i palFRp/gcEsJ6EI6PW6R1NTfcwClNgnQozmPW/yu00U+CPlQD3NMA9/VKiXVyjHQkDXz fubmqSS4Goqzb69qN7r+ZbbIrkl/ZR2JFKeFsIuPTaQtSmKL2ktRdqAeyAJetTxhLYO2 AzmaTVs3txVA36nCb9+3nDnS8ipY9jZmql8r6bni8z++6s2KbpFD/tqUy4O07Z00373V /csw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=eENdwDUXsqa67vsmUe22+n9I72vlGVCrgEnmGa3eH2A=; b=IEeNT9P1DcuA5dJGuwQ7hiLbcX34np4ZYkT4nkZi9a/48CsOEC30h3bH6sYCEKRd7H VI18Nyrtdo/3/4HzPSQyLTry0zj6gxuDuoLvGD9uIQw3BsdoAIX2tSz6Uzrf/11U/vap serDH/hEEVTRaJ7fSkxWe7HrXi7gMWGDACg39o30SAVT4mzNerVCoyScI7wpzsyycVKQ 4nnCfFuXfMNRLRinhTFKPFY13rrFip/pfqAw0/S0UQVwHFh6dYYW6p85JBgpOsKHrzHh jtC2G7RfHhb5eiJsgPQhIC8F619LvtHGBm7PSnIq4bZ3MmodJd6WkFGYP4e8LOG02poA nhdw== X-Gm-Message-State: APjAAAXspHJuAh3y14i6vBRKnky6XpcVJ/JjMPX1D0grADAa+dbDqexy d/EGMtnwPRRocEg3FZpMOi526lnOSDiFuc/J214hzQ== X-Google-Smtp-Source: APXvYqwKESrS/gORjSbDVSLpBqX6b0cvtDLLPpeTXBt/Yf/X7mqWxLrvDd4vFrch/XgczqcoXzP6EjkFOsyahyfd/SQ= X-Received: by 2002:ac8:4510:: with SMTP id q16mr7669461qtn.316.1574334949333; Thu, 21 Nov 2019 03:15:49 -0800 (PST) MIME-Version: 1.0 References: <201911202345.xAKNjVEl038814@repo.freebsd.org> <20191121063130.GA64098@FreeBSD.org> In-Reply-To: <20191121063130.GA64098@FreeBSD.org> From: "Tobias C. Berner" Date: Thu, 21 Nov 2019 12:15:37 +0100 Message-ID: Subject: Re: svn commit: r354922 - in head: etc libexec/rc libexec/rc/rc.d share/man/man5 sys/sys To: Alexey Dokuchaev Cc: Warner Losh , svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Content-Type: text/plain; charset="UTF-8" X-Rspamd-Queue-Id: 47JcS702MRz4Dwq X-Spamd-Bar: ----- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-6.00 / 15.00]; NEURAL_HAM_MEDIUM(-1.00)[-0.998,0]; REPLY(-4.00)[]; NEURAL_HAM_LONG(-1.00)[-0.999,0] X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 21 Nov 2019 11:15:51 -0000 Yes it will be removed once all supported releases have it in base -- until then there will be a switch to conditionally depend on the port depending on the FreeBSD version. On Thu, 21 Nov 2019 at 07:31, Alexey Dokuchaev wrote: > > On Wed, Nov 20, 2019 at 11:45:31PM +0000, Warner Losh wrote: > > New Revision: 354922 > > URL: https://svnweb.freebsd.org/changeset/base/354922 > > > > Log: > > Create /etc/os-release file. > > > > Each boot, regenerate /var/run/os-release based on the currently > > running system. Create a /etc/os-release symlink pointing to this > > file (so that this doesn't create a new reason /etc can not be > > mounted read-only). > > > > This is compatible with what other systems do and is what the > > sysutil/os-release port attempted to do, but in an incomplete way. > > Thanks! Hopefully, `sysutil/os-release' can be wiped out soon: not > just it was placed under wrong category, but it was badly and quite > unreadably coded. > > ./danfe > _______________________________________________ > svn-src-head@freebsd.org mailing list > https://lists.freebsd.org/mailman/listinfo/svn-src-head > To unsubscribe, send any mail to "svn-src-head-unsubscribe@freebsd.org" From owner-svn-src-all@freebsd.org Thu Nov 21 11:22:12 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 6D5BF1BA25B; Thu, 21 Nov 2019 11:22:12 +0000 (UTC) (envelope-from andrew@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47JcbS34QCz4FGr; Thu, 21 Nov 2019 11:22:12 +0000 (UTC) (envelope-from andrew@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4C84FA66F; Thu, 21 Nov 2019 11:22:12 +0000 (UTC) (envelope-from andrew@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xALBMCTN052289; Thu, 21 Nov 2019 11:22:12 GMT (envelope-from andrew@FreeBSD.org) Received: (from andrew@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xALBM8m4052268; Thu, 21 Nov 2019 11:22:08 GMT (envelope-from andrew@FreeBSD.org) Message-Id: <201911211122.xALBM8m4052268@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: andrew set sender to andrew@FreeBSD.org using -f From: Andrew Turner Date: Thu, 21 Nov 2019 11:22:08 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354942 - in head/sys: amd64/amd64 amd64/conf amd64/include arm64/arm64 arm64/conf arm64/include conf kern libkern modules sys x86/include x86/x86 X-SVN-Group: head X-SVN-Commit-Author: andrew X-SVN-Commit-Paths: in head/sys: amd64/amd64 amd64/conf amd64/include arm64/arm64 arm64/conf arm64/include conf kern libkern modules sys x86/include x86/x86 X-SVN-Commit-Revision: 354942 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 21 Nov 2019 11:22:12 -0000 Author: andrew Date: Thu Nov 21 11:22:08 2019 New Revision: 354942 URL: https://svnweb.freebsd.org/changeset/base/354942 Log: Port the NetBSD KCSAN runtime to FreeBSD. Update the NetBSD Kernel Concurrency Sanitizer (KCSAN) runtime to work in the FreeBSD kernel. It is a useful tool for finding data races between threads executing on different CPUs. This can be enabled by enabling KCSAN in the kernel config, or by using the GENERIC-KCSAN amd64 kernel. It works on amd64 and arm64, however the later needs a compiler change to allow -fsanitize=thread that KCSAN uses. Sponsored by: DARPA, AFRL Differential Revision: https://reviews.freebsd.org/D22315 Added: head/sys/amd64/conf/GENERIC-KCSAN (contents, props changed) head/sys/amd64/include/csan.h (contents, props changed) head/sys/arm64/include/csan.h (contents, props changed) head/sys/sys/_cscan_atomic.h (contents, props changed) head/sys/sys/_cscan_bus.h (contents, props changed) Modified: head/sys/amd64/amd64/copyout.c head/sys/amd64/amd64/machdep.c head/sys/amd64/conf/GENERIC head/sys/amd64/include/atomic.h head/sys/arm64/arm64/bus_machdep.c head/sys/arm64/arm64/copystr.c head/sys/arm64/arm64/machdep.c head/sys/arm64/arm64/mp_machdep.c head/sys/arm64/conf/GENERIC head/sys/arm64/include/atomic.h head/sys/arm64/include/bus.h head/sys/conf/files head/sys/conf/files.arm64 head/sys/conf/kern.post.mk head/sys/conf/kern.pre.mk head/sys/conf/options head/sys/kern/subr_csan.c (contents, props changed) head/sys/kern/vfs_aio.c head/sys/libkern/strcmp.c head/sys/libkern/strcpy.c head/sys/libkern/strlen.c head/sys/modules/Makefile head/sys/sys/csan.h (contents, props changed) head/sys/sys/libkern.h head/sys/sys/systm.h head/sys/x86/include/bus.h head/sys/x86/x86/bus_machdep.c head/sys/x86/x86/mp_x86.c Modified: head/sys/amd64/amd64/copyout.c ============================================================================== --- head/sys/amd64/amd64/copyout.c Thu Nov 21 08:20:05 2019 (r354941) +++ head/sys/amd64/amd64/copyout.c Thu Nov 21 11:22:08 2019 (r354942) @@ -146,6 +146,10 @@ DEFINE_IFUNC(, int, casueword, (volatile u_long *, u_l casueword_smap : casueword_nosmap); } +#undef copyinstr +#undef copyin +#undef copyout + int copyinstr_nosmap(const void *udaddr, void *kaddr, size_t len, size_t *lencopied); int copyinstr_smap(const void *udaddr, void *kaddr, size_t len, Modified: head/sys/amd64/amd64/machdep.c ============================================================================== --- head/sys/amd64/amd64/machdep.c Thu Nov 21 08:20:05 2019 (r354941) +++ head/sys/amd64/amd64/machdep.c Thu Nov 21 11:22:08 2019 (r354942) @@ -64,6 +64,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include @@ -1899,6 +1900,8 @@ hammer_time(u_int64_t modulep, u_int64_t physfree) cpu_probe_amdc1e(); + kcsan_cpu_init(0); + #ifdef FDT x86_init_fdt(); #endif @@ -2722,6 +2725,40 @@ outb_(u_short port, u_char data) void *memset_std(void *buf, int c, size_t len); void *memset_erms(void *buf, int c, size_t len); +void *memmove_std(void * _Nonnull dst, const void * _Nonnull src, + size_t len); +void *memmove_erms(void * _Nonnull dst, const void * _Nonnull src, + size_t len); +void *memcpy_std(void * _Nonnull dst, const void * _Nonnull src, + size_t len); +void *memcpy_erms(void * _Nonnull dst, const void * _Nonnull src, + size_t len); + +#ifdef KCSAN +/* + * These fail to build as ifuncs when used with KCSAN. + */ +void * +memset(void *buf, int c, size_t len) +{ + + return memset_std(buf, c, len); +} + +void * +memmove(void * _Nonnull dst, const void * _Nonnull src, size_t len) +{ + + return memmove_std(dst, src, len); +} + +void * +memcpy(void * _Nonnull dst, const void * _Nonnull src, size_t len) +{ + + return memcpy_std(dst, src, len); +} +#else DEFINE_IFUNC(, void *, memset, (void *, int, size_t)) { @@ -2729,10 +2766,6 @@ DEFINE_IFUNC(, void *, memset, (void *, int, size_t)) memset_erms : memset_std); } -void *memmove_std(void * _Nonnull dst, const void * _Nonnull src, - size_t len); -void *memmove_erms(void * _Nonnull dst, const void * _Nonnull src, - size_t len); DEFINE_IFUNC(, void *, memmove, (void * _Nonnull, const void * _Nonnull, size_t)) { @@ -2741,16 +2774,13 @@ DEFINE_IFUNC(, void *, memmove, (void * _Nonnull, cons memmove_erms : memmove_std); } -void *memcpy_std(void * _Nonnull dst, const void * _Nonnull src, - size_t len); -void *memcpy_erms(void * _Nonnull dst, const void * _Nonnull src, - size_t len); DEFINE_IFUNC(, void *, memcpy, (void * _Nonnull, const void * _Nonnull,size_t)) { return ((cpu_stdext_feature & CPUID_STDEXT_ERMS) != 0 ? memcpy_erms : memcpy_std); } +#endif void pagezero_std(void *addr); void pagezero_erms(void *addr); Modified: head/sys/amd64/conf/GENERIC ============================================================================== --- head/sys/amd64/conf/GENERIC Thu Nov 21 08:20:05 2019 (r354941) +++ head/sys/amd64/conf/GENERIC Thu Nov 21 11:22:08 2019 (r354942) @@ -106,6 +106,7 @@ options VERBOSE_SYSINIT=0 # Support debug.verbose_sys #options KCOV # Kernel Coverage Sanitizer # Warning: KUBSAN can result in a kernel too large for loader to load #options KUBSAN # Kernel Undefined Behavior Sanitizer +#options KCSAN # Kernel Concurrency Sanitizer # Kernel dump features. options EKCD # Support for encrypted kernel dumps Added: head/sys/amd64/conf/GENERIC-KCSAN ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/amd64/conf/GENERIC-KCSAN Thu Nov 21 11:22:08 2019 (r354942) @@ -0,0 +1,33 @@ +# +# GENERIC-KCSAN -- Kernel Concurrency Sanitizer kernel configuration file +# for FreeBSD/amd64 +# +# This configuration file removes several debugging options, including +# WITNESS and INVARIANTS checking, which are known to have significant +# performance impact on running systems. When benchmarking new features +# this kernel should be used instead of the standard GENERIC. +# This kernel configuration should never appear outside of the HEAD +# of the FreeBSD tree. +# +# For more information on this file, please read the config(5) manual page, +# and/or the handbook section on Kernel Configuration Files: +# +# https://www.FreeBSD.org/doc/en_US.ISO8859-1/books/handbook/kernelconfig-config.html +# +# The handbook is also available locally in /usr/share/doc/handbook +# if you've installed the doc distribution, otherwise always see the +# FreeBSD World Wide Web server (https://www.FreeBSD.org/) for the +# latest information. +# +# An exhaustive list of options and more detailed explanations of the +# device lines is also present in the ../../conf/NOTES and NOTES files. +# If you are in doubt as to the purpose or necessity of a line, check first +# in NOTES. +# +# $FreeBSD$ + +include GENERIC + +ident GENERIC-KCSAN + +options KCSAN Modified: head/sys/amd64/include/atomic.h ============================================================================== --- head/sys/amd64/include/atomic.h Thu Nov 21 08:20:05 2019 (r354941) +++ head/sys/amd64/include/atomic.h Thu Nov 21 11:22:08 2019 (r354942) @@ -57,6 +57,20 @@ #define wmb() __asm __volatile("sfence;" : : : "memory") #define rmb() __asm __volatile("lfence;" : : : "memory") +#ifdef _KERNEL +/* + * OFFSETOF_MONITORBUF == __pcpu_offset(pc_monitorbuf). + * + * The open-coded number is used instead of the symbolic expression to + * avoid a dependency on sys/pcpu.h in machine/atomic.h consumers. + * An assertion in amd64/vm_machdep.c ensures that the value is correct. + */ +#define OFFSETOF_MONITORBUF 0x100 +#endif + +#if defined(KCSAN) && !defined(KCSAN_RUNTIME) +#include +#else #include /* @@ -345,15 +359,6 @@ atomic_testandclear_long(volatile u_long *p, u_int v) #if defined(_KERNEL) -/* - * OFFSETOF_MONITORBUF == __pcpu_offset(pc_monitorbuf). - * - * The open-coded number is used instead of the symbolic expression to - * avoid a dependency on sys/pcpu.h in machine/atomic.h consumers. - * An assertion in amd64/vm_machdep.c ensures that the value is correct. - */ -#define OFFSETOF_MONITORBUF 0x100 - #if defined(SMP) || defined(KLD_MODULE) static __inline void __storeload_barrier(void) @@ -678,5 +683,7 @@ u_long atomic_swap_long(volatile u_long *p, u_long v); #define atomic_readandclear_ptr atomic_readandclear_long #endif /* !WANT_FUNCTIONS */ + +#endif /* KCSAN && !KCSAN_RUNTIME */ #endif /* !_MACHINE_ATOMIC_H_ */ Added: head/sys/amd64/include/csan.h ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/amd64/include/csan.h Thu Nov 21 11:22:08 2019 (r354942) @@ -0,0 +1,67 @@ +/* $NetBSD: csan.h,v 1.2 2019/11/06 06:57:22 maxv Exp $ */ + +/* + * Copyright (c) 2019 The NetBSD Foundation, Inc. + * All rights reserved. + * + * This code is derived from software contributed to The NetBSD Foundation + * by Maxime Villard. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS + * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + * + * $FreeBSD$ + */ + +#include +#include +#include + +static inline bool +kcsan_md_is_avail(void) +{ + return true; +} + +static inline void +kcsan_md_disable_intrs(uint64_t *state) +{ + + *state = intr_disable(); +} + +static inline void +kcsan_md_enable_intrs(uint64_t *state) +{ + + intr_restore(*state); +} + +static inline void +kcsan_md_delay(uint64_t us) +{ + DELAY(us); +} + +static void +kcsan_md_unwind(void) +{ +} Modified: head/sys/arm64/arm64/bus_machdep.c ============================================================================== --- head/sys/arm64/arm64/bus_machdep.c Thu Nov 21 08:20:05 2019 (r354941) +++ head/sys/arm64/arm64/bus_machdep.c Thu Nov 21 11:22:08 2019 (r354942) @@ -25,6 +25,8 @@ * */ +#define KCSAN_RUNTIME + #include "opt_platform.h" #include Modified: head/sys/arm64/arm64/copystr.c ============================================================================== --- head/sys/arm64/arm64/copystr.c Thu Nov 21 08:20:05 2019 (r354941) +++ head/sys/arm64/arm64/copystr.c Thu Nov 21 11:22:08 2019 (r354942) @@ -32,7 +32,7 @@ __FBSDID("$FreeBSD$"); #include int -copystr(const void * __restrict kfaddr, void * __restrict kdaddr, size_t len, +(copystr)(const void * __restrict kfaddr, void * __restrict kdaddr, size_t len, size_t * __restrict lencopied) { const char *src; Modified: head/sys/arm64/arm64/machdep.c ============================================================================== --- head/sys/arm64/arm64/machdep.c Thu Nov 21 08:20:05 2019 (r354941) +++ head/sys/arm64/arm64/machdep.c Thu Nov 21 11:22:08 2019 (r354942) @@ -38,6 +38,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include @@ -1208,6 +1209,8 @@ initarm(struct arm64_bootparams *abp) dbg_init(); kdb_init(); pan_enable(); + + kcsan_cpu_init(0); env = kern_getenv("kernelname"); if (env != NULL) Modified: head/sys/arm64/arm64/mp_machdep.c ============================================================================== --- head/sys/arm64/arm64/mp_machdep.c Thu Nov 21 08:20:05 2019 (r354941) +++ head/sys/arm64/arm64/mp_machdep.c Thu Nov 21 11:22:08 2019 (r354942) @@ -40,6 +40,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include @@ -252,6 +253,8 @@ init_secondary(uint64_t cpu) } mtx_unlock_spin(&ap_boot_mtx); + + kcsan_cpu_init(cpu); /* Enter the scheduler */ sched_throw(NULL); Modified: head/sys/arm64/conf/GENERIC ============================================================================== --- head/sys/arm64/conf/GENERIC Thu Nov 21 08:20:05 2019 (r354941) +++ head/sys/arm64/conf/GENERIC Thu Nov 21 11:22:08 2019 (r354942) @@ -100,6 +100,7 @@ options VERBOSE_SYSINIT=0 # Support debug.verbose_sys #options KCOV # Kernel Coverage Sanitizer # Warning: KUBSAN can result in a kernel too large for loader to load #options KUBSAN # Kernel Undefined Behavior Sanitizer +#options KCSAN # Kernel Concurrency Sanitizer # Kernel dump features. options EKCD # Support for encrypted kernel dumps Modified: head/sys/arm64/include/atomic.h ============================================================================== --- head/sys/arm64/include/atomic.h Thu Nov 21 08:20:05 2019 (r354941) +++ head/sys/arm64/include/atomic.h Thu Nov 21 11:22:08 2019 (r354942) @@ -29,8 +29,6 @@ #ifndef _MACHINE_ATOMIC_H_ #define _MACHINE_ATOMIC_H_ -#include - #define isb() __asm __volatile("isb" : : : "memory") /* @@ -55,6 +53,12 @@ #define wmb() dmb(st) /* Full system memory barrier store */ #define rmb() dmb(ld) /* Full system memory barrier load */ +#if defined(KCSAN) && !defined(KCSAN_RUNTIME) +#include +#else + +#include + #define ATOMIC_OP(op, asm_op, bar, a, l) \ static __inline void \ atomic_##op##_##bar##8(volatile uint8_t *p, uint8_t val) \ @@ -600,6 +604,8 @@ atomic_thread_fence_seq_cst(void) dmb(sy); } + +#endif /* KCSAN && !KCSAN_RUNTIME */ #endif /* _MACHINE_ATOMIC_H_ */ Modified: head/sys/arm64/include/bus.h ============================================================================== --- head/sys/arm64/include/bus.h Thu Nov 21 08:20:05 2019 (r354941) +++ head/sys/arm64/include/bus.h Thu Nov 21 11:22:08 2019 (r354942) @@ -89,6 +89,9 @@ #define BUS_SPACE_BARRIER_READ 0x01 #define BUS_SPACE_BARRIER_WRITE 0x02 +#if defined(KCSAN) && !defined(KCSAN_RUNTIME) +#include +#else struct bus_space { /* cookie */ @@ -463,6 +466,8 @@ struct bus_space { __bs_copy(4, t, h1, o1, h2, o2, c) #define bus_space_copy_region_8(t, h1, o1, h2, o2, c) \ __bs_copy(8, t, h1, o1, h2, o2, c) + +#endif #include Added: head/sys/arm64/include/csan.h ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/arm64/include/csan.h Thu Nov 21 11:22:08 2019 (r354942) @@ -0,0 +1,104 @@ +/* $NetBSD: csan.h,v 1.2 2019/11/06 06:57:22 maxv Exp $ */ + +/* + * Copyright (c) 2019 The NetBSD Foundation, Inc. + * All rights reserved. + * + * This code is derived from software contributed to The NetBSD Foundation + * by Maxime Villard. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS + * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + * + * $FreeBSD$ + */ + +#include +#include +#include + +static inline bool +kcsan_md_is_avail(void) +{ + return true; +} + +static inline void +kcsan_md_disable_intrs(uint64_t *state) +{ + + *state = intr_disable(); +} + +static inline void +kcsan_md_enable_intrs(uint64_t *state) +{ + + intr_restore(*state); +} + +static inline void +kcsan_md_delay(uint64_t us) +{ + DELAY(us); +} + +static void +kcsan_md_unwind(void) +{ +#ifdef DDB + c_db_sym_t sym; + db_expr_t offset; + const char *symname; +#endif + struct unwind_state frame; + uint64_t sp; + int nsym; + + __asm __volatile("mov %0, sp" : "=&r" (sp)); + + frame.sp = sp; + frame.fp = (uint64_t)__builtin_frame_address(0); + frame.pc = (uint64_t)kcsan_md_unwind; + nsym = 0; + + while (1) { + unwind_frame(&frame); + if (!INKERNEL((vm_offset_t)frame.fp) || + !INKERNEL((vm_offset_t)frame.pc)) + break; + +#ifdef DDB + sym = db_search_symbol((vm_offset_t)frame.pc, DB_STGY_PROC, + &offset); + db_symbol_values(sym, &symname, NULL); + printf("#%d %p in %s+%#lx\n", nsym, (void *)frame.pc, + symname, offset); +#else + printf("#%d %p\n", nsym, (void *)frame.pc); +#endif + nsym++; + + if (nsym >= 15) { + break; + } + } +} Modified: head/sys/conf/files ============================================================================== --- head/sys/conf/files Thu Nov 21 08:20:05 2019 (r354941) +++ head/sys/conf/files Thu Nov 21 11:22:08 2019 (r354942) @@ -3805,6 +3805,8 @@ kern/subr_compressor.c standard \ kern/subr_coverage.c optional coverage \ compile-with "${NORMAL_C:N-fsanitize*}" kern/subr_counter.c standard +kern/subr_csan.c optional kcsan \ + compile-with "${NORMAL_C:N-fsanitize*}" kern/subr_devstat.c standard kern/subr_disk.c standard kern/subr_early.c standard Modified: head/sys/conf/files.arm64 ============================================================================== --- head/sys/conf/files.arm64 Thu Nov 21 08:20:05 2019 (r354941) +++ head/sys/conf/files.arm64 Thu Nov 21 11:22:08 2019 (r354942) @@ -286,8 +286,10 @@ kern/pic_if.m optional intrng kern/subr_devmap.c standard kern/subr_intr.c optional intrng libkern/bcmp.c standard -libkern/memcmp.c standard -libkern/memset.c standard +libkern/memcmp.c standard \ + compile-with "${NORMAL_C:N-fsanitize*}" +libkern/memset.c standard \ + compile-with "${NORMAL_C:N-fsanitize*}" libkern/arm64/crc32c_armv8.S standard cddl/dev/dtrace/aarch64/dtrace_asm.S optional dtrace compile-with "${DTRACE_S}" cddl/dev/dtrace/aarch64/dtrace_subr.c optional dtrace compile-with "${DTRACE_C}" Modified: head/sys/conf/kern.post.mk ============================================================================== --- head/sys/conf/kern.post.mk Thu Nov 21 08:20:05 2019 (r354941) +++ head/sys/conf/kern.post.mk Thu Nov 21 11:22:08 2019 (r354942) @@ -38,6 +38,10 @@ MKMODULESENV+= WITH_CTF="${WITH_CTF}" MKMODULESENV+= WITH_EXTRA_TCP_STACKS="${WITH_EXTRA_TCP_STACKS}" .endif +.if defined(KCSAN_ENABLED) +MKMODULESENV+= KCSAN_ENABLED="yes" +.endif + .if defined(SAN_CFLAGS) MKMODULESENV+= SAN_CFLAGS="${SAN_CFLAGS}" .endif Modified: head/sys/conf/kern.pre.mk ============================================================================== --- head/sys/conf/kern.pre.mk Thu Nov 21 08:20:05 2019 (r354941) +++ head/sys/conf/kern.pre.mk Thu Nov 21 11:22:08 2019 (r354942) @@ -117,6 +117,11 @@ PROF= -pg .endif DEFINED_PROF= ${PROF} +KCSAN_ENABLED!= grep KCSAN opt_global.h || true ; echo +.if !empty(KCSAN_ENABLED) +SAN_CFLAGS+= -fsanitize=thread +.endif + KUBSAN_ENABLED!= grep KUBSAN opt_global.h || true ; echo .if !empty(KUBSAN_ENABLED) SAN_CFLAGS+= -fsanitize=undefined Modified: head/sys/conf/options ============================================================================== --- head/sys/conf/options Thu Nov 21 08:20:05 2019 (r354941) +++ head/sys/conf/options Thu Nov 21 11:22:08 2019 (r354942) @@ -230,6 +230,7 @@ ZSTDIO opt_zstdio.h # Sanitizers COVERAGE opt_global.h KCOV +KCSAN opt_global.h KUBSAN opt_global.h # POSIX kernel options Modified: head/sys/kern/subr_csan.c ============================================================================== --- head/sys/kern/subr_csan.c Thu Nov 21 08:20:05 2019 (r354941) +++ head/sys/kern/subr_csan.c Thu Nov 21 11:22:08 2019 (r354942) @@ -3,6 +3,7 @@ /* * Copyright (c) 2019 The NetBSD Foundation, Inc. * All rights reserved. + * Copyright (c) 2019 Andrew Turner * * This code is derived from software contributed to The NetBSD Foundation * by Maxime Villard. @@ -29,19 +30,26 @@ * POSSIBILITY OF SUCH DAMAGE. */ +#define KCSAN_RUNTIME + +#include "opt_ddb.h" + #include -__KERNEL_RCSID(0, "$NetBSD: subr_csan.c,v 1.5 2019/11/15 08:11:37 maxv Exp $"); +__FBSDID("$FreeBSD$"); #include -#include #include -#include +#include #include -#include -#include -#include #include +#include +#include +#include +#include +#include +#include + #ifdef KCSAN_PANIC #define REPORT panic #else @@ -62,7 +70,7 @@ typedef struct { csan_cell_t cell; } csan_cpu_t; -static csan_cpu_t kcsan_cpus[MAXCPUS]; +static csan_cpu_t kcsan_cpus[MAXCPU]; static bool kcsan_enabled __read_mostly; #define __RET_ADDR (uintptr_t)__builtin_return_address(0) @@ -77,34 +85,43 @@ static bool kcsan_enabled __read_mostly; /* -------------------------------------------------------------------------- */ -void -kcsan_init(void) +static void +kcsan_enable(void *dummy __unused) { + + printf("Enabling KCSCAN, expect reduced performance.\n"); kcsan_enabled = true; } +SYSINIT(kcsan_enable, SI_SUB_SMP, SI_ORDER_SECOND, kcsan_enable, NULL); void -kcsan_cpu_init(struct cpu_info *ci) +kcsan_cpu_init(u_int cpu) { - kcsan_cpus[cpu_index(ci)].inited = true; + kcsan_cpus[cpu].inited = true; } /* -------------------------------------------------------------------------- */ static inline void -kcsan_report(csan_cell_t *new, cpuid_t newcpu, csan_cell_t *old, cpuid_t oldcpu) +kcsan_report(csan_cell_t *new, u_int newcpu, csan_cell_t *old, u_int oldcpu) { const char *newsym, *oldsym; +#ifdef DDB + c_db_sym_t sym; + db_expr_t offset; - if (ksyms_getname(NULL, &newsym, (vaddr_t)new->pc, KSYMS_PROC) != 0) { - newsym = "Unknown"; - } - if (ksyms_getname(NULL, &oldsym, (vaddr_t)old->pc, KSYMS_PROC) != 0) { - oldsym = "Unknown"; - } + sym = db_search_symbol((vm_offset_t)new->pc, DB_STGY_PROC, &offset); + db_symbol_values(sym, &newsym, NULL); + + sym = db_search_symbol((vm_offset_t)old->pc, DB_STGY_PROC, &offset); + db_symbol_values(sym, &oldsym, NULL); +#else + newsym = ""; + oldsym = ""; +#endif REPORT("CSan: Racy Access " - "[Cpu%lu %s%s Addr=%p Size=%u PC=%p<%s>] " - "[Cpu%lu %s%s Addr=%p Size=%u PC=%p<%s>]\n", + "[Cpu%u %s%s Addr=%p Size=%u PC=%p<%s>] " + "[Cpu%u %s%s Addr=%p Size=%u PC=%p<%s>]\n", newcpu, (new->atomic ? "Atomic " : ""), (new->write ? "Write" : "Read"), (void *)new->addr, new->size, (void *)new->pc, newsym, @@ -134,8 +151,6 @@ kcsan_access(uintptr_t addr, size_t size, bool write, if (__predict_false(!kcsan_enabled)) return; - if (__predict_false(kcsan_md_unsupported((vaddr_t)addr))) - return; new.addr = addr; new.size = size; @@ -143,7 +158,7 @@ kcsan_access(uintptr_t addr, size_t size, bool write, new.atomic = atomic; new.pc = pc; - for (i = 0; i < ncpu; i++) { + CPU_FOREACH(i) { __builtin_memcpy(&old, &kcsan_cpus[i].cell, sizeof(old)); if (old.addr + old.size <= new.addr) @@ -155,7 +170,7 @@ kcsan_access(uintptr_t addr, size_t size, bool write, if (__predict_true(kcsan_access_is_atomic(&new, &old))) continue; - kcsan_report(&new, cpu_number(), &old, i); + kcsan_report(&new, PCPU_GET(cpuid), &old, i); break; } @@ -164,7 +179,7 @@ kcsan_access(uintptr_t addr, size_t size, bool write, kcsan_md_disable_intrs(&intr); - cpu = &kcsan_cpus[cpu_number()]; + cpu = &kcsan_cpus[PCPU_GET(cpuid)]; if (__predict_false(!cpu->inited)) goto out; cpu->cnt = (cpu->cnt + 1) % KCSAN_NACCESSES; @@ -184,6 +199,11 @@ out: void __tsan_read##size(uintptr_t addr) \ { \ kcsan_access(addr, size, false, false, __RET_ADDR); \ + } \ + void __tsan_unaligned_read##size(uintptr_t); \ + void __tsan_unaligned_read##size(uintptr_t addr) \ + { \ + kcsan_access(addr, size, false, false, __RET_ADDR); \ } CSAN_READ(1) @@ -197,6 +217,11 @@ CSAN_READ(16) void __tsan_write##size(uintptr_t addr) \ { \ kcsan_access(addr, size, true, false, __RET_ADDR); \ + } \ + void __tsan_unaligned_write##size(uintptr_t); \ + void __tsan_unaligned_write##size(uintptr_t addr) \ + { \ + kcsan_access(addr, size, true, false, __RET_ADDR); \ } CSAN_WRITE(1) @@ -321,35 +346,14 @@ kcsan_strlen(const char *str) return (s - str); } -#undef kcopy #undef copystr -#undef copyinstr -#undef copyoutstr #undef copyin +#undef copyin_nofault +#undef copyinstr #undef copyout +#undef copyout_nofault -int kcsan_kcopy(const void *, void *, size_t); -int kcsan_copystr(const void *, void *, size_t, size_t *); -int kcsan_copyinstr(const void *, void *, size_t, size_t *); -int kcsan_copyoutstr(const void *, void *, size_t, size_t *); -int kcsan_copyin(const void *, void *, size_t); -int kcsan_copyout(const void *, void *, size_t); -int kcopy(const void *, void *, size_t); -int copystr(const void *, void *, size_t, size_t *); -int copyinstr(const void *, void *, size_t, size_t *); -int copyoutstr(const void *, void *, size_t, size_t *); -int copyin(const void *, void *, size_t); -int copyout(const void *, void *, size_t); - int -kcsan_kcopy(const void *src, void *dst, size_t len) -{ - kcsan_access((uintptr_t)src, len, false, false, __RET_ADDR); - kcsan_access((uintptr_t)dst, len, true, false, __RET_ADDR); - return kcopy(src, dst, len); -} - -int kcsan_copystr(const void *kfaddr, void *kdaddr, size_t len, size_t *done) { kcsan_access((uintptr_t)kdaddr, len, true, false, __RET_ADDR); @@ -364,13 +368,6 @@ kcsan_copyin(const void *uaddr, void *kaddr, size_t le } int -kcsan_copyout(const void *kaddr, void *uaddr, size_t len) -{ - kcsan_access((uintptr_t)kaddr, len, false, false, __RET_ADDR); - return copyout(kaddr, uaddr, len); -} - -int kcsan_copyinstr(const void *uaddr, void *kaddr, size_t len, size_t *done) { kcsan_access((uintptr_t)kaddr, len, true, false, __RET_ADDR); @@ -378,377 +375,477 @@ kcsan_copyinstr(const void *uaddr, void *kaddr, size_t } int -kcsan_copyoutstr(const void *kaddr, void *uaddr, size_t len, size_t *done) +kcsan_copyout(const void *kaddr, void *uaddr, size_t len) { kcsan_access((uintptr_t)kaddr, len, false, false, __RET_ADDR); - return copyoutstr(kaddr, uaddr, len, done); + return copyout(kaddr, uaddr, len); } /* -------------------------------------------------------------------------- */ -#undef atomic_add_32 -#undef atomic_add_int -#undef atomic_add_long -#undef atomic_add_ptr -#undef atomic_add_64 -#undef atomic_add_32_nv -#undef atomic_add_int_nv -#undef atomic_add_long_nv -#undef atomic_add_ptr_nv -#undef atomic_add_64_nv -#undef atomic_and_32 -#undef atomic_and_uint -#undef atomic_and_ulong -#undef atomic_and_64 -#undef atomic_and_32_nv -#undef atomic_and_uint_nv -#undef atomic_and_ulong_nv -#undef atomic_and_64_nv -#undef atomic_or_32 -#undef atomic_or_uint -#undef atomic_or_ulong -#undef atomic_or_64 -#undef atomic_or_32_nv -#undef atomic_or_uint_nv -#undef atomic_or_ulong_nv -#undef atomic_or_64_nv -#undef atomic_cas_32 -#undef atomic_cas_uint -#undef atomic_cas_ulong -#undef atomic_cas_ptr -#undef atomic_cas_64 -#undef atomic_cas_32_ni -#undef atomic_cas_uint_ni -#undef atomic_cas_ulong_ni -#undef atomic_cas_ptr_ni -#undef atomic_cas_64_ni -#undef atomic_swap_32 -#undef atomic_swap_uint -#undef atomic_swap_ulong -#undef atomic_swap_ptr -#undef atomic_swap_64 -#undef atomic_dec_32 -#undef atomic_dec_uint -#undef atomic_dec_ulong -#undef atomic_dec_ptr -#undef atomic_dec_64 -#undef atomic_dec_32_nv -#undef atomic_dec_uint_nv -#undef atomic_dec_ulong_nv -#undef atomic_dec_ptr_nv -#undef atomic_dec_64_nv -#undef atomic_inc_32 -#undef atomic_inc_uint -#undef atomic_inc_ulong -#undef atomic_inc_ptr -#undef atomic_inc_64 -#undef atomic_inc_32_nv -#undef atomic_inc_uint_nv -#undef atomic_inc_ulong_nv -#undef atomic_inc_ptr_nv -#undef atomic_inc_64_nv +#include +#include -#define CSAN_ATOMIC_FUNC_ADD(name, tret, targ1, targ2) \ - void atomic_add_##name(volatile targ1 *, targ2); \ - void kcsan_atomic_add_##name(volatile targ1 *, targ2); \ - void kcsan_atomic_add_##name(volatile targ1 *ptr, targ2 val) \ - { \ - kcsan_access((uintptr_t)ptr, sizeof(tret), true, true, \ - __RET_ADDR); \ - atomic_add_##name(ptr, val); \ - } \ - tret atomic_add_##name##_nv(volatile targ1 *, targ2); \ - tret kcsan_atomic_add_##name##_nv(volatile targ1 *, targ2); \ - tret kcsan_atomic_add_##name##_nv(volatile targ1 *ptr, targ2 val) \ - { \ - kcsan_access((uintptr_t)ptr, sizeof(tret), true, true, \ - __RET_ADDR); \ - return atomic_add_##name##_nv(ptr, val); \ +#define _CSAN_ATOMIC_FUNC_ADD(name, type) \ + void kcsan_atomic_add_##name(volatile type *ptr, type val) \ + { \ + kcsan_access((uintptr_t)ptr, sizeof(type), true, true, \ + __RET_ADDR); \ + atomic_add_##name(ptr, val); \ } -#define CSAN_ATOMIC_FUNC_AND(name, tret, targ1, targ2) \ - void atomic_and_##name(volatile targ1 *, targ2); \ - void kcsan_atomic_and_##name(volatile targ1 *, targ2); \ - void kcsan_atomic_and_##name(volatile targ1 *ptr, targ2 val) \ - { \ - kcsan_access((uintptr_t)ptr, sizeof(tret), true, true, \ - __RET_ADDR); \ - atomic_and_##name(ptr, val); \ - } \ - tret atomic_and_##name##_nv(volatile targ1 *, targ2); \ - tret kcsan_atomic_and_##name##_nv(volatile targ1 *, targ2); \ - tret kcsan_atomic_and_##name##_nv(volatile targ1 *ptr, targ2 val) \ - { \ - kcsan_access((uintptr_t)ptr, sizeof(tret), true, true, \ - __RET_ADDR); \ - return atomic_and_##name##_nv(ptr, val); \ +#define CSAN_ATOMIC_FUNC_ADD(name, type) \ + _CSAN_ATOMIC_FUNC_ADD(name, type) \ + _CSAN_ATOMIC_FUNC_ADD(acq_##name, type) \ + _CSAN_ATOMIC_FUNC_ADD(rel_##name, type) + +#define _CSAN_ATOMIC_FUNC_CLEAR(name, type) \ + void kcsan_atomic_clear_##name(volatile type *ptr, type val) \ + { \ + kcsan_access((uintptr_t)ptr, sizeof(type), true, true, \ + __RET_ADDR); \ + atomic_clear_##name(ptr, val); \ } -#define CSAN_ATOMIC_FUNC_OR(name, tret, targ1, targ2) \ - void atomic_or_##name(volatile targ1 *, targ2); \ - void kcsan_atomic_or_##name(volatile targ1 *, targ2); \ - void kcsan_atomic_or_##name(volatile targ1 *ptr, targ2 val) \ - { \ - kcsan_access((uintptr_t)ptr, sizeof(tret), true, true, \ - __RET_ADDR); \ - atomic_or_##name(ptr, val); \ - } \ - tret atomic_or_##name##_nv(volatile targ1 *, targ2); \ - tret kcsan_atomic_or_##name##_nv(volatile targ1 *, targ2); \ - tret kcsan_atomic_or_##name##_nv(volatile targ1 *ptr, targ2 val) \ - { \ - kcsan_access((uintptr_t)ptr, sizeof(tret), true, true, \ - __RET_ADDR); \ - return atomic_or_##name##_nv(ptr, val); \ +#define CSAN_ATOMIC_FUNC_CLEAR(name, type) \ + _CSAN_ATOMIC_FUNC_CLEAR(name, type) \ + _CSAN_ATOMIC_FUNC_CLEAR(acq_##name, type) \ + _CSAN_ATOMIC_FUNC_CLEAR(rel_##name, type) + +#define _CSAN_ATOMIC_FUNC_CMPSET(name, type) \ + int kcsan_atomic_cmpset_##name(volatile type *ptr, type val1, \ + type val2) \ + { \ + kcsan_access((uintptr_t)ptr, sizeof(type), true, true, \ + __RET_ADDR); \ + return (atomic_cmpset_##name(ptr, val1, val2)); \ } -#define CSAN_ATOMIC_FUNC_CAS(name, tret, targ1, targ2) \ - tret atomic_cas_##name(volatile targ1 *, targ2, targ2); \ - tret kcsan_atomic_cas_##name(volatile targ1 *, targ2, targ2); \ - tret kcsan_atomic_cas_##name(volatile targ1 *ptr, targ2 exp, targ2 new) \ - { \ - kcsan_access((uintptr_t)ptr, sizeof(tret), true, true, \ - __RET_ADDR); \ - return atomic_cas_##name(ptr, exp, new); \ - } \ - tret atomic_cas_##name##_ni(volatile targ1 *, targ2, targ2); \ - tret kcsan_atomic_cas_##name##_ni(volatile targ1 *, targ2, targ2); \ - tret kcsan_atomic_cas_##name##_ni(volatile targ1 *ptr, targ2 exp, targ2 new) \ - { \ - kcsan_access((uintptr_t)ptr, sizeof(tret), true, true, \ - __RET_ADDR); \ - return atomic_cas_##name##_ni(ptr, exp, new); \ +#define CSAN_ATOMIC_FUNC_CMPSET(name, type) \ + _CSAN_ATOMIC_FUNC_CMPSET(name, type) \ + _CSAN_ATOMIC_FUNC_CMPSET(acq_##name, type) \ + _CSAN_ATOMIC_FUNC_CMPSET(rel_##name, type) + +#define _CSAN_ATOMIC_FUNC_FCMPSET(name, type) \ + int kcsan_atomic_fcmpset_##name(volatile type *ptr, type *val1, \ + type val2) \ + { \ + kcsan_access((uintptr_t)ptr, sizeof(type), true, true, \ + __RET_ADDR); \ + return (atomic_fcmpset_##name(ptr, val1, val2)); \ } -#define CSAN_ATOMIC_FUNC_SWAP(name, tret, targ1, targ2) \ - tret atomic_swap_##name(volatile targ1 *, targ2); \ - tret kcsan_atomic_swap_##name(volatile targ1 *, targ2); \ - tret kcsan_atomic_swap_##name(volatile targ1 *ptr, targ2 val) \ - { \ - kcsan_access((uintptr_t)ptr, sizeof(tret), true, true, \ - __RET_ADDR); \ - return atomic_swap_##name(ptr, val); \ +#define CSAN_ATOMIC_FUNC_FCMPSET(name, type) \ + _CSAN_ATOMIC_FUNC_FCMPSET(name, type) \ + _CSAN_ATOMIC_FUNC_FCMPSET(acq_##name, type) \ + _CSAN_ATOMIC_FUNC_FCMPSET(rel_##name, type) + +#define CSAN_ATOMIC_FUNC_FETCHADD(name, type) \ + type kcsan_atomic_fetchadd_##name(volatile type *ptr, type val) \ + { \ + kcsan_access((uintptr_t)ptr, sizeof(type), true, true, \ + __RET_ADDR); \ + return (atomic_fetchadd_##name(ptr, val)); \ } -#define CSAN_ATOMIC_FUNC_DEC(name, tret, targ1) \ - void atomic_dec_##name(volatile targ1 *); \ - void kcsan_atomic_dec_##name(volatile targ1 *); \ - void kcsan_atomic_dec_##name(volatile targ1 *ptr) \ - { \ - kcsan_access((uintptr_t)ptr, sizeof(tret), true, true, \ - __RET_ADDR); \ *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-all@freebsd.org Thu Nov 21 12:28:42 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id AE8E11BD006; Thu, 21 Nov 2019 12:28:42 +0000 (UTC) (envelope-from lwhsu@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47Jf4B45Q6z4KKl; Thu, 21 Nov 2019 12:28:42 +0000 (UTC) (envelope-from lwhsu@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 6CB3DB279; Thu, 21 Nov 2019 12:28:42 +0000 (UTC) (envelope-from lwhsu@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xALCSgPx088601; Thu, 21 Nov 2019 12:28:42 GMT (envelope-from lwhsu@FreeBSD.org) Received: (from lwhsu@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xALCSgpk088600; Thu, 21 Nov 2019 12:28:42 GMT (envelope-from lwhsu@FreeBSD.org) Message-Id: <201911211228.xALCSgpk088600@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: lwhsu set sender to lwhsu@FreeBSD.org using -f From: Li-Wen Hsu Date: Thu, 21 Nov 2019 12:28:42 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r354943 - stable/12/sys/conf X-SVN-Group: stable-12 X-SVN-Commit-Author: lwhsu X-SVN-Commit-Paths: stable/12/sys/conf X-SVN-Commit-Revision: 354943 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 21 Nov 2019 12:28:42 -0000 Author: lwhsu Date: Thu Nov 21 12:28:41 2019 New Revision: 354943 URL: https://svnweb.freebsd.org/changeset/base/354943 Log: MFC r354800: Also clean LINT64 kernel configuration for powerpc Sponsored by: The FreeBSD Foundation Modified: stable/12/sys/conf/makeLINT.mk Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/conf/makeLINT.mk ============================================================================== --- stable/12/sys/conf/makeLINT.mk Thu Nov 21 11:22:08 2019 (r354942) +++ stable/12/sys/conf/makeLINT.mk Thu Nov 21 12:28:41 2019 (r354943) @@ -14,6 +14,9 @@ clean: .if ${TARGET} == "arm" rm -f LINT-V5 LINT-V7 .endif +.if ${TARGET} == "powerpc" + rm -f LINT64 +.endif NOTES= ${.CURDIR}/../../conf/NOTES ${.CURDIR}/NOTES MAKELINT_SED= ${.CURDIR}/../../conf/makeLINT.sed From owner-svn-src-all@freebsd.org Thu Nov 21 12:29:01 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id D8DD51BD09D; Thu, 21 Nov 2019 12:29:01 +0000 (UTC) (envelope-from lwhsu@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47Jf4Y5V44z4KRw; Thu, 21 Nov 2019 12:29:01 +0000 (UTC) (envelope-from lwhsu@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id A024FB27B; Thu, 21 Nov 2019 12:29:01 +0000 (UTC) (envelope-from lwhsu@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xALCT1YF088662; Thu, 21 Nov 2019 12:29:01 GMT (envelope-from lwhsu@FreeBSD.org) Received: (from lwhsu@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xALCT1RZ088661; Thu, 21 Nov 2019 12:29:01 GMT (envelope-from lwhsu@FreeBSD.org) Message-Id: <201911211229.xALCT1RZ088661@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: lwhsu set sender to lwhsu@FreeBSD.org using -f From: Li-Wen Hsu Date: Thu, 21 Nov 2019 12:29:01 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r354944 - stable/11/sys/conf X-SVN-Group: stable-11 X-SVN-Commit-Author: lwhsu X-SVN-Commit-Paths: stable/11/sys/conf X-SVN-Commit-Revision: 354944 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 21 Nov 2019 12:29:01 -0000 Author: lwhsu Date: Thu Nov 21 12:29:01 2019 New Revision: 354944 URL: https://svnweb.freebsd.org/changeset/base/354944 Log: MFC r354800: Also clean LINT64 kernel configuration for powerpc Sponsored by: The FreeBSD Foundation Modified: stable/11/sys/conf/makeLINT.mk Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/conf/makeLINT.mk ============================================================================== --- stable/11/sys/conf/makeLINT.mk Thu Nov 21 12:28:41 2019 (r354943) +++ stable/11/sys/conf/makeLINT.mk Thu Nov 21 12:29:01 2019 (r354944) @@ -11,6 +11,9 @@ clean: .if ${TARGET} == "amd64" || ${TARGET} == "i386" rm -f LINT-VIMAGE LINT-NOINET LINT-NOINET6 LINT-NOIP .endif +.if ${TARGET} == "powerpc" + rm -f LINT64 +.endif NOTES= ${.CURDIR}/../../conf/NOTES ${.CURDIR}/NOTES MAKELINT_SED= ${.CURDIR}/../../conf/makeLINT.sed From owner-svn-src-all@freebsd.org Thu Nov 21 12:29:21 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 87F191BD114; Thu, 21 Nov 2019 12:29:21 +0000 (UTC) (envelope-from andrew@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47Jf4x32Xbz4KYy; Thu, 21 Nov 2019 12:29:21 +0000 (UTC) (envelope-from andrew@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4B676B27C; Thu, 21 Nov 2019 12:29:21 +0000 (UTC) (envelope-from andrew@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xALCTLLh088720; Thu, 21 Nov 2019 12:29:21 GMT (envelope-from andrew@FreeBSD.org) Received: (from andrew@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xALCTLaF088719; Thu, 21 Nov 2019 12:29:21 GMT (envelope-from andrew@FreeBSD.org) Message-Id: <201911211229.xALCTLaF088719@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: andrew set sender to andrew@FreeBSD.org using -f From: Andrew Turner Date: Thu, 21 Nov 2019 12:29:21 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354945 - head/sys/amd64/amd64 X-SVN-Group: head X-SVN-Commit-Author: andrew X-SVN-Commit-Paths: head/sys/amd64/amd64 X-SVN-Commit-Revision: 354945 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 21 Nov 2019 12:29:21 -0000 Author: andrew Date: Thu Nov 21 12:29:20 2019 New Revision: 354945 URL: https://svnweb.freebsd.org/changeset/base/354945 Log: Fix for style(9): use parentheses around return statements. Reported by: kib Sponsored by: DARPA, AFRL Modified: head/sys/amd64/amd64/machdep.c Modified: head/sys/amd64/amd64/machdep.c ============================================================================== --- head/sys/amd64/amd64/machdep.c Thu Nov 21 12:29:01 2019 (r354944) +++ head/sys/amd64/amd64/machdep.c Thu Nov 21 12:29:20 2019 (r354945) @@ -2742,21 +2742,21 @@ void * memset(void *buf, int c, size_t len) { - return memset_std(buf, c, len); + return (memset_std(buf, c, len)); } void * memmove(void * _Nonnull dst, const void * _Nonnull src, size_t len) { - return memmove_std(dst, src, len); + return (memmove_std(dst, src, len)); } void * memcpy(void * _Nonnull dst, const void * _Nonnull src, size_t len) { - return memcpy_std(dst, src, len); + return (memcpy_std(dst, src, len)); } #else DEFINE_IFUNC(, void *, memset, (void *, int, size_t)) From owner-svn-src-all@freebsd.org Thu Nov 21 13:12:59 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 90B6E1BE27D; Thu, 21 Nov 2019 13:12:59 +0000 (UTC) (envelope-from andrew@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47Jg3H3Q22z4Mg1; Thu, 21 Nov 2019 13:12:59 +0000 (UTC) (envelope-from andrew@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 5896CBD0A; Thu, 21 Nov 2019 13:12:59 +0000 (UTC) (envelope-from andrew@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xALDCx2H017835; Thu, 21 Nov 2019 13:12:59 GMT (envelope-from andrew@FreeBSD.org) Received: (from andrew@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xALDCxef017834; Thu, 21 Nov 2019 13:12:59 GMT (envelope-from andrew@FreeBSD.org) Message-Id: <201911211312.xALDCxef017834@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: andrew set sender to andrew@FreeBSD.org using -f From: Andrew Turner Date: Thu, 21 Nov 2019 13:12:59 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354946 - head/sys/kern X-SVN-Group: head X-SVN-Commit-Author: andrew X-SVN-Commit-Paths: head/sys/kern X-SVN-Commit-Revision: 354946 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 21 Nov 2019 13:12:59 -0000 Author: andrew Date: Thu Nov 21 13:12:58 2019 New Revision: 354946 URL: https://svnweb.freebsd.org/changeset/base/354946 Log: Fix the bus_space functions with KCSAN on arm64. Arm64 doesn't define the bus_space_set_multi_stream and bus_space_set_region_stream functions. Don't try to define them there. Sponsored by: DARPA, AFRL Modified: head/sys/kern/subr_csan.c Modified: head/sys/kern/subr_csan.c ============================================================================== --- head/sys/kern/subr_csan.c Thu Nov 21 12:29:20 2019 (r354945) +++ head/sys/kern/subr_csan.c Thu Nov 21 13:12:58 2019 (r354946) @@ -828,24 +828,32 @@ CSAN_BUS_WRITE_PTR_FUNC(region_stream, 8, uint64_t) } CSAN_BUS_SET_FUNC(multi, 1, uint8_t) -CSAN_BUS_SET_FUNC(multi_stream, 1, uint8_t) CSAN_BUS_SET_FUNC(region, 1, uint8_t) +#if !defined(__aarch64__) +CSAN_BUS_SET_FUNC(multi_stream, 1, uint8_t) CSAN_BUS_SET_FUNC(region_stream, 1, uint8_t) +#endif CSAN_BUS_SET_FUNC(multi, 2, uint16_t) -CSAN_BUS_SET_FUNC(multi_stream, 2, uint16_t) CSAN_BUS_SET_FUNC(region, 2, uint16_t) +#if !defined(__aarch64__) +CSAN_BUS_SET_FUNC(multi_stream, 2, uint16_t) CSAN_BUS_SET_FUNC(region_stream, 2, uint16_t) +#endif CSAN_BUS_SET_FUNC(multi, 4, uint32_t) -CSAN_BUS_SET_FUNC(multi_stream, 4, uint32_t) CSAN_BUS_SET_FUNC(region, 4, uint32_t) +#if !defined(__aarch64__) +CSAN_BUS_SET_FUNC(multi_stream, 4, uint32_t) CSAN_BUS_SET_FUNC(region_stream, 4, uint32_t) +#endif #if !defined(__amd64__) CSAN_BUS_SET_FUNC(multi, 8, uint64_t) -CSAN_BUS_SET_FUNC(multi_stream, 8, uint64_t) CSAN_BUS_SET_FUNC(region, 8, uint64_t) +#if !defined(__aarch64__) +CSAN_BUS_SET_FUNC(multi_stream, 8, uint64_t) CSAN_BUS_SET_FUNC(region_stream, 8, uint64_t) +#endif #endif From owner-svn-src-all@freebsd.org Thu Nov 21 13:22:24 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 93F3E1BE6B2; Thu, 21 Nov 2019 13:22:24 +0000 (UTC) (envelope-from andrew@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47JgG83VMKz4NDp; Thu, 21 Nov 2019 13:22:24 +0000 (UTC) (envelope-from andrew@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 5B338BEC6; Thu, 21 Nov 2019 13:22:24 +0000 (UTC) (envelope-from andrew@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xALDMOLR023514; Thu, 21 Nov 2019 13:22:24 GMT (envelope-from andrew@FreeBSD.org) Received: (from andrew@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xALDMNHa023512; Thu, 21 Nov 2019 13:22:23 GMT (envelope-from andrew@FreeBSD.org) Message-Id: <201911211322.xALDMNHa023512@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: andrew set sender to andrew@FreeBSD.org using -f From: Andrew Turner Date: Thu, 21 Nov 2019 13:22:23 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354947 - in head/sys: amd64/include arm64/include kern X-SVN-Group: head X-SVN-Commit-Author: andrew X-SVN-Commit-Paths: in head/sys: amd64/include arm64/include kern X-SVN-Commit-Revision: 354947 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 21 Nov 2019 13:22:24 -0000 Author: andrew Date: Thu Nov 21 13:22:23 2019 New Revision: 354947 URL: https://svnweb.freebsd.org/changeset/base/354947 Log: Add kcsan_md_unsupported from NetBSD. It's used to ignore virtual addresses that may have a different physical address depending on the CPU. Sponsored by: DARPA, AFRL Modified: head/sys/amd64/include/csan.h head/sys/arm64/include/csan.h head/sys/kern/subr_csan.c Modified: head/sys/amd64/include/csan.h ============================================================================== --- head/sys/amd64/include/csan.h Thu Nov 21 13:12:58 2019 (r354946) +++ head/sys/amd64/include/csan.h Thu Nov 21 13:22:23 2019 (r354947) @@ -36,6 +36,12 @@ #include static inline bool +kcsan_md_unsupported(vm_offset_t addr) +{ + return false; +} + +static inline bool kcsan_md_is_avail(void) { return true; Modified: head/sys/arm64/include/csan.h ============================================================================== --- head/sys/arm64/include/csan.h Thu Nov 21 13:12:58 2019 (r354946) +++ head/sys/arm64/include/csan.h Thu Nov 21 13:22:23 2019 (r354947) @@ -36,6 +36,12 @@ #include static inline bool +kcsan_md_unsupported(vm_offset_t addr) +{ + return false; +} + +static inline bool kcsan_md_is_avail(void) { return true; Modified: head/sys/kern/subr_csan.c ============================================================================== --- head/sys/kern/subr_csan.c Thu Nov 21 13:12:58 2019 (r354946) +++ head/sys/kern/subr_csan.c Thu Nov 21 13:22:23 2019 (r354947) @@ -151,6 +151,8 @@ kcsan_access(uintptr_t addr, size_t size, bool write, if (__predict_false(!kcsan_enabled)) return; + if (__predict_false(kcsan_md_unsupported((vm_offset_t)addr))) + return; new.addr = addr; new.size = size; From owner-svn-src-all@freebsd.org Thu Nov 21 13:35:44 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id C391F1BECA9; Thu, 21 Nov 2019 13:35:44 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47JgYX5ZF0z4Nym; Thu, 21 Nov 2019 13:35:44 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id A2E42C0B4; Thu, 21 Nov 2019 13:35:44 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xALDZifW029494; Thu, 21 Nov 2019 13:35:44 GMT (envelope-from avg@FreeBSD.org) Received: (from avg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xALDZikp029490; Thu, 21 Nov 2019 13:35:44 GMT (envelope-from avg@FreeBSD.org) Message-Id: <201911211335.xALDZikp029490@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avg set sender to avg@FreeBSD.org using -f From: Andriy Gapon Date: Thu, 21 Nov 2019 13:35:44 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354948 - in head: cddl/contrib/opensolaris/cmd/zdb sys/cddl/contrib/opensolaris/uts/common/fs/zfs sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys X-SVN-Group: head X-SVN-Commit-Author: avg X-SVN-Commit-Paths: in head: cddl/contrib/opensolaris/cmd/zdb sys/cddl/contrib/opensolaris/uts/common/fs/zfs sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys X-SVN-Commit-Revision: 354948 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 21 Nov 2019 13:35:44 -0000 Author: avg Date: Thu Nov 21 13:35:43 2019 New Revision: 354948 URL: https://svnweb.freebsd.org/changeset/base/354948 Log: MFV r354383: 10592 misc. metaslab and vdev related ZoL bug fixes illumos/illumos-gate@555d674d5d4b8191dc83723188349d28278b2431 https://github.com/illumos/illumos-gate/commit/555d674d5d4b8191dc83723188349d28278b2431 https://www.illumos.org/issues/10592 This is a collection of recent fixes from ZoL: 8eef997679b Error path in metaslab_load_impl() forgets to drop ms_sync_lock 928e8ad47d3 Introduce auxiliary metaslab histograms 425d3237ee8 Get rid of space_map_update() for ms_synced_length 6c926f426a2 Simplify log vdev removal code 21e7cf5da89 zdb -L should skip leak detection altogether df72b8bebe0 Rename range_tree_verify to range_tree_verify_not_present 75058f33034 Remove unused vdev_t fields Portions contributed by: Jerry Jelinek Author: Serapheim Dimitropoulos MFC after: 4 weeks Modified: head/cddl/contrib/opensolaris/cmd/zdb/zdb.8 head/cddl/contrib/opensolaris/cmd/zdb/zdb.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/metaslab.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/range_tree.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa_checkpoint.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/space_map.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/metaslab.h head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/metaslab_impl.h head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/range_tree.h head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/space_map.h head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/vdev_impl.h head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_indirect.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_indirect_mapping.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_initialize.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_removal.c Directory Properties: head/cddl/contrib/opensolaris/ (props changed) head/cddl/contrib/opensolaris/cmd/zdb/ (props changed) head/sys/cddl/contrib/opensolaris/ (props changed) Modified: head/cddl/contrib/opensolaris/cmd/zdb/zdb.8 ============================================================================== --- head/cddl/contrib/opensolaris/cmd/zdb/zdb.8 Thu Nov 21 13:22:23 2019 (r354947) +++ head/cddl/contrib/opensolaris/cmd/zdb/zdb.8 Thu Nov 21 13:35:43 2019 (r354948) @@ -10,7 +10,7 @@ .\" .\" .\" Copyright 2012, Richard Lowe. -.\" Copyright (c) 2012, 2017 by Delphix. All rights reserved. +.\" Copyright (c) 2012, 2018 by Delphix. All rights reserved. .\" Copyright 2017 Nexenta Systems, Inc. .\" .Dd October 06, 2017 @@ -187,7 +187,7 @@ If the .Fl u option is also specified, also display the uberblocks on this device. .It Fl L -Disable leak tracing and the loading of space maps. +Disable leak detection and the loading of space maps. By default, .Nm verifies that all non-free blocks are referenced, which can be very expensive. Modified: head/cddl/contrib/opensolaris/cmd/zdb/zdb.c ============================================================================== --- head/cddl/contrib/opensolaris/cmd/zdb/zdb.c Thu Nov 21 13:22:23 2019 (r354947) +++ head/cddl/contrib/opensolaris/cmd/zdb/zdb.c Thu Nov 21 13:35:43 2019 (r354948) @@ -785,18 +785,21 @@ dump_spacemap(objset_t *os, space_map_t *sm) return; (void) printf("space map object %llu:\n", - (longlong_t)sm->sm_phys->smp_object); - (void) printf(" smp_objsize = 0x%llx\n", - (longlong_t)sm->sm_phys->smp_objsize); + (longlong_t)sm->sm_object); + (void) printf(" smp_length = 0x%llx\n", + (longlong_t)sm->sm_phys->smp_length); (void) printf(" smp_alloc = 0x%llx\n", (longlong_t)sm->sm_phys->smp_alloc); + if (dump_opt['d'] < 6 && dump_opt['m'] < 4) + return; + /* * Print out the freelist entries in both encoded and decoded form. */ uint8_t mapshift = sm->sm_shift; int64_t alloc = 0; - uint64_t word; + uint64_t word, entry_id = 0; for (uint64_t offset = 0; offset < space_map_length(sm); offset += sizeof (word)) { @@ -804,11 +807,12 @@ dump_spacemap(objset_t *os, space_map_t *sm) sizeof (word), &word, DMU_READ_PREFETCH)); if (sm_entry_is_debug(word)) { - (void) printf("\t [%6llu] %s: txg %llu, pass %llu\n", - (u_longlong_t)(offset / sizeof (word)), + (void) printf("\t [%6llu] %s: txg %llu pass %llu\n", + (u_longlong_t)entry_id, ddata[SM_DEBUG_ACTION_DECODE(word)], (u_longlong_t)SM_DEBUG_TXG_DECODE(word), (u_longlong_t)SM_DEBUG_SYNCPASS_DECODE(word)); + entry_id++; continue; } @@ -846,7 +850,7 @@ dump_spacemap(objset_t *os, space_map_t *sm) (void) printf("\t [%6llu] %c range:" " %010llx-%010llx size: %06llx vdev: %06llu words: %u\n", - (u_longlong_t)(offset / sizeof (word)), + (u_longlong_t)entry_id, entry_type, (u_longlong_t)entry_off, (u_longlong_t)(entry_off + entry_run), (u_longlong_t)entry_run, @@ -856,8 +860,9 @@ dump_spacemap(objset_t *os, space_map_t *sm) alloc += entry_run; else alloc -= entry_run; + entry_id++; } - if ((uint64_t)alloc != space_map_allocated(sm)) { + if (alloc != space_map_allocated(sm)) { (void) printf("space_map_object alloc (%lld) INCONSISTENT " "with space map summary (%lld)\n", (longlong_t)space_map_allocated(sm), (longlong_t)alloc); @@ -921,11 +926,8 @@ dump_metaslab(metaslab_t *msp) SPACE_MAP_HISTOGRAM_SIZE, sm->sm_shift); } - if (dump_opt['d'] > 5 || dump_opt['m'] > 3) { - ASSERT(msp->ms_size == (1ULL << vd->vdev_ms_shift)); - - dump_spacemap(spa->spa_meta_objset, msp->ms_sm); - } + ASSERT(msp->ms_size == (1ULL << vd->vdev_ms_shift)); + dump_spacemap(spa->spa_meta_objset, msp->ms_sm); } static void @@ -3140,6 +3142,8 @@ zdb_ddt_leak_init(spa_t *spa, zdb_cb_t *zcb) ddt_entry_t dde; int error; + ASSERT(!dump_opt['L']); + bzero(&ddb, sizeof (ddb)); while ((error = ddt_walk(spa, &ddb, &dde)) == 0) { blkptr_t blk; @@ -3163,12 +3167,10 @@ zdb_ddt_leak_init(spa_t *spa, zdb_cb_t *zcb) zcb->zcb_dedup_blocks++; } } - if (!dump_opt['L']) { - ddt_t *ddt = spa->spa_ddt[ddb.ddb_checksum]; - ddt_enter(ddt); - VERIFY(ddt_lookup(ddt, &blk, B_TRUE) != NULL); - ddt_exit(ddt); - } + ddt_t *ddt = spa->spa_ddt[ddb.ddb_checksum]; + ddt_enter(ddt); + VERIFY(ddt_lookup(ddt, &blk, B_TRUE) != NULL); + ddt_exit(ddt); } ASSERT(error == ENOENT); @@ -3210,6 +3212,9 @@ claim_segment_cb(void *arg, uint64_t offset, uint64_t static void zdb_claim_removing(spa_t *spa, zdb_cb_t *zcb) { + if (dump_opt['L']) + return; + if (spa->spa_vdev_removal == NULL) return; @@ -3301,7 +3306,6 @@ zdb_load_obsolete_counts(vdev_t *vd) space_map_t *prev_obsolete_sm = NULL; VERIFY0(space_map_open(&prev_obsolete_sm, spa->spa_meta_objset, scip->scip_prev_obsolete_sm_object, 0, vd->vdev_asize, 0)); - space_map_update(prev_obsolete_sm); vdev_indirect_mapping_load_obsolete_spacemap(vim, counts, prev_obsolete_sm); space_map_close(prev_obsolete_sm); @@ -3395,9 +3399,9 @@ zdb_leak_init_vdev_exclude_checkpoint(vdev_t *vd, zdb_ VERIFY0(space_map_open(&checkpoint_sm, spa_meta_objset(spa), checkpoint_sm_obj, 0, vd->vdev_asize, vd->vdev_ashift)); - space_map_update(checkpoint_sm); VERIFY0(space_map_iterate(checkpoint_sm, + space_map_length(checkpoint_sm), checkpoint_sm_exclude_entry_cb, &cseea)); space_map_close(checkpoint_sm); @@ -3407,6 +3411,8 @@ zdb_leak_init_vdev_exclude_checkpoint(vdev_t *vd, zdb_ static void zdb_leak_init_exclude_checkpoint(spa_t *spa, zdb_cb_t *zcb) { + ASSERT(!dump_opt['L']); + vdev_t *rvd = spa->spa_root_vdev; for (uint64_t c = 0; c < rvd->vdev_children; c++) { ASSERT3U(c, ==, rvd->vdev_child[c]->vdev_id); @@ -3503,6 +3509,8 @@ load_indirect_ms_allocatable_tree(vdev_t *vd, metaslab static void zdb_leak_init_prepare_indirect_vdevs(spa_t *spa, zdb_cb_t *zcb) { + ASSERT(!dump_opt['L']); + vdev_t *rvd = spa->spa_root_vdev; for (uint64_t c = 0; c < rvd->vdev_children; c++) { vdev_t *vd = rvd->vdev_child[c]; @@ -3549,67 +3557,63 @@ zdb_leak_init(spa_t *spa, zdb_cb_t *zcb) { zcb->zcb_spa = spa; - if (!dump_opt['L']) { - dsl_pool_t *dp = spa->spa_dsl_pool; - vdev_t *rvd = spa->spa_root_vdev; + if (dump_opt['L']) + return; - /* - * We are going to be changing the meaning of the metaslab's - * ms_allocatable. Ensure that the allocator doesn't try to - * use the tree. - */ - spa->spa_normal_class->mc_ops = &zdb_metaslab_ops; - spa->spa_log_class->mc_ops = &zdb_metaslab_ops; + dsl_pool_t *dp = spa->spa_dsl_pool; + vdev_t *rvd = spa->spa_root_vdev; - zcb->zcb_vd_obsolete_counts = - umem_zalloc(rvd->vdev_children * sizeof (uint32_t *), - UMEM_NOFAIL); + /* + * We are going to be changing the meaning of the metaslab's + * ms_allocatable. Ensure that the allocator doesn't try to + * use the tree. + */ + spa->spa_normal_class->mc_ops = &zdb_metaslab_ops; + spa->spa_log_class->mc_ops = &zdb_metaslab_ops; - /* - * For leak detection, we overload the ms_allocatable trees - * to contain allocated segments instead of free segments. - * As a result, we can't use the normal metaslab_load/unload - * interfaces. - */ - zdb_leak_init_prepare_indirect_vdevs(spa, zcb); - load_concrete_ms_allocatable_trees(spa, SM_ALLOC); + zcb->zcb_vd_obsolete_counts = + umem_zalloc(rvd->vdev_children * sizeof (uint32_t *), + UMEM_NOFAIL); - /* - * On load_concrete_ms_allocatable_trees() we loaded all the - * allocated entries from the ms_sm to the ms_allocatable for - * each metaslab. If the pool has a checkpoint or is in the - * middle of discarding a checkpoint, some of these blocks - * may have been freed but their ms_sm may not have been - * updated because they are referenced by the checkpoint. In - * order to avoid false-positives during leak-detection, we - * go through the vdev's checkpoint space map and exclude all - * its entries from their relevant ms_allocatable. - * - * We also aggregate the space held by the checkpoint and add - * it to zcb_checkpoint_size. - * - * Note that at this point we are also verifying that all the - * entries on the checkpoint_sm are marked as allocated in - * the ms_sm of their relevant metaslab. - * [see comment in checkpoint_sm_exclude_entry_cb()] - */ - zdb_leak_init_exclude_checkpoint(spa, zcb); + /* + * For leak detection, we overload the ms_allocatable trees + * to contain allocated segments instead of free segments. + * As a result, we can't use the normal metaslab_load/unload + * interfaces. + */ + zdb_leak_init_prepare_indirect_vdevs(spa, zcb); + load_concrete_ms_allocatable_trees(spa, SM_ALLOC); - /* for cleaner progress output */ - (void) fprintf(stderr, "\n"); + /* + * On load_concrete_ms_allocatable_trees() we loaded all the + * allocated entries from the ms_sm to the ms_allocatable for + * each metaslab. If the pool has a checkpoint or is in the + * middle of discarding a checkpoint, some of these blocks + * may have been freed but their ms_sm may not have been + * updated because they are referenced by the checkpoint. In + * order to avoid false-positives during leak-detection, we + * go through the vdev's checkpoint space map and exclude all + * its entries from their relevant ms_allocatable. + * + * We also aggregate the space held by the checkpoint and add + * it to zcb_checkpoint_size. + * + * Note that at this point we are also verifying that all the + * entries on the checkpoint_sm are marked as allocated in + * the ms_sm of their relevant metaslab. + * [see comment in checkpoint_sm_exclude_entry_cb()] + */ + zdb_leak_init_exclude_checkpoint(spa, zcb); + ASSERT3U(zcb->zcb_checkpoint_size, ==, spa_get_checkpoint_space(spa)); - if (bpobj_is_open(&dp->dp_obsolete_bpobj)) { - ASSERT(spa_feature_is_enabled(spa, - SPA_FEATURE_DEVICE_REMOVAL)); - (void) bpobj_iterate_nofree(&dp->dp_obsolete_bpobj, - increment_indirect_mapping_cb, zcb, NULL); - } - } else { - /* - * If leak tracing is disabled, we still need to consider - * any checkpointed space in our space verification. - */ - zcb->zcb_checkpoint_size += spa_get_checkpoint_space(spa); + /* for cleaner progress output */ + (void) fprintf(stderr, "\n"); + + if (bpobj_is_open(&dp->dp_obsolete_bpobj)) { + ASSERT(spa_feature_is_enabled(spa, + SPA_FEATURE_DEVICE_REMOVAL)); + (void) bpobj_iterate_nofree(&dp->dp_obsolete_bpobj, + increment_indirect_mapping_cb, zcb, NULL); } spa_config_enter(spa, SCL_CONFIG, FTAG, RW_READER); @@ -3690,52 +3694,58 @@ zdb_check_for_obsolete_leaks(vdev_t *vd, zdb_cb_t *zcb static boolean_t zdb_leak_fini(spa_t *spa, zdb_cb_t *zcb) { + if (dump_opt['L']) + return (B_FALSE); + boolean_t leaks = B_FALSE; - if (!dump_opt['L']) { - vdev_t *rvd = spa->spa_root_vdev; - for (unsigned c = 0; c < rvd->vdev_children; c++) { - vdev_t *vd = rvd->vdev_child[c]; - metaslab_group_t *mg = vd->vdev_mg; - if (zcb->zcb_vd_obsolete_counts[c] != NULL) { - leaks |= zdb_check_for_obsolete_leaks(vd, zcb); - } + vdev_t *rvd = spa->spa_root_vdev; + for (unsigned c = 0; c < rvd->vdev_children; c++) { + vdev_t *vd = rvd->vdev_child[c]; +#if DEBUG + metaslab_group_t *mg = vd->vdev_mg; +#endif - for (uint64_t m = 0; m < vd->vdev_ms_count; m++) { - metaslab_t *msp = vd->vdev_ms[m]; - ASSERT3P(mg, ==, msp->ms_group); + if (zcb->zcb_vd_obsolete_counts[c] != NULL) { + leaks |= zdb_check_for_obsolete_leaks(vd, zcb); + } - /* - * ms_allocatable has been overloaded - * to contain allocated segments. Now that - * we finished traversing all blocks, any - * block that remains in the ms_allocatable - * represents an allocated block that we - * did not claim during the traversal. - * Claimed blocks would have been removed - * from the ms_allocatable. For indirect - * vdevs, space remaining in the tree - * represents parts of the mapping that are - * not referenced, which is not a bug. - */ - if (vd->vdev_ops == &vdev_indirect_ops) { - range_tree_vacate(msp->ms_allocatable, - NULL, NULL); - } else { - range_tree_vacate(msp->ms_allocatable, - zdb_leak, vd); - } + for (uint64_t m = 0; m < vd->vdev_ms_count; m++) { + metaslab_t *msp = vd->vdev_ms[m]; + ASSERT3P(mg, ==, msp->ms_group); - if (msp->ms_loaded) { - msp->ms_loaded = B_FALSE; - } + /* + * ms_allocatable has been overloaded + * to contain allocated segments. Now that + * we finished traversing all blocks, any + * block that remains in the ms_allocatable + * represents an allocated block that we + * did not claim during the traversal. + * Claimed blocks would have been removed + * from the ms_allocatable. For indirect + * vdevs, space remaining in the tree + * represents parts of the mapping that are + * not referenced, which is not a bug. + */ + if (vd->vdev_ops == &vdev_indirect_ops) { + range_tree_vacate(msp->ms_allocatable, + NULL, NULL); + } else { + range_tree_vacate(msp->ms_allocatable, + zdb_leak, vd); } + + if (msp->ms_loaded) { + msp->ms_loaded = B_FALSE; + } } - umem_free(zcb->zcb_vd_obsolete_counts, - rvd->vdev_children * sizeof (uint32_t *)); - zcb->zcb_vd_obsolete_counts = NULL; } + + umem_free(zcb->zcb_vd_obsolete_counts, + rvd->vdev_children * sizeof (uint32_t *)); + zcb->zcb_vd_obsolete_counts = NULL; + return (leaks); } @@ -3774,13 +3784,18 @@ dump_block_stats(spa_t *spa) !dump_opt['L'] ? "nothing leaked " : ""); /* - * Load all space maps as SM_ALLOC maps, then traverse the pool - * claiming each block we discover. If the pool is perfectly - * consistent, the space maps will be empty when we're done. - * Anything left over is a leak; any block we can't claim (because - * it's not part of any space map) is a double allocation, - * reference to a freed block, or an unclaimed log block. + * When leak detection is enabled we load all space maps as SM_ALLOC + * maps, then traverse the pool claiming each block we discover. If + * the pool is perfectly consistent, the segment trees will be empty + * when we're done. Anything left over is a leak; any block we can't + * claim (because it's not part of any space map) is a double + * allocation, reference to a freed block, or an unclaimed log block. + * + * When leak detection is disabled (-L option) we still traverse the + * pool claiming each block we discover, but we skip opening any space + * maps. */ + bzero(&zcb, sizeof (zdb_cb_t)); zdb_leak_init(spa, &zcb); /* @@ -3859,11 +3874,10 @@ dump_block_stats(spa_t *spa) total_found = tzb->zb_asize - zcb.zcb_dedup_asize + zcb.zcb_removing_size + zcb.zcb_checkpoint_size; - if (total_found == total_alloc) { - if (!dump_opt['L']) - (void) printf("\n\tNo leaks (block sum matches space" - " maps exactly)\n"); - } else { + if (total_found == total_alloc && !dump_opt['L']) { + (void) printf("\n\tNo leaks (block sum matches space" + " maps exactly)\n"); + } else if (!dump_opt['L']) { (void) printf("block traversal size %llu != alloc %llu " "(%s %lld)\n", (u_longlong_t)total_found, @@ -4203,7 +4217,6 @@ verify_device_removal_feature_counts(spa_t *spa) spa->spa_meta_objset, scip->scip_prev_obsolete_sm_object, 0, vd->vdev_asize, 0)); - space_map_update(prev_obsolete_sm); dump_spacemap(spa->spa_meta_objset, prev_obsolete_sm); (void) printf("\n"); space_map_close(prev_obsolete_sm); @@ -4409,7 +4422,8 @@ verify_checkpoint_sm_entry_cb(space_map_entry_t *sme, * their respective ms_allocateable trees should not contain them. */ mutex_enter(&ms->ms_lock); - range_tree_verify(ms->ms_allocatable, sme->sme_offset, sme->sme_run); + range_tree_verify_not_present(ms->ms_allocatable, + sme->sme_offset, sme->sme_run); mutex_exit(&ms->ms_lock); return (0); @@ -4472,7 +4486,6 @@ verify_checkpoint_vdev_spacemaps(spa_t *checkpoint, sp VERIFY0(space_map_open(&checkpoint_sm, spa_meta_objset(current), checkpoint_sm_obj, 0, current_vd->vdev_asize, current_vd->vdev_ashift)); - space_map_update(checkpoint_sm); verify_checkpoint_sm_entry_cb_arg_t vcsec; vcsec.vcsec_vd = ckpoint_vd; @@ -4480,6 +4493,7 @@ verify_checkpoint_vdev_spacemaps(spa_t *checkpoint, sp vcsec.vcsec_num_entries = space_map_length(checkpoint_sm) / sizeof (uint64_t); VERIFY0(space_map_iterate(checkpoint_sm, + space_map_length(checkpoint_sm), verify_checkpoint_sm_entry_cb, &vcsec)); dump_spacemap(current->spa_meta_objset, checkpoint_sm); space_map_close(checkpoint_sm); @@ -4559,7 +4573,7 @@ verify_checkpoint_ms_spacemaps(spa_t *checkpoint, spa_ * are part of the checkpoint were freed by mistake. */ range_tree_walk(ckpoint_msp->ms_allocatable, - (range_tree_func_t *)range_tree_verify, + (range_tree_func_t *)range_tree_verify_not_present, current_msp->ms_allocatable); } } @@ -4571,6 +4585,8 @@ verify_checkpoint_ms_spacemaps(spa_t *checkpoint, spa_ static void verify_checkpoint_blocks(spa_t *spa) { + ASSERT(!dump_opt['L']); + spa_t *checkpoint_spa; char *checkpoint_pool; nvlist_t *config = NULL; @@ -4636,7 +4652,6 @@ dump_leftover_checkpoint_blocks(spa_t *spa) VERIFY0(space_map_open(&checkpoint_sm, spa_meta_objset(spa), checkpoint_sm_obj, 0, vd->vdev_asize, vd->vdev_ashift)); - space_map_update(checkpoint_sm); dump_spacemap(spa->spa_meta_objset, checkpoint_sm); space_map_close(checkpoint_sm); } Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/metaslab.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/metaslab.c Thu Nov 21 13:22:23 2019 (r354947) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/metaslab.c Thu Nov 21 13:35:43 2019 (r354948) @@ -584,45 +584,62 @@ metaslab_compare(const void *x1, const void *x2) return (AVL_CMP(m1->ms_start, m2->ms_start)); } +uint64_t +metaslab_allocated_space(metaslab_t *msp) +{ + return (msp->ms_allocated_space); +} + /* * Verify that the space accounting on disk matches the in-core range_trees. */ -void +static void metaslab_verify_space(metaslab_t *msp, uint64_t txg) { spa_t *spa = msp->ms_group->mg_vd->vdev_spa; - uint64_t allocated = 0; + uint64_t allocating = 0; uint64_t sm_free_space, msp_free_space; ASSERT(MUTEX_HELD(&msp->ms_lock)); + ASSERT(!msp->ms_condensing); if ((zfs_flags & ZFS_DEBUG_METASLAB_VERIFY) == 0) return; /* * We can only verify the metaslab space when we're called - * from syncing context with a loaded metaslab that has an allocated - * space map. Calling this in non-syncing context does not - * provide a consistent view of the metaslab since we're performing - * allocations in the future. + * from syncing context with a loaded metaslab that has an + * allocated space map. Calling this in non-syncing context + * does not provide a consistent view of the metaslab since + * we're performing allocations in the future. */ if (txg != spa_syncing_txg(spa) || msp->ms_sm == NULL || !msp->ms_loaded) return; - sm_free_space = msp->ms_size - space_map_allocated(msp->ms_sm) - - space_map_alloc_delta(msp->ms_sm); + /* + * Even though the smp_alloc field can get negative (e.g. + * see vdev_checkpoint_sm), that should never be the case + * when it come's to a metaslab's space map. + */ + ASSERT3S(space_map_allocated(msp->ms_sm), >=, 0); + sm_free_space = msp->ms_size - metaslab_allocated_space(msp); + /* - * Account for future allocations since we would have already - * deducted that space from the ms_freetree. + * Account for future allocations since we would have + * already deducted that space from the ms_allocatable. */ for (int t = 0; t < TXG_CONCURRENT_STATES; t++) { - allocated += + allocating += range_tree_space(msp->ms_allocating[(txg + t) & TXG_MASK]); } - msp_free_space = range_tree_space(msp->ms_allocatable) + allocated + + ASSERT3U(msp->ms_deferspace, ==, + range_tree_space(msp->ms_defer[0]) + + range_tree_space(msp->ms_defer[1])); + + msp_free_space = range_tree_space(msp->ms_allocatable) + allocating + msp->ms_deferspace + range_tree_space(msp->ms_freed); VERIFY3U(sm_free_space, ==, msp_free_space); @@ -929,6 +946,7 @@ metaslab_group_histogram_verify(metaslab_group_t *mg) for (int m = 0; m < vd->vdev_ms_count; m++) { metaslab_t *msp = vd->vdev_ms[m]; + ASSERT(msp != NULL); /* skip if not active or not a member */ if (msp->ms_sm == NULL || msp->ms_group != mg) @@ -1470,7 +1488,204 @@ metaslab_ops_t *zfs_metaslab_ops = &metaslab_df_ops; * ========================================================================== */ +static void +metaslab_aux_histograms_clear(metaslab_t *msp) +{ + /* + * Auxiliary histograms are only cleared when resetting them, + * which can only happen while the metaslab is loaded. + */ + ASSERT(msp->ms_loaded); + + bzero(msp->ms_synchist, sizeof (msp->ms_synchist)); + for (int t = 0; t < TXG_DEFER_SIZE; t++) + bzero(msp->ms_deferhist[t], sizeof (msp->ms_deferhist[t])); +} + +static void +metaslab_aux_histogram_add(uint64_t *histogram, uint64_t shift, + range_tree_t *rt) +{ + /* + * This is modeled after space_map_histogram_add(), so refer to that + * function for implementation details. We want this to work like + * the space map histogram, and not the range tree histogram, as we + * are essentially constructing a delta that will be later subtracted + * from the space map histogram. + */ + int idx = 0; + for (int i = shift; i < RANGE_TREE_HISTOGRAM_SIZE; i++) { + ASSERT3U(i, >=, idx + shift); + histogram[idx] += rt->rt_histogram[i] << (i - idx - shift); + + if (idx < SPACE_MAP_HISTOGRAM_SIZE - 1) { + ASSERT3U(idx + shift, ==, i); + idx++; + ASSERT3U(idx, <, SPACE_MAP_HISTOGRAM_SIZE); + } + } +} + /* + * Called at every sync pass that the metaslab gets synced. + * + * The reason is that we want our auxiliary histograms to be updated + * wherever the metaslab's space map histogram is updated. This way + * we stay consistent on which parts of the metaslab space map's + * histogram are currently not available for allocations (e.g because + * they are in the defer, freed, and freeing trees). + */ +static void +metaslab_aux_histograms_update(metaslab_t *msp) +{ + space_map_t *sm = msp->ms_sm; + ASSERT(sm != NULL); + + /* + * This is similar to the metaslab's space map histogram updates + * that take place in metaslab_sync(). The only difference is that + * we only care about segments that haven't made it into the + * ms_allocatable tree yet. + */ + if (msp->ms_loaded) { + metaslab_aux_histograms_clear(msp); + + metaslab_aux_histogram_add(msp->ms_synchist, + sm->sm_shift, msp->ms_freed); + + for (int t = 0; t < TXG_DEFER_SIZE; t++) { + metaslab_aux_histogram_add(msp->ms_deferhist[t], + sm->sm_shift, msp->ms_defer[t]); + } + } + + metaslab_aux_histogram_add(msp->ms_synchist, + sm->sm_shift, msp->ms_freeing); +} + +/* + * Called every time we are done syncing (writing to) the metaslab, + * i.e. at the end of each sync pass. + * [see the comment in metaslab_impl.h for ms_synchist, ms_deferhist] + */ +static void +metaslab_aux_histograms_update_done(metaslab_t *msp, boolean_t defer_allowed) +{ + spa_t *spa = msp->ms_group->mg_vd->vdev_spa; + space_map_t *sm = msp->ms_sm; + + if (sm == NULL) { + /* + * We came here from metaslab_init() when creating/opening a + * pool, looking at a metaslab that hasn't had any allocations + * yet. + */ + return; + } + + /* + * This is similar to the actions that we take for the ms_freed + * and ms_defer trees in metaslab_sync_done(). + */ + uint64_t hist_index = spa_syncing_txg(spa) % TXG_DEFER_SIZE; + if (defer_allowed) { + bcopy(msp->ms_synchist, msp->ms_deferhist[hist_index], + sizeof (msp->ms_synchist)); + } else { + bzero(msp->ms_deferhist[hist_index], + sizeof (msp->ms_deferhist[hist_index])); + } + bzero(msp->ms_synchist, sizeof (msp->ms_synchist)); +} + +/* + * Ensure that the metaslab's weight and fragmentation are consistent + * with the contents of the histogram (either the range tree's histogram + * or the space map's depending whether the metaslab is loaded). + */ +static void +metaslab_verify_weight_and_frag(metaslab_t *msp) +{ + ASSERT(MUTEX_HELD(&msp->ms_lock)); + + if ((zfs_flags & ZFS_DEBUG_METASLAB_VERIFY) == 0) + return; + + /* see comment in metaslab_verify_unflushed_changes() */ + if (msp->ms_group == NULL) + return; + + /* + * Devices being removed always return a weight of 0 and leave + * fragmentation and ms_max_size as is - there is nothing for + * us to verify here. + */ + vdev_t *vd = msp->ms_group->mg_vd; + if (vd->vdev_removing) + return; + + /* + * If the metaslab is dirty it probably means that we've done + * some allocations or frees that have changed our histograms + * and thus the weight. + */ + for (int t = 0; t < TXG_SIZE; t++) { + if (txg_list_member(&vd->vdev_ms_list, msp, t)) + return; + } + + /* + * This verification checks that our in-memory state is consistent + * with what's on disk. If the pool is read-only then there aren't + * any changes and we just have the initially-loaded state. + */ + if (!spa_writeable(msp->ms_group->mg_vd->vdev_spa)) + return; + + /* some extra verification for in-core tree if you can */ + if (msp->ms_loaded) { + range_tree_stat_verify(msp->ms_allocatable); + VERIFY(space_map_histogram_verify(msp->ms_sm, + msp->ms_allocatable)); + } + + uint64_t weight = msp->ms_weight; + uint64_t was_active = msp->ms_weight & METASLAB_ACTIVE_MASK; + boolean_t space_based = WEIGHT_IS_SPACEBASED(msp->ms_weight); + uint64_t frag = msp->ms_fragmentation; + uint64_t max_segsize = msp->ms_max_size; + + msp->ms_weight = 0; + msp->ms_fragmentation = 0; + msp->ms_max_size = 0; + + /* + * This function is used for verification purposes. Regardless of + * whether metaslab_weight() thinks this metaslab should be active or + * not, we want to ensure that the actual weight (and therefore the + * value of ms_weight) would be the same if it was to be recalculated + * at this point. + */ + msp->ms_weight = metaslab_weight(msp) | was_active; + + VERIFY3U(max_segsize, ==, msp->ms_max_size); + + /* + * If the weight type changed then there is no point in doing + * verification. Revert fields to their original values. + */ + if ((space_based && !WEIGHT_IS_SPACEBASED(msp->ms_weight)) || + (!space_based && WEIGHT_IS_SPACEBASED(msp->ms_weight))) { + msp->ms_fragmentation = frag; + msp->ms_weight = weight; + return; + } + + VERIFY3U(msp->ms_fragmentation, ==, frag); + VERIFY3U(msp->ms_weight, ==, weight); +} + +/* * Wait for any in-progress metaslab loads to complete. */ static void @@ -1491,47 +1706,94 @@ metaslab_load_impl(metaslab_t *msp) ASSERT(MUTEX_HELD(&msp->ms_lock)); ASSERT(msp->ms_loading); + ASSERT(!msp->ms_condensing); /* - * Nobody else can manipulate a loading metaslab, so it's now safe - * to drop the lock. This way we don't have to hold the lock while - * reading the spacemap from disk. + * We temporarily drop the lock to unblock other operations while we + * are reading the space map. Therefore, metaslab_sync() and + * metaslab_sync_done() can run at the same time as we do. + * + * metaslab_sync() can append to the space map while we are loading. + * Therefore we load only entries that existed when we started the + * load. Additionally, metaslab_sync_done() has to wait for the load + * to complete because there are potential races like metaslab_load() + * loading parts of the space map that are currently being appended + * by metaslab_sync(). If we didn't, the ms_allocatable would have + * entries that metaslab_sync_done() would try to re-add later. + * + * That's why before dropping the lock we remember the synced length + * of the metaslab and read up to that point of the space map, + * ignoring entries appended by metaslab_sync() that happen after we + * drop the lock. */ + uint64_t length = msp->ms_synced_length; mutex_exit(&msp->ms_lock); - /* - * If the space map has not been allocated yet, then treat - * all the space in the metaslab as free and add it to ms_allocatable. - */ if (msp->ms_sm != NULL) { - error = space_map_load(msp->ms_sm, msp->ms_allocatable, - SM_FREE); + error = space_map_load_length(msp->ms_sm, msp->ms_allocatable, + SM_FREE, length); } else { + /* + * The space map has not been allocated yet, so treat + * all the space in the metaslab as free and add it to the + * ms_allocatable tree. + */ range_tree_add(msp->ms_allocatable, msp->ms_start, msp->ms_size); } + /* + * We need to grab the ms_sync_lock to prevent metaslab_sync() from + * changing the ms_sm and the metaslab's range trees while we are + * about to use them and populate the ms_allocatable. The ms_lock + * is insufficient for this because metaslab_sync() doesn't hold + * the ms_lock while writing the ms_checkpointing tree to disk. + */ + mutex_enter(&msp->ms_sync_lock); mutex_enter(&msp->ms_lock); + ASSERT(!msp->ms_condensing); - if (error != 0) + if (error != 0) { + mutex_exit(&msp->ms_sync_lock); return (error); + } ASSERT3P(msp->ms_group, !=, NULL); msp->ms_loaded = B_TRUE; /* - * If the metaslab already has a spacemap, then we need to - * remove all segments from the defer tree; otherwise, the - * metaslab is completely empty and we can skip this. + * The ms_allocatable contains the segments that exist in the + * ms_defer trees [see ms_synced_length]. Thus we need to remove + * them from ms_allocatable as they will be added again in + * metaslab_sync_done(). */ - if (msp->ms_sm != NULL) { - for (int t = 0; t < TXG_DEFER_SIZE; t++) { - range_tree_walk(msp->ms_defer[t], - range_tree_remove, msp->ms_allocatable); - } + for (int t = 0; t < TXG_DEFER_SIZE; t++) { + range_tree_walk(msp->ms_defer[t], + range_tree_remove, msp->ms_allocatable); } + + /* + * Call metaslab_recalculate_weight_and_sort() now that the + * metaslab is loaded so we get the metaslab's real weight. + * + * Unless this metaslab was created with older software and + * has not yet been converted to use segment-based weight, we + * expect the new weight to be better or equal to the weight + * that the metaslab had while it was not loaded. This is + * because the old weight does not take into account the + * consolidation of adjacent segments between TXGs. [see + * comment for ms_synchist and ms_deferhist[] for more info] + */ + uint64_t weight = msp->ms_weight; + metaslab_recalculate_weight_and_sort(msp); + if (!WEIGHT_IS_SPACEBASED(weight)) + ASSERT3U(weight, <=, msp->ms_weight); msp->ms_max_size = metaslab_block_maxsize(msp); + spa_t *spa = msp->ms_group->mg_vd->vdev_spa; + metaslab_verify_space(msp, spa_syncing_txg(spa)); + mutex_exit(&msp->ms_sync_lock); + return (0); } @@ -1548,6 +1810,7 @@ metaslab_load(metaslab_t *msp) if (msp->ms_loaded) return (0); VERIFY(!msp->ms_loading); + ASSERT(!msp->ms_condensing); msp->ms_loading = B_TRUE; int error = metaslab_load_impl(msp); @@ -1561,10 +1824,29 @@ void metaslab_unload(metaslab_t *msp) { ASSERT(MUTEX_HELD(&msp->ms_lock)); + + metaslab_verify_weight_and_frag(msp); + range_tree_vacate(msp->ms_allocatable, NULL, NULL); msp->ms_loaded = B_FALSE; + msp->ms_weight &= ~METASLAB_ACTIVE_MASK; msp->ms_max_size = 0; + + /* + * We explicitly recalculate the metaslab's weight based on its space + * map (as it is now not loaded). We want unload metaslabs to always + * have their weights calculated from the space map histograms, while + * loaded ones have it calculated from their in-core range tree + * [see metaslab_load()]. This way, the weight reflects the information + * available in-core, whether it is loaded or not + * + * If ms_group == NULL means that we came here from metaslab_fini(), + * at which point it doesn't make sense for us to do the recalculation + * and the sorting. + */ + if (msp->ms_group != NULL) + metaslab_recalculate_weight_and_sort(msp); } static void @@ -1604,6 +1886,13 @@ metaslab_init(metaslab_group_t *mg, uint64_t id, uint6 /* * We only open space map objects that already exist. All others * will be opened when we finally allocate an object for it. + * + * Note: + * When called from vdev_expand(), we can't call into the DMU as + * we are holding the spa_config_lock as a writer and we would + * deadlock [see relevant comment in vdev_metaslab_init()]. in + * that case, the object parameter is zero though, so we won't + * call into the DMU. */ if (object != 0) { error = space_map_open(&ms->ms_sm, mos, object, ms->ms_start, @@ -1615,14 +1904,17 @@ metaslab_init(metaslab_group_t *mg, uint64_t id, uint6 } ASSERT(ms->ms_sm != NULL); + ASSERT3S(space_map_allocated(ms->ms_sm), >=, 0); + ms->ms_allocated_space = space_map_allocated(ms->ms_sm); } /* - * We create the main range tree here, but we don't create the + * We create the ms_allocatable here, but we don't create the * other range trees until metaslab_sync_done(). This serves * two purposes: it allows metaslab_sync_done() to detect the - * addition of new space; and for debugging, it ensures that we'd - * data fault on any attempt to use this metaslab before it's ready. + * addition of new space; and for debugging, it ensures that + * we'd data fault on any attempt to use this metaslab before + * it's ready. */ ms->ms_allocatable = range_tree_create_impl(&rt_avl_ops, &ms->ms_allocatable_by_size, metaslab_rangesize_compare, 0); @@ -1639,8 +1931,11 @@ metaslab_init(metaslab_group_t *mg, uint64_t id, uint6 * out this txg. This ensures that we don't attempt to allocate * from it before we have initialized it completely. */ - if (txg <= TXG_INITIAL) + if (txg <= TXG_INITIAL) { metaslab_sync_done(ms, 0); + metaslab_space_update(vd, mg->mg_class, + metaslab_allocated_space(ms), 0, 0); + } /* * If metaslab_debug_load is set and we're initializing a metaslab @@ -1674,7 +1969,7 @@ metaslab_fini(metaslab_t *msp) mutex_enter(&msp->ms_lock); VERIFY(msp->ms_group == NULL); metaslab_space_update(vd, mg->mg_class, - -space_map_allocated(msp->ms_sm), 0, -msp->ms_size); + -metaslab_allocated_space(msp), 0, -msp->ms_size); space_map_close(msp->ms_sm); @@ -1695,6 +1990,9 @@ metaslab_fini(metaslab_t *msp) range_tree_destroy(msp->ms_checkpointing); + for (int t = 0; t < TXG_SIZE; t++) + ASSERT(!txg_list_member(&vd->vdev_ms_list, msp, t)); + mutex_exit(&msp->ms_lock); cv_destroy(&msp->ms_load_cv); mutex_destroy(&msp->ms_lock); @@ -1710,7 +2008,7 @@ metaslab_fini(metaslab_t *msp) * This table defines a segment size based fragmentation metric that will * allow each metaslab to derive its own fragmentation value. This is done * by calculating the space in each bucket of the spacemap histogram and - * multiplying that by the fragmetation metric in this table. Doing + * multiplying that by the fragmentation metric in this table. Doing *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-all@freebsd.org Thu Nov 21 13:46:18 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 9C5571BF169; Thu, 21 Nov 2019 13:46:18 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47Jgnk4RBWz4Pdf; Thu, 21 Nov 2019 13:46:18 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 7C82CC27B; Thu, 21 Nov 2019 13:46:18 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xALDkI8H035767; Thu, 21 Nov 2019 13:46:18 GMT (envelope-from avg@FreeBSD.org) Received: (from avg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xALDkHZ8035760; Thu, 21 Nov 2019 13:46:17 GMT (envelope-from avg@FreeBSD.org) Message-Id: <201911211346.xALDkHZ8035760@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avg set sender to avg@FreeBSD.org using -f From: Andriy Gapon Date: Thu, 21 Nov 2019 13:46:17 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-vendor@freebsd.org Subject: svn commit: r354949 - vendor-sys/illumos/dist/uts/common/fs/zfs vendor-sys/illumos/dist/uts/common/fs/zfs/sys vendor-sys/illumos/dist/uts/common/sys vendor-sys/illumos/dist/uts/common/sys/fs vendor... X-SVN-Group: vendor-sys X-SVN-Commit-Author: avg X-SVN-Commit-Paths: vendor-sys/illumos/dist/uts/common/fs/zfs vendor-sys/illumos/dist/uts/common/fs/zfs/sys vendor-sys/illumos/dist/uts/common/sys vendor-sys/illumos/dist/uts/common/sys/fs vendor/illumos/dist/cmd/zdb ven... X-SVN-Commit-Revision: 354949 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 21 Nov 2019 13:46:18 -0000 Author: avg Date: Thu Nov 21 13:46:16 2019 New Revision: 354949 URL: https://svnweb.freebsd.org/changeset/base/354949 Log: 10405 Implement ZFS sorted scans illumos/illumos-gate@a3874b8b1fe5103fc1f961609557c0587435fec0 https://github.com/illumos/illumos-gate/commit/a3874b8b1fe5103fc1f961609557c0587435fec0 https://www.illumos.org/issues/10405 The original implementation is: https://github.com/zfsonlinux/zfs/commit/d4a72f23863382bdf6d0ae33196f5b5decbc48fd Author: Toomas Soome Modified: vendor-sys/illumos/dist/uts/common/fs/zfs/arc.c vendor-sys/illumos/dist/uts/common/fs/zfs/dbuf.c vendor-sys/illumos/dist/uts/common/fs/zfs/ddt.c vendor-sys/illumos/dist/uts/common/fs/zfs/dmu_objset.c vendor-sys/illumos/dist/uts/common/fs/zfs/dmu_traverse.c vendor-sys/illumos/dist/uts/common/fs/zfs/dsl_scan.c vendor-sys/illumos/dist/uts/common/fs/zfs/metaslab.c vendor-sys/illumos/dist/uts/common/fs/zfs/range_tree.c vendor-sys/illumos/dist/uts/common/fs/zfs/spa.c vendor-sys/illumos/dist/uts/common/fs/zfs/spa_misc.c vendor-sys/illumos/dist/uts/common/fs/zfs/sys/arc.h vendor-sys/illumos/dist/uts/common/fs/zfs/sys/dsl_pool.h vendor-sys/illumos/dist/uts/common/fs/zfs/sys/dsl_scan.h vendor-sys/illumos/dist/uts/common/fs/zfs/sys/range_tree.h vendor-sys/illumos/dist/uts/common/fs/zfs/sys/spa_impl.h vendor-sys/illumos/dist/uts/common/fs/zfs/sys/vdev.h vendor-sys/illumos/dist/uts/common/fs/zfs/sys/vdev_impl.h vendor-sys/illumos/dist/uts/common/fs/zfs/sys/zio.h vendor-sys/illumos/dist/uts/common/fs/zfs/vdev.c vendor-sys/illumos/dist/uts/common/fs/zfs/vdev_disk.c vendor-sys/illumos/dist/uts/common/fs/zfs/vdev_file.c vendor-sys/illumos/dist/uts/common/fs/zfs/vdev_indirect.c vendor-sys/illumos/dist/uts/common/fs/zfs/vdev_mirror.c vendor-sys/illumos/dist/uts/common/fs/zfs/vdev_missing.c vendor-sys/illumos/dist/uts/common/fs/zfs/vdev_queue.c vendor-sys/illumos/dist/uts/common/fs/zfs/vdev_raidz.c vendor-sys/illumos/dist/uts/common/fs/zfs/vdev_root.c vendor-sys/illumos/dist/uts/common/fs/zfs/zio.c vendor-sys/illumos/dist/uts/common/sys/fs/zfs.h vendor-sys/illumos/dist/uts/common/sys/taskq.h Changes in other areas also in this revision: Modified: vendor/illumos/dist/cmd/zdb/zdb.c vendor/illumos/dist/cmd/zpool/zpool_main.c vendor/illumos/dist/cmd/ztest/ztest.c vendor/illumos/dist/lib/libzfs/common/libzfs_status.c Modified: vendor-sys/illumos/dist/uts/common/fs/zfs/arc.c ============================================================================== --- vendor-sys/illumos/dist/uts/common/fs/zfs/arc.c Thu Nov 21 13:35:43 2019 (r354948) +++ vendor-sys/illumos/dist/uts/common/fs/zfs/arc.c Thu Nov 21 13:46:16 2019 (r354949) @@ -348,7 +348,8 @@ int arc_no_grow_shift = 5; * minimum lifespan of a prefetch block in clock ticks * (initialized in arc_init()) */ -static int arc_min_prefetch_lifespan; +static int zfs_arc_min_prefetch_ms = 1; +static int zfs_arc_min_prescient_prefetch_ms = 6; /* * If this percent of memory is free, don't throttle. @@ -690,8 +691,9 @@ typedef struct arc_stats { kstat_named_t arcstat_meta_limit; kstat_named_t arcstat_meta_max; kstat_named_t arcstat_meta_min; - kstat_named_t arcstat_sync_wait_for_async; + kstat_named_t arcstat_async_upgrade_sync; kstat_named_t arcstat_demand_hit_predictive_prefetch; + kstat_named_t arcstat_demand_hit_prescient_prefetch; } arc_stats_t; static arc_stats_t arc_stats = { @@ -774,8 +776,9 @@ static arc_stats_t arc_stats = { { "arc_meta_limit", KSTAT_DATA_UINT64 }, { "arc_meta_max", KSTAT_DATA_UINT64 }, { "arc_meta_min", KSTAT_DATA_UINT64 }, - { "sync_wait_for_async", KSTAT_DATA_UINT64 }, + { "async_upgrade_sync", KSTAT_DATA_UINT64 }, { "demand_hit_predictive_prefetch", KSTAT_DATA_UINT64 }, + { "demand_hit_prescient_prefetch", KSTAT_DATA_UINT64 }, }; #define ARCSTAT(stat) (arc_stats.stat.value.ui64) @@ -872,22 +875,23 @@ typedef struct arc_callback arc_callback_t; struct arc_callback { void *acb_private; - arc_done_func_t *acb_done; + arc_read_done_func_t *acb_done; arc_buf_t *acb_buf; boolean_t acb_compressed; zio_t *acb_zio_dummy; + zio_t *acb_zio_head; arc_callback_t *acb_next; }; typedef struct arc_write_callback arc_write_callback_t; struct arc_write_callback { - void *awcb_private; - arc_done_func_t *awcb_ready; - arc_done_func_t *awcb_children_ready; - arc_done_func_t *awcb_physdone; - arc_done_func_t *awcb_done; - arc_buf_t *awcb_buf; + void *awcb_private; + arc_write_done_func_t *awcb_ready; + arc_write_done_func_t *awcb_children_ready; + arc_write_done_func_t *awcb_physdone; + arc_write_done_func_t *awcb_done; + arc_buf_t *awcb_buf; }; /* @@ -1013,6 +1017,8 @@ struct arc_buf_hdr { #define HDR_IO_IN_PROGRESS(hdr) ((hdr)->b_flags & ARC_FLAG_IO_IN_PROGRESS) #define HDR_IO_ERROR(hdr) ((hdr)->b_flags & ARC_FLAG_IO_ERROR) #define HDR_PREFETCH(hdr) ((hdr)->b_flags & ARC_FLAG_PREFETCH) +#define HDR_PRESCIENT_PREFETCH(hdr) \ + ((hdr)->b_flags & ARC_FLAG_PRESCIENT_PREFETCH) #define HDR_COMPRESSION_ENABLED(hdr) \ ((hdr)->b_flags & ARC_FLAG_COMPRESSED_ARC) @@ -3243,6 +3249,8 @@ arc_evict_hdr(arc_buf_hdr_t *hdr, kmutex_t *hash_lock) { arc_state_t *evicted_state, *state; int64_t bytes_evicted = 0; + int min_lifetime = HDR_PRESCIENT_PREFETCH(hdr) ? + zfs_arc_min_prescient_prefetch_ms : zfs_arc_min_prefetch_ms; ASSERT(MUTEX_HELD(hash_lock)); ASSERT(HDR_HAS_L1HDR(hdr)); @@ -3295,8 +3303,7 @@ arc_evict_hdr(arc_buf_hdr_t *hdr, kmutex_t *hash_lock) /* prefetch buffers have a minimum lifespan */ if (HDR_IO_IN_PROGRESS(hdr) || ((hdr->b_flags & (ARC_FLAG_PREFETCH | ARC_FLAG_INDIRECT)) && - ddi_get_lbolt() - hdr->b_l1hdr.b_arc_access < - arc_min_prefetch_lifespan)) { + ddi_get_lbolt() - hdr->b_l1hdr.b_arc_access < min_lifetime * hz)) { ARCSTAT_BUMP(arcstat_evict_skip); return (bytes_evicted); } @@ -4607,13 +4614,15 @@ arc_access(arc_buf_hdr_t *hdr, kmutex_t *hash_lock) * - move the buffer to the head of the list if this is * another prefetch (to make it less likely to be evicted). */ - if (HDR_PREFETCH(hdr)) { + if (HDR_PREFETCH(hdr) || HDR_PRESCIENT_PREFETCH(hdr)) { if (zfs_refcount_count(&hdr->b_l1hdr.b_refcnt) == 0) { /* link protected by hash lock */ ASSERT(multilist_link_active( &hdr->b_l1hdr.b_arc_node)); } else { - arc_hdr_clear_flags(hdr, ARC_FLAG_PREFETCH); + arc_hdr_clear_flags(hdr, + ARC_FLAG_PREFETCH | + ARC_FLAG_PRESCIENT_PREFETCH); ARCSTAT_BUMP(arcstat_mru_hits); } hdr->b_l1hdr.b_arc_access = now; @@ -4644,10 +4653,13 @@ arc_access(arc_buf_hdr_t *hdr, kmutex_t *hash_lock) * MFU state. */ - if (HDR_PREFETCH(hdr)) { + if (HDR_PREFETCH(hdr) || HDR_PRESCIENT_PREFETCH(hdr)) { new_state = arc_mru; - if (zfs_refcount_count(&hdr->b_l1hdr.b_refcnt) > 0) - arc_hdr_clear_flags(hdr, ARC_FLAG_PREFETCH); + if (zfs_refcount_count(&hdr->b_l1hdr.b_refcnt) > 0) { + arc_hdr_clear_flags(hdr, + ARC_FLAG_PREFETCH | + ARC_FLAG_PRESCIENT_PREFETCH); + } DTRACE_PROBE1(new_state__mru, arc_buf_hdr_t *, hdr); } else { new_state = arc_mfu; @@ -4668,11 +4680,6 @@ arc_access(arc_buf_hdr_t *hdr, kmutex_t *hash_lock) * If it was a prefetch, we will explicitly move it to * the head of the list now. */ - if ((HDR_PREFETCH(hdr)) != 0) { - ASSERT(zfs_refcount_is_zero(&hdr->b_l1hdr.b_refcnt)); - /* link protected by hash_lock */ - ASSERT(multilist_link_active(&hdr->b_l1hdr.b_arc_node)); - } ARCSTAT_BUMP(arcstat_mfu_hits); hdr->b_l1hdr.b_arc_access = ddi_get_lbolt(); } else if (hdr->b_l1hdr.b_state == arc_mfu_ghost) { @@ -4683,12 +4690,11 @@ arc_access(arc_buf_hdr_t *hdr, kmutex_t *hash_lock) * MFU state. */ - if (HDR_PREFETCH(hdr)) { + if (HDR_PREFETCH(hdr) || HDR_PRESCIENT_PREFETCH(hdr)) { /* * This is a prefetch access... * move this block back to the MRU state. */ - ASSERT0(zfs_refcount_count(&hdr->b_l1hdr.b_refcnt)); new_state = arc_mru; } @@ -4710,21 +4716,26 @@ arc_access(arc_buf_hdr_t *hdr, kmutex_t *hash_lock) } } -/* a generic arc_done_func_t which you can use */ +/* a generic arc_read_done_func_t which you can use */ /* ARGSUSED */ void -arc_bcopy_func(zio_t *zio, arc_buf_t *buf, void *arg) +arc_bcopy_func(zio_t *zio, const zbookmark_phys_t *zb, const blkptr_t *bp, + arc_buf_t *buf, void *arg) { - if (zio == NULL || zio->io_error == 0) - bcopy(buf->b_data, arg, arc_buf_size(buf)); + if (buf == NULL) + return; + + bcopy(buf->b_data, arg, arc_buf_size(buf)); arc_buf_destroy(buf, arg); } -/* a generic arc_done_func_t */ +/* a generic arc_read_done_func_t */ void -arc_getbuf_func(zio_t *zio, arc_buf_t *buf, void *arg) +arc_getbuf_func(zio_t *zio, const zbookmark_phys_t *zb, const blkptr_t *bp, + arc_buf_t *buf, void *arg) { arc_buf_t **bufp = arg; + if (buf == NULL) { ASSERT(zio == NULL || zio->io_error != 0); *bufp = NULL; @@ -4759,7 +4770,6 @@ arc_read_done(zio_t *zio) arc_callback_t *callback_list; arc_callback_t *acb; boolean_t freeable = B_FALSE; - boolean_t no_zio_error = (zio->io_error == 0); /* * The hdr was inserted into hash-table and removed from lists @@ -4785,7 +4795,7 @@ arc_read_done(zio_t *zio) ASSERT3P(hash_lock, !=, NULL); } - if (no_zio_error) { + if (zio->io_error == 0) { /* byteswap if necessary */ if (BP_SHOULD_BYTESWAP(zio->io_bp)) { if (BP_GET_LEVEL(zio->io_bp) > 0) { @@ -4806,7 +4816,8 @@ arc_read_done(zio_t *zio) callback_list = hdr->b_l1hdr.b_acb; ASSERT3P(callback_list, !=, NULL); - if (hash_lock && no_zio_error && hdr->b_l1hdr.b_state == arc_anon) { + if (hash_lock && zio->io_error == 0 && + hdr->b_l1hdr.b_state == arc_anon) { /* * Only call arc_access on anonymous buffers. This is because * if we've issued an I/O for an evicted buffer, we've already @@ -4827,30 +4838,29 @@ arc_read_done(zio_t *zio) if (!acb->acb_done) continue; - /* This is a demand read since prefetches don't use callbacks */ callback_cnt++; - if (no_zio_error) { - int error = arc_buf_alloc_impl(hdr, acb->acb_private, - acb->acb_compressed, zio->io_error == 0, - &acb->acb_buf); - if (error != 0) { - /* - * Decompression failed. Set io_error - * so that when we call acb_done (below), - * we will indicate that the read failed. - * Note that in the unusual case where one - * callback is compressed and another - * uncompressed, we will mark all of them - * as failed, even though the uncompressed - * one can't actually fail. In this case, - * the hdr will not be anonymous, because - * if there are multiple callbacks, it's - * because multiple threads found the same - * arc buf in the hash table. - */ - zio->io_error = error; - } + if (zio->io_error != 0) + continue; + + int error = arc_buf_alloc_impl(hdr, acb->acb_private, + acb->acb_compressed, B_TRUE, &acb->acb_buf); + if (error != 0) { + /* + * Decompression failed. Set io_error + * so that when we call acb_done (below), + * we will indicate that the read failed. + * Note that in the unusual case where one + * callback is compressed and another + * uncompressed, we will mark all of them + * as failed, even though the uncompressed + * one can't actually fail. In this case, + * the hdr will not be anonymous, because + * if there are multiple callbacks, it's + * because multiple threads found the same + * arc buf in the hash table. + */ + zio->io_error = error; } } /* @@ -4873,7 +4883,7 @@ arc_read_done(zio_t *zio) ASSERT(zfs_refcount_is_zero(&hdr->b_l1hdr.b_refcnt) || callback_list != NULL); - if (no_zio_error) { + if (zio->io_error == 0) { arc_hdr_verify(hdr, zio->io_bp); } else { arc_hdr_set_flags(hdr, ARC_FLAG_IO_ERROR); @@ -4916,7 +4926,8 @@ arc_read_done(zio_t *zio) arc_buf_destroy(acb->acb_buf, acb->acb_private); acb->acb_buf = NULL; } - acb->acb_done(zio, acb->acb_buf, acb->acb_private); + acb->acb_done(zio, &zio->io_bookmark, zio->io_bp, + acb->acb_buf, acb->acb_private); } if (acb->acb_zio_dummy != NULL) { @@ -4951,7 +4962,7 @@ arc_read_done(zio_t *zio) * for readers of this block. */ int -arc_read(zio_t *pio, spa_t *spa, const blkptr_t *bp, arc_done_func_t *done, +arc_read(zio_t *pio, spa_t *spa, const blkptr_t *bp, arc_read_done_func_t *done, void *private, zio_priority_t priority, int zio_flags, arc_flags_t *arc_flags, const zbookmark_phys_t *zb) { @@ -4960,6 +4971,7 @@ arc_read(zio_t *pio, spa_t *spa, const blkptr_t *bp, a zio_t *rzio; uint64_t guid = spa_load_guid(spa); boolean_t compressed_read = (zio_flags & ZIO_FLAG_RAW) != 0; + int rc = 0; ASSERT(!BP_IS_EMBEDDED(bp) || BPE_GET_ETYPE(bp) == BP_EMBEDDED_TYPE_DATA); @@ -4978,32 +4990,20 @@ top: *arc_flags |= ARC_FLAG_CACHED; if (HDR_IO_IN_PROGRESS(hdr)) { + zio_t *head_zio = hdr->b_l1hdr.b_acb->acb_zio_head; + ASSERT3P(head_zio, !=, NULL); if ((hdr->b_flags & ARC_FLAG_PRIO_ASYNC_READ) && priority == ZIO_PRIORITY_SYNC_READ) { /* - * This sync read must wait for an - * in-progress async read (e.g. a predictive - * prefetch). Async reads are queued - * separately at the vdev_queue layer, so - * this is a form of priority inversion. - * Ideally, we would "inherit" the demand - * i/o's priority by moving the i/o from - * the async queue to the synchronous queue, - * but there is currently no mechanism to do - * so. Track this so that we can evaluate - * the magnitude of this potential performance - * problem. - * - * Note that if the prefetch i/o is already - * active (has been issued to the device), - * the prefetch improved performance, because - * we issued it sooner than we would have - * without the prefetch. + * This is a sync read that needs to wait for + * an in-flight async read. Request that the + * zio have its priority upgraded. */ - DTRACE_PROBE1(arc__sync__wait__for__async, + zio_change_priority(head_zio, priority); + DTRACE_PROBE1(arc__async__upgrade__sync, arc_buf_hdr_t *, hdr); - ARCSTAT_BUMP(arcstat_sync_wait_for_async); + ARCSTAT_BUMP(arcstat_async_upgrade_sync); } if (hdr->b_flags & ARC_FLAG_PREDICTIVE_PREFETCH) { arc_hdr_clear_flags(hdr, @@ -5030,6 +5030,7 @@ top: spa, NULL, NULL, NULL, zio_flags); ASSERT3P(acb->acb_done, !=, NULL); + acb->acb_zio_head = head_zio; acb->acb_next = hdr->b_l1hdr.b_acb; hdr->b_l1hdr.b_acb = acb; mutex_exit(hash_lock); @@ -5057,17 +5058,33 @@ top: arc_hdr_clear_flags(hdr, ARC_FLAG_PREDICTIVE_PREFETCH); } + + if (hdr->b_flags & ARC_FLAG_PRESCIENT_PREFETCH) { + ARCSTAT_BUMP( + arcstat_demand_hit_prescient_prefetch); + arc_hdr_clear_flags(hdr, + ARC_FLAG_PRESCIENT_PREFETCH); + } + ASSERT(!BP_IS_EMBEDDED(bp) || !BP_IS_HOLE(bp)); /* Get a buf with the desired data in it. */ - VERIFY0(arc_buf_alloc_impl(hdr, private, - compressed_read, B_TRUE, &buf)); + rc = arc_buf_alloc_impl(hdr, private, + compressed_read, B_TRUE, &buf); + if (rc != 0) { + arc_buf_destroy(buf, private); + buf = NULL; + } + ASSERT((zio_flags & ZIO_FLAG_SPECULATIVE) || + rc == 0 || rc != ENOENT); } else if (*arc_flags & ARC_FLAG_PREFETCH && zfs_refcount_count(&hdr->b_l1hdr.b_refcnt) == 0) { arc_hdr_set_flags(hdr, ARC_FLAG_PREFETCH); } DTRACE_PROBE1(arc__hit, arc_buf_hdr_t *, hdr); arc_access(hdr, hash_lock); + if (*arc_flags & ARC_FLAG_PRESCIENT_PREFETCH) + arc_hdr_set_flags(hdr, ARC_FLAG_PRESCIENT_PREFETCH); if (*arc_flags & ARC_FLAG_L2CACHE) arc_hdr_set_flags(hdr, ARC_FLAG_L2CACHE); mutex_exit(hash_lock); @@ -5077,7 +5094,7 @@ top: data, metadata, hits); if (done) - done(NULL, buf, private); + done(NULL, zb, bp, buf, private); } else { uint64_t lsize = BP_GET_LSIZE(bp); uint64_t psize = BP_GET_PSIZE(bp); @@ -5151,6 +5168,9 @@ top: if (*arc_flags & ARC_FLAG_PREFETCH) arc_hdr_set_flags(hdr, ARC_FLAG_PREFETCH); + if (*arc_flags & ARC_FLAG_PRESCIENT_PREFETCH) + arc_hdr_set_flags(hdr, ARC_FLAG_PRESCIENT_PREFETCH); + if (*arc_flags & ARC_FLAG_L2CACHE) arc_hdr_set_flags(hdr, ARC_FLAG_L2CACHE); if (BP_GET_LEVEL(bp) > 0) @@ -5180,14 +5200,17 @@ top: vd = NULL; } - if (priority == ZIO_PRIORITY_ASYNC_READ) + /* + * We count both async reads and scrub IOs as asynchronous so + * that both can be upgraded in the event of a cache hit while + * the read IO is still in-flight. + */ + if (priority == ZIO_PRIORITY_ASYNC_READ || + priority == ZIO_PRIORITY_SCRUB) arc_hdr_set_flags(hdr, ARC_FLAG_PRIO_ASYNC_READ); else arc_hdr_clear_flags(hdr, ARC_FLAG_PRIO_ASYNC_READ); - if (hash_lock != NULL) - mutex_exit(hash_lock); - /* * At this point, we have a level 1 cache miss. Try again in * L2ARC if possible. @@ -5257,6 +5280,11 @@ top: ZIO_FLAG_CANFAIL | ZIO_FLAG_DONT_PROPAGATE | ZIO_FLAG_DONT_RETRY, B_FALSE); + acb->acb_zio_head = rzio; + + if (hash_lock != NULL) + mutex_exit(hash_lock); + DTRACE_PROBE2(l2arc__read, vdev_t *, vd, zio_t *, rzio); ARCSTAT_INCR(arcstat_l2_read_bytes, size); @@ -5271,6 +5299,8 @@ top: return (0); /* l2arc read error; goto zio_read() */ + if (hash_lock != NULL) + mutex_enter(hash_lock); } else { DTRACE_PROBE1(l2arc__miss, arc_buf_hdr_t *, hdr); @@ -5291,7 +5321,11 @@ top: rzio = zio_read(pio, spa, bp, hdr->b_l1hdr.b_pabd, size, arc_read_done, hdr, priority, zio_flags, zb); + acb->acb_zio_head = rzio; + if (hash_lock != NULL) + mutex_exit(hash_lock); + if (*arc_flags & ARC_FLAG_WAIT) return (zio_wait(rzio)); @@ -5778,9 +5812,9 @@ arc_write_done(zio_t *zio) zio_t * arc_write(zio_t *pio, spa_t *spa, uint64_t txg, blkptr_t *bp, arc_buf_t *buf, - boolean_t l2arc, const zio_prop_t *zp, arc_done_func_t *ready, - arc_done_func_t *children_ready, arc_done_func_t *physdone, - arc_done_func_t *done, void *private, zio_priority_t priority, + boolean_t l2arc, const zio_prop_t *zp, arc_write_done_func_t *ready, + arc_write_done_func_t *children_ready, arc_write_done_func_t *physdone, + arc_write_done_func_t *done, void *private, zio_priority_t priority, int zio_flags, const zbookmark_phys_t *zb) { arc_buf_hdr_t *hdr = buf->b_hdr; @@ -6191,9 +6225,6 @@ arc_init(void) #endif mutex_init(&arc_adjust_lock, NULL, MUTEX_DEFAULT, NULL); cv_init(&arc_adjust_waiters_cv, NULL, CV_DEFAULT, NULL); - - /* Convert seconds to clock ticks */ - arc_min_prefetch_lifespan = 1 * hz; /* set min cache to 1/32 of all memory, or 64MB, whichever is more */ arc_c_min = MAX(allmem / 32, 64 << 20); Modified: vendor-sys/illumos/dist/uts/common/fs/zfs/dbuf.c ============================================================================== --- vendor-sys/illumos/dist/uts/common/fs/zfs/dbuf.c Thu Nov 21 13:35:43 2019 (r354948) +++ vendor-sys/illumos/dist/uts/common/fs/zfs/dbuf.c Thu Nov 21 13:46:16 2019 (r354949) @@ -942,7 +942,8 @@ dbuf_whichblock(dnode_t *dn, int64_t level, uint64_t o } static void -dbuf_read_done(zio_t *zio, arc_buf_t *buf, void *vdb) +dbuf_read_done(zio_t *zio, const zbookmark_phys_t *zb, const blkptr_t *bp, + arc_buf_t *buf, void *vdb) { dmu_buf_impl_t *db = vdb; @@ -961,15 +962,19 @@ dbuf_read_done(zio_t *zio, arc_buf_t *buf, void *vdb) ASSERT3P(db->db_buf, ==, NULL); db->db_state = DB_UNCACHED; } else if (db->db_level == 0 && db->db_freed_in_flight) { - /* freed in flight */ + /* we were freed in flight; disregard any error */ ASSERT(zio == NULL || zio->io_error == 0); + if (buf == NULL) { + buf = arc_alloc_buf(db->db_objset->os_spa, + db, DBUF_GET_BUFC_TYPE(db), db->db.db_size); + } arc_release(buf, db); bzero(buf->b_data, db->db.db_size); arc_buf_freeze(buf); db->db_freed_in_flight = FALSE; dbuf_set_data(db, buf); db->db_state = DB_CACHED; - } else { + } else if (buf != NULL) { /* success */ ASSERT(zio == NULL || zio->io_error == 0); dbuf_set_data(db, buf); @@ -2395,7 +2400,8 @@ dbuf_issue_final_prefetch(dbuf_prefetch_arg_t *dpa, bl * prefetch if the next block down is our target. */ static void -dbuf_prefetch_indirect_done(zio_t *zio, arc_buf_t *abuf, void *private) +dbuf_prefetch_indirect_done(zio_t *zio, const zbookmark_phys_t *zb, + const blkptr_t *iobp, arc_buf_t *abuf, void *private) { dbuf_prefetch_arg_t *dpa = private; @@ -2442,11 +2448,11 @@ dbuf_prefetch_indirect_done(zio_t *zio, arc_buf_t *abu } dpa->dpa_curlevel--; - uint64_t nextblkid = dpa->dpa_zb.zb_blkid >> (dpa->dpa_epbs * (dpa->dpa_curlevel - dpa->dpa_zb.zb_level)); blkptr_t *bp = ((blkptr_t *)abuf->b_data) + P2PHASE(nextblkid, 1ULL << dpa->dpa_epbs); + if (BP_IS_HOLE(bp)) { kmem_free(dpa, sizeof (*dpa)); } else if (dpa->dpa_curlevel == dpa->dpa_zb.zb_level) { @@ -3852,7 +3858,7 @@ dbuf_write(dbuf_dirty_record_t *dr, arc_buf_t *data, d * ready callback so that we can properly handle an indirect * block that only contains holes. */ - arc_done_func_t *children_ready_cb = NULL; + arc_write_done_func_t *children_ready_cb = NULL; if (db->db_level != 0) children_ready_cb = dbuf_write_children_ready; Modified: vendor-sys/illumos/dist/uts/common/fs/zfs/ddt.c ============================================================================== --- vendor-sys/illumos/dist/uts/common/fs/zfs/ddt.c Thu Nov 21 13:35:43 2019 (r354948) +++ vendor-sys/illumos/dist/uts/common/fs/zfs/ddt.c Thu Nov 21 13:46:16 2019 (r354949) @@ -1106,14 +1106,26 @@ ddt_sync_table(ddt_t *ddt, dmu_tx_t *tx, uint64_t txg) void ddt_sync(spa_t *spa, uint64_t txg) { + dsl_scan_t *scn = spa->spa_dsl_pool->dp_scan; dmu_tx_t *tx; - zio_t *rio = zio_root(spa, NULL, NULL, - ZIO_FLAG_CANFAIL | ZIO_FLAG_SPECULATIVE | ZIO_FLAG_SELF_HEAL); + zio_t *rio; ASSERT(spa_syncing_txg(spa) == txg); tx = dmu_tx_create_assigned(spa->spa_dsl_pool, txg); + rio = zio_root(spa, NULL, NULL, + ZIO_FLAG_CANFAIL | ZIO_FLAG_SPECULATIVE | ZIO_FLAG_SELF_HEAL); + + /* + * This function may cause an immediate scan of ddt blocks (see + * the comment above dsl_scan_ddt() for details). We set the + * scan's root zio here so that we can wait for any scan IOs in + * addition to the regular ddt IOs. + */ + ASSERT3P(scn->scn_zio_root, ==, NULL); + scn->scn_zio_root = rio; + for (enum zio_checksum c = 0; c < ZIO_CHECKSUM_FUNCTIONS; c++) { ddt_t *ddt = spa->spa_ddt[c]; if (ddt == NULL) @@ -1123,6 +1135,7 @@ ddt_sync(spa_t *spa, uint64_t txg) } (void) zio_wait(rio); + scn->scn_zio_root = NULL; dmu_tx_commit(tx); } Modified: vendor-sys/illumos/dist/uts/common/fs/zfs/dmu_objset.c ============================================================================== --- vendor-sys/illumos/dist/uts/common/fs/zfs/dmu_objset.c Thu Nov 21 13:35:43 2019 (r354948) +++ vendor-sys/illumos/dist/uts/common/fs/zfs/dmu_objset.c Thu Nov 21 13:46:16 2019 (r354949) @@ -398,6 +398,7 @@ dmu_objset_open_impl(spa_t *spa, dsl_dataset_t *ds, bl ASSERT(ds == NULL || MUTEX_HELD(&ds->ds_opening_lock)); +#if 0 /* * The $ORIGIN dataset (if it exists) doesn't have an associated * objset, so there's no reason to open it. The $ORIGIN dataset @@ -408,6 +409,7 @@ dmu_objset_open_impl(spa_t *spa, dsl_dataset_t *ds, bl ASSERT3P(ds->ds_dir, !=, spa_get_dsl(spa)->dp_origin_snap->ds_dir); } +#endif os = kmem_zalloc(sizeof (objset_t), KM_SLEEP); os->os_dsl_dataset = ds; Modified: vendor-sys/illumos/dist/uts/common/fs/zfs/dmu_traverse.c ============================================================================== --- vendor-sys/illumos/dist/uts/common/fs/zfs/dmu_traverse.c Thu Nov 21 13:35:43 2019 (r354948) +++ vendor-sys/illumos/dist/uts/common/fs/zfs/dmu_traverse.c Thu Nov 21 13:46:16 2019 (r354949) @@ -492,7 +492,8 @@ traverse_prefetcher(spa_t *spa, zilog_t *zilog, const const zbookmark_phys_t *zb, const dnode_phys_t *dnp, void *arg) { prefetch_data_t *pfd = arg; - arc_flags_t aflags = ARC_FLAG_NOWAIT | ARC_FLAG_PREFETCH; + arc_flags_t aflags = ARC_FLAG_NOWAIT | ARC_FLAG_PREFETCH | + ARC_FLAG_PRESCIENT_PREFETCH; ASSERT(pfd->pd_bytes_fetched >= 0); if (bp == NULL) Modified: vendor-sys/illumos/dist/uts/common/fs/zfs/dsl_scan.c ============================================================================== --- vendor-sys/illumos/dist/uts/common/fs/zfs/dsl_scan.c Thu Nov 21 13:35:43 2019 (r354948) +++ vendor-sys/illumos/dist/uts/common/fs/zfs/dsl_scan.c Thu Nov 21 13:46:16 2019 (r354949) @@ -51,34 +51,157 @@ #include #include #include +#include #ifdef _KERNEL #include #endif +/* + * Grand theory statement on scan queue sorting + * + * Scanning is implemented by recursively traversing all indirection levels + * in an object and reading all blocks referenced from said objects. This + * results in us approximately traversing the object from lowest logical + * offset to the highest. For best performance, we would want the logical + * blocks to be physically contiguous. However, this is frequently not the + * case with pools given the allocation patterns of copy-on-write filesystems. + * So instead, we put the I/Os into a reordering queue and issue them in a + * way that will most benefit physical disks (LBA-order). + * + * Queue management: + * + * Ideally, we would want to scan all metadata and queue up all block I/O + * prior to starting to issue it, because that allows us to do an optimal + * sorting job. This can however consume large amounts of memory. Therefore + * we continuously monitor the size of the queues and constrain them to 5% + * (zfs_scan_mem_lim_fact) of physmem. If the queues grow larger than this + * limit, we clear out a few of the largest extents at the head of the queues + * to make room for more scanning. Hopefully, these extents will be fairly + * large and contiguous, allowing us to approach sequential I/O throughput + * even without a fully sorted tree. + * + * Metadata scanning takes place in dsl_scan_visit(), which is called from + * dsl_scan_sync() every spa_sync(). If we have either fully scanned all + * metadata on the pool, or we need to make room in memory because our + * queues are too large, dsl_scan_visit() is postponed and + * scan_io_queues_run() is called from dsl_scan_sync() instead. This implies + * that metadata scanning and queued I/O issuing are mutually exclusive. This + * allows us to provide maximum sequential I/O throughput for the majority of + * I/O's issued since sequential I/O performance is significantly negatively + * impacted if it is interleaved with random I/O. + * + * Implementation Notes + * + * One side effect of the queued scanning algorithm is that the scanning code + * needs to be notified whenever a block is freed. This is needed to allow + * the scanning code to remove these I/Os from the issuing queue. Additionally, + * we do not attempt to queue gang blocks to be issued sequentially since this + * is very hard to do and would have an extremely limited performance benefit. + * Instead, we simply issue gang I/Os as soon as we find them using the legacy + * algorithm. + * + * Backwards compatibility + * + * This new algorithm is backwards compatible with the legacy on-disk data + * structures (and therefore does not require a new feature flag). + * Periodically during scanning (see zfs_scan_checkpoint_intval), the scan + * will stop scanning metadata (in logical order) and wait for all outstanding + * sorted I/O to complete. Once this is done, we write out a checkpoint + * bookmark, indicating that we have scanned everything logically before it. + * If the pool is imported on a machine without the new sorting algorithm, + * the scan simply resumes from the last checkpoint using the legacy algorithm. + */ + typedef int (scan_cb_t)(dsl_pool_t *, const blkptr_t *, const zbookmark_phys_t *); static scan_cb_t dsl_scan_scrub_cb; -static void dsl_scan_cancel_sync(void *, dmu_tx_t *); -static void dsl_scan_sync_state(dsl_scan_t *, dmu_tx_t *); -static boolean_t dsl_scan_restarting(dsl_scan_t *, dmu_tx_t *); +static int scan_ds_queue_compare(const void *a, const void *b); +static int scan_prefetch_queue_compare(const void *a, const void *b); +static void scan_ds_queue_clear(dsl_scan_t *scn); +static boolean_t scan_ds_queue_contains(dsl_scan_t *scn, uint64_t dsobj, + uint64_t *txg); +static void scan_ds_queue_insert(dsl_scan_t *scn, uint64_t dsobj, uint64_t txg); +static void scan_ds_queue_remove(dsl_scan_t *scn, uint64_t dsobj); +static void scan_ds_queue_sync(dsl_scan_t *scn, dmu_tx_t *tx); + +extern int zfs_vdev_async_write_active_min_dirty_percent; + +/* + * By default zfs will check to ensure it is not over the hard memory + * limit before each txg. If finer-grained control of this is needed + * this value can be set to 1 to enable checking before scanning each + * block. + */ +int zfs_scan_strict_mem_lim = B_FALSE; + +/* + * Maximum number of parallelly executing I/Os per top-level vdev. + * Tune with care. Very high settings (hundreds) are known to trigger + * some firmware bugs and resets on certain SSDs. + */ int zfs_top_maxinflight = 32; /* maximum I/Os per top-level */ -int zfs_resilver_delay = 2; /* number of ticks to delay resilver */ -int zfs_scrub_delay = 4; /* number of ticks to delay scrub */ -int zfs_scan_idle = 50; /* idle window in clock ticks */ +unsigned int zfs_resilver_delay = 2; /* number of ticks to delay resilver */ +unsigned int zfs_scrub_delay = 4; /* number of ticks to delay scrub */ +unsigned int zfs_scan_idle = 50; /* idle window in clock ticks */ -int zfs_scan_min_time_ms = 1000; /* min millisecs to scrub per txg */ -int zfs_free_min_time_ms = 1000; /* min millisecs to free per txg */ -int zfs_obsolete_min_time_ms = 500; /* min millisecs to obsolete per txg */ -int zfs_resilver_min_time_ms = 3000; /* min millisecs to resilver per txg */ +/* + * Maximum number of parallelly executed bytes per leaf vdev. We attempt + * to strike a balance here between keeping the vdev queues full of I/Os + * at all times and not overflowing the queues to cause long latency, + * which would cause long txg sync times. No matter what, we will not + * overload the drives with I/O, since that is protected by + * zfs_vdev_scrub_max_active. + */ +unsigned long zfs_scan_vdev_limit = 4 << 20; + +int zfs_scan_issue_strategy = 0; +int zfs_scan_legacy = B_FALSE; /* don't queue & sort zios, go direct */ +uint64_t zfs_scan_max_ext_gap = 2 << 20; /* in bytes */ + +unsigned int zfs_scan_checkpoint_intval = 7200; /* seconds */ +#define ZFS_SCAN_CHECKPOINT_INTVAL SEC_TO_TICK(zfs_scan_checkpoint_intval) + +/* + * fill_weight is non-tunable at runtime, so we copy it at module init from + * zfs_scan_fill_weight. Runtime adjustments to zfs_scan_fill_weight would + * break queue sorting. + */ +uint64_t zfs_scan_fill_weight = 3; +static uint64_t fill_weight; + +/* See dsl_scan_should_clear() for details on the memory limit tunables */ +uint64_t zfs_scan_mem_lim_min = 16 << 20; /* bytes */ +uint64_t zfs_scan_mem_lim_soft_max = 128 << 20; /* bytes */ +int zfs_scan_mem_lim_fact = 20; /* fraction of physmem */ +int zfs_scan_mem_lim_soft_fact = 20; /* fraction of mem lim above */ + +unsigned int zfs_scrub_min_time_ms = 1000; /* min millisecs to scrub per txg */ +unsigned int zfs_free_min_time_ms = 1000; /* min millisecs to free per txg */ +/* min millisecs to obsolete per txg */ +unsigned int zfs_obsolete_min_time_ms = 500; +/* min millisecs to resilver per txg */ +unsigned int zfs_resilver_min_time_ms = 3000; boolean_t zfs_no_scrub_io = B_FALSE; /* set to disable scrub i/o */ boolean_t zfs_no_scrub_prefetch = B_FALSE; /* set to disable scrub prefetch */ enum ddt_class zfs_scrub_ddt_class_max = DDT_CLASS_DUPLICATE; -int dsl_scan_delay_completion = B_FALSE; /* set to delay scan completion */ /* max number of blocks to free in a single TXG */ uint64_t zfs_async_block_max_blocks = UINT64_MAX; +/* + * We wait a few txgs after importing a pool to begin scanning so that + * the import / mounting code isn't held up by scrub / resilver IO. + * Unfortunately, it is a bit difficult to determine exactly how long + * this will take since userspace will trigger fs mounts asynchronously + * and the kernel will create zvol minors asynchronously. As a result, + * the value provided here is a bit arbitrary, but represents a + * reasonable estimate of how many txgs it will take to finish fully + * importing a pool + */ +#define SCAN_IMPORT_WAIT_TXGS 5 + + #define DSL_SCAN_IS_SCRUB_RESILVER(scn) \ ((scn)->scn_phys.scn_func == POOL_SCAN_SCRUB || \ (scn)->scn_phys.scn_func == POOL_SCAN_RESILVER) @@ -97,6 +220,163 @@ static scan_cb_t *scan_funcs[POOL_SCAN_FUNCS] = { dsl_scan_scrub_cb, /* POOL_SCAN_RESILVER */ }; +/* In core node for the scn->scn_queue. Represents a dataset to be scanned */ +typedef struct { + uint64_t sds_dsobj; + uint64_t sds_txg; + avl_node_t sds_node; +} scan_ds_t; + +/* + * This controls what conditions are placed on dsl_scan_sync_state(): + * SYNC_OPTIONAL) write out scn_phys iff scn_bytes_pending == 0 + * SYNC_MANDATORY) write out scn_phys always. scn_bytes_pending must be 0. + * SYNC_CACHED) if scn_bytes_pending == 0, write out scn_phys. Otherwise + * write out the scn_phys_cached version. + * See dsl_scan_sync_state for details. + */ +typedef enum { + SYNC_OPTIONAL, + SYNC_MANDATORY, + SYNC_CACHED +} state_sync_type_t; + +/* + * This struct represents the minimum information needed to reconstruct a + * zio for sequential scanning. This is useful because many of these will + * accumulate in the sequential IO queues before being issued, so saving + * memory matters here. + */ +typedef struct scan_io { + /* fields from blkptr_t */ + uint64_t sio_offset; + uint64_t sio_blk_prop; + uint64_t sio_phys_birth; + uint64_t sio_birth; + zio_cksum_t sio_cksum; + uint32_t sio_asize; + + /* fields from zio_t */ + int sio_flags; + zbookmark_phys_t sio_zb; + + /* members for queue sorting */ + union { + avl_node_t sio_addr_node; /* link into issueing queue */ + list_node_t sio_list_node; /* link for issuing to disk */ + } sio_nodes; +} scan_io_t; + +struct dsl_scan_io_queue { + dsl_scan_t *q_scn; /* associated dsl_scan_t */ + vdev_t *q_vd; /* top-level vdev that this queue represents */ + + /* trees used for sorting I/Os and extents of I/Os */ + range_tree_t *q_exts_by_addr; + avl_tree_t q_exts_by_size; + avl_tree_t q_sios_by_addr; + + /* members for zio rate limiting */ + uint64_t q_maxinflight_bytes; + uint64_t q_inflight_bytes; + kcondvar_t q_zio_cv; /* used under vd->vdev_scan_io_queue_lock */ + + /* per txg statistics */ + uint64_t q_total_seg_size_this_txg; + uint64_t q_segs_this_txg; + uint64_t q_total_zio_size_this_txg; + uint64_t q_zios_this_txg; +}; + +/* private data for dsl_scan_prefetch_cb() */ +typedef struct scan_prefetch_ctx { + zfs_refcount_t spc_refcnt; /* refcount for memory management */ + dsl_scan_t *spc_scn; /* dsl_scan_t for the pool */ + boolean_t spc_root; /* is this prefetch for an objset? */ + uint8_t spc_indblkshift; /* dn_indblkshift of current dnode */ + uint16_t spc_datablkszsec; /* dn_idatablkszsec of current dnode */ +} scan_prefetch_ctx_t; + +/* private data for dsl_scan_prefetch() */ +typedef struct scan_prefetch_issue_ctx { + avl_node_t spic_avl_node; /* link into scn->scn_prefetch_queue */ + scan_prefetch_ctx_t *spic_spc; /* spc for the callback */ + blkptr_t spic_bp; /* bp to prefetch */ + zbookmark_phys_t spic_zb; /* bookmark to prefetch */ +} scan_prefetch_issue_ctx_t; + +static void scan_exec_io(dsl_pool_t *dp, const blkptr_t *bp, int zio_flags, + const zbookmark_phys_t *zb, dsl_scan_io_queue_t *queue); +static void scan_io_queue_insert_impl(dsl_scan_io_queue_t *queue, + scan_io_t *sio); + +static dsl_scan_io_queue_t *scan_io_queue_create(vdev_t *vd); +static void scan_io_queues_destroy(dsl_scan_t *scn); + +static kmem_cache_t *sio_cache; + +void +scan_init(void) +{ + /* + * This is used in ext_size_compare() to weight segments + * based on how sparse they are. This cannot be changed + * mid-scan and the tree comparison functions don't currently + * have a mechansim for passing additional context to the + * compare functions. Thus we store this value globally and + * we only allow it to be set at module intiailization time + */ + fill_weight = zfs_scan_fill_weight; + + sio_cache = kmem_cache_create("sio_cache", + sizeof (scan_io_t), 0, NULL, NULL, NULL, NULL, NULL, 0); +} + +void +scan_fini(void) +{ + kmem_cache_destroy(sio_cache); +} + +static inline boolean_t +dsl_scan_is_running(const dsl_scan_t *scn) +{ + return (scn->scn_phys.scn_state == DSS_SCANNING); +} + +boolean_t +dsl_scan_resilvering(dsl_pool_t *dp) +{ + return (dsl_scan_is_running(dp->dp_scan) && + dp->dp_scan->scn_phys.scn_func == POOL_SCAN_RESILVER); +} + +static inline void +sio2bp(const scan_io_t *sio, blkptr_t *bp, uint64_t vdev_id) +{ + bzero(bp, sizeof (*bp)); + DVA_SET_ASIZE(&bp->blk_dva[0], sio->sio_asize); + DVA_SET_VDEV(&bp->blk_dva[0], vdev_id); + DVA_SET_OFFSET(&bp->blk_dva[0], sio->sio_offset); + bp->blk_prop = sio->sio_blk_prop; + bp->blk_phys_birth = sio->sio_phys_birth; + bp->blk_birth = sio->sio_birth; + bp->blk_fill = 1; /* we always only work with data pointers */ + bp->blk_cksum = sio->sio_cksum; +} + +static inline void +bp2sio(const blkptr_t *bp, scan_io_t *sio, int dva_i) +{ + /* we discard the vdev id, since we can deduce it from the queue */ + sio->sio_offset = DVA_GET_OFFSET(&bp->blk_dva[dva_i]); + sio->sio_asize = DVA_GET_ASIZE(&bp->blk_dva[dva_i]); + sio->sio_blk_prop = bp->blk_prop; + sio->sio_phys_birth = bp->blk_phys_birth; + sio->sio_birth = bp->blk_birth; + sio->sio_cksum = bp->blk_cksum; +} + int dsl_scan_init(dsl_pool_t *dp, uint64_t txg) { @@ -117,6 +397,13 @@ dsl_scan_init(dsl_pool_t *dp, uint64_t txg) scn->scn_async_destroying = spa_feature_is_active(dp->dp_spa, SPA_FEATURE_ASYNC_DESTROY); + bcopy(&scn->scn_phys, &scn->scn_phys_cached, sizeof (scn->scn_phys)); + avl_create(&scn->scn_queue, scan_ds_queue_compare, sizeof (scan_ds_t), + offsetof(scan_ds_t, sds_node)); + avl_create(&scn->scn_prefetch_queue, scan_prefetch_queue_compare, + sizeof (scan_prefetch_issue_ctx_t), + offsetof(scan_prefetch_issue_ctx_t, spic_avl_node)); + err = zap_lookup(dp->dp_meta_objset, DMU_POOL_DIRECTORY_OBJECT, "scrub_func", sizeof (uint64_t), 1, &f); if (err == 0) { @@ -127,7 +414,7 @@ dsl_scan_init(dsl_pool_t *dp, uint64_t txg) scn->scn_restart_txg = txg; zfs_dbgmsg("old-style scrub was in progress; " "restarting new-style scrub in txg %llu", - scn->scn_restart_txg); + (longlong_t)scn->scn_restart_txg); /* * Load the queue obj from the old location so that it @@ -145,7 +432,14 @@ dsl_scan_init(dsl_pool_t *dp, uint64_t txg) else if (err) return (err); - if (scn->scn_phys.scn_state == DSS_SCANNING && + /* + * We might be restarting after a reboot, so jump the issued + * counter to how far we've scanned. We know we're consistent + * up to here. + */ + scn->scn_issued_before_pass = scn->scn_phys.scn_examined; + + if (dsl_scan_is_running(scn) && spa_prev_software_version(dp->dp_spa) < SPA_VERSION_SCAN) { /* * A new-type scrub was in progress on an old @@ -157,10 +451,26 @@ dsl_scan_init(dsl_pool_t *dp, uint64_t txg) scn->scn_restart_txg = txg; zfs_dbgmsg("new-style scrub was modified " "by old software; restarting in txg %llu", - scn->scn_restart_txg); + (longlong_t)scn->scn_restart_txg); } *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-all@freebsd.org Thu Nov 21 13:46:19 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id D621F1BF174; Thu, 21 Nov 2019 13:46:19 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47Jgnl5GgKz4Pdg; Thu, 21 Nov 2019 13:46:19 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 80FFCC27C; Thu, 21 Nov 2019 13:46:19 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xALDkJRJ035776; Thu, 21 Nov 2019 13:46:19 GMT (envelope-from avg@FreeBSD.org) Received: (from avg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xALDkI5P035772; Thu, 21 Nov 2019 13:46:18 GMT (envelope-from avg@FreeBSD.org) Message-Id: <201911211346.xALDkI5P035772@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avg set sender to avg@FreeBSD.org using -f From: Andriy Gapon Date: Thu, 21 Nov 2019 13:46:18 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-vendor@freebsd.org Subject: svn commit: r354949 - vendor-sys/illumos/dist/uts/common/fs/zfs vendor-sys/illumos/dist/uts/common/fs/zfs/sys vendor-sys/illumos/dist/uts/common/sys vendor-sys/illumos/dist/uts/common/sys/fs vendor... X-SVN-Group: vendor X-SVN-Commit-Author: avg X-SVN-Commit-Paths: vendor-sys/illumos/dist/uts/common/fs/zfs vendor-sys/illumos/dist/uts/common/fs/zfs/sys vendor-sys/illumos/dist/uts/common/sys vendor-sys/illumos/dist/uts/common/sys/fs vendor/illumos/dist/cmd/zdb ven... X-SVN-Commit-Revision: 354949 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 21 Nov 2019 13:46:19 -0000 Author: avg Date: Thu Nov 21 13:46:16 2019 New Revision: 354949 URL: https://svnweb.freebsd.org/changeset/base/354949 Log: 10405 Implement ZFS sorted scans illumos/illumos-gate@a3874b8b1fe5103fc1f961609557c0587435fec0 https://github.com/illumos/illumos-gate/commit/a3874b8b1fe5103fc1f961609557c0587435fec0 https://www.illumos.org/issues/10405 The original implementation is: https://github.com/zfsonlinux/zfs/commit/d4a72f23863382bdf6d0ae33196f5b5decbc48fd Author: Toomas Soome Modified: vendor/illumos/dist/cmd/zdb/zdb.c vendor/illumos/dist/cmd/zpool/zpool_main.c vendor/illumos/dist/cmd/ztest/ztest.c vendor/illumos/dist/lib/libzfs/common/libzfs_status.c Changes in other areas also in this revision: Modified: vendor-sys/illumos/dist/uts/common/fs/zfs/arc.c vendor-sys/illumos/dist/uts/common/fs/zfs/dbuf.c vendor-sys/illumos/dist/uts/common/fs/zfs/ddt.c vendor-sys/illumos/dist/uts/common/fs/zfs/dmu_objset.c vendor-sys/illumos/dist/uts/common/fs/zfs/dmu_traverse.c vendor-sys/illumos/dist/uts/common/fs/zfs/dsl_scan.c vendor-sys/illumos/dist/uts/common/fs/zfs/metaslab.c vendor-sys/illumos/dist/uts/common/fs/zfs/range_tree.c vendor-sys/illumos/dist/uts/common/fs/zfs/spa.c vendor-sys/illumos/dist/uts/common/fs/zfs/spa_misc.c vendor-sys/illumos/dist/uts/common/fs/zfs/sys/arc.h vendor-sys/illumos/dist/uts/common/fs/zfs/sys/dsl_pool.h vendor-sys/illumos/dist/uts/common/fs/zfs/sys/dsl_scan.h vendor-sys/illumos/dist/uts/common/fs/zfs/sys/range_tree.h vendor-sys/illumos/dist/uts/common/fs/zfs/sys/spa_impl.h vendor-sys/illumos/dist/uts/common/fs/zfs/sys/vdev.h vendor-sys/illumos/dist/uts/common/fs/zfs/sys/vdev_impl.h vendor-sys/illumos/dist/uts/common/fs/zfs/sys/zio.h vendor-sys/illumos/dist/uts/common/fs/zfs/vdev.c vendor-sys/illumos/dist/uts/common/fs/zfs/vdev_disk.c vendor-sys/illumos/dist/uts/common/fs/zfs/vdev_file.c vendor-sys/illumos/dist/uts/common/fs/zfs/vdev_indirect.c vendor-sys/illumos/dist/uts/common/fs/zfs/vdev_mirror.c vendor-sys/illumos/dist/uts/common/fs/zfs/vdev_missing.c vendor-sys/illumos/dist/uts/common/fs/zfs/vdev_queue.c vendor-sys/illumos/dist/uts/common/fs/zfs/vdev_raidz.c vendor-sys/illumos/dist/uts/common/fs/zfs/vdev_root.c vendor-sys/illumos/dist/uts/common/fs/zfs/zio.c vendor-sys/illumos/dist/uts/common/sys/fs/zfs.h vendor-sys/illumos/dist/uts/common/sys/taskq.h Modified: vendor/illumos/dist/cmd/zdb/zdb.c ============================================================================== --- vendor/illumos/dist/cmd/zdb/zdb.c Thu Nov 21 13:35:43 2019 (r354948) +++ vendor/illumos/dist/cmd/zdb/zdb.c Thu Nov 21 13:46:16 2019 (r354949) @@ -2384,8 +2384,6 @@ dump_dir(objset_t *os) max_slot_used = object + dnode_slots - 1; } - ASSERT3U(object_count, ==, usedobjs); - (void) printf("\n"); (void) printf(" Dnode slots:\n"); @@ -2408,6 +2406,8 @@ dump_dir(objset_t *os) leaked_objects); leaked_objects = 0; } + + ASSERT3U(object_count, ==, usedobjs); } static void @@ -2975,7 +2975,7 @@ zdb_blkptr_done(zio_t *zio) abd_free(zio->io_abd); mutex_enter(&spa->spa_scrub_lock); - spa->spa_scrub_inflight--; + spa->spa_load_verify_ios--; cv_broadcast(&spa->spa_scrub_io_cv); if (ioerr && !(zio->io_flags & ZIO_FLAG_SPECULATIVE)) { @@ -3046,9 +3046,9 @@ zdb_blkptr_cb(spa_t *spa, zilog_t *zilog, const blkptr flags |= ZIO_FLAG_SPECULATIVE; mutex_enter(&spa->spa_scrub_lock); - while (spa->spa_scrub_inflight > max_inflight) + while (spa->spa_load_verify_ios > max_inflight) cv_wait(&spa->spa_scrub_io_cv, &spa->spa_scrub_lock); - spa->spa_scrub_inflight++; + spa->spa_load_verify_ios++; mutex_exit(&spa->spa_scrub_lock); zio_nowait(zio_read(NULL, spa, bp, abd, size, Modified: vendor/illumos/dist/cmd/zpool/zpool_main.c ============================================================================== --- vendor/illumos/dist/cmd/zpool/zpool_main.c Thu Nov 21 13:35:43 2019 (r354948) +++ vendor/illumos/dist/cmd/zpool/zpool_main.c Thu Nov 21 13:46:16 2019 (r354949) @@ -1688,7 +1688,7 @@ print_status_config(zpool_handle_t *zhp, status_cbdata (void) nvlist_lookup_uint64_array(nv, ZPOOL_CONFIG_SCAN_STATS, (uint64_t **)&ps, &c); - if (ps && ps->pss_state == DSS_SCANNING && + if (ps != NULL && ps->pss_state == DSS_SCANNING && vs->vs_scan_processed != 0 && children == 0) { (void) printf(gettext(" (%s)"), (ps->pss_func == POOL_SCAN_RESILVER) ? @@ -4707,11 +4707,13 @@ static void print_scan_status(pool_scan_stat_t *ps) { time_t start, end, pause; - uint64_t elapsed, mins_left, hours_left; - uint64_t pass_exam, examined, total; - uint_t rate; + uint64_t total_secs_left; + uint64_t elapsed, secs_left, mins_left, hours_left, days_left; + uint64_t pass_scanned, scanned, pass_issued, issued, total; + uint_t scan_rate, issue_rate; double fraction_done; - char processed_buf[7], examined_buf[7], total_buf[7], rate_buf[7]; + char processed_buf[7], scanned_buf[7], issued_buf[7], total_buf[7]; + char srate_buf[7], irate_buf[7]; (void) printf(gettext(" scan: ")); @@ -4725,30 +4727,37 @@ print_scan_status(pool_scan_stat_t *ps) start = ps->pss_start_time; end = ps->pss_end_time; pause = ps->pss_pass_scrub_pause; + zfs_nicenum(ps->pss_processed, processed_buf, sizeof (processed_buf)); assert(ps->pss_func == POOL_SCAN_SCRUB || ps->pss_func == POOL_SCAN_RESILVER); + /* * Scan is finished or canceled. */ if (ps->pss_state == DSS_FINISHED) { - uint64_t minutes_taken = (end - start) / 60; - char *fmt = NULL; + total_secs_left = end - start; + days_left = total_secs_left / 60 / 60 / 24; + hours_left = (total_secs_left / 60 / 60) % 24; + mins_left = (total_secs_left / 60) % 60; + secs_left = (total_secs_left % 60); if (ps->pss_func == POOL_SCAN_SCRUB) { - fmt = gettext("scrub repaired %s in %lluh%um with " - "%llu errors on %s"); + (void) printf(gettext("scrub repaired %s " + "in %llu days %02llu:%02llu:%02llu " + "with %llu errors on %s"), processed_buf, + (u_longlong_t)days_left, (u_longlong_t)hours_left, + (u_longlong_t)mins_left, (u_longlong_t)secs_left, + (u_longlong_t)ps->pss_errors, ctime(&end)); } else if (ps->pss_func == POOL_SCAN_RESILVER) { - fmt = gettext("resilvered %s in %lluh%um with " - "%llu errors on %s"); + (void) printf(gettext("resilvered %s " + "in %llu days %02llu:%02llu:%02llu " + "with %llu errors on %s"), processed_buf, + (u_longlong_t)days_left, (u_longlong_t)hours_left, + (u_longlong_t)mins_left, (u_longlong_t)secs_left, + (u_longlong_t)ps->pss_errors, ctime(&end)); } - /* LINTED */ - (void) printf(fmt, processed_buf, - (u_longlong_t)(minutes_taken / 60), - (uint_t)(minutes_taken % 60), - (u_longlong_t)ps->pss_errors, - ctime((time_t *)&end)); return; } else if (ps->pss_state == DSS_CANCELED) { if (ps->pss_func == POOL_SCAN_SCRUB) { @@ -4763,19 +4772,15 @@ print_scan_status(pool_scan_stat_t *ps) assert(ps->pss_state == DSS_SCANNING); - /* - * Scan is in progress. - */ + /* Scan is in progress. Resilvers can't be paused. */ if (ps->pss_func == POOL_SCAN_SCRUB) { if (pause == 0) { (void) printf(gettext("scrub in progress since %s"), ctime(&start)); } else { - char buf[32]; - struct tm *p = localtime(&pause); - (void) strftime(buf, sizeof (buf), "%a %b %e %T %Y", p); - (void) printf(gettext("scrub paused since %s\n"), buf); - (void) printf(gettext("\tscrub started on %s"), + (void) printf(gettext("scrub paused since %s"), + ctime(&pause)); + (void) printf(gettext("\tscrub started on %s"), ctime(&start)); } } else if (ps->pss_func == POOL_SCAN_RESILVER) { @@ -4783,49 +4788,67 @@ print_scan_status(pool_scan_stat_t *ps) ctime(&start)); } - examined = ps->pss_examined ? ps->pss_examined : 1; + scanned = ps->pss_examined; + pass_scanned = ps->pss_pass_exam; + issued = ps->pss_issued; + pass_issued = ps->pss_pass_issued; total = ps->pss_to_examine; - fraction_done = (double)examined / total; - /* elapsed time for this pass */ + /* we are only done with a block once we have issued the IO for it */ + fraction_done = (double)issued / total; + + /* elapsed time for this pass, rounding up to 1 if it's 0 */ elapsed = time(NULL) - ps->pss_pass_start; elapsed -= ps->pss_pass_scrub_spent_paused; - elapsed = elapsed ? elapsed : 1; - pass_exam = ps->pss_pass_exam ? ps->pss_pass_exam : 1; - rate = pass_exam / elapsed; - rate = rate ? rate : 1; - mins_left = ((total - examined) / rate) / 60; - hours_left = mins_left / 60; + elapsed = (elapsed != 0) ? elapsed : 1; - zfs_nicenum(examined, examined_buf, sizeof (examined_buf)); + scan_rate = pass_scanned / elapsed; + issue_rate = pass_issued / elapsed; + total_secs_left = (issue_rate != 0) ? + ((total - issued) / issue_rate) : UINT64_MAX; + + days_left = total_secs_left / 60 / 60 / 24; + hours_left = (total_secs_left / 60 / 60) % 24; + mins_left = (total_secs_left / 60) % 60; + secs_left = (total_secs_left % 60); + + /* format all of the numbers we will be reporting */ + zfs_nicenum(scanned, scanned_buf, sizeof (scanned_buf)); + zfs_nicenum(issued, issued_buf, sizeof (issued_buf)); zfs_nicenum(total, total_buf, sizeof (total_buf)); + zfs_nicenum(scan_rate, srate_buf, sizeof (srate_buf)); + zfs_nicenum(issue_rate, irate_buf, sizeof (irate_buf)); - /* - * do not print estimated time if hours_left is more than 30 days - * or we have a paused scrub - */ + /* do not print estimated time if we have a paused scrub */ if (pause == 0) { - zfs_nicenum(rate, rate_buf, sizeof (rate_buf)); - (void) printf(gettext("\t%s scanned out of %s at %s/s"), - examined_buf, total_buf, rate_buf); - if (hours_left < (30 * 24)) { - (void) printf(gettext(", %lluh%um to go\n"), - (u_longlong_t)hours_left, (uint_t)(mins_left % 60)); - } else { - (void) printf(gettext( - ", (scan is slow, no estimated time)\n")); - } + (void) printf(gettext("\t%s scanned at %s/s, " + "%s issued at %s/s, %s total\n"), + scanned_buf, srate_buf, issued_buf, irate_buf, total_buf); } else { - (void) printf(gettext("\t%s scanned out of %s\n"), - examined_buf, total_buf); + (void) printf(gettext("\t%s scanned, %s issued, %s total\n"), + scanned_buf, issued_buf, total_buf); } if (ps->pss_func == POOL_SCAN_RESILVER) { - (void) printf(gettext(" %s resilvered, %.2f%% done\n"), + (void) printf(gettext("\t%s resilvered, %.2f%% done"), processed_buf, 100 * fraction_done); } else if (ps->pss_func == POOL_SCAN_SCRUB) { - (void) printf(gettext(" %s repaired, %.2f%% done\n"), + (void) printf(gettext("\t%s repaired, %.2f%% done"), processed_buf, 100 * fraction_done); + } + + if (pause == 0) { + if (issue_rate >= 10 * 1024 * 1024) { + (void) printf(gettext(", %llu days " + "%02llu:%02llu:%02llu to go\n"), + (u_longlong_t)days_left, (u_longlong_t)hours_left, + (u_longlong_t)mins_left, (u_longlong_t)secs_left); + } else { + (void) printf(gettext(", no estimated " + "completion time\n")); + } + } else { + (void) printf(gettext("\n")); } } Modified: vendor/illumos/dist/cmd/ztest/ztest.c ============================================================================== --- vendor/illumos/dist/cmd/ztest/ztest.c Thu Nov 21 13:35:43 2019 (r354948) +++ vendor/illumos/dist/cmd/ztest/ztest.c Thu Nov 21 13:46:16 2019 (r354949) @@ -397,15 +397,15 @@ ztest_info_t ztest_info[] = { { ztest_fzap, 1, &zopt_sometimes }, { ztest_dmu_snapshot_create_destroy, 1, &zopt_sometimes }, { ztest_spa_create_destroy, 1, &zopt_sometimes }, - { ztest_fault_inject, 1, &zopt_sometimes }, + { ztest_fault_inject, 1, &zopt_incessant }, { ztest_ddt_repair, 1, &zopt_sometimes }, { ztest_dmu_snapshot_hold, 1, &zopt_sometimes }, { ztest_mmp_enable_disable, 1, &zopt_sometimes }, { ztest_reguid, 1, &zopt_rarely }, - { ztest_scrub, 1, &zopt_rarely }, + { ztest_scrub, 1, &zopt_often }, { ztest_spa_upgrade, 1, &zopt_rarely }, { ztest_dsl_dataset_promote_busy, 1, &zopt_rarely }, - { ztest_vdev_attach_detach, 1, &zopt_sometimes }, + { ztest_vdev_attach_detach, 1, &zopt_incessant }, { ztest_vdev_LUN_growth, 1, &zopt_rarely }, { ztest_vdev_add_remove, 1, &ztest_opts.zo_vdevtime }, Modified: vendor/illumos/dist/lib/libzfs/common/libzfs_status.c ============================================================================== --- vendor/illumos/dist/lib/libzfs/common/libzfs_status.c Thu Nov 21 13:35:43 2019 (r354948) +++ vendor/illumos/dist/lib/libzfs/common/libzfs_status.c Thu Nov 21 13:46:16 2019 (r354949) @@ -225,7 +225,7 @@ check_status(nvlist_t *config, boolean_t isimport) */ (void) nvlist_lookup_uint64_array(nvroot, ZPOOL_CONFIG_SCAN_STATS, (uint64_t **)&ps, &psc); - if (ps && ps->pss_func == POOL_SCAN_RESILVER && + if (ps != NULL && ps->pss_func == POOL_SCAN_RESILVER && ps->pss_state == DSS_SCANNING) return (ZPOOL_STATUS_RESILVERING); From owner-svn-src-all@freebsd.org Thu Nov 21 13:56:17 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id D32441BF73A; Thu, 21 Nov 2019 13:56:17 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47Jh1F5DJGz4QQc; Thu, 21 Nov 2019 13:56:17 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 96A6BC437; Thu, 21 Nov 2019 13:56:17 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xALDuHbe041488; Thu, 21 Nov 2019 13:56:17 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xALDuHGs041485; Thu, 21 Nov 2019 13:56:17 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201911211356.xALDuHGs041485@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Thu, 21 Nov 2019 13:56:17 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354950 - in head: contrib/amd/amd usr.sbin/jail X-SVN-Group: head X-SVN-Commit-Author: emaste X-SVN-Commit-Paths: in head: contrib/amd/amd usr.sbin/jail X-SVN-Commit-Revision: 354950 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 21 Nov 2019 13:56:17 -0000 Author: emaste Date: Thu Nov 21 13:56:16 2019 New Revision: 354950 URL: https://svnweb.freebsd.org/changeset/base/354950 Log: revert r354935 and apply fix for cleandir failure This reapplies the RISC-V GNU ld workaround from r354896, r354899, and 354900, along with a fix for the build failure during cleandir. LINKER_TYPE was not being set during cleandir, resulting in Malformed conditional (${LINKER_TYPE} == "bfd" && ${MACHINE} == "riscv") from Cirrus-CI. PR: 242109 Sponsored by: The FreeBSD Foundation Modified: head/contrib/amd/amd/amd.8 head/contrib/amd/amd/amd.c head/usr.sbin/jail/Makefile Modified: head/contrib/amd/amd/amd.8 ============================================================================== --- head/contrib/amd/amd/amd.8 Thu Nov 21 13:46:16 2019 (r354949) +++ head/contrib/amd/amd/amd.8 Thu Nov 21 13:56:16 2019 (r354950) @@ -72,7 +72,8 @@ .Ar ... .Sh DESCRIPTION .Bf -symbolic -This daemon is obsolete. +This daemon is deprecated and will be removed before +.Fx 13.0 . Users are advised to use .Xr autofs 5 instead. Modified: head/contrib/amd/amd/amd.c ============================================================================== --- head/contrib/amd/amd/amd.c Thu Nov 21 13:46:16 2019 (r354949) +++ head/contrib/amd/amd/amd.c Thu Nov 21 13:56:16 2019 (r354950) @@ -414,6 +414,8 @@ main(int argc, char *argv[]) progname = "amd"; am_set_progname(progname); + plog(XLOG_WARNING, "built-in amd in FreeBSD is deprecated and will be removed before FreeBSD 13"); + /* * Initialize process id. This is kept * cached since it is used for generating Modified: head/usr.sbin/jail/Makefile ============================================================================== --- head/usr.sbin/jail/Makefile Thu Nov 21 13:46:16 2019 (r354949) +++ head/usr.sbin/jail/Makefile Thu Nov 21 13:56:16 2019 (r354950) @@ -15,6 +15,13 @@ NO_WMISSING_VARIABLE_DECLARATIONS= YFLAGS+=-v CFLAGS+=-I. -I${.CURDIR} +# workaround for GNU ld (GNU Binutils) 2.33.1: +# relocation truncated to fit: R_RISCV_GPREL_I against `.LANCHOR2' +# https://bugs.freebsd.org/242109 +.if defined(LINKER_TYPE) && ${LINKER_TYPE} == "bfd" && ${MACHINE} == "riscv" +CFLAGS+=-Wl,--no-relax +.endif + .if ${MK_INET6_SUPPORT} != "no" CFLAGS+= -DINET6 .endif From owner-svn-src-all@freebsd.org Thu Nov 21 13:57:30 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id EAFBF1BF904; Thu, 21 Nov 2019 13:57:30 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47Jh2f60zzz4QdH; Thu, 21 Nov 2019 13:57:30 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id B285CC440; Thu, 21 Nov 2019 13:57:30 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xALDvUJZ041607; Thu, 21 Nov 2019 13:57:30 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xALDvUv0041606; Thu, 21 Nov 2019 13:57:30 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201911211357.xALDvUv0041606@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Thu, 21 Nov 2019 13:57:30 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354951 - head/contrib/amd/amd X-SVN-Group: head X-SVN-Commit-Author: emaste X-SVN-Commit-Paths: head/contrib/amd/amd X-SVN-Commit-Revision: 354951 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 21 Nov 2019 13:57:31 -0000 Author: emaste Date: Thu Nov 21 13:57:30 2019 New Revision: 354951 URL: https://svnweb.freebsd.org/changeset/base/354951 Log: revert contrib/amd changes accidentally committed with r354950 Modified: head/contrib/amd/amd/amd.8 head/contrib/amd/amd/amd.c Modified: head/contrib/amd/amd/amd.8 ============================================================================== --- head/contrib/amd/amd/amd.8 Thu Nov 21 13:56:16 2019 (r354950) +++ head/contrib/amd/amd/amd.8 Thu Nov 21 13:57:30 2019 (r354951) @@ -72,8 +72,7 @@ .Ar ... .Sh DESCRIPTION .Bf -symbolic -This daemon is deprecated and will be removed before -.Fx 13.0 . +This daemon is obsolete. Users are advised to use .Xr autofs 5 instead. Modified: head/contrib/amd/amd/amd.c ============================================================================== --- head/contrib/amd/amd/amd.c Thu Nov 21 13:56:16 2019 (r354950) +++ head/contrib/amd/amd/amd.c Thu Nov 21 13:57:30 2019 (r354951) @@ -414,8 +414,6 @@ main(int argc, char *argv[]) progname = "amd"; am_set_progname(progname); - plog(XLOG_WARNING, "built-in amd in FreeBSD is deprecated and will be removed before FreeBSD 13"); - /* * Initialize process id. This is kept * cached since it is used for generating From owner-svn-src-all@freebsd.org Thu Nov 21 13:59:02 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 42E581BF9D7; Thu, 21 Nov 2019 13:59:02 +0000 (UTC) (envelope-from andrew@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47Jh4Q15Dvz4QmR; Thu, 21 Nov 2019 13:59:02 +0000 (UTC) (envelope-from andrew@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 08CD9C441; Thu, 21 Nov 2019 13:59:02 +0000 (UTC) (envelope-from andrew@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xALDx1ng041715; Thu, 21 Nov 2019 13:59:01 GMT (envelope-from andrew@FreeBSD.org) Received: (from andrew@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xALDx1Bx041714; Thu, 21 Nov 2019 13:59:01 GMT (envelope-from andrew@FreeBSD.org) Message-Id: <201911211359.xALDx1Bx041714@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: andrew set sender to andrew@FreeBSD.org using -f From: Andrew Turner Date: Thu, 21 Nov 2019 13:59:01 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354952 - head/sys/kern X-SVN-Group: head X-SVN-Commit-Author: andrew X-SVN-Commit-Paths: head/sys/kern X-SVN-Commit-Revision: 354952 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 21 Nov 2019 13:59:02 -0000 Author: andrew Date: Thu Nov 21 13:59:01 2019 New Revision: 354952 URL: https://svnweb.freebsd.org/changeset/base/354952 Log: Disable KCSAN within a panic. The kernel is single threaded at this point and the panic is more important. Sponsored by: DARPA, AFRL Modified: head/sys/kern/subr_csan.c Modified: head/sys/kern/subr_csan.c ============================================================================== --- head/sys/kern/subr_csan.c Thu Nov 21 13:57:30 2019 (r354951) +++ head/sys/kern/subr_csan.c Thu Nov 21 13:59:01 2019 (r354952) @@ -153,6 +153,8 @@ kcsan_access(uintptr_t addr, size_t size, bool write, return; if (__predict_false(kcsan_md_unsupported((vm_offset_t)addr))) return; + if (__predict_false(panicstr != NULL)) + return; new.addr = addr; new.size = size; From owner-svn-src-all@freebsd.org Thu Nov 21 13:59:08 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 8CFA31BFA0D; Thu, 21 Nov 2019 13:59:08 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47Jh4X1qtkz4QqL; Thu, 21 Nov 2019 13:59:08 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id CE709C442; Thu, 21 Nov 2019 13:59:07 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xALDx7Me041771; Thu, 21 Nov 2019 13:59:07 GMT (envelope-from avg@FreeBSD.org) Received: (from avg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xALDx6X7041764; Thu, 21 Nov 2019 13:59:06 GMT (envelope-from avg@FreeBSD.org) Message-Id: <201911211359.xALDx6X7041764@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avg set sender to avg@FreeBSD.org using -f From: Andriy Gapon Date: Thu, 21 Nov 2019 13:59:06 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-vendor@freebsd.org Subject: svn commit: r354953 - in vendor-sys/illumos/dist/uts/common: fs fs/zfs sys X-SVN-Group: vendor-sys X-SVN-Commit-Author: avg X-SVN-Commit-Paths: in vendor-sys/illumos/dist/uts/common: fs fs/zfs sys X-SVN-Commit-Revision: 354953 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 21 Nov 2019 13:59:08 -0000 Author: avg Date: Thu Nov 21 13:59:06 2019 New Revision: 354953 URL: https://svnweb.freebsd.org/changeset/base/354953 Log: 10573 define TASKQID_INVALID as (taskq_id)0 illumos/illumos-gate@fc8ae2ec4282de7ec96f48e11078345f3dc0ac3d https://github.com/illumos/illumos-gate/commit/fc8ae2ec4282de7ec96f48e11078345f3dc0ac3d https://www.illumos.org/issues/10573 We do have taskqid_t taskq_dispatch() and the result of this function is compared with 0, NULL and combined with type casts. Define TASKQID_INVALID (taskq_id)0 and use TASKQID_INVALID everywhere. Author: Toomas Soome Modified: vendor-sys/illumos/dist/uts/common/fs/vnode.c vendor-sys/illumos/dist/uts/common/fs/zfs/dmu_traverse.c vendor-sys/illumos/dist/uts/common/fs/zfs/metaslab.c vendor-sys/illumos/dist/uts/common/fs/zfs/vdev.c vendor-sys/illumos/dist/uts/common/fs/zfs/vdev_file.c vendor-sys/illumos/dist/uts/common/fs/zfs/zil.c vendor-sys/illumos/dist/uts/common/sys/taskq.h Modified: vendor-sys/illumos/dist/uts/common/fs/vnode.c ============================================================================== --- vendor-sys/illumos/dist/uts/common/fs/vnode.c Thu Nov 21 13:59:01 2019 (r354952) +++ vendor-sys/illumos/dist/uts/common/fs/vnode.c Thu Nov 21 13:59:06 2019 (r354953) @@ -915,7 +915,7 @@ vn_rele_async(vnode_t *vp, taskq_t *taskq) if (vp->v_count == 1) { mutex_exit(&vp->v_lock); VERIFY(taskq_dispatch(taskq, (task_func_t *)vn_rele_inactive, - vp, TQ_SLEEP) != NULL); + vp, TQ_SLEEP) != TASKQID_INVALID); return; } VN_RELE_LOCKED(vp); Modified: vendor-sys/illumos/dist/uts/common/fs/zfs/dmu_traverse.c ============================================================================== --- vendor-sys/illumos/dist/uts/common/fs/zfs/dmu_traverse.c Thu Nov 21 13:59:01 2019 (r354952) +++ vendor-sys/illumos/dist/uts/common/fs/zfs/dmu_traverse.c Thu Nov 21 13:59:06 2019 (r354953) @@ -599,8 +599,8 @@ traverse_impl(spa_t *spa, dsl_dataset_t *ds, uint64_t } if (!(flags & TRAVERSE_PREFETCH_DATA) || - 0 == taskq_dispatch(system_taskq, traverse_prefetch_thread, - &td, TQ_NOQUEUE)) + taskq_dispatch(system_taskq, traverse_prefetch_thread, + &td, TQ_NOQUEUE) == TASKQID_INVALID) pd.pd_exited = B_TRUE; SET_BOOKMARK(&czb, td.td_objset, Modified: vendor-sys/illumos/dist/uts/common/fs/zfs/metaslab.c ============================================================================== --- vendor-sys/illumos/dist/uts/common/fs/zfs/metaslab.c Thu Nov 21 13:59:01 2019 (r354952) +++ vendor-sys/illumos/dist/uts/common/fs/zfs/metaslab.c Thu Nov 21 13:59:06 2019 (r354953) @@ -2511,7 +2511,7 @@ metaslab_group_preload(metaslab_group_t *mg) } VERIFY(taskq_dispatch(mg->mg_taskq, metaslab_preload, - msp, TQ_SLEEP) != NULL); + msp, TQ_SLEEP) != TASKQID_INVALID); } mutex_exit(&mg->mg_lock); } Modified: vendor-sys/illumos/dist/uts/common/fs/zfs/vdev.c ============================================================================== --- vendor-sys/illumos/dist/uts/common/fs/zfs/vdev.c Thu Nov 21 13:59:01 2019 (r354952) +++ vendor-sys/illumos/dist/uts/common/fs/zfs/vdev.c Thu Nov 21 13:59:06 2019 (r354953) @@ -1489,7 +1489,7 @@ vdev_open_children(vdev_t *vd) for (int c = 0; c < children; c++) VERIFY(taskq_dispatch(tq, vdev_open_child, vd->vdev_child[c], - TQ_SLEEP) != NULL); + TQ_SLEEP) != TASKQID_INVALID); taskq_destroy(tq); } Modified: vendor-sys/illumos/dist/uts/common/fs/zfs/vdev_file.c ============================================================================== --- vendor-sys/illumos/dist/uts/common/fs/zfs/vdev_file.c Thu Nov 21 13:59:01 2019 (r354952) +++ vendor-sys/illumos/dist/uts/common/fs/zfs/vdev_file.c Thu Nov 21 13:59:06 2019 (r354953) @@ -245,7 +245,7 @@ vdev_file_io_start(zio_t *zio) bp->b_iodone = vdev_file_io_intr; VERIFY3U(taskq_dispatch(system_taskq, vdev_file_io_strategy, bp, - TQ_SLEEP), !=, 0); + TQ_SLEEP), !=, TASKQID_INVALID); } /* ARGSUSED */ Modified: vendor-sys/illumos/dist/uts/common/fs/zfs/zil.c ============================================================================== --- vendor-sys/illumos/dist/uts/common/fs/zfs/zil.c Thu Nov 21 13:59:01 2019 (r354952) +++ vendor-sys/illumos/dist/uts/common/fs/zfs/zil.c Thu Nov 21 13:59:06 2019 (r354953) @@ -1891,7 +1891,8 @@ zil_clean(zilog_t *zilog, uint64_t synced_txg) ASSERT3P(zilog->zl_dmu_pool, !=, NULL); ASSERT3P(zilog->zl_dmu_pool->dp_zil_clean_taskq, !=, NULL); if (taskq_dispatch(zilog->zl_dmu_pool->dp_zil_clean_taskq, - (void (*)(void *))zil_itxg_clean, clean_me, TQ_NOSLEEP) == NULL) + (void (*)(void *))zil_itxg_clean, clean_me, TQ_NOSLEEP) == + TASKQID_INVALID) zil_itxg_clean(clean_me); } Modified: vendor-sys/illumos/dist/uts/common/sys/taskq.h ============================================================================== --- vendor-sys/illumos/dist/uts/common/sys/taskq.h Thu Nov 21 13:59:01 2019 (r354952) +++ vendor-sys/illumos/dist/uts/common/sys/taskq.h Thu Nov 21 13:59:06 2019 (r354953) @@ -60,6 +60,8 @@ struct proc; #define TQ_NOALLOC 0x04 /* cannot allocate memory; may fail */ #define TQ_FRONT 0x08 /* Put task at the front of the queue */ +#define TASKQID_INVALID ((taskqid_t)0) + #ifdef _KERNEL extern taskq_t *system_taskq; From owner-svn-src-all@freebsd.org Thu Nov 21 14:00:12 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id DE2701BFB21; Thu, 21 Nov 2019 14:00:12 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47Jh5m5TCPz4R2v; Thu, 21 Nov 2019 14:00:12 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 9F7EEC44B; Thu, 21 Nov 2019 14:00:12 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xALE0Cbi041939; Thu, 21 Nov 2019 14:00:12 GMT (envelope-from avg@FreeBSD.org) Received: (from avg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xALE0AtL041927; Thu, 21 Nov 2019 14:00:10 GMT (envelope-from avg@FreeBSD.org) Message-Id: <201911211400.xALE0AtL041927@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avg set sender to avg@FreeBSD.org using -f From: Andriy Gapon Date: Thu, 21 Nov 2019 14:00:10 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-vendor@freebsd.org Subject: svn commit: r354954 - vendor-sys/illumos/dist/uts/common/fs/zfs vendor-sys/illumos/dist/uts/common/fs/zfs/sys vendor/illumos/dist/cmd/zinject X-SVN-Group: vendor-sys X-SVN-Commit-Author: avg X-SVN-Commit-Paths: vendor-sys/illumos/dist/uts/common/fs/zfs vendor-sys/illumos/dist/uts/common/fs/zfs/sys vendor/illumos/dist/cmd/zinject X-SVN-Commit-Revision: 354954 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 21 Nov 2019 14:00:12 -0000 Author: avg Date: Thu Nov 21 14:00:09 2019 New Revision: 354954 URL: https://svnweb.freebsd.org/changeset/base/354954 Log: 10566 Multiple DVA Scrubbing Fix illumos/illumos-gate@12a8814c13fbb1d6d58616cf090ea5815dc107f9 https://github.com/illumos/illumos-gate/commit/12a8814c13fbb1d6d58616cf090ea5815dc107f9 https://www.illumos.org/issues/10566 ZoL PR_8453 Author: Tom Caputi Date: Fri Mar 15 17:14:31 2019 -0400 Multiple DVA Scrubbing Fix Currently, there is an issue in the sequential scrub code which prevents self healing from working in some cases. The scrub code will split up all DVA copies of a bp and issue each of them separately. The problem is that, since each of the DVAs is no longer associated with the others, the self healing code doesn't have the opportunity to repair problems that show up in one of the DVAs with the data from the others. This patch fixes this issue by ensuring that all IOs issued by the sequential scrub code include all DVAs. Initially, only the first DVA of each is attempted. If an issue arises, the IO is retried with all available copies, giving the self healing code a chance to correct the issue. To test this change, this patch also adds the ability for zinject to specify individual DVAs to inject read errors into. We then add a new test case that utilizes this functionality to ensure scrubs and self-healing reads can handle and transparently fix issues with individual copies of blocks. This update is followup on #10405 While attempting to port this update, the following ZoL updates are included: 551905dd4 vdev_mirror: kstat observables for preferred vdev d6c6590c5 vdev_mirror: load balancing fixes 9f500936c FreeBSD r256956: Improve ZFS N-way mirror read performance by Portions contributed by: Toomas Soome Portions contributed by: Jerry Jelinek Author: Tom Caputi Modified: vendor-sys/illumos/dist/uts/common/fs/zfs/dsl_scan.c vendor-sys/illumos/dist/uts/common/fs/zfs/metaslab.c vendor-sys/illumos/dist/uts/common/fs/zfs/spa_misc.c vendor-sys/illumos/dist/uts/common/fs/zfs/sys/spa.h vendor-sys/illumos/dist/uts/common/fs/zfs/sys/vdev.h vendor-sys/illumos/dist/uts/common/fs/zfs/sys/vdev_impl.h vendor-sys/illumos/dist/uts/common/fs/zfs/sys/zfs_ioctl.h vendor-sys/illumos/dist/uts/common/fs/zfs/vdev.c vendor-sys/illumos/dist/uts/common/fs/zfs/vdev_disk.c vendor-sys/illumos/dist/uts/common/fs/zfs/vdev_file.c vendor-sys/illumos/dist/uts/common/fs/zfs/vdev_mirror.c vendor-sys/illumos/dist/uts/common/fs/zfs/vdev_queue.c vendor-sys/illumos/dist/uts/common/fs/zfs/zio_inject.c Changes in other areas also in this revision: Modified: vendor/illumos/dist/cmd/zinject/zinject.c Modified: vendor-sys/illumos/dist/uts/common/fs/zfs/dsl_scan.c ============================================================================== --- vendor-sys/illumos/dist/uts/common/fs/zfs/dsl_scan.c Thu Nov 21 13:59:06 2019 (r354953) +++ vendor-sys/illumos/dist/uts/common/fs/zfs/dsl_scan.c Thu Nov 21 14:00:09 2019 (r354954) @@ -249,24 +249,43 @@ typedef enum { */ typedef struct scan_io { /* fields from blkptr_t */ - uint64_t sio_offset; uint64_t sio_blk_prop; uint64_t sio_phys_birth; uint64_t sio_birth; zio_cksum_t sio_cksum; - uint32_t sio_asize; + uint32_t sio_nr_dvas; /* fields from zio_t */ - int sio_flags; + uint32_t sio_flags; zbookmark_phys_t sio_zb; /* members for queue sorting */ union { - avl_node_t sio_addr_node; /* link into issueing queue */ + avl_node_t sio_addr_node; /* link into issuing queue */ list_node_t sio_list_node; /* link for issuing to disk */ } sio_nodes; + + /* + * There may be up to SPA_DVAS_PER_BP DVAs here from the bp, + * depending on how many were in the original bp. Only the + * first DVA is really used for sorting and issuing purposes. + * The other DVAs (if provided) simply exist so that the zio + * layer can find additional copies to repair from in the + * event of an error. This array must go at the end of the + * struct to allow this for the variable number of elements. + */ + dva_t sio_dva[0]; } scan_io_t; +#define SIO_SET_OFFSET(sio, x) DVA_SET_OFFSET(&(sio)->sio_dva[0], x) +#define SIO_SET_ASIZE(sio, x) DVA_SET_ASIZE(&(sio)->sio_dva[0], x) +#define SIO_GET_OFFSET(sio) DVA_GET_OFFSET(&(sio)->sio_dva[0]) +#define SIO_GET_ASIZE(sio) DVA_GET_ASIZE(&(sio)->sio_dva[0]) +#define SIO_GET_END_OFFSET(sio) \ + (SIO_GET_OFFSET(sio) + SIO_GET_ASIZE(sio)) +#define SIO_GET_MUSED(sio) \ + (sizeof (scan_io_t) + ((sio)->sio_nr_dvas * sizeof (dva_t))) + struct dsl_scan_io_queue { dsl_scan_t *q_scn; /* associated dsl_scan_t */ vdev_t *q_vd; /* top-level vdev that this queue represents */ @@ -275,6 +294,7 @@ struct dsl_scan_io_queue { range_tree_t *q_exts_by_addr; avl_tree_t q_exts_by_size; avl_tree_t q_sios_by_addr; + uint64_t q_sio_memused; /* members for zio rate limiting */ uint64_t q_maxinflight_bytes; @@ -313,8 +333,28 @@ static void scan_io_queue_insert_impl(dsl_scan_io_queu static dsl_scan_io_queue_t *scan_io_queue_create(vdev_t *vd); static void scan_io_queues_destroy(dsl_scan_t *scn); -static kmem_cache_t *sio_cache; +static kmem_cache_t *sio_cache[SPA_DVAS_PER_BP]; +/* sio->sio_nr_dvas must be set so we know which cache to free from */ +static void +sio_free(scan_io_t *sio) +{ + ASSERT3U(sio->sio_nr_dvas, >, 0); + ASSERT3U(sio->sio_nr_dvas, <=, SPA_DVAS_PER_BP); + + kmem_cache_free(sio_cache[sio->sio_nr_dvas - 1], sio); +} + +/* It is up to the caller to set sio->sio_nr_dvas for freeing */ +static scan_io_t * +sio_alloc(unsigned short nr_dvas) +{ + ASSERT3U(nr_dvas, >, 0); + ASSERT3U(nr_dvas, <=, SPA_DVAS_PER_BP); + + return (kmem_cache_alloc(sio_cache[nr_dvas - 1], KM_SLEEP)); +} + void scan_init(void) { @@ -328,14 +368,22 @@ scan_init(void) */ fill_weight = zfs_scan_fill_weight; - sio_cache = kmem_cache_create("sio_cache", - sizeof (scan_io_t), 0, NULL, NULL, NULL, NULL, NULL, 0); + for (int i = 0; i < SPA_DVAS_PER_BP; i++) { + char name[36]; + + (void) sprintf(name, "sio_cache_%d", i); + sio_cache[i] = kmem_cache_create(name, + (sizeof (scan_io_t) + ((i + 1) * sizeof (dva_t))), + 0, NULL, NULL, NULL, NULL, NULL, 0); + } } void scan_fini(void) { - kmem_cache_destroy(sio_cache); + for (int i = 0; i < SPA_DVAS_PER_BP; i++) { + kmem_cache_destroy(sio_cache[i]); + } } static inline boolean_t @@ -352,29 +400,39 @@ dsl_scan_resilvering(dsl_pool_t *dp) } static inline void -sio2bp(const scan_io_t *sio, blkptr_t *bp, uint64_t vdev_id) +sio2bp(const scan_io_t *sio, blkptr_t *bp) { bzero(bp, sizeof (*bp)); - DVA_SET_ASIZE(&bp->blk_dva[0], sio->sio_asize); - DVA_SET_VDEV(&bp->blk_dva[0], vdev_id); - DVA_SET_OFFSET(&bp->blk_dva[0], sio->sio_offset); bp->blk_prop = sio->sio_blk_prop; bp->blk_phys_birth = sio->sio_phys_birth; bp->blk_birth = sio->sio_birth; bp->blk_fill = 1; /* we always only work with data pointers */ bp->blk_cksum = sio->sio_cksum; + + ASSERT3U(sio->sio_nr_dvas, >, 0); + ASSERT3U(sio->sio_nr_dvas, <=, SPA_DVAS_PER_BP); + + bcopy(sio->sio_dva, bp->blk_dva, sio->sio_nr_dvas * sizeof (dva_t)); } static inline void bp2sio(const blkptr_t *bp, scan_io_t *sio, int dva_i) { - /* we discard the vdev id, since we can deduce it from the queue */ - sio->sio_offset = DVA_GET_OFFSET(&bp->blk_dva[dva_i]); - sio->sio_asize = DVA_GET_ASIZE(&bp->blk_dva[dva_i]); sio->sio_blk_prop = bp->blk_prop; sio->sio_phys_birth = bp->blk_phys_birth; sio->sio_birth = bp->blk_birth; sio->sio_cksum = bp->blk_cksum; + sio->sio_nr_dvas = BP_GET_NDVAS(bp); + + /* + * Copy the DVAs to the sio. We need all copies of the block so + * that the self healing code can use the alternate copies if the + * first is corrupted. We want the DVA at index dva_i to be first + * in the sio since this is the primary one that we want to issue. + */ + for (int i = 0, j = dva_i; i < sio->sio_nr_dvas; i++, j++) { + sio->sio_dva[i] = bp->blk_dva[j % sio->sio_nr_dvas]; + } } int @@ -1076,11 +1134,9 @@ dsl_scan_should_clear(dsl_scan_t *scn) mutex_enter(&tvd->vdev_scan_io_queue_lock); queue = tvd->vdev_scan_io_queue; if (queue != NULL) { - /* #extents in exts_by_size = # in exts_by_addr */ + /* # extents in exts_by_size = # in exts_by_addr */ mused += avl_numnodes(&queue->q_exts_by_size) * - sizeof (range_seg_t) + - avl_numnodes(&queue->q_sios_by_addr) * - sizeof (scan_io_t); + sizeof (range_seg_t) + queue->q_sio_memused; } mutex_exit(&tvd->vdev_scan_io_queue_lock); } @@ -2546,13 +2602,13 @@ scan_io_queue_issue(dsl_scan_io_queue_t *queue, list_t break; } - sio2bp(sio, &bp, queue->q_vd->vdev_id); - bytes_issued += sio->sio_asize; + sio2bp(sio, &bp); + bytes_issued += SIO_GET_ASIZE(sio); scan_exec_io(scn->scn_dp, &bp, sio->sio_flags, &sio->sio_zb, queue); (void) list_remove_head(io_list); scan_io_queues_update_zio_stats(queue, &bp); - kmem_free(sio, sizeof (*sio)); + sio_free(sio); } atomic_add_64(&scn->scn_bytes_pending, -bytes_issued); @@ -2569,7 +2625,7 @@ scan_io_queue_issue(dsl_scan_io_queue_t *queue, list_t static boolean_t scan_io_queue_gather(dsl_scan_io_queue_t *queue, range_seg_t *rs, list_t *list) { - scan_io_t srch_sio, *sio, *next_sio; + scan_io_t *srch_sio, *sio, *next_sio; avl_index_t idx; uint_t num_sios = 0; int64_t bytes_issued = 0; @@ -2577,24 +2633,30 @@ scan_io_queue_gather(dsl_scan_io_queue_t *queue, range ASSERT(rs != NULL); ASSERT(MUTEX_HELD(&queue->q_vd->vdev_scan_io_queue_lock)); - srch_sio.sio_offset = rs->rs_start; + srch_sio = sio_alloc(1); + srch_sio->sio_nr_dvas = 1; + SIO_SET_OFFSET(srch_sio, rs->rs_start); /* * The exact start of the extent might not contain any matching zios, * so if that's the case, examine the next one in the tree. */ - sio = avl_find(&queue->q_sios_by_addr, &srch_sio, &idx); + sio = avl_find(&queue->q_sios_by_addr, srch_sio, &idx); + sio_free(srch_sio); + if (sio == NULL) sio = avl_nearest(&queue->q_sios_by_addr, idx, AVL_AFTER); - while (sio != NULL && sio->sio_offset < rs->rs_end && num_sios <= 32) { - ASSERT3U(sio->sio_offset, >=, rs->rs_start); - ASSERT3U(sio->sio_offset + sio->sio_asize, <=, rs->rs_end); + while (sio != NULL && + SIO_GET_OFFSET(sio) < rs->rs_end && num_sios <= 32) { + ASSERT3U(SIO_GET_OFFSET(sio), >=, rs->rs_start); + ASSERT3U(SIO_GET_END_OFFSET(sio), <=, rs->rs_end); next_sio = AVL_NEXT(&queue->q_sios_by_addr, sio); avl_remove(&queue->q_sios_by_addr, sio); + queue->q_sio_memused -= SIO_GET_MUSED(sio); - bytes_issued += sio->sio_asize; + bytes_issued += SIO_GET_ASIZE(sio); num_sios++; list_insert_tail(list, sio); sio = next_sio; @@ -2606,11 +2668,11 @@ scan_io_queue_gather(dsl_scan_io_queue_t *queue, range * in the segment we update it to reflect the work we were able to * complete. Otherwise, we remove it from the range tree entirely. */ - if (sio != NULL && sio->sio_offset < rs->rs_end) { + if (sio != NULL && SIO_GET_OFFSET(sio) < rs->rs_end) { range_tree_adjust_fill(queue->q_exts_by_addr, rs, -bytes_issued); range_tree_resize_segment(queue->q_exts_by_addr, rs, - sio->sio_offset, rs->rs_end - sio->sio_offset); + SIO_GET_OFFSET(sio), rs->rs_end - SIO_GET_OFFSET(sio)); return (B_TRUE); } else { @@ -2715,9 +2777,9 @@ scan_io_queues_run_one(void *arg) first_sio = list_head(&sio_list); last_sio = list_tail(&sio_list); - seg_end = last_sio->sio_offset + last_sio->sio_asize; + seg_end = SIO_GET_END_OFFSET(last_sio); if (seg_start == 0) - seg_start = first_sio->sio_offset; + seg_start = SIO_GET_OFFSET(first_sio); /* * Issuing sios can take a long time so drop the @@ -3369,10 +3431,23 @@ count_block(dsl_scan_t *scn, zfs_all_blkstats_t *zab, { int i; - /* update the spa's stats on how many bytes we have issued */ - for (i = 0; i < BP_GET_NDVAS(bp); i++) { + /* + * Update the spa's stats on how many bytes we have issued. + * Sequential scrubs create a zio for each DVA of the bp. Each + * of these will include all DVAs for repair purposes, but the + * zio code will only try the first one unless there is an issue. + * Therefore, we should only count the first DVA for these IOs. + */ + if (scn->scn_is_sorted) { atomic_add_64(&scn->scn_dp->dp_spa->spa_scan_pass_issued, - DVA_GET_ASIZE(&bp->blk_dva[i])); + DVA_GET_ASIZE(&bp->blk_dva[0])); + } else { + spa_t *spa = scn->scn_dp->dp_spa; + + for (i = 0; i < BP_GET_NDVAS(bp); i++) { + atomic_add_64(&spa->spa_scan_pass_issued, + DVA_GET_ASIZE(&bp->blk_dva[i])); + } } /* @@ -3426,7 +3501,7 @@ static void scan_io_queue_insert_impl(dsl_scan_io_queue_t *queue, scan_io_t *sio) { avl_index_t idx; - int64_t asize = sio->sio_asize; + int64_t asize = SIO_GET_ASIZE(sio); dsl_scan_t *scn = queue->q_scn; ASSERT(MUTEX_HELD(&queue->q_vd->vdev_scan_io_queue_lock)); @@ -3434,11 +3509,12 @@ scan_io_queue_insert_impl(dsl_scan_io_queue_t *queue, if (avl_find(&queue->q_sios_by_addr, sio, &idx) != NULL) { /* block is already scheduled for reading */ atomic_add_64(&scn->scn_bytes_pending, -asize); - kmem_free(sio, sizeof (*sio)); + sio_free(sio); return; } avl_insert(&queue->q_sios_by_addr, sio, idx); - range_tree_add(queue->q_exts_by_addr, sio->sio_offset, asize); + queue->q_sio_memused += SIO_GET_MUSED(sio); + range_tree_add(queue->q_exts_by_addr, SIO_GET_OFFSET(sio), asize); } /* @@ -3452,7 +3528,7 @@ scan_io_queue_insert(dsl_scan_io_queue_t *queue, const int zio_flags, const zbookmark_phys_t *zb) { dsl_scan_t *scn = queue->q_scn; - scan_io_t *sio = kmem_zalloc(sizeof (*sio), KM_SLEEP); + scan_io_t *sio = sio_alloc(BP_GET_NDVAS(bp)); ASSERT0(BP_IS_GANG(bp)); ASSERT(MUTEX_HELD(&queue->q_vd->vdev_scan_io_queue_lock)); @@ -3466,7 +3542,7 @@ scan_io_queue_insert(dsl_scan_io_queue_t *queue, const * get an integer underflow in case the worker processes the * zio before we get to incrementing this counter. */ - atomic_add_64(&scn->scn_bytes_pending, sio->sio_asize); + atomic_add_64(&scn->scn_bytes_pending, SIO_GET_ASIZE(sio)); scan_io_queue_insert_impl(queue, sio); } @@ -3699,15 +3775,11 @@ ext_size_compare(const void *x, const void *y) * based on LBA-order (from lowest to highest). */ static int -io_addr_compare(const void *x, const void *y) +sio_addr_compare(const void *x, const void *y) { const scan_io_t *a = x, *b = y; - if (a->sio_offset < b->sio_offset) - return (-1); - if (a->sio_offset == b->sio_offset) - return (0); - return (1); + return (AVL_CMP(SIO_GET_OFFSET(a), SIO_GET_OFFSET(b))); } /* IO queues are created on demand when they are needed. */ @@ -3719,10 +3791,11 @@ scan_io_queue_create(vdev_t *vd) q->q_scn = scn; q->q_vd = vd; + q->q_sio_memused = 0; cv_init(&q->q_zio_cv, NULL, CV_DEFAULT, NULL); q->q_exts_by_addr = range_tree_create_impl(&rt_avl_ops, &q->q_exts_by_size, ext_size_compare, zfs_scan_max_ext_gap); - avl_create(&q->q_sios_by_addr, io_addr_compare, + avl_create(&q->q_sios_by_addr, sio_addr_compare, sizeof (scan_io_t), offsetof(scan_io_t, sio_nodes.sio_addr_node)); return (q); @@ -3746,11 +3819,13 @@ dsl_scan_io_queue_destroy(dsl_scan_io_queue_t *queue) while ((sio = avl_destroy_nodes(&queue->q_sios_by_addr, &cookie)) != NULL) { ASSERT(range_tree_contains(queue->q_exts_by_addr, - sio->sio_offset, sio->sio_asize)); - bytes_dequeued += sio->sio_asize; - kmem_free(sio, sizeof (*sio)); + SIO_GET_OFFSET(sio), SIO_GET_ASIZE(sio))); + bytes_dequeued += SIO_GET_ASIZE(sio); + queue->q_sio_memused -= SIO_GET_MUSED(sio); + sio_free(sio); } + ASSERT0(queue->q_sio_memused); atomic_add_64(&scn->scn_bytes_pending, -bytes_dequeued); range_tree_vacate(queue->q_exts_by_addr, NULL, queue); range_tree_destroy(queue->q_exts_by_addr); @@ -3805,7 +3880,7 @@ dsl_scan_freed_dva(spa_t *spa, const blkptr_t *bp, int vdev_t *vdev; kmutex_t *q_lock; dsl_scan_io_queue_t *queue; - scan_io_t srch, *sio; + scan_io_t *srch_sio, *sio; avl_index_t idx; uint64_t start, size; @@ -3820,9 +3895,10 @@ dsl_scan_freed_dva(spa_t *spa, const blkptr_t *bp, int return; } - bp2sio(bp, &srch, dva_i); - start = srch.sio_offset; - size = srch.sio_asize; + srch_sio = sio_alloc(BP_GET_NDVAS(bp)); + bp2sio(bp, srch_sio, dva_i); + start = SIO_GET_OFFSET(srch_sio); + size = SIO_GET_ASIZE(srch_sio); /* * We can find the zio in two states: @@ -3842,15 +3918,18 @@ dsl_scan_freed_dva(spa_t *spa, const blkptr_t *bp, int * be done with issuing the zio's it gathered and will * signal us. */ - sio = avl_find(&queue->q_sios_by_addr, &srch, &idx); + sio = avl_find(&queue->q_sios_by_addr, srch_sio, &idx); + sio_free(srch_sio); + if (sio != NULL) { - int64_t asize = sio->sio_asize; + int64_t asize = SIO_GET_ASIZE(sio); blkptr_t tmpbp; /* Got it while it was cold in the queue */ - ASSERT3U(start, ==, sio->sio_offset); + ASSERT3U(start, ==, SIO_GET_OFFSET(sio)); ASSERT3U(size, ==, asize); avl_remove(&queue->q_sios_by_addr, sio); + queue->q_sio_memused -= SIO_GET_MUSED(sio); ASSERT(range_tree_contains(queue->q_exts_by_addr, start, size)); range_tree_remove_fill(queue->q_exts_by_addr, start, size); @@ -3863,10 +3942,10 @@ dsl_scan_freed_dva(spa_t *spa, const blkptr_t *bp, int atomic_add_64(&scn->scn_bytes_pending, -asize); /* count the block as though we issued it */ - sio2bp(sio, &tmpbp, dva_i); + sio2bp(sio, &tmpbp); count_block(scn, dp->dp_blkstats, &tmpbp); - kmem_free(sio, sizeof (*sio)); + sio_free(sio); } mutex_exit(q_lock); } Modified: vendor-sys/illumos/dist/uts/common/fs/zfs/metaslab.c ============================================================================== --- vendor-sys/illumos/dist/uts/common/fs/zfs/metaslab.c Thu Nov 21 13:59:06 2019 (r354953) +++ vendor-sys/illumos/dist/uts/common/fs/zfs/metaslab.c Thu Nov 21 14:00:09 2019 (r354954) @@ -2069,7 +2069,7 @@ metaslab_space_weight(metaslab_t *msp) * In effect, this means that we'll select the metaslab with the most * free bandwidth rather than simply the one with the most free space. */ - if (metaslab_lba_weighting_enabled) { + if (!vd->vdev_nonrot && metaslab_lba_weighting_enabled) { weight = 2 * weight - (msp->ms_id * weight) / vd->vdev_ms_count; ASSERT(weight >= space && weight <= 2 * space); } Modified: vendor-sys/illumos/dist/uts/common/fs/zfs/spa_misc.c ============================================================================== --- vendor-sys/illumos/dist/uts/common/fs/zfs/spa_misc.c Thu Nov 21 13:59:06 2019 (r354953) +++ vendor-sys/illumos/dist/uts/common/fs/zfs/spa_misc.c Thu Nov 21 14:00:09 2019 (r354954) @@ -2036,6 +2036,7 @@ spa_init(int mode) dmu_init(); zil_init(); vdev_cache_stat_init(); + vdev_mirror_stat_init(); zfs_prop_init(); zpool_prop_init(); zpool_feature_init(); @@ -2052,6 +2053,7 @@ spa_fini(void) spa_evict_all(); vdev_cache_stat_fini(); + vdev_mirror_stat_fini(); zil_fini(); dmu_fini(); zio_fini(); Modified: vendor-sys/illumos/dist/uts/common/fs/zfs/sys/spa.h ============================================================================== --- vendor-sys/illumos/dist/uts/common/fs/zfs/sys/spa.h Thu Nov 21 13:59:06 2019 (r354953) +++ vendor-sys/illumos/dist/uts/common/fs/zfs/sys/spa.h Thu Nov 21 14:00:09 2019 (r354954) @@ -907,6 +907,10 @@ extern void spa_get_errlists(spa_t *spa, avl_tree_t *l extern void vdev_cache_stat_init(void); extern void vdev_cache_stat_fini(void); +/* vdev mirror */ +extern void vdev_mirror_stat_init(void); +extern void vdev_mirror_stat_fini(void); + /* Initialization and termination */ extern void spa_init(int flags); extern void spa_fini(void); Modified: vendor-sys/illumos/dist/uts/common/fs/zfs/sys/vdev.h ============================================================================== --- vendor-sys/illumos/dist/uts/common/fs/zfs/sys/vdev.h Thu Nov 21 13:59:06 2019 (r354953) +++ vendor-sys/illumos/dist/uts/common/fs/zfs/sys/vdev.h Thu Nov 21 14:00:09 2019 (r354954) @@ -139,6 +139,9 @@ extern zio_t *vdev_queue_io(zio_t *zio); extern void vdev_queue_io_done(zio_t *zio); extern void vdev_queue_change_io_priority(zio_t *zio, zio_priority_t priority); +extern int vdev_queue_length(vdev_t *vd); +extern uint64_t vdev_queue_last_offset(vdev_t *vd); + extern void vdev_config_dirty(vdev_t *vd); extern void vdev_config_clean(vdev_t *vd); extern int vdev_config_sync(vdev_t **svd, int svdcount, uint64_t txg); Modified: vendor-sys/illumos/dist/uts/common/fs/zfs/sys/vdev_impl.h ============================================================================== --- vendor-sys/illumos/dist/uts/common/fs/zfs/sys/vdev_impl.h Thu Nov 21 13:59:06 2019 (r354953) +++ vendor-sys/illumos/dist/uts/common/fs/zfs/sys/vdev_impl.h Thu Nov 21 14:00:09 2019 (r354954) @@ -225,6 +225,7 @@ struct vdev { vdev_stat_t vdev_stat; /* virtual device statistics */ boolean_t vdev_expanding; /* expand the vdev? */ boolean_t vdev_reopening; /* reopen in progress? */ + boolean_t vdev_nonrot; /* true if solid state */ int vdev_open_error; /* error on last open */ kthread_t *vdev_open_thread; /* thread opening children */ uint64_t vdev_crtxg; /* txg when top-level was added */ Modified: vendor-sys/illumos/dist/uts/common/fs/zfs/sys/zfs_ioctl.h ============================================================================== --- vendor-sys/illumos/dist/uts/common/fs/zfs/sys/zfs_ioctl.h Thu Nov 21 13:59:06 2019 (r354953) +++ vendor-sys/illumos/dist/uts/common/fs/zfs/sys/zfs_ioctl.h Thu Nov 21 14:00:09 2019 (r354954) @@ -318,12 +318,14 @@ typedef struct zinject_record { uint64_t zi_timer; uint64_t zi_nlanes; uint32_t zi_cmd; - uint32_t zi_pad; + uint32_t zi_dvas; } zinject_record_t; #define ZINJECT_NULL 0x1 #define ZINJECT_FLUSH_ARC 0x2 #define ZINJECT_UNLOAD_SPA 0x4 + +#define ZI_NO_DVA (-1) typedef enum zinject_type { ZINJECT_UNINITIALIZED, Modified: vendor-sys/illumos/dist/uts/common/fs/zfs/vdev.c ============================================================================== --- vendor-sys/illumos/dist/uts/common/fs/zfs/vdev.c Thu Nov 21 13:59:06 2019 (r354953) +++ vendor-sys/illumos/dist/uts/common/fs/zfs/vdev.c Thu Nov 21 14:00:09 2019 (r354954) @@ -1479,19 +1479,27 @@ vdev_open_children(vdev_t *vd) * spa_namespace_lock */ if (vdev_uses_zvols(vd)) { +retry_sync: for (int c = 0; c < children; c++) vd->vdev_child[c]->vdev_open_error = vdev_open(vd->vdev_child[c]); - return; + } else { + tq = taskq_create("vdev_open", children, minclsyspri, + children, children, TASKQ_PREPOPULATE); + if (tq == NULL) + goto retry_sync; + + for (int c = 0; c < children; c++) + VERIFY(taskq_dispatch(tq, vdev_open_child, + vd->vdev_child[c], TQ_SLEEP) != TASKQID_INVALID); + + taskq_destroy(tq); } - tq = taskq_create("vdev_open", children, minclsyspri, - children, children, TASKQ_PREPOPULATE); - for (int c = 0; c < children; c++) - VERIFY(taskq_dispatch(tq, vdev_open_child, vd->vdev_child[c], - TQ_SLEEP) != TASKQID_INVALID); + vd->vdev_nonrot = B_TRUE; - taskq_destroy(tq); + for (int c = 0; c < children; c++) + vd->vdev_nonrot &= vd->vdev_child[c]->vdev_nonrot; } /* Modified: vendor-sys/illumos/dist/uts/common/fs/zfs/vdev_disk.c ============================================================================== --- vendor-sys/illumos/dist/uts/common/fs/zfs/vdev_disk.c Thu Nov 21 13:59:06 2019 (r354953) +++ vendor-sys/illumos/dist/uts/common/fs/zfs/vdev_disk.c Thu Nov 21 14:00:09 2019 (r354954) @@ -606,6 +606,16 @@ skip_open: */ vd->vdev_nowritecache = B_FALSE; + /* Inform the ZIO pipeline that we are non-rotational */ + vd->vdev_nonrot = B_FALSE; + if (ldi_prop_exists(dvd->vd_lh, DDI_PROP_DONTPASS | DDI_PROP_NOTPROM, + "device-solid-state")) { + if (ldi_prop_get_int(dvd->vd_lh, + LDI_DEV_T_ANY | DDI_PROP_DONTPASS | DDI_PROP_NOTPROM, + "device-solid-state", B_FALSE) != 0) + vd->vdev_nonrot = B_TRUE; + } + return (0); } Modified: vendor-sys/illumos/dist/uts/common/fs/zfs/vdev_file.c ============================================================================== --- vendor-sys/illumos/dist/uts/common/fs/zfs/vdev_file.c Thu Nov 21 13:59:06 2019 (r354953) +++ vendor-sys/illumos/dist/uts/common/fs/zfs/vdev_file.c Thu Nov 21 14:00:09 2019 (r354954) @@ -58,6 +58,9 @@ vdev_file_open(vdev_t *vd, uint64_t *psize, uint64_t * vattr_t vattr; int error; + /* Rotational optimizations only make sense on block devices */ + vd->vdev_nonrot = B_TRUE; + /* * We must have a pathname, and it must be absolute. */ Modified: vendor-sys/illumos/dist/uts/common/fs/zfs/vdev_mirror.c ============================================================================== --- vendor-sys/illumos/dist/uts/common/fs/zfs/vdev_mirror.c Thu Nov 21 13:59:06 2019 (r354953) +++ vendor-sys/illumos/dist/uts/common/fs/zfs/vdev_mirror.c Thu Nov 21 14:00:09 2019 (r354954) @@ -38,6 +38,65 @@ #include /* + * Vdev mirror kstats + */ +static kstat_t *mirror_ksp = NULL; + +typedef struct mirror_stats { + kstat_named_t vdev_mirror_stat_rotating_linear; + kstat_named_t vdev_mirror_stat_rotating_offset; + kstat_named_t vdev_mirror_stat_rotating_seek; + kstat_named_t vdev_mirror_stat_non_rotating_linear; + kstat_named_t vdev_mirror_stat_non_rotating_seek; + + kstat_named_t vdev_mirror_stat_preferred_found; + kstat_named_t vdev_mirror_stat_preferred_not_found; +} mirror_stats_t; + +static mirror_stats_t mirror_stats = { + /* New I/O follows directly the last I/O */ + { "rotating_linear", KSTAT_DATA_UINT64 }, + /* New I/O is within zfs_vdev_mirror_rotating_seek_offset of the last */ + { "rotating_offset", KSTAT_DATA_UINT64 }, + /* New I/O requires random seek */ + { "rotating_seek", KSTAT_DATA_UINT64 }, + /* New I/O follows directly the last I/O (nonrot) */ + { "non_rotating_linear", KSTAT_DATA_UINT64 }, + /* New I/O requires random seek (nonrot) */ + { "non_rotating_seek", KSTAT_DATA_UINT64 }, + /* Preferred child vdev found */ + { "preferred_found", KSTAT_DATA_UINT64 }, + /* Preferred child vdev not found or equal load */ + { "preferred_not_found", KSTAT_DATA_UINT64 }, + +}; + +#define MIRROR_STAT(stat) (mirror_stats.stat.value.ui64) +#define MIRROR_INCR(stat, val) atomic_add_64(&MIRROR_STAT(stat), val) +#define MIRROR_BUMP(stat) MIRROR_INCR(stat, 1) + +void +vdev_mirror_stat_init(void) +{ + mirror_ksp = kstat_create("zfs", 0, "vdev_mirror_stats", + "misc", KSTAT_TYPE_NAMED, + sizeof (mirror_stats) / sizeof (kstat_named_t), KSTAT_FLAG_VIRTUAL); + if (mirror_ksp != NULL) { + mirror_ksp->ks_data = &mirror_stats; + kstat_install(mirror_ksp); + } +} + +void +vdev_mirror_stat_fini(void) +{ + if (mirror_ksp != NULL) { + kstat_delete(mirror_ksp); + mirror_ksp = NULL; + } +} + +/* * Virtual device vector for mirroring. */ @@ -45,48 +104,182 @@ typedef struct mirror_child { vdev_t *mc_vd; uint64_t mc_offset; int mc_error; + int mc_load; uint8_t mc_tried; uint8_t mc_skipped; uint8_t mc_speculative; } mirror_child_t; typedef struct mirror_map { + int *mm_preferred; + int mm_preferred_cnt; int mm_children; int mm_resilvering; - int mm_preferred; int mm_root; - mirror_child_t mm_child[1]; + mirror_child_t mm_child[]; } mirror_map_t; int vdev_mirror_shift = 21; +/* + * The load configuration settings below are tuned by default for + * the case where all devices are of the same rotational type. + * + * If there is a mixture of rotating and non-rotating media, setting + * zfs_vdev_mirror_non_rotating_seek_inc to 0 may well provide better results + * as it will direct more reads to the non-rotating vdevs which are more likely + * to have a higher performance. + */ + +/* Rotating media load calculation configuration. */ +static int zfs_vdev_mirror_rotating_inc = 0; +static int zfs_vdev_mirror_rotating_seek_inc = 5; +static int zfs_vdev_mirror_rotating_seek_offset = 1 * 1024 * 1024; + +/* Non-rotating media load calculation configuration. */ +static int zfs_vdev_mirror_non_rotating_inc = 0; +static int zfs_vdev_mirror_non_rotating_seek_inc = 1; + +static inline size_t +vdev_mirror_map_size(int children) +{ + return (offsetof(mirror_map_t, mm_child[children]) + + sizeof (int) * children); +} + +static inline mirror_map_t * +vdev_mirror_map_alloc(int children, boolean_t resilvering, boolean_t root) +{ + mirror_map_t *mm; + + mm = kmem_zalloc(vdev_mirror_map_size(children), KM_SLEEP); + mm->mm_children = children; + mm->mm_resilvering = resilvering; + mm->mm_root = root; + mm->mm_preferred = (int *)((uintptr_t)mm + + offsetof(mirror_map_t, mm_child[children])); + + return (mm); +} + static void vdev_mirror_map_free(zio_t *zio) { mirror_map_t *mm = zio->io_vsd; - kmem_free(mm, offsetof(mirror_map_t, mm_child[mm->mm_children])); + kmem_free(mm, vdev_mirror_map_size(mm->mm_children)); } static const zio_vsd_ops_t vdev_mirror_vsd_ops = { - vdev_mirror_map_free, - zio_vsd_default_cksum_report + .vsd_free = vdev_mirror_map_free, + .vsd_cksum_report = zio_vsd_default_cksum_report }; +static int +vdev_mirror_load(mirror_map_t *mm, vdev_t *vd, uint64_t zio_offset) +{ + uint64_t last_offset; + int64_t offset_diff; + int load; + + /* All DVAs have equal weight at the root. */ + if (mm->mm_root) + return (INT_MAX); + + /* + * We don't return INT_MAX if the device is resilvering i.e. + * vdev_resilver_txg != 0 as when tested performance was slightly + * worse overall when resilvering with compared to without. + */ + + /* Fix zio_offset for leaf vdevs */ + if (vd->vdev_ops->vdev_op_leaf) + zio_offset += VDEV_LABEL_START_SIZE; + + /* Standard load based on pending queue length. */ + load = vdev_queue_length(vd); + last_offset = vdev_queue_last_offset(vd); + + if (vd->vdev_nonrot) { + /* Non-rotating media. */ + if (last_offset == zio_offset) { + MIRROR_BUMP(vdev_mirror_stat_non_rotating_linear); + return (load + zfs_vdev_mirror_non_rotating_inc); + } + + /* + * Apply a seek penalty even for non-rotating devices as + * sequential I/O's can be aggregated into fewer operations on + * the device, thus avoiding unnecessary per-command overhead + * and boosting performance. + */ + MIRROR_BUMP(vdev_mirror_stat_non_rotating_seek); + return (load + zfs_vdev_mirror_non_rotating_seek_inc); + } + + /* Rotating media I/O's which directly follow the last I/O. */ + if (last_offset == zio_offset) { + MIRROR_BUMP(vdev_mirror_stat_rotating_linear); + return (load + zfs_vdev_mirror_rotating_inc); + } + + /* + * Apply half the seek increment to I/O's within seek offset + * of the last I/O issued to this vdev as they should incur less + * of a seek increment. + */ + offset_diff = (int64_t)(last_offset - zio_offset); + if (ABS(offset_diff) < zfs_vdev_mirror_rotating_seek_offset) { + MIRROR_BUMP(vdev_mirror_stat_rotating_offset); + return (load + (zfs_vdev_mirror_rotating_seek_inc / 2)); + } + + /* Apply the full seek increment to all other I/O's. */ + MIRROR_BUMP(vdev_mirror_stat_rotating_seek); + return (load + zfs_vdev_mirror_rotating_seek_inc); +} + static mirror_map_t * -vdev_mirror_map_alloc(zio_t *zio) +vdev_mirror_map_init(zio_t *zio) { mirror_map_t *mm = NULL; mirror_child_t *mc; vdev_t *vd = zio->io_vd; - int c, d; + int c; if (vd == NULL) { dva_t *dva = zio->io_bp->blk_dva; spa_t *spa = zio->io_spa; + dsl_scan_t *scn = NULL; dva_t dva_copy[SPA_DVAS_PER_BP]; - c = BP_GET_NDVAS(zio->io_bp); + if (spa->spa_dsl_pool != NULL) { + scn = spa->spa_dsl_pool->dp_scan; + } + /* + * The sequential scrub code sorts and issues all DVAs + * of a bp separately. Each of these IOs includes all + * original DVA copies so that repairs can be performed + * in the event of an error, but we only actually want + * to check the first DVA since the others will be + * checked by their respective sorted IOs. Only if we + * hit an error will we try all DVAs upon retrying. + * + * Note: This check is safe even if the user switches + * from a legacy scrub to a sequential one in the middle + * of processing, since scn_is_sorted isn't updated until + * all outstanding IOs from the previous scrub pass + * complete. + */ + if ((zio->io_flags & ZIO_FLAG_SCRUB) && + !(zio->io_flags & ZIO_FLAG_IO_RETRY) && + scn != NULL && + scn->scn_is_sorted && + dsl_scan_scrubbing(spa->spa_dsl_pool)) { + c = 1; + } else { + c = BP_GET_NDVAS(zio->io_bp); + } /* * If we do not trust the pool config, some DVAs might be @@ -110,24 +303,7 @@ vdev_mirror_map_alloc(zio_t *zio) } } - mm = kmem_zalloc(offsetof(mirror_map_t, mm_child[c]), KM_SLEEP); - mm->mm_children = c; - mm->mm_resilvering = B_FALSE; - mm->mm_preferred = spa_get_random(c); - mm->mm_root = B_TRUE; - - /* - * Check the other, lower-index DVAs to see if they're on - * the same vdev as the child we picked. If they are, use - * them since they are likely to have been allocated from - * the primary metaslab in use at the time, and hence are - * more likely to have locality with single-copy data. - */ - for (c = mm->mm_preferred, d = c - 1; d >= 0; d--) { - if (DVA_GET_VDEV(&dva[d]) == DVA_GET_VDEV(&dva[c])) - mm->mm_preferred = d; - } - + mm = vdev_mirror_map_alloc(c, B_FALSE, B_TRUE); for (c = 0; c < mm->mm_children; c++) { mc = &mm->mm_child[c]; @@ -135,12 +311,6 @@ vdev_mirror_map_alloc(zio_t *zio) mc->mc_offset = DVA_GET_OFFSET(&dva[c]); } } else { - int replacing; - - c = vd->vdev_children; - - mm = kmem_zalloc(offsetof(mirror_map_t, mm_child[c]), KM_SLEEP); - mm->mm_children = c; /* * If we are resilvering, then we should handle scrub reads * differently; we shouldn't issue them to the resilvering @@ -164,25 +334,12 @@ vdev_mirror_map_alloc(zio_t *zio) * automatically removed from the pool after the user replaces * the device that originally failed. */ - replacing = (vd->vdev_ops == &vdev_replacing_ops || - vd->vdev_ops == &vdev_spare_ops); - /* - * If a spa load is in progress, then spa_dsl_pool may be - * uninitialized. But we shouldn't be resilvering during a spa - * load anyway. - */ - if (replacing && - (spa_load_state(vd->vdev_spa) == SPA_LOAD_NONE) && - dsl_scan_resilvering(vd->vdev_spa->spa_dsl_pool)) { - mm->mm_resilvering = B_TRUE; - } else { - mm->mm_resilvering = B_FALSE; - } - - mm->mm_preferred = mm->mm_resilvering ? 0 : - (zio->io_offset >> vdev_mirror_shift) % c; - mm->mm_root = B_FALSE; - + boolean_t replacing = (vd->vdev_ops == &vdev_replacing_ops || + vd->vdev_ops == &vdev_spare_ops) && + spa_load_state(vd->vdev_spa) == SPA_LOAD_NONE && + dsl_scan_resilvering(vd->vdev_spa->spa_dsl_pool); + mm = vdev_mirror_map_alloc(vd->vdev_children, replacing, + B_FALSE); for (c = 0; c < mm->mm_children; c++) { mc = &mm->mm_child[c]; mc->mc_vd = vd->vdev_child[c]; @@ -269,6 +426,7 @@ vdev_mirror_scrub_done(zio_t *zio) } mutex_exit(&zio->io_lock); } + abd_free(zio->io_abd); mc->mc_error = zio->io_error; @@ -277,6 +435,54 @@ vdev_mirror_scrub_done(zio_t *zio) } /* + * Check the other, lower-index DVAs to see if they're on the same + * vdev as the child we picked. If they are, use them since they + * are likely to have been allocated from the primary metaslab in + * use at the time, and hence are more likely to have locality with + * single-copy data. + */ +static int +vdev_mirror_dva_select(zio_t *zio, int p) +{ + dva_t *dva = zio->io_bp->blk_dva; + mirror_map_t *mm = zio->io_vsd; + int preferred; + int c; + + preferred = mm->mm_preferred[p]; + for (p--; p >= 0; p--) { + c = mm->mm_preferred[p]; + if (DVA_GET_VDEV(&dva[c]) == DVA_GET_VDEV(&dva[preferred])) + preferred = c; + } + return (preferred); +} + +static int +vdev_mirror_preferred_child_randomize(zio_t *zio) +{ + mirror_map_t *mm = zio->io_vsd; + int p; + + if (mm->mm_root) { + p = spa_get_random(mm->mm_preferred_cnt); + return (vdev_mirror_dva_select(zio, p)); + } + + /* + * To ensure we don't always favour the first matching vdev, + * which could lead to wear leveling issues on SSD's, we + * use the I/O offset as a pseudo random seed into the vdevs + * which have the lowest load. + */ + p = (zio->io_offset >> vdev_mirror_shift) % mm->mm_preferred_cnt; + return (mm->mm_preferred[p]); +} + +/* + * Try to find a vdev whose DTL doesn't contain the block we want to read + * prefering vdevs based on determined load. + * * Try to find a child whose DTL doesn't contain the block we want to read. * If we can't, try the read on any vdev we haven't already tried. */ @@ -284,43 +490,64 @@ static int vdev_mirror_child_select(zio_t *zio) { mirror_map_t *mm = zio->io_vsd; - mirror_child_t *mc; uint64_t txg = zio->io_txg; - int i, c; + int c, lowest_load; ASSERT(zio->io_bp == NULL || BP_PHYSICAL_BIRTH(zio->io_bp) == txg); - /* - * Try to find a child whose DTL doesn't contain the block to read. - * If a child is known to be completely inaccessible (indicated by - * vdev_readable() returning B_FALSE), don't even try. - */ - for (i = 0, c = mm->mm_preferred; i < mm->mm_children; i++, c++) { - if (c >= mm->mm_children) *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-all@freebsd.org Thu Nov 21 14:00:13 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 315551BFB24; Thu, 21 Nov 2019 14:00:13 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47Jh5n0TjLz4R2w; Thu, 21 Nov 2019 14:00:13 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id CF085C44C; Thu, 21 Nov 2019 14:00:12 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xALE0CBG041945; Thu, 21 Nov 2019 14:00:12 GMT (envelope-from avg@FreeBSD.org) Received: (from avg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xALE0CVE041944; Thu, 21 Nov 2019 14:00:12 GMT (envelope-from avg@FreeBSD.org) Message-Id: <201911211400.xALE0CVE041944@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avg set sender to avg@FreeBSD.org using -f From: Andriy Gapon Date: Thu, 21 Nov 2019 14:00:12 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-vendor@freebsd.org Subject: svn commit: r354954 - vendor-sys/illumos/dist/uts/common/fs/zfs vendor-sys/illumos/dist/uts/common/fs/zfs/sys vendor/illumos/dist/cmd/zinject X-SVN-Group: vendor X-SVN-Commit-Author: avg X-SVN-Commit-Paths: vendor-sys/illumos/dist/uts/common/fs/zfs vendor-sys/illumos/dist/uts/common/fs/zfs/sys vendor/illumos/dist/cmd/zinject X-SVN-Commit-Revision: 354954 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 21 Nov 2019 14:00:13 -0000 Author: avg Date: Thu Nov 21 14:00:09 2019 New Revision: 354954 URL: https://svnweb.freebsd.org/changeset/base/354954 Log: 10566 Multiple DVA Scrubbing Fix illumos/illumos-gate@12a8814c13fbb1d6d58616cf090ea5815dc107f9 https://github.com/illumos/illumos-gate/commit/12a8814c13fbb1d6d58616cf090ea5815dc107f9 https://www.illumos.org/issues/10566 ZoL PR_8453 Author: Tom Caputi Date: Fri Mar 15 17:14:31 2019 -0400 Multiple DVA Scrubbing Fix Currently, there is an issue in the sequential scrub code which prevents self healing from working in some cases. The scrub code will split up all DVA copies of a bp and issue each of them separately. The problem is that, since each of the DVAs is no longer associated with the others, the self healing code doesn't have the opportunity to repair problems that show up in one of the DVAs with the data from the others. This patch fixes this issue by ensuring that all IOs issued by the sequential scrub code include all DVAs. Initially, only the first DVA of each is attempted. If an issue arises, the IO is retried with all available copies, giving the self healing code a chance to correct the issue. To test this change, this patch also adds the ability for zinject to specify individual DVAs to inject read errors into. We then add a new test case that utilizes this functionality to ensure scrubs and self-healing reads can handle and transparently fix issues with individual copies of blocks. This update is followup on #10405 While attempting to port this update, the following ZoL updates are included: 551905dd4 vdev_mirror: kstat observables for preferred vdev d6c6590c5 vdev_mirror: load balancing fixes 9f500936c FreeBSD r256956: Improve ZFS N-way mirror read performance by Portions contributed by: Toomas Soome Portions contributed by: Jerry Jelinek Author: Tom Caputi Modified: vendor/illumos/dist/cmd/zinject/zinject.c Changes in other areas also in this revision: Modified: vendor-sys/illumos/dist/uts/common/fs/zfs/dsl_scan.c vendor-sys/illumos/dist/uts/common/fs/zfs/metaslab.c vendor-sys/illumos/dist/uts/common/fs/zfs/spa_misc.c vendor-sys/illumos/dist/uts/common/fs/zfs/sys/spa.h vendor-sys/illumos/dist/uts/common/fs/zfs/sys/vdev.h vendor-sys/illumos/dist/uts/common/fs/zfs/sys/vdev_impl.h vendor-sys/illumos/dist/uts/common/fs/zfs/sys/zfs_ioctl.h vendor-sys/illumos/dist/uts/common/fs/zfs/vdev.c vendor-sys/illumos/dist/uts/common/fs/zfs/vdev_disk.c vendor-sys/illumos/dist/uts/common/fs/zfs/vdev_file.c vendor-sys/illumos/dist/uts/common/fs/zfs/vdev_mirror.c vendor-sys/illumos/dist/uts/common/fs/zfs/vdev_queue.c vendor-sys/illumos/dist/uts/common/fs/zfs/zio_inject.c Modified: vendor/illumos/dist/cmd/zinject/zinject.c ============================================================================== --- vendor/illumos/dist/cmd/zinject/zinject.c Thu Nov 21 13:59:06 2019 (r354953) +++ vendor/illumos/dist/cmd/zinject/zinject.c Thu Nov 21 14:00:09 2019 (r354954) @@ -47,48 +47,48 @@ * * This form of the command looks like: * - * zinject -d device [-e errno] [-L ] pool + * zinject -d device [-e errno] [-L ] pool * * * DATA FAULTS * * We begin with a tuple of the form: * - * + * * - * type A string describing the type of data to target. Each type - * implicitly describes how to interpret 'object'. Currently, - * the following values are supported: + * type A string describing the type of data to target. Each type + * implicitly describes how to interpret 'object'. Currently, + * the following values are supported: * - * data User data for a file - * dnode Dnode for a file or directory + * data User data for a file + * dnode Dnode for a file or directory * * The following MOS objects are special. Instead of injecting * errors on a particular object or blkid, we inject errors across * all objects of the given type. * - * mos Any data in the MOS - * mosdir object directory - * config pool configuration - * bpobj blkptr list - * spacemap spacemap - * metaslab metaslab - * errlog persistent error log + * mos Any data in the MOS + * mosdir object directory + * config pool configuration + * bpobj blkptr list + * spacemap spacemap + * metaslab metaslab + * errlog persistent error log * - * level Object level. Defaults to '0', not applicable to all types. If - * a range is given, this corresponds to the indirect block - * corresponding to the specific range. + * level Object level. Defaults to '0', not applicable to all types. If + * a range is given, this corresponds to the indirect block + * corresponding to the specific range. * * range A numerical range [start,end) within the object. Defaults to * the full size of the file. * - * object A string describing the logical location of the object. For - * files and directories (currently the only supported types), - * this is the path of the object on disk. + * object A string describing the logical location of the object. For + * files and directories (currently the only supported types), + * this is the path of the object on disk. * * This is translated, via libzpool, into the following internal representation: * - * + * * * These types should be self-explanatory. This tuple is then passed to the * kernel via a special ioctl() to initiate fault injection for the given @@ -98,12 +98,12 @@ * * The command itself takes one of the forms: * - * zinject - * zinject <-a | -u pool> - * zinject -c - * zinject [-q] <-t type> [-f freq] [-u] [-a] [-m] [-e errno] [-l level] + * zinject + * zinject <-a | -u pool> + * zinject -c + * zinject [-q] <-t type> [-f freq] [-u] [-a] [-m] [-e errno] [-l level] * [-r range] - * zinject [-f freq] [-a] [-m] [-u] -b objset:object:level:start:end pool + * zinject [-f freq] [-a] [-m] [-u] -b objset:object:level:start:end pool * * With no arguments, the command prints all currently registered injection * handlers, with their numeric identifiers. @@ -288,8 +288,8 @@ usage(void) "\t\tspecified by the remaining tuple. Each number is in\n" "\t\thexidecimal, and only one block can be specified.\n" "\n" - "\tzinject [-q] <-t type> [-e errno] [-l level] [-r range]\n" - "\t [-a] [-m] [-u] [-f freq] \n" + "\tzinject [-q] <-t type> [-C dvas] [-e errno] [-l level]\n" + "\t\t[-r range] [-a] [-m] [-u] [-f freq] \n" "\n" "\t\tInject an error into the object specified by the '-t' option\n" "\t\tand the object descriptor. The 'object' parameter is\n" @@ -297,7 +297,10 @@ usage(void) "\n" "\t\t-q\tQuiet mode. Only print out the handler number added.\n" "\t\t-e\tInject a specific error. Must be either 'io' or\n" - "\t\t\t'checksum'. Default is 'io'.\n" + "\t\t\t'checksum', or 'decompress'. Default is 'io'.\n" + "\t\t-C\tInject the given error only into specific DVAs. The\n" + "\t\t\tDVAs should be specified as a list of 0-indexed DVAs\n" + "\t\t\tseparated by commas (ex. '0,2').\n" "\t\t-l\tInject error at a particular block level. Default is " "0.\n" "\t\t-m\tAutomatically remount underlying filesystem.\n" @@ -358,17 +361,19 @@ print_data_handler(int id, const char *pool, zinject_r return (0); if (*count == 0) { - (void) printf("%3s %-15s %-6s %-6s %-8s %3s %-15s\n", - "ID", "POOL", "OBJSET", "OBJECT", "TYPE", "LVL", "RANGE"); + (void) printf("%3s %-15s %-6s %-6s %-8s %3s %-4s ", + "%-15s\n", "ID", "POOL", "OBJSET", "OBJECT", "TYPE", + "LVL", "DVAs", "RANGE"); (void) printf("--- --------------- ------ " - "------ -------- --- ---------------\n"); + "------ -------- --- ---- ----------------\n"); } *count += 1; - (void) printf("%3d %-15s %-6llu %-6llu %-8s %3d ", id, pool, - (u_longlong_t)record->zi_objset, (u_longlong_t)record->zi_object, - type_to_name(record->zi_type), record->zi_level); + (void) printf("%3d %-15s %-6llu %-6llu %-8s %-3d 0x%02x ", + id, pool, (u_longlong_t)record->zi_objset, + (u_longlong_t)record->zi_object, type_to_name(record->zi_type), + record->zi_level, record->zi_dvas); if (record->zi_start == 0 && record->zi_end == -1ULL) @@ -598,6 +603,7 @@ register_handler(const char *pool, int flags, zinject_ (void) printf(" range: [%llu, %llu)\n", (u_longlong_t)record->zi_start, (u_longlong_t)record->zi_end); + (void) printf(" dvas: 0x%x\n", record->zi_dvas); } } @@ -649,6 +655,59 @@ parse_delay(char *str, uint64_t *delay, uint64_t *nlan return (0); } +/* + * This function converts a string specifier for DVAs into a bit mask. + * The dva's provided by the user should be 0 indexed and separated by + * a comma. For example: + * "1" -> 0b0010 (0x2) + * "0,1" -> 0b0011 (0x3) + * "0,1,2" -> 0b0111 (0x7) + */ +static int +parse_dvas(const char *str, uint32_t *dvas_out) +{ + const char *c = str; + uint32_t mask = 0; + boolean_t need_delim = B_FALSE; + + /* max string length is 5 ("0,1,2") */ + if (strlen(str) > 5 || strlen(str) == 0) + return (EINVAL); + + while (*c != '\0') { + switch (*c) { + case '0': + case '1': + case '2': + /* check for pipe between DVAs */ + if (need_delim) + return (EINVAL); + + /* check if this DVA has been set already */ + if (mask & (1 << ((*c) - '0'))) + return (EINVAL); + + mask |= (1 << ((*c) - '0')); + need_delim = B_TRUE; + break; + case ',': + need_delim = B_FALSE; + break; + default: + /* check for invalid character */ + return (EINVAL); + } + c++; + } + + /* check for dangling delimiter */ + if (!need_delim) + return (EINVAL); + + *dvas_out = mask; + return (0); +} + int main(int argc, char **argv) { @@ -675,6 +734,7 @@ main(int argc, char **argv) int dur_secs = 0; int ret; int flags = 0; + uint32_t dvas = 0; if ((g_zfs = libzfs_init()) == NULL) { (void) fprintf(stderr, "internal error: failed to " @@ -705,7 +765,7 @@ main(int argc, char **argv) } while ((c = getopt(argc, argv, - ":aA:b:d:D:f:Fg:qhIc:t:T:l:mr:s:e:uL:p:")) != -1) { + ":aA:b:C:d:D:f:Fg:qhIc:t:T:l:mr:s:e:uL:p:")) != -1) { switch (c) { case 'a': flags |= ZINJECT_FLUSH_ARC; @@ -728,6 +788,17 @@ main(int argc, char **argv) case 'c': cancel = optarg; break; + case 'C': + ret = parse_dvas(optarg, &dvas); + if (ret != 0) { + (void) fprintf(stderr, "invalid DVA list '%s': " + "DVAs should be 0 indexed and separated by " + "commas.\n", optarg); + usage(); + libzfs_fini(g_zfs); + return (1); + } + break; case 'd': device = optarg; break; @@ -887,7 +958,8 @@ main(int argc, char **argv) * '-c' is invalid with any other options. */ if (raw != NULL || range != NULL || type != TYPE_INVAL || - level != 0 || record.zi_cmd != ZINJECT_UNINITIALIZED) { + level != 0 || record.zi_cmd != ZINJECT_UNINITIALIZED || + record.zi_freq > 0 || dvas != 0) { (void) fprintf(stderr, "cancel (-c) incompatible with " "any other options\n"); usage(); @@ -919,7 +991,8 @@ main(int argc, char **argv) * for doing injection, so handle it separately here. */ if (raw != NULL || range != NULL || type != TYPE_INVAL || - level != 0 || record.zi_cmd != ZINJECT_UNINITIALIZED) { + level != 0 || record.zi_cmd != ZINJECT_UNINITIALIZED || + dvas != 0) { (void) fprintf(stderr, "device (-d) incompatible with " "data error injection\n"); usage(); @@ -953,7 +1026,8 @@ main(int argc, char **argv) } else if (raw != NULL) { if (range != NULL || type != TYPE_INVAL || level != 0 || - record.zi_cmd != ZINJECT_UNINITIALIZED) { + record.zi_cmd != ZINJECT_UNINITIALIZED || + record.zi_freq > 0 || dvas != 0) { (void) fprintf(stderr, "raw (-b) format with " "any other options\n"); usage(); @@ -983,7 +1057,8 @@ main(int argc, char **argv) error = EIO; } else if (record.zi_cmd == ZINJECT_PANIC) { if (raw != NULL || range != NULL || type != TYPE_INVAL || - level != 0 || device != NULL) { + level != 0 || device != NULL || record.zi_freq > 0 || + dvas != 0) { (void) fprintf(stderr, "panic (-p) incompatible with " "other options\n"); usage(); @@ -1002,6 +1077,15 @@ main(int argc, char **argv) record.zi_type = atoi(argv[1]); dataset[0] = '\0'; } else if (record.zi_cmd == ZINJECT_IGNORED_WRITES) { + if (raw != NULL || range != NULL || type != TYPE_INVAL || + level != 0 || record.zi_freq > 0 || dvas != 0) { + (void) fprintf(stderr, "hardware failure (-I) " + "incompatible with other options\n"); + usage(); + libzfs_fini(g_zfs); + return (2); + } + if (nowrites == 0) { (void) fprintf(stderr, "-s or -g meaningless " "without -I (ignore writes)\n"); @@ -1053,6 +1137,18 @@ main(int argc, char **argv) (void) fprintf(stderr, "data error type must be " "'checksum' or 'io'\n"); return (1); + } + + if (dvas != 0) { + if (error == EACCES || error == EINVAL) { + (void) fprintf(stderr, "the '-C' option may " + "not be used with logical data errors " + "'decrypt' and 'decompress'\n"); + libzfs_fini(g_zfs); + return (1); + } + + record.zi_dvas = dvas; } record.zi_cmd = ZINJECT_DATA_FAULT; From owner-svn-src-all@freebsd.org Thu Nov 21 14:01:00 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 3C3021BFBF9; Thu, 21 Nov 2019 14:01:00 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47Jh6h0tXFz4RPV; Thu, 21 Nov 2019 14:01:00 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 028F9C478; Thu, 21 Nov 2019 14:01:00 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xALE0xOg042020; Thu, 21 Nov 2019 14:00:59 GMT (envelope-from avg@FreeBSD.org) Received: (from avg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xALE0xl7042019; Thu, 21 Nov 2019 14:00:59 GMT (envelope-from avg@FreeBSD.org) Message-Id: <201911211400.xALE0xl7042019@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avg set sender to avg@FreeBSD.org using -f From: Andriy Gapon Date: Thu, 21 Nov 2019 14:00:59 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-vendor@freebsd.org Subject: svn commit: r354955 - in vendor/illumos/dist: cmd/zpool man/man1m X-SVN-Group: vendor X-SVN-Commit-Author: avg X-SVN-Commit-Paths: in vendor/illumos/dist: cmd/zpool man/man1m X-SVN-Commit-Revision: 354955 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 21 Nov 2019 14:01:00 -0000 Author: avg Date: Thu Nov 21 14:00:59 2019 New Revision: 354955 URL: https://svnweb.freebsd.org/changeset/base/354955 Log: 10900 Fix estimated scrub completion time illumos/illumos-gate@3db6627c6730f7ec4426ac0be0e9338235aed2d8 https://github.com/illumos/illumos-gate/commit/3db6627c6730f7ec4426ac0be0e9338235aed2d8 https://www.illumos.org/issues/10900 ZoL update: Author: Tom Caputi Date: Wed May 1 20:34:24 2019 -0400 Fix estimated scrub completion time Currently, it is possible for the 'zpool scrub' command to progress slightly beyond 100% due to concurrent changes happening on the live pool. This behavior is expected, but the userspace code for 'zpool status' would subtract the expected amount of data from the amount of data already scrubbed, resulting in a negative integer being casted to a large positive one. This number was then used to calculate the estimated completion time, resulting in wildly wrong results. This code changes the behavior so that 'zpool status' does not attempt to report an estimate during this period. Reviewed by: Brian Behlendorf Reviewed-by: Igor Kozhukhov Reviewed-by: George Melikov Signed-off-by: Tom Caputi Closes #8611 Closes #8687 After this fix, the zpool status output does display more reasonable output. Author: Tom Caputi Modified: vendor/illumos/dist/cmd/zpool/zpool_main.c vendor/illumos/dist/man/man1m/zpool.1m Modified: vendor/illumos/dist/cmd/zpool/zpool_main.c ============================================================================== --- vendor/illumos/dist/cmd/zpool/zpool_main.c Thu Nov 21 14:00:09 2019 (r354954) +++ vendor/illumos/dist/cmd/zpool/zpool_main.c Thu Nov 21 14:00:59 2019 (r354955) @@ -4804,7 +4804,7 @@ print_scan_status(pool_scan_stat_t *ps) scan_rate = pass_scanned / elapsed; issue_rate = pass_issued / elapsed; - total_secs_left = (issue_rate != 0) ? + total_secs_left = (issue_rate != 0 && total >= issued) ? ((total - issued) / issue_rate) : UINT64_MAX; days_left = total_secs_left / 60 / 60 / 24; @@ -4838,7 +4838,8 @@ print_scan_status(pool_scan_stat_t *ps) } if (pause == 0) { - if (issue_rate >= 10 * 1024 * 1024) { + if (total_secs_left != UINT64_MAX && + issue_rate >= 10 * 1024 * 1024) { (void) printf(gettext(", %llu days " "%02llu:%02llu:%02llu to go\n"), (u_longlong_t)days_left, (u_longlong_t)hours_left, Modified: vendor/illumos/dist/man/man1m/zpool.1m ============================================================================== --- vendor/illumos/dist/man/man1m/zpool.1m Thu Nov 21 14:00:09 2019 (r354954) +++ vendor/illumos/dist/man/man1m/zpool.1m Thu Nov 21 14:00:59 2019 (r354955) @@ -1808,6 +1808,10 @@ If a scrub is paused, the resumes it. If a resilver is in progress, ZFS does not allow a scrub to be started until the resilver completes. +.Pp +Note that, due to changes in pool data on a live system, it is possible for +scrubs to progress slightly beyond 100% completion. +During this period, no completion time estimate will be provided. .Bl -tag -width Ds .It Fl s Stop scrubbing. From owner-svn-src-all@freebsd.org Thu Nov 21 14:01:44 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id BED581BFDAD; Thu, 21 Nov 2019 14:01:44 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47Jh7X4hFCz4RYN; Thu, 21 Nov 2019 14:01:44 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 84385C5D2; Thu, 21 Nov 2019 14:01:44 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xALE1ik0045850; Thu, 21 Nov 2019 14:01:44 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xALE1iRd045849; Thu, 21 Nov 2019 14:01:44 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201911211401.xALE1iRd045849@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Thu, 21 Nov 2019 14:01:44 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354956 - head/sys/arm/broadcom/bcm2835 X-SVN-Group: head X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: head/sys/arm/broadcom/bcm2835 X-SVN-Commit-Revision: 354956 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 21 Nov 2019 14:01:44 -0000 Author: kevans Date: Thu Nov 21 14:01:44 2019 New Revision: 354956 URL: https://svnweb.freebsd.org/changeset/base/354956 Log: bcm2835_sdhci: only inspect interrupts we handle We'll write the value we read back to ack pending interrupts, but we should at least make it clear to ourselves that we only want to ack pending transfer interrupts. Modified: head/sys/arm/broadcom/bcm2835/bcm2835_sdhci.c Modified: head/sys/arm/broadcom/bcm2835/bcm2835_sdhci.c ============================================================================== --- head/sys/arm/broadcom/bcm2835/bcm2835_sdhci.c Thu Nov 21 14:00:59 2019 (r354955) +++ head/sys/arm/broadcom/bcm2835/bcm2835_sdhci.c Thu Nov 21 14:01:44 2019 (r354956) @@ -653,7 +653,8 @@ bcm_sdhci_dma_intr(int ch, void *arg) * can continue via DMA, do so. Otherwise, re-enable interrupts and * return. */ - reg = bcm_sdhci_read_4(slot->bus, slot, SDHCI_INT_STATUS); + reg = bcm_sdhci_read_4(slot->bus, slot, SDHCI_INT_STATUS) & + DATA_XFER_MASK; if ((reg & DATA_PENDING_MASK) != 0 && BCM_SDHCI_SEGSZ_LEFT(slot) >= BCM_SDHCI_BUFFER_SIZE) { /* ACK any pending interrupts */ From owner-svn-src-all@freebsd.org Thu Nov 21 14:02:55 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 99A741BFE93; Thu, 21 Nov 2019 14:02:55 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47Jh8v4ML6z4Rl4; Thu, 21 Nov 2019 14:02:55 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 79782C616; Thu, 21 Nov 2019 14:02:55 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xALE2t7n047282; Thu, 21 Nov 2019 14:02:55 GMT (envelope-from avg@FreeBSD.org) Received: (from avg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xALE2sCR047278; Thu, 21 Nov 2019 14:02:54 GMT (envelope-from avg@FreeBSD.org) Message-Id: <201911211402.xALE2sCR047278@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avg set sender to avg@FreeBSD.org using -f From: Andriy Gapon Date: Thu, 21 Nov 2019 14:02:54 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-vendor@freebsd.org Subject: svn commit: r354957 - vendor-sys/illumos/dist/uts/common/fs/zfs X-SVN-Group: vendor-sys X-SVN-Commit-Author: avg X-SVN-Commit-Paths: vendor-sys/illumos/dist/uts/common/fs/zfs X-SVN-Commit-Revision: 354957 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 21 Nov 2019 14:02:55 -0000 Author: avg Date: Thu Nov 21 14:02:54 2019 New Revision: 354957 URL: https://svnweb.freebsd.org/changeset/base/354957 Log: 10853 spa_sync, vs_alloc can underflow and checkpoint test fixes illumos/illumos-gate@9740f25f0360eb7d9131fa15fabebf958bf19126 https://github.com/illumos/illumos-gate/commit/9740f25f0360eb7d9131fa15fabebf958bf19126 https://www.illumos.org/issues/10853 From ZoL 7558997 vs_alloc can underflow in L2ARC vdevs 8dc2197 Simplify spa_sync by breaking it up to smaller functions db58794 Make zdb results for checkpoint tests consistent Here are the commit msg summaries from ZoL: vs_alloc can underflow in L2ARC vdevs The current L2 ARC device code consistently uses psize to increment vs_alloc but varies between psize and lsize when decrementing it. The result of this behavior is that vs_alloc can be decremented more that it is incremented and underflow. This patch changes the code so asize is used anywhere. In addition, it ensures that vs_alloc gets incremented by the L2 ARC device code as buffers are written and not at the end of the l2arc_write_buffers() routine. The latter (and old) way would temporarily underflow vs_alloc as buffers that were just written, would be destroyed while l2arc_write_buffers() was still looping. Simplify spa_sync by breaking it up to smaller functions The point of this refactoring is to break the high-level conceptual steps of spa_sync() to their own helper functions. In general large functions can enhance readability if structured well, but in this case the amount of conceptual steps taken could use the help of helper functions. Make zdb results for checkpoint tests consistent This patch exports and re-imports the pool when these tests are analyzed with zdb to get consistent results. Portions contributed by: Jerry Jelinek Author: Serapheim Dimitropoulos Modified: vendor-sys/illumos/dist/uts/common/fs/zfs/arc.c vendor-sys/illumos/dist/uts/common/fs/zfs/spa.c vendor-sys/illumos/dist/uts/common/fs/zfs/vdev.c vendor-sys/illumos/dist/uts/common/fs/zfs/vdev_removal.c Modified: vendor-sys/illumos/dist/uts/common/fs/zfs/arc.c ============================================================================== --- vendor-sys/illumos/dist/uts/common/fs/zfs/arc.c Thu Nov 21 14:01:44 2019 (r354956) +++ vendor-sys/illumos/dist/uts/common/fs/zfs/arc.c Thu Nov 21 14:02:54 2019 (r354957) @@ -3124,7 +3124,8 @@ arc_hdr_l2hdr_destroy(arc_buf_hdr_t *hdr) { l2arc_buf_hdr_t *l2hdr = &hdr->b_l2hdr; l2arc_dev_t *dev = l2hdr->b_dev; - uint64_t psize = arc_hdr_size(hdr); + uint64_t psize = HDR_GET_PSIZE(hdr); + uint64_t asize = vdev_psize_to_asize(dev->l2ad_vdev, psize); ASSERT(MUTEX_HELD(&dev->l2ad_mtx)); ASSERT(HDR_HAS_L2HDR(hdr)); @@ -3134,9 +3135,10 @@ arc_hdr_l2hdr_destroy(arc_buf_hdr_t *hdr) ARCSTAT_INCR(arcstat_l2_psize, -psize); ARCSTAT_INCR(arcstat_l2_lsize, -HDR_GET_LSIZE(hdr)); - vdev_space_update(dev->l2ad_vdev, -psize, 0, 0); + vdev_space_update(dev->l2ad_vdev, -asize, 0, 0); - (void) zfs_refcount_remove_many(&dev->l2ad_alloc, psize, hdr); + (void) zfs_refcount_remove_many(&dev->l2ad_alloc, arc_hdr_size(hdr), + hdr); arc_hdr_clear_flags(hdr, ARC_FLAG_HAS_L2HDR); } @@ -6759,10 +6761,12 @@ top: list_remove(buflist, hdr); arc_hdr_clear_flags(hdr, ARC_FLAG_HAS_L2HDR); - ARCSTAT_INCR(arcstat_l2_psize, -arc_hdr_size(hdr)); + uint64_t psize = HDR_GET_PSIZE(hdr); + ARCSTAT_INCR(arcstat_l2_psize, -psize); ARCSTAT_INCR(arcstat_l2_lsize, -HDR_GET_LSIZE(hdr)); - bytes_dropped += arc_hdr_size(hdr); + bytes_dropped += + vdev_psize_to_asize(dev->l2ad_vdev, psize); (void) zfs_refcount_remove_many(&dev->l2ad_alloc, arc_hdr_size(hdr), hdr); } @@ -7213,6 +7217,7 @@ l2arc_write_buffers(spa_t *spa, l2arc_dev_t *dev, uint write_psize += psize; write_asize += asize; dev->l2ad_hand += asize; + vdev_space_update(dev->l2ad_vdev, asize, 0, 0); mutex_exit(hash_lock); @@ -7238,7 +7243,6 @@ l2arc_write_buffers(spa_t *spa, l2arc_dev_t *dev, uint ARCSTAT_INCR(arcstat_l2_write_bytes, write_psize); ARCSTAT_INCR(arcstat_l2_lsize, write_lsize); ARCSTAT_INCR(arcstat_l2_psize, write_psize); - vdev_space_update(dev->l2ad_vdev, write_psize, 0, 0); /* * Bump device hand to the device start if it is approaching the end. Modified: vendor-sys/illumos/dist/uts/common/fs/zfs/spa.c ============================================================================== --- vendor-sys/illumos/dist/uts/common/fs/zfs/spa.c Thu Nov 21 14:01:44 2019 (r354956) +++ vendor-sys/illumos/dist/uts/common/fs/zfs/spa.c Thu Nov 21 14:02:54 2019 (r354957) @@ -7379,6 +7379,9 @@ spa_sync_frees(spa_t *spa, bplist_t *bpl, dmu_tx_t *tx static void spa_sync_deferred_frees(spa_t *spa, dmu_tx_t *tx) { + if (spa_sync_pass(spa) != 1) + return; + zio_t *zio = zio_root(spa, NULL, NULL, 0); VERIFY3U(bpobj_iterate(&spa->spa_deferred_bpobj, spa_free_sync_cb, zio, tx), ==, 0); @@ -7774,10 +7777,10 @@ spa_sync_props(void *arg, dmu_tx_t *tx) static void spa_sync_upgrades(spa_t *spa, dmu_tx_t *tx) { - dsl_pool_t *dp = spa->spa_dsl_pool; + if (spa_sync_pass(spa) != 1) + return; - ASSERT(spa->spa_sync_pass == 1); - + dsl_pool_t *dp = spa->spa_dsl_pool; rrw_enter(&dp->dp_config_rwlock, RW_WRITER, FTAG); if (spa->spa_ubsync.ub_version < SPA_VERSION_ORIGIN && @@ -7872,116 +7875,31 @@ vdev_indirect_state_sync_verify(vdev_t *vd) } /* - * Sync the specified transaction group. New blocks may be dirtied as - * part of the process, so we iterate until it converges. + * Set the top-level vdev's max queue depth. Evaluate each top-level's + * async write queue depth in case it changed. The max queue depth will + * not change in the middle of syncing out this txg. */ -void -spa_sync(spa_t *spa, uint64_t txg) +static void +spa_sync_adjust_vdev_max_queue_depth(spa_t *spa) { - dsl_pool_t *dp = spa->spa_dsl_pool; - objset_t *mos = spa->spa_meta_objset; - bplist_t *free_bpl = &spa->spa_free_bplist[txg & TXG_MASK]; - metaslab_class_t *normal = spa_normal_class(spa); - metaslab_class_t *special = spa_special_class(spa); - metaslab_class_t *dedup = spa_dedup_class(spa); + ASSERT(spa_writeable(spa)); + vdev_t *rvd = spa->spa_root_vdev; - vdev_t *vd; - dmu_tx_t *tx; - int error; uint32_t max_queue_depth = zfs_vdev_async_write_max_active * zfs_vdev_queue_depth_pct / 100; + metaslab_class_t *normal = spa_normal_class(spa); + metaslab_class_t *special = spa_special_class(spa); + metaslab_class_t *dedup = spa_dedup_class(spa); - VERIFY(spa_writeable(spa)); - - /* - * Wait for i/os issued in open context that need to complete - * before this txg syncs. - */ - (void) zio_wait(spa->spa_txg_zio[txg & TXG_MASK]); - spa->spa_txg_zio[txg & TXG_MASK] = zio_root(spa, NULL, NULL, - ZIO_FLAG_CANFAIL); - - /* - * Lock out configuration changes. - */ - spa_config_enter(spa, SCL_CONFIG, FTAG, RW_READER); - - spa->spa_syncing_txg = txg; - spa->spa_sync_pass = 0; - - for (int i = 0; i < spa->spa_alloc_count; i++) { - mutex_enter(&spa->spa_alloc_locks[i]); - VERIFY0(avl_numnodes(&spa->spa_alloc_trees[i])); - mutex_exit(&spa->spa_alloc_locks[i]); - } - - /* - * If there are any pending vdev state changes, convert them - * into config changes that go out with this transaction group. - */ - spa_config_enter(spa, SCL_STATE, FTAG, RW_READER); - while (list_head(&spa->spa_state_dirty_list) != NULL) { - /* - * We need the write lock here because, for aux vdevs, - * calling vdev_config_dirty() modifies sav_config. - * This is ugly and will become unnecessary when we - * eliminate the aux vdev wart by integrating all vdevs - * into the root vdev tree. - */ - spa_config_exit(spa, SCL_CONFIG | SCL_STATE, FTAG); - spa_config_enter(spa, SCL_CONFIG | SCL_STATE, FTAG, RW_WRITER); - while ((vd = list_head(&spa->spa_state_dirty_list)) != NULL) { - vdev_state_clean(vd); - vdev_config_dirty(vd); - } - spa_config_exit(spa, SCL_CONFIG | SCL_STATE, FTAG); - spa_config_enter(spa, SCL_CONFIG | SCL_STATE, FTAG, RW_READER); - } - spa_config_exit(spa, SCL_STATE, FTAG); - - tx = dmu_tx_create_assigned(dp, txg); - - spa->spa_sync_starttime = gethrtime(); - VERIFY(cyclic_reprogram(spa->spa_deadman_cycid, - spa->spa_sync_starttime + spa->spa_deadman_synctime)); - - /* - * If we are upgrading to SPA_VERSION_RAIDZ_DEFLATE this txg, - * set spa_deflate if we have no raid-z vdevs. - */ - if (spa->spa_ubsync.ub_version < SPA_VERSION_RAIDZ_DEFLATE && - spa->spa_uberblock.ub_version >= SPA_VERSION_RAIDZ_DEFLATE) { - int i; - - for (i = 0; i < rvd->vdev_children; i++) { - vd = rvd->vdev_child[i]; - if (vd->vdev_deflate_ratio != SPA_MINBLOCKSIZE) - break; - } - if (i == rvd->vdev_children) { - spa->spa_deflate = TRUE; - VERIFY(0 == zap_add(spa->spa_meta_objset, - DMU_POOL_DIRECTORY_OBJECT, DMU_POOL_DEFLATE, - sizeof (uint64_t), 1, &spa->spa_deflate, tx)); - } - } - - /* - * Set the top-level vdev's max queue depth. Evaluate each - * top-level's async write queue depth in case it changed. - * The max queue depth will not change in the middle of syncing - * out this txg. - */ uint64_t slots_per_allocator = 0; for (int c = 0; c < rvd->vdev_children; c++) { vdev_t *tvd = rvd->vdev_child[c]; - metaslab_group_t *mg = tvd->vdev_mg; - metaslab_class_t *mc; + metaslab_group_t *mg = tvd->vdev_mg; if (mg == NULL || !metaslab_group_initialized(mg)) continue; - mc = mg->mg_class; + metaslab_class_t *mc = mg->mg_class; if (mc != normal && mc != special && mc != dedup) continue; @@ -8013,7 +7931,14 @@ spa_sync(spa_t *spa, uint64_t txg) normal->mc_alloc_throttle_enabled = zio_dva_throttle_enabled; special->mc_alloc_throttle_enabled = zio_dva_throttle_enabled; dedup->mc_alloc_throttle_enabled = zio_dva_throttle_enabled; +} +static void +spa_sync_condense_indirect(spa_t *spa, dmu_tx_t *tx) +{ + ASSERT(spa_writeable(spa)); + + vdev_t *rvd = spa->spa_root_vdev; for (int c = 0; c < rvd->vdev_children; c++) { vdev_t *vd = rvd->vdev_child[c]; vdev_indirect_state_sync_verify(vd); @@ -8023,10 +7948,16 @@ spa_sync(spa_t *spa, uint64_t txg) break; } } +} - /* - * Iterate to convergence. - */ +static void +spa_sync_iterate_to_convergence(spa_t *spa, dmu_tx_t *tx) +{ + objset_t *mos = spa->spa_meta_objset; + dsl_pool_t *dp = spa->spa_dsl_pool; + uint64_t txg = tx->tx_txg; + bplist_t *free_bpl = &spa->spa_free_bplist[txg & TXG_MASK]; + do { int pass = ++spa->spa_sync_pass; @@ -8052,79 +7983,60 @@ spa_sync(spa_t *spa, uint64_t txg) ddt_sync(spa, txg); dsl_scan_sync(dp, tx); + svr_sync(spa, tx); + spa_sync_upgrades(spa, tx); - if (spa->spa_vdev_removal != NULL) - svr_sync(spa, tx); - + vdev_t *vd = NULL; while ((vd = txg_list_remove(&spa->spa_vdev_txg_list, txg)) != NULL) vdev_sync(vd, txg); - if (pass == 1) { - spa_sync_upgrades(spa, tx); - ASSERT3U(txg, >=, - spa->spa_uberblock.ub_rootbp.blk_birth); + /* + * Note: We need to check if the MOS is dirty because we could + * have marked the MOS dirty without updating the uberblock + * (e.g. if we have sync tasks but no dirty user data). We need + * to check the uberblock's rootbp because it is updated if we + * have synced out dirty data (though in this case the MOS will + * most likely also be dirty due to second order effects, we + * don't want to rely on that here). + */ + if (pass == 1 && + spa->spa_uberblock.ub_rootbp.blk_birth < txg && + !dmu_objset_is_dirty(mos, txg)) { /* - * Note: We need to check if the MOS is dirty - * because we could have marked the MOS dirty - * without updating the uberblock (e.g. if we - * have sync tasks but no dirty user data). We - * need to check the uberblock's rootbp because - * it is updated if we have synced out dirty - * data (though in this case the MOS will most - * likely also be dirty due to second order - * effects, we don't want to rely on that here). + * Nothing changed on the first pass, therefore this + * TXG is a no-op. Avoid syncing deferred frees, so + * that we can keep this TXG as a no-op. */ - if (spa->spa_uberblock.ub_rootbp.blk_birth < txg && - !dmu_objset_is_dirty(mos, txg)) { - /* - * Nothing changed on the first pass, - * therefore this TXG is a no-op. Avoid - * syncing deferred frees, so that we - * can keep this TXG as a no-op. - */ - ASSERT(txg_list_empty(&dp->dp_dirty_datasets, - txg)); - ASSERT(txg_list_empty(&dp->dp_dirty_dirs, txg)); - ASSERT(txg_list_empty(&dp->dp_sync_tasks, txg)); - ASSERT(txg_list_empty(&dp->dp_early_sync_tasks, - txg)); - break; - } - spa_sync_deferred_frees(spa, tx); + ASSERT(txg_list_empty(&dp->dp_dirty_datasets, txg)); + ASSERT(txg_list_empty(&dp->dp_dirty_dirs, txg)); + ASSERT(txg_list_empty(&dp->dp_sync_tasks, txg)); + ASSERT(txg_list_empty(&dp->dp_early_sync_tasks, txg)); + break; } + spa_sync_deferred_frees(spa, tx); } while (dmu_objset_is_dirty(mos, txg)); +} - if (!list_is_empty(&spa->spa_config_dirty_list)) { - /* - * Make sure that the number of ZAPs for all the vdevs matches - * the number of ZAPs in the per-vdev ZAP list. This only gets - * called if the config is dirty; otherwise there may be - * outstanding AVZ operations that weren't completed in - * spa_sync_config_object. - */ - uint64_t all_vdev_zap_entry_count; - ASSERT0(zap_count(spa->spa_meta_objset, - spa->spa_all_vdev_zaps, &all_vdev_zap_entry_count)); - ASSERT3U(vdev_count_verify_zaps(spa->spa_root_vdev), ==, - all_vdev_zap_entry_count); - } +/* + * Rewrite the vdev configuration (which includes the uberblock) to + * commit the transaction group. + * + * If there are no dirty vdevs, we sync the uberblock to a few random + * top-level vdevs that are known to be visible in the config cache + * (see spa_vdev_add() for a complete description). If there *are* dirty + * vdevs, sync the uberblock to all vdevs. + */ +static void +spa_sync_rewrite_vdev_config(spa_t *spa, dmu_tx_t *tx) +{ + vdev_t *rvd = spa->spa_root_vdev; + uint64_t txg = tx->tx_txg; - if (spa->spa_vdev_removal != NULL) { - ASSERT0(spa->spa_vdev_removal->svr_bytes_done[txg & TXG_MASK]); - } - - /* - * Rewrite the vdev configuration (which includes the uberblock) - * to commit the transaction group. - * - * If there are no dirty vdevs, we sync the uberblock to a few - * random top-level vdevs that are known to be visible in the - * config cache (see spa_vdev_add() for a complete description). - * If there *are* dirty vdevs, sync the uberblock to all vdevs. - */ for (;;) { + int error = 0; + /* * We hold SCL_STATE to prevent vdev open/close/etc. * while we're attempting to write the vdev labels. @@ -8138,13 +8050,15 @@ spa_sync(spa_t *spa, uint64_t txg) int c0 = spa_get_random(children); for (int c = 0; c < children; c++) { - vd = rvd->vdev_child[(c0 + c) % children]; + vdev_t *vd = + rvd->vdev_child[(c0 + c) % children]; /* Stop when revisiting the first vdev */ if (c > 0 && svd[0] == vd) break; - if (vd->vdev_ms_array == 0 || vd->vdev_islog || + if (vd->vdev_ms_array == 0 || + vd->vdev_islog || !vdev_is_concrete(vd)) continue; @@ -8168,6 +8082,122 @@ spa_sync(spa_t *spa, uint64_t txg) zio_suspend(spa, NULL, ZIO_SUSPEND_IOERR); zio_resume_wait(spa); } +} + +/* + * Sync the specified transaction group. New blocks may be dirtied as + * part of the process, so we iterate until it converges. + */ +void +spa_sync(spa_t *spa, uint64_t txg) +{ + vdev_t *vd = NULL; + + VERIFY(spa_writeable(spa)); + + /* + * Wait for i/os issued in open context that need to complete + * before this txg syncs. + */ + (void) zio_wait(spa->spa_txg_zio[txg & TXG_MASK]); + spa->spa_txg_zio[txg & TXG_MASK] = zio_root(spa, NULL, NULL, + ZIO_FLAG_CANFAIL); + + /* + * Lock out configuration changes. + */ + spa_config_enter(spa, SCL_CONFIG, FTAG, RW_READER); + + spa->spa_syncing_txg = txg; + spa->spa_sync_pass = 0; + + for (int i = 0; i < spa->spa_alloc_count; i++) { + mutex_enter(&spa->spa_alloc_locks[i]); + VERIFY0(avl_numnodes(&spa->spa_alloc_trees[i])); + mutex_exit(&spa->spa_alloc_locks[i]); + } + + /* + * If there are any pending vdev state changes, convert them + * into config changes that go out with this transaction group. + */ + spa_config_enter(spa, SCL_STATE, FTAG, RW_READER); + while (list_head(&spa->spa_state_dirty_list) != NULL) { + /* + * We need the write lock here because, for aux vdevs, + * calling vdev_config_dirty() modifies sav_config. + * This is ugly and will become unnecessary when we + * eliminate the aux vdev wart by integrating all vdevs + * into the root vdev tree. + */ + spa_config_exit(spa, SCL_CONFIG | SCL_STATE, FTAG); + spa_config_enter(spa, SCL_CONFIG | SCL_STATE, FTAG, RW_WRITER); + while ((vd = list_head(&spa->spa_state_dirty_list)) != NULL) { + vdev_state_clean(vd); + vdev_config_dirty(vd); + } + spa_config_exit(spa, SCL_CONFIG | SCL_STATE, FTAG); + spa_config_enter(spa, SCL_CONFIG | SCL_STATE, FTAG, RW_READER); + } + spa_config_exit(spa, SCL_STATE, FTAG); + + dsl_pool_t *dp = spa->spa_dsl_pool; + dmu_tx_t *tx = dmu_tx_create_assigned(dp, txg); + + spa->spa_sync_starttime = gethrtime(); + VERIFY(cyclic_reprogram(spa->spa_deadman_cycid, + spa->spa_sync_starttime + spa->spa_deadman_synctime)); + + /* + * If we are upgrading to SPA_VERSION_RAIDZ_DEFLATE this txg, + * set spa_deflate if we have no raid-z vdevs. + */ + if (spa->spa_ubsync.ub_version < SPA_VERSION_RAIDZ_DEFLATE && + spa->spa_uberblock.ub_version >= SPA_VERSION_RAIDZ_DEFLATE) { + vdev_t *rvd = spa->spa_root_vdev; + + int i; + for (i = 0; i < rvd->vdev_children; i++) { + vd = rvd->vdev_child[i]; + if (vd->vdev_deflate_ratio != SPA_MINBLOCKSIZE) + break; + } + if (i == rvd->vdev_children) { + spa->spa_deflate = TRUE; + VERIFY0(zap_add(spa->spa_meta_objset, + DMU_POOL_DIRECTORY_OBJECT, DMU_POOL_DEFLATE, + sizeof (uint64_t), 1, &spa->spa_deflate, tx)); + } + } + + spa_sync_adjust_vdev_max_queue_depth(spa); + + spa_sync_condense_indirect(spa, tx); + + spa_sync_iterate_to_convergence(spa, tx); + +#ifdef ZFS_DEBUG + if (!list_is_empty(&spa->spa_config_dirty_list)) { + /* + * Make sure that the number of ZAPs for all the vdevs matches + * the number of ZAPs in the per-vdev ZAP list. This only gets + * called if the config is dirty; otherwise there may be + * outstanding AVZ operations that weren't completed in + * spa_sync_config_object. + */ + uint64_t all_vdev_zap_entry_count; + ASSERT0(zap_count(spa->spa_meta_objset, + spa->spa_all_vdev_zaps, &all_vdev_zap_entry_count)); + ASSERT3U(vdev_count_verify_zaps(spa->spa_root_vdev), ==, + all_vdev_zap_entry_count); + } +#endif + + if (spa->spa_vdev_removal != NULL) { + ASSERT0(spa->spa_vdev_removal->svr_bytes_done[txg & TXG_MASK]); + } + + spa_sync_rewrite_vdev_config(spa, tx); dmu_tx_commit(tx); VERIFY(cyclic_reprogram(spa->spa_deadman_cycid, CY_INFINITY)); Modified: vendor-sys/illumos/dist/uts/common/fs/zfs/vdev.c ============================================================================== --- vendor-sys/illumos/dist/uts/common/fs/zfs/vdev.c Thu Nov 21 14:01:44 2019 (r354956) +++ vendor-sys/illumos/dist/uts/common/fs/zfs/vdev.c Thu Nov 21 14:02:54 2019 (r354957) @@ -3833,6 +3833,11 @@ vdev_space_update(vdev_t *vd, int64_t alloc_delta, int dspace_delta = vdev_deflated_space(vd, space_delta); mutex_enter(&vd->vdev_stat_lock); + /* ensure we won't underflow */ + if (alloc_delta < 0) { + ASSERT3U(vd->vdev_stat.vs_alloc, >=, -alloc_delta); + } + vd->vdev_stat.vs_alloc += alloc_delta; vd->vdev_stat.vs_space += space_delta; vd->vdev_stat.vs_dspace += dspace_delta; @@ -3840,6 +3845,7 @@ vdev_space_update(vdev_t *vd, int64_t alloc_delta, int /* every class but log contributes to root space stats */ if (vd->vdev_mg != NULL && !vd->vdev_islog) { + ASSERT(!vd->vdev_isl2cache); mutex_enter(&rvd->vdev_stat_lock); rvd->vdev_stat.vs_alloc += alloc_delta; rvd->vdev_stat.vs_space += space_delta; Modified: vendor-sys/illumos/dist/uts/common/fs/zfs/vdev_removal.c ============================================================================== --- vendor-sys/illumos/dist/uts/common/fs/zfs/vdev_removal.c Thu Nov 21 14:01:44 2019 (r354956) +++ vendor-sys/illumos/dist/uts/common/fs/zfs/vdev_removal.c Thu Nov 21 14:02:54 2019 (r354957) @@ -1688,6 +1688,9 @@ svr_sync(spa_t *spa, dmu_tx_t *tx) spa_vdev_removal_t *svr = spa->spa_vdev_removal; int txgoff = dmu_tx_get_txg(tx) & TXG_MASK; + if (svr == NULL) + return; + /* * This check is necessary so that we do not dirty the * DIRECTORY_OBJECT via spa_sync_removing_state() when there From owner-svn-src-all@freebsd.org Thu Nov 21 14:04:07 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 16C9F1BFF26; Thu, 21 Nov 2019 14:04:07 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47JhBG6YTGz4Rs9; Thu, 21 Nov 2019 14:04:06 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id C4384C618; Thu, 21 Nov 2019 14:04:06 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xALE46pf047380; Thu, 21 Nov 2019 14:04:06 GMT (envelope-from avg@FreeBSD.org) Received: (from avg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xALE469R047379; Thu, 21 Nov 2019 14:04:06 GMT (envelope-from avg@FreeBSD.org) Message-Id: <201911211404.xALE469R047379@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avg set sender to avg@FreeBSD.org using -f From: Andriy Gapon Date: Thu, 21 Nov 2019 14:04:06 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-vendor@freebsd.org Subject: svn commit: r354958 - vendor-sys/illumos/dist/uts/common/fs/zfs X-SVN-Group: vendor-sys X-SVN-Commit-Author: avg X-SVN-Commit-Paths: vendor-sys/illumos/dist/uts/common/fs/zfs X-SVN-Commit-Revision: 354958 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 21 Nov 2019 14:04:07 -0000 Author: avg Date: Thu Nov 21 14:04:06 2019 New Revision: 354958 URL: https://svnweb.freebsd.org/changeset/base/354958 Log: 11051 zfs miscounts BP_IS_EMBEDDED blocks during scan. illumos/illumos-gate@ee2f9ca4ea24f72b05598c92aad7f42fb77b1345 https://github.com/illumos/illumos-gate/commit/ee2f9ca4ea24f72b05598c92aad7f42fb77b1345 https://www.illumos.org/issues/11051 Author: Bill Sommerfeld Modified: vendor-sys/illumos/dist/uts/common/fs/zfs/dsl_scan.c Modified: vendor-sys/illumos/dist/uts/common/fs/zfs/dsl_scan.c ============================================================================== --- vendor-sys/illumos/dist/uts/common/fs/zfs/dsl_scan.c Thu Nov 21 14:02:54 2019 (r354957) +++ vendor-sys/illumos/dist/uts/common/fs/zfs/dsl_scan.c Thu Nov 21 14:04:06 2019 (r354958) @@ -3432,6 +3432,13 @@ count_block(dsl_scan_t *scn, zfs_all_blkstats_t *zab, int i; /* + * Don't count embedded bp's, since we already did the work of + * scanning these when we scanned the containing block. + */ + if (BP_IS_EMBEDDED(bp)) + return; + + /* * Update the spa's stats on how many bytes we have issued. * Sequential scrubs create a zio for each DVA of the bp. Each * of these will include all DVAs for repair purposes, but the From owner-svn-src-all@freebsd.org Thu Nov 21 14:05:16 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 86C2B1BFFD2; Thu, 21 Nov 2019 14:05:16 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47JhCc32Cjz4S0W; Thu, 21 Nov 2019 14:05:16 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4B685C61A; Thu, 21 Nov 2019 14:05:16 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xALE5GKG047482; Thu, 21 Nov 2019 14:05:16 GMT (envelope-from avg@FreeBSD.org) Received: (from avg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xALE5GHL047481; Thu, 21 Nov 2019 14:05:16 GMT (envelope-from avg@FreeBSD.org) Message-Id: <201911211405.xALE5GHL047481@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avg set sender to avg@FreeBSD.org using -f From: Andriy Gapon Date: Thu, 21 Nov 2019 14:05:16 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-vendor@freebsd.org Subject: svn commit: r354959 - vendor-sys/illumos/dist/uts/common/fs/zfs X-SVN-Group: vendor-sys X-SVN-Commit-Author: avg X-SVN-Commit-Paths: vendor-sys/illumos/dist/uts/common/fs/zfs X-SVN-Commit-Revision: 354959 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 21 Nov 2019 14:05:16 -0000 Author: avg Date: Thu Nov 21 14:05:15 2019 New Revision: 354959 URL: https://svnweb.freebsd.org/changeset/base/354959 Log: 11056 vdev_disk_io_start will panic the system if ldi_strategy returns an error. illumos/illumos-gate@fa88c70fa54c01be933cc49fd271e5c4468f7eb8 https://github.com/illumos/illumos-gate/commit/fa88c70fa54c01be933cc49fd271e5c4468f7eb8 https://www.illumos.org/issues/11056 Author: Jerry Jelinek Modified: vendor-sys/illumos/dist/uts/common/fs/zfs/vdev_disk.c Modified: vendor-sys/illumos/dist/uts/common/fs/zfs/vdev_disk.c ============================================================================== --- vendor-sys/illumos/dist/uts/common/fs/zfs/vdev_disk.c Thu Nov 21 14:04:06 2019 (r354958) +++ vendor-sys/illumos/dist/uts/common/fs/zfs/vdev_disk.c Thu Nov 21 14:05:15 2019 (r354959) @@ -22,7 +22,7 @@ * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2012, 2018 by Delphix. All rights reserved. * Copyright 2016 Nexenta Systems, Inc. All rights reserved. - * Copyright (c) 2013 Joyent, Inc. All rights reserved. + * Copyright 2019 Joyent, Inc. */ #include @@ -857,8 +857,15 @@ vdev_disk_io_start(zio_t *zio) bp->b_bufsize = zio->io_size; bp->b_iodone = vdev_disk_io_intr; - /* ldi_strategy() will return non-zero only on programming errors */ - VERIFY(ldi_strategy(dvd->vd_lh, bp) == 0); + /* + * In general we would expect ldi_strategy() to return non-zero only + * because of programming errors, but we've also seen this fail shortly + * after a disk dies. + */ + if (ldi_strategy(dvd->vd_lh, bp) != 0) { + zio->io_error = ENXIO; + zio_interrupt(zio); + } } static void From owner-svn-src-all@freebsd.org Thu Nov 21 14:09:47 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 879811C0142; Thu, 21 Nov 2019 14:09:47 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47JhJq30bDz4SC9; Thu, 21 Nov 2019 14:09:47 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4AB77C62E; Thu, 21 Nov 2019 14:09:47 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xALE9lTW047715; Thu, 21 Nov 2019 14:09:47 GMT (envelope-from avg@FreeBSD.org) Received: (from avg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xALE9lrF047714; Thu, 21 Nov 2019 14:09:47 GMT (envelope-from avg@FreeBSD.org) Message-Id: <201911211409.xALE9lrF047714@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avg set sender to avg@FreeBSD.org using -f From: Andriy Gapon Date: Thu, 21 Nov 2019 14:09:47 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-vendor@freebsd.org Subject: svn commit: r354960 - vendor/illumos/dist/man/man5 X-SVN-Group: vendor X-SVN-Commit-Author: avg X-SVN-Commit-Paths: vendor/illumos/dist/man/man5 X-SVN-Commit-Revision: 354960 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 21 Nov 2019 14:09:47 -0000 Author: avg Date: Thu Nov 21 14:09:46 2019 New Revision: 354960 URL: https://svnweb.freebsd.org/changeset/base/354960 Log: 10829 zpool-features.5 add missing .RE illumos/illumos-gate@1d775d5906fd85b9ab1ac2251af8d38b5567d9a1 https://github.com/illumos/illumos-gate/commit/1d775d5906fd85b9ab1ac2251af8d38b5567d9a1 https://www.illumos.org/issues/10829 zpool-features.5 is missing .RE before allocation_classes. Author: Toomas Soome Modified: vendor/illumos/dist/man/man5/zpool-features.5 Modified: vendor/illumos/dist/man/man5/zpool-features.5 ============================================================================== --- vendor/illumos/dist/man/man5/zpool-features.5 Thu Nov 21 14:05:15 2019 (r354959) +++ vendor/illumos/dist/man/man5/zpool-features.5 Thu Nov 21 14:09:46 2019 (r354960) @@ -15,7 +15,7 @@ .\" CDDL HEADER, with the fields enclosed by brackets "[]" replaced with your .\" own identifying information: .\" Portions Copyright [yyyy] [name of copyright owner] -.TH ZPOOL-FEATURES 5 "Jun 8, 2018" +.TH ZPOOL-FEATURES 5 "Apr 19, 2019" .SH NAME zpool\-features \- ZFS pool feature descriptions .SH DESCRIPTION @@ -661,6 +661,8 @@ ever had their checksum set to \fBedonr\fR are destroy Booting off of pools using \fBedonr\fR is supported. +.RE + .sp .ne 2 .na @@ -680,8 +682,6 @@ This feature becomes \fBactive\fR when a dedicated all (dedup or special) is created with zpool create or zpool add. With device removal, it can be returned to the \fBenabled\fR state if all the top-level vdevs from an allocation class are removed. - -.RE .SH "SEE ALSO" \fBzpool\fR(1M) From owner-svn-src-all@freebsd.org Thu Nov 21 14:10:58 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 178AF1C01DD; Thu, 21 Nov 2019 14:10:58 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47JhL96rHDz4SLX; Thu, 21 Nov 2019 14:10:57 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id CF53AC65B; Thu, 21 Nov 2019 14:10:57 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xALEAvw7050112; Thu, 21 Nov 2019 14:10:57 GMT (envelope-from avg@FreeBSD.org) Received: (from avg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xALEAuL1050104; Thu, 21 Nov 2019 14:10:56 GMT (envelope-from avg@FreeBSD.org) Message-Id: <201911211410.xALEAuL1050104@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avg set sender to avg@FreeBSD.org using -f From: Andriy Gapon Date: Thu, 21 Nov 2019 14:10:56 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-vendor@freebsd.org Subject: svn commit: r354961 - vendor-sys/illumos/dist/common/zfs vendor-sys/illumos/dist/uts/common/fs/zfs vendor-sys/illumos/dist/uts/common/fs/zfs/sys vendor-sys/illumos/dist/uts/common/sys/fs vendor/ill... X-SVN-Group: vendor X-SVN-Commit-Author: avg X-SVN-Commit-Paths: vendor-sys/illumos/dist/common/zfs vendor-sys/illumos/dist/uts/common/fs/zfs vendor-sys/illumos/dist/uts/common/fs/zfs/sys vendor-sys/illumos/dist/uts/common/sys/fs vendor/illumos/dist/cmd/zpool vendo... X-SVN-Commit-Revision: 354961 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 21 Nov 2019 14:10:58 -0000 Author: avg Date: Thu Nov 21 14:10:53 2019 New Revision: 354961 URL: https://svnweb.freebsd.org/changeset/base/354961 Log: 10952 defer new resilvers and misc. resilver-related fixes illumos/illumos-gate@e4c795beb33bf59dd4ad2e3f88f493111484b890 https://github.com/illumos/illumos-gate/commit/e4c795beb33bf59dd4ad2e3f88f493111484b890 https://www.illumos.org/issues/10952 From ZoL 612c4930dd2 Fix the spelling of deferred ??? cef48f14da6 Remove races from scrub / resilver tests 4021ba4cfaa Make vdev_set_deferred_resilver() recursive 8cb119e3dc0 Fix 2 small bugs with cached dsl_scan_phys_t 5e0bd0ae056 Fix issue with scanning dedup blocks as scan ends b3d7725c943 Remove zfs_gitrev.h (this shouldn't be part of 80a91e74696) 80a91e74696 Defer new resilvers until the current one ends Portions contributed by: Jerry Jelinek Portions contributed by: Brian Behlendorf Portions contributed by: Arkadiusz BubaÅ‚a Author: Tom Caputi Modified: vendor/illumos/dist/cmd/zpool/zpool_main.c vendor/illumos/dist/lib/libzfs/common/libzfs.h vendor/illumos/dist/lib/libzfs/common/libzfs_pool.c vendor/illumos/dist/lib/libzfs/common/libzfs_util.c vendor/illumos/dist/man/man1m/zpool.1m vendor/illumos/dist/man/man5/zpool-features.5 Changes in other areas also in this revision: Modified: vendor-sys/illumos/dist/common/zfs/zfeature_common.c vendor-sys/illumos/dist/common/zfs/zfeature_common.h vendor-sys/illumos/dist/uts/common/fs/zfs/dsl_scan.c vendor-sys/illumos/dist/uts/common/fs/zfs/spa.c vendor-sys/illumos/dist/uts/common/fs/zfs/sys/spa_impl.h vendor-sys/illumos/dist/uts/common/fs/zfs/sys/vdev.h vendor-sys/illumos/dist/uts/common/fs/zfs/sys/vdev_impl.h vendor-sys/illumos/dist/uts/common/fs/zfs/vdev.c vendor-sys/illumos/dist/uts/common/fs/zfs/vdev_indirect.c vendor-sys/illumos/dist/uts/common/fs/zfs/vdev_label.c vendor-sys/illumos/dist/uts/common/fs/zfs/vdev_removal.c vendor-sys/illumos/dist/uts/common/fs/zfs/zil.c vendor-sys/illumos/dist/uts/common/sys/fs/zfs.h Modified: vendor/illumos/dist/cmd/zpool/zpool_main.c ============================================================================== --- vendor/illumos/dist/cmd/zpool/zpool_main.c Thu Nov 21 14:09:46 2019 (r354960) +++ vendor/illumos/dist/cmd/zpool/zpool_main.c Thu Nov 21 14:10:53 2019 (r354961) @@ -88,6 +88,7 @@ static int zpool_do_split(int, char **); static int zpool_do_initialize(int, char **); static int zpool_do_scrub(int, char **); +static int zpool_do_resilver(int, char **); static int zpool_do_import(int, char **); static int zpool_do_export(int, char **); @@ -140,6 +141,7 @@ typedef enum { HELP_REMOVE, HELP_INITIALIZE, HELP_SCRUB, + HELP_RESILVER, HELP_STATUS, HELP_UPGRADE, HELP_GET, @@ -192,6 +194,7 @@ static zpool_command_t command_table[] = { { "split", zpool_do_split, HELP_SPLIT }, { NULL }, { "initialize", zpool_do_initialize, HELP_INITIALIZE }, + { "resilver", zpool_do_resilver, HELP_RESILVER }, { "scrub", zpool_do_scrub, HELP_SCRUB }, { NULL }, { "import", zpool_do_import, HELP_IMPORT }, @@ -273,6 +276,8 @@ get_usage(zpool_help_t idx) return (gettext("\tinitialize [-cs] [ ...]\n")); case HELP_SCRUB: return (gettext("\tscrub [-s | -p] ...\n")); + case HELP_RESILVER: + return (gettext("\tresilver ...\n")); case HELP_STATUS: return (gettext("\tstatus [-DgLPvx] [-T d|u] [pool] ... " "[interval [count]]\n")); @@ -1688,11 +1693,14 @@ print_status_config(zpool_handle_t *zhp, status_cbdata (void) nvlist_lookup_uint64_array(nv, ZPOOL_CONFIG_SCAN_STATS, (uint64_t **)&ps, &c); - if (ps != NULL && ps->pss_state == DSS_SCANNING && - vs->vs_scan_processed != 0 && children == 0) { - (void) printf(gettext(" (%s)"), - (ps->pss_func == POOL_SCAN_RESILVER) ? - "resilvering" : "repairing"); + if (ps != NULL && ps->pss_state == DSS_SCANNING && children == 0) { + if (vs->vs_scan_processed != 0) { + (void) printf(gettext(" (%s)"), + (ps->pss_func == POOL_SCAN_RESILVER) ? + "resilvering" : "repairing"); + } else if (vs->vs_resilver_deferred) { + (void) printf(gettext(" (awaiting resilver)")); + } } if ((vs->vs_initialize_state == VDEV_INITIALIZE_ACTIVE || @@ -4519,7 +4527,7 @@ scrub_callback(zpool_handle_t *zhp, void *data) * Ignore faulted pools. */ if (zpool_get_state(zhp) == POOL_STATE_UNAVAIL) { - (void) fprintf(stderr, gettext("cannot scrub '%s': pool is " + (void) fprintf(stderr, gettext("cannot scan '%s': pool is " "currently unavailable\n"), zpool_get_name(zhp)); return (1); } @@ -4576,6 +4584,43 @@ zpool_do_scrub(int argc, char **argv) cb.cb_argc = argc; cb.cb_argv = argv; + argc -= optind; + argv += optind; + + if (argc < 1) { + (void) fprintf(stderr, gettext("missing pool name argument\n")); + usage(B_FALSE); + } + + return (for_each_pool(argc, argv, B_TRUE, NULL, scrub_callback, &cb)); +} + +/* + * zpool resilver ... + * + * Restarts any in-progress resilver + */ +int +zpool_do_resilver(int argc, char **argv) +{ + int c; + scrub_cbdata_t cb; + + cb.cb_type = POOL_SCAN_RESILVER; + cb.cb_scrub_cmd = POOL_SCRUB_NORMAL; + cb.cb_argc = argc; + cb.cb_argv = argv; + + /* check options */ + while ((c = getopt(argc, argv, "")) != -1) { + switch (c) { + case '?': + (void) fprintf(stderr, gettext("invalid option '%c'\n"), + optopt); + usage(B_FALSE); + } + } + argc -= optind; argv += optind; Modified: vendor/illumos/dist/lib/libzfs/common/libzfs.h ============================================================================== --- vendor/illumos/dist/lib/libzfs/common/libzfs.h Thu Nov 21 14:09:46 2019 (r354960) +++ vendor/illumos/dist/lib/libzfs/common/libzfs.h Thu Nov 21 14:10:53 2019 (r354961) @@ -140,6 +140,7 @@ typedef enum zfs_error { EZFS_TOOMANY, /* argument list too long */ EZFS_INITIALIZING, /* currently initializing */ EZFS_NO_INITIALIZE, /* no active initialize */ + EZFS_NO_RESILVER_DEFER, /* pool doesn't support resilver_defer */ EZFS_UNKNOWN } zfs_error_t; Modified: vendor/illumos/dist/lib/libzfs/common/libzfs_pool.c ============================================================================== --- vendor/illumos/dist/lib/libzfs/common/libzfs_pool.c Thu Nov 21 14:09:46 2019 (r354960) +++ vendor/illumos/dist/lib/libzfs/common/libzfs_pool.c Thu Nov 21 14:10:53 2019 (r354961) @@ -2034,6 +2034,10 @@ zpool_scan(zpool_handle_t *zhp, pool_scan_func_t func, (void) snprintf(msg, sizeof (msg), dgettext(TEXT_DOMAIN, "cannot scrub %s"), zc.zc_name); } + } else if (func == POOL_SCAN_RESILVER) { + assert(cmd == POOL_SCRUB_NORMAL); + (void) snprintf(msg, sizeof (msg), dgettext(TEXT_DOMAIN, + "cannot restart resilver on %s"), zc.zc_name); } else if (func == POOL_SCAN_NONE) { (void) snprintf(msg, sizeof (msg), dgettext(TEXT_DOMAIN, "cannot cancel scrubbing %s"), @@ -2061,6 +2065,8 @@ zpool_scan(zpool_handle_t *zhp, pool_scan_func_t func, } } else if (err == ENOENT) { return (zfs_error(hdl, EZFS_NO_SCRUB, msg)); + } else if (err == ENOTSUP && func == POOL_SCAN_RESILVER) { + return (zfs_error(hdl, EZFS_NO_RESILVER_DEFER, msg)); } else { return (zpool_standard_error(hdl, err, msg)); } Modified: vendor/illumos/dist/lib/libzfs/common/libzfs_util.c ============================================================================== --- vendor/illumos/dist/lib/libzfs/common/libzfs_util.c Thu Nov 21 14:09:46 2019 (r354960) +++ vendor/illumos/dist/lib/libzfs/common/libzfs_util.c Thu Nov 21 14:10:53 2019 (r354961) @@ -260,6 +260,9 @@ libzfs_error_description(libzfs_handle_t *hdl) case EZFS_NO_INITIALIZE: return (dgettext(TEXT_DOMAIN, "there is no active " "initialization")); + case EZFS_NO_RESILVER_DEFER: + return (dgettext(TEXT_DOMAIN, "this action requires the " + "resilver_defer feature")); case EZFS_UNKNOWN: return (dgettext(TEXT_DOMAIN, "unknown error")); default: Modified: vendor/illumos/dist/man/man1m/zpool.1m ============================================================================== --- vendor/illumos/dist/man/man1m/zpool.1m Thu Nov 21 14:09:46 2019 (r354960) +++ vendor/illumos/dist/man/man1m/zpool.1m Thu Nov 21 14:10:53 2019 (r354961) @@ -26,7 +26,7 @@ .\" Copyright (c) 2017 George Melikov. All Rights Reserved. .\" Copyright 2019 Joyent, Inc. .\" -.Dd April 27, 2018 +.Dd May 15, 2019 .Dt ZPOOL 1M .Os .Sh NAME @@ -156,6 +156,9 @@ .Op Fl f .Ar pool Ar device Op Ar new_device .Nm +.Cm resilver +.Ar pool Ns ... +.Nm .Cm scrub .Op Fl s | Fl p .Ar pool Ns ... @@ -1774,6 +1777,19 @@ Forces use of even if its appears to be in use. Not all devices can be overridden in this manner. .El +.It Xo +.Nm +.Cm resilver +.Ar pool Ns ... +.Xc +Starts a resilver. +If an existing resilver is already running it will be restarted from the +beginning. +Any drives that were scheduled for a deferred resilver will be added to the +new one. +This requires the +.Sy resilver_defer +feature. .It Xo .Nm .Cm scrub Modified: vendor/illumos/dist/man/man5/zpool-features.5 ============================================================================== --- vendor/illumos/dist/man/man5/zpool-features.5 Thu Nov 21 14:09:46 2019 (r354960) +++ vendor/illumos/dist/man/man5/zpool-features.5 Thu Nov 21 14:10:53 2019 (r354961) @@ -15,7 +15,7 @@ .\" CDDL HEADER, with the fields enclosed by brackets "[]" replaced with your .\" own identifying information: .\" Portions Copyright [yyyy] [name of copyright owner] -.TH ZPOOL-FEATURES 5 "Apr 19, 2019" +.TH ZPOOL-FEATURES 5 "May 15, 2019" .SH NAME zpool\-features \- ZFS pool feature descriptions .SH DESCRIPTION @@ -682,6 +682,27 @@ This feature becomes \fBactive\fR when a dedicated all (dedup or special) is created with zpool create or zpool add. With device removal, it can be returned to the \fBenabled\fR state if all the top-level vdevs from an allocation class are removed. + +.RE +.sp +.ne 2 +.na +\fB\fBresilver_defer\fR\fR +.ad +.RS 4n +.TS +l l . +GUID com.datto:resilver_defer +READ\-ONLY COMPATIBLE yes +DEPENDENCIES none +.TE + +This feature allows zfs to postpone new resilvers if an existing one is already +in progress. Without this feature, any new resilvers will cause the currently +running one to be immediately restarted from the beginning. + +This feature becomes \fBactive\fR once a resilver has been deferred, and +returns to being \fBenabled\fR when the deferred resilver begins. .SH "SEE ALSO" \fBzpool\fR(1M) From owner-svn-src-all@freebsd.org Thu Nov 21 14:10:56 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 7B9291C01D7; Thu, 21 Nov 2019 14:10:56 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47JhL83QcSz4SLS; Thu, 21 Nov 2019 14:10:56 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 58D67C657; Thu, 21 Nov 2019 14:10:56 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xALEAuUn050099; Thu, 21 Nov 2019 14:10:56 GMT (envelope-from avg@FreeBSD.org) Received: (from avg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xALEArvv050085; Thu, 21 Nov 2019 14:10:53 GMT (envelope-from avg@FreeBSD.org) Message-Id: <201911211410.xALEArvv050085@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avg set sender to avg@FreeBSD.org using -f From: Andriy Gapon Date: Thu, 21 Nov 2019 14:10:53 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-vendor@freebsd.org Subject: svn commit: r354961 - vendor-sys/illumos/dist/common/zfs vendor-sys/illumos/dist/uts/common/fs/zfs vendor-sys/illumos/dist/uts/common/fs/zfs/sys vendor-sys/illumos/dist/uts/common/sys/fs vendor/ill... X-SVN-Group: vendor-sys X-SVN-Commit-Author: avg X-SVN-Commit-Paths: vendor-sys/illumos/dist/common/zfs vendor-sys/illumos/dist/uts/common/fs/zfs vendor-sys/illumos/dist/uts/common/fs/zfs/sys vendor-sys/illumos/dist/uts/common/sys/fs vendor/illumos/dist/cmd/zpool vendo... X-SVN-Commit-Revision: 354961 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 21 Nov 2019 14:10:56 -0000 Author: avg Date: Thu Nov 21 14:10:53 2019 New Revision: 354961 URL: https://svnweb.freebsd.org/changeset/base/354961 Log: 10952 defer new resilvers and misc. resilver-related fixes illumos/illumos-gate@e4c795beb33bf59dd4ad2e3f88f493111484b890 https://github.com/illumos/illumos-gate/commit/e4c795beb33bf59dd4ad2e3f88f493111484b890 https://www.illumos.org/issues/10952 From ZoL 612c4930dd2 Fix the spelling of deferred ??? cef48f14da6 Remove races from scrub / resilver tests 4021ba4cfaa Make vdev_set_deferred_resilver() recursive 8cb119e3dc0 Fix 2 small bugs with cached dsl_scan_phys_t 5e0bd0ae056 Fix issue with scanning dedup blocks as scan ends b3d7725c943 Remove zfs_gitrev.h (this shouldn't be part of 80a91e74696) 80a91e74696 Defer new resilvers until the current one ends Portions contributed by: Jerry Jelinek Portions contributed by: Brian Behlendorf Portions contributed by: Arkadiusz BubaÅ‚a Author: Tom Caputi Modified: vendor-sys/illumos/dist/common/zfs/zfeature_common.c vendor-sys/illumos/dist/common/zfs/zfeature_common.h vendor-sys/illumos/dist/uts/common/fs/zfs/dsl_scan.c vendor-sys/illumos/dist/uts/common/fs/zfs/spa.c vendor-sys/illumos/dist/uts/common/fs/zfs/sys/spa_impl.h vendor-sys/illumos/dist/uts/common/fs/zfs/sys/vdev.h vendor-sys/illumos/dist/uts/common/fs/zfs/sys/vdev_impl.h vendor-sys/illumos/dist/uts/common/fs/zfs/vdev.c vendor-sys/illumos/dist/uts/common/fs/zfs/vdev_indirect.c vendor-sys/illumos/dist/uts/common/fs/zfs/vdev_label.c vendor-sys/illumos/dist/uts/common/fs/zfs/vdev_removal.c vendor-sys/illumos/dist/uts/common/fs/zfs/zil.c vendor-sys/illumos/dist/uts/common/sys/fs/zfs.h Changes in other areas also in this revision: Modified: vendor/illumos/dist/cmd/zpool/zpool_main.c vendor/illumos/dist/lib/libzfs/common/libzfs.h vendor/illumos/dist/lib/libzfs/common/libzfs_pool.c vendor/illumos/dist/lib/libzfs/common/libzfs_util.c vendor/illumos/dist/man/man1m/zpool.1m vendor/illumos/dist/man/man5/zpool-features.5 Modified: vendor-sys/illumos/dist/common/zfs/zfeature_common.c ============================================================================== --- vendor-sys/illumos/dist/common/zfs/zfeature_common.c Thu Nov 21 14:09:46 2019 (r354960) +++ vendor-sys/illumos/dist/common/zfs/zfeature_common.c Thu Nov 21 14:10:53 2019 (r354961) @@ -300,10 +300,13 @@ zpool_feature_init(void) "freed or remapped.", ZFEATURE_FLAG_READONLY_COMPAT, obsolete_counts_deps); - { zfeature_register(SPA_FEATURE_ALLOCATION_CLASSES, "org.zfsonlinux:allocation_classes", "allocation_classes", "Support for separate allocation classes.", ZFEATURE_FLAG_READONLY_COMPAT, NULL); - } + + zfeature_register(SPA_FEATURE_RESILVER_DEFER, + "com.datto:resilver_defer", "resilver_defer", + "Support for defering new resilvers when one is already running.", + ZFEATURE_FLAG_READONLY_COMPAT, NULL); } Modified: vendor-sys/illumos/dist/common/zfs/zfeature_common.h ============================================================================== --- vendor-sys/illumos/dist/common/zfs/zfeature_common.h Thu Nov 21 14:09:46 2019 (r354960) +++ vendor-sys/illumos/dist/common/zfs/zfeature_common.h Thu Nov 21 14:10:53 2019 (r354961) @@ -63,6 +63,7 @@ typedef enum spa_feature { SPA_FEATURE_POOL_CHECKPOINT, SPA_FEATURE_SPACEMAP_V2, SPA_FEATURE_ALLOCATION_CLASSES, + SPA_FEATURE_RESILVER_DEFER, SPA_FEATURES } spa_feature_t; Modified: vendor-sys/illumos/dist/uts/common/fs/zfs/dsl_scan.c ============================================================================== --- vendor-sys/illumos/dist/uts/common/fs/zfs/dsl_scan.c Thu Nov 21 14:09:46 2019 (r354960) +++ vendor-sys/illumos/dist/uts/common/fs/zfs/dsl_scan.c Thu Nov 21 14:10:53 2019 (r354961) @@ -183,12 +183,15 @@ unsigned int zfs_free_min_time_ms = 1000; /* min milli unsigned int zfs_obsolete_min_time_ms = 500; /* min millisecs to resilver per txg */ unsigned int zfs_resilver_min_time_ms = 3000; +int zfs_scan_suspend_progress = 0; /* set to prevent scans from progressing */ boolean_t zfs_no_scrub_io = B_FALSE; /* set to disable scrub i/o */ boolean_t zfs_no_scrub_prefetch = B_FALSE; /* set to disable scrub prefetch */ enum ddt_class zfs_scrub_ddt_class_max = DDT_CLASS_DUPLICATE; /* max number of blocks to free in a single TXG */ uint64_t zfs_async_block_max_blocks = UINT64_MAX; +int zfs_resilver_disable_defer = 0; /* set to disable resilver deferring */ + /* * We wait a few txgs after importing a pool to begin scanning so that * the import / mounting code isn't held up by scrub / resilver IO. @@ -455,7 +458,6 @@ dsl_scan_init(dsl_pool_t *dp, uint64_t txg) scn->scn_async_destroying = spa_feature_is_active(dp->dp_spa, SPA_FEATURE_ASYNC_DESTROY); - bcopy(&scn->scn_phys, &scn->scn_phys_cached, sizeof (scn->scn_phys)); avl_create(&scn->scn_queue, scan_ds_queue_compare, sizeof (scan_ds_t), offsetof(scan_ds_t, sds_node)); avl_create(&scn->scn_prefetch_queue, scan_prefetch_queue_compare, @@ -513,6 +515,8 @@ dsl_scan_init(dsl_pool_t *dp, uint64_t txg) } } + bcopy(&scn->scn_phys, &scn->scn_phys_cached, sizeof (scn->scn_phys)); + /* reload the queue into the in-core state */ if (scn->scn_phys.scn_queue_obj != 0) { zap_cursor_t zc; @@ -751,6 +755,11 @@ dsl_scan(dsl_pool_t *dp, pool_scan_func_t func) spa->spa_scrub_reopen = B_FALSE; (void) spa_vdev_state_exit(spa, NULL, 0); + if (func == POOL_SCAN_RESILVER) { + dsl_resilver_restart(spa->spa_dsl_pool, 0); + return (0); + } + if (func == POOL_SCAN_SCRUB && dsl_scan_is_paused_scrub(scn)) { /* got scrub start cmd, resume paused scrub */ int err = dsl_scrub_set_pause_resume(scn->scn_dp, @@ -766,6 +775,41 @@ dsl_scan(dsl_pool_t *dp, pool_scan_func_t func) dsl_scan_setup_sync, &func, 0, ZFS_SPACE_CHECK_EXTRA_RESERVED)); } +/* + * Sets the resilver defer flag to B_FALSE on all leaf devs under vd. Returns + * B_TRUE if we have devices that need to be resilvered and are available to + * accept resilver I/Os. + */ +static boolean_t +dsl_scan_clear_deferred(vdev_t *vd, dmu_tx_t *tx) +{ + boolean_t resilver_needed = B_FALSE; + spa_t *spa = vd->vdev_spa; + + for (int c = 0; c < vd->vdev_children; c++) { + resilver_needed |= + dsl_scan_clear_deferred(vd->vdev_child[c], tx); + } + + if (vd == spa->spa_root_vdev && + spa_feature_is_active(spa, SPA_FEATURE_RESILVER_DEFER)) { + spa_feature_decr(spa, SPA_FEATURE_RESILVER_DEFER, tx); + vdev_config_dirty(vd); + spa->spa_resilver_deferred = B_FALSE; + return (resilver_needed); + } + + if (!vdev_is_concrete(vd) || vd->vdev_aux || + !vd->vdev_ops->vdev_op_leaf) + return (resilver_needed); + + if (vd->vdev_resilver_deferred) + vd->vdev_resilver_deferred = B_FALSE; + + return (!vdev_is_dead(vd) && !vd->vdev_offline && + vdev_resilver_needed(vd, NULL, NULL)); +} + /* ARGSUSED */ static void dsl_scan_done(dsl_scan_t *scn, boolean_t complete, dmu_tx_t *tx) @@ -865,6 +909,25 @@ dsl_scan_done(dsl_scan_t *scn, boolean_t complete, dmu * Let the async thread assess this and handle the detach. */ spa_async_request(spa, SPA_ASYNC_RESILVER_DONE); + + /* + * Clear any deferred_resilver flags in the config. + * If there are drives that need resilvering, kick + * off an asynchronous request to start resilver. + * dsl_scan_clear_deferred() may update the config + * before the resilver can restart. In the event of + * a crash during this period, the spa loading code + * will find the drives that need to be resilvered + * when the machine reboots and start the resilver then. + */ + boolean_t resilver_needed = + dsl_scan_clear_deferred(spa->spa_root_vdev, tx); + if (resilver_needed) { + spa_history_log_internal(spa, + "starting deferred resilver", tx, + "errors=%llu", spa_get_errlog_size(spa)); + spa_async_request(spa, SPA_ASYNC_RESILVER); + } } scn->scn_phys.scn_end_time = gethrestime_sec(); @@ -935,6 +998,7 @@ dsl_scrub_pause_resume_sync(void *arg, dmu_tx_t *tx) /* can't pause a scrub when there is no in-progress scrub */ spa->spa_scan_pass_scrub_pause = gethrestime_sec(); scn->scn_phys.scn_flags |= DSF_SCRUB_PAUSED; + scn->scn_phys_cached.scn_flags |= DSF_SCRUB_PAUSED; dsl_scan_sync_state(scn, tx, SYNC_CACHED); spa_event_notify(spa, NULL, NULL, ESC_ZFS_SCRUB_PAUSED); } else { @@ -949,6 +1013,7 @@ dsl_scrub_pause_resume_sync(void *arg, dmu_tx_t *tx) gethrestime_sec() - spa->spa_scan_pass_scrub_pause; spa->spa_scan_pass_scrub_pause = 0; scn->scn_phys.scn_flags &= ~DSF_SCRUB_PAUSED; + scn->scn_phys_cached.scn_flags &= ~DSF_SCRUB_PAUSED; dsl_scan_sync_state(scn, tx, SYNC_CACHED); } } @@ -2335,6 +2400,20 @@ dsl_scan_ddt_entry(dsl_scan_t *scn, enum zio_checksum if (scn->scn_phys.scn_state != DSS_SCANNING) return; + /* + * This function is special because it is the only thing + * that can add scan_io_t's to the vdev scan queues from + * outside dsl_scan_sync(). For the most part this is ok + * as long as it is called from within syncing context. + * However, dsl_scan_sync() expects that no new sio's will + * be added between when all the work for a scan is done + * and the next txg when the scan is actually marked as + * completed. This check ensures we do not issue new sio's + * during this period. + */ + if (scn->scn_done_txg != 0) + return; + for (p = 0; p < DDT_PHYS_TYPES; p++, ddp++) { if (ddp->ddp_phys_birth == 0 || ddp->ddp_phys_birth > scn->scn_phys.scn_max_txg) @@ -2986,6 +3065,26 @@ dsl_scan_active(dsl_scan_t *scn) } static boolean_t +dsl_scan_check_deferred(vdev_t *vd) +{ + boolean_t need_resilver = B_FALSE; + + for (int c = 0; c < vd->vdev_children; c++) { + need_resilver |= + dsl_scan_check_deferred(vd->vdev_child[c]); + } + + if (!vdev_is_concrete(vd) || vd->vdev_aux || + !vd->vdev_ops->vdev_op_leaf) + return (need_resilver); + + if (!vd->vdev_resilver_deferred) + need_resilver = B_TRUE; + + return (need_resilver); +} + +static boolean_t dsl_scan_need_resilver(spa_t *spa, const dva_t *dva, size_t psize, uint64_t phys_birth) { @@ -3032,6 +3131,13 @@ dsl_scan_need_resilver(spa_t *spa, const dva_t *dva, s if (!vdev_dtl_need_resilver(vd, DVA_GET_OFFSET(dva), psize)) return (B_FALSE); + /* + * Check that this top-level vdev has a device under it which + * is resilvering and is not deferred. + */ + if (!dsl_scan_check_deferred(vd)) + return (B_FALSE); + return (B_TRUE); } @@ -3193,12 +3299,19 @@ dsl_scan_sync(dsl_pool_t *dp, dmu_tx_t *tx) int err = 0; state_sync_type_t sync_type = SYNC_OPTIONAL; + if (spa->spa_resilver_deferred && + !spa_feature_is_active(dp->dp_spa, SPA_FEATURE_RESILVER_DEFER)) + spa_feature_incr(spa, SPA_FEATURE_RESILVER_DEFER, tx); + /* * Check for scn_restart_txg before checking spa_load_state, so * that we can restart an old-style scan while the pool is being - * imported (see dsl_scan_init). + * imported (see dsl_scan_init). We also restart scans if there + * is a deferred resilver and the user has manually disabled + * deferred resilvers via the tunable. */ - if (dsl_scan_restarting(scn, tx)) { + if (dsl_scan_restarting(scn, tx) || + (spa->spa_resilver_deferred && zfs_resilver_disable_defer)) { pool_scan_func_t func = POOL_SCAN_SCRUB; dsl_scan_done(scn, B_FALSE, tx); if (vdev_resilver_needed(spa->spa_root_vdev, NULL, NULL)) @@ -3265,6 +3378,27 @@ dsl_scan_sync(dsl_pool_t *dp, dmu_tx_t *tx) return; /* + * zfs_scan_suspend_progress can be set to disable scan progress. + * We don't want to spin the txg_sync thread, so we add a delay + * here to simulate the time spent doing a scan. This is mostly + * useful for testing and debugging. + */ + if (zfs_scan_suspend_progress) { + uint64_t scan_time_ns = gethrtime() - scn->scn_sync_start_time; + int mintime = (scn->scn_phys.scn_func == POOL_SCAN_RESILVER) ? + zfs_resilver_min_time_ms : zfs_scrub_min_time_ms; + + while (zfs_scan_suspend_progress && + !txg_sync_waiting(scn->scn_dp) && + !spa_shutting_down(scn->scn_dp->dp_spa) && + NSEC2MSEC(scan_time_ns) < mintime) { + delay(hz); + scan_time_ns = gethrtime() - scn->scn_sync_start_time; + } + return; + } + + /* * It is possible to switch from unsorted to sorted at any time, * but afterwards the scan will remain sorted unless reloaded from * a checkpoint after a reboot. @@ -3393,6 +3527,8 @@ dsl_scan_sync(dsl_pool_t *dp, dmu_tx_t *tx) (longlong_t)tx->tx_txg); } } else if (scn->scn_is_sorted && scn->scn_bytes_pending != 0) { + ASSERT(scn->scn_clearing); + /* need to issue scrubbing IOs from per-vdev queues */ scn->scn_zio_root = zio_root(dp->dp_spa, NULL, NULL, ZIO_FLAG_CANFAIL); Modified: vendor-sys/illumos/dist/uts/common/fs/zfs/spa.c ============================================================================== --- vendor-sys/illumos/dist/uts/common/fs/zfs/spa.c Thu Nov 21 14:09:46 2019 (r354960) +++ vendor-sys/illumos/dist/uts/common/fs/zfs/spa.c Thu Nov 21 14:10:53 2019 (r354961) @@ -6176,9 +6176,14 @@ spa_vdev_attach(spa_t *spa, uint64_t guid, nvlist_t *n /* * Schedule the resilver to restart in the future. We do this to * ensure that dmu_sync-ed blocks have been stitched into the - * respective datasets. + * respective datasets. We do not do this if resilvers have been + * deferred. */ - dsl_resilver_restart(spa->spa_dsl_pool, dtl_max_txg); + if (dsl_scan_resilvering(spa_get_dsl(spa)) && + spa_feature_is_enabled(spa, SPA_FEATURE_RESILVER_DEFER)) + vdev_set_deferred_resilver(spa, newvd); + else + dsl_resilver_restart(spa->spa_dsl_pool, dtl_max_txg); if (spa->spa_bootfs) spa_event_notify(spa, newvd, NULL, ESC_ZFS_BOOTFS_VDEV_ATTACH); @@ -7069,6 +7074,10 @@ spa_scan(spa_t *spa, pool_scan_func_t func) if (func >= POOL_SCAN_FUNCS || func == POOL_SCAN_NONE) return (SET_ERROR(ENOTSUP)); + if (func == POOL_SCAN_RESILVER && + !spa_feature_is_enabled(spa, SPA_FEATURE_RESILVER_DEFER)) + return (SET_ERROR(ENOTSUP)); + /* * If a resilver was requested, but there is no DTL on a * writeable leaf device, we have nothing to do. @@ -7160,6 +7169,7 @@ static void spa_async_thread(void *arg) { spa_t *spa = (spa_t *)arg; + dsl_pool_t *dp = spa->spa_dsl_pool; int tasks; ASSERT(spa->spa_sync_on); @@ -7235,8 +7245,10 @@ spa_async_thread(void *arg) /* * Kick off a resilver. */ - if (tasks & SPA_ASYNC_RESILVER) - dsl_resilver_restart(spa->spa_dsl_pool, 0); + if (tasks & SPA_ASYNC_RESILVER && + (!dsl_scan_resilvering(dp) || + !spa_feature_is_enabled(dp->dp_spa, SPA_FEATURE_RESILVER_DEFER))) + dsl_resilver_restart(dp, 0); if (tasks & SPA_ASYNC_INITIALIZE_RESTART) { mutex_enter(&spa_namespace_lock); Modified: vendor-sys/illumos/dist/uts/common/fs/zfs/sys/spa_impl.h ============================================================================== --- vendor-sys/illumos/dist/uts/common/fs/zfs/sys/spa_impl.h Thu Nov 21 14:09:46 2019 (r354960) +++ vendor-sys/illumos/dist/uts/common/fs/zfs/sys/spa_impl.h Thu Nov 21 14:10:53 2019 (r354961) @@ -279,6 +279,13 @@ struct spa { uint64_t spa_scan_pass_scrub_spent_paused; /* total paused */ uint64_t spa_scan_pass_exam; /* examined bytes per pass */ uint64_t spa_scan_pass_issued; /* issued bytes per pass */ + + /* + * We are in the middle of a resilver, and another resilver + * is needed once this one completes. This is set iff any + * vdev_resilver_deferred is set. + */ + boolean_t spa_resilver_deferred; kmutex_t spa_async_lock; /* protect async state */ kthread_t *spa_async_thread; /* thread doing async task */ int spa_async_suspended; /* async tasks suspended */ Modified: vendor-sys/illumos/dist/uts/common/fs/zfs/sys/vdev.h ============================================================================== --- vendor-sys/illumos/dist/uts/common/fs/zfs/sys/vdev.h Thu Nov 21 14:09:46 2019 (r354960) +++ vendor-sys/illumos/dist/uts/common/fs/zfs/sys/vdev.h Thu Nov 21 14:10:53 2019 (r354961) @@ -149,6 +149,8 @@ extern int vdev_config_sync(vdev_t **svd, int svdcount extern void vdev_state_dirty(vdev_t *vd); extern void vdev_state_clean(vdev_t *vd); +extern void vdev_set_deferred_resilver(spa_t *spa, vdev_t *vd); + typedef enum vdev_config_flag { VDEV_CONFIG_SPARE = 1 << 0, VDEV_CONFIG_L2CACHE = 1 << 1, Modified: vendor-sys/illumos/dist/uts/common/fs/zfs/sys/vdev_impl.h ============================================================================== --- vendor-sys/illumos/dist/uts/common/fs/zfs/sys/vdev_impl.h Thu Nov 21 14:09:46 2019 (r354960) +++ vendor-sys/illumos/dist/uts/common/fs/zfs/sys/vdev_impl.h Thu Nov 21 14:10:53 2019 (r354961) @@ -346,6 +346,7 @@ struct vdev { boolean_t vdev_cant_write; /* vdev is failing all writes */ boolean_t vdev_isspare; /* was a hot spare */ boolean_t vdev_isl2cache; /* was a l2cache device */ + boolean_t vdev_resilver_deferred; /* resilver deferred */ vdev_queue_t vdev_queue; /* I/O deadline schedule queue */ vdev_cache_t vdev_cache; /* physical block cache */ spa_aux_vdev_t *vdev_aux; /* for l2cache and spares vdevs */ Modified: vendor-sys/illumos/dist/uts/common/fs/zfs/vdev.c ============================================================================== --- vendor-sys/illumos/dist/uts/common/fs/zfs/vdev.c Thu Nov 21 14:09:46 2019 (r354960) +++ vendor-sys/illumos/dist/uts/common/fs/zfs/vdev.c Thu Nov 21 14:10:53 2019 (r354961) @@ -760,6 +760,9 @@ vdev_alloc(spa_t *spa, vdev_t **vdp, nvlist_t *nv, vde (void) nvlist_lookup_uint64(nv, ZPOOL_CONFIG_RESILVER_TXG, &vd->vdev_resilver_txg); + if (nvlist_exists(nv, ZPOOL_CONFIG_RESILVER_DEFER)) + vdev_set_deferred_resilver(spa, vd); + /* * When importing a pool, we want to ignore the persistent fault * state, as the diagnosis made on another system may not be @@ -1733,8 +1736,13 @@ vdev_open(vdev_t *vd) * since this would just restart the scrub we are already doing. */ if (vd->vdev_ops->vdev_op_leaf && !spa->spa_scrub_reopen && - vdev_resilver_needed(vd, NULL, NULL)) - spa_async_request(spa, SPA_ASYNC_RESILVER); + vdev_resilver_needed(vd, NULL, NULL)) { + if (dsl_scan_resilvering(spa->spa_dsl_pool) && + spa_feature_is_enabled(spa, SPA_FEATURE_RESILVER_DEFER)) + vdev_set_deferred_resilver(spa, vd); + else + spa_async_request(spa, SPA_ASYNC_RESILVER); + } return (0); } @@ -2441,6 +2449,9 @@ vdev_dtl_should_excise(vdev_t *vd) if (vd->vdev_state < VDEV_STATE_DEGRADED) return (B_FALSE); + if (vd->vdev_resilver_deferred) + return (B_FALSE); + if (vd->vdev_resilver_txg == 0 || range_tree_is_empty(vd->vdev_dtl[DTL_MISSING])) return (B_TRUE); @@ -3474,8 +3485,14 @@ vdev_clear(spa_t *spa, vdev_t *vd) if (vd != rvd && vdev_writeable(vd->vdev_top)) vdev_state_dirty(vd->vdev_top); - if (vd->vdev_aux == NULL && !vdev_is_dead(vd)) - spa_async_request(spa, SPA_ASYNC_RESILVER); + if (vd->vdev_aux == NULL && !vdev_is_dead(vd)) { + if (dsl_scan_resilvering(spa->spa_dsl_pool) && + spa_feature_is_enabled(spa, + SPA_FEATURE_RESILVER_DEFER)) + vdev_set_deferred_resilver(spa, vd); + else + spa_async_request(spa, SPA_ASYNC_RESILVER); + } spa_event_notify(spa, vd, NULL, ESC_ZFS_VDEV_CLEAR); } @@ -3618,6 +3635,8 @@ vdev_get_stats(vdev_t *vd, vdev_stat_t *vs) vs->vs_fragmentation = (vd->vdev_mg != NULL) ? vd->vdev_mg->mg_fragmentation : 0; } + if (vd->vdev_ops->vdev_op_leaf) + vs->vs_resilver_deferred = vd->vdev_resilver_deferred; /* * If we're getting stats on the root vdev, aggregate the I/O counts @@ -4330,4 +4349,19 @@ vdev_deadman(vdev_t *vd) } mutex_exit(&vq->vq_lock); } +} + +void +vdev_set_deferred_resilver(spa_t *spa, vdev_t *vd) +{ + for (uint64_t i = 0; i < vd->vdev_children; i++) + vdev_set_deferred_resilver(spa, vd->vdev_child[i]); + + if (!vd->vdev_ops->vdev_op_leaf || !vdev_writeable(vd) || + range_tree_is_empty(vd->vdev_dtl[DTL_MISSING])) { + return; + } + + vd->vdev_resilver_deferred = B_TRUE; + spa->spa_resilver_deferred = B_TRUE; } Modified: vendor-sys/illumos/dist/uts/common/fs/zfs/vdev_indirect.c ============================================================================== --- vendor-sys/illumos/dist/uts/common/fs/zfs/vdev_indirect.c Thu Nov 21 14:09:46 2019 (r354960) +++ vendor-sys/illumos/dist/uts/common/fs/zfs/vdev_indirect.c Thu Nov 21 14:10:53 2019 (r354961) @@ -1239,6 +1239,8 @@ vdev_indirect_read_all(zio_t *zio) { indirect_vsd_t *iv = zio->io_vsd; + ASSERT3U(zio->io_type, ==, ZIO_TYPE_READ); + for (indirect_split_t *is = list_head(&iv->iv_splits); is != NULL; is = list_next(&iv->iv_splits, is)) { for (int i = 0; i < is->is_children; i++) { @@ -1321,7 +1323,8 @@ vdev_indirect_io_start(zio_t *zio) vdev_indirect_child_io_done, zio)); } else { iv->iv_split_block = B_TRUE; - if (zio->io_flags & (ZIO_FLAG_SCRUB | ZIO_FLAG_RESILVER)) { + if (zio->io_type == ZIO_TYPE_READ && + zio->io_flags & (ZIO_FLAG_SCRUB | ZIO_FLAG_RESILVER)) { /* * Read all copies. Note that for simplicity, * we don't bother consulting the DTL in the @@ -1330,13 +1333,17 @@ vdev_indirect_io_start(zio_t *zio) vdev_indirect_read_all(zio); } else { /* - * Read one copy of each split segment, from the - * top-level vdev. Since we don't know the - * checksum of each split individually, the child - * zio can't ensure that we get the right data. - * E.g. if it's a mirror, it will just read from a - * random (healthy) leaf vdev. We have to verify - * the checksum in vdev_indirect_io_done(). + * If this is a read zio, we read one copy of each + * split segment, from the top-level vdev. Since + * we don't know the checksum of each split + * individually, the child zio can't ensure that + * we get the right data. E.g. if it's a mirror, + * it will just read from a random (healthy) leaf + * vdev. We have to verify the checksum in + * vdev_indirect_io_done(). + * + * For write zios, the vdev code will ensure we write + * to all children. */ for (indirect_split_t *is = list_head(&iv->iv_splits); is != NULL; is = list_next(&iv->iv_splits, is)) { Modified: vendor-sys/illumos/dist/uts/common/fs/zfs/vdev_label.c ============================================================================== --- vendor-sys/illumos/dist/uts/common/fs/zfs/vdev_label.c Thu Nov 21 14:09:46 2019 (r354960) +++ vendor-sys/illumos/dist/uts/common/fs/zfs/vdev_label.c Thu Nov 21 14:10:53 2019 (r354961) @@ -377,6 +377,12 @@ vdev_config_generate(spa_t *spa, vdev_t *vd, boolean_t fnvlist_add_uint64(nv, ZPOOL_CONFIG_VDEV_TOP_ZAP, vd->vdev_top_zap); } + + if (vd->vdev_resilver_deferred) { + ASSERT(vd->vdev_ops->vdev_op_leaf); + ASSERT(spa->spa_resilver_deferred); + fnvlist_add_boolean(nv, ZPOOL_CONFIG_RESILVER_DEFER); + } } if (getstats) { Modified: vendor-sys/illumos/dist/uts/common/fs/zfs/vdev_removal.c ============================================================================== --- vendor-sys/illumos/dist/uts/common/fs/zfs/vdev_removal.c Thu Nov 21 14:09:46 2019 (r354960) +++ vendor-sys/illumos/dist/uts/common/fs/zfs/vdev_removal.c Thu Nov 21 14:10:53 2019 (r354961) @@ -127,7 +127,7 @@ int vdev_removal_max_span = 32 * 1024; * This is used by the test suite so that it can ensure that certain * actions happen while in the middle of a removal. */ -uint64_t zfs_remove_max_bytes_pause = UINT64_MAX; +int zfs_removal_suspend_progress = 0; #define VDEV_REMOVAL_ZAP_OBJS "lzap" @@ -1433,14 +1433,14 @@ spa_vdev_remove_thread(void *arg) /* * This delay will pause the removal around the point - * specified by zfs_remove_max_bytes_pause. We do this + * specified by zfs_removal_suspend_progress. We do this * solely from the test suite or during debugging. */ uint64_t bytes_copied = spa->spa_removing_phys.sr_copied; for (int i = 0; i < TXG_SIZE; i++) bytes_copied += svr->svr_bytes_done[i]; - while (zfs_remove_max_bytes_pause <= bytes_copied && + while (zfs_removal_suspend_progress && !svr->svr_thread_exit) delay(hz); Modified: vendor-sys/illumos/dist/uts/common/fs/zfs/zil.c ============================================================================== --- vendor-sys/illumos/dist/uts/common/fs/zfs/zil.c Thu Nov 21 14:09:46 2019 (r354960) +++ vendor-sys/illumos/dist/uts/common/fs/zfs/zil.c Thu Nov 21 14:10:53 2019 (r354961) @@ -1252,7 +1252,7 @@ zil_lwb_set_zio_dependency(zilog_t *zilog, lwb_t *lwb) * root zios). This is required because of how we can * defer the DKIOCFLUSHWRITECACHE commands for each lwb. * - * When the DKIOCFLUSHWRITECACHE commands are defered, + * When the DKIOCFLUSHWRITECACHE commands are deferred, * the previous lwb will rely on this lwb to flush the * vdevs written to by that previous lwb. Thus, we need * to ensure this lwb doesn't issue the flush until Modified: vendor-sys/illumos/dist/uts/common/sys/fs/zfs.h ============================================================================== --- vendor-sys/illumos/dist/uts/common/sys/fs/zfs.h Thu Nov 21 14:09:46 2019 (r354960) +++ vendor-sys/illumos/dist/uts/common/sys/fs/zfs.h Thu Nov 21 14:10:53 2019 (r354961) @@ -597,6 +597,7 @@ typedef struct zpool_load_policy { #define ZPOOL_CONFIG_VDEV_TOP_ZAP "com.delphix:vdev_zap_top" #define ZPOOL_CONFIG_VDEV_LEAF_ZAP "com.delphix:vdev_zap_leaf" #define ZPOOL_CONFIG_HAS_PER_VDEV_ZAPS "com.delphix:has_per_vdev_zaps" +#define ZPOOL_CONFIG_RESILVER_DEFER "com.datto:resilver_defer" #define ZPOOL_CONFIG_CACHEFILE "cachefile" /* not stored on disk */ #define ZPOOL_CONFIG_MMP_STATE "mmp_state" /* not stored on disk */ #define ZPOOL_CONFIG_MMP_TXG "mmp_txg" /* not stored on disk */ @@ -896,6 +897,7 @@ typedef struct vdev_stat { uint64_t vs_initialize_state; /* vdev_initialzing_state_t */ uint64_t vs_initialize_action_time; /* time_t */ uint64_t vs_checkpoint_space; /* checkpoint-consumed space */ + uint64_t vs_resilver_deferred; /* resilver deferred */ } vdev_stat_t; /* From owner-svn-src-all@freebsd.org Thu Nov 21 14:14:08 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id EFC801C04C5; Thu, 21 Nov 2019 14:14:08 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47JhPr623Lz4Sqs; Thu, 21 Nov 2019 14:14:08 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id B1BADC7E8; Thu, 21 Nov 2019 14:14:08 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xALEE81Z053469; Thu, 21 Nov 2019 14:14:08 GMT (envelope-from avg@FreeBSD.org) Received: (from avg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xALEE8hY053468; Thu, 21 Nov 2019 14:14:08 GMT (envelope-from avg@FreeBSD.org) Message-Id: <201911211414.xALEE8hY053468@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avg set sender to avg@FreeBSD.org using -f From: Andriy Gapon Date: Thu, 21 Nov 2019 14:14:08 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-vendor@freebsd.org Subject: svn commit: r354962 - vendor-sys/illumos/dist/uts/common/fs/zfs X-SVN-Group: vendor-sys X-SVN-Commit-Author: avg X-SVN-Commit-Paths: vendor-sys/illumos/dist/uts/common/fs/zfs X-SVN-Commit-Revision: 354962 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 21 Nov 2019 14:14:09 -0000 Author: avg Date: Thu Nov 21 14:14:08 2019 New Revision: 354962 URL: https://svnweb.freebsd.org/changeset/base/354962 Log: disabled resilver_defer feature leads to looping resilvers illumos/illumos-gate@233f6c49954dadfb21fa0809febd15e2160e0ff5 https://github.com/illumos/illumos-gate/commit/233f6c49954dadfb21fa0809febd15e2160e0ff5 Note: unusually for illumos this commit does not have a bug ID. Author: Kody Kantor Modified: vendor-sys/illumos/dist/uts/common/fs/zfs/dsl_scan.c Modified: vendor-sys/illumos/dist/uts/common/fs/zfs/dsl_scan.c ============================================================================== --- vendor-sys/illumos/dist/uts/common/fs/zfs/dsl_scan.c Thu Nov 21 14:10:53 2019 (r354961) +++ vendor-sys/illumos/dist/uts/common/fs/zfs/dsl_scan.c Thu Nov 21 14:14:08 2019 (r354962) @@ -23,7 +23,7 @@ * Copyright (c) 2011, 2018 by Delphix. All rights reserved. * Copyright 2016 Gary Mills * Copyright (c) 2011, 2017 by Delphix. All rights reserved. - * Copyright 2017 Joyent, Inc. + * Copyright 2019 Joyent, Inc. * Copyright (c) 2017 Datto Inc. */ @@ -920,13 +920,15 @@ dsl_scan_done(dsl_scan_t *scn, boolean_t complete, dmu * will find the drives that need to be resilvered * when the machine reboots and start the resilver then. */ - boolean_t resilver_needed = - dsl_scan_clear_deferred(spa->spa_root_vdev, tx); - if (resilver_needed) { - spa_history_log_internal(spa, - "starting deferred resilver", tx, - "errors=%llu", spa_get_errlog_size(spa)); - spa_async_request(spa, SPA_ASYNC_RESILVER); + if (spa_feature_is_enabled(spa, SPA_FEATURE_RESILVER_DEFER)) { + boolean_t resilver_needed = + dsl_scan_clear_deferred(spa->spa_root_vdev, tx); + if (resilver_needed) { + spa_history_log_internal(spa, + "starting deferred resilver", tx, + "errors=%llu", spa_get_errlog_size(spa)); + spa_async_request(spa, SPA_ASYNC_RESILVER); + } } } From owner-svn-src-all@freebsd.org Thu Nov 21 14:23:17 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 750DB1C094E; Thu, 21 Nov 2019 14:23:17 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47JhcP2WMmz4TN5; Thu, 21 Nov 2019 14:23:17 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 3990DC9A6; Thu, 21 Nov 2019 14:23:17 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xALENHbL059605; Thu, 21 Nov 2019 14:23:17 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xALENHfL059604; Thu, 21 Nov 2019 14:23:17 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201911211423.xALENHfL059604@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Thu, 21 Nov 2019 14:23:17 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354963 - head/share/man/man7 X-SVN-Group: head X-SVN-Commit-Author: emaste X-SVN-Commit-Paths: head/share/man/man7 X-SVN-Commit-Revision: 354963 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 21 Nov 2019 14:23:17 -0000 Author: emaste Date: Thu Nov 21 14:23:16 2019 New Revision: 354963 URL: https://svnweb.freebsd.org/changeset/base/354963 Log: arch.7: document only FreeBSD 11.0 and later FreeBSD 11 is the earliest supported version and there is no longer a need to include information about differences present in earlier releases. Modified: head/share/man/man7/arch.7 Modified: head/share/man/man7/arch.7 ============================================================================== --- head/share/man/man7/arch.7 Thu Nov 21 14:14:08 2019 (r354962) +++ head/share/man/man7/arch.7 Thu Nov 21 14:23:16 2019 (r354963) @@ -44,7 +44,7 @@ documentation. .Pp If not explicitly mentioned, sizes are in bytes. The architecture details in this document apply to -.Fx 10.0 +.Fx 11.0 and later, unless otherwise noted. .Pp .Fx @@ -274,8 +274,8 @@ is 8 bytes on all supported architectures except i386. .It aarch64 Ta hard Ta soft, quad precision .It amd64 Ta hard Ta hard, 80 bit .It arm Ta soft Ta soft, double precision -.It armv6 Ta hard(1) Ta hard, double precision -.It armv7 Ta hard(1) Ta hard, double precision +.It armv6 Ta hard Ta hard, double precision +.It armv7 Ta hard Ta hard, double precision .It i386 Ta hard Ta hard, 80 bit .It mips Ta soft Ta identical to double .It mipsel Ta soft Ta identical to double @@ -293,11 +293,6 @@ is 8 bytes on all supported architectures except i386. .It riscv64sf Ta soft Ta soft, double precision .It sparc64 Ta hard Ta hard, quad precision .El -.Pp -(1) Prior to -.Fx 11.0 , -armv6 used the softfp ABI even though it supported only processors -with a floating point unit. .Ss Default Tool Chain .Fx uses a variety of tool chain components for the supported CPU architectures: From owner-svn-src-all@freebsd.org Thu Nov 21 14:25:26 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 621F61C0A0C; Thu, 21 Nov 2019 14:25:26 +0000 (UTC) (envelope-from carpeddiem@gmail.com) Received: from mail-il1-f173.google.com (mail-il1-f173.google.com [209.85.166.173]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47Jhft1tXdz4TWC; Thu, 21 Nov 2019 14:25:25 +0000 (UTC) (envelope-from carpeddiem@gmail.com) Received: by mail-il1-f173.google.com with SMTP id a7so3426529ild.6; Thu, 21 Nov 2019 06:25:25 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=gVa6iL/n4c8hUiPCE71YIkwIS3qcojxwmJGmge1HyCA=; b=YLZsv1eGcjLpHRVKCSCPB2ZRn+FK1/amxJg49dYHIpDRzTr3lmvbu1YuzBDxYcYgHV AMl35WyysOvvxe3KaLc2RbP+9KDxcdMdORc0m5thCt6kNEedzxWIAU80+vOlaCVdtW4y GxhtlDXChscmyhd9GUweuXFXuIXt7z+/YyPSV/CeHhFo1mLQDl60eNi4ArlwdkC0lYdp 91YODn8D4ZMV4jJH/IplovbUzC5h0YxAFbugbKfGVmqiPwjxMpfWGFJk65n8vXxxD9o8 aw2hdixJd1pdlUsjC2XAMjX97UEpIcLC8NkDPzr0Koo++Jyouh2wQ4zKXoeSjIncK9qU /7ng== X-Gm-Message-State: APjAAAUHZ4V0RfT8RrBH3kL5ACCY66vrN6iokNApI43cy1qqCFk+yHa5 FExqUnrUDZlqrdKfLC5Nq9YKD9Pl8L3DPigs1CBqdA== X-Google-Smtp-Source: APXvYqymKdohp6ngTdzyKeyfWN7MoeyilyC39Qsy6Dnw5cBc2jATOew0Eb5MbJx3Cypagw8mIIe7fpPHJUrCf95BhJY= X-Received: by 2002:a92:1d52:: with SMTP id d79mr10186798ild.185.1574346324281; Thu, 21 Nov 2019 06:25:24 -0800 (PST) MIME-Version: 1.0 References: <201911210644.xAL6iJPW087732@repo.freebsd.org> In-Reply-To: <201911210644.xAL6iJPW087732@repo.freebsd.org> From: Ed Maste Date: Thu, 21 Nov 2019 05:38:45 -0500 Message-ID: Subject: Re: svn commit: r354936 - head/share/man/man7 To: Warner Losh Cc: src-committers , svn-src-all , svn-src-head Content-Type: text/plain; charset="UTF-8" X-Rspamd-Queue-Id: 47Jhft1tXdz4TWC X-Spamd-Bar: ----- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-6.00 / 15.00]; NEURAL_HAM_MEDIUM(-1.00)[-0.998,0]; NEURAL_HAM_LONG(-1.00)[-0.999,0]; REPLY(-4.00)[] X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 21 Nov 2019 14:25:26 -0000 On Thu, 21 Nov 2019 at 01:44, Warner Losh wrote: > > Author: imp > Date: Thu Nov 21 06:44:19 2019 > New Revision: 354936 > URL: https://svnweb.freebsd.org/changeset/base/354936 > > Log: > Add table for MACHINE_CPUARCH > > Add table and also some additional verbage of which one to use. This really belongs near the descriptions of MACHINE / MACHINE_ARCH / MACHINE_CPUARCH in arch.7; I'll move it in a bit. From owner-svn-src-all@freebsd.org Thu Nov 21 14:54:21 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 9D8891C168A; Thu, 21 Nov 2019 14:54:21 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47JjJF3b9Yz4VxG; Thu, 21 Nov 2019 14:54:21 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 5E67FCF13; Thu, 21 Nov 2019 14:54:21 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xALEsLBC077203; Thu, 21 Nov 2019 14:54:21 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xALEsKxd077199; Thu, 21 Nov 2019 14:54:20 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201911211454.xALEsKxd077199@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Thu, 21 Nov 2019 14:54:20 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r354964 - stable/12/sys/dev/aacraid X-SVN-Group: stable-12 X-SVN-Commit-Author: emaste X-SVN-Commit-Paths: stable/12/sys/dev/aacraid X-SVN-Commit-Revision: 354964 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 21 Nov 2019 14:54:21 -0000 Author: emaste Date: Thu Nov 21 14:54:20 2019 New Revision: 354964 URL: https://svnweb.freebsd.org/changeset/base/354964 Log: MFC r348091 by sobomax: update aacraid driver to 3.2.10 PR: 209468 Modified: stable/12/sys/dev/aacraid/aacraid.c stable/12/sys/dev/aacraid/aacraid_cam.c stable/12/sys/dev/aacraid/aacraid_reg.h stable/12/sys/dev/aacraid/aacraid_var.h Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/dev/aacraid/aacraid.c ============================================================================== --- stable/12/sys/dev/aacraid/aacraid.c Thu Nov 21 14:23:16 2019 (r354963) +++ stable/12/sys/dev/aacraid/aacraid.c Thu Nov 21 14:54:20 2019 (r354964) @@ -264,7 +264,7 @@ aacraid_attach(struct aac_softc *sc) /* * Check that the firmware on the card is supported. */ - sc->msi_enabled = FALSE; + sc->msi_enabled = sc->msi_tupelo = FALSE; if ((error = aac_check_firmware(sc)) != 0) return(error); @@ -284,8 +284,8 @@ aacraid_attach(struct aac_softc *sc) */ if ((error = aac_alloc(sc)) != 0) return(error); + aac_define_int_mode(sc); if (!(sc->flags & AAC_FLAGS_SYNC_MODE)) { - aac_define_int_mode(sc); if ((error = aac_init(sc)) != 0) return(error); } @@ -728,7 +728,7 @@ aacraid_free(struct aac_softc *sc) else break; } - if (sc->msi_enabled) + if (sc->msi_enabled || sc->msi_tupelo) pci_release_msi(sc->aac_dev); /* destroy data-transfer DMA tag */ @@ -1316,6 +1316,9 @@ aacraid_map_command_sg(void *arg, bus_dma_segment_t *s fwprintf(sc, HBA_FLAGS_DBG_FUNCTION_ENTRY_B, "nseg %d", nseg); mtx_assert(&sc->aac_io_lock, MA_OWNED); + if ((sc->flags & AAC_FLAGS_SYNC_MODE) && sc->aac_sync_cm) + return; + /* copy into the FIB */ if (cm->cm_sgtable != NULL) { if (fib->Header.Command == RawIo2) { @@ -1433,11 +1436,14 @@ aacraid_map_command_sg(void *arg, bus_dma_segment_t *s cm->cm_flags |= AAC_CMD_MAPPED; - if (sc->flags & AAC_FLAGS_SYNC_MODE) { + if (cm->cm_flags & AAC_CMD_WAIT) { + aacraid_sync_command(sc, AAC_MONKER_SYNCFIB, + cm->cm_fibphys, 0, 0, 0, NULL, NULL); + } else if (sc->flags & AAC_FLAGS_SYNC_MODE) { u_int32_t wait = 0; - aacraid_sync_command(sc, AAC_MONKER_SYNCFIB, cm->cm_fibphys, 0, 0, 0, &wait, NULL); - } else if (cm->cm_flags & AAC_CMD_WAIT) { - aacraid_sync_command(sc, AAC_MONKER_SYNCFIB, cm->cm_fibphys, 0, 0, 0, NULL, NULL); + sc->aac_sync_cm = cm; + aacraid_sync_command(sc, AAC_MONKER_SYNCFIB, + cm->cm_fibphys, 0, 0, 0, &wait, NULL); } else { int count = 10000000L; while (AAC_SEND_COMMAND(sc, cm) != 0) { @@ -1617,6 +1623,7 @@ aac_check_firmware(struct aac_softc *sc) options = AAC_GET_MAILBOX(sc, 1); atu_size = AAC_GET_MAILBOX(sc, 2); sc->supported_options = options; + sc->doorbell_mask = AAC_GET_MAILBOX(sc, 3); if ((options & AAC_SUPPORTED_4GB_WINDOW) != 0 && (sc->flags & AAC_FLAGS_NO4GB) == 0) @@ -1631,13 +1638,13 @@ aac_check_firmware(struct aac_softc *sc) sc->flags |= AAC_FLAGS_SG_64BIT; } if (sc->aac_if.aif_send_command) { - if ((options & AAC_SUPPORTED_NEW_COMM_TYPE3) || - (options & AAC_SUPPORTED_NEW_COMM_TYPE4)) - sc->flags |= AAC_FLAGS_NEW_COMM | AAC_FLAGS_NEW_COMM_TYPE34; + if (options & AAC_SUPPORTED_NEW_COMM_TYPE2) + sc->flags |= AAC_FLAGS_NEW_COMM | AAC_FLAGS_NEW_COMM_TYPE2; else if (options & AAC_SUPPORTED_NEW_COMM_TYPE1) sc->flags |= AAC_FLAGS_NEW_COMM | AAC_FLAGS_NEW_COMM_TYPE1; - else if (options & AAC_SUPPORTED_NEW_COMM_TYPE2) - sc->flags |= AAC_FLAGS_NEW_COMM | AAC_FLAGS_NEW_COMM_TYPE2; + else if ((options & AAC_SUPPORTED_NEW_COMM_TYPE3) || + (options & AAC_SUPPORTED_NEW_COMM_TYPE4)) + sc->flags |= AAC_FLAGS_NEW_COMM | AAC_FLAGS_NEW_COMM_TYPE34; } if (options & AAC_SUPPORTED_64BIT_ARRAYSIZE) sc->flags |= AAC_FLAGS_ARRAY_64BIT; @@ -1851,8 +1858,30 @@ aac_define_int_mode(struct aac_softc *sc) dev = sc->aac_dev; + if (sc->flags & AAC_FLAGS_SYNC_MODE) { + device_printf(dev, "using line interrupts\n"); + sc->aac_max_msix = 1; + sc->aac_vector_cap = sc->aac_max_fibs; + return; + } + /* max. vectors from AAC_MONKER_GETCOMMPREF */ if (sc->aac_max_msix == 0) { + if (sc->aac_hwif == AAC_HWIF_SRC) { + msi_count = 1; + if ((error = pci_alloc_msi(dev, &msi_count)) != 0) { + device_printf(dev, "alloc msi failed - err=%d; " + "will use INTx\n", error); + pci_release_msi(dev); + } else { + sc->msi_tupelo = TRUE; + } + } + if (sc->msi_tupelo) + device_printf(dev, "using MSI interrupts\n"); + else + device_printf(dev, "using line interrupts\n"); + sc->aac_max_msix = 1; sc->aac_vector_cap = sc->aac_max_fibs; return; @@ -1958,7 +1987,7 @@ aac_setup_intr(struct aac_softc *sc) void *tag; msi_count = sc->aac_max_msix; - rid = (sc->msi_enabled ? 1:0); + rid = ((sc->msi_enabled || sc->msi_tupelo)? 1:0); for (i = 0; i < msi_count; i++, rid++) { if ((res = bus_alloc_resource_any(sc->aac_dev,SYS_RES_IRQ, &rid, @@ -2854,14 +2883,14 @@ aac_ioctl_send_raw_srb(struct aac_softc *sc, caddr_t a fib = cm->cm_fib; srbcmd = (struct aac_srb *)fib->data; - if ((error = copyin((void *)&user_srb->data_len, &fibsize, - sizeof (u_int32_t)) != 0)) + if ((error = copyin((void *)&user_srb->data_len, &fibsize, + sizeof (u_int32_t))) != 0) goto out; if (fibsize > (sc->aac_max_fib_size-sizeof(struct aac_fib_header))) { error = EINVAL; goto out; } - if ((error = copyin((void *)user_srb, srbcmd, fibsize) != 0)) + if ((error = copyin((void *)user_srb, srbcmd, fibsize)) != 0) goto out; srbcmd->function = 0; /* SRBF_ExecuteScsi */ @@ -2895,13 +2924,10 @@ aac_ioctl_send_raw_srb(struct aac_softc *sc, caddr_t a srb_sg_bytecount = sg.SgByteCount; srb_sg_address = sg.SgAddress; - if (srb_sg_address > 0xffffffffull && - !(sc->flags & AAC_FLAGS_SG_64BIT)) -#endif - { - error = EINVAL; - goto out; - } +#else + error = EINVAL; + goto out; +#endif } else { error = EINVAL; goto out; @@ -3701,7 +3727,7 @@ aac_get_bus_info(struct aac_softc *sc) caminf->TargetsPerBus = businfo.TargetsPerBus; caminf->BusNumber = i+1; caminf->BusType = PASSTHROUGH_BUS; - caminf->InitiatorBusId = businfo.InitiatorBusId[i]; + caminf->InitiatorBusId = -1; caminf->aac_sc = sc; caminf->sim_dev = child; caminf->aac_cam = NULL; @@ -3745,7 +3771,7 @@ aac_reset_adapter(struct aac_softc *sc) struct aac_fib *fib; struct aac_pause_command *pc; u_int32_t status, reset_mask, waitCount, max_msix_orig; - int msi_enabled_orig; + int ret, msi_enabled_orig; fwprintf(sc, HBA_FLAGS_DBG_FUNCTION_ENTRY_B, ""); mtx_assert(&sc->aac_io_lock, MA_OWNED); @@ -3804,50 +3830,61 @@ aac_reset_adapter(struct aac_softc *sc) AAC_MEM0_SETREG4(sc, AAC_IRCSR, AAC_IRCSR_CORES_RST); /* We need to wait for 5 seconds before accessing the MU again - * 10000 * 100us = 1000,000us = 1000ms = 1s + * 10000 * 100us = 1000,000us = 1000ms = 1s */ waitCount = 5 * 10000; while (waitCount) { DELAY(100); /* delay 100 microseconds */ waitCount--; } - } else if ((aacraid_sync_command(sc, - AAC_IOP_RESET_ALWAYS, 0, 0, 0, 0, &status, &reset_mask)) != 0) { - /* call IOP_RESET for older firmware */ - if ((aacraid_sync_command(sc, - AAC_IOP_RESET, 0, 0, 0, 0, &status, NULL)) != 0) { + } else { + ret = aacraid_sync_command(sc, AAC_IOP_RESET_ALWAYS, + 0, 0, 0, 0, &status, &reset_mask); + if (ret && !sc->doorbell_mask) { + /* call IOP_RESET for older firmware */ + if ((aacraid_sync_command(sc, AAC_IOP_RESET, 0,0,0,0, + &status, NULL)) != 0) { + if (status == AAC_SRB_STS_INVALID_REQUEST) { + device_printf(sc->aac_dev, + "IOP_RESET not supported\n"); + } else { + /* probably timeout */ + device_printf(sc->aac_dev, + "IOP_RESET failed\n"); + } - if (status == AAC_SRB_STS_INVALID_REQUEST) - device_printf(sc->aac_dev, "IOP_RESET not supported\n"); - else - /* probably timeout */ - device_printf(sc->aac_dev, "IOP_RESET failed\n"); + /* unwind aac_shutdown() */ + aac_alloc_sync_fib(sc, &fib); + pc = (struct aac_pause_command *)&fib->data[0]; + pc->Command = VM_ContainerConfig; + pc->Type = CT_PAUSE_IO; + pc->Timeout = 1; + pc->Min = 1; + pc->NoRescan = 1; - /* unwind aac_shutdown() */ - aac_alloc_sync_fib(sc, &fib); - pc = (struct aac_pause_command *)&fib->data[0]; - pc->Command = VM_ContainerConfig; - pc->Type = CT_PAUSE_IO; - pc->Timeout = 1; - pc->Min = 1; - pc->NoRescan = 1; + (void) aac_sync_fib(sc, ContainerCommand, 0, + fib, sizeof (struct aac_pause_command)); + aac_release_sync_fib(sc); - (void) aac_sync_fib(sc, ContainerCommand, 0, fib, - sizeof (struct aac_pause_command)); - aac_release_sync_fib(sc); - - goto finish; + goto finish; + } + } else if (sc->doorbell_mask) { + ret = 0; + reset_mask = sc->doorbell_mask; } - } else if (sc->aac_support_opt2 & AAC_SUPPORTED_DOORBELL_RESET) { - AAC_MEM0_SETREG4(sc, AAC_SRC_IDBR, reset_mask); - /* - * We need to wait for 5 seconds before accessing the doorbell - * again, 10000 * 100us = 1000,000us = 1000ms = 1s - */ - waitCount = 5 * 10000; - while (waitCount) { - DELAY(100); /* delay 100 microseconds */ - waitCount--; + if (!ret && + (sc->aac_support_opt2 & AAC_SUPPORTED_DOORBELL_RESET)) { + AAC_MEM0_SETREG4(sc, AAC_SRC_IDBR, reset_mask); + /* + * We need to wait for 5 seconds before accessing the + * doorbell again; + * 10000 * 100us = 1000,000us = 1000ms = 1s + */ + waitCount = 5 * 10000; + while (waitCount) { + DELAY(100); /* delay 100 microseconds */ + waitCount--; + } } } Modified: stable/12/sys/dev/aacraid/aacraid_cam.c ============================================================================== --- stable/12/sys/dev/aacraid/aacraid_cam.c Thu Nov 21 14:23:16 2019 (r354963) +++ stable/12/sys/dev/aacraid/aacraid_cam.c Thu Nov 21 14:54:20 2019 (r354964) @@ -1017,8 +1017,8 @@ aac_cam_action(struct cam_sim *sim, union ccb *ccb) cpi->version_num = 1; cpi->target_sprt = 0; cpi->hba_eng_cnt = 0; - cpi->max_target = camsc->inf->TargetsPerBus; - cpi->max_lun = 8; /* Per the controller spec */ + cpi->max_target = camsc->inf->TargetsPerBus - 1; + cpi->max_lun = 7; /* Per the controller spec */ cpi->initiator_id = camsc->inf->InitiatorBusId; cpi->bus_id = camsc->inf->BusNumber; #if __FreeBSD_version >= 800000 @@ -1389,15 +1389,9 @@ aacraid_startio(struct aac_softc *sc) * Try to get a command that's been put off for lack of * resources */ - if (sc->flags & AAC_FLAGS_SYNC_MODE) { - /* sync. transfer mode */ - if (sc->aac_sync_cm) - break; - cm = aac_dequeue_ready(sc); - sc->aac_sync_cm = cm; - } else { - cm = aac_dequeue_ready(sc); - } + if ((sc->flags & AAC_FLAGS_SYNC_MODE) && sc->aac_sync_cm) + break; + cm = aac_dequeue_ready(sc); /* nothing to do? */ if (cm == NULL) Modified: stable/12/sys/dev/aacraid/aacraid_reg.h ============================================================================== --- stable/12/sys/dev/aacraid/aacraid_reg.h Thu Nov 21 14:23:16 2019 (r354963) +++ stable/12/sys/dev/aacraid/aacraid_reg.h Thu Nov 21 14:54:20 2019 (r354964) @@ -42,7 +42,7 @@ /* * Misc. magic numbers. */ -#define AAC_MAX_CONTAINERS 64 +#define AAC_MAX_CONTAINERS 240 #define AAC_BLOCK_SIZE 512 /* Modified: stable/12/sys/dev/aacraid/aacraid_var.h ============================================================================== --- stable/12/sys/dev/aacraid/aacraid_var.h Thu Nov 21 14:23:16 2019 (r354963) +++ stable/12/sys/dev/aacraid/aacraid_var.h Thu Nov 21 14:54:20 2019 (r354964) @@ -49,7 +49,7 @@ #define AAC_DRIVER_MAJOR_VERSION 3 #define AAC_DRIVER_MINOR_VERSION 2 -#define AAC_DRIVER_BUGFIX_LEVEL 5 +#define AAC_DRIVER_BUGFIX_LEVEL 10 #define AAC_DRIVER_TYPE AAC_TYPE_RELEASE #ifndef AAC_DRIVER_BUILD @@ -481,9 +481,12 @@ struct aac_softc u_int32_t aac_feature_bits; /* feature bits from suppl. info */ u_int32_t aac_support_opt2; /* supp. options from suppl. info */ u_int32_t aac_max_aif; /* max. AIF count */ + u_int32_t doorbell_mask; /* for IOP reset */ u_int32_t aac_max_msix; /* max. MSI-X vectors */ u_int32_t aac_vector_cap; /* MSI-X vector capab.*/ int msi_enabled; /* MSI/MSI-X enabled */ + int msi_tupelo; /* Series 6 support for */ + /* single MSI interrupt */ #define AAC_CAM_TARGET_WILDCARD ~0 void (*cam_rescan_cb)(struct aac_softc *, uint32_t, uint32_t); From owner-svn-src-all@freebsd.org Thu Nov 21 14:55:28 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 5B4971C172B; Thu, 21 Nov 2019 14:55:28 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47JjKX1pchz4W5K; Thu, 21 Nov 2019 14:55:28 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 2281BCF29; Thu, 21 Nov 2019 14:55:28 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xALEtSCU077349; Thu, 21 Nov 2019 14:55:28 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xALEtRRN077346; Thu, 21 Nov 2019 14:55:27 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201911211455.xALEtRRN077346@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Thu, 21 Nov 2019 14:55:27 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r354965 - stable/11/sys/dev/aacraid X-SVN-Group: stable-11 X-SVN-Commit-Author: emaste X-SVN-Commit-Paths: stable/11/sys/dev/aacraid X-SVN-Commit-Revision: 354965 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 21 Nov 2019 14:55:28 -0000 Author: emaste Date: Thu Nov 21 14:55:27 2019 New Revision: 354965 URL: https://svnweb.freebsd.org/changeset/base/354965 Log: MFC r348091 by sobomax: update aacraid driver to 3.2.10 PR: 209468 Modified: stable/11/sys/dev/aacraid/aacraid.c stable/11/sys/dev/aacraid/aacraid_cam.c stable/11/sys/dev/aacraid/aacraid_reg.h stable/11/sys/dev/aacraid/aacraid_var.h Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/dev/aacraid/aacraid.c ============================================================================== --- stable/11/sys/dev/aacraid/aacraid.c Thu Nov 21 14:54:20 2019 (r354964) +++ stable/11/sys/dev/aacraid/aacraid.c Thu Nov 21 14:55:27 2019 (r354965) @@ -264,7 +264,7 @@ aacraid_attach(struct aac_softc *sc) /* * Check that the firmware on the card is supported. */ - sc->msi_enabled = FALSE; + sc->msi_enabled = sc->msi_tupelo = FALSE; if ((error = aac_check_firmware(sc)) != 0) return(error); @@ -284,8 +284,8 @@ aacraid_attach(struct aac_softc *sc) */ if ((error = aac_alloc(sc)) != 0) return(error); + aac_define_int_mode(sc); if (!(sc->flags & AAC_FLAGS_SYNC_MODE)) { - aac_define_int_mode(sc); if ((error = aac_init(sc)) != 0) return(error); } @@ -728,7 +728,7 @@ aacraid_free(struct aac_softc *sc) else break; } - if (sc->msi_enabled) + if (sc->msi_enabled || sc->msi_tupelo) pci_release_msi(sc->aac_dev); /* destroy data-transfer DMA tag */ @@ -1316,6 +1316,9 @@ aacraid_map_command_sg(void *arg, bus_dma_segment_t *s fwprintf(sc, HBA_FLAGS_DBG_FUNCTION_ENTRY_B, "nseg %d", nseg); mtx_assert(&sc->aac_io_lock, MA_OWNED); + if ((sc->flags & AAC_FLAGS_SYNC_MODE) && sc->aac_sync_cm) + return; + /* copy into the FIB */ if (cm->cm_sgtable != NULL) { if (fib->Header.Command == RawIo2) { @@ -1433,11 +1436,14 @@ aacraid_map_command_sg(void *arg, bus_dma_segment_t *s cm->cm_flags |= AAC_CMD_MAPPED; - if (sc->flags & AAC_FLAGS_SYNC_MODE) { + if (cm->cm_flags & AAC_CMD_WAIT) { + aacraid_sync_command(sc, AAC_MONKER_SYNCFIB, + cm->cm_fibphys, 0, 0, 0, NULL, NULL); + } else if (sc->flags & AAC_FLAGS_SYNC_MODE) { u_int32_t wait = 0; - aacraid_sync_command(sc, AAC_MONKER_SYNCFIB, cm->cm_fibphys, 0, 0, 0, &wait, NULL); - } else if (cm->cm_flags & AAC_CMD_WAIT) { - aacraid_sync_command(sc, AAC_MONKER_SYNCFIB, cm->cm_fibphys, 0, 0, 0, NULL, NULL); + sc->aac_sync_cm = cm; + aacraid_sync_command(sc, AAC_MONKER_SYNCFIB, + cm->cm_fibphys, 0, 0, 0, &wait, NULL); } else { int count = 10000000L; while (AAC_SEND_COMMAND(sc, cm) != 0) { @@ -1617,6 +1623,7 @@ aac_check_firmware(struct aac_softc *sc) options = AAC_GET_MAILBOX(sc, 1); atu_size = AAC_GET_MAILBOX(sc, 2); sc->supported_options = options; + sc->doorbell_mask = AAC_GET_MAILBOX(sc, 3); if ((options & AAC_SUPPORTED_4GB_WINDOW) != 0 && (sc->flags & AAC_FLAGS_NO4GB) == 0) @@ -1631,13 +1638,13 @@ aac_check_firmware(struct aac_softc *sc) sc->flags |= AAC_FLAGS_SG_64BIT; } if (sc->aac_if.aif_send_command) { - if ((options & AAC_SUPPORTED_NEW_COMM_TYPE3) || - (options & AAC_SUPPORTED_NEW_COMM_TYPE4)) - sc->flags |= AAC_FLAGS_NEW_COMM | AAC_FLAGS_NEW_COMM_TYPE34; + if (options & AAC_SUPPORTED_NEW_COMM_TYPE2) + sc->flags |= AAC_FLAGS_NEW_COMM | AAC_FLAGS_NEW_COMM_TYPE2; else if (options & AAC_SUPPORTED_NEW_COMM_TYPE1) sc->flags |= AAC_FLAGS_NEW_COMM | AAC_FLAGS_NEW_COMM_TYPE1; - else if (options & AAC_SUPPORTED_NEW_COMM_TYPE2) - sc->flags |= AAC_FLAGS_NEW_COMM | AAC_FLAGS_NEW_COMM_TYPE2; + else if ((options & AAC_SUPPORTED_NEW_COMM_TYPE3) || + (options & AAC_SUPPORTED_NEW_COMM_TYPE4)) + sc->flags |= AAC_FLAGS_NEW_COMM | AAC_FLAGS_NEW_COMM_TYPE34; } if (options & AAC_SUPPORTED_64BIT_ARRAYSIZE) sc->flags |= AAC_FLAGS_ARRAY_64BIT; @@ -1851,8 +1858,30 @@ aac_define_int_mode(struct aac_softc *sc) dev = sc->aac_dev; + if (sc->flags & AAC_FLAGS_SYNC_MODE) { + device_printf(dev, "using line interrupts\n"); + sc->aac_max_msix = 1; + sc->aac_vector_cap = sc->aac_max_fibs; + return; + } + /* max. vectors from AAC_MONKER_GETCOMMPREF */ if (sc->aac_max_msix == 0) { + if (sc->aac_hwif == AAC_HWIF_SRC) { + msi_count = 1; + if ((error = pci_alloc_msi(dev, &msi_count)) != 0) { + device_printf(dev, "alloc msi failed - err=%d; " + "will use INTx\n", error); + pci_release_msi(dev); + } else { + sc->msi_tupelo = TRUE; + } + } + if (sc->msi_tupelo) + device_printf(dev, "using MSI interrupts\n"); + else + device_printf(dev, "using line interrupts\n"); + sc->aac_max_msix = 1; sc->aac_vector_cap = sc->aac_max_fibs; return; @@ -1958,7 +1987,7 @@ aac_setup_intr(struct aac_softc *sc) void *tag; msi_count = sc->aac_max_msix; - rid = (sc->msi_enabled ? 1:0); + rid = ((sc->msi_enabled || sc->msi_tupelo)? 1:0); for (i = 0; i < msi_count; i++, rid++) { if ((res = bus_alloc_resource_any(sc->aac_dev,SYS_RES_IRQ, &rid, @@ -2854,14 +2883,14 @@ aac_ioctl_send_raw_srb(struct aac_softc *sc, caddr_t a fib = cm->cm_fib; srbcmd = (struct aac_srb *)fib->data; - if ((error = copyin((void *)&user_srb->data_len, &fibsize, - sizeof (u_int32_t)) != 0)) + if ((error = copyin((void *)&user_srb->data_len, &fibsize, + sizeof (u_int32_t))) != 0) goto out; if (fibsize > (sc->aac_max_fib_size-sizeof(struct aac_fib_header))) { error = EINVAL; goto out; } - if ((error = copyin((void *)user_srb, srbcmd, fibsize) != 0)) + if ((error = copyin((void *)user_srb, srbcmd, fibsize)) != 0) goto out; srbcmd->function = 0; /* SRBF_ExecuteScsi */ @@ -2895,13 +2924,10 @@ aac_ioctl_send_raw_srb(struct aac_softc *sc, caddr_t a srb_sg_bytecount = sg.SgByteCount; srb_sg_address = sg.SgAddress; - if (srb_sg_address > 0xffffffffull && - !(sc->flags & AAC_FLAGS_SG_64BIT)) -#endif - { - error = EINVAL; - goto out; - } +#else + error = EINVAL; + goto out; +#endif } else { error = EINVAL; goto out; @@ -3701,7 +3727,7 @@ aac_get_bus_info(struct aac_softc *sc) caminf->TargetsPerBus = businfo.TargetsPerBus; caminf->BusNumber = i+1; caminf->BusType = PASSTHROUGH_BUS; - caminf->InitiatorBusId = businfo.InitiatorBusId[i]; + caminf->InitiatorBusId = -1; caminf->aac_sc = sc; caminf->sim_dev = child; caminf->aac_cam = NULL; @@ -3745,7 +3771,7 @@ aac_reset_adapter(struct aac_softc *sc) struct aac_fib *fib; struct aac_pause_command *pc; u_int32_t status, reset_mask, waitCount, max_msix_orig; - int msi_enabled_orig; + int ret, msi_enabled_orig; fwprintf(sc, HBA_FLAGS_DBG_FUNCTION_ENTRY_B, ""); mtx_assert(&sc->aac_io_lock, MA_OWNED); @@ -3804,50 +3830,61 @@ aac_reset_adapter(struct aac_softc *sc) AAC_MEM0_SETREG4(sc, AAC_IRCSR, AAC_IRCSR_CORES_RST); /* We need to wait for 5 seconds before accessing the MU again - * 10000 * 100us = 1000,000us = 1000ms = 1s + * 10000 * 100us = 1000,000us = 1000ms = 1s */ waitCount = 5 * 10000; while (waitCount) { DELAY(100); /* delay 100 microseconds */ waitCount--; } - } else if ((aacraid_sync_command(sc, - AAC_IOP_RESET_ALWAYS, 0, 0, 0, 0, &status, &reset_mask)) != 0) { - /* call IOP_RESET for older firmware */ - if ((aacraid_sync_command(sc, - AAC_IOP_RESET, 0, 0, 0, 0, &status, NULL)) != 0) { + } else { + ret = aacraid_sync_command(sc, AAC_IOP_RESET_ALWAYS, + 0, 0, 0, 0, &status, &reset_mask); + if (ret && !sc->doorbell_mask) { + /* call IOP_RESET for older firmware */ + if ((aacraid_sync_command(sc, AAC_IOP_RESET, 0,0,0,0, + &status, NULL)) != 0) { + if (status == AAC_SRB_STS_INVALID_REQUEST) { + device_printf(sc->aac_dev, + "IOP_RESET not supported\n"); + } else { + /* probably timeout */ + device_printf(sc->aac_dev, + "IOP_RESET failed\n"); + } - if (status == AAC_SRB_STS_INVALID_REQUEST) - device_printf(sc->aac_dev, "IOP_RESET not supported\n"); - else - /* probably timeout */ - device_printf(sc->aac_dev, "IOP_RESET failed\n"); + /* unwind aac_shutdown() */ + aac_alloc_sync_fib(sc, &fib); + pc = (struct aac_pause_command *)&fib->data[0]; + pc->Command = VM_ContainerConfig; + pc->Type = CT_PAUSE_IO; + pc->Timeout = 1; + pc->Min = 1; + pc->NoRescan = 1; - /* unwind aac_shutdown() */ - aac_alloc_sync_fib(sc, &fib); - pc = (struct aac_pause_command *)&fib->data[0]; - pc->Command = VM_ContainerConfig; - pc->Type = CT_PAUSE_IO; - pc->Timeout = 1; - pc->Min = 1; - pc->NoRescan = 1; + (void) aac_sync_fib(sc, ContainerCommand, 0, + fib, sizeof (struct aac_pause_command)); + aac_release_sync_fib(sc); - (void) aac_sync_fib(sc, ContainerCommand, 0, fib, - sizeof (struct aac_pause_command)); - aac_release_sync_fib(sc); - - goto finish; + goto finish; + } + } else if (sc->doorbell_mask) { + ret = 0; + reset_mask = sc->doorbell_mask; } - } else if (sc->aac_support_opt2 & AAC_SUPPORTED_DOORBELL_RESET) { - AAC_MEM0_SETREG4(sc, AAC_SRC_IDBR, reset_mask); - /* - * We need to wait for 5 seconds before accessing the doorbell - * again, 10000 * 100us = 1000,000us = 1000ms = 1s - */ - waitCount = 5 * 10000; - while (waitCount) { - DELAY(100); /* delay 100 microseconds */ - waitCount--; + if (!ret && + (sc->aac_support_opt2 & AAC_SUPPORTED_DOORBELL_RESET)) { + AAC_MEM0_SETREG4(sc, AAC_SRC_IDBR, reset_mask); + /* + * We need to wait for 5 seconds before accessing the + * doorbell again; + * 10000 * 100us = 1000,000us = 1000ms = 1s + */ + waitCount = 5 * 10000; + while (waitCount) { + DELAY(100); /* delay 100 microseconds */ + waitCount--; + } } } Modified: stable/11/sys/dev/aacraid/aacraid_cam.c ============================================================================== --- stable/11/sys/dev/aacraid/aacraid_cam.c Thu Nov 21 14:54:20 2019 (r354964) +++ stable/11/sys/dev/aacraid/aacraid_cam.c Thu Nov 21 14:55:27 2019 (r354965) @@ -1015,8 +1015,8 @@ aac_cam_action(struct cam_sim *sim, union ccb *ccb) cpi->version_num = 1; cpi->target_sprt = 0; cpi->hba_eng_cnt = 0; - cpi->max_target = camsc->inf->TargetsPerBus; - cpi->max_lun = 8; /* Per the controller spec */ + cpi->max_target = camsc->inf->TargetsPerBus - 1; + cpi->max_lun = 7; /* Per the controller spec */ cpi->initiator_id = camsc->inf->InitiatorBusId; cpi->bus_id = camsc->inf->BusNumber; #if __FreeBSD_version >= 800000 @@ -1387,15 +1387,9 @@ aacraid_startio(struct aac_softc *sc) * Try to get a command that's been put off for lack of * resources */ - if (sc->flags & AAC_FLAGS_SYNC_MODE) { - /* sync. transfer mode */ - if (sc->aac_sync_cm) - break; - cm = aac_dequeue_ready(sc); - sc->aac_sync_cm = cm; - } else { - cm = aac_dequeue_ready(sc); - } + if ((sc->flags & AAC_FLAGS_SYNC_MODE) && sc->aac_sync_cm) + break; + cm = aac_dequeue_ready(sc); /* nothing to do? */ if (cm == NULL) Modified: stable/11/sys/dev/aacraid/aacraid_reg.h ============================================================================== --- stable/11/sys/dev/aacraid/aacraid_reg.h Thu Nov 21 14:54:20 2019 (r354964) +++ stable/11/sys/dev/aacraid/aacraid_reg.h Thu Nov 21 14:55:27 2019 (r354965) @@ -40,7 +40,7 @@ /* * Misc. magic numbers. */ -#define AAC_MAX_CONTAINERS 64 +#define AAC_MAX_CONTAINERS 240 #define AAC_BLOCK_SIZE 512 /* Modified: stable/11/sys/dev/aacraid/aacraid_var.h ============================================================================== --- stable/11/sys/dev/aacraid/aacraid_var.h Thu Nov 21 14:54:20 2019 (r354964) +++ stable/11/sys/dev/aacraid/aacraid_var.h Thu Nov 21 14:55:27 2019 (r354965) @@ -47,7 +47,7 @@ #define AAC_DRIVER_MAJOR_VERSION 3 #define AAC_DRIVER_MINOR_VERSION 2 -#define AAC_DRIVER_BUGFIX_LEVEL 5 +#define AAC_DRIVER_BUGFIX_LEVEL 10 #define AAC_DRIVER_TYPE AAC_TYPE_RELEASE #ifndef AAC_DRIVER_BUILD @@ -479,9 +479,12 @@ struct aac_softc u_int32_t aac_feature_bits; /* feature bits from suppl. info */ u_int32_t aac_support_opt2; /* supp. options from suppl. info */ u_int32_t aac_max_aif; /* max. AIF count */ + u_int32_t doorbell_mask; /* for IOP reset */ u_int32_t aac_max_msix; /* max. MSI-X vectors */ u_int32_t aac_vector_cap; /* MSI-X vector capab.*/ int msi_enabled; /* MSI/MSI-X enabled */ + int msi_tupelo; /* Series 6 support for */ + /* single MSI interrupt */ #define AAC_CAM_TARGET_WILDCARD ~0 void (*cam_rescan_cb)(struct aac_softc *, uint32_t, uint32_t); From owner-svn-src-all@freebsd.org Thu Nov 21 15:06:32 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 19EEC1C1CD5; Thu, 21 Nov 2019 15:06:32 +0000 (UTC) (envelope-from ronald-lists@klop.ws) Received: from smarthost1.greenhost.nl (smarthost1.greenhost.nl [195.190.28.88]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 47JjZG3mlqz4Wsg; Thu, 21 Nov 2019 15:06:30 +0000 (UTC) (envelope-from ronald-lists@klop.ws) Received: from smtp.greenhost.nl ([213.108.110.112]) by smarthost1.greenhost.nl with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.89) (envelope-from ) id 1iXo2H-0004pe-1u; Thu, 21 Nov 2019 16:06:27 +0100 Content-Type: text/plain; charset=utf-8; format=flowed; delsp=yes To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org, "Dimitry Andric" Subject: Re: svn commit: r354803 - in stable: 11/contrib/llvm/lib/Transforms/InstCombine 12/contrib/llvm/lib/Transforms/InstCombine References: <201911180704.xAI74xAM039993@repo.freebsd.org> Date: Thu, 21 Nov 2019 16:06:22 +0100 MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: "Ronald Klop" Message-ID: In-Reply-To: <201911180704.xAI74xAM039993@repo.freebsd.org> User-Agent: Opera Mail/12.16 (FreeBSD) X-Authenticated-As-Hash: 398f5522cb258ce43cb679602f8cfe8b62a256d1 X-Virus-Scanned: by clamav at smarthost1.samage.net X-Spam-Level: -- X-Spam-Score: -2.0 X-Spam-Status: No, score=-2.0 required=5.0 tests=ALL_TRUSTED, BAYES_00 autolearn=disabled version=3.4.2 X-Scan-Signature: e6bdf1242ae0fe6211617ef395c8efe5 X-Rspamd-Queue-Id: 47JjZG3mlqz4Wsg X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org; dkim=none; dmarc=none; spf=pass (mx1.freebsd.org: domain of ronald-lists@klop.ws designates 195.190.28.88 as permitted sender) smtp.mailfrom=ronald-lists@klop.ws X-Spamd-Result: default: False [-2.56 / 15.00]; ARC_NA(0.00)[]; NEURAL_HAM_MEDIUM(-1.00)[-0.999,0]; FROM_HAS_DN(0.00)[]; TO_DN_SOME(0.00)[]; R_SPF_ALLOW(-0.20)[+ip4:195.190.28.64/27]; TO_MATCH_ENVRCPT_ALL(0.00)[]; MIME_GOOD(-0.10)[text/plain]; DMARC_NA(0.00)[klop.ws]; NEURAL_HAM_LONG(-1.00)[-0.999,0]; RCPT_COUNT_FIVE(0.00)[5]; IP_SCORE(-0.76)[ip: (-0.89), ipnet: 195.190.28.0/24(-0.33), asn: 47172(-2.61), country: NL(0.02)]; RCVD_IN_DNSWL_NONE(0.00)[88.28.190.195.list.dnswl.org : 127.0.10.0]; FROM_EQ_ENVFROM(0.00)[]; R_DKIM_NA(0.00)[]; MID_RHS_NOT_FQDN(0.50)[]; ASN(0.00)[asn:47172, ipnet:195.190.28.0/24, country:NL]; MIME_TRACE(0.00)[0:+]; RCVD_TLS_ALL(0.00)[]; RCVD_COUNT_TWO(0.00)[2] X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 21 Nov 2019 15:06:32 -0000 On Mon, 18 Nov 2019 08:04:59 +0100, Dimitry Andric wrote: > Author: dim > Date: Mon Nov 18 07:04:59 2019 > New Revision: 354803 > URL: https://svnweb.freebsd.org/changeset/base/354803 > > Log: > MFC r354724: > Merge commit 5bbb604bb from llvm git (by Craig Topper): > [InstCombine] Disable some portions of foldGEPICmp for GEPs that > return a vector of pointers. Fix other portions. > llvm-svn: 370114 > This should fix instances of 'Assertion failed: (isa(Val) && > "cast() argument of incompatible type!"), function cast, file > /usr/src/contrib/llvm/include/llvm/Support/Casting.h, line 255', when > building openjdk8 for aarch64 and armv7. > Reported by: jbeich > PR: 236566 > Are there plans for an errata notice for releng-12.1 with this fix? That would keep Openjdk8 as a pkg on aarch64 after 12.0 goes EOL and pkgs will be build on 12.1. If no plans exist how do I request this formally? Regards, Ronald. > Modified: > stable/11/contrib/llvm/lib/Transforms/InstCombine/InstCombineCompares.cpp > Directory Properties: > stable/11/ (props changed) > > Changes in other areas also in this revision: > Modified: > stable/12/contrib/llvm/lib/Transforms/InstCombine/InstCombineCompares.cpp > Directory Properties: > stable/12/ (props changed) > > Modified: > stable/11/contrib/llvm/lib/Transforms/InstCombine/InstCombineCompares.cpp > ============================================================================== > --- > stable/11/contrib/llvm/lib/Transforms/InstCombine/InstCombineCompares.cpp Mon > Nov 18 04:22:04 2019 (r354802) > +++ > stable/11/contrib/llvm/lib/Transforms/InstCombine/InstCombineCompares.cpp Mon > Nov 18 07:04:59 2019 (r354803) > @@ -830,6 +830,10 @@ getAsConstantIndexedAddress(Value *V, const > DataLayout > static Instruction *transformToIndexedCompare(GEPOperator *GEPLHS, > Value *RHS, > ICmpInst::Predicate Cond, > const DataLayout &DL) { > + // FIXME: Support vector of pointers. > + if (GEPLHS->getType()->isVectorTy()) > + return nullptr; > + > if (!GEPLHS->hasAllConstantIndices()) > return nullptr; > @@ -880,7 +884,9 @@ Instruction *InstCombiner::foldGEPICmp(GEPOperator > *GE > RHS = RHS->stripPointerCasts(); > Value *PtrBase = GEPLHS->getOperand(0); > - if (PtrBase == RHS && GEPLHS->isInBounds()) { > + // FIXME: Support vector pointer GEPs. > + if (PtrBase == RHS && GEPLHS->isInBounds() && > + !GEPLHS->getType()->isVectorTy()) { > // ((gep Ptr, OFFSET) cmp Ptr) ---> (OFFSET cmp 0). > // This transformation (ignoring the base and scales) is valid > because we > // know pointers can't overflow since the gep is inbounds. See if > we can > @@ -914,11 +920,13 @@ Instruction *InstCombiner::foldGEPICmp(GEPOperator > *GE > // If we're comparing GEPs with two base pointers that only > differ in type > // and both GEPs have only constant indices or just one use, then > fold > // the compare with the adjusted indices. > + // FIXME: Support vector of pointers. > if (GEPLHS->isInBounds() && GEPRHS->isInBounds() && > (GEPLHS->hasAllConstantIndices() || GEPLHS->hasOneUse()) && > (GEPRHS->hasAllConstantIndices() || GEPRHS->hasOneUse()) && > PtrBase->stripPointerCasts() == > - GEPRHS->getOperand(0)->stripPointerCasts()) { > + GEPRHS->getOperand(0)->stripPointerCasts() && > + !GEPLHS->getType()->isVectorTy()) { > Value *LOffset = EmitGEPOffset(GEPLHS); > Value *ROffset = EmitGEPOffset(GEPRHS); > @@ -962,15 +970,20 @@ Instruction *InstCombiner::foldGEPICmp(GEPOperator > *GE > unsigned DiffOperand = 0; // The operand that differs. > for (unsigned i = 1, e = GEPRHS->getNumOperands(); i != e; ++i) > if (GEPLHS->getOperand(i) != GEPRHS->getOperand(i)) { > - if > (GEPLHS->getOperand(i)->getType()->getPrimitiveSizeInBits() != > - > GEPRHS->getOperand(i)->getType()->getPrimitiveSizeInBits()) { > + Type *LHSType = GEPLHS->getOperand(i)->getType(); > + Type *RHSType = GEPRHS->getOperand(i)->getType(); > + // FIXME: Better support for vector of pointers. > + if (LHSType->getPrimitiveSizeInBits() != > + RHSType->getPrimitiveSizeInBits() || > + (GEPLHS->getType()->isVectorTy() && > + (!LHSType->isVectorTy() || !RHSType->isVectorTy()))) { > // Irreconcilable differences. > NumDifferences = 2; > break; > - } else { > - if (NumDifferences++) break; > - DiffOperand = i; > } > + > + if (NumDifferences++) break; > + DiffOperand = i; > } > if (NumDifferences == 0) // SAME GEP? > _______________________________________________ > svn-src-all@freebsd.org mailing list > https://lists.freebsd.org/mailman/listinfo/svn-src-all > To unsubscribe, send any mail to "svn-src-all-unsubscribe@freebsd.org" From owner-svn-src-all@freebsd.org Thu Nov 21 15:38:28 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 041C71C2ABA; Thu, 21 Nov 2019 15:38:28 +0000 (UTC) (envelope-from zeising@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47JkH74mRlz4YZ1; Thu, 21 Nov 2019 15:38:27 +0000 (UTC) (envelope-from zeising@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 88317D6A2; Thu, 21 Nov 2019 15:38:27 +0000 (UTC) (envelope-from zeising@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xALFcRY2001012; Thu, 21 Nov 2019 15:38:27 GMT (envelope-from zeising@FreeBSD.org) Received: (from zeising@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xALFcRwX001011; Thu, 21 Nov 2019 15:38:27 GMT (envelope-from zeising@FreeBSD.org) Message-Id: <201911211538.xALFcRwX001011@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: zeising set sender to zeising@FreeBSD.org using -f From: Niclas Zeising Date: Thu, 21 Nov 2019 15:38:27 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354966 - head X-SVN-Group: head X-SVN-Commit-Author: zeising X-SVN-Commit-Paths: head X-SVN-Commit-Revision: 354966 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 21 Nov 2019 15:38:28 -0000 Author: zeising (doc,ports committer) Date: Thu Nov 21 15:38:27 2019 New Revision: 354966 URL: https://svnweb.freebsd.org/changeset/base/354966 Log: ObsoleteFiles.inc: add sio(4) leftovers Add the manual page for sio(4) to ObsoleteFiles.inc, so that make delete-all will remove it. The manual page was removed together with sio(4) in r354929. Approved by: emaste Differential Revision: https://reviews.freebsd.org/D22477 Modified: head/ObsoleteFiles.inc Modified: head/ObsoleteFiles.inc ============================================================================== --- head/ObsoleteFiles.inc Thu Nov 21 14:55:27 2019 (r354965) +++ head/ObsoleteFiles.inc Thu Nov 21 15:38:27 2019 (r354966) @@ -38,6 +38,8 @@ # xargs -n1 | sort | uniq -d; # done +# 20191121: Removal of sio(4) +OLD_FILES+=usr/share/man/man4/sio.4.gz # 20191105: picobsd(8), et al, removed. OLD_FILES+=usr/share/man/man8/picobsd.8.gz # 20191009: new clang import which bumps version from 8.0.1 to 9.0.0. From owner-svn-src-all@freebsd.org Thu Nov 21 15:54:57 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id AF59E1C33DC; Thu, 21 Nov 2019 15:54:57 +0000 (UTC) (envelope-from 0mp@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47Jkf94CGYz4ZlK; Thu, 21 Nov 2019 15:54:57 +0000 (UTC) (envelope-from 0mp@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 6F5A7DA5C; Thu, 21 Nov 2019 15:54:57 +0000 (UTC) (envelope-from 0mp@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xALFsvjI012224; Thu, 21 Nov 2019 15:54:57 GMT (envelope-from 0mp@FreeBSD.org) Received: (from 0mp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xALFsvN0012223; Thu, 21 Nov 2019 15:54:57 GMT (envelope-from 0mp@FreeBSD.org) Message-Id: <201911211554.xALFsvN0012223@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: 0mp set sender to 0mp@FreeBSD.org using -f From: Mateusz Piotrowski <0mp@FreeBSD.org> Date: Thu, 21 Nov 2019 15:54:57 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354967 - head/usr.sbin/bsdinstall X-SVN-Group: head X-SVN-Commit-Author: 0mp X-SVN-Commit-Paths: head/usr.sbin/bsdinstall X-SVN-Commit-Revision: 354967 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 21 Nov 2019 15:54:57 -0000 Author: 0mp (doc,ports committer) Date: Thu Nov 21 15:54:56 2019 New Revision: 354967 URL: https://svnweb.freebsd.org/changeset/base/354967 Log: bsdinstall.8: Fix description of DISTRIBUTIONS environment variable Reviewed by: bcr Approved by: bcr (mentor) MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D22478 Modified: head/usr.sbin/bsdinstall/bsdinstall.8 Modified: head/usr.sbin/bsdinstall/bsdinstall.8 ============================================================================== --- head/usr.sbin/bsdinstall/bsdinstall.8 Thu Nov 21 15:38:27 2019 (r354966) +++ head/usr.sbin/bsdinstall/bsdinstall.8 Thu Nov 21 15:54:56 2019 (r354967) @@ -25,7 +25,7 @@ .\" .\" $FreeBSD$ .\" -.Dd October 4, 2018 +.Dd November 21, 2019 .Dt BSDINSTALL 8 .Os .Sh NAME @@ -260,7 +260,7 @@ Others are set by various interactive user prompts, an overridden when making scripted or customized installers. .Bl -tag -width ".Ev BSDINSTALL_DISTSITE" .It Ev DISTRIBUTIONS -The set of distributions to install, e.g., "base kernel ports". +The set of distributions to install, e.g., "base.txz kernel.txz ports.txz". Default: unset .It Ev BSDINSTALL_DISTDIR The directory in which the distribution files can be found (or to which they From owner-svn-src-all@freebsd.org Thu Nov 21 15:59:35 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 313E71C35D7; Thu, 21 Nov 2019 15:59:35 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47JklW0WXRz4b2K; Thu, 21 Nov 2019 15:59:35 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id EA658DA82; Thu, 21 Nov 2019 15:59:34 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xALFxYU9012519; Thu, 21 Nov 2019 15:59:34 GMT (envelope-from imp@FreeBSD.org) Received: (from imp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xALFxXQa012513; Thu, 21 Nov 2019 15:59:33 GMT (envelope-from imp@FreeBSD.org) Message-Id: <201911211559.xALFxXQa012513@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: imp set sender to imp@FreeBSD.org using -f From: Warner Losh Date: Thu, 21 Nov 2019 15:59:33 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354968 - in head: share/mk sys/conf X-SVN-Group: head X-SVN-Commit-Author: imp X-SVN-Commit-Paths: in head: share/mk sys/conf X-SVN-Commit-Revision: 354968 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 21 Nov 2019 15:59:35 -0000 Author: imp Date: Thu Nov 21 15:59:33 2019 New Revision: 354968 URL: https://svnweb.freebsd.org/changeset/base/354968 Log: Introduce bsd.sysdir.mk to consolidate looking for the kernel. Reviewed by: jhb Differential Revision: https://reviews.freebsd.org/D22144 Added: head/share/mk/bsd.sysdir.mk - copied, changed from r354937, head/share/mk/bsd.kmod.mk Modified: head/share/mk/bsd.dtb.mk head/share/mk/bsd.kmod.mk head/sys/conf/dtb.build.mk head/sys/conf/kmod.mk Modified: head/share/mk/bsd.dtb.mk ============================================================================== --- head/share/mk/bsd.dtb.mk Thu Nov 21 15:54:56 2019 (r354967) +++ head/share/mk/bsd.dtb.mk Thu Nov 21 15:59:33 2019 (r354968) @@ -1,22 +1,6 @@ # $FreeBSD$ -# Search for kernel source tree in standard places. -.if empty(KERNBUILDDIR) -.if !defined(SYSDIR) -.for _dir in ${SRCTOP:D${SRCTOP}/sys} \ - ${.CURDIR}/../.. ${.CURDIR}/../../.. ${.CURDIR}/../../../.. \ - ${.CURDIR}/../../../../.. /sys /usr/src/sys -.if !defined(SYSDIR) && exists(${_dir}/kern/) && exists(${_dir}/conf/kmod.mk) -SYSDIR= ${_dir} -.endif -.endfor -.endif -.if !defined(SYSDIR) || !exists(${SYSDIR}/kern/) || \ - !exists(${SYSDIR}/conf/kmod.mk) -.error Unable to locate the kernel source tree. Set SYSDIR to override. -.endif -.endif - +.include .include "${SYSDIR}/conf/dtb.mk" .include Modified: head/share/mk/bsd.kmod.mk ============================================================================== --- head/share/mk/bsd.kmod.mk Thu Nov 21 15:54:56 2019 (r354967) +++ head/share/mk/bsd.kmod.mk Thu Nov 21 15:59:33 2019 (r354968) @@ -1,20 +1,4 @@ # $FreeBSD$ -# Search for kernel source tree in standard places. -.if empty(KERNBUILDDIR) -.if !defined(SYSDIR) -.for _dir in ${SRCTOP:D${SRCTOP}/sys} \ - ${.CURDIR}/../.. ${.CURDIR}/../../.. ${.CURDIR}/../../../.. \ - ${.CURDIR}/../../../../.. /sys /usr/src/sys -.if !defined(SYSDIR) && exists(${_dir}/kern/) && exists(${_dir}/conf/kmod.mk) -SYSDIR= ${_dir:tA} -.endif -.endfor -.endif -.if !defined(SYSDIR) || !exists(${SYSDIR}/kern/) || \ - !exists(${SYSDIR}/conf/kmod.mk) -.error Unable to locate the kernel source tree. Set SYSDIR to override. -.endif -.endif - +.include .include "${SYSDIR}/conf/kmod.mk" Copied and modified: head/share/mk/bsd.sysdir.mk (from r354937, head/share/mk/bsd.kmod.mk) ============================================================================== --- head/share/mk/bsd.kmod.mk Thu Nov 21 06:48:30 2019 (r354937, copy source) +++ head/share/mk/bsd.sysdir.mk Thu Nov 21 15:59:33 2019 (r354968) @@ -1,7 +1,6 @@ # $FreeBSD$ # Search for kernel source tree in standard places. -.if empty(KERNBUILDDIR) .if !defined(SYSDIR) .for _dir in ${SRCTOP:D${SRCTOP}/sys} \ ${.CURDIR}/../.. ${.CURDIR}/../../.. ${.CURDIR}/../../../.. \ @@ -15,6 +14,3 @@ SYSDIR= ${_dir:tA} !exists(${SYSDIR}/conf/kmod.mk) .error Unable to locate the kernel source tree. Set SYSDIR to override. .endif -.endif - -.include "${SYSDIR}/conf/kmod.mk" Modified: head/sys/conf/dtb.build.mk ============================================================================== --- head/sys/conf/dtb.build.mk Thu Nov 21 15:54:56 2019 (r354967) +++ head/sys/conf/dtb.build.mk Thu Nov 21 15:59:33 2019 (r354968) @@ -11,12 +11,7 @@ DTC?= dtc .if defined(S) SYSDIR= ${S} .else -# Search for kernel source tree in standard places. -.for _dir in ${.CURDIR}/../.. ${.CURDIR}/../../.. /sys /usr/src/sys -.if exists(${_dir}/kern/) -SYSDIR= ${_dir:tA} -.endif -.endfor +.include .endif # defined(S) .endif # defined(SYSDIR) Modified: head/sys/conf/kmod.mk ============================================================================== --- head/sys/conf/kmod.mk Thu Nov 21 15:54:56 2019 (r354967) +++ head/sys/conf/kmod.mk Thu Nov 21 15:59:33 2019 (r354968) @@ -79,21 +79,7 @@ OBJCOPY?= objcopy .include "kern.opts.mk" .include .include "config.mk" - -# Search for kernel source tree in standard places. -.if empty(KERNBUILDDIR) -.if !defined(SYSDIR) -.for _dir in ${SRCTOP:D${SRCTOP}/sys} \ - ${.CURDIR}/../.. ${.CURDIR}/../../.. /sys /usr/src/sys -.if !defined(SYSDIR) && exists(${_dir}/kern/) -SYSDIR= ${_dir:tA} -.endif -.endfor -.endif -.if !defined(SYSDIR) || !exists(${SYSDIR}/kern/) -.error "can't find kernel source tree" -.endif -.endif +.include .SUFFIXES: .out .o .c .cc .cxx .C .y .l .s .S .m From owner-svn-src-all@freebsd.org Thu Nov 21 16:13:42 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 5A48E1C3CBE; Thu, 21 Nov 2019 16:13:42 +0000 (UTC) (envelope-from gjb@freebsd.org) Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2610:1c1:1:6074::16:84]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "freefall.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47Jl3p1fZLz4bvb; Thu, 21 Nov 2019 16:13:42 +0000 (UTC) (envelope-from gjb@freebsd.org) Received: from FreeBSD.org (freefall.freebsd.org [IPv6:2610:1c1:1:6074::16:84]) (using TLSv1 with cipher ECDHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by freefall.freebsd.org (Postfix) with ESMTPS id 28A2C122D1; Thu, 21 Nov 2019 16:13:41 +0000 (UTC) (envelope-from gjb@freebsd.org) Date: Thu, 21 Nov 2019 16:13:37 +0000 From: Glen Barber To: Brooks Davis Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org, FreeBSD Ports Management Team , Colin Percival Subject: Re: svn commit: r354909 - in head: . share/mk Message-ID: <20191121161337.GA92849@FreeBSD.org> References: <201911201836.xAKIawWt053874@repo.freebsd.org> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="0OAP2g/MAC+5xKAE" Content-Disposition: inline In-Reply-To: <201911201836.xAKIawWt053874@repo.freebsd.org> User-Agent: Mutt/1.12.1 (2019-06-15) X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 21 Nov 2019 16:13:42 -0000 --0OAP2g/MAC+5xKAE Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Wed, Nov 20, 2019 at 06:36:58PM +0000, Brooks Davis wrote: > Author: brooks > Date: Wed Nov 20 18:36:58 2019 > New Revision: 354909 > URL: https://svnweb.freebsd.org/changeset/base/354909 >=20 > Log: > Make the warning for deprecated NO_ variables an error. > =20 > Support for NO_CTF, NO_DEBUG_FILES, NO_INSTALLLIB, NO_MAN, NO_PROFILE, > and NO_WARNS as deprecated in 2014 with a warning added for each one > found. Turn these into error in preperation for removal of compatability > support before FreeBSD 13. > =20 > Reviewed by: imp > Relnotes: yes > Sponsored by: DARPA, AFRL > Differential Revision: https://reviews.freebsd.org/D22448 >=20 > Modified: head/share/mk/bsd.opts.mk > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D > --- head/share/mk/bsd.opts.mk Wed Nov 20 18:12:01 2019 (r354908) > +++ head/share/mk/bsd.opts.mk Wed Nov 20 18:36:58 2019 (r354909) > @@ -100,7 +100,7 @@ __DEFAULT_DEPENDENT_OPTIONS =3D \ > PROFILE \ > WARNS > .if defined(NO_${var}) > -.warning "NO_${var} is defined, but deprecated. Please use MK_${var}=3Dn= o instead." > +.error "NO_${var} is defined, but deprecated. Please use MK_${var}=3Dno = instead." > MK_${var}:=3Dno > .endif > .endfor >=20 Had this been exp-run tested? This breaks at least the net/bsdec2-image-upload port, which does *not* set NO_MAN explicitly in its Makefile. I suspect at least several other ports are now implicitly broken as result of this change. Glen --0OAP2g/MAC+5xKAE Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAEBCAAdFiEEjRJAPC5sqwhs9k2jAxRYpUeP4pMFAl3Wt7EACgkQAxRYpUeP 4pOTuxAAgR2/yJghO5rzYZCSvcCFD7Hk30IH0ECYsahxcXH8q90WWKTAmSUQCwqU n3V9oFygnyLCpXEcQRlSsrvCRgcW0K6C0UCA4zsOftCWh5qoLP6B0k6bZvUI4Bqp d4XagrBxerRro0pZgwQ5x3jie3SylkfwwMvbmy9zHL21jca24AwF4GfwvV5ksB0a AKF812J5iH+LRJAca2OJumNyA7vz3QbZJurCi/0WQLaij4vcbKIl5TK/lqkrcru+ sgAFhhaE79y9UDp8eNugUeR7/0/gy6KuHcqQJ+A50DMwHM1jvAw9L476UsRInNs6 jDKNDLY0ujEBAt8jNAWsL18vmk+KUcvOqbkkxG6Uz8rDt8iE7tjF4M9n5GgLv/gP tykkNY2InwCdo0SX3+1QiUSFCv37MRlb5OSLHK0P1gsBwKxbgLBuj6l01c8Pyl7G nWR+akbaLm9w1e1FZ5SaA+Gb/kNwq6Jv1ck4Pm+iem7Z5gwG3ITRKkNsBu97Mowh rCaSv+XnwxRKLBFHd9y1G2GhNmkMLrVav/qNYVxSt0CcT8aI9A+4JKxZC6j9TLzb Nqr9zh9KjYyoABHJhpIWLu9quyqqcaMekE0v8ddklED0UffOAen+IIOpZrvpdNd+ UW8QoNwbsndpZJJfYZhpxNr5i7p3Kh2gZqeiUKoPe774tYP5qXQ= =d3mA -----END PGP SIGNATURE----- --0OAP2g/MAC+5xKAE-- From owner-svn-src-all@freebsd.org Thu Nov 21 16:23:14 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id DA4161C40DE; Thu, 21 Nov 2019 16:23:14 +0000 (UTC) (envelope-from gjb@freebsd.org) Received: from freefall.freebsd.org (freefall.freebsd.org [96.47.72.132]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "freefall.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47JlGp53n7z4cNQ; Thu, 21 Nov 2019 16:23:14 +0000 (UTC) (envelope-from gjb@freebsd.org) Received: from FreeBSD.org (freefall.freebsd.org [IPv6:2610:1c1:1:6074::16:84]) (using TLSv1 with cipher ECDHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by freefall.freebsd.org (Postfix) with ESMTPS id 1013A124CA; Thu, 21 Nov 2019 16:23:14 +0000 (UTC) (envelope-from gjb@freebsd.org) Date: Thu, 21 Nov 2019 16:23:11 +0000 From: Glen Barber To: Brooks Davis Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org, FreeBSD Ports Management Team , Colin Percival Subject: Re: svn commit: r354909 - in head: . share/mk Message-ID: <20191121162311.GN5599@FreeBSD.org> References: <201911201836.xAKIawWt053874@repo.freebsd.org> <20191121161337.GA92849@FreeBSD.org> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="mzDsWmoYTs+XRn5Z" Content-Disposition: inline In-Reply-To: <20191121161337.GA92849@FreeBSD.org> User-Agent: Mutt/1.12.1 (2019-06-15) X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 21 Nov 2019 16:23:14 -0000 --mzDsWmoYTs+XRn5Z Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Thu, Nov 21, 2019 at 04:13:37PM +0000, Glen Barber wrote: > On Wed, Nov 20, 2019 at 06:36:58PM +0000, Brooks Davis wrote: > > Author: brooks > > Date: Wed Nov 20 18:36:58 2019 > > New Revision: 354909 > > URL: https://svnweb.freebsd.org/changeset/base/354909 > >=20 > > Log: > > Make the warning for deprecated NO_ variables an error. > > =20 > > Support for NO_CTF, NO_DEBUG_FILES, NO_INSTALLLIB, NO_MAN, NO_PROFILE, > > and NO_WARNS as deprecated in 2014 with a warning added for each one > > found. Turn these into error in preperation for removal of compatabil= ity > > support before FreeBSD 13. > > =20 > > Reviewed by: imp > > Relnotes: yes > > Sponsored by: DARPA, AFRL > > Differential Revision: https://reviews.freebsd.org/D22448 > >=20 >=20 > > Modified: head/share/mk/bsd.opts.mk > > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D > > --- head/share/mk/bsd.opts.mk Wed Nov 20 18:12:01 2019 (r354908) > > +++ head/share/mk/bsd.opts.mk Wed Nov 20 18:36:58 2019 (r354909) > > @@ -100,7 +100,7 @@ __DEFAULT_DEPENDENT_OPTIONS =3D \ > > PROFILE \ > > WARNS > > .if defined(NO_${var}) > > -.warning "NO_${var} is defined, but deprecated. Please use MK_${var}= =3Dno instead." > > +.error "NO_${var} is defined, but deprecated. Please use MK_${var}=3Dn= o instead." > > MK_${var}:=3Dno > > .endif > > .endfor > >=20 >=20 > Had this been exp-run tested? This breaks at least the > net/bsdec2-image-upload port, which does *not* set NO_MAN explicitly in > its Makefile. I suspect at least several other ports are now implicitly > broken as result of this change. >=20 In fact, on a quick search through ports/*/*/Makefile, I do not see NO_MAN defined *anywhere*. So, this is pulled in from somewhere else, which now I have a feeling more ports than I initially thought are now broken. Glen --mzDsWmoYTs+XRn5Z Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAEBCAAdFiEEjRJAPC5sqwhs9k2jAxRYpUeP4pMFAl3Wue8ACgkQAxRYpUeP 4pPRGg//bDDnF4LD6gYlF0cnkgFt+WB3i9gOvZff3dghn4mb1AXyF3GD3BA2W+RY ai5m+bX33CVXQ5tvq/Okk8b+tafGZSBLRidghn8qwa7BQ1IesGbv4Sd1aTvn7lb0 mmKWRfgeI+EJ7Fo6iexUGiz+PpQZxU5B/ROUIvOgSgzGtu3RQMMzEwX4PVUHQW8I 3OjaagyXVDB57iDDT1b/Jje52LfKkIHhaI7D708lhDQRAjso807uTBjeJN/zMWZ1 3kuhegS0VrMBGAm5XAk+M2r6DikhuKk+f3Jof6/1BtFLFhM8Gt11GvOkswSi771T wpRqgARYEb/ad/B1OqxnD99On69xwe5GNboVWQq5Cwx0PpyFJaS1UyJGfHBWUAQo I/DTjAzfn6mfkrWecZFazVCepIU5UqkyZ98CVea35z1nRfwBv6VrFz/8d1w9ds9Z 56bi6WF7qvmyZD1yd3BrU3a/FYFWC//0mf49LuG6szkYwaQT3t/kfwa3oQbkR9AG 3qJ0eAHlkH03kVBF/qmic3z2tUjrjGDQbCeGz2o1X6Z4hbbF98ZV5juMGiZ2owC/ eqQzNKgRIUpxI4qNdOfEQ+yS9t/WJzguKHp4B5SASMEamomSma/OUh7xon+3Xwx4 gCEew0Il7dGgEKc5+Ny1iD8iQRZUsVAAwK0MhDaoBbEmC3IJLGg= =iJyz -----END PGP SIGNATURE----- --mzDsWmoYTs+XRn5Z-- From owner-svn-src-all@freebsd.org Thu Nov 21 16:28:56 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 242A51C42E2 for ; Thu, 21 Nov 2019 16:28:56 +0000 (UTC) (envelope-from ian@freebsd.org) Received: from outbound2m.ore.mailhop.org (outbound2m.ore.mailhop.org [54.149.155.156]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 47JlPM5DdSz4cd9 for ; Thu, 21 Nov 2019 16:28:55 +0000 (UTC) (envelope-from ian@freebsd.org) ARC-Seal: i=1; a=rsa-sha256; t=1574353734; cv=none; d=outbound.mailhop.org; s=arc-outbound20181012; b=b9ykdyi2SkmN5IEyeBhHz+S3gnDDgzXUtvKlTxaxE4dbnRvINYCRZyVSINnJsW/hqsvTGQ+GkqRqb icLelnx8sWf/1KXLmeXeoEIm9nqplyKSFcUG6PZkeB+IM8UsGwIe2pNOv2yDmWwkgboMkUccM+c8eO sWfLvhuNjsl2K9Q+Me/BcjmBRnu17Dgy6SwBBGbNMaC/PZ3W2fCZHc30nQW2bsjLjLOKQwnnLkc7Hw ltTfHLfbWUMXS76Y8QJtI7oVtOX8OIoWdjBoBFsCNOO2lw9ASV091cuJtXT2waAZ3rtltq613qnhUx KpL54nG2MybNu3t6kkZH+Xze9NXdnNw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=outbound.mailhop.org; s=arc-outbound20181012; h=content-transfer-encoding:mime-version:content-type:references:in-reply-to: date:cc:to:from:subject:message-id:dkim-signature:from; bh=aWCvtw0smVbLH+WIMF8FGX8heQSj25J1dL0TVnonqHo=; b=NC+5I8LaQ2GqwDOPJ7pHaVZG+xIU6pDYMyr7iGkFmAlmIKRaojyNQUarecdRJhm50RUfuzcu+hvFn ziStvZN3Eodf6fBi6+kDLGHONDAVe2+oLmRKkgoiXtOp456g1azTmy143kzf7ndud2R17JihfUCJxy Sw6qNQtKsnwExmW9afaz4KOJ10an7735JGDejYfRmWgtXq+HfwUYQaEsTyFSSkk1uZ3VO5SiMtZc+2 HX6BYGg7bT83ajMjPMhGUKEdlnfj7h+tBJSyMFCRHvRrjpK/bsPYtxCxj2M2p8xhhBvAR2e2c5UXZg Ro2qUha5Bn9Q7KA78SyM3C6fQ4fAwxg== ARC-Authentication-Results: i=1; outbound4.ore.mailhop.org; spf=softfail smtp.mailfrom=freebsd.org smtp.remote-ip=67.177.211.60; dmarc=none header.from=freebsd.org; arc=none header.oldest-pass=0; DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=outbound.mailhop.org; s=dkim-high; h=content-transfer-encoding:mime-version:content-type:references:in-reply-to: date:cc:to:from:subject:message-id:from; bh=aWCvtw0smVbLH+WIMF8FGX8heQSj25J1dL0TVnonqHo=; b=N0mKiEvs3Yn8SSD5Mxy9Ag5DHKtUHj7J0qFW4VN/n2ODQwCQ5eTflU2LDbMgWriyobkFUXXUu9FaF e30Vm82qqvAPuhYDFrAYuueL8IOFd4L1iDaD5e4wsD2lILm30JwY97DImfZRvLG17XZPXFOh0mODP2 zTYUIiL2T/BkgtqaFIoJP4EngcJSNSZh4sdUIcuW6ZCQK2C4Twgskc/CE9rADA93naLPfbIOKlGUwh FFyvv1LjJSa8eyTLDc9Bs0wklkYZmv2maGJdRN3cj9fmq5taWIjlFguQve+hqLpoZ0b/VFQHfFldu2 qnzwBdgFHjS9cS7Fn1VLdbRs/6YInbg== X-MHO-RoutePath: aGlwcGll X-MHO-User: 007092ea-0c7c-11ea-829e-79a40d15cccd X-Report-Abuse-To: https://support.duocircle.com/support/solutions/articles/5000540958-duocircle-standard-smtp-abuse-information X-Originating-IP: 67.177.211.60 X-Mail-Handler: DuoCircle Outbound SMTP Received: from ilsoft.org (unknown [67.177.211.60]) by outbound4.ore.mailhop.org (Halon) with ESMTPSA id 007092ea-0c7c-11ea-829e-79a40d15cccd; Thu, 21 Nov 2019 16:28:52 +0000 (UTC) Received: from rev (rev [172.22.42.240]) by ilsoft.org (8.15.2/8.15.2) with ESMTP id xALGSo7P054684; Thu, 21 Nov 2019 09:28:50 -0700 (MST) (envelope-from ian@freebsd.org) Message-ID: <3ed399dae42291005a5b88e426018697b47d8419.camel@freebsd.org> Subject: Re: svn commit: r354909 - in head: . share/mk From: Ian Lepore To: Glen Barber , Brooks Davis Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org, FreeBSD Ports Management Team , Colin Percival Date: Thu, 21 Nov 2019 09:28:50 -0700 In-Reply-To: <20191121162311.GN5599@FreeBSD.org> References: <201911201836.xAKIawWt053874@repo.freebsd.org> <20191121161337.GA92849@FreeBSD.org> <20191121162311.GN5599@FreeBSD.org> Content-Type: text/plain; charset="UTF-8" X-Mailer: Evolution 3.28.5 FreeBSD GNOME Team Mime-Version: 1.0 Content-Transfer-Encoding: 7bit X-Rspamd-Queue-Id: 47JlPM5DdSz4cd9 X-Spamd-Bar: - Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-1.94 / 15.00]; local_wl_from(0.00)[freebsd.org]; NEURAL_HAM_MEDIUM(-0.97)[-0.966,0]; NEURAL_HAM_LONG(-0.98)[-0.978,0]; ASN(0.00)[asn:16509, ipnet:54.148.0.0/15, country:US] X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 21 Nov 2019 16:28:56 -0000 On Thu, 2019-11-21 at 16:23 +0000, Glen Barber wrote: > On Thu, Nov 21, 2019 at 04:13:37PM +0000, Glen Barber wrote: > > On Wed, Nov 20, 2019 at 06:36:58PM +0000, Brooks Davis wrote: > > > Author: brooks > > > Date: Wed Nov 20 18:36:58 2019 > > > New Revision: 354909 > > > URL: https://svnweb.freebsd.org/changeset/base/354909 > > > > > > Log: > > > Make the warning for deprecated NO_ variables an error. > > > > > > Support for NO_CTF, NO_DEBUG_FILES, NO_INSTALLLIB, NO_MAN, > > > NO_PROFILE, > > > and NO_WARNS as deprecated in 2014 with a warning added for > > > each one > > > found. Turn these into error in preperation for removal of > > > compatability > > > support before FreeBSD 13. > > > > > > Reviewed by: imp > > > Relnotes: yes > > > Sponsored by: DARPA, AFRL > > > Differential Revision: https://reviews.freebsd.org/D22448 > > > > > > Modified: head/share/mk/bsd.opts.mk > > > ================================================================= > > > ============= > > > --- head/share/mk/bsd.opts.mk Wed Nov 20 18:12:01 2019 ( > > > r354908) > > > +++ head/share/mk/bsd.opts.mk Wed Nov 20 18:36:58 2019 ( > > > r354909) > > > @@ -100,7 +100,7 @@ __DEFAULT_DEPENDENT_OPTIONS = \ > > > PROFILE \ > > > WARNS > > > .if defined(NO_${var}) > > > -.warning "NO_${var} is defined, but deprecated. Please use > > > MK_${var}=no instead." > > > +.error "NO_${var} is defined, but deprecated. Please use > > > MK_${var}=no instead." > > > MK_${var}:=no > > > .endif > > > .endfor > > > > > > > Had this been exp-run tested? This breaks at least the > > net/bsdec2-image-upload port, which does *not* set NO_MAN > > explicitly in > > its Makefile. I suspect at least several other ports are now > > implicitly > > broken as result of this change. > > > > In fact, on a quick search through ports/*/*/Makefile, I do not see > NO_MAN defined *anywhere*. So, this is pulled in from somewhere > else, > which now I have a feeling more ports than I initially thought are > now > broken. > Your search was too narrow. Re-do it as "grep -Rw NO_MAN *" from /usr/ports and you'll get a lot of hits from within files/ dirs. -- Ian From owner-svn-src-all@freebsd.org Thu Nov 21 16:32:57 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 9607C1C45A4; Thu, 21 Nov 2019 16:32:57 +0000 (UTC) (envelope-from gjb@freebsd.org) Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2610:1c1:1:6074::16:84]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "freefall.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47JlV13NQPz4d4N; Thu, 21 Nov 2019 16:32:57 +0000 (UTC) (envelope-from gjb@freebsd.org) Received: from FreeBSD.org (freefall.freebsd.org [IPv6:2610:1c1:1:6074::16:84]) (using TLSv1 with cipher ECDHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by freefall.freebsd.org (Postfix) with ESMTPS id B8F7412880; Thu, 21 Nov 2019 16:32:56 +0000 (UTC) (envelope-from gjb@freebsd.org) Date: Thu, 21 Nov 2019 16:32:54 +0000 From: Glen Barber To: Ian Lepore Cc: Brooks Davis , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org, FreeBSD Ports Management Team , Colin Percival Subject: Re: svn commit: r354909 - in head: . share/mk Message-ID: <20191121163254.GO5599@FreeBSD.org> References: <201911201836.xAKIawWt053874@repo.freebsd.org> <20191121161337.GA92849@FreeBSD.org> <20191121162311.GN5599@FreeBSD.org> <3ed399dae42291005a5b88e426018697b47d8419.camel@freebsd.org> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="Zpx5Rz5PkYgiNBE6" Content-Disposition: inline In-Reply-To: <3ed399dae42291005a5b88e426018697b47d8419.camel@freebsd.org> User-Agent: Mutt/1.12.1 (2019-06-15) X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 21 Nov 2019 16:32:57 -0000 --Zpx5Rz5PkYgiNBE6 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Thu, Nov 21, 2019 at 09:28:50AM -0700, Ian Lepore wrote: > On Thu, 2019-11-21 at 16:23 +0000, Glen Barber wrote: > > On Thu, Nov 21, 2019 at 04:13:37PM +0000, Glen Barber wrote: > > > On Wed, Nov 20, 2019 at 06:36:58PM +0000, Brooks Davis wrote: > > > > Author: brooks > > > > Date: Wed Nov 20 18:36:58 2019 > > > > New Revision: 354909 > > > > URL: https://svnweb.freebsd.org/changeset/base/354909 > > > >=20 > > > > Log: > > > > Make the warning for deprecated NO_ variables an error. > > > > =20 > > > > Support for NO_CTF, NO_DEBUG_FILES, NO_INSTALLLIB, NO_MAN, > > > > NO_PROFILE, > > > > and NO_WARNS as deprecated in 2014 with a warning added for > > > > each one > > > > found. Turn these into error in preperation for removal of > > > > compatability > > > > support before FreeBSD 13. > > > > =20 > > > > Reviewed by: imp > > > > Relnotes: yes > > > > Sponsored by: DARPA, AFRL > > > > Differential Revision: https://reviews.freebsd.org/D22448 > > > >=20 > > > > Modified: head/share/mk/bsd.opts.mk > > > > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D > > > > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D > > > > --- head/share/mk/bsd.opts.mk Wed Nov 20 18:12:01 2019 ( > > > > r354908) > > > > +++ head/share/mk/bsd.opts.mk Wed Nov 20 18:36:58 2019 ( > > > > r354909) > > > > @@ -100,7 +100,7 @@ __DEFAULT_DEPENDENT_OPTIONS =3D \ > > > > PROFILE \ > > > > WARNS > > > > .if defined(NO_${var}) > > > > -.warning "NO_${var} is defined, but deprecated. Please use > > > > MK_${var}=3Dno instead." > > > > +.error "NO_${var} is defined, but deprecated. Please use > > > > MK_${var}=3Dno instead." > > > > MK_${var}:=3Dno > > > > .endif > > > > .endfor > > > >=20 > > >=20 > > > Had this been exp-run tested? This breaks at least the > > > net/bsdec2-image-upload port, which does *not* set NO_MAN > > > explicitly in > > > its Makefile. I suspect at least several other ports are now > > > implicitly > > > broken as result of this change. > > >=20 > >=20 > > In fact, on a quick search through ports/*/*/Makefile, I do not see > > NO_MAN defined *anywhere*. So, this is pulled in from somewhere > > else, > > which now I have a feeling more ports than I initially thought are > > now > > broken. > >=20 >=20 > Your search was too narrow. Re-do it as "grep -Rw NO_MAN *" from > /usr/ports and you'll get a lot of hits from within files/ dirs. >=20 Thank you for that; I forgot about the files/ directories. Nonetheless, net/bsdec2-image-upload still does not explicitly set this knob. Glen --Zpx5Rz5PkYgiNBE6 Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAEBCAAdFiEEjRJAPC5sqwhs9k2jAxRYpUeP4pMFAl3WvDYACgkQAxRYpUeP 4pM33w/9HDQsEin+9IiRyDWUt2QZa9xjg7dqKVEvx1M2uSYRlHb9CTApj3yRJiIO yunN+O9zXoJxulYotUsueXBT5kkMSTmj3Z1eAReuL1ykEiu7bqjVpj3WlZHnq//p 410/f7+V4Vx2IDKaoJZR8ZaK8ZorjU6ncXJ53nRguG6gTL0n6fv1CxnG04h3zo+l 7evwL4lgYJZYjRIjsP/jc4EMUbuoCY5C9/sDlt4D0qEEv93Qbx9L9YLAlD1pUiLu kYw+5+O7owSZpv9lZnxK0ObcUHo0gWI0hZ5DH3oCMinIxT8SuDDwdnFFFpdstn9g ury/IMypElzBWHC0CHJi4VcjC0XQG0i/fxlM8m8KrwIr++WDLbZeLVjCxqHE6EKK Vury7KEcaitrbf1/ZkoB/eRvDBvquaa/u0GkxwHMdEIRqvdljZy1o0OGpL6mX3Oj 33X2zf8Hg2zfRhNy6aZoP9tiue+uyUI3BIGIJGPyuv9V6LAqsDiW6JAAAwLZBWeI jDvwGVzHs79qgz3r7ANXGuJY0XvIBlPYebBwlNGlkqoPacXRz44g4RgOj1agsDyV +UWT6ENFqXNjzTrs7JUKDUV3gIaTNOftvpgamdos9lm+eTLWdOGRg5JVz8phUKzW Ci2/qPcZ8Q8bbIkRC6+UTYz41eSHFdEIqS839WBQgtv425maXTI= =eyXc -----END PGP SIGNATURE----- --Zpx5Rz5PkYgiNBE6-- From owner-svn-src-all@freebsd.org Thu Nov 21 16:42:25 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id E0D061C4A0C; Thu, 21 Nov 2019 16:42:25 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47Jlhx5YfRz4db4; Thu, 21 Nov 2019 16:42:25 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id A35A1E354; Thu, 21 Nov 2019 16:42:25 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xALGgPrN041443; Thu, 21 Nov 2019 16:42:25 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xALGgPko041441; Thu, 21 Nov 2019 16:42:25 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201911211642.xALGgPko041441@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Thu, 21 Nov 2019 16:42:25 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354969 - in head/sys/dev/usb: . video X-SVN-Group: head X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: in head/sys/dev/usb: . video X-SVN-Commit-Revision: 354969 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 21 Nov 2019 16:42:25 -0000 Author: hselasky Date: Thu Nov 21 16:42:25 2019 New Revision: 354969 URL: https://svnweb.freebsd.org/changeset/base/354969 Log: Add USB ID for Diamond Multimedia BVU195 Display Link device. Submitted by: darius@dons.net.au PR: 242128 MFC after: 1 week Sponsored by: Mellanox Technologies Modified: head/sys/dev/usb/usbdevs head/sys/dev/usb/video/udl.c Modified: head/sys/dev/usb/usbdevs ============================================================================== --- head/sys/dev/usb/usbdevs Thu Nov 21 15:59:33 2019 (r354968) +++ head/sys/dev/usb/usbdevs Thu Nov 21 16:42:25 2019 (r354969) @@ -1783,6 +1783,7 @@ product DISPLAYLINK M01061 0x01e2 Lenovo DVI product DISPLAYLINK SWDVI 0x024c SUNWEIT DVI product DISPLAYLINK NBDOCK 0x0215 VideoHome NBdock1920 product DISPLAYLINK LUM70 0x02a9 Lilliput UM-70 +product DISPLAYLINK DVI_19 0x0360 USB to DVI-19 product DISPLAYLINK UM7X0 0x401a nanovision MiMo product DISPLAYLINK LT1421 0x03e0 Lenovo ThinkVision LT1421 product DISPLAYLINK POLARIS2 0x0117 Polaris2 USB dock Modified: head/sys/dev/usb/video/udl.c ============================================================================== --- head/sys/dev/usb/video/udl.c Thu Nov 21 15:59:33 2019 (r354968) +++ head/sys/dev/usb/video/udl.c Thu Nov 21 16:42:25 2019 (r354969) @@ -179,6 +179,7 @@ static const STRUCT_USB_HOST_ID udl_devs[] = { {USB_VPI(USB_VENDOR_DISPLAYLINK, USB_PRODUCT_DISPLAYLINK_POLARIS2, DLUNK)}, {USB_VPI(USB_VENDOR_DISPLAYLINK, USB_PRODUCT_DISPLAYLINK_LT1421, DLUNK)}, {USB_VPI(USB_VENDOR_DISPLAYLINK, USB_PRODUCT_DISPLAYLINK_ITEC, DL165)}, + {USB_VPI(USB_VENDOR_DISPLAYLINK, USB_PRODUCT_DISPLAYLINK_DVI_19, DL165)}, }; static void From owner-svn-src-all@freebsd.org Thu Nov 21 18:14:27 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 39A811C710B; Thu, 21 Nov 2019 18:14:27 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47Jnl70psvz3G5p; Thu, 21 Nov 2019 18:14:27 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 0032AF3DE; Thu, 21 Nov 2019 18:14:26 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xALIEQZ3094708; Thu, 21 Nov 2019 18:14:26 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xALIEQuA094706; Thu, 21 Nov 2019 18:14:26 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <201911211814.xALIEQuA094706@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Thu, 21 Nov 2019 18:14:26 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354970 - in head: share/mk sys/conf X-SVN-Group: head X-SVN-Commit-Author: jhb X-SVN-Commit-Paths: in head: share/mk sys/conf X-SVN-Commit-Revision: 354970 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 21 Nov 2019 18:14:27 -0000 Author: jhb Date: Thu Nov 21 18:14:26 2019 New Revision: 354970 URL: https://svnweb.freebsd.org/changeset/base/354970 Log: Add a kmod.opts.mk. This Makefile sets KERN_OPTS. This permits kernel module Makefiles to use KERN_OPTS to control the value of variables such as SRCS that are used by bsd.kmod.mk for KERN_OPTS values that honor WITH/WITHOUT options for standalone builds. Added: head/share/mk/kmod.opts.mk (contents, props changed) head/sys/conf/kmod.opts.mk (contents, props changed) Modified: head/sys/conf/kmod.mk Added: head/share/mk/kmod.opts.mk ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/share/mk/kmod.opts.mk Thu Nov 21 18:14:26 2019 (r354970) @@ -0,0 +1,4 @@ +# $FreeBSD$ + +.include +.include "${SYSDIR}/conf/kmod.opts.mk" Modified: head/sys/conf/kmod.mk ============================================================================== --- head/sys/conf/kmod.mk Thu Nov 21 16:42:25 2019 (r354969) +++ head/sys/conf/kmod.mk Thu Nov 21 18:14:26 2019 (r354970) @@ -73,12 +73,7 @@ KMODUNLOAD?= /sbin/kldunload KMODISLOADED?= /sbin/kldstat -q -n OBJCOPY?= objcopy -.include -# Grab all the options for a kernel build. For backwards compat, we need to -# do this after bsd.own.mk. -.include "kern.opts.mk" -.include -.include "config.mk" +.include "kmod.opts.mk" .include .SUFFIXES: .out .o .c .cc .cxx .C .y .l .s .S .m Added: head/sys/conf/kmod.opts.mk ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/conf/kmod.opts.mk Thu Nov 21 18:14:26 2019 (r354970) @@ -0,0 +1,16 @@ +# $FreeBSD$ +# +# Handle options (KERN_OPTS) for kernel module options. This can be included earlier in a kmod Makefile +# to allow KERN_OPTS to control SRCS, etc. + +.if !target(____) +____: + +.include +# Grab all the options for a kernel build. For backwards compat, we need to +# do this after bsd.own.mk. +.include "kern.opts.mk" +.include +.include "config.mk" + +.endif # !target(____) From owner-svn-src-all@freebsd.org Thu Nov 21 18:17:18 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 7D6A71C7283; Thu, 21 Nov 2019 18:17:18 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from smtp.freebsd.org (smtp.freebsd.org [IPv6:2610:1c1:1:606c::24b:4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "smtp.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47JnpQ2hDgz3GGV; Thu, 21 Nov 2019 18:17:18 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from John-Baldwins-MacBook-Pro-5.local (ralph.baldwin.cx [66.234.199.215]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client did not present a certificate) (Authenticated sender: jhb) by smtp.freebsd.org (Postfix) with ESMTPSA id C72B29D9D; Thu, 21 Nov 2019 18:17:17 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Subject: Re: svn commit: r354970 - in head: share/mk sys/conf From: John Baldwin To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org References: <201911211814.xALIEQuA094706@repo.freebsd.org> Openpgp: preference=signencrypt Autocrypt: addr=jhb@FreeBSD.org; keydata= mQGiBETQ+XcRBADMFybiq69u+fJRy/0wzqTNS8jFfWaBTs5/OfcV7wWezVmf9sgwn8TW0Dk0 c9MBl0pz+H01dA2ZSGZ5fXlmFIsee1WEzqeJzpiwd/pejPgSzXB9ijbLHZ2/E0jhGBcVy5Yo /Tw5+U/+laeYKu2xb0XPvM0zMNls1ah5OnP9a6Ql6wCgupaoMySb7DXm2LHD1Z9jTsHcAQMD /1jzh2BoHriy/Q2s4KzzjVp/mQO5DSm2z14BvbQRcXU48oAosHA1u3Wrov6LfPY+0U1tG47X 1BGfnQH+rNAaH0livoSBQ0IPI/8WfIW7ub4qV6HYwWKVqkDkqwcpmGNDbz3gfaDht6nsie5Z pcuCcul4M9CW7Md6zzyvktjnbz61BADGDCopfZC4of0Z3Ka0u8Wik6UJOuqShBt1WcFS8ya1 oB4rc4tXfSHyMF63aPUBMxHR5DXeH+EO2edoSwViDMqWk1jTnYza51rbGY+pebLQOVOxAY7k do5Ordl3wklBPMVEPWoZ61SdbcjhHVwaC5zfiskcxj5wwXd2E9qYlBqRg7QeSm9obiBCYWxk d2luIDxqaGJARnJlZUJTRC5vcmc+iGAEExECACAFAkTQ+awCGwMGCwkIBwMCBBUCCAMEFgID AQIeAQIXgAAKCRBy3lIGd+N/BI6RAJ9S97fvbME+3hxzE3JUyUZ6vTewDACdE1stFuSfqMvM jomvZdYxIYyTUpC5Ag0ERND5ghAIAPwsO0B7BL+bz8sLlLoQktGxXwXQfS5cInvL17Dsgnr3 1AKa94j9EnXQyPEj7u0d+LmEe6CGEGDh1OcGFTMVrof2ZzkSy4+FkZwMKJpTiqeaShMh+Goj XlwIMDxyADYvBIg3eN5YdFKaPQpfgSqhT+7El7w+wSZZD8pPQuLAnie5iz9C8iKy4/cMSOrH YUK/tO+Nhw8Jjlw94Ik0T80iEhI2t+XBVjwdfjbq3HrJ0ehqdBwukyeJRYKmbn298KOFQVHO EVbHA4rF/37jzaMadK43FgJ0SAhPPF5l4l89z5oPu0b/+5e2inA3b8J3iGZxywjM+Csq1tqz hltEc7Q+E08AAwUIAL+15XH8bPbjNJdVyg2CMl10JNW2wWg2Q6qdljeaRqeR6zFus7EZTwtX sNzs5bP8y51PSUDJbeiy2RNCNKWFMndM22TZnk3GNG45nQd4OwYK0RZVrikalmJY5Q6m7Z16 4yrZgIXFdKj2t8F+x613/SJW1lIr9/bDp4U9tw0V1g3l2dFtD3p3ZrQ3hpoDtoK70ioIAjjH aIXIAcm3FGZFXy503DOA0KaTWwvOVdYCFLm3zWuSOmrX/GsEc7ovasOWwjPn878qVjbUKWwx Q4QkF4OhUV9zPtf9tDSAZ3x7QSwoKbCoRCZ/xbyTUPyQ1VvNy/mYrBcYlzHodsaqUDjHuW+I SQQYEQIACQUCRND5ggIbDAAKCRBy3lIGd+N/BCO8AJ9j1dWVQWxw/YdTbEyrRKOY8YZNwwCf afMAg8QvmOWnHx3wl8WslCaXaE8= Message-ID: Date: Thu, 21 Nov 2019 10:17:13 -0800 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.12; rv:60.0) Gecko/20100101 Thunderbird/60.9.1 MIME-Version: 1.0 In-Reply-To: <201911211814.xALIEQuA094706@repo.freebsd.org> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 21 Nov 2019 18:17:18 -0000 On 11/21/19 10:14 AM, John Baldwin wrote: > Author: jhb > Date: Thu Nov 21 18:14:26 2019 > New Revision: 354970 > URL: https://svnweb.freebsd.org/changeset/base/354970 > > Log: > Add a kmod.opts.mk. > > This Makefile sets KERN_OPTS. This permits kernel module Makefiles to > use KERN_OPTS to control the value of variables such as SRCS that are > used by bsd.kmod.mk for KERN_OPTS values that honor WITH/WITHOUT > options for standalone builds. Closed editor too quickly, missed: Reviewed by: imp Differential Revision: https://reviews.freebsd.org/D22118 -- John Baldwin From owner-svn-src-all@freebsd.org Thu Nov 21 18:21:30 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id B85F41C759C; Thu, 21 Nov 2019 18:21:30 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47JnvG4TS2z3GjF; Thu, 21 Nov 2019 18:21:30 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 7CF93F54B; Thu, 21 Nov 2019 18:21:30 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xALILU5m098199; Thu, 21 Nov 2019 18:21:30 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xALILU44098198; Thu, 21 Nov 2019 18:21:30 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <201911211821.xALILU44098198@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Thu, 21 Nov 2019 18:21:30 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354971 - head/sys/modules/geom/geom_uzip X-SVN-Group: head X-SVN-Commit-Author: jhb X-SVN-Commit-Paths: head/sys/modules/geom/geom_uzip X-SVN-Commit-Revision: 354971 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 21 Nov 2019 18:21:30 -0000 Author: jhb Date: Thu Nov 21 18:21:30 2019 New Revision: 354971 URL: https://svnweb.freebsd.org/changeset/base/354971 Log: Use kmod.opts.mk to fix standalone build. Modified: head/sys/modules/geom/geom_uzip/Makefile Modified: head/sys/modules/geom/geom_uzip/Makefile ============================================================================== --- head/sys/modules/geom/geom_uzip/Makefile Thu Nov 21 18:14:26 2019 (r354970) +++ head/sys/modules/geom/geom_uzip/Makefile Thu Nov 21 18:21:30 2019 (r354971) @@ -1,5 +1,7 @@ # $FreeBSD$ +.include + .PATH: ${SRCTOP}/sys/geom/uzip ${SRCTOP}/sys/net KMOD= geom_uzip From owner-svn-src-all@freebsd.org Thu Nov 21 18:49:55 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 8B3711C7CA5; Thu, 21 Nov 2019 18:49:55 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47JpX336RLz3Hk0; Thu, 21 Nov 2019 18:49:55 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 49988F935; Thu, 21 Nov 2019 18:49:55 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xALIntUt012593; Thu, 21 Nov 2019 18:49:55 GMT (envelope-from imp@FreeBSD.org) Received: (from imp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xALInsCu012591; Thu, 21 Nov 2019 18:49:54 GMT (envelope-from imp@FreeBSD.org) Message-Id: <201911211849.xALInsCu012591@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: imp set sender to imp@FreeBSD.org using -f From: Warner Losh Date: Thu, 21 Nov 2019 18:49:54 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354972 - in head/sys: arm/include mips/include X-SVN-Group: head X-SVN-Commit-Author: imp X-SVN-Commit-Paths: in head/sys: arm/include mips/include X-SVN-Commit-Revision: 354972 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 21 Nov 2019 18:49:55 -0000 Author: imp Date: Thu Nov 21 18:49:54 2019 New Revision: 354972 URL: https://svnweb.freebsd.org/changeset/base/354972 Log: Remove two obsolete comments that reference splhigh/splx. Modified: head/sys/arm/include/profile.h head/sys/mips/include/profile.h Modified: head/sys/arm/include/profile.h ============================================================================== --- head/sys/arm/include/profile.h Thu Nov 21 18:21:30 2019 (r354971) +++ head/sys/arm/include/profile.h Thu Nov 21 18:49:54 2019 (r354972) @@ -114,12 +114,6 @@ void user(void); #include #include -/* - * splhigh() and splx() are heavyweight, and call mcount(). Therefore - * we disabled interrupts (IRQ, but not FIQ) directly on the CPU. - * - * We're lucky that the CPSR and 's' both happen to be 'int's. - */ #define MCOUNT_ENTER(s) {s = intr_disable(); } /* kill IRQ */ #define MCOUNT_EXIT(s) {intr_restore(s); } /* restore old value */ Modified: head/sys/mips/include/profile.h ============================================================================== --- head/sys/mips/include/profile.h Thu Nov 21 18:21:30 2019 (r354971) +++ head/sys/mips/include/profile.h Thu Nov 21 18:49:54 2019 (r354972) @@ -76,13 +76,6 @@ ".set at"); #ifdef _KERNEL -/* - * The following two macros do splhigh and splx respectively. - * They have to be defined this way because these are real - * functions on the MIPS, and we do not want to invoke mcount - * recursively. - */ - #define MCOUNT_DECL(s) u_long s; #ifdef SMP extern int mcount_lock; From owner-svn-src-all@freebsd.org Thu Nov 21 19:07:58 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 44DAB1C82DE; Thu, 21 Nov 2019 19:07:58 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from springbank.echomania.com (springbank.echomania.com [IPv6:2a01:7c8:aab2:81::1]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "springbank.echomania.com", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47Jpws67rZz3JZJ; Thu, 21 Nov 2019 19:07:57 +0000 (UTC) (envelope-from dim@FreeBSD.org) X-Virus-Scanned: Debian amavisd-new at springbank.echomania.com Received: from [IPv6:2001:470:7a58::a9b6:ac6d:ea45:224e] (unknown [IPv6:2001:470:7a58:0:a9b6:ac6d:ea45:224e]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by springbank.echomania.com (Postfix) with ESMTPSA id 1671D580227; Thu, 21 Nov 2019 20:07:53 +0100 (CET) From: Dimitry Andric Message-Id: Content-Type: multipart/signed; boundary="Apple-Mail=_C13C8E61-27C0-4564-B130-AA556F53A5A2"; protocol="application/pgp-signature"; micalg=pgp-sha1 Mime-Version: 1.0 (Mac OS X Mail 12.4 \(3445.104.11\)) Subject: Re: svn commit: r354803 - in stable: 11/contrib/llvm/lib/Transforms/InstCombine 12/contrib/llvm/lib/Transforms/InstCombine Date: Thu, 21 Nov 2019 20:07:46 +0100 In-Reply-To: Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org To: Ronald Klop References: <201911180704.xAI74xAM039993@repo.freebsd.org> X-Mailer: Apple Mail (2.3445.104.11) X-Rspamd-Queue-Id: 47Jpws67rZz3JZJ X-Spamd-Bar: - Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-1.36 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-0.83)[-0.831,0]; NEURAL_HAM_LONG(-0.53)[-0.534,0]; ASN(0.00)[asn:20857, ipnet:2a01:7c8::/32, country:NL] X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 21 Nov 2019 19:07:58 -0000 --Apple-Mail=_C13C8E61-27C0-4564-B130-AA556F53A5A2 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=us-ascii On 21 Nov 2019, at 16:06, Ronald Klop wrote: >=20 > On Mon, 18 Nov 2019 08:04:59 +0100, Dimitry Andric = wrote: >> Author: dim >> Date: Mon Nov 18 07:04:59 2019 >> New Revision: 354803 >> URL: https://svnweb.freebsd.org/changeset/base/354803 >>=20 >> Log: >> MFC r354724: >> Merge commit 5bbb604bb from llvm git (by Craig Topper): >> [InstCombine] Disable some portions of foldGEPICmp for GEPs that >> return a vector of pointers. Fix other portions. >> llvm-svn: 370114 >> This should fix instances of 'Assertion failed: (isa(Val) && >> "cast() argument of incompatible type!"), function cast, file >> /usr/src/contrib/llvm/include/llvm/Support/Casting.h, line 255', = when >> building openjdk8 for aarch64 and armv7. >> Reported by: jbeich >> PR: 236566 >>=20 >=20 >=20 > Are there plans for an errata notice for releng-12.1 with this fix? = That would keep Openjdk8 as a pkg on aarch64 after 12.0 goes EOL and = pkgs will be build on 12.1. There should be no need for this, as release versions (and stable branches) have their copies of clang compiled with assertions disabled. Hence, the assertion reported in PR 236566 cannot occur, unless you have explicitly turned them on again and recompiled the toolchain components. I have tried compiling the original test case from the PR on both 12.0-RELEASE and 12.1-RELEASE. On 12.0-RELEASE, which has clang version 6.0.1 (tags/RELEASE_601/final 335540), it complains that the -fno-delete-null-pointer-checks and -faddrsig options are unknown, but this is to be expected. The former was important to get the original assertion. If I remove both those options, the test case compiles just fine. On 12.1-RELEASE, which has clang version 8.0.1 (tags/RELEASE_801/final 366581), the test case compiles just fine, out of the box. -Dimitry --Apple-Mail=_C13C8E61-27C0-4564-B130-AA556F53A5A2 Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename=signature.asc Content-Type: application/pgp-signature; name=signature.asc Content-Description: Message signed with OpenPGP -----BEGIN PGP SIGNATURE----- Version: GnuPG/MacGPG2 v2.2 iF0EARECAB0WIQR6tGLSzjX8bUI5T82wXqMKLiCWowUCXdbgggAKCRCwXqMKLiCW o04+AJ9U33dfByow9sRNWHImOn178dgYDgCeO5atGS85s+g4Uq9p/Mk4fTqEnvs= =w6wk -----END PGP SIGNATURE----- --Apple-Mail=_C13C8E61-27C0-4564-B130-AA556F53A5A2-- From owner-svn-src-all@freebsd.org Thu Nov 21 19:13:06 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 1427B1C8549; Thu, 21 Nov 2019 19:13:06 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47Jq2n6jDNz3K0c; Thu, 21 Nov 2019 19:13:05 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id AF48BFE87; Thu, 21 Nov 2019 19:13:05 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xALJD5TA030032; Thu, 21 Nov 2019 19:13:05 GMT (envelope-from ian@FreeBSD.org) Received: (from ian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xALJD52E030031; Thu, 21 Nov 2019 19:13:05 GMT (envelope-from ian@FreeBSD.org) Message-Id: <201911211913.xALJD52E030031@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ian set sender to ian@FreeBSD.org using -f From: Ian Lepore Date: Thu, 21 Nov 2019 19:13:05 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354973 - head/sys/dev/iicbus X-SVN-Group: head X-SVN-Commit-Author: ian X-SVN-Commit-Paths: head/sys/dev/iicbus X-SVN-Commit-Revision: 354973 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 21 Nov 2019 19:13:06 -0000 Author: ian Date: Thu Nov 21 19:13:05 2019 New Revision: 354973 URL: https://svnweb.freebsd.org/changeset/base/354973 Log: Rewrite iicdev_writeto() to use a single buffer and a single iic_msg, rather than effectively doing scatter/gather IO with a pair of iic_msgs that direct the controller to do a single transfer with no bus STOP/START between the two buffers. It turns out we have multiple i2c hardware drivers that don't honor the NOSTOP and NOSTART flags; sometimes they just try to do the transfers anyway, creating confusing failures or leading to corrupted data. Modified: head/sys/dev/iicbus/iiconf.c Modified: head/sys/dev/iicbus/iiconf.c ============================================================================== --- head/sys/dev/iicbus/iiconf.c Thu Nov 21 18:49:54 2019 (r354972) +++ head/sys/dev/iicbus/iiconf.c Thu Nov 21 19:13:05 2019 (r354973) @@ -540,25 +540,47 @@ iicdev_readfrom(device_t slavedev, uint8_t regaddr, vo int iicdev_writeto(device_t slavedev, uint8_t regaddr, void *buffer, uint16_t buflen, int waithow) { - struct iic_msg msgs[2]; - uint8_t slaveaddr; + struct iic_msg msg; + uint8_t local_buffer[32]; + uint8_t *bufptr; + size_t bufsize; + int error; /* - * Two transfers back to back with no stop or start between them; first - * we write the address then we write the data to that address, all in a - * single transfer from two scattered buffers. + * Ideally, we would do two transfers back to back with no stop or start + * between them using an array of 2 iic_msgs; first we'd write the + * address byte using the IIC_M_NOSTOP flag, then we write the data + * using IIC_M_NOSTART, all in a single transfer. Unfortunately, + * several i2c hardware drivers don't support that (perhaps because the + * hardware itself can't support it). So instead we gather the + * scattered bytes into a single buffer here before writing them using a + * single iic_msg. This function is typically used to write a few bytes + * at a time, so we try to use a small local buffer on the stack, but + * fall back to allocating a temporary buffer when necessary. */ - slaveaddr = iicbus_get_addr(slavedev); - msgs[0].slave = slaveaddr; - msgs[0].flags = IIC_M_WR | IIC_M_NOSTOP; - msgs[0].len = 1; - msgs[0].buf = ®addr; + bufsize = buflen + 1; + if (bufsize <= sizeof(local_buffer)) { + bufptr = local_buffer; + } else { + bufptr = malloc(bufsize, M_DEVBUF, + (waithow & IIC_WAIT) ? M_WAITOK : M_NOWAIT); + if (bufptr == NULL) + return (errno2iic(ENOMEM)); + } - msgs[1].slave = slaveaddr; - msgs[1].flags = IIC_M_WR | IIC_M_NOSTART; - msgs[1].len = buflen; - msgs[1].buf = buffer; + bufptr[0] = regaddr; + memcpy(&bufptr[1], buffer, buflen); - return (iicbus_transfer_excl(slavedev, msgs, nitems(msgs), waithow)); + msg.slave = iicbus_get_addr(slavedev); + msg.flags = IIC_M_WR; + msg.len = bufsize; + msg.buf = bufptr; + + error = iicbus_transfer_excl(slavedev, &msg, 1, waithow); + + if (bufptr != local_buffer) + free(bufptr, M_DEVBUF); + + return (error); } From owner-svn-src-all@freebsd.org Thu Nov 21 19:30:33 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 242E01C8B7E; Thu, 21 Nov 2019 19:30:33 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47JqQx0xDzz3KnX; Thu, 21 Nov 2019 19:30:33 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 00C891805E; Thu, 21 Nov 2019 19:30:33 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xALJUWwd036566; Thu, 21 Nov 2019 19:30:32 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xALJUVEP036559; Thu, 21 Nov 2019 19:30:31 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <201911211930.xALJUVEP036559@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Thu, 21 Nov 2019 19:30:31 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354974 - in head/sys: conf dev/cxgbe dev/cxgbe/common dev/cxgbe/crypto dev/cxgbe/firmware dev/cxgbe/tom modules/cxgbe/if_cxgbe X-SVN-Group: head X-SVN-Commit-Author: jhb X-SVN-Commit-Paths: in head/sys: conf dev/cxgbe dev/cxgbe/common dev/cxgbe/crypto dev/cxgbe/firmware dev/cxgbe/tom modules/cxgbe/if_cxgbe X-SVN-Commit-Revision: 354974 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 21 Nov 2019 19:30:33 -0000 Author: jhb Date: Thu Nov 21 19:30:31 2019 New Revision: 354974 URL: https://svnweb.freebsd.org/changeset/base/354974 Log: NIC KTLS for Chelsio T6 adapters. This adds support for ifnet (NIC) KTLS using Chelsio T6 adapters. Unlike the TOE-based KTLS in r353328, NIC TLS works with non-TOE connections. NIC KTLS on T6 is not able to use the normal TSO (LSO) path to segment the encrypted TLS frames output by the crypto engine. Instead, the TOE is placed into a special setup to permit "dummy" connections to be associated with regular sockets using KTLS. This permits using the TOE to segment the encrypted TLS records. However, this approach does have some limitations: 1) Regular TOE sockets cannot be used when the TOE is in this special mode. One can use either TOE and TOE-based KTLS or NIC KTLS, but not both at the same time. 2) In NIC KTLS mode, the TOE is only able to accept a per-connection timestamp offset that varies in the upper 4 bits. Put another way, only connections whose timestamp offset has the 28 lower bits cleared can use NIC KTLS and generate correct timestamps. The driver will refuse to enable NIC KTLS on connections with a timestamp offset with any of the lower 28 bits set. To use NIC KTLS, users can either disable TCP timestamps by setting the net.inet.tcp.rfc1323 sysctl to 0, or apply a local patch to the tcp_new_ts_offset() function to clear the lower 28 bits of the generated offset. 3) Because the TCP segmentation relies on fields mirrored in a TCB in the TOE, not all fields in a TCP packet can be sent in the TCP segments generated from a TLS record. Specifically, for packets containing TCP options other than timestamps, the driver will inject an "empty" TCP packet holding the requested options (e.g. a SACK scoreboard) along with the segments from the TLS record. These empty TCP packets are counted by the dev.cc.N.txq.M.kern_tls_options sysctls. Unlike TOE TLS which is able to buffer encrypted TLS records in on-card memory to handle retransmits, NIC KTLS must re-encrypt TLS records for retransmit requests as well as non-retransmit requests that do not include the start of a TLS record but do include the trailer. The T6 NIC KTLS code tries to optimize some of the cases for requests to transmit partial TLS records. In particular it attempts to minimize sending "waste" bytes that have to be given as input to the crypto engine but are not needed on the wire to satisfy mbufs sent from the TCP stack down to the driver. TCP packets for TLS requests are broken down into the following classes (with associated counters): - Mbufs that send an entire TLS record in full do not have any waste bytes (dev.cc.N.txq.M.kern_tls_full). - Mbufs that send a short TLS record that ends before the end of the trailer (dev.cc.N.txq.M.kern_tls_short). For sockets using AES-CBC, the encryption must always start at the beginning, so if the mbuf starts at an offset into the TLS record, the offset bytes will be "waste" bytes. For sockets using AES-GCM, the encryption can start at the 16 byte block before the starting offset capping the waste at 15 bytes. - Mbufs that send a partial TLS record that has a non-zero starting offset but ends at the end of the trailer (dev.cc.N.txq.M.kern_tls_partial). In order to compute the authentication hash stored in the trailer, the entire TLS record must be sent as input to the crypto engine, so the bytes before the offset are always "waste" bytes. In addition, other per-txq sysctls are provided: - dev.cc.N.txq.M.kern_tls_cbc: Count of sockets sent via this txq using AES-CBC. - dev.cc.N.txq.M.kern_tls_gcm: Count of sockets sent via this txq using AES-GCM. - dev.cc.N.txq.M.kern_tls_fin: Count of empty FIN-only packets sent to compensate for the TOE engine not being able to set FIN on the last segment of a TLS record if the TLS record mbuf had FIN set. - dev.cc.N.txq.M.kern_tls_records: Count of TLS records sent via this txq including full, short, and partial records. - dev.cc.N.txq.M.kern_tls_octets: Count of non-waste bytes (TLS header and payload) sent for TLS record requests. - dev.cc.N.txq.M.kern_tls_waste: Count of waste bytes sent for TLS record requests. To enable NIC KTLS with T6, set the following tunables prior to loading the cxgbe(4) driver: hw.cxgbe.config_file=kern_tls hw.cxgbe.kern_tls=1 Reviewed by: np Sponsored by: Chelsio Communications Differential Revision: https://reviews.freebsd.org/D21962 Added: head/sys/dev/cxgbe/crypto/t4_kern_tls.c (contents, props changed) head/sys/dev/cxgbe/firmware/t6fw_cfg_kern_tls.txt (contents, props changed) Modified: head/sys/conf/files head/sys/dev/cxgbe/adapter.h head/sys/dev/cxgbe/common/t4_msg.h head/sys/dev/cxgbe/common/t4_regs.h head/sys/dev/cxgbe/common/t4_tcb.h head/sys/dev/cxgbe/offload.h head/sys/dev/cxgbe/t4_l2t.c head/sys/dev/cxgbe/t4_l2t.h head/sys/dev/cxgbe/t4_main.c head/sys/dev/cxgbe/t4_sge.c head/sys/dev/cxgbe/tom/t4_connect.c head/sys/dev/cxgbe/tom/t4_listen.c head/sys/modules/cxgbe/if_cxgbe/Makefile Modified: head/sys/conf/files ============================================================================== --- head/sys/conf/files Thu Nov 21 19:13:05 2019 (r354973) +++ head/sys/conf/files Thu Nov 21 19:30:31 2019 (r354974) @@ -1423,6 +1423,8 @@ dev/cxgbe/common/t4_hw.c optional cxgbe pci \ compile-with "${NORMAL_C} -I$S/dev/cxgbe" dev/cxgbe/common/t4vf_hw.c optional cxgbev pci \ compile-with "${NORMAL_C} -I$S/dev/cxgbe" +dev/cxgbe/crypto/t4_kern_tls.c optional cxgbe pci kern_tls \ + compile-with "${NORMAL_C} -I$S/dev/cxgbe" dev/cxgbe/crypto/t4_keyctx.c optional cxgbe pci \ compile-with "${NORMAL_C} -I$S/dev/cxgbe" dev/cxgbe/cudbg/cudbg_common.c optional cxgbe \ Modified: head/sys/dev/cxgbe/adapter.h ============================================================================== --- head/sys/dev/cxgbe/adapter.h Thu Nov 21 19:13:05 2019 (r354973) +++ head/sys/dev/cxgbe/adapter.h Thu Nov 21 19:30:31 2019 (r354974) @@ -35,6 +35,7 @@ #include #include +#include #include #include #include @@ -158,6 +159,7 @@ enum { ADAP_ERR = (1 << 5), BUF_PACKING_OK = (1 << 6), IS_VF = (1 << 7), + KERN_TLS_OK = (1 << 8), CXGBE_BUSY = (1 << 9), @@ -380,7 +382,7 @@ enum { CPL_COOKIE_TOM, CPL_COOKIE_HASHFILTER, CPL_COOKIE_ETHOFLD, - CPL_COOKIE_AVAILABLE3, + CPL_COOKIE_KERN_TLS, NUM_CPL_COOKIES = 8 /* Limited by M_COOKIE. Do not increase. */ }; @@ -582,8 +584,25 @@ struct sge_txq { uint64_t txpkts0_pkts; /* # of frames in type0 coalesced tx WRs */ uint64_t txpkts1_pkts; /* # of frames in type1 coalesced tx WRs */ uint64_t raw_wrs; /* # of raw work requests (alloc_wr_mbuf) */ + uint64_t tls_wrs; /* # of TLS work requests */ + uint64_t kern_tls_records; + uint64_t kern_tls_short; + uint64_t kern_tls_partial; + uint64_t kern_tls_full; + uint64_t kern_tls_octets; + uint64_t kern_tls_waste; + uint64_t kern_tls_options; + uint64_t kern_tls_header; + uint64_t kern_tls_fin; + uint64_t kern_tls_fin_short; + uint64_t kern_tls_cbc; + uint64_t kern_tls_gcm; + /* stats for not-that-common events */ + + /* Optional scratch space for constructing work requests. */ + uint8_t ss[SGE_MAX_WR_LEN] __aligned(16); } __aligned(CACHE_LINE_SIZE); /* rxq: SGE ingress queue + SGE free list + miscellaneous items */ @@ -840,6 +859,7 @@ struct adapter { struct smt_data *smt; /* Source MAC Table */ struct tid_info tids; vmem_t *key_map; + struct tls_tunables tlst; uint8_t doorbells; int offload_map; /* ports with IFCAP_TOE enabled */ @@ -897,6 +917,8 @@ struct adapter { int last_op_flags; int swintr; + + struct callout ktls_tick; }; #define ADAPTER_LOCK(sc) mtx_lock(&(sc)->sc_lock) @@ -1168,6 +1190,18 @@ int cxgbe_media_change(struct ifnet *); void cxgbe_media_status(struct ifnet *, struct ifmediareq *); bool t4_os_dump_cimla(struct adapter *, int, bool); void t4_os_dump_devlog(struct adapter *); + +#ifdef KERN_TLS +/* t4_kern_tls.c */ +int cxgbe_tls_tag_alloc(struct ifnet *, union if_snd_tag_alloc_params *, + struct m_snd_tag **); +void cxgbe_tls_tag_free(struct m_snd_tag *); +void t6_ktls_modload(void); +void t6_ktls_modunload(void); +int t6_ktls_try(struct ifnet *, struct socket *, struct ktls_session *); +int t6_ktls_parse_pkt(struct mbuf *, int *, int *); +int t6_ktls_write_wr(struct sge_txq *, void *, struct mbuf *, u_int, u_int); +#endif /* t4_keyctx.c */ struct auth_hash; Modified: head/sys/dev/cxgbe/common/t4_msg.h ============================================================================== --- head/sys/dev/cxgbe/common/t4_msg.h Thu Nov 21 19:13:05 2019 (r354973) +++ head/sys/dev/cxgbe/common/t4_msg.h Thu Nov 21 19:30:31 2019 (r354974) @@ -1158,6 +1158,17 @@ struct cpl_tx_data { __be32 flags; }; +/* cpl_tx_data.len fields */ +#define S_TX_DATA_MSS 16 +#define M_TX_DATA_MSS 0xFFFF +#define V_TX_DATA_MSS(x) ((x) << S_TX_DATA_MSS) +#define G_TX_DATA_MSS(x) (((x) >> S_TX_DATA_MSS) & M_TX_DATA_MSS) + +#define S_TX_LENGTH 0 +#define M_TX_LENGTH 0xFFFF +#define V_TX_LENGTH(x) ((x) << S_TX_LENGTH) +#define G_TX_LENGTH(x) (((x) >> S_TX_LENGTH) & M_TX_LENGTH) + /* cpl_tx_data.flags fields */ #define S_TX_PROXY 5 #define V_TX_PROXY(x) ((x) << S_TX_PROXY) @@ -1204,6 +1215,14 @@ struct cpl_tx_data { #define S_T6_TX_FORCE 20 #define V_T6_TX_FORCE(x) ((x) << S_T6_TX_FORCE) #define F_T6_TX_FORCE V_T6_TX_FORCE(1U) + +#define S_TX_BYPASS 21 +#define V_TX_BYPASS(x) ((x) << S_TX_BYPASS) +#define F_TX_BYPASS V_TX_BYPASS(1U) + +#define S_TX_PUSH 22 +#define V_TX_PUSH(x) ((x) << S_TX_PUSH) +#define F_TX_PUSH V_TX_PUSH(1U) /* additional tx_data_wr.flags fields */ #define S_TX_CPU_IDX 0 Modified: head/sys/dev/cxgbe/common/t4_regs.h ============================================================================== --- head/sys/dev/cxgbe/common/t4_regs.h Thu Nov 21 19:13:05 2019 (r354973) +++ head/sys/dev/cxgbe/common/t4_regs.h Thu Nov 21 19:30:31 2019 (r354974) @@ -22617,6 +22617,10 @@ #define V_TXPDUSIZEADJ(x) ((x) << S_TXPDUSIZEADJ) #define G_TXPDUSIZEADJ(x) (((x) >> S_TXPDUSIZEADJ) & M_TXPDUSIZEADJ) +#define S_ENABLECBYP 21 +#define V_ENABLECBYP(x) ((x) << S_ENABLECBYP) +#define F_ENABLECBYP V_ENABLECBYP(1U) + #define S_LIMITEDTRANSMIT 20 #define M_LIMITEDTRANSMIT 0xfU #define V_LIMITEDTRANSMIT(x) ((x) << S_LIMITEDTRANSMIT) Modified: head/sys/dev/cxgbe/common/t4_tcb.h ============================================================================== --- head/sys/dev/cxgbe/common/t4_tcb.h Thu Nov 21 19:13:05 2019 (r354973) +++ head/sys/dev/cxgbe/common/t4_tcb.h Thu Nov 21 19:30:31 2019 (r354974) @@ -753,6 +753,9 @@ #define S_TF_CCTRL_RFR 62 #define V_TF_CCTRL_RFR(x) ((__u64)(x) << S_TF_CCTRL_RFR) +#define S_TF_CORE_BYPASS 63 +#define V_TF_CORE_BYPASS(x) ((__u64)(x) << S_TF_CORE_BYPASS) + #define S_TF_DDP_INDICATE_OUT 16 #define V_TF_DDP_INDICATE_OUT(x) ((x) << S_TF_DDP_INDICATE_OUT) Added: head/sys/dev/cxgbe/crypto/t4_kern_tls.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/dev/cxgbe/crypto/t4_kern_tls.c Thu Nov 21 19:30:31 2019 (r354974) @@ -0,0 +1,2400 @@ +/*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * + * Copyright (c) 2018-2019 Chelsio Communications, Inc. + * All rights reserved. + * Written by: John Baldwin + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include "opt_inet.h" +#include "opt_inet6.h" +#include "opt_kern_tls.h" + +#include +__FBSDID("$FreeBSD$"); + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "common/common.h" +#include "common/t4_regs.h" +#include "common/t4_regs_values.h" +#include "common/t4_tcb.h" +#include "t4_l2t.h" +#include "t4_clip.h" +#include "t4_mp_ring.h" +#include "crypto/t4_crypto.h" + +#if defined(INET) || defined(INET6) + +#define SALT_SIZE 4 + +#define GCM_TAG_SIZE 16 +#define TLS_HEADER_LENGTH 5 + +#define TLS_KEY_CONTEXT_SZ roundup2(sizeof(struct tls_keyctx), 32) + +struct tls_scmd { + __be32 seqno_numivs; + __be32 ivgen_hdrlen; +}; + +struct tls_key_req { + /* FW_ULPTX_WR */ + __be32 wr_hi; + __be32 wr_mid; + __be32 ftid; + __u8 reneg_to_write_rx; + __u8 protocol; + __be16 mfs; + /* master command */ + __be32 cmd; + __be32 len16; /* command length */ + __be32 dlen; /* data length in 32-byte units */ + __be32 kaddr; + /* sub-command */ + __be32 sc_more; + __be32 sc_len; +}__packed; + +struct tls_keyctx { + struct tx_keyctx_hdr { + __u8 ctxlen; + __u8 r2; + __be16 dualck_to_txvalid; + __u8 txsalt[4]; + __be64 r5; + } txhdr; + struct keys { + __u8 edkey[32]; + __u8 ipad[64]; + __u8 opad[64]; + } keys; +}; + +#define S_TLS_KEYCTX_TX_WR_TXOPAD_PRESENT 11 +#define M_TLS_KEYCTX_TX_WR_TXOPAD_PRESENT 0x1 +#define V_TLS_KEYCTX_TX_WR_TXOPAD_PRESENT(x) \ + ((x) << S_TLS_KEYCTX_TX_WR_TXOPAD_PRESENT) +#define G_TLS_KEYCTX_TX_WR_TXOPAD_PRESENT(x) \ + (((x) >> S_TLS_KEYCTX_TX_WR_TXOPAD_PRESENT) & \ + M_TLS_KEYCTX_TX_WR_TXOPAD_PRESENT) +#define F_TLS_KEYCTX_TX_WR_TXOPAD_PRESENT \ + V_TLS_KEYCTX_TX_WR_TXOPAD_PRESENT(1U) + +#define S_TLS_KEYCTX_TX_WR_SALT_PRESENT 10 +#define M_TLS_KEYCTX_TX_WR_SALT_PRESENT 0x1 +#define V_TLS_KEYCTX_TX_WR_SALT_PRESENT(x) \ + ((x) << S_TLS_KEYCTX_TX_WR_SALT_PRESENT) +#define G_TLS_KEYCTX_TX_WR_SALT_PRESENT(x) \ + (((x) >> S_TLS_KEYCTX_TX_WR_SALT_PRESENT) & \ + M_TLS_KEYCTX_TX_WR_SALT_PRESENT) +#define F_TLS_KEYCTX_TX_WR_SALT_PRESENT \ + V_TLS_KEYCTX_TX_WR_SALT_PRESENT(1U) + +#define S_TLS_KEYCTX_TX_WR_TXCK_SIZE 6 +#define M_TLS_KEYCTX_TX_WR_TXCK_SIZE 0xf +#define V_TLS_KEYCTX_TX_WR_TXCK_SIZE(x) \ + ((x) << S_TLS_KEYCTX_TX_WR_TXCK_SIZE) +#define G_TLS_KEYCTX_TX_WR_TXCK_SIZE(x) \ + (((x) >> S_TLS_KEYCTX_TX_WR_TXCK_SIZE) & \ + M_TLS_KEYCTX_TX_WR_TXCK_SIZE) + +#define S_TLS_KEYCTX_TX_WR_TXMK_SIZE 2 +#define M_TLS_KEYCTX_TX_WR_TXMK_SIZE 0xf +#define V_TLS_KEYCTX_TX_WR_TXMK_SIZE(x) \ + ((x) << S_TLS_KEYCTX_TX_WR_TXMK_SIZE) +#define G_TLS_KEYCTX_TX_WR_TXMK_SIZE(x) \ + (((x) >> S_TLS_KEYCTX_TX_WR_TXMK_SIZE) & \ + M_TLS_KEYCTX_TX_WR_TXMK_SIZE) + +#define S_TLS_KEYCTX_TX_WR_TXVALID 0 +#define M_TLS_KEYCTX_TX_WR_TXVALID 0x1 +#define V_TLS_KEYCTX_TX_WR_TXVALID(x) \ + ((x) << S_TLS_KEYCTX_TX_WR_TXVALID) +#define G_TLS_KEYCTX_TX_WR_TXVALID(x) \ + (((x) >> S_TLS_KEYCTX_TX_WR_TXVALID) & M_TLS_KEYCTX_TX_WR_TXVALID) +#define F_TLS_KEYCTX_TX_WR_TXVALID V_TLS_KEYCTX_TX_WR_TXVALID(1U) + +/* Key Context Programming Operation type */ +#define KEY_WRITE_RX 0x1 +#define KEY_WRITE_TX 0x2 +#define KEY_DELETE_RX 0x4 +#define KEY_DELETE_TX 0x8 + +struct tlspcb { + struct cxgbe_snd_tag com; + struct vi_info *vi; /* virtual interface */ + struct adapter *sc; + struct l2t_entry *l2te; /* L2 table entry used by this connection */ + int tid; /* Connection identifier */ + + int tx_key_addr; + bool inline_key; + bool using_timestamps; + unsigned char enc_mode; + + struct tls_scmd scmd0; + struct tls_scmd scmd0_short; + + unsigned int tx_key_info_size; + + uint32_t prev_seq; + uint32_t prev_ack; + uint32_t prev_tsecr; + uint16_t prev_win; + uint16_t prev_mss; + + /* Only used outside of setup and teardown when using inline keys. */ + struct tls_keyctx keyctx; + + /* Fields only used during setup and teardown. */ + struct inpcb *inp; /* backpointer to host stack's PCB */ + struct sge_txq *txq; + struct sge_wrq *ctrlq; + struct clip_entry *ce; /* CLIP table entry used by this tid */ + + unsigned char auth_mode; + unsigned char hmac_ctrl; + unsigned char mac_first; + unsigned char iv_size; + + unsigned int frag_size; + unsigned int cipher_secret_size; + int proto_ver; + + bool open_pending; +}; + +static int ktls_setup_keys(struct tlspcb *tlsp, + const struct ktls_session *tls, struct sge_txq *txq); + +static inline struct tlspcb * +mst_to_tls(struct m_snd_tag *t) +{ + return ((struct tlspcb *)mst_to_cst(t)); +} + +/* XXX: There are similar versions of these two in tom/t4_tls.c. */ +static int +get_new_keyid(struct tlspcb *tlsp) +{ + vmem_addr_t addr; + + if (vmem_alloc(tlsp->sc->key_map, TLS_KEY_CONTEXT_SZ, + M_NOWAIT | M_FIRSTFIT, &addr) != 0) + return (-1); + + return (addr); +} + +static void +free_keyid(struct tlspcb *tlsp, int keyid) +{ + + CTR3(KTR_CXGBE, "%s: tid %d key addr %#x", __func__, tlsp->tid, keyid); + vmem_free(tlsp->sc->key_map, keyid, TLS_KEY_CONTEXT_SZ); +} + +static struct tlspcb * +alloc_tlspcb(struct ifnet *ifp, struct vi_info *vi, int flags) +{ + struct port_info *pi = vi->pi; + struct adapter *sc = pi->adapter; + struct tlspcb *tlsp; + + tlsp = malloc(sizeof(*tlsp), M_CXGBE, M_ZERO | flags); + if (tlsp == NULL) + return (NULL); + + cxgbe_snd_tag_init(&tlsp->com, ifp, IF_SND_TAG_TYPE_TLS); + tlsp->vi = vi; + tlsp->sc = sc; + tlsp->ctrlq = &sc->sge.ctrlq[pi->port_id]; + tlsp->tid = -1; + tlsp->tx_key_addr = -1; + + return (tlsp); +} + +static void +init_ktls_key_params(struct tlspcb *tlsp, const struct ktls_session *tls) +{ + int mac_key_size; + + if (tls->params.tls_vminor == TLS_MINOR_VER_ONE) + tlsp->proto_ver = SCMD_PROTO_VERSION_TLS_1_1; + else + tlsp->proto_ver = SCMD_PROTO_VERSION_TLS_1_2; + tlsp->cipher_secret_size = tls->params.cipher_key_len; + tlsp->tx_key_info_size = sizeof(struct tx_keyctx_hdr) + + tlsp->cipher_secret_size; + if (tls->params.cipher_algorithm == CRYPTO_AES_NIST_GCM_16) { + tlsp->auth_mode = SCMD_AUTH_MODE_GHASH; + tlsp->enc_mode = SCMD_CIPH_MODE_AES_GCM; + tlsp->iv_size = 4; + tlsp->mac_first = 0; + tlsp->hmac_ctrl = SCMD_HMAC_CTRL_NOP; + tlsp->tx_key_info_size += GMAC_BLOCK_LEN; + } else { + switch (tls->params.auth_algorithm) { + case CRYPTO_SHA1_HMAC: + mac_key_size = roundup2(SHA1_HASH_LEN, 16); + tlsp->auth_mode = SCMD_AUTH_MODE_SHA1; + break; + case CRYPTO_SHA2_256_HMAC: + mac_key_size = SHA2_256_HASH_LEN; + tlsp->auth_mode = SCMD_AUTH_MODE_SHA256; + break; + case CRYPTO_SHA2_384_HMAC: + mac_key_size = SHA2_512_HASH_LEN; + tlsp->auth_mode = SCMD_AUTH_MODE_SHA512_384; + break; + } + tlsp->enc_mode = SCMD_CIPH_MODE_AES_CBC; + tlsp->iv_size = 8; /* for CBC, iv is 16B, unit of 2B */ + tlsp->mac_first = 1; + tlsp->hmac_ctrl = SCMD_HMAC_CTRL_NO_TRUNC; + tlsp->tx_key_info_size += mac_key_size * 2; + } + + tlsp->frag_size = tls->params.max_frame_len; +} + +static int +ktls_act_open_cpl_size(bool isipv6) +{ + + if (isipv6) + return (sizeof(struct cpl_t6_act_open_req6)); + else + return (sizeof(struct cpl_t6_act_open_req)); +} + +static void +mk_ktls_act_open_req(struct adapter *sc, struct vi_info *vi, struct inpcb *inp, + struct tlspcb *tlsp, int atid, void *dst) +{ + struct tcpcb *tp = intotcpcb(inp); + struct cpl_t6_act_open_req *cpl6; + struct cpl_act_open_req *cpl; + uint64_t options; + int qid_atid; + + cpl6 = dst; + cpl = (struct cpl_act_open_req *)cpl6; + INIT_TP_WR(cpl6, 0); + qid_atid = V_TID_QID(sc->sge.fwq.abs_id) | V_TID_TID(atid) | + V_TID_COOKIE(CPL_COOKIE_KERN_TLS); + OPCODE_TID(cpl) = htobe32(MK_OPCODE_TID(CPL_ACT_OPEN_REQ, + qid_atid)); + inp_4tuple_get(inp, &cpl->local_ip, &cpl->local_port, + &cpl->peer_ip, &cpl->peer_port); + + options = F_TCAM_BYPASS | V_ULP_MODE(ULP_MODE_NONE); + options |= V_SMAC_SEL(vi->smt_idx) | V_TX_CHAN(vi->pi->tx_chan); + options |= F_NON_OFFLOAD; + cpl->opt0 = htobe64(options); + + options = V_TX_QUEUE(sc->params.tp.tx_modq[vi->pi->tx_chan]); + if (tp->t_flags & TF_REQ_TSTMP) + options |= F_TSTAMPS_EN; + cpl->opt2 = htobe32(options); +} + +static void +mk_ktls_act_open_req6(struct adapter *sc, struct vi_info *vi, + struct inpcb *inp, struct tlspcb *tlsp, int atid, void *dst) +{ + struct tcpcb *tp = intotcpcb(inp); + struct cpl_t6_act_open_req6 *cpl6; + struct cpl_act_open_req6 *cpl; + uint64_t options; + int qid_atid; + + cpl6 = dst; + cpl = (struct cpl_act_open_req6 *)cpl6; + INIT_TP_WR(cpl6, 0); + qid_atid = V_TID_QID(sc->sge.fwq.abs_id) | V_TID_TID(atid) | + V_TID_COOKIE(CPL_COOKIE_KERN_TLS); + OPCODE_TID(cpl) = htobe32(MK_OPCODE_TID(CPL_ACT_OPEN_REQ6, + qid_atid)); + cpl->local_port = inp->inp_lport; + cpl->local_ip_hi = *(uint64_t *)&inp->in6p_laddr.s6_addr[0]; + cpl->local_ip_lo = *(uint64_t *)&inp->in6p_laddr.s6_addr[8]; + cpl->peer_port = inp->inp_fport; + cpl->peer_ip_hi = *(uint64_t *)&inp->in6p_faddr.s6_addr[0]; + cpl->peer_ip_lo = *(uint64_t *)&inp->in6p_faddr.s6_addr[8]; + + options = F_TCAM_BYPASS | V_ULP_MODE(ULP_MODE_NONE); + options |= V_SMAC_SEL(vi->smt_idx) | V_TX_CHAN(vi->pi->tx_chan); + options |= F_NON_OFFLOAD; + cpl->opt0 = htobe64(options); + + options = V_TX_QUEUE(sc->params.tp.tx_modq[vi->pi->tx_chan]); + if (tp->t_flags & TF_REQ_TSTMP) + options |= F_TSTAMPS_EN; + cpl->opt2 = htobe32(options); +} + +static int +send_ktls_act_open_req(struct adapter *sc, struct vi_info *vi, + struct inpcb *inp, struct tlspcb *tlsp, int atid) +{ + struct wrqe *wr; + bool isipv6; + + isipv6 = (inp->inp_vflag & INP_IPV6) != 0; + if (isipv6) { + tlsp->ce = t4_hold_lip(sc, &inp->in6p_laddr, NULL); + if (tlsp->ce == NULL) + return (ENOENT); + } + + wr = alloc_wrqe(ktls_act_open_cpl_size(isipv6), tlsp->ctrlq); + if (wr == NULL) { + CTR2(KTR_CXGBE, "%s: atid %d failed to alloc WR", __func__, + atid); + return (ENOMEM); + } + + if (isipv6) + mk_ktls_act_open_req6(sc, vi, inp, tlsp, atid, wrtod(wr)); + else + mk_ktls_act_open_req(sc, vi, inp, tlsp, atid, wrtod(wr)); + + tlsp->open_pending = true; + t4_wrq_tx(sc, wr); + return (0); +} + +static int +ktls_act_open_rpl(struct sge_iq *iq, const struct rss_header *rss, + struct mbuf *m) +{ + struct adapter *sc = iq->adapter; + const struct cpl_act_open_rpl *cpl = (const void *)(rss + 1); + u_int atid = G_TID_TID(G_AOPEN_ATID(be32toh(cpl->atid_status))); + u_int status = G_AOPEN_STATUS(be32toh(cpl->atid_status)); + struct tlspcb *tlsp = lookup_atid(sc, atid); + struct inpcb *inp = tlsp->inp; + + CTR3(KTR_CXGBE, "%s: atid %d status %d", __func__, atid, status); + free_atid(sc, atid); + if (status == 0) + tlsp->tid = GET_TID(cpl); + + INP_WLOCK(inp); + tlsp->open_pending = false; + wakeup(tlsp); + INP_WUNLOCK(inp); + return (0); +} + +/* SET_TCB_FIELD sent as a ULP command looks like this */ +#define LEN__SET_TCB_FIELD_ULP (sizeof(struct ulp_txpkt) + \ + sizeof(struct ulptx_idata) + sizeof(struct cpl_set_tcb_field_core)) + +_Static_assert((LEN__SET_TCB_FIELD_ULP + sizeof(struct ulptx_idata)) % 16 == 0, + "CPL_SET_TCB_FIELD ULP command not 16-byte aligned"); + +static void +write_set_tcb_field_ulp(struct tlspcb *tlsp, void *dst, struct sge_txq *txq, + uint16_t word, uint64_t mask, uint64_t val) +{ + struct ulp_txpkt *txpkt; + struct ulptx_idata *idata; + struct cpl_set_tcb_field_core *cpl; + + /* ULP_TXPKT */ + txpkt = dst; + txpkt->cmd_dest = htobe32(V_ULPTX_CMD(ULP_TX_PKT) | + V_ULP_TXPKT_DATAMODIFY(0) | + V_ULP_TXPKT_CHANNELID(tlsp->vi->pi->port_id) | V_ULP_TXPKT_DEST(0) | + V_ULP_TXPKT_FID(txq->eq.cntxt_id) | V_ULP_TXPKT_RO(1)); + txpkt->len = htobe32(howmany(LEN__SET_TCB_FIELD_ULP, 16)); + + /* ULPTX_IDATA sub-command */ + idata = (struct ulptx_idata *)(txpkt + 1); + idata->cmd_more = htobe32(V_ULPTX_CMD(ULP_TX_SC_IMM)); + idata->len = htobe32(sizeof(*cpl)); + + /* CPL_SET_TCB_FIELD */ + cpl = (struct cpl_set_tcb_field_core *)(idata + 1); + OPCODE_TID(cpl) = htobe32(MK_OPCODE_TID(CPL_SET_TCB_FIELD, tlsp->tid)); + cpl->reply_ctrl = htobe16(F_NO_REPLY); + cpl->word_cookie = htobe16(V_WORD(word)); + cpl->mask = htobe64(mask); + cpl->val = htobe64(val); + + /* ULPTX_NOOP */ + idata = (struct ulptx_idata *)(cpl + 1); + idata->cmd_more = htobe32(V_ULPTX_CMD(ULP_TX_SC_NOOP)); + idata->len = htobe32(0); +} + +static int +ktls_set_tcb_fields(struct tlspcb *tlsp, struct tcpcb *tp, struct sge_txq *txq) +{ + struct fw_ulptx_wr *wr; + struct mbuf *m; + char *dst; + void *items[1]; + int error, len; + + len = sizeof(*wr) + 3 * roundup2(LEN__SET_TCB_FIELD_ULP, 16); + if (tp->t_flags & TF_REQ_TSTMP) + len += roundup2(LEN__SET_TCB_FIELD_ULP, 16); + m = alloc_wr_mbuf(len, M_NOWAIT); + if (m == NULL) { + CTR2(KTR_CXGBE, "%s: tid %d failed to alloc WR mbuf", __func__, + tlsp->tid); + return (ENOMEM); + } + m->m_pkthdr.snd_tag = m_snd_tag_ref(&tlsp->com.com); + m->m_pkthdr.csum_flags |= CSUM_SND_TAG; + + /* FW_ULPTX_WR */ + wr = mtod(m, void *); + wr->op_to_compl = htobe32(V_FW_WR_OP(FW_ULPTX_WR)); + wr->flowid_len16 = htobe32(F_FW_ULPTX_WR_DATA | + V_FW_WR_LEN16(len / 16)); + wr->cookie = 0; + dst = (char *)(wr + 1); + + /* Clear TF_NON_OFFLOAD and set TF_CORE_BYPASS */ + write_set_tcb_field_ulp(tlsp, dst, txq, W_TCB_T_FLAGS, + V_TCB_T_FLAGS(V_TF_CORE_BYPASS(1) | V_TF_NON_OFFLOAD(1)), + V_TCB_T_FLAGS(V_TF_CORE_BYPASS(1))); + dst += roundup2(LEN__SET_TCB_FIELD_ULP, 16); + + /* Clear the SND_UNA_RAW, SND_NXT_RAW, and SND_MAX_RAW offsets. */ + write_set_tcb_field_ulp(tlsp, dst, txq, W_TCB_SND_UNA_RAW, + V_TCB_SND_NXT_RAW(M_TCB_SND_NXT_RAW) | + V_TCB_SND_UNA_RAW(M_TCB_SND_UNA_RAW), + V_TCB_SND_NXT_RAW(0) | V_TCB_SND_UNA_RAW(0)); + dst += roundup2(LEN__SET_TCB_FIELD_ULP, 16); + + write_set_tcb_field_ulp(tlsp, dst, txq, W_TCB_SND_MAX_RAW, + V_TCB_SND_MAX_RAW(M_TCB_SND_MAX_RAW), V_TCB_SND_MAX_RAW(0)); + dst += roundup2(LEN__SET_TCB_FIELD_ULP, 16); + + if (tp->t_flags & TF_REQ_TSTMP) { + write_set_tcb_field_ulp(tlsp, dst, txq, W_TCB_TIMESTAMP_OFFSET, + V_TCB_TIMESTAMP_OFFSET(M_TCB_TIMESTAMP_OFFSET), + V_TCB_TIMESTAMP_OFFSET(tp->ts_offset >> 28)); + dst += roundup2(LEN__SET_TCB_FIELD_ULP, 16); + } + + KASSERT(dst - (char *)wr == len, ("%s: length mismatch", __func__)); + + items[0] = m; + error = mp_ring_enqueue(txq->r, items, 1, 1); + if (error) + m_free(m); + return (error); +} + +int +cxgbe_tls_tag_alloc(struct ifnet *ifp, union if_snd_tag_alloc_params *params, + struct m_snd_tag **pt) +{ + const struct ktls_session *tls; + struct tlspcb *tlsp; + struct adapter *sc; + struct vi_info *vi; + struct inpcb *inp; + struct tcpcb *tp; + struct sge_txq *txq; + int atid, error, keyid; + + tls = params->tls.tls; + + /* Only TLS 1.1 and TLS 1.2 are currently supported. */ + if (tls->params.tls_vmajor != TLS_MAJOR_VER_ONE || + tls->params.tls_vminor < TLS_MINOR_VER_ONE || + tls->params.tls_vminor > TLS_MINOR_VER_TWO) + return (EPROTONOSUPPORT); + + /* Sanity check values in *tls. */ + switch (tls->params.cipher_algorithm) { + case CRYPTO_AES_CBC: + /* XXX: Explicitly ignore any provided IV. */ + switch (tls->params.cipher_key_len) { + case 128 / 8: + case 192 / 8: + case 256 / 8: + break; + default: + return (EINVAL); + } + switch (tls->params.auth_algorithm) { + case CRYPTO_SHA1_HMAC: + case CRYPTO_SHA2_256_HMAC: + case CRYPTO_SHA2_384_HMAC: + break; + default: + return (EPROTONOSUPPORT); + } + break; + case CRYPTO_AES_NIST_GCM_16: + if (tls->params.iv_len != SALT_SIZE) + return (EINVAL); + switch (tls->params.cipher_key_len) { + case 128 / 8: + case 192 / 8: + case 256 / 8: + break; + default: + return (EINVAL); + } + break; + default: + return (EPROTONOSUPPORT); + } + + vi = ifp->if_softc; + sc = vi->pi->adapter; + + tlsp = alloc_tlspcb(ifp, vi, M_WAITOK); + + atid = alloc_atid(sc, tlsp); + if (atid < 0) { + error = ENOMEM; + goto failed; + } + + if (sc->tlst.inline_keys) + keyid = -1; + else + keyid = get_new_keyid(tlsp); + if (keyid < 0) { + CTR2(KTR_CXGBE, "%s: atid %d using immediate key ctx", __func__, + atid); + tlsp->inline_key = true; + } else { + tlsp->tx_key_addr = keyid; + CTR3(KTR_CXGBE, "%s: atid %d allocated TX key addr %#x", + __func__, + atid, tlsp->tx_key_addr); + } + + inp = params->tls.inp; + INP_RLOCK(inp); + if (inp->inp_flags & (INP_TIMEWAIT | INP_DROPPED)) { + INP_RUNLOCK(inp); + error = ECONNRESET; + goto failed; + } + tlsp->inp = inp; + + tp = inp->inp_ppcb; + if (tp->t_flags & TF_REQ_TSTMP) { + tlsp->using_timestamps = true; + if ((tp->ts_offset & 0xfffffff) != 0) { + INP_RUNLOCK(inp); + error = EINVAL; + goto failed; + } + } else + tlsp->using_timestamps = false; + + error = send_ktls_act_open_req(sc, vi, inp, tlsp, atid); + if (error) { + INP_RUNLOCK(inp); + goto failed; + } + + /* Wait for reply to active open. */ + CTR2(KTR_CXGBE, "%s: atid %d sent CPL_ACT_OPEN_REQ", __func__, + atid); + while (tlsp->open_pending) { + /* + * XXX: PCATCH? We would then have to discard the PCB + * when the completion CPL arrived. + */ + error = rw_sleep(tlsp, &inp->inp_lock, 0, "t6tlsop", 0); + } + + atid = -1; + if (tlsp->tid < 0) { + INP_RUNLOCK(inp); + error = ENOMEM; + goto failed; + } + + if (inp->inp_flags & (INP_TIMEWAIT | INP_DROPPED)) { + INP_RUNLOCK(inp); + error = ECONNRESET; + goto failed; + } + + txq = &sc->sge.txq[vi->first_txq]; + if (inp->inp_flowtype != M_HASHTYPE_NONE) + txq += ((inp->inp_flowid % (vi->ntxq - vi->rsrv_noflowq)) + + vi->rsrv_noflowq); + tlsp->txq = txq; + + error = ktls_set_tcb_fields(tlsp, tp, txq); + INP_RUNLOCK(inp); + if (error) + goto failed; + + init_ktls_key_params(tlsp, tls); + + error = ktls_setup_keys(tlsp, tls, txq); + if (error) + goto failed; + + /* The SCMD fields used when encrypting a full TLS record. */ + tlsp->scmd0.seqno_numivs = htobe32(V_SCMD_SEQ_NO_CTRL(3) | + V_SCMD_PROTO_VERSION(tlsp->proto_ver) | + V_SCMD_ENC_DEC_CTRL(SCMD_ENCDECCTRL_ENCRYPT) | + V_SCMD_CIPH_AUTH_SEQ_CTRL((tlsp->mac_first == 0)) | + V_SCMD_CIPH_MODE(tlsp->enc_mode) | + V_SCMD_AUTH_MODE(tlsp->auth_mode) | + V_SCMD_HMAC_CTRL(tlsp->hmac_ctrl) | + V_SCMD_IV_SIZE(tlsp->iv_size) | V_SCMD_NUM_IVS(1)); + + tlsp->scmd0.ivgen_hdrlen = V_SCMD_IV_GEN_CTRL(0) | + V_SCMD_TLS_FRAG_ENABLE(0); + if (tlsp->inline_key) + tlsp->scmd0.ivgen_hdrlen |= V_SCMD_KEY_CTX_INLINE(1); + tlsp->scmd0.ivgen_hdrlen = htobe32(tlsp->scmd0.ivgen_hdrlen); + + /* + * The SCMD fields used when encrypting a partial TLS record + * (no trailer and possibly a truncated payload). + */ + tlsp->scmd0_short.seqno_numivs = V_SCMD_SEQ_NO_CTRL(0) | + V_SCMD_PROTO_VERSION(SCMD_PROTO_VERSION_GENERIC) | + V_SCMD_ENC_DEC_CTRL(SCMD_ENCDECCTRL_ENCRYPT) | + V_SCMD_CIPH_AUTH_SEQ_CTRL((tlsp->mac_first == 0)) | + V_SCMD_AUTH_MODE(SCMD_AUTH_MODE_NOP) | + V_SCMD_HMAC_CTRL(SCMD_HMAC_CTRL_NOP) | + V_SCMD_IV_SIZE(AES_BLOCK_LEN / 2) | V_SCMD_NUM_IVS(0); + if (tlsp->enc_mode == SCMD_CIPH_MODE_AES_GCM) + tlsp->scmd0_short.seqno_numivs |= + V_SCMD_CIPH_MODE(SCMD_CIPH_MODE_AES_CTR); + else + tlsp->scmd0_short.seqno_numivs |= + V_SCMD_CIPH_MODE(tlsp->enc_mode); + tlsp->scmd0_short.seqno_numivs = + htobe32(tlsp->scmd0_short.seqno_numivs); + + tlsp->scmd0_short.ivgen_hdrlen = V_SCMD_IV_GEN_CTRL(0) | + V_SCMD_TLS_FRAG_ENABLE(0) | + V_SCMD_AADIVDROP(1); + if (tlsp->inline_key) + tlsp->scmd0_short.ivgen_hdrlen |= V_SCMD_KEY_CTX_INLINE(1); + + TXQ_LOCK(txq); + if (tlsp->enc_mode == SCMD_CIPH_MODE_AES_GCM) + txq->kern_tls_gcm++; + else + txq->kern_tls_cbc++; + TXQ_UNLOCK(txq); + *pt = &tlsp->com.com; + return (0); + +failed: + if (atid >= 0) + free_atid(sc, atid); + m_snd_tag_rele(&tlsp->com.com); + return (error); +} + +static int +ktls_setup_keys(struct tlspcb *tlsp, const struct ktls_session *tls, + struct sge_txq *txq) +{ + struct auth_hash *axf; + int error, keyid, kwrlen, kctxlen, len; + struct tls_key_req *kwr; + struct tls_keyctx *kctx; + void *items[1], *key; + struct tx_keyctx_hdr *khdr; + unsigned int ck_size, mk_size, partial_digest_len; + struct mbuf *m; + + /* + * Store the salt and keys in the key context. For + * connections with an inline key, this key context is passed + * as immediate data in each work request. For connections + * storing the key in DDR, a work request is used to store a + * copy of the key context in DDR. + */ + kctx = &tlsp->keyctx; + khdr = &kctx->txhdr; + + switch (tlsp->cipher_secret_size) { + case 128 / 8: + ck_size = CHCR_KEYCTX_CIPHER_KEY_SIZE_128; + break; + case 192 / 8: + ck_size = CHCR_KEYCTX_CIPHER_KEY_SIZE_192; + break; + case 256 / 8: + ck_size = CHCR_KEYCTX_CIPHER_KEY_SIZE_256; + break; + default: + panic("bad key size"); + } + axf = NULL; + partial_digest_len = 0; + if (tlsp->enc_mode == SCMD_CIPH_MODE_AES_GCM) + mk_size = CHCR_KEYCTX_MAC_KEY_SIZE_512; + else { + switch (tlsp->auth_mode) { + case SCMD_AUTH_MODE_SHA1: + axf = &auth_hash_hmac_sha1; + mk_size = CHCR_KEYCTX_MAC_KEY_SIZE_160; + partial_digest_len = SHA1_HASH_LEN; + break; + case SCMD_AUTH_MODE_SHA256: + axf = &auth_hash_hmac_sha2_256; + mk_size = CHCR_KEYCTX_MAC_KEY_SIZE_256; + partial_digest_len = SHA2_256_HASH_LEN; + break; + case SCMD_AUTH_MODE_SHA512_384: + axf = &auth_hash_hmac_sha2_384; + mk_size = CHCR_KEYCTX_MAC_KEY_SIZE_512; + partial_digest_len = SHA2_512_HASH_LEN; + break; + default: + panic("bad auth mode"); + } + } + + khdr->ctxlen = (tlsp->tx_key_info_size >> 4); + khdr->dualck_to_txvalid = V_TLS_KEYCTX_TX_WR_SALT_PRESENT(1) | + V_TLS_KEYCTX_TX_WR_TXCK_SIZE(ck_size) | + V_TLS_KEYCTX_TX_WR_TXMK_SIZE(mk_size) | + V_TLS_KEYCTX_TX_WR_TXVALID(1); + if (tlsp->enc_mode != SCMD_CIPH_MODE_AES_GCM) + khdr->dualck_to_txvalid |= V_TLS_KEYCTX_TX_WR_TXOPAD_PRESENT(1); + khdr->dualck_to_txvalid = htobe16(khdr->dualck_to_txvalid); + key = kctx->keys.edkey; + memcpy(key, tls->params.cipher_key, tls->params.cipher_key_len); + if (tlsp->enc_mode == SCMD_CIPH_MODE_AES_GCM) { + memcpy(khdr->txsalt, tls->params.iv, SALT_SIZE); + t4_init_gmac_hash(tls->params.cipher_key, + tls->params.cipher_key_len * 8, + (char *)key + tls->params.cipher_key_len); + } else { + t4_init_hmac_digest(axf, partial_digest_len, + tls->params.auth_key, tls->params.auth_key_len * 8, + (char *)key + tls->params.cipher_key_len); + } + + if (tlsp->inline_key) + return (0); + + keyid = tlsp->tx_key_addr; + + /* Populate key work request. */ + kwrlen = sizeof(*kwr); + kctxlen = roundup2(sizeof(*kctx), 32); + len = kwrlen + kctxlen; + + m = alloc_wr_mbuf(len, M_NOWAIT); + if (m == NULL) { + CTR2(KTR_CXGBE, "%s: tid %d failed to alloc WR mbuf", __func__, + tlsp->tid); + return (ENOMEM); *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-all@freebsd.org Thu Nov 21 19:36:12 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id A6A991C8E0A; Thu, 21 Nov 2019 19:36:12 +0000 (UTC) (envelope-from erj@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47JqYS3v52z3L9f; Thu, 21 Nov 2019 19:36:12 +0000 (UTC) (envelope-from erj@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 68F7C1822E; Thu, 21 Nov 2019 19:36:12 +0000 (UTC) (envelope-from erj@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xALJaCIK042412; Thu, 21 Nov 2019 19:36:12 GMT (envelope-from erj@FreeBSD.org) Received: (from erj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xALJaCEx042409; Thu, 21 Nov 2019 19:36:12 GMT (envelope-from erj@FreeBSD.org) Message-Id: <201911211936.xALJaCEx042409@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: erj set sender to erj@FreeBSD.org using -f From: Eric Joyner Date: Thu, 21 Nov 2019 19:36:12 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354975 - in head: sys/sys tests/sys/sys X-SVN-Group: head X-SVN-Commit-Author: erj X-SVN-Commit-Paths: in head: sys/sys tests/sys/sys X-SVN-Commit-Revision: 354975 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 21 Nov 2019 19:36:12 -0000 Author: erj Date: Thu Nov 21 19:36:11 2019 New Revision: 354975 URL: https://svnweb.freebsd.org/changeset/base/354975 Log: bitstring: exit early if _start is past size of the bitstring bit_ffs_at and bit_ffc_at both take _start parameters which indicate to start searching from _start onwards. If the given _start index is past the size of the bit string, these functions will calculate an address of the current bitstring which is after the expected size. The function will also dereference the memory, resulting in a read buffer overflow. The output of the function remains correct, because the tests ensure to stop the loop if the current bitstring chunk passes the stop bitstring chunk, and because of a check to ensure the reported _value is never past _nbits. However, if is ever used in code which is checked by -fsanitize=undefined, or similar static analysis, it can produce warnings about reading past the buffer size. Because of the above mentioned checks, these buffer overflows do not occur as long as _start is less than _nbits. Additionally, by definition bit_ffs_at and bif_ffc_at should set _result to -1 in any case where the _start is after the _nbits. Check for this case at the start of the function and exit early if so, preventing the buffer read overflow, and reducing the amount of computation that occurs. Note that it may seem odd to ever have code that could call bit_ffc_at or bit_ffs_at with a _start value greater than _nbits. However, consider a for-loop that used bit_ffs and bit_ffs_at to loop over a bit string and perform some operation on each bit that was set. If the last bit of the bit string was set, the simplest loop implementation would call bit_ffs_at with a start of _nbits, and expect that to return -1. While it does infact perform correctly, this is what ultimately triggers the unexpected buffer read overflow. Signed-off-by: Jacob Keller Submitted by: Jacob Keller Reviewed by: asomers@, erj@ MFC after: 1 week Sponsored by: Intel Corporation Differential Revision: https://reviews.freebsd.org/D22398 Modified: head/sys/sys/bitstring.h head/tests/sys/sys/bitstring_test.c Modified: head/sys/sys/bitstring.h ============================================================================== --- head/sys/sys/bitstring.h Thu Nov 21 19:30:31 2019 (r354974) +++ head/sys/sys/bitstring.h Thu Nov 21 19:36:11 2019 (r354975) @@ -202,6 +202,11 @@ bit_ffs_at(bitstr_t *_bitstr, int _start, int _nbits, bitstr_t _test; int _value, _offset; + if (_start >= _nbits) { + *_result = -1; + return; + } + if (_nbits > 0) { _curbitstr = _bitstr + _bit_idx(_start); _stopbitstr = _bitstr + _bit_idx(_nbits - 1); @@ -230,6 +235,11 @@ bit_ffc_at(bitstr_t *_bitstr, int _start, int _nbits, bitstr_t *_stopbitstr; bitstr_t _test; int _value, _offset; + + if (_start >= _nbits) { + *_result = -1; + return; + } if (_nbits > 0) { _curbitstr = _bitstr + _bit_idx(_start); Modified: head/tests/sys/sys/bitstring_test.c ============================================================================== --- head/tests/sys/sys/bitstring_test.c Thu Nov 21 19:30:31 2019 (r354974) +++ head/tests/sys/sys/bitstring_test.c Thu Nov 21 19:36:11 2019 (r354975) @@ -246,6 +246,17 @@ BITSTRING_TC_DEFINE(bit_ffs_at) nbits, memloc, i, found_set_bit); } } + + /* Pass a start value beyond the size of the bit string */ + bit_ffs_at(bitstr, nbits, nbits, &found_set_bit); + ATF_REQUIRE_MSG(found_set_bit == -1, + "bit_ffs_at_%d_%s: Failed with high start value of %d, Result %d", + nbits, memloc, nbits, found_set_bit); + + bit_ffs_at(bitstr, nbits + 3, nbits, &found_set_bit); + ATF_REQUIRE_MSG(found_set_bit == -1, + "bit_ffs_at_%d_%s: Failed with high start value of %d, Result %d", + nbits, memloc, nbits + 3, found_set_bit); } BITSTRING_TC_DEFINE(bit_ffc_at) @@ -297,6 +308,17 @@ BITSTRING_TC_DEFINE(bit_ffc_at) nbits, memloc, i, found_clear_bit); } } + + /* Pass a start value beyond the size of the bit string */ + bit_ffc_at(bitstr, nbits, nbits, &found_clear_bit); + ATF_REQUIRE_MSG(found_clear_bit == -1, + "bit_ffc_at_%d_%s: Failed with high start value, Result %d", + nbits, memloc, found_clear_bit); + + bit_ffc_at(bitstr, nbits + 3, nbits, &found_clear_bit); + ATF_REQUIRE_MSG(found_clear_bit == -1, + "bit_ffc_at_%d_%s: Failed with high start value of %d, Result %d", + nbits, memloc, nbits + 3, found_clear_bit); } BITSTRING_TC_DEFINE(bit_nclear) From owner-svn-src-all@freebsd.org Thu Nov 21 19:41:30 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id D98ED1C8FDC; Thu, 21 Nov 2019 19:41:30 +0000 (UTC) (envelope-from ronald-lists@klop.ws) Received: from smarthost1.greenhost.nl (smarthost1.greenhost.nl [195.190.28.88]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 47JqgZ5Wgdz3Lfp; Thu, 21 Nov 2019 19:41:30 +0000 (UTC) (envelope-from ronald-lists@klop.ws) Received: from smtp.greenhost.nl ([213.108.110.112]) by smarthost1.greenhost.nl with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.89) (envelope-from ) id 1iXsK1-0005uF-RD; Thu, 21 Nov 2019 20:41:28 +0100 Content-Type: text/plain; charset=utf-8; format=flowed; delsp=yes To: "Dimitry Andric" Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: Re: svn commit: r354803 - in stable: 11/contrib/llvm/lib/Transforms/InstCombine 12/contrib/llvm/lib/Transforms/InstCombine References: <201911180704.xAI74xAM039993@repo.freebsd.org> Date: Thu, 21 Nov 2019 20:41:00 +0100 MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: "Ronald Klop" Message-ID: In-Reply-To: User-Agent: Opera Mail/12.16 (FreeBSD) X-Authenticated-As-Hash: 398f5522cb258ce43cb679602f8cfe8b62a256d1 X-Virus-Scanned: by clamav at smarthost1.samage.net X-Spam-Level: -- X-Spam-Score: -2.0 X-Spam-Status: No, score=-2.0 required=5.0 tests=ALL_TRUSTED, BAYES_00 autolearn=disabled version=3.4.2 X-Scan-Signature: 9b84bad32751a42de3aa9e7877f1ca86 X-Rspamd-Queue-Id: 47JqgZ5Wgdz3Lfp X-Spamd-Bar: ----- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-5.98 / 15.00]; NEURAL_HAM_MEDIUM(-1.00)[-0.996,0]; NEURAL_HAM_LONG(-0.99)[-0.986,0]; REPLY(-4.00)[] X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 21 Nov 2019 19:41:30 -0000 On Thu, 21 Nov 2019 20:07:46 +0100, Dimitry Andric wrote: > On 21 Nov 2019, at 16:06, Ronald Klop wrote: >> >> On Mon, 18 Nov 2019 08:04:59 +0100, Dimitry Andric >> wrote: >>> Author: dim >>> Date: Mon Nov 18 07:04:59 2019 >>> New Revision: 354803 >>> URL: https://svnweb.freebsd.org/changeset/base/354803 >>> >>> Log: >>> MFC r354724: >>> Merge commit 5bbb604bb from llvm git (by Craig Topper): >>> [InstCombine] Disable some portions of foldGEPICmp for GEPs that >>> return a vector of pointers. Fix other portions. >>> llvm-svn: 370114 >>> This should fix instances of 'Assertion failed: (isa(Val) && >>> "cast() argument of incompatible type!"), function cast, file >>> /usr/src/contrib/llvm/include/llvm/Support/Casting.h, line 255', when >>> building openjdk8 for aarch64 and armv7. >>> Reported by: jbeich >>> PR: 236566 >>> >> >> >> Are there plans for an errata notice for releng-12.1 with this fix? >> That would keep Openjdk8 as a pkg on aarch64 after 12.0 goes EOL and >> pkgs will be build on 12.1. > > There should be no need for this, as release versions (and stable > branches) have their copies of clang compiled with assertions disabled. > > Hence, the assertion reported in PR 236566 cannot occur, unless you have > explicitly turned them on again and recompiled the toolchain components. > > I have tried compiling the original test case from the PR on both > 12.0-RELEASE and 12.1-RELEASE. > > On 12.0-RELEASE, which has clang version 6.0.1 (tags/RELEASE_601/final > 335540), it complains that the -fno-delete-null-pointer-checks and > -faddrsig options are unknown, but this is to be expected. The former > was important to get the original assertion. If I remove both those > options, the test case compiles just fine. > > On 12.1-RELEASE, which has clang version 8.0.1 (tags/RELEASE_801/final > 366581), the test case compiles just fine, out of the box. > > -Dimitry > Dimitry, Thank you for testing and your quick answer. Regards, Ronald. From owner-svn-src-all@freebsd.org Thu Nov 21 19:49:23 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 81EC41C92B3; Thu, 21 Nov 2019 19:49:23 +0000 (UTC) (envelope-from jkim@FreeBSD.org) Received: from smtp.freebsd.org (smtp.freebsd.org [IPv6:2610:1c1:1:606c::24b:4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "smtp.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47Jqrg2ppdz3Lyy; Thu, 21 Nov 2019 19:49:23 +0000 (UTC) (envelope-from jkim@FreeBSD.org) Received: from freefall.freebsd.org (static-71-168-218-4.cmdnnj.fios.verizon.net [71.168.218.4]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client did not present a certificate) (Authenticated sender: jkim/mail) by smtp.freebsd.org (Postfix) with ESMTPSA id 351A3A7F1; Thu, 21 Nov 2019 19:49:23 +0000 (UTC) (envelope-from jkim@FreeBSD.org) Subject: Re: svn commit: r354968 - in head: share/mk sys/conf To: Warner Losh , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org References: <201911211559.xALFxXQa012513@repo.freebsd.org> From: Jung-uk Kim Autocrypt: addr=jkim@FreeBSD.org; prefer-encrypt=mutual; keydata= mQENBFJBztUBCAChqNyGqmFuNo0U7MBzsD+q/G6Cv0l7LGVrOAsgh34M8wIWhD+tztDWMVfn AhxNDd0ceCj2bYOe67sTQxAScEcbt2FfvPOLp9MEXb9qohZj172Gwkk7dnhOhZZKhVGVZKM4 NcsuBDUzgf4f3Vdzj4wg6WlqplnTZo8lPE4hZWvZHoFIyunPTJWenybeV1xnxK7JkUdSvQR0 fA59RfTTECMwTrSEfYGUnxIDBraxJ7Ecs/0hGQ7sljIj8WBvlRDU5fU1xfF35aw56T8POQRq F4E6RVJW3YGuTpSwgtGZOTfygcLRhAiq3dFC3JNLaTVTpM8PjOinJyt9AU6RoITGOKwDABEB AAG0Hkp1bmctdWsgS2ltIDxqa2ltQEZyZWVCU0Qub3JnPokBPQQTAQoAJwUCUkHO1QIbAwUJ E0/POwULCQgHAwUVCgkICwUWAgMBAAIeAQIXgAAKCRB8n5Ym/NvxRqyzB/wL7QtsIpeGfGIA ZPMtgXMucM3NWzomyQMln2j2efUkDKthzh9jBxgF53TjOr7imwIt0PT2k1bqctPrq5IRqnu9 mGroqaCLE3LG2/E3jEaao4k9PO6efwlioyivUo5NrqIQOQ4k3EAXw7d2y0Dk1VpTgdMrnUAB hj7lGlLqS4ydcrf24DdbCRGdEQwqd9DBeBgbWynxAJMgbZBhYVEyIHuQKkJ8qY0ibIPXXuF0 KYDeH0qUHtWV2K3srNyPtymUkBQD84Pl1GWRYx05XdUHDmnX0JV3lg0BfYJZgZv0ehPQrMfY Fd9abTkf9FHQYz1JtsC8wUuRgqElRd6+YAGf8Tt9uQENBFJBztUBCADLtSrP44El2VoJmH14 OFrlOgxzZnbn+Y/Gf1k12mJBiR+A+pBeRLD50p7AiTrjHRxO3cHcl9Dh0uf1VSbXgp8Or0ye iP/86fZPd4k5HXNmDTLL0HecPE08SCqGZ0W8vllQrokB1QxxRUB+fFMPJyMCjDAZ7P9fFTOS dTw1bJSTtOD8Sx8MpZUa9ti06bXFlVYDlaqSdgk181SSx+ZbSKkQR8CIMARlHwiLsa3Z9q9O EJr20HPyxe0AlTvwvFndH61hg7ds63eRvglwRnNON28VXO/lvKXq7Br/CiiyhFdKfINIx2Z5 htYq22tgGTW7mBURbIKoECFBTX9Lv6BXz6w9ABEBAAGJASUEGAEKAA8FAlJBztUCGwwFCRNP zzsACgkQfJ+WJvzb8UZcJQf+IsTCxUEqY7W/pT84sMg5/QD3s6ufTRncvq14fEOxCNq1Rf4Q 9P+tOFa8GZfKDGB2BFGIrW7uT5mlmKdK1vO6ZIA930y5kUsnCmBUEBJkE2ciSQk01aB/1o62 Q3Gk/F6BwtNY9OXiqF7AcAo+K/BMIaqb26QKeh+IIgK1NN9dQiq3ByTbl4zpGZa6MmsnnRTu mzGKt2nkz7vBzH6+hZp1OzGZikgjjhYWVFoJo1dvf/rv4obs0ZJEqFPQs/1Qa1dbkKBv6odB XJpPH0ssOluTY24d1XxTiKTwmWvHeQkOKRAIfD7VTtF4TesoZYkf7hsh3e3VwXhptSLFnEOi WwYofg== Message-ID: Date: Thu, 21 Nov 2019 14:49:17 -0500 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:68.0) Gecko/20100101 Thunderbird/68.3.0 MIME-Version: 1.0 In-Reply-To: <201911211559.xALFxXQa012513@repo.freebsd.org> Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="LVlVuOS1aMHbPcqxQwZzvLZnouJJ4paQ8" X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 21 Nov 2019 19:49:23 -0000 This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --LVlVuOS1aMHbPcqxQwZzvLZnouJJ4paQ8 Content-Type: multipart/mixed; boundary="ThqEpL40cBdfwCB51MY0QOqy45lhP4IT5" --ThqEpL40cBdfwCB51MY0QOqy45lhP4IT5 Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: quoted-printable On 19. 11. 21., Warner Losh wrote: > Author: imp > Date: Thu Nov 21 15:59:33 2019 > New Revision: 354968 > URL: https://svnweb.freebsd.org/changeset/base/354968 >=20 > Log: > Introduce bsd.sysdir.mk to consolidate looking for the kernel. > =20 > Reviewed by: jhb > Differential Revision: https://reviews.freebsd.org/D22144 >=20 > Added: > head/share/mk/bsd.sysdir.mk > - copied, changed from r354937, head/share/mk/bsd.kmod.mk > Modified: > head/share/mk/bsd.dtb.mk > head/share/mk/bsd.kmod.mk > head/sys/conf/dtb.build.mk > head/sys/conf/kmod.mk It seems you forgot to install bsd.sysdir.mk. All device drivers in ports tree are failing. Index: share/mk/Makefile =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- share/mk/Makefile (revision 354973) +++ share/mk/Makefile (working copy) @@ -56,6 +56,7 @@ FILES=3D \ bsd.suffixes.mk \ bsd.symver.mk \ bsd.sys.mk \ + bsd.sysdir.mk \ bsd.test.mk \ dirdeps.mk \ dirdeps-options.mk \ Jung-uk Kim --ThqEpL40cBdfwCB51MY0QOqy45lhP4IT5-- --LVlVuOS1aMHbPcqxQwZzvLZnouJJ4paQ8 Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- iQEzBAEBCAAdFiEEl1bqgKaRyqfWXu/CfJ+WJvzb8UYFAl3W6kIACgkQfJ+WJvzb 8UYbGwf9F2R6kRaVRcl/Z62kv9pt4e4zEuz6mTAB4Bz0IbEObbnHp5saUFtEwtPA uyoCj5/IdIz0zvXTm3Wkh9BZfJwsGVUK28i0/LQauRaxhnDhtmZ0ne/H2ZqUNRzo pfKCRrreMlW8wBF0PrJGKTtI27vrji/7ONQM9WUCj+BBwl+5BuPqKMd8VgPyWbQq NGjzMqscXHYucQFFTPkcXBqrm/+nwVfmjADRy/Y3MK4w8ttoS43mk7nYOaZXt5aT y4hK1AAlurtslGofJej/43YWwhICSpulv12gdCv7TDN7QOJUAOy8bL8VdzJ+8t5G +moK9+3utR1Q0FbC9uJ7uN2Kj50XIw== =pRHL -----END PGP SIGNATURE----- --LVlVuOS1aMHbPcqxQwZzvLZnouJJ4paQ8-- From owner-svn-src-all@freebsd.org Thu Nov 21 19:54:11 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 16F711C94D3; Thu, 21 Nov 2019 19:54:11 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47JqyB6wQrz3MMb; Thu, 21 Nov 2019 19:54:10 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id D20B5185B6; Thu, 21 Nov 2019 19:54:10 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xALJsA4r053936; Thu, 21 Nov 2019 19:54:10 GMT (envelope-from imp@FreeBSD.org) Received: (from imp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xALJsAUb053935; Thu, 21 Nov 2019 19:54:10 GMT (envelope-from imp@FreeBSD.org) Message-Id: <201911211954.xALJsAUb053935@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: imp set sender to imp@FreeBSD.org using -f From: Warner Losh Date: Thu, 21 Nov 2019 19:54:10 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354976 - head/share/mk X-SVN-Group: head X-SVN-Commit-Author: imp X-SVN-Commit-Paths: head/share/mk X-SVN-Commit-Revision: 354976 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 21 Nov 2019 19:54:11 -0000 Author: imp Date: Thu Nov 21 19:54:10 2019 New Revision: 354976 URL: https://svnweb.freebsd.org/changeset/base/354976 Log: Install bsd.sysdir.mk. Submitted by: Jung-uk Kim Modified: head/share/mk/Makefile Modified: head/share/mk/Makefile ============================================================================== --- head/share/mk/Makefile Thu Nov 21 19:36:11 2019 (r354975) +++ head/share/mk/Makefile Thu Nov 21 19:54:10 2019 (r354976) @@ -56,6 +56,7 @@ FILES= \ bsd.suffixes.mk \ bsd.symver.mk \ bsd.sys.mk \ + bsd.sysdir.mk \ bsd.test.mk \ dirdeps.mk \ dirdeps-options.mk \ From owner-svn-src-all@freebsd.org Thu Nov 21 19:57:57 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id BC1F21C95E5; Thu, 21 Nov 2019 19:57:57 +0000 (UTC) (envelope-from erj@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47Jr2Y4TwJz3McH; Thu, 21 Nov 2019 19:57:57 +0000 (UTC) (envelope-from erj@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 63263185BF; Thu, 21 Nov 2019 19:57:57 +0000 (UTC) (envelope-from erj@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xALJvvcF054403; Thu, 21 Nov 2019 19:57:57 GMT (envelope-from erj@FreeBSD.org) Received: (from erj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xALJvuwi054399; Thu, 21 Nov 2019 19:57:56 GMT (envelope-from erj@FreeBSD.org) Message-Id: <201911211957.xALJvuwi054399@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: erj set sender to erj@FreeBSD.org using -f From: Eric Joyner Date: Thu, 21 Nov 2019 19:57:56 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354977 - in head: share/man/man3 sys/sys tests/sys/sys X-SVN-Group: head X-SVN-Commit-Author: erj X-SVN-Commit-Paths: in head: share/man/man3 sys/sys tests/sys/sys X-SVN-Commit-Revision: 354977 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 21 Nov 2019 19:57:57 -0000 Author: erj Date: Thu Nov 21 19:57:56 2019 New Revision: 354977 URL: https://svnweb.freebsd.org/changeset/base/354977 Log: bitstring: add functions to find contiguous set/unset bit sequences Add bit_ffs_area_at and bit_ffc_area_at functions for searching a bit string for a sequence of contiguous set or unset bits of at least the specified size. The bit_ffc_area function will be used by the Intel ice driver for implementing resource assignment logic using a bitstring to represent whether or not a given index has been assigned or is currently free. The bit_ffs_area, bit_ffc_area_at and bit_ffs_area_at functions are implemented for completeness. I'd like to add further test cases for the new functions, but I'm not really sure how to add them easily. The new functions depend on specific sequences of bits being set, while the bitstring tests appear to run for varying bit sizes. Signed-off-by: Jacob Keller Submitted by: Jacob Keller Reviewed by: asomers@, erj@ MFC after: 1 week Sponsored by: Intel Corporation Differential Revision: https://reviews.freebsd.org/D22400 Modified: head/share/man/man3/bitstring.3 head/sys/sys/bitstring.h head/sys/sys/param.h head/tests/sys/sys/bitstring_test.c Modified: head/share/man/man3/bitstring.3 ============================================================================== --- head/share/man/man3/bitstring.3 Thu Nov 21 19:54:10 2019 (r354976) +++ head/share/man/man3/bitstring.3 Thu Nov 21 19:57:56 2019 (r354977) @@ -58,7 +58,7 @@ .\" @(#)bitstring.3 8.1 (Berkeley) 7/19/93 .\" $FreeBSD$ .\" -.Dd May 23, 2016 +.Dd Nov 18, 2019 .Dt BITSTRING 3 .Os .Sh NAME @@ -70,6 +70,10 @@ .Nm bit_ffs , .Nm bit_ffc_at , .Nm bit_ffs_at , +.Nm bit_ffc_area , +.Nm bit_ffs_area , +.Nm bit_ffc_area_at , +.Nm bit_ffs_area_at , .Nm bit_nclear , .Nm bit_nset , .Nm bit_set , @@ -95,6 +99,14 @@ .Ft void .Fn bit_ffs_at "bitstr_t *name" "int start" "int nbits" "int *value" .Ft void +.Fn bit_ffc_area "bitstr_t *name" "int nbits" "int size" "int *value" +.Ft void +.Fn bit_ffs_area "bitstr_t *name" "int nbits" "int size" "int *value" +.Ft void +.Fn bit_ffc_area_at "bitstr_t *name" "int start" "int nbits" "int size" "int *value" +.Ft void +.Fn bit_ffs_area_at "bitstr_t *name" "int start" "int nbits" "int size" "int *value" +.Ft void .Fn bit_nclear "bitstr_t *name" "int start" "int stop" .Ft void .Fn bit_nset "bitstr_t *name" "int start" "int stop" @@ -223,6 +235,82 @@ bits referenced by at or after the zero-based bit index .Fa start . If no bits are set after +.Fa start , +the location referenced by +.Fa value +is set to \-1. +.Pp +The +.Fn bit_ffc_area +function stores in the location referenced by +.Fa value +the zero-based number of the first bit beginning a sequence of unset bits of +at least +.Fa size +unset bits in the array of +.Fa nbits +bits referenced by +.Fa name . +If no sequence of contiguous unset bits of the specified +.Fa size +can be found, the location referenced by +.Fa value +is set to \-1. +.Pp +The +.Fn bit_ffs_area +function stores in the location referenced by +.Fa value +the zero-based number of the first bit beginning a sequence of set bits of +at least +.Fa size +set bits in the array of +.Fa nbits +bits referenced by +.Fa name . +If no sequence of contiguous set bits of the specified +.Fa size +can be found, the location referenced by +.Fa value +is set to \-1. +.Pp +The +.Fn bit_ffc_area_at +function stores in the location referenced by +.Fa value +the zero-based number of the first bit beginning a sequence of unset bits of +at least +.Fa size +unset bits in the array of +.Fa nbits +bits referenced by +.Fa name , +at or after the zero-based bit index +.Fa start . +If no sequence of contiguous unset bits of the specified +.Fa size +can be found at or after +.Fa start , +the location referenced by +.Fa value +is set to \-1. +.Pp +The +.Fn bit_ffs_area_at +function stores in the location referenced by +.Fa value +the zero-based number of the first bit beginning a sequence of set bits of +at least +.Fa size +set bits in the array of +.Fa nbits +bits referenced by +.Fa name , +at or after the zero-based bit index +.Fa start . +If no sequence of contiguous set bits of the specified +.Fa size +can be found at or after .Fa start , the location referenced by .Fa value Modified: head/sys/sys/bitstring.h ============================================================================== --- head/sys/sys/bitstring.h Thu Nov 21 19:54:10 2019 (r354976) +++ head/sys/sys/bitstring.h Thu Nov 21 19:57:56 2019 (r354977) @@ -275,6 +275,84 @@ bit_ffc(bitstr_t *_bitstr, int _nbits, int *_result) bit_ffc_at(_bitstr, /*start*/0, _nbits, _result); } +/* Find contiguous sequence of at least size set bits at or after start */ +static inline void +bit_ffs_area_at(bitstr_t *_bitstr, int _start, int _nbits, int _size, int *_result) +{ + int _index, _end, _i; +again: + /* Find the first set bit */ + bit_ffs_at(_bitstr, _start, _nbits, &_index); + if (_index < 0) { + *_result = -1; + return; + } + + /* Make sure there is enough room left in the bitstr */ + _end = _index + _size; + if (_end > _nbits) { + *_result = -1; + return; + } + + /* Find the next cleared bit starting at _index, stopping at _end */ + bit_ffc_at(_bitstr, _index, _end, &_i); + if (_i >= 0) { + /* we found a clear bit between _index and _end, so skip ahead + * to the next bit and try again + */ + _start = _i + 1; + goto again; + } + *_result = _index; +} + +/* Find contiguous sequence of at least size cleared bits at or after start */ +static inline void +bit_ffc_area_at(bitstr_t *_bitstr, int _start, int _nbits, int _size, int *_result) +{ + int _index, _end, _i; +again: + /* Find the first zero bit */ + bit_ffc_at(_bitstr, _start, _nbits, &_index); + if (_index < 0) { + *_result = -1; + return; + } + + /* Make sure there is enough room left in the bitstr */ + _end = _index + _size; + if (_end > _nbits) { + *_result = -1; + return; + } + + /* Find the next set bit starting at _index, stopping at _end */ + bit_ffs_at(_bitstr, _index, _end, &_i); + if (_i >= 0) { + /* we found a set bit between _index and _end, so skip ahead + * to the next bit and try again + */ + _start = _i + 1; + goto again; + } + *_result = _index; +} + +/* Find contiguous sequence of at least size set bits in bit string */ +static inline void +bit_ffs_area(bitstr_t *_bitstr, int _nbits, int _size, int *_result) +{ + bit_ffs_area_at(_bitstr, /*start*/0, _nbits, _size, _result); +} + +/* Find contiguous sequence of at least size cleared bits in bit string */ +static inline void +bit_ffc_area(bitstr_t *_bitstr, int _nbits, int _size, int *_result) +{ + bit_ffc_area_at(_bitstr, /*start*/0, _nbits, _size, _result); +} + /* Count the number of bits set in a bitstr of size _nbits at or after _start */ static inline void bit_count(bitstr_t *_bitstr, int _start, int _nbits, int *_result) Modified: head/sys/sys/param.h ============================================================================== --- head/sys/sys/param.h Thu Nov 21 19:54:10 2019 (r354976) +++ head/sys/sys/param.h Thu Nov 21 19:57:56 2019 (r354977) @@ -60,7 +60,7 @@ * in the range 5 to 9. */ #undef __FreeBSD_version -#define __FreeBSD_version 1300060 /* Master, propagated to newvers */ +#define __FreeBSD_version 1300061 /* Master, propagated to newvers */ /* * __FreeBSD_kernel__ indicates that this system uses the kernel of FreeBSD, Modified: head/tests/sys/sys/bitstring_test.c ============================================================================== --- head/tests/sys/sys/bitstring_test.c Thu Nov 21 19:54:10 2019 (r354976) +++ head/tests/sys/sys/bitstring_test.c Thu Nov 21 19:57:56 2019 (r354977) @@ -321,6 +321,169 @@ BITSTRING_TC_DEFINE(bit_ffc_at) nbits, memloc, nbits + 3, found_clear_bit); } +BITSTRING_TC_DEFINE(bit_ffc_area_no_match) +/* bitstr_t *bitstr, int nbits, const char *memloc */ +{ + int found_clear_bits; + + memset(bitstr, 0xFF, bitstr_size(nbits)); + bit_ffc_area(bitstr, nbits, 2, &found_clear_bits); + ATF_REQUIRE_EQ_MSG(-1, found_clear_bits, + "bit_ffc_area_%d_%s: Failed all set bits.", nbits, memloc); +} + +BITSTRING_TC_DEFINE(bit_ffs_area_no_match) +/* bitstr_t *bitstr, int nbits, const char *memloc */ +{ + int found_clear_bits; + + memset(bitstr, 0, bitstr_size(nbits)); + bit_ffs_area(bitstr, nbits, 2, &found_clear_bits); + ATF_REQUIRE_EQ_MSG(-1, found_clear_bits, + "bit_ffc_area_%d_%s: Failed all clear bits.", nbits, memloc); +} + +ATF_TC_WITHOUT_HEAD(bit_ffs_area); +ATF_TC_BODY(bit_ffs_area, tc) +{ + const int nbits = 72; + bitstr_t bit_decl(bitstr, nbits) = {}; + int location; + + bit_set(bitstr, 5); + bit_set(bitstr, 6); + + location = 0; + bit_ffs_area(bitstr, nbits, 3, &location); + ATF_REQUIRE_EQ_MSG(-1, location, + "bit_ffc_area: found location of size 3 when only 2 bits are set"); + + bit_set(bitstr, 7); + + location = 0; + bit_ffs_area(bitstr, nbits, 3, &location); + ATF_REQUIRE_EQ_MSG(5, location, + "bit_ffc_area: failed to find location of size 3"); + + bit_set(bitstr, 8); + + location = 0; + bit_ffs_area(bitstr, nbits, 3, &location); + ATF_REQUIRE_EQ_MSG(5, location, + "bit_ffc_area: failed to find location of size 3"); + + location = 0; + bit_ffs_area_at(bitstr, 2, nbits, 3, &location); + ATF_REQUIRE_EQ_MSG(5, location, + "bit_ffc_area: failed to find location of size 3"); + + location = 0; + bit_ffs_area_at(bitstr, 6, nbits, 3, &location); + ATF_REQUIRE_EQ_MSG(6, location, + "bit_ffc_area: failed to find location of size 3"); + + location = 0; + bit_ffs_area_at(bitstr, 8, nbits, 3, &location); + ATF_REQUIRE_EQ_MSG(-1, location, + "bit_ffc_area: found invalid location"); + + bit_set(bitstr, 69); + bit_set(bitstr, 70); + bit_set(bitstr, 71); + + location = 0; + bit_ffs_area_at(bitstr, 8, nbits, 3, &location); + ATF_REQUIRE_EQ_MSG(69, location, + "bit_ffc_area: failed to find location of size 3"); + + location = 0; + bit_ffs_area_at(bitstr, 69, nbits, 3, &location); + ATF_REQUIRE_EQ_MSG(69, location, + "bit_ffc_area: failed to find location of size 3"); + + location = 0; + bit_ffs_area_at(bitstr, 70, nbits, 3, &location); + ATF_REQUIRE_EQ_MSG(-1, location, + "bit_ffc_area: found invalid location"); + + location = 0; + bit_ffs_area_at(bitstr, 72, nbits, 3, &location); + ATF_REQUIRE_EQ_MSG(-1, location, + "bit_ffc_area: found invalid location"); +} + +ATF_TC_WITHOUT_HEAD(bit_ffc_area); +ATF_TC_BODY(bit_ffc_area, tc) +{ + const int nbits = 80; + bitstr_t bit_decl(bitstr, nbits) = {}; + int location; + + /* set all bits */ + memset(bitstr, 0xFF, bitstr_size(nbits)); + + bit_clear(bitstr, 7); + bit_clear(bitstr, 8); + + location = 0; + bit_ffc_area(bitstr, nbits, 3, &location); + ATF_REQUIRE_EQ_MSG(-1, location, + "bit_ffc_area: found location of size 3 when only 2 bits are set"); + + bit_clear(bitstr, 9); + + location = 0; + bit_ffc_area(bitstr, nbits, 3, &location); + ATF_REQUIRE_EQ_MSG(7, location, + "bit_ffc_area: failed to find location of size 3"); + + bit_clear(bitstr, 10); + + location = 0; + bit_ffc_area(bitstr, nbits, 3, &location); + ATF_REQUIRE_EQ_MSG(7, location, + "bit_ffc_area: failed to find location of size 3"); + + location = 0; + bit_ffc_area_at(bitstr, 2, nbits, 3, &location); + ATF_REQUIRE_EQ_MSG(7, location, + "bit_ffc_area: failed to find location of size 3"); + + location = 0; + bit_ffc_area_at(bitstr, 8, nbits, 3, &location); + ATF_REQUIRE_EQ_MSG(8, location, + "bit_ffc_area: failed to find location of size 3"); + + location = 0; + bit_ffc_area_at(bitstr, 9, nbits, 3, &location); + ATF_REQUIRE_EQ_MSG(-1, location, + "bit_ffc_area: found invalid bit location"); + + bit_clear(bitstr, 77); + bit_clear(bitstr, 78); + bit_clear(bitstr, 79); + + location = 0; + bit_ffc_area_at(bitstr, 12, nbits, 3, &location); + ATF_REQUIRE_EQ_MSG(77, location, + "bit_ffc_area: failed to find location of size 3"); + + location = 0; + bit_ffc_area_at(bitstr, 77, nbits, 3, &location); + ATF_REQUIRE_EQ_MSG(77, location, + "bit_ffc_area: failed to find location of size 3"); + + location = 0; + bit_ffc_area_at(bitstr, 78, nbits, 3, &location); + ATF_REQUIRE_EQ_MSG(-1, location, + "bit_ffc_area: found invalid location"); + + location = 0; + bit_ffc_area_at(bitstr, 85, nbits, 3, &location); + ATF_REQUIRE_EQ_MSG(-1, location, + "bit_ffc_area: found invalid location"); +} + BITSTRING_TC_DEFINE(bit_nclear) /* bitstr_t *bitstr, int nbits, const char *memloc */ { @@ -441,6 +604,8 @@ ATF_TP_ADD_TCS(tp) ATF_TP_ADD_TC(tp, bitstr_in_struct); ATF_TP_ADD_TC(tp, bitstr_size); + ATF_TP_ADD_TC(tp, bit_ffc_area); + ATF_TP_ADD_TC(tp, bit_ffs_area); BITSTRING_TC_ADD(tp, bit_set); BITSTRING_TC_ADD(tp, bit_clear); BITSTRING_TC_ADD(tp, bit_ffs); @@ -450,6 +615,8 @@ ATF_TP_ADD_TCS(tp) BITSTRING_TC_ADD(tp, bit_nclear); BITSTRING_TC_ADD(tp, bit_nset); BITSTRING_TC_ADD(tp, bit_count); + BITSTRING_TC_ADD(tp, bit_ffs_area_no_match); + BITSTRING_TC_ADD(tp, bit_ffc_area_no_match); return (atf_no_error()); } From owner-svn-src-all@freebsd.org Thu Nov 21 20:07:53 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 4ABB71C98D7; Thu, 21 Nov 2019 20:07:53 +0000 (UTC) (envelope-from cse.cem@gmail.com) Received: from mail-oi1-f181.google.com (mail-oi1-f181.google.com [209.85.167.181]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47JrG11D8kz3N3X; Thu, 21 Nov 2019 20:07:52 +0000 (UTC) (envelope-from cse.cem@gmail.com) Received: by mail-oi1-f181.google.com with SMTP id e9so4373598oif.8; Thu, 21 Nov 2019 12:07:52 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:reply-to :from:date:message-id:subject:to:cc; bh=05gWfSiXbWZpz/jDlrjnUKeI6YmiCcJJNFrYMqDIpY4=; b=SwHYFIOS1Erq+Kj2/ULkZn8w32bj1ppVNLLShxLJoiz9lFySeQgOaS+FhV9/MtN84J ekgt4YL5QOKXT6YTzJiVQ1lMHKyzVoYZwHmLiL80A8cmWNF3uQJCreZdKDjTGB42il/U T/r+38mteKt4cf73TY2A0PHAV+qrzqRzd5rpFY3exbfbdXcXNWoum18oeDgq+5X9g+VM po1VKL/UO4aVvbempx14mLtoCWrqGjPzT2SbCRSGZbcKKOD4IK9xCKRG0h8+EHN2jgo4 ootfNtbBBM6mdQD+nnvZsZSknYTpVt+LPPjuidEny5qf47enMOnq9g9R7ZX0mf6Bfm7j Hokg== X-Gm-Message-State: APjAAAVD9WVjqMlWjvJbTFGkl6X8Jp9lsxAnVRKwa4uuKHPUBydmBJpq yIaAwbmKYwjGtfMMPPQXsc0N8a9G X-Google-Smtp-Source: APXvYqwScCRx6DQzsQW/ASNA5TR33RpVEe0gKLW761MhvUXCULtvzTMIAVSuOtdmq7QQP5G3c4T0xA== X-Received: by 2002:aca:7293:: with SMTP id p141mr9395086oic.88.1574366871382; Thu, 21 Nov 2019 12:07:51 -0800 (PST) Received: from mail-oi1-f174.google.com (mail-oi1-f174.google.com. [209.85.167.174]) by smtp.gmail.com with ESMTPSA id r4sm1333037otg.55.2019.11.21.12.07.51 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 21 Nov 2019 12:07:51 -0800 (PST) Received: by mail-oi1-f174.google.com with SMTP id n16so4414228oig.2; Thu, 21 Nov 2019 12:07:51 -0800 (PST) X-Received: by 2002:aca:6006:: with SMTP id u6mr9380231oib.137.1574366870956; Thu, 21 Nov 2019 12:07:50 -0800 (PST) MIME-Version: 1.0 References: <201911211957.xALJvuwi054399@repo.freebsd.org> In-Reply-To: <201911211957.xALJvuwi054399@repo.freebsd.org> Reply-To: cem@freebsd.org From: Conrad Meyer Date: Thu, 21 Nov 2019 12:07:40 -0800 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: svn commit: r354977 - in head: share/man/man3 sys/sys tests/sys/sys To: Eric Joyner Cc: src-committers , svn-src-all , svn-src-head Content-Type: text/plain; charset="UTF-8" X-Rspamd-Queue-Id: 47JrG11D8kz3N3X X-Spamd-Bar: ----- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-6.00 / 15.00]; NEURAL_HAM_MEDIUM(-1.00)[-0.999,0]; NEURAL_HAM_LONG(-1.00)[-0.999,0]; REPLY(-4.00)[]; TAGGED_FROM(0.00)[] X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 21 Nov 2019 20:07:53 -0000 Hi Eric, On Thu, Nov 21, 2019 at 11:58 AM Eric Joyner wrote: > > Author: erj > Date: Thu Nov 21 19:57:56 2019 > New Revision: 354977 > URL: https://svnweb.freebsd.org/changeset/base/354977 > > Log: > bitstring: add functions to find contiguous set/unset bit sequences > > Add bit_ffs_area_at and bit_ffc_area_at functions for searching a bit > string for a sequence of contiguous set or unset bits of at least the > specified size. > > The bit_ffc_area function will be used by the Intel ice driver for > implementing resource assignment logic using a bitstring to represent > whether or not a given index has been assigned or is currently free. I don't know what the ice driver is/does, so apologies if this is nonsensical. Would it make more sense to use vmem(9) for this purpose? It's a general-purpose resource allocator and can scale well with large numbers of resources / CPUs. Best, Conrad From owner-svn-src-all@freebsd.org Thu Nov 21 20:15:23 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 46E491C9BDD; Thu, 21 Nov 2019 20:15:23 +0000 (UTC) (envelope-from cy@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47JrQg14DJz3NYQ; Thu, 21 Nov 2019 20:15:23 +0000 (UTC) (envelope-from cy@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 0736718986; Thu, 21 Nov 2019 20:15:23 +0000 (UTC) (envelope-from cy@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xALKFMcR066042; Thu, 21 Nov 2019 20:15:22 GMT (envelope-from cy@FreeBSD.org) Received: (from cy@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xALKFMpn066041; Thu, 21 Nov 2019 20:15:22 GMT (envelope-from cy@FreeBSD.org) Message-Id: <201911212015.xALKFMpn066041@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: cy set sender to cy@FreeBSD.org using -f From: Cy Schubert Date: Thu, 21 Nov 2019 20:15:22 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354978 - head/usr.sbin/ntp X-SVN-Group: head X-SVN-Commit-Author: cy X-SVN-Commit-Paths: head/usr.sbin/ntp X-SVN-Commit-Revision: 354978 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 21 Nov 2019 20:15:23 -0000 Author: cy Date: Thu Nov 21 20:15:22 2019 New Revision: 354978 URL: https://svnweb.freebsd.org/changeset/base/354978 Log: Chase r344883. ntp is 4.2.8p13. MFC after: 3 days Modified: head/usr.sbin/ntp/config.h Modified: head/usr.sbin/ntp/config.h ============================================================================== --- head/usr.sbin/ntp/config.h Thu Nov 21 19:57:56 2019 (r354977) +++ head/usr.sbin/ntp/config.h Thu Nov 21 20:15:22 2019 (r354978) @@ -1477,7 +1477,7 @@ #define PACKAGE_URL "http://www.ntp.org./" /* Define to the version of this package. */ -#define PACKAGE_VERSION "4.2.8p12" +#define PACKAGE_VERSION "4.2.8p13" /* data dir */ #define PERLLIBDIR "/usr/share/ntp/lib" From owner-svn-src-all@freebsd.org Thu Nov 21 20:22:10 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 650141C9F05; Thu, 21 Nov 2019 20:22:10 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47JrZV2jvxz3P5q; Thu, 21 Nov 2019 20:22:10 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4069418B1C; Thu, 21 Nov 2019 20:22:10 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xALKMArt071832; Thu, 21 Nov 2019 20:22:10 GMT (envelope-from dim@FreeBSD.org) Received: (from dim@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xALKM8WW071823; Thu, 21 Nov 2019 20:22:08 GMT (envelope-from dim@FreeBSD.org) Message-Id: <201911212022.xALKM8WW071823@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dim set sender to dim@FreeBSD.org using -f From: Dimitry Andric Date: Thu, 21 Nov 2019 20:22:08 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354979 - in head/contrib/llvm/lib/Target/Mips: . AsmParser Disassembler X-SVN-Group: head X-SVN-Commit-Author: dim X-SVN-Commit-Paths: in head/contrib/llvm/lib/Target/Mips: . AsmParser Disassembler X-SVN-Commit-Revision: 354979 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 21 Nov 2019 20:22:10 -0000 Author: dim Date: Thu Nov 21 20:22:07 2019 New Revision: 354979 URL: https://svnweb.freebsd.org/changeset/base/354979 Log: Merge commit 7bed381ea from llvm git (by Simon Atanasyan): [mips] Implement Octeon+ `saa` and `saad` instructions `saa` and `saad` are 32-bit and 64-bit store atomic add instructions. memory[base] = memory[base] + rt These instructions are available for "Octeon+" CPU. The patch adds support for both instructions to MIPS assembler and diassembler and introduces new CPU type - "octeon+". Next patches will implement `.set arch=octeon+` directive and `AFL_EXT_OCTEONP` ISA extension flag support. Differential Revision: https://reviews.llvm.org/D69849 This is one of the upstream changes needed for adding support for the OCTEON+ CPU type, so that we can test Clang builds using the most commonly available FreeBSD/mips64 reference platform, the Edge Router Lite. Requested by: kevans MFC after: 1 month X-MFC-With: r353358 Modified: head/contrib/llvm/lib/Target/Mips/AsmParser/MipsAsmParser.cpp head/contrib/llvm/lib/Target/Mips/Disassembler/MipsDisassembler.cpp head/contrib/llvm/lib/Target/Mips/Mips.td head/contrib/llvm/lib/Target/Mips/Mips64InstrInfo.td head/contrib/llvm/lib/Target/Mips/MipsInstrFormats.td head/contrib/llvm/lib/Target/Mips/MipsInstrInfo.td head/contrib/llvm/lib/Target/Mips/MipsScheduleGeneric.td head/contrib/llvm/lib/Target/Mips/MipsScheduleP5600.td head/contrib/llvm/lib/Target/Mips/MipsSubtarget.h Modified: head/contrib/llvm/lib/Target/Mips/AsmParser/MipsAsmParser.cpp ============================================================================== --- head/contrib/llvm/lib/Target/Mips/AsmParser/MipsAsmParser.cpp Thu Nov 21 20:15:22 2019 (r354978) +++ head/contrib/llvm/lib/Target/Mips/AsmParser/MipsAsmParser.cpp Thu Nov 21 20:22:07 2019 (r354979) @@ -125,7 +125,8 @@ const FeatureBitset MipsAssemblerOptions::AllArchRelat Mips::FeatureMips32r3, Mips::FeatureMips32r5, Mips::FeatureMips32r6, Mips::FeatureMips64, Mips::FeatureMips64r2, Mips::FeatureMips64r3, Mips::FeatureMips64r5, Mips::FeatureMips64r6, Mips::FeatureCnMips, - Mips::FeatureFP64Bit, Mips::FeatureGP64Bit, Mips::FeatureNaN2008 + Mips::FeatureCnMipsP, Mips::FeatureFP64Bit, Mips::FeatureGP64Bit, + Mips::FeatureNaN2008 }; namespace { @@ -324,6 +325,9 @@ class MipsAsmParser : public MCTargetAsmParser { bool expandMXTRAlias(MCInst &Inst, SMLoc IDLoc, MCStreamer &Out, const MCSubtargetInfo *STI); + bool expandSaaAddr(MCInst &Inst, SMLoc IDLoc, MCStreamer &Out, + const MCSubtargetInfo *STI); + bool reportParseError(Twine ErrorMsg); bool reportParseError(SMLoc Loc, Twine ErrorMsg); @@ -648,6 +652,10 @@ class MipsAsmParser : public MCTargetAsmParser { return (getSTI().getFeatureBits()[Mips::FeatureCnMips]); } + bool hasCnMipsP() const { + return (getSTI().getFeatureBits()[Mips::FeatureCnMipsP]); + } + bool inPicMode() { return IsPicEnabled; } @@ -2584,6 +2592,9 @@ MipsAsmParser::tryExpandInstruction(MCInst &Inst, SMLo case Mips::MFTHC1: case Mips::MTTHC1: case Mips::CFTC1: case Mips::CTTC1: return expandMXTRAlias(Inst, IDLoc, Out, STI) ? MER_Fail : MER_Success; + case Mips::SaaAddr: + case Mips::SaadAddr: + return expandSaaAddr(Inst, IDLoc, Out, STI) ? MER_Fail : MER_Success; } } @@ -3074,7 +3085,7 @@ bool MipsAsmParser::loadAndAddSymbolAddress(const MCEx TOut.emitRRR(Mips::DADDu, DstReg, ATReg, SrcReg, IDLoc, STI); return false; - } else if (canUseATReg() && !RdRegIsRsReg) { + } else if (canUseATReg() && !RdRegIsRsReg && DstReg != getATReg(IDLoc)) { unsigned ATReg = getATReg(IDLoc); // If the $rs is different from $rd or if $rs isn't specified and we @@ -3101,7 +3112,8 @@ bool MipsAsmParser::loadAndAddSymbolAddress(const MCEx TOut.emitRRR(Mips::DADDu, DstReg, DstReg, SrcReg, IDLoc, STI); return false; - } else if (!canUseATReg() && !RdRegIsRsReg) { + } else if ((!canUseATReg() && !RdRegIsRsReg) || + (canUseATReg() && DstReg == getATReg(IDLoc))) { // Otherwise, synthesize the address in the destination register // serially: // (d)la $rd, sym/sym($rs) => lui $rd, %highest(sym) @@ -5356,6 +5368,39 @@ bool MipsAsmParser::expandMXTRAlias(MCInst &Inst, SMLo TOut.emitRRIII(IsMFTR ? Mips::MFTR : Mips::MTTR, Op0, Op1, u, sel, h, IDLoc, STI); + return false; +} + +bool MipsAsmParser::expandSaaAddr(MCInst &Inst, SMLoc IDLoc, MCStreamer &Out, + const MCSubtargetInfo *STI) { + assert(Inst.getNumOperands() == 3 && "expected three operands"); + assert(Inst.getOperand(0).isReg() && "expected register operand kind"); + assert(Inst.getOperand(1).isReg() && "expected register operand kind"); + + warnIfNoMacro(IDLoc); + + MipsTargetStreamer &TOut = getTargetStreamer(); + unsigned Opcode = Inst.getOpcode() == Mips::SaaAddr ? Mips::SAA : Mips::SAAD; + unsigned RtReg = Inst.getOperand(0).getReg(); + unsigned BaseReg = Inst.getOperand(1).getReg(); + const MCOperand &BaseOp = Inst.getOperand(2); + + if (BaseOp.isImm()) { + int64_t ImmValue = BaseOp.getImm(); + if (ImmValue == 0) { + TOut.emitRR(Opcode, RtReg, BaseReg, IDLoc, STI); + return false; + } + } + + unsigned ATReg = getATReg(IDLoc); + if (!ATReg) + return true; + + if (expandLoadAddress(ATReg, BaseReg, BaseOp, !isGP64bit(), IDLoc, Out, STI)) + return true; + + TOut.emitRR(Opcode, RtReg, ATReg, IDLoc, STI); return false; } Modified: head/contrib/llvm/lib/Target/Mips/Disassembler/MipsDisassembler.cpp ============================================================================== --- head/contrib/llvm/lib/Target/Mips/Disassembler/MipsDisassembler.cpp Thu Nov 21 20:15:22 2019 (r354978) +++ head/contrib/llvm/lib/Target/Mips/Disassembler/MipsDisassembler.cpp Thu Nov 21 20:22:07 2019 (r354979) @@ -63,6 +63,8 @@ class MipsDisassembler : public MCDisassembler { (publ bool hasCnMips() const { return STI.getFeatureBits()[Mips::FeatureCnMips]; } + bool hasCnMipsP() const { return STI.getFeatureBits()[Mips::FeatureCnMipsP]; } + bool hasCOP3() const { // Only present in MIPS-I and MIPS-II return !hasMips32() && !hasMips3(); @@ -1341,6 +1343,14 @@ DecodeStatus MipsDisassembler::getInstruction(MCInst & if (hasCnMips()) { LLVM_DEBUG(dbgs() << "Trying CnMips table (32-bit opcodes):\n"); Result = decodeInstruction(DecoderTableCnMips32, Instr, Insn, + Address, this, STI); + if (Result != MCDisassembler::Fail) + return Result; + } + + if (hasCnMipsP()) { + LLVM_DEBUG(dbgs() << "Trying CnMipsP table (32-bit opcodes):\n"); + Result = decodeInstruction(DecoderTableCnMipsP32, Instr, Insn, Address, this, STI); if (Result != MCDisassembler::Fail) return Result; Modified: head/contrib/llvm/lib/Target/Mips/Mips.td ============================================================================== --- head/contrib/llvm/lib/Target/Mips/Mips.td Thu Nov 21 20:15:22 2019 (r354978) +++ head/contrib/llvm/lib/Target/Mips/Mips.td Thu Nov 21 20:22:07 2019 (r354979) @@ -193,6 +193,10 @@ def FeatureCnMips : SubtargetFeature<"cnmips", "Ha "true", "Octeon cnMIPS Support", [FeatureMips64r2]>; +def FeatureCnMipsP : SubtargetFeature<"cnmipsp", "HasCnMipsP", + "true", "Octeon+ cnMIPS Support", + [FeatureCnMips]>; + def FeatureUseTCCInDIV : SubtargetFeature< "use-tcc-in-div", "UseTCCInDIV", "false", @@ -238,6 +242,7 @@ def : Proc<"mips64r3", [FeatureMips64r3]>; def : Proc<"mips64r5", [FeatureMips64r5]>; def : Proc<"mips64r6", [FeatureMips64r6]>; def : Proc<"octeon", [FeatureMips64r2, FeatureCnMips]>; +def : Proc<"octeon+", [FeatureMips64r2, FeatureCnMips, FeatureCnMipsP]>; def : ProcessorModel<"p5600", MipsP5600Model, [ImplP5600]>; def MipsAsmParser : AsmParser { Modified: head/contrib/llvm/lib/Target/Mips/Mips64InstrInfo.td ============================================================================== --- head/contrib/llvm/lib/Target/Mips/Mips64InstrInfo.td Thu Nov 21 20:15:22 2019 (r354978) +++ head/contrib/llvm/lib/Target/Mips/Mips64InstrInfo.td Thu Nov 21 20:22:07 2019 (r354979) @@ -585,6 +585,24 @@ def DMTC2_OCTEON : MFC2OP<"dmtc2", GPR64Opnd, II_DMTC2 ASE_CNMIPS; } +// Cavium Octeon+ cnMIPS instructions +let DecoderNamespace = "CnMipsP", + // FIXME: The lack of HasStdEnc is probably a bug + EncodingPredicates = [] in { + +class Saa: + InstSE<(outs), (ins GPR64Opnd:$rt, GPR64Opnd:$rs), + !strconcat(opstr, "\t$rt, (${rs})"), [], NoItinerary, FrmR, opstr>; + +def SAA : Saa<"saa">, SAA_FM<0x18>, ASE_CNMIPSP; +def SAAD : Saa<"saad">, SAA_FM<0x19>, ASE_CNMIPSP; + +def SaaAddr : MipsAsmPseudoInst<(outs), (ins GPR64Opnd:$rt, mem:$addr), + "saa\t$rt, $addr">, ASE_CNMIPSP; +def SaadAddr : MipsAsmPseudoInst<(outs), (ins GPR64Opnd:$rt, mem:$addr), + "saad\t$rt, $addr">, ASE_CNMIPSP; +} + } /// Move between CPU and coprocessor registers Modified: head/contrib/llvm/lib/Target/Mips/MipsInstrFormats.td ============================================================================== --- head/contrib/llvm/lib/Target/Mips/MipsInstrFormats.td Thu Nov 21 20:15:22 2019 (r354978) +++ head/contrib/llvm/lib/Target/Mips/MipsInstrFormats.td Thu Nov 21 20:22:07 2019 (r354979) @@ -626,6 +626,19 @@ class SEQI_FM funct> : StdArch { let Inst{5-0} = funct; } +class SAA_FM funct> : StdArch { + bits<5> rt; + bits<5> rs; + + bits<32> Inst; + + let Inst{31-26} = 0x1c; + let Inst{25-21} = rs; + let Inst{20-16} = rt; + let Inst{15-6} = 0; + let Inst{5-0} = funct; +} + //===----------------------------------------------------------------------===// // System calls format //===----------------------------------------------------------------------===// Modified: head/contrib/llvm/lib/Target/Mips/MipsInstrInfo.td ============================================================================== --- head/contrib/llvm/lib/Target/Mips/MipsInstrInfo.td Thu Nov 21 20:15:22 2019 (r354978) +++ head/contrib/llvm/lib/Target/Mips/MipsInstrInfo.td Thu Nov 21 20:22:07 2019 (r354979) @@ -211,6 +211,10 @@ def HasCnMips : Predicate<"Subtarget->hasCnMips( AssemblerPredicate<"FeatureCnMips">; def NotCnMips : Predicate<"!Subtarget->hasCnMips()">, AssemblerPredicate<"!FeatureCnMips">; +def HasCnMipsP : Predicate<"Subtarget->hasCnMipsP()">, + AssemblerPredicate<"FeatureCnMipsP">; +def NotCnMipsP : Predicate<"!Subtarget->hasCnMipsP()">, + AssemblerPredicate<"!FeatureCnMipsP">; def IsSym32 : Predicate<"Subtarget->HasSym32()">, AssemblerPredicate<"FeatureSym32">; def IsSym64 : Predicate<"!Subtarget->HasSym32()">, @@ -437,6 +441,14 @@ class ASE_CNMIPS { class NOT_ASE_CNMIPS { list ASEPredicate = [NotCnMips]; +} + +class ASE_CNMIPSP { + list ASEPredicate = [HasCnMipsP]; +} + +class NOT_ASE_CNMIPSP { + list ASEPredicate = [NotCnMipsP]; } class ASE_MIPS64_CNMIPS { Modified: head/contrib/llvm/lib/Target/Mips/MipsScheduleGeneric.td ============================================================================== --- head/contrib/llvm/lib/Target/Mips/MipsScheduleGeneric.td Thu Nov 21 20:15:22 2019 (r354978) +++ head/contrib/llvm/lib/Target/Mips/MipsScheduleGeneric.td Thu Nov 21 20:22:07 2019 (r354979) @@ -720,10 +720,15 @@ def : InstRW<[GenericWriteALU], (instrs BADDu, BBIT0, CINS, CINS32, CINS64_32, CINS_i32, DMFC2_OCTEON, DMTC2_OCTEON, DPOP, EXTS, EXTS32, MTM0, MTM1, MTM2, MTP0, MTP1, MTP2, - POP, SEQ, SEQi, SNE, SNEi, V3MULU, VMM0, - VMULU)>; + POP, SEQ, SEQi, SNE, SNEi, + V3MULU, VMM0, VMULU)>; def : InstRW<[GenericWriteMDUtoGPR], (instrs DMUL)>; + +// Cavium Networks MIPS (cnMIPSP) - Octeon+, HasCnMipsP +// ================================================= + +def : InstRW<[GenericWriteALU], (instrs SAA, SAAD)>; // FPU Pipelines // ============= Modified: head/contrib/llvm/lib/Target/Mips/MipsScheduleP5600.td ============================================================================== --- head/contrib/llvm/lib/Target/Mips/MipsScheduleP5600.td Thu Nov 21 20:15:22 2019 (r354978) +++ head/contrib/llvm/lib/Target/Mips/MipsScheduleP5600.td Thu Nov 21 20:22:07 2019 (r354979) @@ -18,7 +18,8 @@ def MipsP5600Model : SchedMachineModel { list UnsupportedFeatures = [HasMips3, HasMips32r6, HasMips64, HasMips64r2, HasMips64r5, HasMips64r6, IsGP64bit, IsPTR64bit, - InMicroMips, InMips16Mode, HasCnMips, + InMicroMips, InMips16Mode, + HasCnMips, HasCnMipsP, HasDSP, HasDSPR2, HasMT, HasCRC]; } Modified: head/contrib/llvm/lib/Target/Mips/MipsSubtarget.h ============================================================================== --- head/contrib/llvm/lib/Target/Mips/MipsSubtarget.h Thu Nov 21 20:15:22 2019 (r354978) +++ head/contrib/llvm/lib/Target/Mips/MipsSubtarget.h Thu Nov 21 20:22:07 2019 (r354979) @@ -111,6 +111,9 @@ class MipsSubtarget : public MipsGenSubtargetInfo { // CPU supports cnMIPS (Cavium Networks Octeon CPU). bool HasCnMips; + // CPU supports cnMIPSP (Cavium Networks Octeon+ CPU). + bool HasCnMipsP; + // isLinux - Target system is Linux. Is false we consider ELFOS for now. bool IsLinux; @@ -267,6 +270,7 @@ class MipsSubtarget : public MipsGenSubtargetInfo { bool hasMips64r6() const { return MipsArchVersion >= Mips64r6; } bool hasCnMips() const { return HasCnMips; } + bool hasCnMipsP() const { return HasCnMipsP; } bool isLittle() const { return IsLittle; } bool isABICalls() const { return !NoABICalls; } From owner-svn-src-all@freebsd.org Thu Nov 21 20:23:35 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id D26BC1C9FF3; Thu, 21 Nov 2019 20:23:35 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47Jrc758q5z3PHj; Thu, 21 Nov 2019 20:23:35 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 9431D18B3F; Thu, 21 Nov 2019 20:23:35 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xALKNZBE071978; Thu, 21 Nov 2019 20:23:35 GMT (envelope-from dim@FreeBSD.org) Received: (from dim@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xALKNZZA071977; Thu, 21 Nov 2019 20:23:35 GMT (envelope-from dim@FreeBSD.org) Message-Id: <201911212023.xALKNZZA071977@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dim set sender to dim@FreeBSD.org using -f From: Dimitry Andric Date: Thu, 21 Nov 2019 20:23:35 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354980 - head/contrib/llvm/lib/Target/Mips/AsmParser X-SVN-Group: head X-SVN-Commit-Author: dim X-SVN-Commit-Paths: head/contrib/llvm/lib/Target/Mips/AsmParser X-SVN-Commit-Revision: 354980 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 21 Nov 2019 20:23:35 -0000 Author: dim Date: Thu Nov 21 20:23:35 2019 New Revision: 354980 URL: https://svnweb.freebsd.org/changeset/base/354980 Log: Merge commit 3718102d4 from llvm git (by Simon Atanasyan): [mips] Support `octeon+` CPU in the `.set arch=` directive Differential Revision: https://reviews.llvm.org/D69850 This is one of the upstream changes needed for adding support for the OCTEON+ CPU type, so that we can test Clang builds using the most commonly available FreeBSD/mips64 reference platform, the Edge Router Lite. Requested by: kevans MFC after: 1 month X-MFC-With: r353358 Modified: head/contrib/llvm/lib/Target/Mips/AsmParser/MipsAsmParser.cpp Modified: head/contrib/llvm/lib/Target/Mips/AsmParser/MipsAsmParser.cpp ============================================================================== --- head/contrib/llvm/lib/Target/Mips/AsmParser/MipsAsmParser.cpp Thu Nov 21 20:22:07 2019 (r354979) +++ head/contrib/llvm/lib/Target/Mips/AsmParser/MipsAsmParser.cpp Thu Nov 21 20:23:35 2019 (r354980) @@ -7122,8 +7122,8 @@ bool MipsAsmParser::parseSetArchDirective() { return reportParseError("unexpected token, expected equals sign"); Parser.Lex(); - StringRef Arch; - if (Parser.parseIdentifier(Arch)) + StringRef Arch = getParser().parseStringToEndOfStatement().trim(); + if (Arch.empty()) return reportParseError("expected arch identifier"); StringRef ArchFeatureName = @@ -7144,6 +7144,7 @@ bool MipsAsmParser::parseSetArchDirective() { .Case("mips64r5", "mips64r5") .Case("mips64r6", "mips64r6") .Case("octeon", "cnmips") + .Case("octeon+", "cnmipsp") .Case("r4000", "mips3") // This is an implementation of Mips3. .Default(""); From owner-svn-src-all@freebsd.org Thu Nov 21 20:25:13 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 00AF11CA0C1; Thu, 21 Nov 2019 20:25:13 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47Jrf069T5z3PR9; Thu, 21 Nov 2019 20:25:12 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id B85C018B41; Thu, 21 Nov 2019 20:25:12 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xALKPC2m072112; Thu, 21 Nov 2019 20:25:12 GMT (envelope-from dim@FreeBSD.org) Received: (from dim@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xALKPCpx072111; Thu, 21 Nov 2019 20:25:12 GMT (envelope-from dim@FreeBSD.org) Message-Id: <201911212025.xALKPCpx072111@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dim set sender to dim@FreeBSD.org using -f From: Dimitry Andric Date: Thu, 21 Nov 2019 20:25:12 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354981 - head/contrib/llvm/lib/Target/Mips/MCTargetDesc X-SVN-Group: head X-SVN-Commit-Author: dim X-SVN-Commit-Paths: head/contrib/llvm/lib/Target/Mips/MCTargetDesc X-SVN-Commit-Revision: 354981 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 21 Nov 2019 20:25:13 -0000 Author: dim Date: Thu Nov 21 20:25:12 2019 New Revision: 354981 URL: https://svnweb.freebsd.org/changeset/base/354981 Log: Merge commit bf996f761 from llvm git (by Simon Atanasyan): [mips] Write `AFL_EXT_OCTEONP` flag to the `.MIPS.abiflags` section Differential Revision: https://reviews.llvm.org/D69851 This is one of the upstream changes needed for adding support for the OCTEON+ CPU type, so that we can test Clang builds using the most commonly available FreeBSD/mips64 reference platform, the Edge Router Lite. Requested by: kevans MFC after: 1 month X-MFC-With: r353358 Modified: head/contrib/llvm/lib/Target/Mips/MCTargetDesc/MipsABIFlagsSection.h Modified: head/contrib/llvm/lib/Target/Mips/MCTargetDesc/MipsABIFlagsSection.h ============================================================================== --- head/contrib/llvm/lib/Target/Mips/MCTargetDesc/MipsABIFlagsSection.h Thu Nov 21 20:23:35 2019 (r354980) +++ head/contrib/llvm/lib/Target/Mips/MCTargetDesc/MipsABIFlagsSection.h Thu Nov 21 20:25:12 2019 (r354981) @@ -139,7 +139,9 @@ struct MipsABIFlagsSection { (public) template void setISAExtensionFromPredicates(const PredicateLibrary &P) { - if (P.hasCnMips()) + if (P.hasCnMipsP()) + ISAExtension = Mips::AFL_EXT_OCTEONP; + else if (P.hasCnMips()) ISAExtension = Mips::AFL_EXT_OCTEON; else ISAExtension = Mips::AFL_EXT_NONE; From owner-svn-src-all@freebsd.org Thu Nov 21 20:26:36 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 01C021CA176; Thu, 21 Nov 2019 20:26:36 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47Jrgb562Xz3Pb3; Thu, 21 Nov 2019 20:26:35 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 93FDF18B5A; Thu, 21 Nov 2019 20:26:35 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xALKQZVe072217; Thu, 21 Nov 2019 20:26:35 GMT (envelope-from dim@FreeBSD.org) Received: (from dim@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xALKQZNF072215; Thu, 21 Nov 2019 20:26:35 GMT (envelope-from dim@FreeBSD.org) Message-Id: <201911212026.xALKQZNF072215@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dim set sender to dim@FreeBSD.org using -f From: Dimitry Andric Date: Thu, 21 Nov 2019 20:26:35 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354982 - in head/contrib/llvm/tools/clang/lib: Basic/Targets Driver/ToolChains X-SVN-Group: head X-SVN-Commit-Author: dim X-SVN-Commit-Paths: in head/contrib/llvm/tools/clang/lib: Basic/Targets Driver/ToolChains X-SVN-Commit-Revision: 354982 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 21 Nov 2019 20:26:36 -0000 Author: dim Date: Thu Nov 21 20:26:34 2019 New Revision: 354982 URL: https://svnweb.freebsd.org/changeset/base/354982 Log: Merge commit 3552d3e0f from llvm git (by Simon Atanasyan): [mips] Add `octeon+` to the list of CPUs accepted by the driver This is one of the upstream changes needed for adding support for the OCTEON+ CPU type, so that we can test Clang builds using the most commonly available FreeBSD/mips64 reference platform, the Edge Router Lite. Requested by: kevans MFC after: 1 month X-MFC-With: r353358 Modified: head/contrib/llvm/tools/clang/lib/Basic/Targets/Mips.cpp head/contrib/llvm/tools/clang/lib/Basic/Targets/Mips.h head/contrib/llvm/tools/clang/lib/Driver/ToolChains/Gnu.cpp Modified: head/contrib/llvm/tools/clang/lib/Basic/Targets/Mips.cpp ============================================================================== --- head/contrib/llvm/tools/clang/lib/Basic/Targets/Mips.cpp Thu Nov 21 20:25:12 2019 (r354981) +++ head/contrib/llvm/tools/clang/lib/Basic/Targets/Mips.cpp Thu Nov 21 20:26:34 2019 (r354982) @@ -39,6 +39,7 @@ bool MipsTargetInfo::processorSupportsGPR64() const { .Case("mips64r5", true) .Case("mips64r6", true) .Case("octeon", true) + .Case("octeon+", true) .Default(false); return false; } @@ -47,7 +48,7 @@ static constexpr llvm::StringLiteral ValidCPUNames[] = {"mips1"}, {"mips2"}, {"mips3"}, {"mips4"}, {"mips5"}, {"mips32"}, {"mips32r2"}, {"mips32r3"}, {"mips32r5"}, {"mips32r6"}, {"mips64"}, {"mips64r2"}, {"mips64r3"}, {"mips64r5"}, {"mips64r6"}, - {"octeon"}, {"p5600"}}; + {"octeon"}, {"octeon+"}, {"p5600"}}; bool MipsTargetInfo::isValidCPUName(StringRef Name) const { return llvm::find(ValidCPUNames, Name) != std::end(ValidCPUNames); Modified: head/contrib/llvm/tools/clang/lib/Basic/Targets/Mips.h ============================================================================== --- head/contrib/llvm/tools/clang/lib/Basic/Targets/Mips.h Thu Nov 21 20:25:12 2019 (r354981) +++ head/contrib/llvm/tools/clang/lib/Basic/Targets/Mips.h Thu Nov 21 20:26:34 2019 (r354982) @@ -180,6 +180,8 @@ class LLVM_LIBRARY_VISIBILITY MipsTargetInfo : public CPU = getCPU(); if (CPU == "octeon") Features["mips64r2"] = Features["cnmips"] = true; + else if (CPU == "octeon+") + Features["mips64r2"] = Features["cnmips"] = Features["cnmipsp"] = true; else Features[CPU] = true; return TargetInfo::initFeatureMap(Features, Diags, CPU, FeaturesVec); Modified: head/contrib/llvm/tools/clang/lib/Driver/ToolChains/Gnu.cpp ============================================================================== --- head/contrib/llvm/tools/clang/lib/Driver/ToolChains/Gnu.cpp Thu Nov 21 20:25:12 2019 (r354981) +++ head/contrib/llvm/tools/clang/lib/Driver/ToolChains/Gnu.cpp Thu Nov 21 20:26:34 2019 (r354982) @@ -1392,7 +1392,8 @@ bool clang::driver::findMIPSMultilibs(const Driver &D, addMultilibFlag(CPUName == "mips32r6", "march=mips32r6", Flags); addMultilibFlag(CPUName == "mips64", "march=mips64", Flags); addMultilibFlag(CPUName == "mips64r2" || CPUName == "mips64r3" || - CPUName == "mips64r5" || CPUName == "octeon", + CPUName == "mips64r5" || CPUName == "octeon" || + CPUName == "octeon+", "march=mips64r2", Flags); addMultilibFlag(CPUName == "mips64r6", "march=mips64r6", Flags); addMultilibFlag(isMicroMips(Args), "mmicromips", Flags); From owner-svn-src-all@freebsd.org Thu Nov 21 20:32:35 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 8BD4B1CA462; Thu, 21 Nov 2019 20:32:35 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47JrpW3Dcfz3Q2Q; Thu, 21 Nov 2019 20:32:35 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 53DD418D11; Thu, 21 Nov 2019 20:32:35 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xALKWZ8a077748; Thu, 21 Nov 2019 20:32:35 GMT (envelope-from dim@FreeBSD.org) Received: (from dim@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xALKWZOF077747; Thu, 21 Nov 2019 20:32:35 GMT (envelope-from dim@FreeBSD.org) Message-Id: <201911212032.xALKWZOF077747@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dim set sender to dim@FreeBSD.org using -f From: Dimitry Andric Date: Thu, 21 Nov 2019 20:32:35 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354983 - head/contrib/llvm/tools/clang/lib/Basic/Targets X-SVN-Group: head X-SVN-Commit-Author: dim X-SVN-Commit-Paths: head/contrib/llvm/tools/clang/lib/Basic/Targets X-SVN-Commit-Revision: 354983 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 21 Nov 2019 20:32:35 -0000 Author: dim Date: Thu Nov 21 20:32:34 2019 New Revision: 354983 URL: https://svnweb.freebsd.org/changeset/base/354983 Log: Merge commit e578d0fd2 from llvm git (by Simon Atanasyan): [mips] Fix `__mips_isa_rev` macros value for Octeon CPU This is one of the upstream changes needed for adding support for the OCTEON+ CPU type, so that we can test Clang builds using the most commonly available FreeBSD/mips64 reference platform, the Edge Router Lite. Requested by: kevans MFC after: 1 month X-MFC-With: r353358 Modified: head/contrib/llvm/tools/clang/lib/Basic/Targets/Mips.cpp Modified: head/contrib/llvm/tools/clang/lib/Basic/Targets/Mips.cpp ============================================================================== --- head/contrib/llvm/tools/clang/lib/Basic/Targets/Mips.cpp Thu Nov 21 20:26:34 2019 (r354982) +++ head/contrib/llvm/tools/clang/lib/Basic/Targets/Mips.cpp Thu Nov 21 20:32:34 2019 (r354983) @@ -62,7 +62,7 @@ void MipsTargetInfo::fillValidCPUList( unsigned MipsTargetInfo::getISARev() const { return llvm::StringSwitch(getCPU()) .Cases("mips32", "mips64", 1) - .Cases("mips32r2", "mips64r2", 2) + .Cases("mips32r2", "mips64r2", "octeon", 2) .Cases("mips32r3", "mips64r3", 3) .Cases("mips32r5", "mips64r5", 5) .Cases("mips32r6", "mips64r6", 6) From owner-svn-src-all@freebsd.org Thu Nov 21 20:35:54 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 26A4D1CA622; Thu, 21 Nov 2019 20:35:54 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47JrtL0Jtrz3QG6; Thu, 21 Nov 2019 20:35:54 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id E25B118D19; Thu, 21 Nov 2019 20:35:53 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xALKZrpG077955; Thu, 21 Nov 2019 20:35:53 GMT (envelope-from dim@FreeBSD.org) Received: (from dim@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xALKZrtU077954; Thu, 21 Nov 2019 20:35:53 GMT (envelope-from dim@FreeBSD.org) Message-Id: <201911212035.xALKZrtU077954@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dim set sender to dim@FreeBSD.org using -f From: Dimitry Andric Date: Thu, 21 Nov 2019 20:35:53 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354984 - head/contrib/llvm/tools/clang/lib/Basic/Targets X-SVN-Group: head X-SVN-Commit-Author: dim X-SVN-Commit-Paths: head/contrib/llvm/tools/clang/lib/Basic/Targets X-SVN-Commit-Revision: 354984 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 21 Nov 2019 20:35:54 -0000 Author: dim Date: Thu Nov 21 20:35:53 2019 New Revision: 354984 URL: https://svnweb.freebsd.org/changeset/base/354984 Log: Merge commit 0d14656b9 from llvm git (by Simon Atanasyan): [mips] Set __OCTEON__ macros This is one of the upstream changes needed for adding support for the OCTEON+ CPU type, so that we can test Clang builds using the most commonly available FreeBSD/mips64 reference platform, the Edge Router Lite. Requested by: kevans MFC after: 1 month X-MFC-With: r353358 Modified: head/contrib/llvm/tools/clang/lib/Basic/Targets/Mips.cpp Modified: head/contrib/llvm/tools/clang/lib/Basic/Targets/Mips.cpp ============================================================================== --- head/contrib/llvm/tools/clang/lib/Basic/Targets/Mips.cpp Thu Nov 21 20:32:34 2019 (r354983) +++ head/contrib/llvm/tools/clang/lib/Basic/Targets/Mips.cpp Thu Nov 21 20:35:53 2019 (r354984) @@ -190,6 +190,9 @@ void MipsTargetInfo::getTargetDefines(const LangOption Builder.defineMacro("_MIPS_ARCH", "\"" + CPU + "\""); Builder.defineMacro("_MIPS_ARCH_" + StringRef(CPU).upper()); + if (StringRef(CPU).startswith("octeon")) + Builder.defineMacro("__OCTEON__"); + // These shouldn't be defined for MIPS-I but there's no need to check // for that since MIPS-I isn't supported. Builder.defineMacro("__GCC_HAVE_SYNC_COMPARE_AND_SWAP_1"); From owner-svn-src-all@freebsd.org Thu Nov 21 20:36:46 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id DDF891CA6E6; Thu, 21 Nov 2019 20:36:46 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47JrvL5WY8z3QP6; Thu, 21 Nov 2019 20:36:46 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id A1F9218D1A; Thu, 21 Nov 2019 20:36:46 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xALKakR7078043; Thu, 21 Nov 2019 20:36:46 GMT (envelope-from dim@FreeBSD.org) Received: (from dim@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xALKakYp078042; Thu, 21 Nov 2019 20:36:46 GMT (envelope-from dim@FreeBSD.org) Message-Id: <201911212036.xALKakYp078042@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dim set sender to dim@FreeBSD.org using -f From: Dimitry Andric Date: Thu, 21 Nov 2019 20:36:46 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354985 - head/contrib/llvm/tools/clang/lib/Basic/Targets X-SVN-Group: head X-SVN-Commit-Author: dim X-SVN-Commit-Paths: head/contrib/llvm/tools/clang/lib/Basic/Targets X-SVN-Commit-Revision: 354985 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 21 Nov 2019 20:36:46 -0000 Author: dim Date: Thu Nov 21 20:36:46 2019 New Revision: 354985 URL: https://svnweb.freebsd.org/changeset/base/354985 Log: Merge commit a751f557d from llvm git (by Simon Atanasyan): [mips] Set macros for Octeon+ CPU This is one of the upstream changes needed for adding support for the OCTEON+ CPU type, so that we can test Clang builds using the most commonly available FreeBSD/mips64 reference platform, the Edge Router Lite. Requested by: kevans MFC after: 1 month X-MFC-With: r353358 Modified: head/contrib/llvm/tools/clang/lib/Basic/Targets/Mips.cpp Modified: head/contrib/llvm/tools/clang/lib/Basic/Targets/Mips.cpp ============================================================================== --- head/contrib/llvm/tools/clang/lib/Basic/Targets/Mips.cpp Thu Nov 21 20:35:53 2019 (r354984) +++ head/contrib/llvm/tools/clang/lib/Basic/Targets/Mips.cpp Thu Nov 21 20:36:46 2019 (r354985) @@ -62,7 +62,7 @@ void MipsTargetInfo::fillValidCPUList( unsigned MipsTargetInfo::getISARev() const { return llvm::StringSwitch(getCPU()) .Cases("mips32", "mips64", 1) - .Cases("mips32r2", "mips64r2", "octeon", 2) + .Cases("mips32r2", "mips64r2", "octeon", "octeon+", 2) .Cases("mips32r3", "mips64r3", 3) .Cases("mips32r5", "mips64r5", 5) .Cases("mips32r6", "mips64r6", 6) @@ -188,7 +188,10 @@ void MipsTargetInfo::getTargetDefines(const LangOption Builder.defineMacro("_MIPS_SZLONG", Twine(getLongWidth())); Builder.defineMacro("_MIPS_ARCH", "\"" + CPU + "\""); - Builder.defineMacro("_MIPS_ARCH_" + StringRef(CPU).upper()); + if (CPU == "octeon+") + Builder.defineMacro("_MIPS_ARCH_OCTEONP"); + else + Builder.defineMacro("_MIPS_ARCH_" + StringRef(CPU).upper()); if (StringRef(CPU).startswith("octeon")) Builder.defineMacro("__OCTEON__"); From owner-svn-src-all@freebsd.org Thu Nov 21 21:11:29 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id AACD81CAFDE; Thu, 21 Nov 2019 21:11:29 +0000 (UTC) (envelope-from brooks@spindle.one-eyed-alien.net) Received: from spindle.one-eyed-alien.net (spindle.one-eyed-alien.net [199.48.129.229]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 47JsgN6Hydz3xHy; Thu, 21 Nov 2019 21:11:28 +0000 (UTC) (envelope-from brooks@spindle.one-eyed-alien.net) Received: by spindle.one-eyed-alien.net (Postfix, from userid 3001) id DC0EB3C0199; Thu, 21 Nov 2019 21:11:27 +0000 (UTC) Date: Thu, 21 Nov 2019 21:11:27 +0000 From: Brooks Davis To: Glen Barber Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org, FreeBSD Ports Management Team , Colin Percival Subject: Re: svn commit: r354909 - in head: . share/mk Message-ID: <20191121211127.GC50024@spindle.one-eyed-alien.net> References: <201911201836.xAKIawWt053874@repo.freebsd.org> <20191121161337.GA92849@FreeBSD.org> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="dc+cDN39EJAMEtIO" Content-Disposition: inline In-Reply-To: <20191121161337.GA92849@FreeBSD.org> User-Agent: Mutt/1.9.4 (2018-02-28) X-Rspamd-Queue-Id: 47JsgN6Hydz3xHy X-Spamd-Bar: ------ Authentication-Results: mx1.freebsd.org; dkim=none; dmarc=none; spf=none (mx1.freebsd.org: domain of brooks@spindle.one-eyed-alien.net has no SPF policy when checking 199.48.129.229) smtp.mailfrom=brooks@spindle.one-eyed-alien.net X-Spamd-Result: default: False [-6.50 / 15.00]; ARC_NA(0.00)[]; NEURAL_HAM_MEDIUM(-0.99)[-0.992,0]; FROM_HAS_DN(0.00)[]; TO_DN_SOME(0.00)[]; TO_MATCH_ENVRCPT_ALL(0.00)[]; NEURAL_HAM_LONG(-1.00)[-0.997,0]; MIME_GOOD(-0.20)[multipart/signed,text/plain]; DMARC_NA(0.00)[freebsd.org]; AUTH_NA(1.00)[]; RCPT_COUNT_FIVE(0.00)[6]; IP_SCORE(-3.61)[ip: (-9.46), ipnet: 199.48.128.0/22(-4.72), asn: 36236(-3.85), country: US(-0.05)]; R_SPF_NA(0.00)[]; SIGNED_PGP(-2.00)[]; FORGED_SENDER(0.30)[brooks@freebsd.org,brooks@spindle.one-eyed-alien.net]; RCVD_COUNT_ZERO(0.00)[0]; R_DKIM_NA(0.00)[]; MIME_TRACE(0.00)[0:+,1:+,2:~]; ASN(0.00)[asn:36236, ipnet:199.48.128.0/22, country:US]; FROM_NEQ_ENVFROM(0.00)[brooks@freebsd.org,brooks@spindle.one-eyed-alien.net] X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 21 Nov 2019 21:11:29 -0000 --dc+cDN39EJAMEtIO Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Thu, Nov 21, 2019 at 04:13:37PM +0000, Glen Barber wrote: > On Wed, Nov 20, 2019 at 06:36:58PM +0000, Brooks Davis wrote: > > Author: brooks > > Date: Wed Nov 20 18:36:58 2019 > > New Revision: 354909 > > URL: https://svnweb.freebsd.org/changeset/base/354909 > >=20 > > Log: > > Make the warning for deprecated NO_ variables an error. > > =20 > > Support for NO_CTF, NO_DEBUG_FILES, NO_INSTALLLIB, NO_MAN, NO_PROFILE, > > and NO_WARNS as deprecated in 2014 with a warning added for each one > > found. Turn these into error in preperation for removal of compatabil= ity > > support before FreeBSD 13. > > =20 > > Reviewed by: imp > > Relnotes: yes > > Sponsored by: DARPA, AFRL > > Differential Revision: https://reviews.freebsd.org/D22448 > >=20 >=20 > > Modified: head/share/mk/bsd.opts.mk > > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D > > --- head/share/mk/bsd.opts.mk Wed Nov 20 18:12:01 2019 (r354908) > > +++ head/share/mk/bsd.opts.mk Wed Nov 20 18:36:58 2019 (r354909) > > @@ -100,7 +100,7 @@ __DEFAULT_DEPENDENT_OPTIONS =3D \ > > PROFILE \ > > WARNS > > .if defined(NO_${var}) > > -.warning "NO_${var} is defined, but deprecated. Please use MK_${var}= =3Dno instead." > > +.error "NO_${var} is defined, but deprecated. Please use MK_${var}=3Dn= o instead." > > MK_${var}:=3Dno > > .endif > > .endfor > >=20 >=20 > Had this been exp-run tested? This breaks at least the > net/bsdec2-image-upload port, which does *not* set NO_MAN explicitly in > its Makefile. I suspect at least several other ports are now implicitly > broken as result of this change. No, it wasn't. I didn't realize it was needed. I could revert if there's significant fallout. I've patched net/bsdec2-image-upload and I'm testing a patch for emulators/open-vm-tools. In general the issue is people putting NO_MAN=3D in Makefiles that the freebsd build infrastructure and then never looking at build output. In some cases it's clearly blind copy-and-paste (e.g. emulators/open-vm-tools sets NO_MAN and NOMAN in a kmod Makefile where they do nothing). Ideally I'd like to suppress these errors in ports unless DEVELOPER is defined, but I'm not sure how best to do that. -- Brooks --dc+cDN39EJAMEtIO Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQEcBAEBAgAGBQJd1v1/AAoJEKzQXbSebgfAGcMH/16GvoPgZCr65wRJ8bMeAmcV XL1PNd2kP7h/J6dPeWWVAEOh26FspYBzhu93hMDd1qcNqiHHT3HzDvsLaTaR+YJQ kyL9KytRC+XzFad5YgW0Q403u+P88jgQtllHvJm++Z79Rj732B18gKrggEnfTfUu 8MAb8jgaGRXrmaKCtbmHfeloiz2FPBXJh7mlG5Gf8sWonvKF6rzEfc4yRI04JnSn CNFIqeG6CGld0DP15oYNGzTdYvZC7kkF7DvFfKn0ilaquu4D22JF5he1KHG9JdxA 4/+tmw+xvRDTJKOg32YQr5Sc5NHFwW/tUIE97V4QQ441P68zcStd764791LdRu8= =wzRv -----END PGP SIGNATURE----- --dc+cDN39EJAMEtIO-- From owner-svn-src-all@freebsd.org Thu Nov 21 21:34:53 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 11A221CB828 for ; Thu, 21 Nov 2019 21:34:53 +0000 (UTC) (envelope-from ricera10@gmail.com) Received: from mail-lj1-f172.google.com (mail-lj1-f172.google.com [209.85.208.172]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47JtBM5Wplz3yYR for ; Thu, 21 Nov 2019 21:34:51 +0000 (UTC) (envelope-from ricera10@gmail.com) Received: by mail-lj1-f172.google.com with SMTP id y23so4882642ljh.10 for ; Thu, 21 Nov 2019 13:34:51 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=4DOMGgulyKFF9icac0EaFhtPMT+6AucIJGfMsjG4A54=; b=AfQvYx8YcnhXcTUWm8y4fhMreOOwzqBnn2Reo3sgllajbpXTrRXqknN4LX4OqEiem+ iqc1hig+UbGYubZfoUKXfIzNbVpIyGJi4O7RnoSaXbdxaR4AKbCWwIoW07kLmf4G44lf wg5onxKteD+CAONUV0c2D2uDh7E59dv0/5LcppJXWmN5lTJjWrO3lU7ZiayWMjgLZCed X3kJQ5pGniJvbfAEfanpR9oQDnmhf726XEKVeB6zgeDJDxqaqQ5KJplDfkgKleUjPGEZ EWs3JhgInEqbLBWVFHMqX0e2/PHG70LpxDdbjdmzJaAou8F+iTugTlNL3AyyiIkBnjUA hsFw== X-Gm-Message-State: APjAAAWCZ86XlK3Wf0hosbCE0MPbbgERhh/F0i8FfwHbjAV658ZrILkM a1jrze5D4qMQDfazHoljv8W1Vhbr X-Google-Smtp-Source: APXvYqzIBExYSFGqc2z33T2Botf4sL2oMK9UCSjjEVgHv7NiVYqJw8oTeSDsSkBQp9sPMS8HwhP2Ng== X-Received: by 2002:a2e:8613:: with SMTP id a19mr9316999lji.138.1574372089402; Thu, 21 Nov 2019 13:34:49 -0800 (PST) Received: from mail-lj1-f181.google.com (mail-lj1-f181.google.com. [209.85.208.181]) by smtp.gmail.com with ESMTPSA id x1sm2362470lff.90.2019.11.21.13.34.48 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 21 Nov 2019 13:34:48 -0800 (PST) Received: by mail-lj1-f181.google.com with SMTP id m4so4893552ljj.8 for ; Thu, 21 Nov 2019 13:34:48 -0800 (PST) X-Received: by 2002:a2e:9904:: with SMTP id v4mr9430770lji.211.1574372088118; Thu, 21 Nov 2019 13:34:48 -0800 (PST) MIME-Version: 1.0 References: <201911211957.xALJvuwi054399@repo.freebsd.org> In-Reply-To: From: Eric Joyner Date: Thu, 21 Nov 2019 13:34:36 -0800 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: svn commit: r354977 - in head: share/man/man3 sys/sys tests/sys/sys To: cem@freebsd.org Cc: src-committers , svn-src-all , svn-src-head , Jacob Keller X-Rspamd-Queue-Id: 47JtBM5Wplz3yYR X-Spamd-Bar: --- Authentication-Results: mx1.freebsd.org; dkim=none; dmarc=none; spf=pass (mx1.freebsd.org: domain of ricera10@gmail.com designates 209.85.208.172 as permitted sender) smtp.mailfrom=ricera10@gmail.com X-Spamd-Result: default: False [-3.10 / 15.00]; ARC_NA(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; FROM_HAS_DN(0.00)[]; TO_DN_SOME(0.00)[]; R_SPF_ALLOW(-0.20)[+ip4:209.85.128.0/17:c]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; MIME_GOOD(-0.10)[multipart/alternative,text/plain]; PREVIOUSLY_DELIVERED(0.00)[svn-src-all@freebsd.org]; DMARC_NA(0.00)[freebsd.org]; RCPT_COUNT_FIVE(0.00)[5]; RCVD_COUNT_THREE(0.00)[4]; MIME_TRACE(0.00)[0:+,1:+,2:~]; TO_MATCH_ENVRCPT_SOME(0.00)[]; RCVD_IN_DNSWL_NONE(0.00)[172.208.85.209.list.dnswl.org : 127.0.5.0]; IP_SCORE(-1.10)[ip: (-0.32), ipnet: 209.85.128.0/17(-3.17), asn: 15169(-1.97), country: US(-0.05)]; FORGED_SENDER(0.30)[erj@freebsd.org,ricera10@gmail.com]; RWL_MAILSPIKE_POSSIBLE(0.00)[172.208.85.209.rep.mailspike.net : 127.0.0.17]; R_DKIM_NA(0.00)[]; FREEMAIL_ENVFROM(0.00)[gmail.com]; ASN(0.00)[asn:15169, ipnet:209.85.128.0/17, country:US]; FROM_NEQ_ENVFROM(0.00)[erj@freebsd.org,ricera10@gmail.com]; RCVD_TLS_ALL(0.00)[] Content-Type: text/plain; charset="UTF-8" X-Content-Filtered-By: Mailman/MimeDel 2.1.29 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 21 Nov 2019 21:34:53 -0000 On Thu, Nov 21, 2019 at 12:07 PM Conrad Meyer wrote: > Hi Eric, > > On Thu, Nov 21, 2019 at 11:58 AM Eric Joyner wrote: > > > > Author: erj > > Date: Thu Nov 21 19:57:56 2019 > > New Revision: 354977 > > URL: https://svnweb.freebsd.org/changeset/base/354977 > > > > Log: > > bitstring: add functions to find contiguous set/unset bit sequences > > > > Add bit_ffs_area_at and bit_ffc_area_at functions for searching a bit > > string for a sequence of contiguous set or unset bits of at least the > > specified size. > > > > The bit_ffc_area function will be used by the Intel ice driver for > > implementing resource assignment logic using a bitstring to represent > > whether or not a given index has been assigned or is currently free. > > I don't know what the ice driver is/does, so apologies if this is > nonsensical. Would it make more sense to use vmem(9) for this > purpose? It's a general-purpose resource allocator and can scale well > with large numbers of resources / CPUs. > > Best, > Conrad > +Jake Hi Conrad, It doesn't seem nonsensical; this seems like it would vaguely be an ok fit. But one issue I find after looking at it is that it doesn't support the "scattered" allocations that we need; for some types of hardware queues we need to be able to group together multiple non-sequential allocations into one single block, and it doesn't look like we could do that without having to add another layer on top of vmem. As well, it looks like it's kind of overbuilt for what we need; we only need a few operations. It also seems to import a bunch of stuff in its headers, which might complicate using it in our unit test code. If you want to look at the current structure we use, you can look at the ice_pf_qmgr.[ch] files in this Phabricator review that introduces ice(4) to the kernel: https://reviews.freebsd.org/D21959. - Eric From owner-svn-src-all@freebsd.org Thu Nov 21 21:53:00 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 4D0AD1CBEE4; Thu, 21 Nov 2019 21:53:00 +0000 (UTC) (envelope-from jacob.e.keller@intel.com) Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "fmsmga101.fm.intel.com", Issuer "Sectigo RSA Organization Validation Secure Server CA" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47JtbG2Rmcz40hl; Thu, 21 Nov 2019 21:52:57 +0000 (UTC) (envelope-from jacob.e.keller@intel.com) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga003.jf.intel.com ([10.7.209.27]) by fmsmga101.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 21 Nov 2019 13:52:56 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.69,227,1571727600"; d="scan'208";a="210050194" Received: from orsmsx106.amr.corp.intel.com ([10.22.225.133]) by orsmga003.jf.intel.com with ESMTP; 21 Nov 2019 13:52:55 -0800 Received: from orsmsx152.amr.corp.intel.com (10.22.226.39) by ORSMSX106.amr.corp.intel.com (10.22.225.133) with Microsoft SMTP Server (TLS) id 14.3.439.0; Thu, 21 Nov 2019 13:52:55 -0800 Received: from orsmsx121.amr.corp.intel.com ([169.254.10.169]) by ORSMSX152.amr.corp.intel.com ([169.254.8.219]) with mapi id 14.03.0439.000; Thu, 21 Nov 2019 13:52:55 -0800 From: "Keller, Jacob E" To: "cem@freebsd.org" , "erj@freebsd.org" CC: "src-committers@freebsd.org" , "svn-src-head@freebsd.org" , "svn-src-all@freebsd.org" Subject: Re: svn commit: r354977 - in head: share/man/man3 sys/sys tests/sys/sys Thread-Topic: svn commit: r354977 - in head: share/man/man3 sys/sys tests/sys/sys Thread-Index: AQHVoLOSDkNl7xHhTke697Fm41TX06eWsMKA Date: Thu, 21 Nov 2019 21:52:54 +0000 Message-ID: <0435131fb462d6930409ce335af25dd5a33ec2b2.camel@intel.com> References: <201911211957.xALJvuwi054399@repo.freebsd.org> In-Reply-To: Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: user-agent: Evolution 3.32.5 (3.32.5-1.fc30) x-originating-ip: [10.166.244.172] Content-Type: text/plain; charset="utf-8" Content-ID: <79D7ACBE5BEFF449B24A34DE38A7B697@intel.com> Content-Transfer-Encoding: base64 MIME-Version: 1.0 X-Rspamd-Queue-Id: 47JtbG2Rmcz40hl X-Spamd-Bar: --------- Authentication-Results: mx1.freebsd.org; dkim=none; dmarc=pass (policy=none) header.from=intel.com; spf=pass (mx1.freebsd.org: domain of jacob.e.keller@intel.com designates 192.55.52.88 as permitted sender) smtp.mailfrom=jacob.e.keller@intel.com X-Spamd-Result: default: False [-9.98 / 15.00]; ARC_NA(0.00)[]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; RCVD_COUNT_FIVE(0.00)[5]; HAS_XOIP(0.00)[]; FROM_HAS_DN(0.00)[]; R_SPF_ALLOW(-0.20)[+ip4:192.55.52.88/32]; TO_MATCH_ENVRCPT_ALL(0.00)[]; MIME_GOOD(-0.10)[text/plain]; RCVD_TLS_LAST(0.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; RCPT_COUNT_FIVE(0.00)[5]; IP_SCORE(-3.78)[ip: (-9.91), ipnet: 192.55.52.0/24(-4.96), asn: 4983(-3.96), country: US(-0.05)]; MIME_BASE64_TEXT(0.10)[]; DMARC_POLICY_ALLOW(-0.50)[intel.com,none]; TO_DN_EQ_ADDR_ALL(0.00)[]; FROM_EQ_ENVFROM(0.00)[]; R_DKIM_NA(0.00)[]; MIME_TRACE(0.00)[0:+]; ASN(0.00)[asn:4983, ipnet:192.55.52.0/24, country:US]; RCVD_IN_DNSWL_HI(-0.50)[88.52.55.192.list.dnswl.org : 127.0.9.3]; MID_RHS_MATCH_FROM(0.00)[]; WHITELIST_SPF_DKIM(-3.00)[intel.com:s:+] X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 21 Nov 2019 21:53:00 -0000 T24gVGh1LCAyMDE5LTExLTIxIGF0IDEzOjM0IC0wODAwLCBFcmljIEpveW5lciB3cm90ZToNCj4g T24gVGh1LCBOb3YgMjEsIDIwMTkgYXQgMTI6MDcgUE0gQ29ucmFkIE1leWVyIDxjZW1AZnJlZWJz ZC5vcmc+DQo+IHdyb3RlOg0KPiA+IEhpIEVyaWMsDQo+ID4gDQo+ID4gT24gVGh1LCBOb3YgMjEs IDIwMTkgYXQgMTE6NTggQU0gRXJpYyBKb3luZXIgPGVyakBmcmVlYnNkLm9yZz4NCj4gPiB3cm90 ZToNCj4gPiA+DQo+ID4gPiBBdXRob3I6IGVyag0KPiA+ID4gRGF0ZTogVGh1IE5vdiAyMSAxOTo1 Nzo1NiAyMDE5DQo+ID4gPiBOZXcgUmV2aXNpb246IDM1NDk3Nw0KPiA+ID4gVVJMOiBodHRwczov L3N2bndlYi5mcmVlYnNkLm9yZy9jaGFuZ2VzZXQvYmFzZS8zNTQ5NzcNCj4gPiA+DQo+ID4gPiBM b2c6DQo+ID4gPiAgIGJpdHN0cmluZzogYWRkIGZ1bmN0aW9ucyB0byBmaW5kIGNvbnRpZ3VvdXMg c2V0L3Vuc2V0IGJpdA0KPiA+IHNlcXVlbmNlcw0KPiA+ID4NCj4gPiA+ICAgQWRkIGJpdF9mZnNf YXJlYV9hdCBhbmQgYml0X2ZmY19hcmVhX2F0IGZ1bmN0aW9ucyBmb3Igc2VhcmNoaW5nDQo+ID4g YSBiaXQNCj4gPiA+ICAgc3RyaW5nIGZvciBhIHNlcXVlbmNlIG9mIGNvbnRpZ3VvdXMgc2V0IG9y IHVuc2V0IGJpdHMgb2YgYXQNCj4gPiBsZWFzdCB0aGUNCj4gPiA+ICAgc3BlY2lmaWVkIHNpemUu DQo+ID4gPg0KPiA+ID4gICBUaGUgYml0X2ZmY19hcmVhIGZ1bmN0aW9uIHdpbGwgYmUgdXNlZCBi eSB0aGUgSW50ZWwgaWNlIGRyaXZlcg0KPiA+IGZvcg0KPiA+ID4gICBpbXBsZW1lbnRpbmcgcmVz b3VyY2UgYXNzaWdubWVudCBsb2dpYyB1c2luZyBhIGJpdHN0cmluZyB0bw0KPiA+IHJlcHJlc2Vu dA0KPiA+ID4gICB3aGV0aGVyIG9yIG5vdCBhIGdpdmVuIGluZGV4IGhhcyBiZWVuIGFzc2lnbmVk IG9yIGlzIGN1cnJlbnRseQ0KPiA+IGZyZWUuDQo+ID4gDQo+ID4gSSBkb24ndCBrbm93IHdoYXQg dGhlIGljZSBkcml2ZXIgaXMvZG9lcywgc28gYXBvbG9naWVzIGlmIHRoaXMgaXMNCj4gPiBub25z ZW5zaWNhbC4gIFdvdWxkIGl0IG1ha2UgbW9yZSBzZW5zZSB0byB1c2Ugdm1lbSg5KSBmb3IgdGhp cw0KPiA+IHB1cnBvc2U/ICBJdCdzIGEgZ2VuZXJhbC1wdXJwb3NlIHJlc291cmNlIGFsbG9jYXRv ciBhbmQgY2FuIHNjYWxlDQo+ID4gd2VsbA0KPiA+IHdpdGggbGFyZ2UgbnVtYmVycyBvZiByZXNv dXJjZXMgLyBDUFVzLg0KPiA+IA0KPiA+IEJlc3QsDQo+ID4gQ29ucmFkDQo+IA0KDQpFcmljIGFs cmVhZHkgYWRkZWQgdGhlIHJldmlldyBsaW5rIGZvciB0aGUgaWNlIGRyaXZlciwgd2hpY2ggd2UN CnJlY2VudGx5IHB1Ymxpc2hlZC4gSSdtIGN1cnJlbnRseSBnb2luZyB0aHJvdWdoIHJldmlldyBj b21tZW50cyBhbmQNCnByZWVwYXJpbmcgYW4gdXBkYXRlLg0KDQpXZSB1c2UgYSBiaXQgc3RyaW5n IGFzIGEgbWV0aG9kIG9mIGRldGVybWluaW5nIHdoaWNoIGluZGV4IG51bWJlcnMgaGF2ZQ0KYmVl biBhc3NpZ25lZC4NCg0KPiArSmFrZQ0KPiANCj4gSGkgQ29ucmFkLA0KPiANCj4gSXQgZG9lc24n dCBzZWVtIG5vbnNlbnNpY2FsOyB0aGlzIHNlZW1zIGxpa2UgaXQgd291bGQgdmFndWVseSBiZSBh bg0KPiBvayBmaXQuIEJ1dCBvbmUgaXNzdWUNCj4gSSBmaW5kIGFmdGVyIGxvb2tpbmcgYXQgaXQg aXMgdGhhdCBpdCBkb2Vzbid0IHN1cHBvcnQgdGhlICJzY2F0dGVyZWQiDQo+IGFsbG9jYXRpb25z IHRoYXQgd2UgbmVlZDsgZm9yIHNvbWUgdHlwZXMgb2YgDQo+IGhhcmR3YXJlIHF1ZXVlcyB3ZSBu ZWVkIHRvIGJlIGFibGUgdG8gZ3JvdXAgdG9nZXRoZXIgbXVsdGlwbGUgbm9uLQ0KPiBzZXF1ZW50 aWFsIGFsbG9jYXRpb25zIGludG8gb25lIHNpbmdsZSBibG9jaywNCj4gYW5kIGl0IGRvZXNuJ3Qg bG9vayBsaWtlIHdlIGNvdWxkIGRvIHRoYXQgd2l0aG91dCBoYXZpbmcgdG8gYWRkDQo+IGFub3Ro ZXIgbGF5ZXIgb24gdG9wIG9mIHZtZW0uDQo+IA0KDQpJIGRvbid0IGtub3cgbXVjaCBhYm91dCB2 bWVtLi4gaXQgbWlnaHQgYmUgc3VpdGFibGUgZm9yIG91ciBwdXJwb3NlcywNCmJ1dCBpdCBkb2Vz IHNvdW5kIGxpa2UgYSBiaXQgb3ZlcmtpbGwgZm9yIHdoYXQgd2UgZG8uDQoNCkknbGwgdHJ5IHRv IGRvIGEgcmV2aWV3IG9mIHRoZSB2bWVtIGludGVyZmFjZXMgdG8gc2VlIGlmIGl0IG1ha2VzDQpz ZW5zZS4NCg0KPiBBcyB3ZWxsLCBpdCBsb29rcyBsaWtlIGl0J3Mga2luZCBvZiBvdmVyYnVpbHQg Zm9yIHdoYXQgd2UgbmVlZDsgd2UNCj4gb25seSBuZWVkIGEgZmV3IG9wZXJhdGlvbnMuIEl0IGFs c28gc2VlbXMgdG8gaW1wb3J0DQo+IGEgYnVuY2ggb2Ygc3R1ZmYgaW4gaXRzIGhlYWRlcnMsIHdo aWNoIG1pZ2h0IGNvbXBsaWNhdGUgdXNpbmcgaXQgaW4NCj4gb3VyIHVuaXQgdGVzdCBjb2RlLg0K PiANCj4gSWYgeW91IHdhbnQgdG8gbG9vayBhdCB0aGUgY3VycmVudCBzdHJ1Y3R1cmUgd2UgdXNl LCB5b3UgY2FuIGxvb2sgYXQNCj4gdGhlIGljZV9wZl9xbWdyLltjaF0gZmlsZXMgaW4gdGhpcyBQ aGFicmljYXRvcg0KPiByZXZpZXcgdGhhdCBpbnRyb2R1Y2VzIGljZSg0KSB0byB0aGUga2VybmVs OiANCj4gaHR0cHM6Ly9yZXZpZXdzLmZyZWVic2Qub3JnL0QyMTk1OS4NCj4gDQo+IC0gRXJpYw0K DQpZZXMsIHdlJ2QgZGVmaW5pdGVseSBhcHByZWNpYXRlIHJldmlldyBvZiB0aGUgaWNlIGRldmlj ZSBkcml2ZXIgY29kZS4NCg0KVGhhbmtzLA0KSmFrZQ0KDQo= From owner-svn-src-all@freebsd.org Thu Nov 21 21:59:36 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 4DC5D1CC019; Thu, 21 Nov 2019 21:59:36 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47Jtkw1FC6z40vv; Thu, 21 Nov 2019 21:59:36 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 0E04619C22; Thu, 21 Nov 2019 21:59:36 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xALLxZ3i025998; Thu, 21 Nov 2019 21:59:35 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xALLxZ5x025995; Thu, 21 Nov 2019 21:59:35 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201911212159.xALLxZ5x025995@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Thu, 21 Nov 2019 21:59:35 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354986 - in head/sys: kern sys X-SVN-Group: head X-SVN-Commit-Author: mav X-SVN-Commit-Paths: in head/sys: kern sys X-SVN-Commit-Revision: 354986 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 21 Nov 2019 21:59:36 -0000 Author: mav Date: Thu Nov 21 21:59:35 2019 New Revision: 354986 URL: https://svnweb.freebsd.org/changeset/base/354986 Log: Add variant of root_mount_hold() without allocation. It allows to use this KPI in non-sleepable contexts. MFC after: 2 weeks Sponsored by: iXsystems, Inc. Modified: head/sys/kern/vfs_mountroot.c head/sys/sys/systm.h Modified: head/sys/kern/vfs_mountroot.c ============================================================================== --- head/sys/kern/vfs_mountroot.c Thu Nov 21 20:36:46 2019 (r354985) +++ head/sys/kern/vfs_mountroot.c Thu Nov 21 21:59:35 2019 (r354986) @@ -111,14 +111,9 @@ char *rootdevnames[2] = {NULL, NULL}; struct mtx root_holds_mtx; MTX_SYSINIT(root_holds, &root_holds_mtx, "root_holds", MTX_DEF); -struct root_hold_token { - const char *who; - LIST_ENTRY(root_hold_token) list; -}; +static TAILQ_HEAD(, root_hold_token) root_holds = + TAILQ_HEAD_INITIALIZER(root_holds); -static LIST_HEAD(, root_hold_token) root_holds = - LIST_HEAD_INITIALIZER(root_holds); - enum action { A_CONTINUE, A_PANIC, @@ -126,6 +121,12 @@ enum action { A_RETRY }; +enum rh_flags { + RH_FREE, + RH_ALLOC, + RH_ARG, +}; + static enum action root_mount_onfail = A_CONTINUE; static int root_mount_mddev; @@ -155,8 +156,8 @@ sysctl_vfs_root_mount_hold(SYSCTL_HANDLER_ARGS) sbuf_new(&sb, NULL, 256, SBUF_AUTOEXTEND | SBUF_INCLUDENUL); mtx_lock(&root_holds_mtx); - LIST_FOREACH(h, &root_holds, list) { - if (h != LIST_FIRST(&root_holds)) + TAILQ_FOREACH(h, &root_holds, list) { + if (h != TAILQ_FIRST(&root_holds)) sbuf_putc(&sb, ' '); sbuf_printf(&sb, "%s", h->who); } @@ -175,27 +176,54 @@ root_mount_hold(const char *identifier) struct root_hold_token *h; h = malloc(sizeof *h, M_DEVBUF, M_ZERO | M_WAITOK); + h->flags = RH_ALLOC; h->who = identifier; mtx_lock(&root_holds_mtx); TSHOLD("root mount"); - LIST_INSERT_HEAD(&root_holds, h, list); + TAILQ_INSERT_TAIL(&root_holds, h, list); mtx_unlock(&root_holds_mtx); return (h); } void +root_mount_hold_token(const char *identifier, struct root_hold_token *h) +{ +#ifdef INVARIANTS + struct root_hold_token *t; +#endif + + h->flags = RH_ARG; + h->who = identifier; + mtx_lock(&root_holds_mtx); +#ifdef INVARIANTS + TAILQ_FOREACH(t, &root_holds, list) { + if (t == h) { + panic("Duplicate mount hold by '%s' on %p", + identifier, h); + } + } +#endif + TSHOLD("root mount"); + TAILQ_INSERT_TAIL(&root_holds, h, list); + mtx_unlock(&root_holds_mtx); +} + +void root_mount_rel(struct root_hold_token *h) { - if (h == NULL) + if (h == NULL || h->flags == RH_FREE) return; mtx_lock(&root_holds_mtx); - LIST_REMOVE(h, list); + TAILQ_REMOVE(&root_holds, h, list); TSRELEASE("root mount"); wakeup(&root_holds); mtx_unlock(&root_holds_mtx); - free(h, M_DEVBUF); + if (h->flags == RH_ALLOC) { + free(h, M_DEVBUF); + } else + h->flags = RH_FREE; } int @@ -964,13 +992,13 @@ vfs_mountroot_wait(void) while (1) { g_waitidle(); mtx_lock(&root_holds_mtx); - if (LIST_EMPTY(&root_holds)) { + if (TAILQ_EMPTY(&root_holds)) { mtx_unlock(&root_holds_mtx); break; } if (ppsratecheck(&lastfail, &curfail, 1)) { printf("Root mount waiting for:"); - LIST_FOREACH(h, &root_holds, list) + TAILQ_FOREACH(h, &root_holds, list) printf(" %s", h->who); printf("\n"); } Modified: head/sys/sys/systm.h ============================================================================== --- head/sys/sys/systm.h Thu Nov 21 20:36:46 2019 (r354985) +++ head/sys/sys/systm.h Thu Nov 21 21:59:35 2019 (r354986) @@ -536,9 +536,14 @@ int poll_no_poll(int events); void DELAY(int usec); /* Root mount holdback API */ -struct root_hold_token; +struct root_hold_token { + int flags; + const char *who; + TAILQ_ENTRY(root_hold_token) list; +}; struct root_hold_token *root_mount_hold(const char *identifier); +void root_mount_hold_token(const char *identifier, struct root_hold_token *h); void root_mount_rel(struct root_hold_token *h); int root_mounted(void); From owner-svn-src-all@freebsd.org Thu Nov 21 23:55:20 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 0958B1CE715; Thu, 21 Nov 2019 23:55:20 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47JxJR6SvWz46db; Thu, 21 Nov 2019 23:55:19 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id BD0BC1B237; Thu, 21 Nov 2019 23:55:19 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xALNtJPu095969; Thu, 21 Nov 2019 23:55:19 GMT (envelope-from glebius@FreeBSD.org) Received: (from glebius@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xALNtJGn095968; Thu, 21 Nov 2019 23:55:19 GMT (envelope-from glebius@FreeBSD.org) Message-Id: <201911212355.xALNtJGn095968@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: glebius set sender to glebius@FreeBSD.org using -f From: Gleb Smirnoff Date: Thu, 21 Nov 2019 23:55:19 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354987 - head/sys/sys X-SVN-Group: head X-SVN-Commit-Author: glebius X-SVN-Commit-Paths: head/sys/sys X-SVN-Commit-Revision: 354987 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 21 Nov 2019 23:55:20 -0000 Author: glebius Date: Thu Nov 21 23:55:19 2019 New Revision: 354987 URL: https://svnweb.freebsd.org/changeset/base/354987 Log: Delete ih_thread. Should have gone in r334170. Modified: head/sys/sys/interrupt.h Modified: head/sys/sys/interrupt.h ============================================================================== --- head/sys/sys/interrupt.h Thu Nov 21 21:59:35 2019 (r354986) +++ head/sys/sys/interrupt.h Thu Nov 21 23:55:19 2019 (r354987) @@ -55,7 +55,6 @@ struct intr_handler { int ih_need; /* Needs service. */ CK_SLIST_ENTRY(intr_handler) ih_next; /* Next handler for this event. */ u_char ih_pri; /* Priority of this handler. */ - struct intr_thread *ih_thread; /* Ithread for filtered handler. */ }; /* Interrupt handle flags kept in ih_flags */ From owner-svn-src-all@freebsd.org Thu Nov 21 23:55:43 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id DA3751CE784; Thu, 21 Nov 2019 23:55:43 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47JxJv5TVHz46m0; Thu, 21 Nov 2019 23:55:43 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 9F40E1B238; Thu, 21 Nov 2019 23:55:43 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xALNthV7096031; Thu, 21 Nov 2019 23:55:43 GMT (envelope-from glebius@FreeBSD.org) Received: (from glebius@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xALNthX0096030; Thu, 21 Nov 2019 23:55:43 GMT (envelope-from glebius@FreeBSD.org) Message-Id: <201911212355.xALNthX0096030@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: glebius set sender to glebius@FreeBSD.org using -f From: Gleb Smirnoff Date: Thu, 21 Nov 2019 23:55:43 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354988 - head/sys/kern X-SVN-Group: head X-SVN-Commit-Author: glebius X-SVN-Commit-Paths: head/sys/kern X-SVN-Commit-Revision: 354988 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 21 Nov 2019 23:55:43 -0000 Author: glebius Date: Thu Nov 21 23:55:43 2019 New Revision: 354988 URL: https://svnweb.freebsd.org/changeset/base/354988 Log: cc_ktr_event_name is used only with KTR Modified: head/sys/kern/kern_timeout.c Modified: head/sys/kern/kern_timeout.c ============================================================================== --- head/sys/kern/kern_timeout.c Thu Nov 21 23:55:19 2019 (r354987) +++ head/sys/kern/kern_timeout.c Thu Nov 21 23:55:43 2019 (r354988) @@ -175,7 +175,9 @@ struct callout_cpu { void *cc_cookie; u_int cc_bucket; u_int cc_inited; +#ifdef KTR char cc_ktr_event_name[20]; +#endif }; #define callout_migrating(c) ((c)->c_iflags & CALLOUT_DFRMIGRATION) @@ -335,8 +337,10 @@ callout_cpu_init(struct callout_cpu *cc, int cpu) cc->cc_firstevent = SBT_MAX; for (i = 0; i < 2; i++) cc_cce_cleanup(cc, i); +#ifdef KTR snprintf(cc->cc_ktr_event_name, sizeof(cc->cc_ktr_event_name), "callwheel cpu %d", cpu); +#endif if (cc->cc_callout == NULL) /* Only BSP handles timeout(9) */ return; for (i = 0; i < ncallout; i++) { From owner-svn-src-all@freebsd.org Fri Nov 22 00:22:43 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 4EE4D1CF233; Fri, 22 Nov 2019 00:22:43 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from kib.kiev.ua (kib.kiev.ua [IPv6:2001:470:d5e7:1::1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 47Jxw213bvz482m; Fri, 22 Nov 2019 00:22:41 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from tom.home (kib@localhost [127.0.0.1]) by kib.kiev.ua (8.15.2/8.15.2) with ESMTPS id xAM0MYZm047053 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NO); Fri, 22 Nov 2019 02:22:37 +0200 (EET) (envelope-from kostikbel@gmail.com) DKIM-Filter: OpenDKIM Filter v2.10.3 kib.kiev.ua xAM0MYZm047053 Received: (from kostik@localhost) by tom.home (8.15.2/8.15.2/Submit) id xAM0MXS6047052; Fri, 22 Nov 2019 02:22:33 +0200 (EET) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: tom.home: kostik set sender to kostikbel@gmail.com using -f Date: Fri, 22 Nov 2019 02:22:33 +0200 From: Konstantin Belousov To: "Keller, Jacob E" Cc: "cem@freebsd.org" , "erj@freebsd.org" , "src-committers@freebsd.org" , "svn-src-head@freebsd.org" , "svn-src-all@freebsd.org" Subject: Re: svn commit: r354977 - in head: share/man/man3 sys/sys tests/sys/sys Message-ID: <20191122002233.GJ2707@kib.kiev.ua> References: <201911211957.xALJvuwi054399@repo.freebsd.org> <0435131fb462d6930409ce335af25dd5a33ec2b2.camel@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <0435131fb462d6930409ce335af25dd5a33ec2b2.camel@intel.com> User-Agent: Mutt/1.12.2 (2019-09-21) X-Spam-Status: No, score=-1.0 required=5.0 tests=ALL_TRUSTED,BAYES_00, DKIM_ADSP_CUSTOM_MED,FORGED_GMAIL_RCVD,FREEMAIL_FROM, NML_ADSP_CUSTOM_MED autolearn=no autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on tom.home X-Rspamd-Queue-Id: 47Jxw213bvz482m X-Spamd-Bar: - Authentication-Results: mx1.freebsd.org; dkim=none; dmarc=fail reason="No valid SPF, No valid DKIM" header.from=gmail.com (policy=none); spf=softfail (mx1.freebsd.org: 2001:470:d5e7:1::1 is neither permitted nor denied by domain of kostikbel@gmail.com) smtp.mailfrom=kostikbel@gmail.com X-Spamd-Result: default: False [-2.00 / 15.00]; ARC_NA(0.00)[]; TO_DN_EQ_ADDR_SOME(0.00)[]; RCVD_TLS_ALL(0.00)[]; FROM_HAS_DN(0.00)[]; TO_DN_SOME(0.00)[]; FREEMAIL_FROM(0.00)[gmail.com]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; MIME_GOOD(-0.10)[text/plain]; HAS_XAW(0.00)[]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; R_SPF_SOFTFAIL(0.00)[~all:c]; RCPT_COUNT_FIVE(0.00)[6]; IP_SCORE_FREEMAIL(0.00)[]; TO_MATCH_ENVRCPT_SOME(0.00)[]; IP_SCORE(0.00)[ip: (-2.77), ipnet: 2001:470::/32(-4.63), asn: 6939(-3.51), country: US(-0.05)]; FROM_EQ_ENVFROM(0.00)[]; R_DKIM_NA(0.00)[]; MIME_TRACE(0.00)[0:+]; ASN(0.00)[asn:6939, ipnet:2001:470::/32, country:US]; RCVD_COUNT_TWO(0.00)[2]; FREEMAIL_ENVFROM(0.00)[gmail.com]; DMARC_POLICY_SOFTFAIL(0.10)[gmail.com : No valid SPF, No valid DKIM,none] X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 22 Nov 2019 00:22:43 -0000 On Thu, Nov 21, 2019 at 09:52:54PM +0000, Keller, Jacob E wrote: > We use a bit string as a method of determining which index numbers have > been assigned. For unit numbers we have unr(9) as well. From owner-svn-src-all@freebsd.org Fri Nov 22 00:22:56 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id CDF7F1CF28D; Fri, 22 Nov 2019 00:22:56 +0000 (UTC) (envelope-from rmacklem@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47JxwJ58ghz488w; Fri, 22 Nov 2019 00:22:56 +0000 (UTC) (envelope-from rmacklem@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 958F41B7E4; Fri, 22 Nov 2019 00:22:56 +0000 (UTC) (envelope-from rmacklem@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xAM0Muaa013639; Fri, 22 Nov 2019 00:22:56 GMT (envelope-from rmacklem@FreeBSD.org) Received: (from rmacklem@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xAM0Mujj013637; Fri, 22 Nov 2019 00:22:56 GMT (envelope-from rmacklem@FreeBSD.org) Message-Id: <201911220022.xAM0Mujj013637@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: rmacklem set sender to rmacklem@FreeBSD.org using -f From: Rick Macklem Date: Fri, 22 Nov 2019 00:22:56 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354989 - in head/sys/fs: nfs nfsserver X-SVN-Group: head X-SVN-Commit-Author: rmacklem X-SVN-Commit-Paths: in head/sys/fs: nfs nfsserver X-SVN-Commit-Revision: 354989 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 22 Nov 2019 00:22:56 -0000 Author: rmacklem Date: Fri Nov 22 00:22:55 2019 New Revision: 354989 URL: https://svnweb.freebsd.org/changeset/base/354989 Log: Fix the pNFS server's reporting of SpaceUsed (va_bytes). The pNFS server currently reports SpaceUsed (va_bytes) for the metadata file. This in not correct, since the metadata file is always empty and, as such, va_bytes is just the allocation for the empty file. This patch adds va_bytes to the list of attributes acquired from the DS for a file, so that it includes the allocated data size and is updated when the file is written. For files created on a pNFS server before this patch is applied, the va_bytes value is estimated by rounding va_size up to a multiple of BLKDEV_IOSIZE. Once the file is written after this patch has been applied to the metadata server, the va_bytes returned for the file will be correct. This patch only affects a pNFS metadata server. Found during testing of the NFSv4.2 pNFS server for the Allocate operation. (Not yet in head/current.) MFC after: 2 weeks Modified: head/sys/fs/nfs/nfsrvstate.h head/sys/fs/nfsserver/nfs_nfsdport.c Modified: head/sys/fs/nfs/nfsrvstate.h ============================================================================== --- head/sys/fs/nfs/nfsrvstate.h Thu Nov 21 23:55:43 2019 (r354988) +++ head/sys/fs/nfs/nfsrvstate.h Fri Nov 22 00:22:55 2019 (r354989) @@ -355,14 +355,24 @@ struct nfsdevice { }; /* - * This structure holds the va_size, va_filerev, va_atime and va_mtime for the - * DS file and is stored in the metadata file's extended attribute pnfsd.dsattr. + * This structure holds the va_size, va_filerev, va_atime, va_mtime and + * va_bytes for the DS file and is stored in the metadata file's extended + * attribute pnfsd.dsattr. + * opnfsdsattr was missing the va_bytes field and, as such, it was updated. */ +struct opnfsdsattr { + uint64_t dsa_filerev; + uint64_t dsa_size; + struct timespec dsa_atime; + struct timespec dsa_mtime; +}; + struct pnfsdsattr { uint64_t dsa_filerev; uint64_t dsa_size; struct timespec dsa_atime; struct timespec dsa_mtime; + uint64_t dsa_bytes; }; /* Modified: head/sys/fs/nfsserver/nfs_nfsdport.c ============================================================================== --- head/sys/fs/nfsserver/nfs_nfsdport.c Thu Nov 21 23:55:43 2019 (r354988) +++ head/sys/fs/nfsserver/nfs_nfsdport.c Fri Nov 22 00:22:55 2019 (r354989) @@ -277,7 +277,8 @@ nfsvno_getattr(struct vnode *vp, struct nfsvattr *nvap } /* - * Acquire the Change, Size and TimeModify attributes, as required. + * Acquire the Change, Size, TimeAccess, TimeModify and SpaceUsed + * attributes, as required. * This needs to be done for regular files if: * - non-NFSv4 RPCs or * - when attrbitp == NULL or @@ -292,7 +293,8 @@ nfsvno_getattr(struct vnode *vp, struct nfsvattr *nvap NFSISSET_ATTRBIT(attrbitp, NFSATTRBIT_CHANGE) || NFSISSET_ATTRBIT(attrbitp, NFSATTRBIT_SIZE) || NFSISSET_ATTRBIT(attrbitp, NFSATTRBIT_TIMEACCESS) || - NFSISSET_ATTRBIT(attrbitp, NFSATTRBIT_TIMEMODIFY))) { + NFSISSET_ATTRBIT(attrbitp, NFSATTRBIT_TIMEMODIFY) || + NFSISSET_ATTRBIT(attrbitp, NFSATTRBIT_SPACEUSED))) { error = nfsrv_proxyds(vp, 0, 0, nd->nd_cred, p, NFSPROC_GETATTR, NULL, NULL, NULL, &na, NULL); if (error == 0) @@ -312,6 +314,7 @@ nfsvno_getattr(struct vnode *vp, struct nfsvattr *nvap nvap->na_mtime = na.na_mtime; nvap->na_filerev = na.na_filerev; nvap->na_size = na.na_size; + nvap->na_bytes = na.na_bytes; } NFSD_DEBUG(4, "nfsvno_getattr: gotattr=%d err=%d chg=%ju\n", gotattr, error, (uintmax_t)na.na_filerev); @@ -3881,6 +3884,7 @@ nfsrv_dscreate(struct vnode *dvp, struct vattr *vap, s dsa->dsa_size = va.va_size; dsa->dsa_atime = va.va_atime; dsa->dsa_mtime = va.va_mtime; + dsa->dsa_bytes = va.va_bytes; } } if (error == 0) { @@ -4405,6 +4409,7 @@ nfsrv_proxyds(struct vnode *vp, off_t off, int cnt, st struct vnode *dvp[NFSDEV_MAXMIRRORS]; struct nfsdevice *ds; struct pnfsdsattr dsattr; + struct opnfsdsattr odsattr; char *buf; int buflen, error, failpos, i, mirrorcnt, origmircnt, trycnt; @@ -4429,15 +4434,31 @@ nfsrv_proxyds(struct vnode *vp, off_t off, int cnt, st error = vn_extattr_get(vp, IO_NODELOCKED, EXTATTR_NAMESPACE_SYSTEM, "pnfsd.dsattr", &buflen, buf, p); - if (error == 0 && buflen != sizeof(dsattr)) - error = ENXIO; if (error == 0) { - NFSBCOPY(buf, &dsattr, buflen); - nap->na_filerev = dsattr.dsa_filerev; - nap->na_size = dsattr.dsa_size; - nap->na_atime = dsattr.dsa_atime; - nap->na_mtime = dsattr.dsa_mtime; - + if (buflen == sizeof(odsattr)) { + NFSBCOPY(buf, &odsattr, buflen); + nap->na_filerev = odsattr.dsa_filerev; + nap->na_size = odsattr.dsa_size; + nap->na_atime = odsattr.dsa_atime; + nap->na_mtime = odsattr.dsa_mtime; + /* + * Fake na_bytes by rounding up na_size. + * Since we don't know the block size, just + * use BLKDEV_IOSIZE. + */ + nap->na_bytes = (odsattr.dsa_size + + BLKDEV_IOSIZE - 1) & ~(BLKDEV_IOSIZE - 1); + } else if (buflen == sizeof(dsattr)) { + NFSBCOPY(buf, &dsattr, buflen); + nap->na_filerev = dsattr.dsa_filerev; + nap->na_size = dsattr.dsa_size; + nap->na_atime = dsattr.dsa_atime; + nap->na_mtime = dsattr.dsa_mtime; + nap->na_bytes = dsattr.dsa_bytes; + } else + error = ENXIO; + } + if (error == 0) { /* * If nfsrv_pnfsgetdsattr is 0 or nfsrv_checkdsattr() * returns 0, just return now. nfsrv_checkdsattr() @@ -4809,6 +4830,7 @@ nfsrv_setextattr(struct vnode *vp, struct nfsvattr *na dsattr.dsa_size = nap->na_size; dsattr.dsa_atime = nap->na_atime; dsattr.dsa_mtime = nap->na_mtime; + dsattr.dsa_bytes = nap->na_bytes; error = vn_extattr_set(vp, IO_NODELOCKED, EXTATTR_NAMESPACE_SYSTEM, "pnfsd.dsattr", sizeof(dsattr), (char *)&dsattr, p); if (error != 0) @@ -4984,12 +5006,13 @@ nfsrv_writedsdorpc(struct nfsmount *nmp, fhandle_t *fh nd->nd_bpos = mtod(m, char *) + m->m_len; NFSD_DEBUG(4, "nfsrv_writedsdorpc: lastmb len=%d\n", m->m_len); - /* Do a Getattr for Size, Change and Modify Time. */ + /* Do a Getattr for the attributes that change upon writing. */ NFSZERO_ATTRBIT(&attrbits); NFSSETBIT_ATTRBIT(&attrbits, NFSATTRBIT_SIZE); NFSSETBIT_ATTRBIT(&attrbits, NFSATTRBIT_CHANGE); NFSSETBIT_ATTRBIT(&attrbits, NFSATTRBIT_TIMEACCESS); NFSSETBIT_ATTRBIT(&attrbits, NFSATTRBIT_TIMEMODIFY); + NFSSETBIT_ATTRBIT(&attrbits, NFSATTRBIT_SPACEUSED); NFSM_BUILD(tl, u_int32_t *, NFSX_UNSIGNED); *tl = txdr_unsigned(NFSV4OP_GETATTR); (void) nfsrv_putattrbit(nd, &attrbits); @@ -5168,12 +5191,13 @@ nfsrv_setattrdsdorpc(fhandle_t *fhp, struct ucred *cre nfsm_stateidtom(nd, &st, NFSSTATEID_PUTSTATEID); nfscl_fillsattr(nd, &nap->na_vattr, vp, NFSSATTR_FULL, 0); - /* Do a Getattr for Size, Change, Access Time and Modify Time. */ + /* Do a Getattr for the attributes that change due to writing. */ NFSZERO_ATTRBIT(&attrbits); NFSSETBIT_ATTRBIT(&attrbits, NFSATTRBIT_SIZE); NFSSETBIT_ATTRBIT(&attrbits, NFSATTRBIT_CHANGE); NFSSETBIT_ATTRBIT(&attrbits, NFSATTRBIT_TIMEACCESS); NFSSETBIT_ATTRBIT(&attrbits, NFSATTRBIT_TIMEMODIFY); + NFSSETBIT_ATTRBIT(&attrbits, NFSATTRBIT_SPACEUSED); NFSM_BUILD(tl, u_int32_t *, NFSX_UNSIGNED); *tl = txdr_unsigned(NFSV4OP_GETATTR); (void) nfsrv_putattrbit(nd, &attrbits); @@ -5470,7 +5494,7 @@ nfsrv_setacldsrpc(fhandle_t *fhp, struct ucred *cred, } /* - * Getattr call to the DS for the Modify, Size and Change attributes. + * Getattr call to the DS for the attributes that change due to writing. */ static int nfsrv_getattrdsrpc(fhandle_t *fhp, struct ucred *cred, NFSPROC_T *p, @@ -5489,6 +5513,7 @@ nfsrv_getattrdsrpc(fhandle_t *fhp, struct ucred *cred, NFSSETBIT_ATTRBIT(&attrbits, NFSATTRBIT_CHANGE); NFSSETBIT_ATTRBIT(&attrbits, NFSATTRBIT_TIMEACCESS); NFSSETBIT_ATTRBIT(&attrbits, NFSATTRBIT_TIMEMODIFY); + NFSSETBIT_ATTRBIT(&attrbits, NFSATTRBIT_SPACEUSED); (void) nfsrv_putattrbit(nd, &attrbits); error = newnfs_request(nd, nmp, NULL, &nmp->nm_sockreq, NULL, p, cred, NFS_PROG, NFS_VER4, NULL, 1, NULL, NULL); From owner-svn-src-all@freebsd.org Fri Nov 22 00:25:05 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 7D0421CF3BC; Fri, 22 Nov 2019 00:25:05 +0000 (UTC) (envelope-from jacob.e.keller@intel.com) Received: from mga12.intel.com (mga12.intel.com [192.55.52.136]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "fmsmga106.fm.intel.com", Issuer "Sectigo RSA Organization Validation Secure Server CA" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47Jxyl4Gvgz48Jl; Fri, 22 Nov 2019 00:25:03 +0000 (UTC) (envelope-from jacob.e.keller@intel.com) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga005.fm.intel.com ([10.253.24.32]) by fmsmga106.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 21 Nov 2019 16:25:01 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.69,227,1571727600"; d="scan'208";a="407400283" Received: from orsmsx105.amr.corp.intel.com ([10.22.225.132]) by fmsmga005.fm.intel.com with ESMTP; 21 Nov 2019 16:25:01 -0800 Received: from orsmsx115.amr.corp.intel.com (10.22.240.11) by ORSMSX105.amr.corp.intel.com (10.22.225.132) with Microsoft SMTP Server (TLS) id 14.3.439.0; Thu, 21 Nov 2019 16:25:00 -0800 Received: from orsmsx121.amr.corp.intel.com ([169.254.10.169]) by ORSMSX115.amr.corp.intel.com ([169.254.4.121]) with mapi id 14.03.0439.000; Thu, 21 Nov 2019 16:25:00 -0800 From: "Keller, Jacob E" To: "kostikbel@gmail.com" CC: "src-committers@freebsd.org" , "cem@freebsd.org" , "svn-src-head@freebsd.org" , "svn-src-all@freebsd.org" , "erj@freebsd.org" Subject: Re: svn commit: r354977 - in head: share/man/man3 sys/sys tests/sys/sys Thread-Topic: svn commit: r354977 - in head: share/man/man3 sys/sys tests/sys/sys Thread-Index: AQHVoLOSDkNl7xHhTke697Fm41TX06eWsMKAgAAp0YCAAACsAA== Date: Fri, 22 Nov 2019 00:25:00 +0000 Message-ID: <363f0fb5ec2924d2fb79d337030a7a3133467258.camel@intel.com> References: <201911211957.xALJvuwi054399@repo.freebsd.org> <0435131fb462d6930409ce335af25dd5a33ec2b2.camel@intel.com> <20191122002233.GJ2707@kib.kiev.ua> In-Reply-To: <20191122002233.GJ2707@kib.kiev.ua> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: user-agent: Evolution 3.32.5 (3.32.5-1.fc30) x-originating-ip: [10.166.244.172] Content-Type: text/plain; charset="utf-8" Content-ID: <00469D6A6D5DF3468550BE07A3E35E4A@intel.com> Content-Transfer-Encoding: base64 MIME-Version: 1.0 X-Rspamd-Queue-Id: 47Jxyl4Gvgz48Jl X-Spamd-Bar: --------- Authentication-Results: mx1.freebsd.org; dkim=none; dmarc=pass (policy=none) header.from=intel.com; spf=pass (mx1.freebsd.org: domain of jacob.e.keller@intel.com designates 192.55.52.136 as permitted sender) smtp.mailfrom=jacob.e.keller@intel.com X-Spamd-Result: default: False [-9.68 / 15.00]; ARC_NA(0.00)[]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; RCVD_COUNT_FIVE(0.00)[5]; HAS_XOIP(0.00)[]; FROM_HAS_DN(0.00)[]; R_SPF_ALLOW(-0.20)[+ip4:192.55.52.136/32]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; MIME_GOOD(-0.10)[text/plain]; RCVD_TLS_LAST(0.00)[]; RCPT_COUNT_FIVE(0.00)[6]; TO_MATCH_ENVRCPT_SOME(0.00)[]; RCVD_IN_DNSWL_MED(-0.20)[136.52.55.192.list.dnswl.org : 127.0.9.2]; MIME_BASE64_TEXT(0.10)[]; DMARC_POLICY_ALLOW(-0.50)[intel.com,none]; TO_DN_EQ_ADDR_ALL(0.00)[]; IP_SCORE(-3.78)[ip: (-9.91), ipnet: 192.55.52.0/24(-4.96), asn: 4983(-3.96), country: US(-0.05)]; FREEMAIL_TO(0.00)[gmail.com]; FROM_EQ_ENVFROM(0.00)[]; R_DKIM_NA(0.00)[]; MIME_TRACE(0.00)[0:+]; ASN(0.00)[asn:4983, ipnet:192.55.52.0/24, country:US]; MID_RHS_MATCH_FROM(0.00)[]; WHITELIST_SPF_DKIM(-3.00)[intel.com:s:+] X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 22 Nov 2019 00:25:05 -0000 T24gRnJpLCAyMDE5LTExLTIyIGF0IDAyOjIyICswMjAwLCBLb25zdGFudGluIEJlbG91c292IHdy b3RlOg0KPiBPbiBUaHUsIE5vdiAyMSwgMjAxOSBhdCAwOTo1Mjo1NFBNICswMDAwLCBLZWxsZXIs IEphY29iIEUgd3JvdGU6DQo+ID4gV2UgdXNlIGEgYml0IHN0cmluZyBhcyBhIG1ldGhvZCBvZiBk ZXRlcm1pbmluZyB3aGljaCBpbmRleCBudW1iZXJzDQo+ID4gaGF2ZQ0KPiA+IGJlZW4gYXNzaWdu ZWQuDQo+IEZvciB1bml0IG51bWJlcnMgd2UgaGF2ZSB1bnIoOSkgYXMgd2VsbC4NCg0KRG9lcyB1 bnIgaGF2ZSBzdXBwb3J0IGZvciBhbGxvY2F0aW5nIGNvbnRpZ3VvdXMgc2VxdWVuY2VzIG9mIHVu aXQNCm51bWJlcnM/DQoNClRoYW5rcywNCkpha2UNCg== From owner-svn-src-all@freebsd.org Fri Nov 22 00:35:00 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id A9FFB1CF671; Fri, 22 Nov 2019 00:35:00 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from kib.kiev.ua (kib.kiev.ua [IPv6:2001:470:d5e7:1::1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 47JyBC4278z48mw; Fri, 22 Nov 2019 00:34:59 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from tom.home (kib@localhost [127.0.0.1]) by kib.kiev.ua (8.15.2/8.15.2) with ESMTPS id xAM0Yp8i049447 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NO); Fri, 22 Nov 2019 02:34:55 +0200 (EET) (envelope-from kostikbel@gmail.com) DKIM-Filter: OpenDKIM Filter v2.10.3 kib.kiev.ua xAM0Yp8i049447 Received: (from kostik@localhost) by tom.home (8.15.2/8.15.2/Submit) id xAM0Yp17049446; Fri, 22 Nov 2019 02:34:51 +0200 (EET) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: tom.home: kostik set sender to kostikbel@gmail.com using -f Date: Fri, 22 Nov 2019 02:34:51 +0200 From: Konstantin Belousov To: "Keller, Jacob E" Cc: "src-committers@freebsd.org" , "cem@freebsd.org" , "svn-src-head@freebsd.org" , "svn-src-all@freebsd.org" , "erj@freebsd.org" Subject: Re: svn commit: r354977 - in head: share/man/man3 sys/sys tests/sys/sys Message-ID: <20191122003451.GK2707@kib.kiev.ua> References: <201911211957.xALJvuwi054399@repo.freebsd.org> <0435131fb462d6930409ce335af25dd5a33ec2b2.camel@intel.com> <20191122002233.GJ2707@kib.kiev.ua> <363f0fb5ec2924d2fb79d337030a7a3133467258.camel@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <363f0fb5ec2924d2fb79d337030a7a3133467258.camel@intel.com> User-Agent: Mutt/1.12.2 (2019-09-21) X-Spam-Status: No, score=-1.0 required=5.0 tests=ALL_TRUSTED,BAYES_00, DKIM_ADSP_CUSTOM_MED,FORGED_GMAIL_RCVD,FREEMAIL_FROM, NML_ADSP_CUSTOM_MED autolearn=no autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on tom.home X-Rspamd-Queue-Id: 47JyBC4278z48mw X-Spamd-Bar: - Authentication-Results: mx1.freebsd.org; dkim=none; dmarc=fail reason="No valid SPF, No valid DKIM" header.from=gmail.com (policy=none); spf=softfail (mx1.freebsd.org: 2001:470:d5e7:1::1 is neither permitted nor denied by domain of kostikbel@gmail.com) smtp.mailfrom=kostikbel@gmail.com X-Spamd-Result: default: False [-2.00 / 15.00]; ARC_NA(0.00)[]; TO_DN_EQ_ADDR_SOME(0.00)[]; RCVD_TLS_ALL(0.00)[]; FROM_HAS_DN(0.00)[]; TO_DN_SOME(0.00)[]; FREEMAIL_FROM(0.00)[gmail.com]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; MIME_GOOD(-0.10)[text/plain]; HAS_XAW(0.00)[]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; R_SPF_SOFTFAIL(0.00)[~all]; RCPT_COUNT_FIVE(0.00)[6]; IP_SCORE_FREEMAIL(0.00)[]; TO_MATCH_ENVRCPT_SOME(0.00)[]; IP_SCORE(0.00)[ip: (-2.76), ipnet: 2001:470::/32(-4.63), asn: 6939(-3.51), country: US(-0.05)]; FROM_EQ_ENVFROM(0.00)[]; R_DKIM_NA(0.00)[]; MIME_TRACE(0.00)[0:+]; ASN(0.00)[asn:6939, ipnet:2001:470::/32, country:US]; RCVD_COUNT_TWO(0.00)[2]; FREEMAIL_ENVFROM(0.00)[gmail.com]; DMARC_POLICY_SOFTFAIL(0.10)[gmail.com : No valid SPF, No valid DKIM,none] X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 22 Nov 2019 00:35:00 -0000 On Fri, Nov 22, 2019 at 12:25:00AM +0000, Keller, Jacob E wrote: > On Fri, 2019-11-22 at 02:22 +0200, Konstantin Belousov wrote: > > On Thu, Nov 21, 2019 at 09:52:54PM +0000, Keller, Jacob E wrote: > > > We use a bit string as a method of determining which index numbers > > > have > > > been assigned. > > For unit numbers we have unr(9) as well. > > Does unr have support for allocating contiguous sequences of unit > numbers? No, it does not. Although the data structure is optimized to track contiguous runs, there is currently no API to allocate the chunk of desired length. From owner-svn-src-all@freebsd.org Fri Nov 22 00:50:48 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 6E93F1CFA96; Fri, 22 Nov 2019 00:50:48 +0000 (UTC) (envelope-from jacob.e.keller@intel.com) Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "fmsmga102.fm.intel.com", Issuer "Sectigo RSA Organization Validation Secure Server CA" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47JyXQ4fQWz49Tl; Fri, 22 Nov 2019 00:50:46 +0000 (UTC) (envelope-from jacob.e.keller@intel.com) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga008.fm.intel.com ([10.253.24.58]) by fmsmga102.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 21 Nov 2019 16:50:44 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.69,227,1571727600"; d="scan'208";a="205250783" Received: from orsmsx102.amr.corp.intel.com ([10.22.225.129]) by fmsmga008.fm.intel.com with ESMTP; 21 Nov 2019 16:50:44 -0800 Received: from orsmsx121.amr.corp.intel.com ([169.254.10.169]) by ORSMSX102.amr.corp.intel.com ([169.254.3.246]) with mapi id 14.03.0439.000; Thu, 21 Nov 2019 16:50:43 -0800 From: "Keller, Jacob E" To: "kostikbel@gmail.com" CC: "src-committers@freebsd.org" , "cem@freebsd.org" , "svn-src-head@freebsd.org" , "svn-src-all@freebsd.org" , "erj@freebsd.org" Subject: Re: svn commit: r354977 - in head: share/man/man3 sys/sys tests/sys/sys Thread-Topic: svn commit: r354977 - in head: share/man/man3 sys/sys tests/sys/sys Thread-Index: AQHVoLOSDkNl7xHhTke697Fm41TX06eWsMKAgAAp0YCAAACsAIAAAsOAgAAEbgA= Date: Fri, 22 Nov 2019 00:50:43 +0000 Message-ID: <8f81e1457580142d077b074124a355d70793f250.camel@intel.com> References: <201911211957.xALJvuwi054399@repo.freebsd.org> <0435131fb462d6930409ce335af25dd5a33ec2b2.camel@intel.com> <20191122002233.GJ2707@kib.kiev.ua> <363f0fb5ec2924d2fb79d337030a7a3133467258.camel@intel.com> <20191122003451.GK2707@kib.kiev.ua> In-Reply-To: <20191122003451.GK2707@kib.kiev.ua> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: user-agent: Evolution 3.32.5 (3.32.5-1.fc30) x-originating-ip: [10.166.244.172] Content-Type: text/plain; charset="utf-8" Content-ID: Content-Transfer-Encoding: base64 MIME-Version: 1.0 X-Rspamd-Queue-Id: 47JyXQ4fQWz49Tl X-Spamd-Bar: --------- Authentication-Results: mx1.freebsd.org; dkim=none; dmarc=pass (policy=none) header.from=intel.com; spf=pass (mx1.freebsd.org: domain of jacob.e.keller@intel.com designates 192.55.52.93 as permitted sender) smtp.mailfrom=jacob.e.keller@intel.com X-Spamd-Result: default: False [-9.98 / 15.00]; ARC_NA(0.00)[]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; HAS_XOIP(0.00)[]; FROM_HAS_DN(0.00)[]; R_SPF_ALLOW(-0.20)[+ip4:192.55.52.93/32]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; MIME_GOOD(-0.10)[text/plain]; RCVD_TLS_LAST(0.00)[]; RCPT_COUNT_FIVE(0.00)[6]; RCVD_COUNT_THREE(0.00)[4]; TO_MATCH_ENVRCPT_SOME(0.00)[]; MIME_BASE64_TEXT(0.10)[]; DMARC_POLICY_ALLOW(-0.50)[intel.com,none]; TO_DN_EQ_ADDR_ALL(0.00)[]; IP_SCORE(-3.78)[ip: (-9.91), ipnet: 192.55.52.0/24(-4.96), asn: 4983(-3.96), country: US(-0.05)]; FREEMAIL_TO(0.00)[gmail.com]; FROM_EQ_ENVFROM(0.00)[]; R_DKIM_NA(0.00)[]; MIME_TRACE(0.00)[0:+]; ASN(0.00)[asn:4983, ipnet:192.55.52.0/24, country:US]; RCVD_IN_DNSWL_HI(-0.50)[93.52.55.192.list.dnswl.org : 127.0.9.3]; MID_RHS_MATCH_FROM(0.00)[]; WHITELIST_SPF_DKIM(-3.00)[intel.com:s:+] X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 22 Nov 2019 00:50:48 -0000 T24gRnJpLCAyMDE5LTExLTIyIGF0IDAyOjM0ICswMjAwLCBLb25zdGFudGluIEJlbG91c292IHdy b3RlOg0KPiBPbiBGcmksIE5vdiAyMiwgMjAxOSBhdCAxMjoyNTowMEFNICswMDAwLCBLZWxsZXIs IEphY29iIEUgd3JvdGU6DQo+ID4gT24gRnJpLCAyMDE5LTExLTIyIGF0IDAyOjIyICswMjAwLCBL b25zdGFudGluIEJlbG91c292IHdyb3RlOg0KPiA+ID4gT24gVGh1LCBOb3YgMjEsIDIwMTkgYXQg MDk6NTI6NTRQTSArMDAwMCwgS2VsbGVyLCBKYWNvYiBFIHdyb3RlOg0KPiA+ID4gPiBXZSB1c2Ug YSBiaXQgc3RyaW5nIGFzIGEgbWV0aG9kIG9mIGRldGVybWluaW5nIHdoaWNoIGluZGV4DQo+ID4g PiA+IG51bWJlcnMNCj4gPiA+ID4gaGF2ZQ0KPiA+ID4gPiBiZWVuIGFzc2lnbmVkLg0KPiA+ID4g Rm9yIHVuaXQgbnVtYmVycyB3ZSBoYXZlIHVucig5KSBhcyB3ZWxsLg0KPiA+IA0KPiA+IERvZXMg dW5yIGhhdmUgc3VwcG9ydCBmb3IgYWxsb2NhdGluZyBjb250aWd1b3VzIHNlcXVlbmNlcyBvZiB1 bml0DQo+ID4gbnVtYmVycz8NCj4gDQo+IE5vLCBpdCBkb2VzIG5vdC4gIEFsdGhvdWdoIHRoZSBk YXRhIHN0cnVjdHVyZSBpcyBvcHRpbWl6ZWQgdG8gdHJhY2sNCj4gY29udGlndW91cyBydW5zLCB0 aGVyZSBpcyBjdXJyZW50bHkgbm8gQVBJIHRvIGFsbG9jYXRlIHRoZSBjaHVuayBvZg0KPiBkZXNp cmVkDQo+IGxlbmd0aC4NCg0KSG1tLiBNaWdodCBtYWtlIG1vcmUgc2Vuc2UgdG8gZXh0ZW5kIHRo ZSBBUEkgdG8gYWxsb3cgcmVxdWVzdGluZyBjaHVua3MNCm9mIGRlc2lyZWQgbGVuZ3RoLCBhbmQg dGhlbiB1c2UgdGhhdC4NCg0KVGhhbmtzLA0KSmFrZQ0K From owner-svn-src-all@freebsd.org Fri Nov 22 04:23:31 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 5D8EA1AC00F; Fri, 22 Nov 2019 04:23:31 +0000 (UTC) (envelope-from gjb@freebsd.org) Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2610:1c1:1:6074::16:84]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "freefall.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47K3Fv0hzVz4K9v; Fri, 22 Nov 2019 04:23:31 +0000 (UTC) (envelope-from gjb@freebsd.org) Received: from FreeBSD.org (freefall.freebsd.org [IPv6:2610:1c1:1:6074::16:84]) (using TLSv1 with cipher ECDHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by freefall.freebsd.org (Postfix) with ESMTPS id 65CDB1B719; Fri, 22 Nov 2019 04:23:30 +0000 (UTC) (envelope-from gjb@freebsd.org) Date: Fri, 22 Nov 2019 04:23:27 +0000 From: Glen Barber To: Brooks Davis Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org, FreeBSD Ports Management Team , Colin Percival Subject: Re: svn commit: r354909 - in head: . share/mk Message-ID: <20191122042327.GQ5599@FreeBSD.org> References: <201911201836.xAKIawWt053874@repo.freebsd.org> <20191121161337.GA92849@FreeBSD.org> <20191121211127.GC50024@spindle.one-eyed-alien.net> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="xYEXny2b0/vlBQCR" Content-Disposition: inline In-Reply-To: <20191121211127.GC50024@spindle.one-eyed-alien.net> User-Agent: Mutt/1.12.1 (2019-06-15) X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 22 Nov 2019 04:23:31 -0000 --xYEXny2b0/vlBQCR Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Thu, Nov 21, 2019 at 09:11:27PM +0000, Brooks Davis wrote: > On Thu, Nov 21, 2019 at 04:13:37PM +0000, Glen Barber wrote: > > On Wed, Nov 20, 2019 at 06:36:58PM +0000, Brooks Davis wrote: > > > Author: brooks > > > Date: Wed Nov 20 18:36:58 2019 > > > New Revision: 354909 > > > URL: https://svnweb.freebsd.org/changeset/base/354909 > > >=20 > > > Log: > > > Make the warning for deprecated NO_ variables an error. > > > =20 > > > Support for NO_CTF, NO_DEBUG_FILES, NO_INSTALLLIB, NO_MAN, NO_PROFI= LE, > > > and NO_WARNS as deprecated in 2014 with a warning added for each one > > > found. Turn these into error in preperation for removal of compatab= ility > > > support before FreeBSD 13. > > > =20 > > > Reviewed by: imp > > > Relnotes: yes > > > Sponsored by: DARPA, AFRL > > > Differential Revision: https://reviews.freebsd.org/D22448 > > >=20 > >=20 > > > Modified: head/share/mk/bsd.opts.mk > > > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D > > > --- head/share/mk/bsd.opts.mk Wed Nov 20 18:12:01 2019 (r354908) > > > +++ head/share/mk/bsd.opts.mk Wed Nov 20 18:36:58 2019 (r354909) > > > @@ -100,7 +100,7 @@ __DEFAULT_DEPENDENT_OPTIONS =3D \ > > > PROFILE \ > > > WARNS > > > .if defined(NO_${var}) > > > -.warning "NO_${var} is defined, but deprecated. Please use MK_${var}= =3Dno instead." > > > +.error "NO_${var} is defined, but deprecated. Please use MK_${var}= =3Dno instead." > > > MK_${var}:=3Dno > > > .endif > > > .endfor > > >=20 > >=20 > > Had this been exp-run tested? This breaks at least the > > net/bsdec2-image-upload port, which does *not* set NO_MAN explicitly in > > its Makefile. I suspect at least several other ports are now implicitly > > broken as result of this change. >=20 > No, it wasn't. I didn't realize it was needed. I could revert if > there's significant fallout. I've patched net/bsdec2-image-upload and > I'm testing a patch for emulators/open-vm-tools. >=20 > In general the issue is people putting NO_MAN=3D in Makefiles that > the freebsd build infrastructure and then never looking at build > output. In some cases it's clearly blind copy-and-paste (e.g. > emulators/open-vm-tools sets NO_MAN and NOMAN in a kmod Makefile where > they do nothing). >=20 > Ideally I'd like to suppress these errors in ports unless DEVELOPER is > defined, but I'm not sure how best to do that. >=20 Have you seen the email from antoine in reply to your commit to the net/bsdec2-image-upload commit? Glen --xYEXny2b0/vlBQCR Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAEBCAAdFiEEjRJAPC5sqwhs9k2jAxRYpUeP4pMFAl3XYroACgkQAxRYpUeP 4pOGzg//YVQVDLv0RlLudB3ZUsw34dF+fQNub+LUvSz3nSuZBlSezXu+lzvmKVmC Otob7LAqMVH6xWmDL6cs3y/Wnp1piIEWKHB2ylADGRu9Fm/9Huz/jubOD3W9/CDV kkzYBrNY7qaqikwMjL1PVUzvAGPE3C4+q20wiVtKXTS7bq89B8+WwrbKfDfL2Crx 7PT1gWd7SRULE32fBZxjb46n2WP0K/SqJab/XfGXlxnpt8bCuPkxeWZxY7I/spdZ ASoYN8GKugu0/r0iniTuPAFRLdigUbhYUzjHJajkEcVeOKC464zZmPqpvt9HvM3c VFjloAMf0t7HmFW0jt9jl3wweyaJRN1u+zZwT3ASN84dy58pm6NEhxOuN7ZKarDd DAq/qzF2RPYJALlVli6B+vqmYI1sDLPymS76rmsZygRIpv9AT3F5qzaKLgAfTjQo K71BroWV8jf9B3+knjeub9sJR4Xz8zoQ/EjN5H4ufzQLhbUKAz/sEO3++Jv55aMe Y0I/vFwRdgqZL6ctgP3ILzqgueSpwLeMKqRZi1+dRBmXXbeLdIAEHTjdJZKoLc3O t8CMKQMMQ85QZYaMLd1svFobYgzWcOr6sI3tNHEL7ThqiEyP5pAIr9gSxFXB3dx1 n3OcFsxIWZApDj0WeFSsd1MKK1hvUEf4pEqROhafS4pniDBOsW4= =+/xo -----END PGP SIGNATURE----- --xYEXny2b0/vlBQCR-- From owner-svn-src-all@freebsd.org Fri Nov 22 04:34:47 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 8A3A01AC310; Fri, 22 Nov 2019 04:34:47 +0000 (UTC) (envelope-from jhibbits@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47K3Vv1mFXz4KbB; Fri, 22 Nov 2019 04:34:47 +0000 (UTC) (envelope-from jhibbits@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 212881E537; Fri, 22 Nov 2019 04:34:47 +0000 (UTC) (envelope-from jhibbits@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xAM4YlEt060896; Fri, 22 Nov 2019 04:34:47 GMT (envelope-from jhibbits@FreeBSD.org) Received: (from jhibbits@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xAM4YkxD060895; Fri, 22 Nov 2019 04:34:46 GMT (envelope-from jhibbits@FreeBSD.org) Message-Id: <201911220434.xAM4YkxD060895@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhibbits set sender to jhibbits@FreeBSD.org using -f From: Justin Hibbits Date: Fri, 22 Nov 2019 04:34:46 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354990 - head/sys/powerpc/powerpc X-SVN-Group: head X-SVN-Commit-Author: jhibbits X-SVN-Commit-Paths: head/sys/powerpc/powerpc X-SVN-Commit-Revision: 354990 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 22 Nov 2019 04:34:47 -0000 Author: jhibbits Date: Fri Nov 22 04:34:46 2019 New Revision: 354990 URL: https://svnweb.freebsd.org/changeset/base/354990 Log: powerpc/ptrace: Give ptrace(2) access to SPE registers when available SPE registers are already exported in core dumps with the VMX note, so use the same interface for live access. Instead of simply guarding out in #ifndef __SPE__ the cpu_feature check, I chose to keep the check and check against PPC_FEATURE_SPE, on the off-chance someone decides to run a SPE kernel on a non-SPE device (which is possible, though highly unlikely, and would be no different from running a MPC85XX kernel in that instance). Modified: head/sys/powerpc/powerpc/ptrace_machdep.c Modified: head/sys/powerpc/powerpc/ptrace_machdep.c ============================================================================== --- head/sys/powerpc/powerpc/ptrace_machdep.c Fri Nov 22 00:22:55 2019 (r354989) +++ head/sys/powerpc/powerpc/ptrace_machdep.c Fri Nov 22 04:34:46 2019 (r354990) @@ -40,6 +40,12 @@ __FBSDID("$FreeBSD$"); #include #include +#ifdef __SPE__ +#define PPC_FEATURE_VECTOR PPC_FEATURE_HAS_SPE +#else +#define PPC_FEATURE_VECTOR PPC_FEATURE_HAS_ALTIVEC +#endif + int cpu_ptrace(struct thread *td, int req, void *addr, int data) { @@ -58,7 +64,7 @@ cpu_ptrace(struct thread *td, int req, void *addr, int error = EINVAL; switch (req) { case PT_GETVRREGS: - if (!(cpu_features & PPC_FEATURE_HAS_ALTIVEC)) + if (!(cpu_features & PPC_FEATURE_VECTOR)) break; if (pcb->pcb_flags & PCB_VEC) { @@ -68,7 +74,7 @@ cpu_ptrace(struct thread *td, int req, void *addr, int error = copyout(&vec, addr, sizeof(vec)); break; case PT_SETVRREGS: - if (!(cpu_features & PPC_FEATURE_HAS_ALTIVEC)) + if (!(cpu_features & PPC_FEATURE_VECTOR)) break; error = copyin(addr, &vec, sizeof(vec)); if (error == 0) { From owner-svn-src-all@freebsd.org Fri Nov 22 10:03:17 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 76F311B4145; Fri, 22 Nov 2019 10:03:17 +0000 (UTC) (envelope-from lwhsu@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47KBnx2Ht3z4bH3; Fri, 22 Nov 2019 10:03:17 +0000 (UTC) (envelope-from lwhsu@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 3306821FE1; Fri, 22 Nov 2019 10:03:17 +0000 (UTC) (envelope-from lwhsu@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xAMA3G2C054490; Fri, 22 Nov 2019 10:03:16 GMT (envelope-from lwhsu@FreeBSD.org) Received: (from lwhsu@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xAMA3GOX054489; Fri, 22 Nov 2019 10:03:16 GMT (envelope-from lwhsu@FreeBSD.org) Message-Id: <201911221003.xAMA3GOX054489@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: lwhsu set sender to lwhsu@FreeBSD.org using -f From: Li-Wen Hsu Date: Fri, 22 Nov 2019 10:03:16 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354991 - head/tests/sys/sys X-SVN-Group: head X-SVN-Commit-Author: lwhsu X-SVN-Commit-Paths: head/tests/sys/sys X-SVN-Commit-Revision: 354991 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 22 Nov 2019 10:03:17 -0000 Author: lwhsu Date: Fri Nov 22 10:03:16 2019 New Revision: 354991 URL: https://svnweb.freebsd.org/changeset/base/354991 Log: Fix GCC build. Sponsored by: The FreeBSD Foundation Modified: head/tests/sys/sys/bitstring_test.c Modified: head/tests/sys/sys/bitstring_test.c ============================================================================== --- head/tests/sys/sys/bitstring_test.c Fri Nov 22 04:34:46 2019 (r354990) +++ head/tests/sys/sys/bitstring_test.c Fri Nov 22 10:03:16 2019 (r354991) @@ -347,7 +347,7 @@ ATF_TC_WITHOUT_HEAD(bit_ffs_area); ATF_TC_BODY(bit_ffs_area, tc) { const int nbits = 72; - bitstr_t bit_decl(bitstr, nbits) = {}; + bitstr_t bit_decl(bitstr, nbits); int location; bit_set(bitstr, 5); @@ -416,7 +416,7 @@ ATF_TC_WITHOUT_HEAD(bit_ffc_area); ATF_TC_BODY(bit_ffc_area, tc) { const int nbits = 80; - bitstr_t bit_decl(bitstr, nbits) = {}; + bitstr_t bit_decl(bitstr, nbits); int location; /* set all bits */ From owner-svn-src-all@freebsd.org Fri Nov 22 10:15:16 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 221FA1B44C8; Fri, 22 Nov 2019 10:15:16 +0000 (UTC) (envelope-from lwhsu@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47KC3m06N8z4bw3; Fri, 22 Nov 2019 10:15:16 +0000 (UTC) (envelope-from lwhsu@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id DB0E62219B; Fri, 22 Nov 2019 10:15:15 +0000 (UTC) (envelope-from lwhsu@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xAMAFFUF060679; Fri, 22 Nov 2019 10:15:15 GMT (envelope-from lwhsu@FreeBSD.org) Received: (from lwhsu@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xAMAFFck060678; Fri, 22 Nov 2019 10:15:15 GMT (envelope-from lwhsu@FreeBSD.org) Message-Id: <201911221015.xAMAFFck060678@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: lwhsu set sender to lwhsu@FreeBSD.org using -f From: Li-Wen Hsu Date: Fri, 22 Nov 2019 10:15:15 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354992 - head/tests/sys/sys X-SVN-Group: head X-SVN-Commit-Author: lwhsu X-SVN-Commit-Paths: head/tests/sys/sys X-SVN-Commit-Revision: 354992 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 22 Nov 2019 10:15:16 -0000 Author: lwhsu Date: Fri Nov 22 10:15:15 2019 New Revision: 354992 URL: https://svnweb.freebsd.org/changeset/base/354992 Log: Initialize variable bitstr r354991 removed variable-sized object initializing on defining. For the safe reason, manually initialize the members to 0. Sponsored by: The FreeBSD Foundation Modified: head/tests/sys/sys/bitstring_test.c Modified: head/tests/sys/sys/bitstring_test.c ============================================================================== --- head/tests/sys/sys/bitstring_test.c Fri Nov 22 10:03:16 2019 (r354991) +++ head/tests/sys/sys/bitstring_test.c Fri Nov 22 10:15:15 2019 (r354992) @@ -350,6 +350,8 @@ ATF_TC_BODY(bit_ffs_area, tc) bitstr_t bit_decl(bitstr, nbits); int location; + memset(bitstr, 0, bitstr_size(nbits)); + bit_set(bitstr, 5); bit_set(bitstr, 6); From owner-svn-src-all@freebsd.org Fri Nov 22 14:18:13 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 2F7BC1B94BB; Fri, 22 Nov 2019 14:18:13 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47KJS50Vtsz3LNQ; Fri, 22 Nov 2019 14:18:13 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id E994324CBC; Fri, 22 Nov 2019 14:18:12 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xAMEICh0001856; Fri, 22 Nov 2019 14:18:12 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xAMEIC2d001855; Fri, 22 Nov 2019 14:18:12 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201911221418.xAMEIC2d001855@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Fri, 22 Nov 2019 14:18:12 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r354993 - in stable/12/sys: contrib/rdma/krping ofed/include/rdma X-SVN-Group: stable-12 X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: in stable/12/sys: contrib/rdma/krping ofed/include/rdma X-SVN-Commit-Revision: 354993 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 22 Nov 2019 14:18:13 -0000 Author: hselasky Date: Fri Nov 22 14:18:12 2019 New Revision: 354993 URL: https://svnweb.freebsd.org/changeset/base/354993 Log: MFC r354727: Correct MR length field to be 64-bit in ibcore. Linux commit: edd31551148c09608feee6b8756ad148d550ee3b Sponsored by: Mellanox Technologies Modified: stable/12/sys/contrib/rdma/krping/krping.c stable/12/sys/ofed/include/rdma/ib_verbs.h Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/contrib/rdma/krping/krping.c ============================================================================== --- stable/12/sys/contrib/rdma/krping/krping.c Fri Nov 22 10:15:15 2019 (r354992) +++ stable/12/sys/contrib/rdma/krping/krping.c Fri Nov 22 14:18:12 2019 (r354993) @@ -736,7 +736,7 @@ static u32 krping_rdma_rkey(struct krping_cb *cb, u64 post_inv, cb->reg_mr_wr.key, cb->reg_mr->page_size, - cb->reg_mr->length, + (unsigned)cb->reg_mr->length, (unsigned long long)cb->reg_mr->iova); if (post_inv) Modified: stable/12/sys/ofed/include/rdma/ib_verbs.h ============================================================================== --- stable/12/sys/ofed/include/rdma/ib_verbs.h Fri Nov 22 10:15:15 2019 (r354992) +++ stable/12/sys/ofed/include/rdma/ib_verbs.h Fri Nov 22 14:18:12 2019 (r354993) @@ -1559,7 +1559,7 @@ struct ib_mr { u32 lkey; u32 rkey; u64 iova; - u32 length; + u64 length; unsigned int page_size; bool need_inval; union { From owner-svn-src-all@freebsd.org Fri Nov 22 14:21:56 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 0D0891B973A; Fri, 22 Nov 2019 14:21:56 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47KJXM6bPHz3LcF; Fri, 22 Nov 2019 14:21:55 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id C5F9424D3B; Fri, 22 Nov 2019 14:21:55 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xAMELt71003456; Fri, 22 Nov 2019 14:21:55 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xAMELt1F003454; Fri, 22 Nov 2019 14:21:55 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201911221421.xAMELt1F003454@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Fri, 22 Nov 2019 14:21:55 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r354994 - in stable/11/sys: contrib/rdma/krping ofed/include/rdma X-SVN-Group: stable-11 X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: in stable/11/sys: contrib/rdma/krping ofed/include/rdma X-SVN-Commit-Revision: 354994 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 22 Nov 2019 14:21:56 -0000 Author: hselasky Date: Fri Nov 22 14:21:55 2019 New Revision: 354994 URL: https://svnweb.freebsd.org/changeset/base/354994 Log: MFC r354727: Correct MR length field to be 64-bit in ibcore. Linux commit: edd31551148c09608feee6b8756ad148d550ee3b Sponsored by: Mellanox Technologies Modified: stable/11/sys/contrib/rdma/krping/krping.c stable/11/sys/ofed/include/rdma/ib_verbs.h Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/contrib/rdma/krping/krping.c ============================================================================== --- stable/11/sys/contrib/rdma/krping/krping.c Fri Nov 22 14:18:12 2019 (r354993) +++ stable/11/sys/contrib/rdma/krping/krping.c Fri Nov 22 14:21:55 2019 (r354994) @@ -736,7 +736,7 @@ static u32 krping_rdma_rkey(struct krping_cb *cb, u64 post_inv, cb->reg_mr_wr.key, cb->reg_mr->page_size, - cb->reg_mr->length, + (unsigned)cb->reg_mr->length, (unsigned long long)cb->reg_mr->iova); if (post_inv) Modified: stable/11/sys/ofed/include/rdma/ib_verbs.h ============================================================================== --- stable/11/sys/ofed/include/rdma/ib_verbs.h Fri Nov 22 14:18:12 2019 (r354993) +++ stable/11/sys/ofed/include/rdma/ib_verbs.h Fri Nov 22 14:21:55 2019 (r354994) @@ -1562,7 +1562,7 @@ struct ib_mr { u32 lkey; u32 rkey; u64 iova; - u32 length; + u64 length; unsigned int page_size; bool need_inval; union { From owner-svn-src-all@freebsd.org Fri Nov 22 14:23:12 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 5698F1B97D1; Fri, 22 Nov 2019 14:23:12 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47KJYr1gKcz3LtF; Fri, 22 Nov 2019 14:23:12 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 1D5EA24E71; Fri, 22 Nov 2019 14:23:12 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xAMENBEV007555; Fri, 22 Nov 2019 14:23:11 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xAMENBuh007554; Fri, 22 Nov 2019 14:23:11 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201911221423.xAMENBuh007554@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Fri, 22 Nov 2019 14:23:11 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r354995 - stable/12/sys/ofed/include/rdma X-SVN-Group: stable-12 X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: stable/12/sys/ofed/include/rdma X-SVN-Commit-Revision: 354995 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 22 Nov 2019 14:23:12 -0000 Author: hselasky Date: Fri Nov 22 14:23:11 2019 New Revision: 354995 URL: https://svnweb.freebsd.org/changeset/base/354995 Log: MFC r354728: Prevent potential underflow in ibcore. Linux commit: a9018adfde809d44e71189b984fa61cc89682b5e Sponsored by: Mellanox Technologies Modified: stable/12/sys/ofed/include/rdma/ib_verbs.h Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/ofed/include/rdma/ib_verbs.h ============================================================================== --- stable/12/sys/ofed/include/rdma/ib_verbs.h Fri Nov 22 14:21:55 2019 (r354994) +++ stable/12/sys/ofed/include/rdma/ib_verbs.h Fri Nov 22 14:23:11 2019 (r354995) @@ -285,7 +285,7 @@ enum ib_cq_creation_flags { struct ib_cq_init_attr { unsigned int cqe; - int comp_vector; + u32 comp_vector; u32 flags; }; From owner-svn-src-all@freebsd.org Fri Nov 22 14:24:11 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 919DB1B9858; Fri, 22 Nov 2019 14:24:11 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47KJZz3J2wz3M1W; Fri, 22 Nov 2019 14:24:11 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 5468024E73; Fri, 22 Nov 2019 14:24:11 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xAMEOBRm007654; Fri, 22 Nov 2019 14:24:11 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xAMEOBT6007653; Fri, 22 Nov 2019 14:24:11 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201911221424.xAMEOBT6007653@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Fri, 22 Nov 2019 14:24:11 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r354996 - stable/11/sys/ofed/include/rdma X-SVN-Group: stable-11 X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: stable/11/sys/ofed/include/rdma X-SVN-Commit-Revision: 354996 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 22 Nov 2019 14:24:11 -0000 Author: hselasky Date: Fri Nov 22 14:24:10 2019 New Revision: 354996 URL: https://svnweb.freebsd.org/changeset/base/354996 Log: MFC r354728: Prevent potential underflow in ibcore. Linux commit: a9018adfde809d44e71189b984fa61cc89682b5e Sponsored by: Mellanox Technologies Modified: stable/11/sys/ofed/include/rdma/ib_verbs.h Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/ofed/include/rdma/ib_verbs.h ============================================================================== --- stable/11/sys/ofed/include/rdma/ib_verbs.h Fri Nov 22 14:23:11 2019 (r354995) +++ stable/11/sys/ofed/include/rdma/ib_verbs.h Fri Nov 22 14:24:10 2019 (r354996) @@ -283,7 +283,7 @@ enum ib_cq_creation_flags { struct ib_cq_init_attr { unsigned int cqe; - int comp_vector; + u32 comp_vector; u32 flags; }; From owner-svn-src-all@freebsd.org Fri Nov 22 15:04:04 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 9E2B01BA29C; Fri, 22 Nov 2019 15:04:04 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47KKT03RlKz3NVR; Fri, 22 Nov 2019 15:04:04 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 5AD312556F; Fri, 22 Nov 2019 15:04:04 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xAMF44A1031071; Fri, 22 Nov 2019 15:04:04 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xAMF44lM031070; Fri, 22 Nov 2019 15:04:04 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201911221504.xAMF44lM031070@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Fri, 22 Nov 2019 15:04:04 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354997 - head/contrib/amd/amd X-SVN-Group: head X-SVN-Commit-Author: emaste X-SVN-Commit-Paths: head/contrib/amd/amd X-SVN-Commit-Revision: 354997 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 22 Nov 2019 15:04:04 -0000 Author: emaste Date: Fri Nov 22 15:04:03 2019 New Revision: 354997 URL: https://svnweb.freebsd.org/changeset/base/354997 Log: add deprecation notice to amd man page Clarify the deprecation notice in amd.8. amd will be removed from the FreeBSD base system before FreeBSD 13.0. Reviewed by: rgrimes, trasz, kevans, brooks (all earlier, in D22466) Discussed with: cy MFC after: 3 days Sponsored by: The FreeBSD Foundation Modified: head/contrib/amd/amd/amd.8 Modified: head/contrib/amd/amd/amd.8 ============================================================================== --- head/contrib/amd/amd/amd.8 Fri Nov 22 14:24:10 2019 (r354996) +++ head/contrib/amd/amd/amd.8 Fri Nov 22 15:04:03 2019 (r354997) @@ -36,7 +36,7 @@ .\" File: am-utils/amd/amd.8 .\" $FreeBSD$ .\" -.Dd February 26, 2016 +.Dd November 22, 2019 .Dt AMD 8 .Os .Sh NAME @@ -72,10 +72,17 @@ .Ar ... .Sh DESCRIPTION .Bf -symbolic -This daemon is obsolete. +The +.Nm +daemon in the +.Fx +base system is deprecated and will be removed before +.Fx 13.0 . Users are advised to use .Xr autofs 5 -instead. +or the +.Pa sysutils/am-utils +port or package instead. .Ef .Pp The From owner-svn-src-all@freebsd.org Fri Nov 22 15:06:08 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 2BFF51BA409; Fri, 22 Nov 2019 15:06:08 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47KKWN0MMxz3Nj3; Fri, 22 Nov 2019 15:06:08 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id DF28125571; Fri, 22 Nov 2019 15:06:07 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xAMF67Xp031207; Fri, 22 Nov 2019 15:06:07 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xAMF678t031206; Fri, 22 Nov 2019 15:06:07 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201911221506.xAMF678t031206@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Fri, 22 Nov 2019 15:06:07 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354998 - head/contrib/amd/amd X-SVN-Group: head X-SVN-Commit-Author: emaste X-SVN-Commit-Paths: head/contrib/amd/amd X-SVN-Commit-Revision: 354998 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 22 Nov 2019 15:06:08 -0000 Author: emaste Date: Fri Nov 22 15:06:07 2019 New Revision: 354998 URL: https://svnweb.freebsd.org/changeset/base/354998 Log: amd: add deprecation warning on program startup Reviewed by: rgrimes, trasz, kevans, brooks Discussed with: cy Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D22466 Modified: head/contrib/amd/amd/amd.c Modified: head/contrib/amd/amd/amd.c ============================================================================== --- head/contrib/amd/amd/amd.c Fri Nov 22 15:04:03 2019 (r354997) +++ head/contrib/amd/amd/amd.c Fri Nov 22 15:06:07 2019 (r354998) @@ -414,6 +414,8 @@ main(int argc, char *argv[]) progname = "amd"; am_set_progname(progname); + plog(XLOG_WARNING, "built-in amd in FreeBSD is deprecated and will be removed before FreeBSD 13"); + /* * Initialize process id. This is kept * cached since it is used for generating From owner-svn-src-all@freebsd.org Fri Nov 22 15:41:48 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 711EA1BADEE; Fri, 22 Nov 2019 15:41:48 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47KLJX2Dx1z3Q7c; Fri, 22 Nov 2019 15:41:48 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 3094B25B34; Fri, 22 Nov 2019 15:41:48 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xAMFflEU053267; Fri, 22 Nov 2019 15:41:47 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xAMFfltJ053266; Fri, 22 Nov 2019 15:41:47 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201911221541.xAMFfltJ053266@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Fri, 22 Nov 2019 15:41:47 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354999 - head/sbin/camcontrol X-SVN-Group: head X-SVN-Commit-Author: mav X-SVN-Commit-Paths: head/sbin/camcontrol X-SVN-Commit-Revision: 354999 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 22 Nov 2019 15:41:48 -0000 Author: mav Date: Fri Nov 22 15:41:47 2019 New Revision: 354999 URL: https://svnweb.freebsd.org/changeset/base/354999 Log: Fix off-by-one error in HPA/AMA maximum reporting. Before my refactoring the code reported value as maximum number of sectors, adding one to the maximum sector number returned by respective command. While this difference is somewhat confusing, restore previous behavior. MFC after: 3 days Modified: head/sbin/camcontrol/camcontrol.c Modified: head/sbin/camcontrol/camcontrol.c ============================================================================== --- head/sbin/camcontrol/camcontrol.c Fri Nov 22 15:06:07 2019 (r354998) +++ head/sbin/camcontrol/camcontrol.c Fri Nov 22 15:41:47 2019 (r354999) @@ -1961,7 +1961,7 @@ atahpa_proc_resp(struct cam_device *device, union ccb if (hpasize != NULL) { if (retval == 2 || retval == 6) return (1); - *hpasize = lba; + *hpasize = lba + 1; } return (0); From owner-svn-src-all@freebsd.org Fri Nov 22 16:25:01 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 6229E1BB664; Fri, 22 Nov 2019 16:25:01 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47KMGP1ykKz3x41; Fri, 22 Nov 2019 16:25:01 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 2708F2639E; Fri, 22 Nov 2019 16:25:01 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xAMGP1RL078489; Fri, 22 Nov 2019 16:25:01 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xAMGP13h078488; Fri, 22 Nov 2019 16:25:01 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201911221625.xAMGP13h078488@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Fri, 22 Nov 2019 16:25:01 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r355000 - head/lib/libc/sys X-SVN-Group: head X-SVN-Commit-Author: markj X-SVN-Commit-Paths: head/lib/libc/sys X-SVN-Commit-Revision: 355000 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 22 Nov 2019 16:25:01 -0000 Author: markj Date: Fri Nov 22 16:25:00 2019 New Revision: 355000 URL: https://svnweb.freebsd.org/changeset/base/355000 Log: Fix typos in the cpuset_{get,set}domain() man page. MFC after: 1 week Sponsored by: The FreeBSD Foundation Modified: head/lib/libc/sys/cpuset_getdomain.2 Modified: head/lib/libc/sys/cpuset_getdomain.2 ============================================================================== --- head/lib/libc/sys/cpuset_getdomain.2 Fri Nov 22 15:41:47 2019 (r354999) +++ head/lib/libc/sys/cpuset_getdomain.2 Fri Nov 22 16:25:00 2019 (r355000) @@ -47,7 +47,7 @@ and allow the manipulation of sets of memory domains and allocation policy available to processes, threads, jails and other resources. These functions may manipulate sets of memory domains that contain many processes -or per-object anonymous masks that effect only a single object. +or per-object anonymous masks that affect only a single object. .Pp The valid values for the .Fa level @@ -97,7 +97,8 @@ mask and policy from the object specified by and .Fa id and stores it in the space provided by -.Fa mask and +.Fa mask +and .Fa policy . .Pp .Fn cpuset_setdomain @@ -107,7 +108,8 @@ attempts to set the mask and policy for the object spe and .Fa id to the values in -.Fa mask and +.Fa mask +and .Fa policy . .Sh ALLOCATION POLICIES Valid policy values are as follows: From owner-svn-src-all@freebsd.org Fri Nov 22 16:28:53 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 96B311BB844; Fri, 22 Nov 2019 16:28:53 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47KMLs3XYnz3xKL; Fri, 22 Nov 2019 16:28:53 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 599EA263B9; Fri, 22 Nov 2019 16:28:53 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xAMGSrvF078680; Fri, 22 Nov 2019 16:28:53 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xAMGSq4R078678; Fri, 22 Nov 2019 16:28:52 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201911221628.xAMGSq4R078678@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Fri, 22 Nov 2019 16:28:52 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r355001 - head/sys/vm X-SVN-Group: head X-SVN-Commit-Author: markj X-SVN-Commit-Paths: head/sys/vm X-SVN-Commit-Revision: 355001 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 22 Nov 2019 16:28:53 -0000 Author: markj Date: Fri Nov 22 16:28:52 2019 New Revision: 355001 URL: https://svnweb.freebsd.org/changeset/base/355001 Log: Fix locking in vm_reserv_reclaim_contig(). We were not properly handling the case where the trylock of the reservaton fails, in which case we could leak reservation lock. Introduce a marker reservation to implement precise scanning in vm_reserv_reclaim_contig(). Before, a race could result in early termination of the scan in rare situations. Use the marker's lock to serialize scans of the partpop queue so that a global marker structure can be used. Modify vm_reserv_reclaim_inactive() to handle the presence of a marker while minimizing the hold time of domain-global locks. Reviewed by: alc, jeff, kib MFC after: 2 weeks Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D22392 Modified: head/sys/vm/vm_reserv.c head/sys/vm/vm_reserv.h Modified: head/sys/vm/vm_reserv.c ============================================================================== --- head/sys/vm/vm_reserv.c Fri Nov 22 16:25:00 2019 (r355000) +++ head/sys/vm/vm_reserv.c Fri Nov 22 16:28:52 2019 (r355001) @@ -181,10 +181,11 @@ popmap_is_set(popmap_t popmap[], int i) * * A partially populated reservation can be broken and reclaimed at any time. * - * r - vm_reserv_lock + * c - constant after boot * d - vm_reserv_domain_lock * o - vm_reserv_object_lock - * c - constant after boot + * r - vm_reserv_lock + * s - vm_reserv_domain_scan_lock */ struct vm_reserv { struct mtx lock; /* reservation lock. */ @@ -200,6 +201,8 @@ struct vm_reserv { popmap_t popmap[NPOPMAP_MAX]; /* (r) bit vector, used pages */ }; +TAILQ_HEAD(vm_reserv_queue, vm_reserv); + #define vm_reserv_lockptr(rv) (&(rv)->lock) #define vm_reserv_assert_locked(rv) \ mtx_assert(vm_reserv_lockptr(rv), MA_OWNED) @@ -238,18 +241,26 @@ static vm_reserv_t vm_reserv_array; * is the least recently changed, partially populated reservation. * * Access to this queue is synchronized by the per-domain reservation lock. + * Threads reclaiming free pages from the queue must hold the per-domain scan + * lock. */ struct vm_reserv_domain { - struct mtx lock; - TAILQ_HEAD(, vm_reserv) partpop; + struct mtx lock; + struct vm_reserv_queue partpop; /* (d) */ + struct vm_reserv marker; /* (d, s) scan marker/lock */ } __aligned(CACHE_LINE_SIZE); static struct vm_reserv_domain vm_rvd[MAXMEMDOM]; #define vm_reserv_domain_lockptr(d) (&vm_rvd[(d)].lock) +#define vm_reserv_domain_assert_locked(d) \ + mtx_assert(vm_reserv_domain_lockptr(d), MA_OWNED) #define vm_reserv_domain_lock(d) mtx_lock(vm_reserv_domain_lockptr(d)) #define vm_reserv_domain_unlock(d) mtx_unlock(vm_reserv_domain_lockptr(d)) +#define vm_reserv_domain_scan_lock(d) mtx_lock(&vm_rvd[(d)].marker.lock) +#define vm_reserv_domain_scan_unlock(d) mtx_unlock(&vm_rvd[(d)].marker.lock) + static SYSCTL_NODE(_vm, OID_AUTO, reserv, CTLFLAG_RD, 0, "Reservation Info"); static counter_u64_t vm_reserv_broken = EARLY_COUNTER; @@ -350,6 +361,8 @@ sysctl_vm_reserv_partpopq(SYSCTL_HANDLER_ARGS) unused_pages = 0; vm_reserv_domain_lock(domain); TAILQ_FOREACH(rv, &vm_rvd[domain].partpop, partpopq) { + if (rv == &vm_rvd[domain].marker) + continue; counter++; unused_pages += VM_LEVEL_0_NPAGES - rv->popcnt; } @@ -1037,7 +1050,8 @@ vm_reserv_init(void) vm_paddr_t paddr; struct vm_phys_seg *seg; struct vm_reserv *rv; - int i, segind; + struct vm_reserv_domain *rvd; + int i, j, segind; /* * Initialize the reservation array. Specifically, initialize the @@ -1056,8 +1070,18 @@ vm_reserv_init(void) } } for (i = 0; i < MAXMEMDOM; i++) { - mtx_init(&vm_rvd[i].lock, "VM reserv domain", NULL, MTX_DEF); - TAILQ_INIT(&vm_rvd[i].partpop); + rvd = &vm_rvd[i]; + mtx_init(&rvd->lock, "vm reserv domain", NULL, MTX_DEF); + TAILQ_INIT(&rvd->partpop); + mtx_init(&rvd->marker.lock, "vm reserv marker", NULL, MTX_DEF); + + /* + * Fully populated reservations should never be present in the + * partially populated reservation queues. + */ + rvd->marker.popcnt = VM_LEVEL_0_NPAGES; + for (j = 0; j < NBPOPMAP; j++) + popmap_set(rvd->marker.popmap, j); } for (i = 0; i < VM_RESERV_OBJ_LOCK_COUNT; i++) @@ -1107,50 +1131,71 @@ vm_reserv_level_iffullpop(vm_page_t m) } /* - * Breaks the given partially populated reservation, releasing its free pages - * to the physical memory allocator. + * Remove a partially populated reservation from the queue. */ static void -vm_reserv_reclaim(vm_reserv_t rv) +vm_reserv_dequeue(vm_reserv_t rv) { + vm_reserv_domain_assert_locked(rv->domain); vm_reserv_assert_locked(rv); CTR5(KTR_VM, "%s: rv %p object %p popcnt %d inpartpop %d", __FUNCTION__, rv, rv->object, rv->popcnt, rv->inpartpopq); - vm_reserv_domain_lock(rv->domain); KASSERT(rv->inpartpopq, ("vm_reserv_reclaim: reserv %p's inpartpopq is FALSE", rv)); - KASSERT(rv->domain < vm_ndomains, - ("vm_reserv_reclaim: reserv %p's domain is corrupted %d", - rv, rv->domain)); + TAILQ_REMOVE(&vm_rvd[rv->domain].partpop, rv, partpopq); rv->inpartpopq = FALSE; - vm_reserv_domain_unlock(rv->domain); +} + +/* + * Breaks the given partially populated reservation, releasing its free pages + * to the physical memory allocator. + */ +static void +vm_reserv_reclaim(vm_reserv_t rv) +{ + + vm_reserv_assert_locked(rv); + CTR5(KTR_VM, "%s: rv %p object %p popcnt %d inpartpop %d", + __FUNCTION__, rv, rv->object, rv->popcnt, rv->inpartpopq); + if (rv->inpartpopq) { + vm_reserv_domain_lock(rv->domain); + vm_reserv_dequeue(rv); + vm_reserv_domain_unlock(rv->domain); + } vm_reserv_break(rv); counter_u64_add(vm_reserv_reclaimed, 1); } /* - * Breaks the reservation at the head of the partially populated reservation + * Breaks a reservation near the head of the partially populated reservation * queue, releasing its free pages to the physical memory allocator. Returns * TRUE if a reservation is broken and FALSE otherwise. */ -boolean_t +bool vm_reserv_reclaim_inactive(int domain) { vm_reserv_t rv; - while ((rv = TAILQ_FIRST(&vm_rvd[domain].partpop)) != NULL) { - vm_reserv_lock(rv); - if (rv != TAILQ_FIRST(&vm_rvd[domain].partpop)) { - vm_reserv_unlock(rv); - continue; + vm_reserv_domain_lock(domain); + TAILQ_FOREACH(rv, &vm_rvd[domain].partpop, partpopq) { + /* + * A locked reservation is likely being updated or reclaimed, + * so just skip ahead. + */ + if (rv != &vm_rvd[domain].marker && vm_reserv_trylock(rv)) { + vm_reserv_dequeue(rv); + break; } + } + vm_reserv_domain_unlock(domain); + if (rv != NULL) { vm_reserv_reclaim(rv); vm_reserv_unlock(rv); - return (TRUE); + return (true); } - return (FALSE); + return (false); } /* @@ -1236,20 +1281,23 @@ vm_reserv_test_contig(vm_reserv_t rv, u_long npages, v * contiguous physical memory. If a satisfactory reservation is found, it is * broken. Returns true if a reservation is broken and false otherwise. */ -boolean_t +bool vm_reserv_reclaim_contig(int domain, u_long npages, vm_paddr_t low, vm_paddr_t high, u_long alignment, vm_paddr_t boundary) { + struct vm_reserv_queue *queue; vm_paddr_t pa, size; - vm_reserv_t rv, rvn; + vm_reserv_t marker, rv, rvn; if (npages > VM_LEVEL_0_NPAGES - 1) return (false); + marker = &vm_rvd[domain].marker; + queue = &vm_rvd[domain].partpop; size = npages << PAGE_SHIFT; + + vm_reserv_domain_scan_lock(domain); vm_reserv_domain_lock(domain); -again: - for (rv = TAILQ_FIRST(&vm_rvd[domain].partpop); rv != NULL; rv = rvn) { - rvn = TAILQ_NEXT(rv, partpopq); + TAILQ_FOREACH_SAFE(rv, queue, partpopq, rvn) { pa = VM_PAGE_TO_PHYS(&rv->pages[0]); if (pa + VM_LEVEL_0_SIZE - size < low) { /* This entire reservation is too low; go to next. */ @@ -1259,29 +1307,35 @@ again: /* This entire reservation is too high; go to next. */ continue; } + if (vm_reserv_trylock(rv) == 0) { + TAILQ_INSERT_AFTER(queue, rv, marker, partpopq); vm_reserv_domain_unlock(domain); vm_reserv_lock(rv); - if (!rv->inpartpopq) { + if (!rv->inpartpopq || + TAILQ_NEXT(rv, partpopq) != marker) { + vm_reserv_unlock(rv); vm_reserv_domain_lock(domain); - if (!rvn->inpartpopq) - goto again; + rvn = TAILQ_NEXT(marker, partpopq); + TAILQ_REMOVE(queue, marker, partpopq); continue; } - } else - vm_reserv_domain_unlock(domain); + vm_reserv_domain_lock(domain); + TAILQ_REMOVE(queue, marker, partpopq); + } + vm_reserv_domain_unlock(domain); if (vm_reserv_test_contig(rv, npages, low, high, alignment, boundary)) { + vm_reserv_domain_scan_unlock(domain); vm_reserv_reclaim(rv); vm_reserv_unlock(rv); return (true); } vm_reserv_unlock(rv); vm_reserv_domain_lock(domain); - if (rvn != NULL && !rvn->inpartpopq) - goto again; } vm_reserv_domain_unlock(domain); + vm_reserv_domain_scan_unlock(domain); return (false); } Modified: head/sys/vm/vm_reserv.h ============================================================================== --- head/sys/vm/vm_reserv.h Fri Nov 22 16:25:00 2019 (r355000) +++ head/sys/vm/vm_reserv.h Fri Nov 22 16:28:52 2019 (r355001) @@ -59,10 +59,10 @@ void vm_reserv_init(void); bool vm_reserv_is_page_free(vm_page_t m); int vm_reserv_level(vm_page_t m); int vm_reserv_level_iffullpop(vm_page_t m); -boolean_t vm_reserv_reclaim_contig(int domain, u_long npages, +bool vm_reserv_reclaim_contig(int domain, u_long npages, vm_paddr_t low, vm_paddr_t high, u_long alignment, vm_paddr_t boundary); -boolean_t vm_reserv_reclaim_inactive(int domain); +bool vm_reserv_reclaim_inactive(int domain); void vm_reserv_rename(vm_page_t m, vm_object_t new_object, vm_object_t old_object, vm_pindex_t old_object_offset); int vm_reserv_size(int level); From owner-svn-src-all@freebsd.org Fri Nov 22 16:30:49 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 51BEA1BBA97; Fri, 22 Nov 2019 16:30:49 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47KMP51WmRz3xcD; Fri, 22 Nov 2019 16:30:49 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 18546264E0; Fri, 22 Nov 2019 16:30:49 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xAMGUmus080176; Fri, 22 Nov 2019 16:30:48 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xAMGUmXc080171; Fri, 22 Nov 2019 16:30:48 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201911221630.xAMGUmXc080171@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Fri, 22 Nov 2019 16:30:48 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r355002 - in head: share/man/man9 sys/vm X-SVN-Group: head X-SVN-Commit-Author: markj X-SVN-Commit-Paths: in head: share/man/man9 sys/vm X-SVN-Commit-Revision: 355002 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 22 Nov 2019 16:30:49 -0000 Author: markj Date: Fri Nov 22 16:30:47 2019 New Revision: 355002 URL: https://svnweb.freebsd.org/changeset/base/355002 Log: Revise the page cache size policy. In r353734 the use of the page caches was limited to systems with a relatively large amount of RAM per CPU. This was to mitigate some issues reported with the system not able to keep up with memory pressure in cases where it had been able to do so prior to the addition of the direct free pool cache. This change re-enables those caches. The change modifies uma_zone_set_maxcache(), which was introduced specifically for the page cache zones. Rather than using it to limit only the full bucket cache, have it also set uz_count_max to provide an upper bound on the per-CPU cache size that is consistent with the number of items requested. Remove its return value since it has no use. Enable the page cache zones unconditionally, and limit them to 0.1% of the domain's pages. The limit can be overridden by the vm.pgcache_zone_max tunable as before. Change the item size parameter passed to uma_zcache_create() to the correct size, and stop setting UMA_ZONE_MAXBUCKET. This allows the page cache buckets to be adaptively sized, like the rest of UMA's caches. This also causes the initial bucket size to be small, so only systems which benefit from large caches will get them. Reviewed by: gallatin, jeff MFC after: 2 weeks Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D22393 Modified: head/share/man/man9/zone.9 head/sys/vm/uma.h head/sys/vm/uma_core.c head/sys/vm/vm_glue.c head/sys/vm/vm_page.c Modified: head/share/man/man9/zone.9 ============================================================================== --- head/share/man/man9/zone.9 Fri Nov 22 16:28:52 2019 (r355001) +++ head/share/man/man9/zone.9 Fri Nov 22 16:30:47 2019 (r355002) @@ -25,7 +25,7 @@ .\" .\" $FreeBSD$ .\" -.Dd September 1, 2019 +.Dd November 22, 2019 .Dt UMA 9 .Os .Sh NAME @@ -107,7 +107,7 @@ typedef void (*uma_free)(void *item, vm_size_t size, u .Fn uma_zone_set_freef "uma_zone_t zone" "uma_free freef" .Ft int .Fn uma_zone_set_max "uma_zone_t zone" "int nitems" -.Ft int +.Ft void .Fn uma_zone_set_maxcache "uma_zone_t zone" "int nitems" .Ft int .Fn uma_zone_get_max "uma_zone_t zone" @@ -501,11 +501,8 @@ other CPUs when the limit is hit. .Pp The .Fn uma_zone_set_maxcache -function limits the number of free items which may be cached in the zone, -excluding the per-CPU caches, which are bounded in size. -For example, to implement a -.Ql pure -per-CPU cache, a cache zone may be configured with a maximum cache size of 0. +function limits the number of free items which may be cached in the zone. +This limit applies to both the per-CPU caches and the cache of free buckets. .Pp The .Fn uma_zone_get_max Modified: head/sys/vm/uma.h ============================================================================== --- head/sys/vm/uma.h Fri Nov 22 16:28:52 2019 (r355001) +++ head/sys/vm/uma.h Fri Nov 22 16:30:47 2019 (r355002) @@ -494,7 +494,7 @@ int uma_zone_reserve_kva(uma_zone_t zone, int nitems); * nitems The requested upper limit on the number of items allowed * * Returns: - * int The effective value of nitems after rounding up based on page size + * int The effective value of nitems */ int uma_zone_set_max(uma_zone_t zone, int nitems); @@ -504,11 +504,8 @@ int uma_zone_set_max(uma_zone_t zone, int nitems); * Arguments: * zone The zone to limit * nitems The requested upper limit on the number of items allowed - * - * Returns: - * int The effective value of nitems set */ -int uma_zone_set_maxcache(uma_zone_t zone, int nitems); +void uma_zone_set_maxcache(uma_zone_t zone, int nitems); /* * Obtains the effective limit on the number of items in a zone Modified: head/sys/vm/uma_core.c ============================================================================== --- head/sys/vm/uma_core.c Fri Nov 22 16:28:52 2019 (r355001) +++ head/sys/vm/uma_core.c Fri Nov 22 16:30:47 2019 (r355002) @@ -384,6 +384,29 @@ bucket_zone_lookup(int entries) return (ubz); } +static struct uma_bucket_zone * +bucket_zone_max(uma_zone_t zone, int nitems) +{ + struct uma_bucket_zone *ubz; + int bpcpu; + + bpcpu = 2; +#ifdef UMA_XDOMAIN + if ((zone->uz_flags & UMA_ZONE_NUMA) != 0) + /* Count the cross-domain bucket. */ + bpcpu++; +#endif + + for (ubz = &bucket_zones[0]; ubz->ubz_entries != 0; ubz++) + if (ubz->ubz_entries * bpcpu * mp_ncpus > nitems) + break; + if (ubz == &bucket_zones[0]) + ubz = NULL; + else + ubz--; + return (ubz); +} + static int bucket_select(int size) { @@ -3469,22 +3492,12 @@ int uma_zone_set_max(uma_zone_t zone, int nitems) { struct uma_bucket_zone *ubz; + int count; - /* - * If limit is very low we may need to limit how - * much items are allowed in CPU caches. - */ - ubz = &bucket_zones[0]; - for (; ubz->ubz_entries != 0; ubz++) - if (ubz->ubz_entries * 2 * mp_ncpus > nitems) - break; - if (ubz == &bucket_zones[0]) - nitems = ubz->ubz_entries * 2 * mp_ncpus; - else - ubz--; - ZONE_LOCK(zone); - zone->uz_count_max = zone->uz_count = ubz->ubz_entries; + ubz = bucket_zone_max(zone, nitems); + count = ubz != NULL ? ubz->ubz_entries : 0; + zone->uz_count_max = zone->uz_count = count; if (zone->uz_count_min > zone->uz_count_max) zone->uz_count_min = zone->uz_count_max; zone->uz_max_items = nitems; @@ -3494,15 +3507,30 @@ uma_zone_set_max(uma_zone_t zone, int nitems) } /* See uma.h */ -int +void uma_zone_set_maxcache(uma_zone_t zone, int nitems) { + struct uma_bucket_zone *ubz; + int bpcpu; ZONE_LOCK(zone); + ubz = bucket_zone_max(zone, nitems); + if (ubz != NULL) { + bpcpu = 2; +#ifdef UMA_XDOMAIN + if ((zone->uz_flags & UMA_ZONE_NUMA) != 0) + /* Count the cross-domain bucket. */ + bpcpu++; +#endif + nitems -= ubz->ubz_entries * bpcpu * mp_ncpus; + zone->uz_count_max = ubz->ubz_entries; + } else { + zone->uz_count_max = zone->uz_count = 0; + } + if (zone->uz_count_min > zone->uz_count_max) + zone->uz_count_min = zone->uz_count_max; zone->uz_bkt_max = nitems; ZONE_UNLOCK(zone); - - return (nitems); } /* See uma.h */ Modified: head/sys/vm/vm_glue.c ============================================================================== --- head/sys/vm/vm_glue.c Fri Nov 22 16:28:52 2019 (r355001) +++ head/sys/vm/vm_glue.c Fri Nov 22 16:30:47 2019 (r355002) @@ -80,6 +80,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include @@ -266,7 +267,7 @@ vm_sync_icache(vm_map_t map, vm_offset_t va, vm_offset } static uma_zone_t kstack_cache; -static int kstack_cache_size = 128; +static int kstack_cache_size; static int kstack_domain_iter; static int @@ -277,8 +278,7 @@ sysctl_kstack_cache_size(SYSCTL_HANDLER_ARGS) newsize = kstack_cache_size; error = sysctl_handle_int(oidp, &newsize, 0, req); if (error == 0 && req->newptr && newsize != kstack_cache_size) - kstack_cache_size = - uma_zone_set_maxcache(kstack_cache, newsize); + uma_zone_set_maxcache(kstack_cache, newsize); return (error); } SYSCTL_PROC(_vm, OID_AUTO, kstack_cache_size, CTLTYPE_INT|CTLFLAG_RW, @@ -473,7 +473,8 @@ kstack_cache_init(void *null) kstack_cache = uma_zcache_create("kstack_cache", kstack_pages * PAGE_SIZE, NULL, NULL, NULL, NULL, kstack_import, kstack_release, NULL, - UMA_ZONE_NUMA|UMA_ZONE_MINBUCKET); + UMA_ZONE_NUMA); + kstack_cache_size = imax(128, mp_ncpus * 4); uma_zone_set_maxcache(kstack_cache, kstack_cache_size); } Modified: head/sys/vm/vm_page.c ============================================================================== --- head/sys/vm/vm_page.c Fri Nov 22 16:28:52 2019 (r355001) +++ head/sys/vm/vm_page.c Fri Nov 22 16:30:47 2019 (r355002) @@ -216,30 +216,28 @@ vm_page_init_cache_zones(void *dummy __unused) { struct vm_domain *vmd; struct vm_pgcache *pgcache; - int domain, maxcache, pool; + int cache, domain, maxcache, pool; maxcache = 0; TUNABLE_INT_FETCH("vm.pgcache_zone_max", &maxcache); for (domain = 0; domain < vm_ndomains; domain++) { vmd = VM_DOMAIN(domain); - - /* - * Don't allow the page caches to take up more than .1875% of - * memory. A UMA bucket contains at most 256 free pages, and we - * have two buckets per CPU per free pool. - */ - if (vmd->vmd_page_count / 600 < 2 * 256 * mp_ncpus * - VM_NFREEPOOL) - continue; for (pool = 0; pool < VM_NFREEPOOL; pool++) { pgcache = &vmd->vmd_pgcache[pool]; pgcache->domain = domain; pgcache->pool = pool; pgcache->zone = uma_zcache_create("vm pgcache", - sizeof(struct vm_page), NULL, NULL, NULL, NULL, + PAGE_SIZE, NULL, NULL, NULL, NULL, vm_page_zone_import, vm_page_zone_release, pgcache, - UMA_ZONE_MAXBUCKET | UMA_ZONE_VM); - (void)uma_zone_set_maxcache(pgcache->zone, maxcache); + UMA_ZONE_VM); + + /* + * Limit each pool's zone to 0.1% of the pages in the + * domain. + */ + cache = maxcache != 0 ? maxcache : + vmd->vmd_page_count / 1000; + uma_zone_set_maxcache(pgcache->zone, cache); } } } From owner-svn-src-all@freebsd.org Fri Nov 22 16:31:10 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id AB4041BBAFC; Fri, 22 Nov 2019 16:31:10 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47KMPV41lHz3xlM; Fri, 22 Nov 2019 16:31:10 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 6EAF4264FA; Fri, 22 Nov 2019 16:31:10 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xAMGVApd080238; Fri, 22 Nov 2019 16:31:10 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xAMGVAYa080237; Fri, 22 Nov 2019 16:31:10 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201911221631.xAMGVAYa080237@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Fri, 22 Nov 2019 16:31:10 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r355003 - head/sys/vm X-SVN-Group: head X-SVN-Commit-Author: markj X-SVN-Commit-Paths: head/sys/vm X-SVN-Commit-Revision: 355003 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 22 Nov 2019 16:31:10 -0000 Author: markj Date: Fri Nov 22 16:31:10 2019 New Revision: 355003 URL: https://svnweb.freebsd.org/changeset/base/355003 Log: Update the checks in vm_page_zone_import(). - Remove the cnt == 1 check. UMA passes cnt == 1 when it has disabled per-CPU caching. In this case we might as well just allocate a single page and return it to the caller, since the caller is going to do exactly that anyway if the UMA cache allocation attempt fails. - Don't replenish caches if the domain is severely short on free pages. With large buckets we may otherwise quickly exacerbate a situation where the page daemon is failing to keep up. - Don't replenish caches if the calling thread belongs to the page daemon, which should avoid creating extra memory pressure when it is trying to free memory. Virtually all such allocations while occur in the context of laundering, where the laundry thread must allocate slabs for various swap and I/O-related UMA zones. Reviewed by: kib Discussed with: alc, jeff MFC after: 2 weeks Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D22394 Modified: head/sys/vm/vm_page.c Modified: head/sys/vm/vm_page.c ============================================================================== --- head/sys/vm/vm_page.c Fri Nov 22 16:30:47 2019 (r355002) +++ head/sys/vm/vm_page.c Fri Nov 22 16:31:10 2019 (r355003) @@ -1829,21 +1829,14 @@ vm_page_alloc_after(vm_object_t object, vm_pindex_t pi * Returns true if the number of free pages exceeds the minimum * for the request class and false otherwise. */ -int -vm_domain_allocate(struct vm_domain *vmd, int req, int npages) +static int +_vm_domain_allocate(struct vm_domain *vmd, int req_class, int npages) { u_int limit, old, new; - req = req & VM_ALLOC_CLASS_MASK; - - /* - * The page daemon is allowed to dig deeper into the free page list. - */ - if (curproc == pageproc && req != VM_ALLOC_INTERRUPT) - req = VM_ALLOC_SYSTEM; - if (req == VM_ALLOC_INTERRUPT) + if (req_class == VM_ALLOC_INTERRUPT) limit = 0; - else if (req == VM_ALLOC_SYSTEM) + else if (req_class == VM_ALLOC_SYSTEM) limit = vmd->vmd_interrupt_free_min; else limit = vmd->vmd_free_reserved; @@ -1871,6 +1864,20 @@ vm_domain_allocate(struct vm_domain *vmd, int req, int return (1); } +int +vm_domain_allocate(struct vm_domain *vmd, int req, int npages) +{ + int req_class; + + /* + * The page daemon is allowed to dig deeper into the free page list. + */ + req_class = req & VM_ALLOC_CLASS_MASK; + if (curproc == pageproc && req_class != VM_ALLOC_INTERRUPT) + req_class = VM_ALLOC_SYSTEM; + return (_vm_domain_allocate(vmd, req_class, npages)); +} + vm_page_t vm_page_alloc_domain_after(vm_object_t object, vm_pindex_t pindex, int domain, int req, vm_page_t mpred) @@ -2316,8 +2323,13 @@ vm_page_zone_import(void *arg, void **store, int cnt, pgcache = arg; vmd = VM_DOMAIN(pgcache->domain); - /* Only import if we can bring in a full bucket. */ - if (cnt == 1 || !vm_domain_allocate(vmd, VM_ALLOC_NORMAL, cnt)) + + /* + * The page daemon should avoid creating extra memory pressure since its + * main purpose is to replenish the store of free pages. + */ + if (vmd->vmd_severeset || curproc == pageproc || + !_vm_domain_allocate(vmd, VM_ALLOC_NORMAL, cnt)) return (0); domain = vmd->vmd_domain; vm_domain_free_lock(vmd); From owner-svn-src-all@freebsd.org Fri Nov 22 16:31:31 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 74B2D1BBB78; Fri, 22 Nov 2019 16:31:31 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47KMPv2XkJz3xvf; Fri, 22 Nov 2019 16:31:31 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 21B1126535; Fri, 22 Nov 2019 16:31:31 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xAMGVVQ7081810; Fri, 22 Nov 2019 16:31:31 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xAMGVVxU081809; Fri, 22 Nov 2019 16:31:31 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201911221631.xAMGVVxU081809@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Fri, 22 Nov 2019 16:31:31 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r355004 - head/sys/vm X-SVN-Group: head X-SVN-Commit-Author: markj X-SVN-Commit-Paths: head/sys/vm X-SVN-Commit-Revision: 355004 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 22 Nov 2019 16:31:31 -0000 Author: markj Date: Fri Nov 22 16:31:30 2019 New Revision: 355004 URL: https://svnweb.freebsd.org/changeset/base/355004 Log: Reclaim memory from UMA if the page daemon is struggling. Use the UMA reclaim thread to asynchronously drain all caches if there is a severe shortage in a domain. Otherwise we only trigger UMA reclamation every 10s even when the system has completely run out of memory. Stop entirely draining the caches when one domain falls below its min threshold. In some workloads it is normal for one NUMA domain to end up being nearly depleted by kernel memory allocations, for example for the ZFS ARC. The domainset iterators skip domains below the vmd_min_free theshold on the first iteration, so we should allow that mechanism to limit further depletion of the domain's free pages before taking the extreme step of calling uma_reclaim(UMA_RECLAIM_DRAIN_CPU). Discussed with: jeff MFC after: 2 weeks Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D22395 Modified: head/sys/vm/vm_pageout.c Modified: head/sys/vm/vm_pageout.c ============================================================================== --- head/sys/vm/vm_pageout.c Fri Nov 22 16:31:10 2019 (r355003) +++ head/sys/vm/vm_pageout.c Fri Nov 22 16:31:30 2019 (r355004) @@ -1965,12 +1965,20 @@ vm_pageout_oom(int shortage) } } +/* + * Signal a free page shortage to subsystems that have registered an event + * handler. Reclaim memory from UMA in the event of a severe shortage. + * Return true if the free page count should be re-evaluated. + */ static bool vm_pageout_lowmem(void) { static int lowmem_ticks = 0; int last; + bool ret; + ret = false; + last = atomic_load_int(&lowmem_ticks); while ((u_int)(ticks - last) / hz >= lowmem_period) { if (atomic_fcmpset_int(&lowmem_ticks, &last, ticks) == 0) @@ -1984,15 +1992,27 @@ vm_pageout_lowmem(void) /* * We do this explicitly after the caches have been - * drained above. If we have a severe page shortage on - * our hands, completely drain all UMA zones. Otherwise, - * just prune the caches. + * drained above. */ - uma_reclaim(vm_page_count_min() ? UMA_RECLAIM_DRAIN_CPU : - UMA_RECLAIM_TRIM); - return (true); + uma_reclaim(UMA_RECLAIM_TRIM); + ret = true; } - return (false); + + /* + * Kick off an asynchronous reclaim of cached memory if one of the + * page daemons is failing to keep up with demand. Use the "severe" + * threshold instead of "min" to ensure that we do not blow away the + * caches if a subset of the NUMA domains are depleted by kernel memory + * allocations; the domainset iterators automatically skip domains + * below the "min" threshold on the first pass. + * + * UMA reclaim worker has its own rate-limiting mechanism, so don't + * worry about kicking it too often. + */ + if (vm_page_count_severe()) + uma_reclaim_wakeup(); + + return (ret); } static void From owner-svn-src-all@freebsd.org Fri Nov 22 16:31:44 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id C64391BBBDA; Fri, 22 Nov 2019 16:31:44 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47KMQ84y3nz3y3K; Fri, 22 Nov 2019 16:31:44 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 8DFBA26549; Fri, 22 Nov 2019 16:31:44 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xAMGVinl082115; Fri, 22 Nov 2019 16:31:44 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xAMGViXr081861; Fri, 22 Nov 2019 16:31:44 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201911221631.xAMGViXr081861@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Fri, 22 Nov 2019 16:31:44 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r355005 - head/sys/vm X-SVN-Group: head X-SVN-Commit-Author: markj X-SVN-Commit-Paths: head/sys/vm X-SVN-Commit-Revision: 355005 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 22 Nov 2019 16:31:44 -0000 Author: markj Date: Fri Nov 22 16:31:43 2019 New Revision: 355005 URL: https://svnweb.freebsd.org/changeset/base/355005 Log: Simplify vm_pageout_init_domain() and add a "big picture" comment. Stop subtracting 1024/200 from vmd_page_count/200. I cannot see how such precise accounting can make a difference on modern systems. Add some explanation of what the page daemon does and how it handles memory shortages. Reviewed by: dougm Discussed with: jeff, kib MFC after: 2 weeks Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D22396 Modified: head/sys/vm/vm_pageout.c head/sys/vm/vm_pagequeue.h Modified: head/sys/vm/vm_pageout.c ============================================================================== --- head/sys/vm/vm_pageout.c Fri Nov 22 16:31:30 2019 (r355004) +++ head/sys/vm/vm_pageout.c Fri Nov 22 16:31:43 2019 (r355005) @@ -2104,7 +2104,9 @@ vm_pageout_worker(void *arg) } /* - * vm_pageout_init initialises basic pageout daemon settings. + * Initialize basic pageout daemon settings. See the comment above the + * definition of vm_domain for some explanation of how these thresholds are + * used. */ static void vm_pageout_init_domain(int domain) @@ -2120,14 +2122,11 @@ vm_pageout_init_domain(int domain) * swap pager structures plus enough for any pv_entry structs * when paging. */ - if (vmd->vmd_page_count > 1024) - vmd->vmd_free_min = 4 + (vmd->vmd_page_count - 1024) / 200; - else - vmd->vmd_free_min = 4; vmd->vmd_pageout_free_min = 2 * MAXBSIZE / PAGE_SIZE + vmd->vmd_interrupt_free_min; vmd->vmd_free_reserved = vm_pageout_page_count + - vmd->vmd_pageout_free_min + (vmd->vmd_page_count / 768); + vmd->vmd_pageout_free_min + vmd->vmd_page_count / 768; + vmd->vmd_free_min = vmd->vmd_page_count / 200; vmd->vmd_free_severe = vmd->vmd_free_min / 2; vmd->vmd_free_target = 4 * vmd->vmd_free_min + vmd->vmd_free_reserved; vmd->vmd_free_min += vmd->vmd_free_reserved; Modified: head/sys/vm/vm_pagequeue.h ============================================================================== --- head/sys/vm/vm_pagequeue.h Fri Nov 22 16:31:30 2019 (r355004) +++ head/sys/vm/vm_pagequeue.h Fri Nov 22 16:31:43 2019 (r355005) @@ -88,7 +88,7 @@ struct vm_batchqueue { struct sysctl_oid; /* - * One vm_domain per-numa domain. Contains pagequeues, free page structures, + * One vm_domain per NUMA domain. Contains pagequeues, free page structures, * and accounting. * * Lock Key: @@ -98,7 +98,141 @@ struct sysctl_oid; * a atomic * c const after boot * q page queue lock -*/ + * + * A unique page daemon thread manages each vm_domain structure and is + * responsible for ensuring that some free memory is available by freeing + * inactive pages and aging active pages. To decide how many pages to process, + * it uses thresholds derived from the number of pages in the domain: + * + * vmd_page_count + * --- + * | + * |-> vmd_inactive_target (~3%) + * | - The active queue scan target is given by + * | (vmd_inactive_target + vmd_free_target - vmd_free_count). + * | + * | + * |-> vmd_free_target (~2%) + * | - Target for page reclamation. + * | + * |-> vmd_pageout_wakeup_thresh (~1.8%) + * | - Threshold for waking up the page daemon. + * | + * | + * |-> vmd_free_min (~0.5%) + * | - First low memory threshold. + * | - Causes per-CPU caching to be lazily disabled in UMA. + * | - vm_wait() sleeps below this threshold. + * | + * |-> vmd_free_severe (~0.25%) + * | - Second low memory threshold. + * | - Triggers aggressive UMA reclamation, disables delayed buffer + * | writes. + * | + * |-> vmd_free_reserved (~0.13%) + * | - Minimum for VM_ALLOC_NORMAL page allocations. + * |-> vmd_pageout_free_min (32 + 2 pages) + * | - Minimum for waking a page daemon thread sleeping in vm_wait(). + * |-> vmd_interrupt_free_min (2 pages) + * | - Minimum for VM_ALLOC_SYSTEM page allocations. + * --- + * + *-- + * Free page count regulation: + * + * The page daemon attempts to ensure that the free page count is above the free + * target. It wakes up periodically (every 100ms) to input the current free + * page shortage (free_target - free_count) to a PID controller, which in + * response outputs the number of pages to attempt to reclaim. The shortage's + * current magnitude, rate of change, and cumulative value are together used to + * determine the controller's output. The page daemon target thus adapts + * dynamically to the system's demand for free pages, resulting in less + * burstiness than a simple hysteresis loop. + * + * When the free page count drops below the wakeup threshold, + * vm_domain_allocate() proactively wakes up the page daemon. This helps ensure + * that the system responds promptly to a large instantaneous free page + * shortage. + * + * The page daemon also attempts to ensure that some fraction of the system's + * memory is present in the inactive (I) and laundry (L) page queues, so that it + * can respond promptly to a sudden free page shortage. In particular, the page + * daemon thread aggressively scans active pages so long as the following + * condition holds: + * + * len(I) + len(L) + free_target - free_count < inactive_target + * + * Otherwise, when the inactive target is met, the page daemon periodically + * scans a small portion of the active queue in order to maintain up-to-date + * per-page access history. Unreferenced pages in the active queue thus + * eventually migrate to the inactive queue. + * + * The per-domain laundry thread periodically launders dirty pages based on the + * number of clean pages freed by the page daemon since the last laundering. If + * the page daemon fails to meet its scan target (i.e., the PID controller + * output) because of a shortage of clean inactive pages, the laundry thread + * attempts to launder enough pages to meet the free page target. + * + *-- + * Page allocation priorities: + * + * The system defines three page allocation priorities: VM_ALLOC_NORMAL, + * VM_ALLOC_SYSTEM and VM_ALLOC_INTERRUPT. An interrupt-priority allocation can + * claim any free page. This priority is used in the pmap layer when attempting + * to allocate a page for the kernel page tables; in such cases an allocation + * failure will usually result in a kernel panic. The system priority is used + * for most other kernel memory allocations, for instance by UMA's slab + * allocator or the buffer cache. Such allocations will fail if the free count + * is below interrupt_free_min. All other allocations occur at the normal + * priority, which is typically used for allocation of user pages, for instance + * in the page fault handler or when allocating page table pages or pv_entry + * structures for user pmaps. Such allocations fail if the free count is below + * the free_reserved threshold. + * + *-- + * Free memory shortages: + * + * The system uses the free_min and free_severe thresholds to apply + * back-pressure and give the page daemon a chance to recover. When a page + * allocation fails due to a shortage and the allocating thread cannot handle + * failure, it may call vm_wait() to sleep until free pages are available. + * vm_domain_freecnt_inc() wakes sleeping threads once the free page count rises + * above the free_min threshold; the page daemon and laundry threads are given + * priority and will wake up once free_count reaches the (much smaller) + * pageout_free_min threshold. + * + * On NUMA systems, the domainset iterators always prefer NUMA domains where the + * free page count is above the free_min threshold. This means that given the + * choice between two NUMA domains, one above the free_min threshold and one + * below, the former will be used to satisfy the allocation request regardless + * of the domain selection policy. + * + * In addition to reclaiming memory from the page queues, the vm_lowmem event + * fires every ten seconds so long as the system is under memory pressure (i.e., + * vmd_free_count < vmd_free_target). This allows kernel subsystems to register + * for notifications of free page shortages, upon which they may shrink their + * caches. Following a vm_lowmem event, UMA's caches are pruned to ensure that + * they do not contain an excess of unused memory. When a domain is below the + * free_min threshold, UMA limits the population of per-CPU caches. When a + * domain falls below the free_severe threshold, UMA's caches are completely + * drained. + * + * If the system encounters a global memory shortage, it may resort to the + * out-of-memory (OOM) killer, which selects a process and delivers SIGKILL in a + * last-ditch attempt to free up some pages. Either of the two following + * conditions will activate the OOM killer: + * + * 1. The page daemons collectively fail to reclaim any pages during their + * inactive queue scans. After vm_pageout_oom_seq consecutive scans fail, + * the page daemon thread votes for an OOM kill, and an OOM kill is + * triggered when all page daemons have voted. This heuristic is strict and + * may fail to trigger even when the system is effectively deadlocked. + * + * 2. Threads in the user fault handler are repeatedly unable to make progress + * while allocating a page to satisfy the fault. After + * vm_pfault_oom_attempts page allocation failures with intervening + * vm_wait() calls, the faulting thread will trigger an OOM kill. + */ struct vm_domain { struct vm_pagequeue vmd_pagequeues[PQ_COUNT]; struct mtx_padalign vmd_free_mtx; From owner-svn-src-all@freebsd.org Fri Nov 22 16:53:32 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 6D74B1BC0EE; Fri, 22 Nov 2019 16:53:32 +0000 (UTC) (envelope-from rpokala@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47KMvJ2G75z3yys; Fri, 22 Nov 2019 16:53:32 +0000 (UTC) (envelope-from rpokala@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 309AB2693D; Fri, 22 Nov 2019 16:53:32 +0000 (UTC) (envelope-from rpokala@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xAMGrV1x096405; Fri, 22 Nov 2019 16:53:31 GMT (envelope-from rpokala@FreeBSD.org) Received: (from rpokala@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xAMGrVHt096401; Fri, 22 Nov 2019 16:53:31 GMT (envelope-from rpokala@FreeBSD.org) Message-Id: <201911221653.xAMGrVHt096401@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: rpokala set sender to rpokala@FreeBSD.org using -f From: Ravi Pokala Date: Fri, 22 Nov 2019 16:53:31 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r355006 - in head/usr.sbin: rpc.lockd rpc.statd X-SVN-Group: head X-SVN-Commit-Author: rpokala X-SVN-Commit-Paths: in head/usr.sbin: rpc.lockd rpc.statd X-SVN-Commit-Revision: 355006 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 22 Nov 2019 16:53:32 -0000 Author: rpokala Date: Fri Nov 22 16:53:30 2019 New Revision: 355006 URL: https://svnweb.freebsd.org/changeset/base/355006 Log: Add and document options to allow rpc.lockd and rpc.statd to run in the foreground. This allows a separate process to monitor when and how those programs exit. That process can then restart them if needed. Submitted by: Alex Burlyga Reviewed by: bcr, imp MFC after: 1 week Sponsored by: Panasas Differential Revision: https://reviews.freebsd.org/D22474 Modified: head/usr.sbin/rpc.lockd/lockd.c head/usr.sbin/rpc.lockd/rpc.lockd.8 head/usr.sbin/rpc.statd/rpc.statd.8 head/usr.sbin/rpc.statd/statd.c Modified: head/usr.sbin/rpc.lockd/lockd.c ============================================================================== --- head/usr.sbin/rpc.lockd/lockd.c Fri Nov 22 16:31:43 2019 (r355005) +++ head/usr.sbin/rpc.lockd/lockd.c Fri Nov 22 16:53:30 2019 (r355006) @@ -120,6 +120,7 @@ main(int argc, char **argv) char *endptr, **hosts_bak; struct sigaction sigalarm; int grace_period = 30; + int foreground = 0; struct netconfig *nconf; int have_v6 = 1; int maxrec = RPC_MAXDATASIZE; @@ -127,7 +128,7 @@ main(int argc, char **argv) int attempt_cnt, port_len, port_pos, ret; char **port_list; - while ((ch = getopt(argc, argv, "d:g:h:p:")) != (-1)) { + while ((ch = getopt(argc, argv, "d:Fg:h:p:")) != (-1)) { switch (ch) { case 'd': debug_level = atoi(optarg); @@ -136,6 +137,9 @@ main(int argc, char **argv) /* NOTREACHED */ } break; + case 'F': + foreground = 1; + break; case 'g': grace_period = atoi(optarg); if (!grace_period) { @@ -422,7 +426,7 @@ main(int argc, char **argv) * Note that it is NOT sensible to run this program from inetd - the * protocol assumes that it will run immediately at boot time. */ - if (daemon(0, debug_level > 0)) { + if ((foreground == 0) && daemon(0, debug_level > 0)) { err(1, "cannot fork"); /* NOTREACHED */ } @@ -844,7 +848,7 @@ void usage() { errx(1, "usage: rpc.lockd [-d ]" - " [-g ] [-h ] [-p ]"); + " [-F] [-g ] [-h ] [-p ]"); } /* Modified: head/usr.sbin/rpc.lockd/rpc.lockd.8 ============================================================================== --- head/usr.sbin/rpc.lockd/rpc.lockd.8 Fri Nov 22 16:31:43 2019 (r355005) +++ head/usr.sbin/rpc.lockd/rpc.lockd.8 Fri Nov 22 16:53:30 2019 (r355006) @@ -29,7 +29,7 @@ .\" .\" $FreeBSD$ .\" -.Dd November 2, 2007 +.Dd November 21, 2019 .Dt RPC.LOCKD 8 .Os .Sh NAME @@ -38,6 +38,7 @@ .Sh SYNOPSIS .Nm .Op Fl d Ar debug_level +.Op Fl F .Op Fl g Ar grace period .Op Fl h Ar bindip .Op Fl p Ar port @@ -70,6 +71,17 @@ in the generation of one log line per protocol operati Higher debug levels can be specified, causing display of operation arguments and internal operations of the daemon. +.It Fl F +Run +.Nm +in the foreground, rather than going into daemon mode. +This is useful if some other process uses +.Xr fork 2 +and +.Xr exec 3 +to run +.Nm , +and wants to monitor when and how it exits. .It Fl g The .Fl g Modified: head/usr.sbin/rpc.statd/rpc.statd.8 ============================================================================== --- head/usr.sbin/rpc.statd/rpc.statd.8 Fri Nov 22 16:31:43 2019 (r355005) +++ head/usr.sbin/rpc.statd/rpc.statd.8 Fri Nov 22 16:53:30 2019 (r355006) @@ -29,7 +29,7 @@ .\" .\" $FreeBSD$ .\" -.Dd November 1, 2007 +.Dd November 21, 2019 .Dt RPC.STATD 8 .Os .Sh NAME @@ -38,6 +38,7 @@ .Sh SYNOPSIS .Nm .Op Fl d +.Op Fl F .Op Fl h Ar bindip .Op Fl p Ar port .Sh DESCRIPTION @@ -71,6 +72,17 @@ These messages are logged with level LOG_DEBUG and facility LOG_DAEMON. Error conditions are logged irrespective of this option, using level LOG_ERR. +.It Fl F +Run +.Nm +in the foreground, rather than going into daemon mode. +This is useful if some other process uses +.Xr fork 2 +and +.Xr exec 3 +to run +.Nm , +and wants to monitor when and how it exits. .It Fl h Ar bindip Specify specific IP addresses to bind to. This option may be specified multiple times. Modified: head/usr.sbin/rpc.statd/statd.c ============================================================================== --- head/usr.sbin/rpc.statd/statd.c Fri Nov 22 16:31:43 2019 (r355005) +++ head/usr.sbin/rpc.statd/statd.c Fri Nov 22 16:53:30 2019 (r355006) @@ -89,15 +89,19 @@ main(int argc, char **argv) char *endptr; char **hosts_bak; int have_v6 = 1; + int foreground = 0; int maxrec = RPC_MAXDATASIZE; int attempt_cnt, port_len, port_pos, ret; char **port_list; - while ((ch = getopt(argc, argv, "dh:p:")) != -1) + while ((ch = getopt(argc, argv, "dFh:p:")) != -1) switch (ch) { case 'd': debug = 1; break; + case 'F': + foreground = 1; + break; case 'h': ++nhosts; hosts_bak = hosts; @@ -288,7 +292,11 @@ main(int argc, char **argv) /* Note that it is NOT sensible to run this program from inetd - the */ /* protocol assumes that it will run immediately at boot time. */ - daemon(0, 0); + if ((foreground == 0) && daemon(0, 0) < 0) { + err(1, "cannot fork"); + /* NOTREACHED */ + } + openlog("rpc.statd", 0, LOG_DAEMON); if (debug) syslog(LOG_INFO, "Starting - debug enabled"); else syslog(LOG_INFO, "Starting"); @@ -618,7 +626,7 @@ clearout_service(void) static void usage(void) { - fprintf(stderr, "usage: rpc.statd [-d] [-h ] [-p ]\n"); + fprintf(stderr, "usage: rpc.statd [-d] [-F] [-h ] [-p ]\n"); exit(1); } From owner-svn-src-all@freebsd.org Fri Nov 22 17:06:33 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 4D0721BC596; Fri, 22 Nov 2019 17:06:33 +0000 (UTC) (envelope-from jgh@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47KNBK1H6Qz40k6; Fri, 22 Nov 2019 17:06:33 +0000 (UTC) (envelope-from jgh@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 0AAB726B11; Fri, 22 Nov 2019 17:06:33 +0000 (UTC) (envelope-from jgh@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xAMH6WrY002755; Fri, 22 Nov 2019 17:06:32 GMT (envelope-from jgh@FreeBSD.org) Received: (from jgh@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xAMH6WsE002754; Fri, 22 Nov 2019 17:06:32 GMT (envelope-from jgh@FreeBSD.org) Message-Id: <201911221706.xAMH6WsE002754@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jgh set sender to jgh@FreeBSD.org using -f From: Jason Helfman Date: Fri, 22 Nov 2019 17:06:32 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r355007 - stable/12/share/man/man5 X-SVN-Group: stable-12 X-SVN-Commit-Author: jgh X-SVN-Commit-Paths: stable/12/share/man/man5 X-SVN-Commit-Revision: 355007 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 22 Nov 2019 17:06:33 -0000 Author: jgh (doc,ports committer) Date: Fri Nov 22 17:06:32 2019 New Revision: 355007 URL: https://svnweb.freebsd.org/changeset/base/355007 Log: MFH: r351820 - correct HISTORY section - while here clarify wording PR: 240260 (based on) Submitted by: gbergling@gmail.com Modified: stable/12/share/man/man5/passwd.5 Directory Properties: stable/12/ (props changed) Modified: stable/12/share/man/man5/passwd.5 ============================================================================== --- stable/12/share/man/man5/passwd.5 Fri Nov 22 16:53:30 2019 (r355006) +++ stable/12/share/man/man5/passwd.5 Fri Nov 22 17:06:32 2019 (r355007) @@ -438,8 +438,8 @@ BEGIN { FS = ":"} .Sh HISTORY A .Nm -file format appeared in -.At v6 . +file format first appeared in +.At v1 . .Pp The .Tn NIS From owner-svn-src-all@freebsd.org Fri Nov 22 17:13:03 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 9C9C31BC905; Fri, 22 Nov 2019 17:13:03 +0000 (UTC) (envelope-from jgh@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47KNKq3czXz41Dt; Fri, 22 Nov 2019 17:13:03 +0000 (UTC) (envelope-from jgh@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 5F6F026CF5; Fri, 22 Nov 2019 17:13:03 +0000 (UTC) (envelope-from jgh@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xAMHD3x1008632; Fri, 22 Nov 2019 17:13:03 GMT (envelope-from jgh@FreeBSD.org) Received: (from jgh@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xAMHD3Lh008631; Fri, 22 Nov 2019 17:13:03 GMT (envelope-from jgh@FreeBSD.org) Message-Id: <201911221713.xAMHD3Lh008631@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jgh set sender to jgh@FreeBSD.org using -f From: Jason Helfman Date: Fri, 22 Nov 2019 17:13:03 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r355008 - stable/11/share/man/man5 X-SVN-Group: stable-11 X-SVN-Commit-Author: jgh X-SVN-Commit-Paths: stable/11/share/man/man5 X-SVN-Commit-Revision: 355008 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 22 Nov 2019 17:13:03 -0000 Author: jgh (doc,ports committer) Date: Fri Nov 22 17:13:02 2019 New Revision: 355008 URL: https://svnweb.freebsd.org/changeset/base/355008 Log: MFH: r351820 - correct HISTORY section - while here clarify wording PR: 240260 (based on) http://www.FreeBSD.org/cgi/query-pr.cgi?pr=240260 Submitted by: gbergling@gmail.com Modified: stable/11/share/man/man5/passwd.5 Directory Properties: stable/11/ (props changed) Modified: stable/11/share/man/man5/passwd.5 ============================================================================== --- stable/11/share/man/man5/passwd.5 Fri Nov 22 17:06:32 2019 (r355007) +++ stable/11/share/man/man5/passwd.5 Fri Nov 22 17:13:02 2019 (r355008) @@ -438,8 +438,8 @@ BEGIN { FS = ":"} .Sh HISTORY A .Nm -file format appeared in -.At v6 . +file format first appeared in +.At v1 . .Pp The .Tn NIS From owner-svn-src-all@freebsd.org Fri Nov 22 18:18:37 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 4844F1BD9E4; Fri, 22 Nov 2019 18:18:37 +0000 (UTC) (envelope-from scottl@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47KPnT17D8z43qL; Fri, 22 Nov 2019 18:18:37 +0000 (UTC) (envelope-from scottl@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 05F9F27789; Fri, 22 Nov 2019 18:18:37 +0000 (UTC) (envelope-from scottl@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xAMIIaVY044330; Fri, 22 Nov 2019 18:18:36 GMT (envelope-from scottl@FreeBSD.org) Received: (from scottl@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xAMIIaBq044329; Fri, 22 Nov 2019 18:18:36 GMT (envelope-from scottl@FreeBSD.org) Message-Id: <201911221818.xAMIIaBq044329@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: scottl set sender to scottl@FreeBSD.org using -f From: Scott Long Date: Fri, 22 Nov 2019 18:18:36 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r355009 - head/sys/cam/scsi X-SVN-Group: head X-SVN-Commit-Author: scottl X-SVN-Commit-Paths: head/sys/cam/scsi X-SVN-Commit-Revision: 355009 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 22 Nov 2019 18:18:37 -0000 Author: scottl Date: Fri Nov 22 18:18:36 2019 New Revision: 355009 URL: https://svnweb.freebsd.org/changeset/base/355009 Log: Remove NEEDGIANT from the scsi_sg /dev node. It likely has not been needed for many years. Reported by: imp Modified: head/sys/cam/scsi/scsi_sg.c Modified: head/sys/cam/scsi/scsi_sg.c ============================================================================== --- head/sys/cam/scsi/scsi_sg.c Fri Nov 22 17:13:02 2019 (r355008) +++ head/sys/cam/scsi/scsi_sg.c Fri Nov 22 18:18:36 2019 (r355009) @@ -142,7 +142,7 @@ PERIPHDRIVER_DECLARE(sg, sgdriver); static struct cdevsw sg_cdevsw = { .d_version = D_VERSION, - .d_flags = D_NEEDGIANT | D_TRACKCLOSE, + .d_flags = D_TRACKCLOSE, .d_open = sgopen, .d_close = sgclose, .d_ioctl = sgioctl, From owner-svn-src-all@freebsd.org Fri Nov 22 18:39:52 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 779A61BDFE0; Fri, 22 Nov 2019 18:39:52 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47KQG02Ttcz44qh; Fri, 22 Nov 2019 18:39:52 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 389E027B13; Fri, 22 Nov 2019 18:39:52 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xAMIdqNS056575; Fri, 22 Nov 2019 18:39:52 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xAMIdpMa056572; Fri, 22 Nov 2019 18:39:51 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201911221839.xAMIdpMa056572@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Fri, 22 Nov 2019 18:39:51 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r355010 - in head/sys/cam: . scsi X-SVN-Group: head X-SVN-Commit-Author: mav X-SVN-Commit-Paths: in head/sys/cam: . scsi X-SVN-Commit-Revision: 355010 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 22 Nov 2019 18:39:52 -0000 Author: mav Date: Fri Nov 22 18:39:51 2019 New Revision: 355010 URL: https://svnweb.freebsd.org/changeset/base/355010 Log: Make CAM use root_mount_hold_token() to delay boot. Before this change CAM used config_intrhook_establish() for this purpose, but that approach does not allow to delay it again after releasing once. USB stack uses root_mount_hold() to delay boot until bus scan is complete. But once it is, CAM had no time to scan SCSI bus, registered by umass(4), if it already done other scans and called config_intrhook_disestablish(). The new approach makes it work smooth, assuming the USB device is found during the initial bus scan. Devices appearing on USB bus later may still require setting kern.cam.boot_delay, but hopefully those are minority. MFC after: 2 weeks Sponsored by: iXsystems, Inc. Modified: head/sys/cam/cam_xpt.c head/sys/cam/scsi/scsi_enc.c head/sys/cam/scsi/scsi_enc_internal.h Modified: head/sys/cam/cam_xpt.c ============================================================================== --- head/sys/cam/cam_xpt.c Fri Nov 22 18:18:36 2019 (r355009) +++ head/sys/cam/cam_xpt.c Fri Nov 22 18:39:51 2019 (r355010) @@ -99,13 +99,6 @@ MALLOC_DEFINE(M_CAMDEV, "CAM DEV", "CAM devices"); MALLOC_DEFINE(M_CAMCCB, "CAM CCB", "CAM CCBs"); MALLOC_DEFINE(M_CAMPATH, "CAM path", "CAM paths"); -/* Object for defering XPT actions to a taskqueue */ -struct xpt_task { - struct task task; - void *data1; - uintptr_t data2; -}; - struct xpt_softc { uint32_t xpt_generation; @@ -129,10 +122,10 @@ struct xpt_softc { TAILQ_HEAD(,cam_eb) xpt_busses; u_int bus_generation; - struct intr_config_hook xpt_config_hook; - int boot_delay; struct callout boot_callout; + struct task boot_task; + struct root_hold_token xpt_rootmount; struct mtx xpt_topo_lock; struct mtx xpt_lock; @@ -273,6 +266,7 @@ static struct cam_et* static struct cam_ed* xpt_find_device(struct cam_et *target, lun_id_t lun_id); static void xpt_config(void *arg); +static void xpt_hold_boot_locked(void); static int xpt_schedule_dev(struct camq *queue, cam_pinfo *dev_pinfo, u_int32_t new_priority); static xpt_devicefunc_t xptpassannouncefunc; @@ -881,7 +875,7 @@ xpt_rescan(union ccb *ccb) } } TAILQ_INSERT_TAIL(&xsoftc.ccb_scanq, &ccb->ccb_h, sim_links.tqe); - xsoftc.buses_to_config++; + xpt_hold_boot_locked(); wakeup(&xsoftc.ccb_scanq); xpt_unlock_buses(); } @@ -913,6 +907,7 @@ xpt_init(void *dummy) */ xsoftc.boot_delay = CAM_BOOT_DELAY; #endif + /* * The xpt layer is, itself, the equivalent of a SIM. * Allow 16 ccbs in the ccb pool for it. This should @@ -979,14 +974,11 @@ xpt_init(void *dummy) "- failing attach\n"); return (ENOMEM); } + /* * Register a callback for when interrupts are enabled. */ - xsoftc.xpt_config_hook.ich_func = xpt_config; - if (config_intrhook_establish(&xsoftc.xpt_config_hook) != 0) { - printf("xpt_init: config_intrhook_establish failed " - "- failing attach\n"); - } + config_intrhook_oneshot(xpt_config, NULL); return (0); } @@ -5148,6 +5140,10 @@ xpt_stop_tags(struct cam_path *path) xpt_action((union ccb *)&crs); } +/* + * Assume all possible buses are detected by this time, so allow boot + * as soon as they all are scanned. + */ static void xpt_boot_delay(void *arg) { @@ -5155,12 +5151,26 @@ xpt_boot_delay(void *arg) xpt_release_boot(); } +/* + * Now that all config hooks have completed, start boot_delay timer, + * waiting for possibly still undetected buses (USB) to appear. + */ static void +xpt_ch_done(void *arg) +{ + + callout_init(&xsoftc.boot_callout, 1); + callout_reset_sbt(&xsoftc.boot_callout, SBT_1MS * xsoftc.boot_delay, 0, + xpt_boot_delay, NULL, 0); +} +SYSINIT(xpt_hw_delay, SI_SUB_INT_CONFIG_HOOKS, SI_ORDER_ANY, xpt_ch_done, NULL); + +/* + * Now that interrupts are enabled, go find our devices + */ +static void xpt_config(void *arg) { - /* - * Now that interrupts are enabled, go find our devices - */ if (taskqueue_start_threads(&xsoftc.xpt_taskq, 1, PRIBIO, "CAM taskq")) printf("xpt_config: failed to create taskqueue thread.\n"); @@ -5179,9 +5189,7 @@ xpt_config(void *arg) periphdriver_init(1); xpt_hold_boot(); - callout_init(&xsoftc.boot_callout, 1); - callout_reset_sbt(&xsoftc.boot_callout, SBT_1MS * xsoftc.boot_delay, 0, - xpt_boot_delay, NULL, 0); + /* Fire up rescan thread. */ if (kproc_kthread_add(xpt_scanner_thread, NULL, &cam_proc, NULL, 0, 0, "cam", "scanner")) { @@ -5190,31 +5198,38 @@ xpt_config(void *arg) } void +xpt_hold_boot_locked(void) +{ + + if (xsoftc.buses_to_config++ == 0) + root_mount_hold_token("CAM", &xsoftc.xpt_rootmount); +} + +void xpt_hold_boot(void) { + xpt_lock_buses(); - xsoftc.buses_to_config++; + xpt_hold_boot_locked(); xpt_unlock_buses(); } void xpt_release_boot(void) { - xpt_lock_buses(); - xsoftc.buses_to_config--; - if (xsoftc.buses_to_config == 0 && xsoftc.buses_config_done == 0) { - struct xpt_task *task; - xsoftc.buses_config_done = 1; - xpt_unlock_buses(); - /* Call manually because we don't have any buses */ - task = malloc(sizeof(struct xpt_task), M_CAMXPT, M_NOWAIT); - if (task != NULL) { - TASK_INIT(&task->task, 0, xpt_finishconfig_task, task); - taskqueue_enqueue(taskqueue_thread, &task->task); - } - } else - xpt_unlock_buses(); + xpt_lock_buses(); + if (--xsoftc.buses_to_config == 0) { + if (xsoftc.buses_config_done == 0) { + xsoftc.buses_config_done = 1; + xsoftc.buses_to_config++; + TASK_INIT(&xsoftc.boot_task, 0, xpt_finishconfig_task, + NULL); + taskqueue_enqueue(taskqueue_thread, &xsoftc.boot_task); + } else + root_mount_rel(&xsoftc.xpt_rootmount); + } + xpt_unlock_buses(); } /* @@ -5252,10 +5267,7 @@ xpt_finishconfig_task(void *context, int pending) if (!bootverbose) xpt_for_all_devices(xptpassannouncefunc, NULL); - /* Release our hook so that the boot can continue. */ - config_intrhook_disestablish(&xsoftc.xpt_config_hook); - - free(context, M_CAMXPT); + xpt_release_boot(); } cam_status Modified: head/sys/cam/scsi/scsi_enc.c ============================================================================== --- head/sys/cam/scsi/scsi_enc.c Fri Nov 22 18:18:36 2019 (r355009) +++ head/sys/cam/scsi/scsi_enc.c Fri Nov 22 18:39:51 2019 (r355010) @@ -205,10 +205,7 @@ enc_dtor(struct cam_periph *periph) if (enc->enc_vec.softc_cleanup != NULL) enc->enc_vec.softc_cleanup(enc); - if (enc->enc_boot_hold_ch.ich_func != NULL) { - config_intrhook_disestablish(&enc->enc_boot_hold_ch); - enc->enc_boot_hold_ch.ich_func = NULL; - } + root_mount_rel(&enc->enc_rootmount); ENC_FREE(enc); } @@ -835,7 +832,6 @@ enc_daemon(void *arg) cam_periph_lock(enc->periph); while ((enc->enc_flags & ENC_FLAG_SHUTDOWN) == 0) { if (enc->pending_actions == 0) { - struct intr_config_hook *hook; /* * Reset callout and msleep, or @@ -848,11 +844,7 @@ enc_daemon(void *arg) * We've been through our state machine at least * once. Allow the transition to userland. */ - hook = &enc->enc_boot_hold_ch; - if (hook->ich_func != NULL) { - config_intrhook_disestablish(hook); - hook->ich_func = NULL; - } + root_mount_rel(&enc->enc_rootmount); callout_reset(&enc->status_updater, 60*hz, enc_status_updater, enc); @@ -891,22 +883,6 @@ enc_kproc_init(enc_softc_t *enc) cam_periph_release(enc->periph); return (result); } - -/** - * \brief Interrupt configuration hook callback associated with - * enc_boot_hold_ch. - * - * Since interrupts are always functional at the time of enclosure - * configuration, there is nothing to be done when the callback occurs. - * This hook is only registered to hold up boot processing while initial - * eclosure processing occurs. - * - * \param arg The enclosure softc, but currently unused in this callback. - */ -static void -enc_nop_confighook_cb(void *arg __unused) -{ -} static cam_status enc_ctor(struct cam_periph *periph, void *arg) @@ -964,9 +940,7 @@ enc_ctor(struct cam_periph *periph, void *arg) * present. */ if (enc->enc_vec.poll_status != NULL) { - enc->enc_boot_hold_ch.ich_func = enc_nop_confighook_cb; - enc->enc_boot_hold_ch.ich_arg = enc; - config_intrhook_establish(&enc->enc_boot_hold_ch); + root_mount_hold_token(periph->periph_name, &enc->enc_rootmount); } /* Modified: head/sys/cam/scsi/scsi_enc_internal.h ============================================================================== --- head/sys/cam/scsi/scsi_enc_internal.h Fri Nov 22 18:18:36 2019 (r355009) +++ head/sys/cam/scsi/scsi_enc_internal.h Fri Nov 22 18:39:51 2019 (r355010) @@ -163,7 +163,7 @@ struct enc_softc { struct enc_fsm_state *enc_fsm_states; - struct intr_config_hook enc_boot_hold_ch; + struct root_hold_token enc_rootmount; #define ENC_ANNOUNCE_SZ 400 char announce_buf[ENC_ANNOUNCE_SZ]; From owner-svn-src-all@freebsd.org Fri Nov 22 18:41:10 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 5B0CB1BE0D6; Fri, 22 Nov 2019 18:41:10 +0000 (UTC) (envelope-from brooks@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47KQHV1jcmz451D; Fri, 22 Nov 2019 18:41:10 +0000 (UTC) (envelope-from brooks@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 1F0F627B57; Fri, 22 Nov 2019 18:41:10 +0000 (UTC) (envelope-from brooks@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xAMIfAsE061201; Fri, 22 Nov 2019 18:41:10 GMT (envelope-from brooks@FreeBSD.org) Received: (from brooks@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xAMIf9fZ061200; Fri, 22 Nov 2019 18:41:09 GMT (envelope-from brooks@FreeBSD.org) Message-Id: <201911221841.xAMIf9fZ061200@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: brooks set sender to brooks@FreeBSD.org using -f From: Brooks Davis Date: Fri, 22 Nov 2019 18:41:09 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r355011 - in head: . share/mk X-SVN-Group: head X-SVN-Commit-Author: brooks X-SVN-Commit-Paths: in head: . share/mk X-SVN-Commit-Revision: 355011 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 22 Nov 2019 18:41:10 -0000 Author: brooks Date: Fri Nov 22 18:41:09 2019 New Revision: 355011 URL: https://svnweb.freebsd.org/changeset/base/355011 Log: Revert r354909: Make the warning for deprecated NO_ variables an error. An unexpectidly large number of ports define NO_MAN (and sometimes the long-dead NOMAN). I'll fix ports and then re-commit. Modified: head/UPDATING head/share/mk/bsd.opts.mk Modified: head/UPDATING ============================================================================== --- head/UPDATING Fri Nov 22 18:39:51 2019 (r355010) +++ head/UPDATING Fri Nov 22 18:41:09 2019 (r355011) @@ -31,14 +31,6 @@ NOTE TO PEOPLE WHO THINK THAT FreeBSD 13.x IS SLOW: removed in the future. As of FreeBSD 10.1 the autofs(5) is available for automounting. -20191120: - Defining the long deprecated NO_CTF, NO_DEBUG_FILES, NO_INSTALLLIB, - NO_MAN, NO_PROFILE, and NO_WARNS variables is now an error. Update - your Makefiles and scripts to define MK_=no instead as required. - - One exception to this is that program or library Makefiles should - define MAN to empty rather than setting MK_MAN=no. - 20191107: The nctgpio and wbwd drivers have been moved to the superio bus. If you have one of these drivers in a kernel configuration, then Modified: head/share/mk/bsd.opts.mk ============================================================================== --- head/share/mk/bsd.opts.mk Fri Nov 22 18:39:51 2019 (r355010) +++ head/share/mk/bsd.opts.mk Fri Nov 22 18:41:09 2019 (r355011) @@ -100,7 +100,7 @@ __DEFAULT_DEPENDENT_OPTIONS = \ PROFILE \ WARNS .if defined(NO_${var}) -.error "NO_${var} is defined, but deprecated. Please use MK_${var}=no instead." +.warning "NO_${var} is defined, but deprecated. Please use MK_${var}=no instead." MK_${var}:=no .endif .endfor From owner-svn-src-all@freebsd.org Fri Nov 22 18:50:54 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id BCC571BE4DF; Fri, 22 Nov 2019 18:50:54 +0000 (UTC) (envelope-from scottl@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47KQVk4cTKz45WL; Fri, 22 Nov 2019 18:50:54 +0000 (UTC) (envelope-from scottl@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 819F827DF1; Fri, 22 Nov 2019 18:50:54 +0000 (UTC) (envelope-from scottl@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xAMIosnI063260; Fri, 22 Nov 2019 18:50:54 GMT (envelope-from scottl@FreeBSD.org) Received: (from scottl@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xAMIospb063258; Fri, 22 Nov 2019 18:50:54 GMT (envelope-from scottl@FreeBSD.org) Message-Id: <201911221850.xAMIospb063258@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: scottl set sender to scottl@FreeBSD.org using -f From: Scott Long Date: Fri, 22 Nov 2019 18:50:54 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r355012 - in head: share/man/man4 sys/dev/trm X-SVN-Group: head X-SVN-Commit-Author: scottl X-SVN-Commit-Paths: in head: share/man/man4 sys/dev/trm X-SVN-Commit-Revision: 355012 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 22 Nov 2019 18:50:54 -0000 Author: scottl Date: Fri Nov 22 18:50:53 2019 New Revision: 355012 URL: https://svnweb.freebsd.org/changeset/base/355012 Log: Schedule the trm(4) driver for removal. It relies on Giant and thus has required compat shims in CAM for 12 years. Relnotes: yes Modified: head/share/man/man4/trm.4 head/sys/dev/trm/trm.c Modified: head/share/man/man4/trm.4 ============================================================================== --- head/share/man/man4/trm.4 Fri Nov 22 18:41:09 2019 (r355011) +++ head/share/man/man4/trm.4 Fri Nov 22 18:50:53 2019 (r355012) @@ -48,6 +48,9 @@ module at boot time, place the following line in .Bd -literal -offset indent trm_load="YES" .Ed +.Sh DEPRECATION NOTICE +This driver is scheduled for removal prior to the release of +.Fx 13.0 .Sh DESCRIPTION The .Nm Modified: head/sys/dev/trm/trm.c ============================================================================== --- head/sys/dev/trm/trm.c Fri Nov 22 18:41:09 2019 (r355011) +++ head/sys/dev/trm/trm.c Fri Nov 22 18:50:53 2019 (r355012) @@ -3376,7 +3376,9 @@ trm_attach(device_t dev) PACB pACB = 0; int rid = 0; int unit = device_get_unit(dev); - + + gone_in(13, "Giant locked CAM drivers"); + device_id = pci_get_devid(dev); /* * These cards do not allow memory mapped accesses From owner-svn-src-all@freebsd.org Fri Nov 22 18:55:28 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 775471BE595; Fri, 22 Nov 2019 18:55:28 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47KQc02X66z45sx; Fri, 22 Nov 2019 18:55:28 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 35D7827E7E; Fri, 22 Nov 2019 18:55:28 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xAMItSnB068459; Fri, 22 Nov 2019 18:55:28 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xAMItSBq068458; Fri, 22 Nov 2019 18:55:28 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201911221855.xAMItSBq068458@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Fri, 22 Nov 2019 18:55:28 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r355013 - head/sys/cam X-SVN-Group: head X-SVN-Commit-Author: mav X-SVN-Commit-Paths: head/sys/cam X-SVN-Commit-Revision: 355013 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 22 Nov 2019 18:55:28 -0000 Author: mav Date: Fri Nov 22 18:55:27 2019 New Revision: 355013 URL: https://svnweb.freebsd.org/changeset/base/355013 Log: Remove xpt_lock mutex. CAM does not require SIM locks for years, and obviously does not require it for completely virtual XPT SIM. MFC after: 2 weeks Modified: head/sys/cam/cam_xpt.c Modified: head/sys/cam/cam_xpt.c ============================================================================== --- head/sys/cam/cam_xpt.c Fri Nov 22 18:50:53 2019 (r355012) +++ head/sys/cam/cam_xpt.c Fri Nov 22 18:55:27 2019 (r355013) @@ -128,7 +128,6 @@ struct xpt_softc { struct root_hold_token xpt_rootmount; struct mtx xpt_topo_lock; - struct mtx xpt_lock; struct taskqueue *xpt_taskq; }; @@ -895,7 +894,6 @@ xpt_init(void *dummy) STAILQ_INIT(&xsoftc.highpowerq); xsoftc.num_highpower = CAM_MAX_HIGHPOWER; - mtx_init(&xsoftc.xpt_lock, "XPT lock", NULL, MTX_DEF); mtx_init(&xsoftc.xpt_highpower_lock, "XPT highpower lock", NULL, MTX_DEF); xsoftc.xpt_taskq = taskqueue_create("CAM XPT task", M_WAITOK, taskqueue_thread_enqueue, /*context*/&xsoftc.xpt_taskq); @@ -920,21 +918,18 @@ xpt_init(void *dummy) "xpt", /*softc*/NULL, /*unit*/0, - /*mtx*/&xsoftc.xpt_lock, + /*mtx*/NULL, /*max_dev_transactions*/0, /*max_tagged_dev_transactions*/0, devq); if (xpt_sim == NULL) return (ENOMEM); - mtx_lock(&xsoftc.xpt_lock); if ((status = xpt_bus_register(xpt_sim, NULL, 0)) != CAM_SUCCESS) { - mtx_unlock(&xsoftc.xpt_lock); printf("xpt_init: xpt_bus_register failed with status %#x," " failing attach\n", status); return (EINVAL); } - mtx_unlock(&xsoftc.xpt_lock); /* * Looking at the XPT from the SIM layer, the XPT is From owner-svn-src-all@freebsd.org Fri Nov 22 19:00:41 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id F23251BE6DF for ; Fri, 22 Nov 2019 19:00:41 +0000 (UTC) (envelope-from ian@freebsd.org) Received: from outbound3d.ore.mailhop.org (outbound3d.ore.mailhop.org [54.186.57.195]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 47KQk148jTz46Km for ; Fri, 22 Nov 2019 19:00:41 +0000 (UTC) (envelope-from ian@freebsd.org) ARC-Seal: i=1; a=rsa-sha256; t=1574449240; cv=none; d=outbound.mailhop.org; s=arc-outbound20181012; b=ize+fQyPrNSC1NkrBUyGOIPX+dXD7R1JWSSr6ssNp1c0bdGW9Ij+rgZaRk3sMiMofyF0r6AGW7X7t TXMJqFNVJgF4GOMDuiXpEIsse1+bhrtpkfCQ9vEGm/SU0s5goHkdJGgOrfQm9qTUjifjBkq2arZK6I zatEOY+VC4g3YJgRb2i6DZ7EPnZKqYk6dHjjcSXd8HceuEybpkO3L8uz2WRJwAYgat5eHSKrGhdLlX Dr+57wLVdmfTiu6gMmINUqEn2QyxlIaskUrBlV0YnhSpXOiZ0JUvCSCE6iUlDauxdplF6jYAFkoGDR XEXTkUMCjXBj2JYpNcYObEI0KVVciig== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=outbound.mailhop.org; s=arc-outbound20181012; h=content-transfer-encoding:mime-version:content-type:references:in-reply-to: date:to:from:subject:message-id:dkim-signature:from; bh=hfM+tKzQ9J7x6Z3ltRSkcD1a8BCps6cHwIJvCo5WeRI=; b=Ky68vekUZiTcQ36VlPvmA9AoB3E54GVS0SBs/P/ypMryGA/wXgmCuT7UMckkMdwxe+Ac8jIb2e+U5 AilJIfxhmCUMIfECi10Zy5rvS994IESzEx5dBO10XZFUXjOOGKa4Ybmo7hv8UlYcekZRWDus0tYCjc tGou4CMJ6hN93D0ZMkl35baRJRDK/DGR6zY152GNhcAfERKp8cLdGiHDS7wWUG6lw8F8vgs+ixKDl2 AgXm7iAEAfTFG9Wyi5/f/1AEw2YCiV4d+plxKNYoi8MnN5dednT5XROX13P0UU1LJ7XclvXNNBY/RK fOm3NyrTPYSpti1rRFYz8TugJ+TPSNg== ARC-Authentication-Results: i=1; outbound3.ore.mailhop.org; spf=softfail smtp.mailfrom=freebsd.org smtp.remote-ip=67.177.211.60; dmarc=none header.from=freebsd.org; arc=none header.oldest-pass=0; DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=outbound.mailhop.org; s=dkim-high; h=content-transfer-encoding:mime-version:content-type:references:in-reply-to: date:to:from:subject:message-id:from; bh=hfM+tKzQ9J7x6Z3ltRSkcD1a8BCps6cHwIJvCo5WeRI=; b=Q6jpaKahO9Wt49vrCI+Z4p2Q08z5LI5ZVR7dFKq0WAvWbfhOMfiKAHbiWofvv4mJf28/Q78pr/eC7 i1O1ZY0TdeUkNhNWGE2UPw2hP/xR5M64lO39FU6oxtzKX38m9Mu4cUAGz8eTi52PXW9tIhPJqJ2ZmK W8/SxojJwwrhbhEXLx3ZL8lYnw7ik2x/r+tSn80EbXhESCiNyANZCkJVrNSntTPhnYMldduSF52h8B PAatXLM+C60qmJzPuVRZm8gytvgTCIFpQHr03Tp0nAQ79JSilFWHkVPScUjDX6CmEp3gnU9wFLudGO 2TjxM81ahxf76ZlDjIMtxCcRhBz2Fsg== X-MHO-RoutePath: aGlwcGll X-MHO-User: 5e7991d1-0d5a-11ea-b80c-052b4a66b6b2 X-Report-Abuse-To: https://support.duocircle.com/support/solutions/articles/5000540958-duocircle-standard-smtp-abuse-information X-Originating-IP: 67.177.211.60 X-Mail-Handler: DuoCircle Outbound SMTP Received: from ilsoft.org (unknown [67.177.211.60]) by outbound3.ore.mailhop.org (Halon) with ESMTPSA id 5e7991d1-0d5a-11ea-b80c-052b4a66b6b2; Fri, 22 Nov 2019 19:00:38 +0000 (UTC) Received: from rev (rev [172.22.42.240]) by ilsoft.org (8.15.2/8.15.2) with ESMTP id xAMJ0arB059099; Fri, 22 Nov 2019 12:00:36 -0700 (MST) (envelope-from ian@freebsd.org) Message-ID: <512688616ef83a24a907a8ba3cee76cb9d53490b.camel@freebsd.org> Subject: Re: svn commit: r355010 - in head/sys/cam: . scsi From: Ian Lepore To: Alexander Motin , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Date: Fri, 22 Nov 2019 12:00:36 -0700 In-Reply-To: <201911221839.xAMIdpMa056572@repo.freebsd.org> References: <201911221839.xAMIdpMa056572@repo.freebsd.org> Content-Type: text/plain; charset="UTF-8" X-Mailer: Evolution 3.28.5 FreeBSD GNOME Team Mime-Version: 1.0 Content-Transfer-Encoding: 7bit X-Rspamd-Queue-Id: 47KQk148jTz46Km X-Spamd-Bar: - Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-1.95 / 15.00]; local_wl_from(0.00)[freebsd.org]; NEURAL_HAM_MEDIUM(-0.98)[-0.980,0]; NEURAL_HAM_LONG(-0.97)[-0.974,0]; ASN(0.00)[asn:16509, ipnet:54.186.0.0/15, country:US] X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 22 Nov 2019 19:00:42 -0000 On Fri, 2019-11-22 at 18:39 +0000, Alexander Motin wrote: > Author: mav > Date: Fri Nov 22 18:39:51 2019 > New Revision: 355010 > URL: https://svnweb.freebsd.org/changeset/base/355010 > > Log: > Make CAM use root_mount_hold_token() to delay boot. > > Before this change CAM used config_intrhook_establish() for this > purpose, > but that approach does not allow to delay it again after releasing > once. > > USB stack uses root_mount_hold() to delay boot until bus scan is > complete. > But once it is, CAM had no time to scan SCSI bus, registered by > umass(4), > if it already done other scans and called > config_intrhook_disestablish(). > The new approach makes it work smooth, assuming the USB device is > found > during the initial bus scan. Devices appearing on USB bus later > may still > require setting kern.cam.boot_delay, but hopefully those are > minority. > > MFC after: 2 weeks > Sponsored by: iXsystems, Inc. > This is probably the fix for this PR? https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=144824 -- Ian > Modified: > head/sys/cam/cam_xpt.c > head/sys/cam/scsi/scsi_enc.c > head/sys/cam/scsi/scsi_enc_internal.h > > Modified: head/sys/cam/cam_xpt.c > ===================================================================== > ========= > --- head/sys/cam/cam_xpt.c Fri Nov 22 18:18:36 2019 (r355009) > +++ head/sys/cam/cam_xpt.c Fri Nov 22 18:39:51 2019 (r355010) > @@ -99,13 +99,6 @@ MALLOC_DEFINE(M_CAMDEV, "CAM DEV", "CAM devices"); > MALLOC_DEFINE(M_CAMCCB, "CAM CCB", "CAM CCBs"); > MALLOC_DEFINE(M_CAMPATH, "CAM path", "CAM paths"); > > -/* Object for defering XPT actions to a taskqueue */ > -struct xpt_task { > - struct task task; > - void *data1; > - uintptr_t data2; > -}; > - > struct xpt_softc { > uint32_t xpt_generation; > > @@ -129,10 +122,10 @@ struct xpt_softc { > TAILQ_HEAD(,cam_eb) xpt_busses; > u_int bus_generation; > > - struct intr_config_hook xpt_config_hook; > - > int boot_delay; > struct callout boot_callout; > + struct task boot_task; > + struct root_hold_token xpt_rootmount; > > struct mtx xpt_topo_lock; > struct mtx xpt_lock; > @@ -273,6 +266,7 @@ static struct cam_et* > static struct cam_ed* > xpt_find_device(struct cam_et *target, lun_id_t > lun_id); > static void xpt_config(void *arg); > +static void xpt_hold_boot_locked(void); > static int xpt_schedule_dev(struct camq *queue, cam_pinfo > *dev_pinfo, > u_int32_t new_priority); > static xpt_devicefunc_t xptpassannouncefunc; > @@ -881,7 +875,7 @@ xpt_rescan(union ccb *ccb) > } > } > TAILQ_INSERT_TAIL(&xsoftc.ccb_scanq, &ccb->ccb_h, > sim_links.tqe); > - xsoftc.buses_to_config++; > + xpt_hold_boot_locked(); > wakeup(&xsoftc.ccb_scanq); > xpt_unlock_buses(); > } > @@ -913,6 +907,7 @@ xpt_init(void *dummy) > */ > xsoftc.boot_delay = CAM_BOOT_DELAY; > #endif > + > /* > * The xpt layer is, itself, the equivalent of a SIM. > * Allow 16 ccbs in the ccb pool for it. This should > @@ -979,14 +974,11 @@ xpt_init(void *dummy) > "- failing attach\n"); > return (ENOMEM); > } > + > /* > * Register a callback for when interrupts are enabled. > */ > - xsoftc.xpt_config_hook.ich_func = xpt_config; > - if (config_intrhook_establish(&xsoftc.xpt_config_hook) != 0) { > - printf("xpt_init: config_intrhook_establish failed " > - "- failing attach\n"); > - } > + config_intrhook_oneshot(xpt_config, NULL); > > return (0); > } > @@ -5148,6 +5140,10 @@ xpt_stop_tags(struct cam_path *path) > xpt_action((union ccb *)&crs); > } > > +/* > + * Assume all possible buses are detected by this time, so allow > boot > + * as soon as they all are scanned. > + */ > static void > xpt_boot_delay(void *arg) > { > @@ -5155,12 +5151,26 @@ xpt_boot_delay(void *arg) > xpt_release_boot(); > } > > +/* > + * Now that all config hooks have completed, start boot_delay timer, > + * waiting for possibly still undetected buses (USB) to appear. > + */ > static void > +xpt_ch_done(void *arg) > +{ > + > + callout_init(&xsoftc.boot_callout, 1); > + callout_reset_sbt(&xsoftc.boot_callout, SBT_1MS * > xsoftc.boot_delay, 0, > + xpt_boot_delay, NULL, 0); > +} > +SYSINIT(xpt_hw_delay, SI_SUB_INT_CONFIG_HOOKS, SI_ORDER_ANY, > xpt_ch_done, NULL); > + > +/* > + * Now that interrupts are enabled, go find our devices > + */ > +static void > xpt_config(void *arg) > { > - /* > - * Now that interrupts are enabled, go find our devices > - */ > if (taskqueue_start_threads(&xsoftc.xpt_taskq, 1, PRIBIO, "CAM > taskq")) > printf("xpt_config: failed to create taskqueue > thread.\n"); > > @@ -5179,9 +5189,7 @@ xpt_config(void *arg) > > periphdriver_init(1); > xpt_hold_boot(); > - callout_init(&xsoftc.boot_callout, 1); > - callout_reset_sbt(&xsoftc.boot_callout, SBT_1MS * > xsoftc.boot_delay, 0, > - xpt_boot_delay, NULL, 0); > + > /* Fire up rescan thread. */ > if (kproc_kthread_add(xpt_scanner_thread, NULL, &cam_proc, > NULL, 0, 0, > "cam", "scanner")) { > @@ -5190,31 +5198,38 @@ xpt_config(void *arg) > } > > void > +xpt_hold_boot_locked(void) > +{ > + > + if (xsoftc.buses_to_config++ == 0) > + root_mount_hold_token("CAM", &xsoftc.xpt_rootmount); > +} > + > +void > xpt_hold_boot(void) > { > + > xpt_lock_buses(); > - xsoftc.buses_to_config++; > + xpt_hold_boot_locked(); > xpt_unlock_buses(); > } > > void > xpt_release_boot(void) > { > - xpt_lock_buses(); > - xsoftc.buses_to_config--; > - if (xsoftc.buses_to_config == 0 && xsoftc.buses_config_done == > 0) { > - struct xpt_task *task; > > - xsoftc.buses_config_done = 1; > - xpt_unlock_buses(); > - /* Call manually because we don't have any buses */ > - task = malloc(sizeof(struct xpt_task), M_CAMXPT, > M_NOWAIT); > - if (task != NULL) { > - TASK_INIT(&task->task, 0, > xpt_finishconfig_task, task); > - taskqueue_enqueue(taskqueue_thread, &task- > >task); > - } > - } else > - xpt_unlock_buses(); > + xpt_lock_buses(); > + if (--xsoftc.buses_to_config == 0) { > + if (xsoftc.buses_config_done == 0) { > + xsoftc.buses_config_done = 1; > + xsoftc.buses_to_config++; > + TASK_INIT(&xsoftc.boot_task, 0, > xpt_finishconfig_task, > + NULL); > + taskqueue_enqueue(taskqueue_thread, > &xsoftc.boot_task); > + } else > + root_mount_rel(&xsoftc.xpt_rootmount); > + } > + xpt_unlock_buses(); > } > > /* > @@ -5252,10 +5267,7 @@ xpt_finishconfig_task(void *context, int > pending) > if (!bootverbose) > xpt_for_all_devices(xptpassannouncefunc, NULL); > > - /* Release our hook so that the boot can continue. */ > - config_intrhook_disestablish(&xsoftc.xpt_config_hook); > - > - free(context, M_CAMXPT); > + xpt_release_boot(); > } > > cam_status > > Modified: head/sys/cam/scsi/scsi_enc.c > ===================================================================== > ========= > --- head/sys/cam/scsi/scsi_enc.c Fri Nov 22 18:18:36 2019 (r355 > 009) > +++ head/sys/cam/scsi/scsi_enc.c Fri Nov 22 18:39:51 2019 (r355 > 010) > @@ -205,10 +205,7 @@ enc_dtor(struct cam_periph *periph) > if (enc->enc_vec.softc_cleanup != NULL) > enc->enc_vec.softc_cleanup(enc); > > - if (enc->enc_boot_hold_ch.ich_func != NULL) { > - config_intrhook_disestablish(&enc->enc_boot_hold_ch); > - enc->enc_boot_hold_ch.ich_func = NULL; > - } > + root_mount_rel(&enc->enc_rootmount); > > ENC_FREE(enc); > } > @@ -835,7 +832,6 @@ enc_daemon(void *arg) > cam_periph_lock(enc->periph); > while ((enc->enc_flags & ENC_FLAG_SHUTDOWN) == 0) { > if (enc->pending_actions == 0) { > - struct intr_config_hook *hook; > > /* > * Reset callout and msleep, or > @@ -848,11 +844,7 @@ enc_daemon(void *arg) > * We've been through our state machine at > least > * once. Allow the transition to userland. > */ > - hook = &enc->enc_boot_hold_ch; > - if (hook->ich_func != NULL) { > - config_intrhook_disestablish(hook); > - hook->ich_func = NULL; > - } > + root_mount_rel(&enc->enc_rootmount); > > callout_reset(&enc->status_updater, 60*hz, > enc_status_updater, enc); > @@ -891,22 +883,6 @@ enc_kproc_init(enc_softc_t *enc) > cam_periph_release(enc->periph); > return (result); > } > - > -/** > - * \brief Interrupt configuration hook callback associated with > - * enc_boot_hold_ch. > - * > - * Since interrupts are always functional at the time of enclosure > - * configuration, there is nothing to be done when the callback > occurs. > - * This hook is only registered to hold up boot processing while > initial > - * eclosure processing occurs. > - * > - * \param arg The enclosure softc, but currently unused in this > callback. > - */ > -static void > -enc_nop_confighook_cb(void *arg __unused) > -{ > -} > > static cam_status > enc_ctor(struct cam_periph *periph, void *arg) > @@ -964,9 +940,7 @@ enc_ctor(struct cam_periph *periph, void *arg) > * present. > */ > if (enc->enc_vec.poll_status != NULL) { > - enc->enc_boot_hold_ch.ich_func = enc_nop_confighook_cb; > - enc->enc_boot_hold_ch.ich_arg = enc; > - config_intrhook_establish(&enc->enc_boot_hold_ch); > + root_mount_hold_token(periph->periph_name, &enc- > >enc_rootmount); > } > > /* > > Modified: head/sys/cam/scsi/scsi_enc_internal.h > ===================================================================== > ========= > --- head/sys/cam/scsi/scsi_enc_internal.h Fri Nov 22 18:18:36 > 2019 (r355009) > +++ head/sys/cam/scsi/scsi_enc_internal.h Fri Nov 22 18:39:51 > 2019 (r355010) > @@ -163,7 +163,7 @@ struct enc_softc { > > struct enc_fsm_state *enc_fsm_states; > > - struct intr_config_hook enc_boot_hold_ch; > + struct root_hold_token enc_rootmount; > > #define ENC_ANNOUNCE_SZ 400 > char announce_buf[ENC_ANNOUNCE_SZ]; From owner-svn-src-all@freebsd.org Fri Nov 22 19:07:47 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 214DF1BEADF; Fri, 22 Nov 2019 19:07:47 +0000 (UTC) (envelope-from mavbsd@gmail.com) Received: from mail-yw1-xc33.google.com (mail-yw1-xc33.google.com [IPv6:2607:f8b0:4864:20::c33]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47KQtB1ChRz46rG; Fri, 22 Nov 2019 19:07:45 +0000 (UTC) (envelope-from mavbsd@gmail.com) Received: by mail-yw1-xc33.google.com with SMTP id d80so2774933ywa.6; Fri, 22 Nov 2019 11:07:45 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:subject:to:references:from:autocrypt:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=YeV8kt1haUQ/deLXRrEJbQ6bjbHpmqPJH+Q+L81qVj8=; b=IJVdGBDdq9371K5ttKjy//xzWiWX9nenSGtDkZlhq1d/5eIZuTa4+cXTLMEd9EKByT P31HTTEUWhpXVgyEdCdVQkk5D+ukRgYZCApK8atoomFPwXf0jBiEz/V0Y1ltwp2Z6iU1 pl8gBYe/p8VN+0SxeIUgcPfCpPOdGvN2VS1NO0KyMO4zBVGuycKkFd3H82yhv8Lw6K2k OUF/Lun/LUFr8omyZsppOqPuKW0JXuFOXJqBBsTZajTi5SG3mu0b6w5ZbEsPMRyS7rDy HejttkFArah3gqodfrZ3DfxiZ6ggQHbb9rX3aZZ0PCYVln+sBMn5nAOaDZlRDwSLrCml 9K/Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:subject:to:references:from:autocrypt :message-id:date:user-agent:mime-version:in-reply-to :content-language:content-transfer-encoding; bh=YeV8kt1haUQ/deLXRrEJbQ6bjbHpmqPJH+Q+L81qVj8=; b=N/Em0ySoRyxgFkK8QKfoq0omQLG9DxVPptitSXcvAyUyhMKijLKSCWUPeJsqIH2cgv +SLvo5Tgsq3S2QRD2DSw5xITBRk3Ol4P4tw4gi5EGXAKAxnOvaRidzMVMrfIM7grmf2x CH4lTNXRm1VLxU7P3o5+x+lTU9/4WgxOxWkwV2iI1BzYuUajkZYAMx7fhsOOJo+Pjqp9 PAT6a+Zp2AHqwq5fkU+mcvNo4fFSptEC0kmZiYPi45gKZ4jdwJfAQ3nge/AR7TQ+7A3D KIDfve6QEau7Ihs6Geo96TxcBtNRspPpgctWMqtcZD8V85A3X/l6ByzlWuWrTYiEywzk /6CQ== X-Gm-Message-State: APjAAAVHEUL5jfLOAveuIxQEJgLUZUUIFC1zQlkBvTvdndX1dbNiXwyI VDi2kgH9OxV5/PLb6ciChlRWqutq X-Google-Smtp-Source: APXvYqw69fIuHBAkfKKjVAwnJyKCcWL7JyatBJ2y8ZOEOipYAFr4PVfjdP7TnXcbkAV9PKdOezpe/w== X-Received: by 2002:a81:71d7:: with SMTP id m206mr10204049ywc.109.1574449664204; Fri, 22 Nov 2019 11:07:44 -0800 (PST) Received: from mavoffice.ixsystems.com ([12.189.233.129]) by smtp.gmail.com with ESMTPSA id d17sm1903904ywa.81.2019.11.22.11.07.43 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 22 Nov 2019 11:07:43 -0800 (PST) Sender: Alexander Motin Subject: Re: svn commit: r355010 - in head/sys/cam: . scsi To: Ian Lepore , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org References: <201911221839.xAMIdpMa056572@repo.freebsd.org> <512688616ef83a24a907a8ba3cee76cb9d53490b.camel@freebsd.org> From: Alexander Motin Autocrypt: addr=mav@FreeBSD.org; prefer-encrypt=mutual; keydata= mQENBFOzxAwBCADkPrax0pI2W/ig0CK9nRJJwsHitAGEZ2HZiFEuti+6/4UVxj81yr4ak/4g 9bKUyC7rMEAp/ZHNhd+MFCPAAcHPvtovnfykqE/vuosCS3wlSLloix2iKVLks0CwbLHGAyne 46lTQW74Xl/33c3W1Z6d8jD9gVFT/xaVzZ0U9xdzOmsYAZaAj4ki0tuxO9F7L+ct9grRe7iP g8t9hai7BL4ee3VRwk2JXnKb7UvBiVITKYWKz1jRvZIrjPokgEcCLOSlv7x/1kjuFnj3xWZU 7HSFFT8J93epBbrSSCsYsppIk2fZH41kaaFXsMQfTPH8wkeM6qwrvOh4HiQM08R+9tThABEB AAG0IUFsZXhhbmRlciBNb3RpbiA8bWF2QEZyZWVCU0Qub3JnPokBVwQTAQoAQQIbAwULCQgH AwUVCgkICwUWAwIBAAIeAQIXgAIZARYhBOmM88TmnMPNDledVYMYw5VbqyJ/BQJZYMKuBQkN McyiAAoJEIMYw5VbqyJ/tuUIAOG3ONOSNYqjK4eTZ1TVh9jdUBAhWk5nhDFnODN49Wj0AbYm 7aIqy8O1hnCDSZG5LttjSAo3UfXJZDKQM0BLb0gpRMBnAYqO6tdolLNqAbPGJBnGoPjsh24y 6KcbDaNnis+lD4GwPXwQM+92wZGhCUFElPV9NciZGVS65TNIgk7X+yEjjhD1MSWKKijZ1r9Z zIt4OzUTxxNOvzdlABZS88nNRdJkatOQJPmFdd1mpP6UzTNCiLUo1pIqOEtJgvVVDYq5WHY6 tciWWYdmZG/tIBexJmv2mV2OLVjXR6ZeKmntVH14H72/wRHJuYHQC+r5SVRcWWayrThsY6jZ Yr4+raS5AQ0EU7PEDAEIAOZgWf2cJIu+58IzP2dkXE/urj3tr4OqrB/yHGWUf71Lz6D0Fi6Z AXgDtmcFLGPfMyWuLAvSM+xmoguk7zC4hRBYvQycmIhuqBq1jO1Wp/Z+lpoPM/1cDYLn8Flv mI/c40MhUZh345DA4jYWWaZNjQHUWVQ1fPf595vdVVMPT/abE8E5DaF6fSkRmqFTmfYRkfbt 3ytU8NdUapDcJVY7cEP2nJBVNZPnOIObR/ZIgSxjjrG5o34yXoqeup8JvwEv+/NylzzuyXEZ R1EdEIzQ/a1nh/0j4NXtzZEqKW4aTWlmSqb6wN8jh1OSOOqkYsfnE3nfxcZbxi4IRoNQYlm5 9R8AEQEAAYkBPAQYAQoAJgIbDBYhBOmM88TmnMPNDledVYMYw5VbqyJ/BQJZYMLYBQkNMczM AAoJEIMYw5VbqyJ/TqgH/RQHClkvecE0262lwKoP/m0Mh4I5TLRgoJJn8S7G1BnqohYJkiLq A6xe6urGD7OqdNAl12UbrjWbdJV+zvea3vJoM4MZuYiYrGaXWxzFXqWJcPwMU9sAh8MRghHu uC5vgPb45Tnftw9/+n0i8GfVhQhOqepUGdQg4NPcXviSkoAvig6pp9Lcxisn0groUQKt15Gc sS9YcQWg3j9Hnipc6Mu416HX98Fb113NHJqc2geTHLkRyuBFOoyIqB6N9GKjzOAIzxxsVdl9 TevwGsrp4M4/RFzWbSgsbOnbE7454lmuVZGfReEjnUm8RHp9Q2UWKXlp3exlZjvOp/uVEpCg lz65AQ0EU7PEDAEIAOZgWf2cJIu+58IzP2dkXE/urj3tr4OqrB/yHGWUf71Lz6D0Fi6ZAXgD tmcFLGPfMyWuLAvSM+xmoguk7zC4hRBYvQycmIhuqBq1jO1Wp/Z+lpoPM/1cDYLn8FlvmI/c 40MhUZh345DA4jYWWaZNjQHUWVQ1fPf595vdVVMPT/abE8E5DaF6fSkRmqFTmfYRkfbt3ytU 8NdUapDcJVY7cEP2nJBVNZPnOIObR/ZIgSxjjrG5o34yXoqeup8JvwEv+/NylzzuyXEZR1Ed EIzQ/a1nh/0j4NXtzZEqKW4aTWlmSqb6wN8jh1OSOOqkYsfnE3nfxcZbxi4IRoNQYlm59R8A EQEAAYkBPAQYAQoAJgIbDBYhBOmM88TmnMPNDledVYMYw5VbqyJ/BQJZYMLYBQkNMczMAAoJ EIMYw5VbqyJ/TqgH/RQHClkvecE0262lwKoP/m0Mh4I5TLRgoJJn8S7G1BnqohYJkiLqA6xe 6urGD7OqdNAl12UbrjWbdJV+zvea3vJoM4MZuYiYrGaXWxzFXqWJcPwMU9sAh8MRghHuuC5v gPb45Tnftw9/+n0i8GfVhQhOqepUGdQg4NPcXviSkoAvig6pp9Lcxisn0groUQKt15GcsS9Y cQWg3j9Hnipc6Mu416HX98Fb113NHJqc2geTHLkRyuBFOoyIqB6N9GKjzOAIzxxsVdl9Tevw Gsrp4M4/RFzWbSgsbOnbE7454lmuVZGfReEjnUm8RHp9Q2UWKXlp3exlZjvOp/uVEpCglz4= Message-ID: Date: Fri, 22 Nov 2019 14:07:42 -0500 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:68.0) Gecko/20100101 Thunderbird/68.1.1 MIME-Version: 1.0 In-Reply-To: <512688616ef83a24a907a8ba3cee76cb9d53490b.camel@freebsd.org> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit X-Rspamd-Queue-Id: 47KQtB1ChRz46rG X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; dkim=pass header.d=gmail.com header.s=20161025 header.b=IJVdGBDd; dmarc=none; spf=pass (mx1.freebsd.org: domain of mavbsd@gmail.com designates 2607:f8b0:4864:20::c33 as permitted sender) smtp.mailfrom=mavbsd@gmail.com X-Spamd-Result: default: False [-4.90 / 15.00]; ARC_NA(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; R_DKIM_ALLOW(-0.20)[gmail.com:s=20161025]; RCVD_TLS_ALL(0.00)[]; FROM_HAS_DN(0.00)[]; RCPT_COUNT_THREE(0.00)[4]; R_SPF_ALLOW(-0.20)[+ip6:2607:f8b0:4000::/36:c]; TO_MATCH_ENVRCPT_ALL(0.00)[]; MIME_GOOD(-0.10)[text/plain]; DMARC_NA(0.00)[FreeBSD.org]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; TO_DN_SOME(0.00)[]; RCVD_COUNT_THREE(0.00)[3]; IP_SCORE(-2.70)[ip: (-9.20), ipnet: 2607:f8b0::/32(-2.29), asn: 15169(-1.96), country: US(-0.05)]; DKIM_TRACE(0.00)[gmail.com:+]; RCVD_IN_DNSWL_NONE(0.00)[3.3.c.0.0.0.0.0.0.0.0.0.0.0.0.0.0.2.0.0.4.6.8.4.0.b.8.f.7.0.6.2.list.dnswl.org : 127.0.5.0]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; FORGED_SENDER(0.30)[mav@FreeBSD.org,mavbsd@gmail.com]; MIME_TRACE(0.00)[0:+]; FREEMAIL_ENVFROM(0.00)[gmail.com]; ASN(0.00)[asn:15169, ipnet:2607:f8b0::/32, country:US]; FROM_NEQ_ENVFROM(0.00)[mav@FreeBSD.org,mavbsd@gmail.com]; MID_RHS_MATCH_FROM(0.00)[] X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 22 Nov 2019 19:07:47 -0000 On 22.11.2019 14:00, Ian Lepore wrote: > On Fri, 2019-11-22 at 18:39 +0000, Alexander Motin wrote: >> Author: mav >> Date: Fri Nov 22 18:39:51 2019 >> New Revision: 355010 >> URL: https://svnweb.freebsd.org/changeset/base/355010 >> >> Log: >> Make CAM use root_mount_hold_token() to delay boot. >> >> Before this change CAM used config_intrhook_establish() for this >> purpose, >> but that approach does not allow to delay it again after releasing >> once. >> >> USB stack uses root_mount_hold() to delay boot until bus scan is >> complete. >> But once it is, CAM had no time to scan SCSI bus, registered by >> umass(4), >> if it already done other scans and called >> config_intrhook_disestablish(). >> The new approach makes it work smooth, assuming the USB device is >> found >> during the initial bus scan. Devices appearing on USB bus later >> may still >> require setting kern.cam.boot_delay, but hopefully those are >> minority. >> >> MFC after: 2 weeks >> Sponsored by: iXsystems, Inc. >> > > This is probably the fix for this PR? > > https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=144824 Probably. It is a very old issue. I've taken the PR. -- Alexander Motin From owner-svn-src-all@freebsd.org Fri Nov 22 19:30:31 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id B7DA21BF522; Fri, 22 Nov 2019 19:30:31 +0000 (UTC) (envelope-from cem@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47KRNR4PKpz482K; Fri, 22 Nov 2019 19:30:31 +0000 (UTC) (envelope-from cem@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 76CAC43C; Fri, 22 Nov 2019 19:30:31 +0000 (UTC) (envelope-from cem@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xAMJUVk3086171; Fri, 22 Nov 2019 19:30:31 GMT (envelope-from cem@FreeBSD.org) Received: (from cem@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xAMJUVP2086170; Fri, 22 Nov 2019 19:30:31 GMT (envelope-from cem@FreeBSD.org) Message-Id: <201911221930.xAMJUVP2086170@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: cem set sender to cem@FreeBSD.org using -f From: Conrad Meyer Date: Fri, 22 Nov 2019 19:30:31 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r355014 - head/sys/dev/random X-SVN-Group: head X-SVN-Commit-Author: cem X-SVN-Commit-Paths: head/sys/dev/random X-SVN-Commit-Revision: 355014 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 22 Nov 2019 19:30:31 -0000 Author: cem Date: Fri Nov 22 19:30:31 2019 New Revision: 355014 URL: https://svnweb.freebsd.org/changeset/base/355014 Log: random/ivy: Provide mechanism to read independent seed values from rdrand On x86 platforms with the intrinsic, rdrand is a deterministic bit generator (AES-CTR) seeded from an entropic source. On x86 platforms with rdseed, it is something closer to the upstream entropic source. (There is more nuance; a block diagram is provided in [1].) On devices with rdrand and without rdseed, there is no good intrinsic for acecssing the good entropic soure directly. However, the DRBG is guaranteed to reseed every 8 kB on these platforms. As a conservative option, on such hardware we can read an extra 7.99kB samples every time we want a sample from an independent seed. As one can imagine, this drastically slows the effective read rate of RDRAND (a factor of 1024 on amd64 and 2048 on ia32). Microbenchmarks on AMD Zen (has RDSEED) show an RDRAND rate of 25 MB/s and Intel Haswell (no RDSEED) show RDRAND of 170 MB/s. This would reduce the read rate on Haswell to ~170 kB/s (at 100% CPU). random(4)'s harvestq thread periodically "feeds" from pure sources in amounts of 128-1024 bytes. On Haswell, enabling this feature increases the CPU time of RDRAND in each "feed" from approximately 0.7-6 µs to 0.7-6 ms. Because there is some performance penalty to this more conservative option, a knob is provided to enable the change. The change does not affect platforms with RDSEED. [1]: https://software.intel.com/en-us/articles/intel-digital-random-number-generator-drng-software-implementation-guide#inpage-nav-4-2 Approved by: csprng(delphij, markm) Differential Revision: https://reviews.freebsd.org/D22455 Modified: head/sys/dev/random/ivy.c Modified: head/sys/dev/random/ivy.c ============================================================================== --- head/sys/dev/random/ivy.c Fri Nov 22 18:55:27 2019 (r355013) +++ head/sys/dev/random/ivy.c Fri Nov 22 19:30:31 2019 (r355014) @@ -40,6 +40,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include @@ -59,23 +60,46 @@ static struct random_source random_ivy = { .rs_read = random_ivy_read }; +SYSCTL_NODE(_kern_random, OID_AUTO, rdrand, CTLFLAG_RW, 0, + "rdrand (ivy) entropy source"); +static bool acquire_independent_seed_samples = false; +SYSCTL_BOOL(_kern_random_rdrand, OID_AUTO, rdrand_independent_seed, + CTLFLAG_RWTUN, &acquire_independent_seed_samples, 0, + "If non-zero, use more expensive and slow, but safer, seeded samples " + "where RDSEED is not present."); + static bool x86_rdrand_store(u_long *buf) { - u_long rndval; + u_long rndval, seed_iterations, i; int retry; - retry = RETRY_COUNT; - __asm __volatile( - "1:\n\t" - "rdrand %1\n\t" /* read randomness into rndval */ - "jc 2f\n\t" /* CF is set on success, exit retry loop */ - "dec %0\n\t" /* otherwise, retry-- */ - "jne 1b\n\t" /* and loop if retries are not exhausted */ - "2:" - : "+r" (retry), "=r" (rndval) : : "cc"); + /* Per [1], "§ 5.2.6 Generating Seeds from RDRAND," + * machines lacking RDSEED will guarantee RDRAND is reseeded every 8kB + * of generated output. + * + * [1]: https://software.intel.com/en-us/articles/intel-digital-random-number-generator-drng-software-implementation-guide#inpage-nav-6-8 + */ + if (acquire_independent_seed_samples) + seed_iterations = 8 * 1024 / sizeof(*buf); + else + seed_iterations = 1; + + for (i = 0; i < seed_iterations; i++) { + retry = RETRY_COUNT; + __asm __volatile( + "1:\n\t" + "rdrand %1\n\t" /* read randomness into rndval */ + "jc 2f\n\t" /* CF is set on success, exit retry loop */ + "dec %0\n\t" /* otherwise, retry-- */ + "jne 1b\n\t" /* and loop if retries are not exhausted */ + "2:" + : "+r" (retry), "=r" (rndval) : : "cc"); + if (retry == 0) + return (false); + } *buf = rndval; - return (retry != 0); + return (true); } static bool From owner-svn-src-all@freebsd.org Fri Nov 22 19:54:15 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 6BEA91BFCEC; Fri, 22 Nov 2019 19:54:15 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47KRvq1v4rz49R9; Fri, 22 Nov 2019 19:54:15 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 243299CB; Fri, 22 Nov 2019 19:54:15 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xAMJsFWf003467; Fri, 22 Nov 2019 19:54:15 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xAMJsFIc003466; Fri, 22 Nov 2019 19:54:15 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201911221954.xAMJsFIc003466@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Fri, 22 Nov 2019 19:54:15 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r355015 - head/sys/cam/mmc X-SVN-Group: head X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: head/sys/cam/mmc X-SVN-Commit-Revision: 355015 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 22 Nov 2019 19:54:15 -0000 Author: kevans Date: Fri Nov 22 19:54:14 2019 New Revision: 355015 URL: https://svnweb.freebsd.org/changeset/base/355015 Log: MMCCAM: defer release of ccb until we're done with it If we've found a device, we attempt to call xpt_action() on a ccb that's already been released. Simply defer release until after we're done with it. Reviewed by: imp, scottl MFC after: 1 week Modified: head/sys/cam/mmc/mmc_xpt.c Modified: head/sys/cam/mmc/mmc_xpt.c ============================================================================== --- head/sys/cam/mmc/mmc_xpt.c Fri Nov 22 19:30:31 2019 (r355014) +++ head/sys/cam/mmc/mmc_xpt.c Fri Nov 22 19:54:14 2019 (r355015) @@ -1082,7 +1082,6 @@ mmcprobe_done(struct cam_periph *periph, union ccb *do //xpt_async(AC_LOST_DEVICE, path, NULL); } - xpt_release_ccb(done_ccb); if (softc->action != PROBE_INVALID) xpt_schedule(periph, priority); /* Drop freeze taken due to CAM_DEV_QFREEZE flag set. */ @@ -1099,6 +1098,7 @@ mmcprobe_done(struct cam_periph *periph, union ccb *do xpt_async(AC_FOUND_DEVICE, path, done_ccb); } } + xpt_release_ccb(done_ccb); if (softc->action == PROBE_DONE || softc->action == PROBE_INVALID) { cam_periph_invalidate(periph); cam_periph_release_locked(periph); From owner-svn-src-all@freebsd.org Fri Nov 22 19:56:52 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id B81E71BFEB9; Fri, 22 Nov 2019 19:56:52 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47KRyr4XB3z49tc; Fri, 22 Nov 2019 19:56:52 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 797279D3; Fri, 22 Nov 2019 19:56:52 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xAMJuqbZ003651; Fri, 22 Nov 2019 19:56:52 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xAMJuqSm003650; Fri, 22 Nov 2019 19:56:52 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201911221956.xAMJuqSm003650@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Fri, 22 Nov 2019 19:56:52 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r355016 - head/sys/arm/broadcom/bcm2835 X-SVN-Group: head X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: head/sys/arm/broadcom/bcm2835 X-SVN-Commit-Revision: 355016 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 22 Nov 2019 19:56:52 -0000 Author: kevans Date: Fri Nov 22 19:56:52 2019 New Revision: 355016 URL: https://svnweb.freebsd.org/changeset/base/355016 Log: bcm2835_vcbus: add the *other* rpi4 compat string The DTS I used initially had brcm,bcm2838; the new one uses brcm,bcm2711. Add that one as well. Modified: head/sys/arm/broadcom/bcm2835/bcm2835_vcbus.c Modified: head/sys/arm/broadcom/bcm2835/bcm2835_vcbus.c ============================================================================== --- head/sys/arm/broadcom/bcm2835/bcm2835_vcbus.c Fri Nov 22 19:54:14 2019 (r355015) +++ head/sys/arm/broadcom/bcm2835/bcm2835_vcbus.c Fri Nov 22 19:56:52 2019 (r355016) @@ -158,6 +158,11 @@ static struct bcm283x_memory_soc_cfg { #ifdef SOC_BRCM_BCM2838 { .memmap = bcm2838_memmap, + .soc_compat = "brcm,bcm2711", + .busdma_lowaddr = BCM2838_PERIPH_MAXADDR, + }, + { + .memmap = bcm2838_memmap, .soc_compat = "brcm,bcm2838", .busdma_lowaddr = BCM2838_PERIPH_MAXADDR, }, From owner-svn-src-all@freebsd.org Fri Nov 22 20:18:08 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 9951F1C0869; Fri, 22 Nov 2019 20:18:08 +0000 (UTC) (envelope-from cem@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47KSRN3Tzwz4C82; Fri, 22 Nov 2019 20:18:08 +0000 (UTC) (envelope-from cem@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 5AEDCD7B; Fri, 22 Nov 2019 20:18:08 +0000 (UTC) (envelope-from cem@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xAMKI80X015760; Fri, 22 Nov 2019 20:18:08 GMT (envelope-from cem@FreeBSD.org) Received: (from cem@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xAMKI8sY015759; Fri, 22 Nov 2019 20:18:08 GMT (envelope-from cem@FreeBSD.org) Message-Id: <201911222018.xAMKI8sY015759@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: cem set sender to cem@FreeBSD.org using -f From: Conrad Meyer Date: Fri, 22 Nov 2019 20:18:08 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r355017 - head/sys/dev/random X-SVN-Group: head X-SVN-Commit-Author: cem X-SVN-Commit-Paths: head/sys/dev/random X-SVN-Commit-Revision: 355017 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 22 Nov 2019 20:18:08 -0000 Author: cem Date: Fri Nov 22 20:18:07 2019 New Revision: 355017 URL: https://svnweb.freebsd.org/changeset/base/355017 Log: random(4): Remove unused definitions Approved by: csprng(gordon, markm) Differential Revision: https://reviews.freebsd.org/D22481 Modified: head/sys/dev/random/randomdev.h Modified: head/sys/dev/random/randomdev.h ============================================================================== --- head/sys/dev/random/randomdev.h Fri Nov 22 19:56:52 2019 (r355016) +++ head/sys/dev/random/randomdev.h Fri Nov 22 20:18:07 2019 (r355017) @@ -65,12 +65,9 @@ extern bool random_bypass_disable_warnings; struct harvest_event; -typedef void random_alg_init_t(void *); -typedef void random_alg_deinit_t(void *); typedef void random_alg_pre_read_t(void); typedef void random_alg_read_t(uint8_t *, size_t); typedef bool random_alg_seeded_t(void); -typedef void random_alg_reseed_t(void); typedef void random_alg_eventprocessor_t(struct harvest_event *); typedef u_int random_source_read_t(void *, u_int); From owner-svn-src-all@freebsd.org Fri Nov 22 20:20:38 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 697631C0942; Fri, 22 Nov 2019 20:20:38 +0000 (UTC) (envelope-from cem@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47KSVG2Ckrz4CJ3; Fri, 22 Nov 2019 20:20:38 +0000 (UTC) (envelope-from cem@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 2FE93D92; Fri, 22 Nov 2019 20:20:38 +0000 (UTC) (envelope-from cem@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xAMKKcsQ017868; Fri, 22 Nov 2019 20:20:38 GMT (envelope-from cem@FreeBSD.org) Received: (from cem@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xAMKKbE0017524; Fri, 22 Nov 2019 20:20:37 GMT (envelope-from cem@FreeBSD.org) Message-Id: <201911222020.xAMKKbE0017524@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: cem set sender to cem@FreeBSD.org using -f From: Conrad Meyer Date: Fri, 22 Nov 2019 20:20:37 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r355018 - in head/sys: dev/random sys X-SVN-Group: head X-SVN-Commit-Author: cem X-SVN-Commit-Paths: in head/sys: dev/random sys X-SVN-Commit-Revision: 355018 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 22 Nov 2019 20:20:38 -0000 Author: cem Date: Fri Nov 22 20:20:37 2019 New Revision: 355018 URL: https://svnweb.freebsd.org/changeset/base/355018 Log: random(4): Abstract loader entropy injection Break random_harvestq_prime up into some logical subroutines. The goal is that it becomes easier to add other early entropy sources. While here, drop pre-12.0 compatibility logic. loader default configuration should preload the file as expeced since 12.0. Approved by: csprng(delphij, markm) Differential Revision: https://reviews.freebsd.org/D22482 Modified: head/sys/dev/random/random_harvestq.c head/sys/sys/random.h Modified: head/sys/dev/random/random_harvestq.c ============================================================================== --- head/sys/dev/random/random_harvestq.c Fri Nov 22 20:18:07 2019 (r355017) +++ head/sys/dev/random/random_harvestq.c Fri Nov 22 20:20:37 2019 (r355018) @@ -402,6 +402,57 @@ random_harvestq_init(void *unused __unused) SYSINIT(random_device_h_init, SI_SUB_RANDOM, SI_ORDER_SECOND, random_harvestq_init, NULL); /* + * Subroutine to slice up a contiguous chunk of 'entropy' and feed it into the + * underlying algorithm. Returns number of bytes actually fed into underlying + * algorithm. + */ +static size_t +random_early_prime(char *entropy, size_t len) +{ + struct harvest_event event; + size_t i; + + len = rounddown(len, sizeof(event.he_entropy)); + if (len == 0) + return (0); + + for (i = 0; i < len; i += sizeof(event.he_entropy)) { + event.he_somecounter = (uint32_t)get_cyclecount(); + event.he_size = sizeof(event.he_entropy); + event.he_source = RANDOM_CACHED; + event.he_destination = + harvest_context.hc_destination[RANDOM_CACHED]++; + memcpy(event.he_entropy, entropy + i, sizeof(event.he_entropy)); + random_harvestq_fast_process_event(&event); + } + explicit_bzero(entropy, len); + return (len); +} + +/* + * Subroutine to search for known loader-loaded files in memory and feed them + * into the underlying algorithm early in boot. Returns the number of bytes + * loaded (zero if none were loaded). + */ +static size_t +random_prime_loader_file(const char *type) +{ + uint8_t *keyfile, *data; + size_t size; + + keyfile = preload_search_by_type(type); + if (keyfile == NULL) + return (0); + + data = preload_fetch_addr(keyfile); + size = preload_fetch_size(keyfile); + if (data == NULL) + return (0); + + return (random_early_prime(data, size)); +} + +/* * This is used to prime the RNG by grabbing any early random stuff * known to the kernel, and inserting it directly into the hashing * module, currently Fortuna. @@ -410,41 +461,19 @@ SYSINIT(random_device_h_init, SI_SUB_RANDOM, SI_ORDER_ static void random_harvestq_prime(void *unused __unused) { - struct harvest_event event; - size_t count, size, i; - uint8_t *keyfile, *data; + size_t size; /* * Get entropy that may have been preloaded by loader(8) * and use it to pre-charge the entropy harvest queue. */ - keyfile = preload_search_by_type(RANDOM_CACHED_BOOT_ENTROPY_MODULE); -#ifndef NO_BACKWARD_COMPATIBILITY - if (keyfile == NULL) - keyfile = preload_search_by_type(RANDOM_LEGACY_BOOT_ENTROPY_MODULE); -#endif - if (keyfile != NULL) { - data = preload_fetch_addr(keyfile); - size = preload_fetch_size(keyfile); - /* Trim the size. If the admin has a file with a funny size, we lose some. Tough. */ - size -= (size % sizeof(event.he_entropy)); - if (data != NULL && size != 0) { - for (i = 0; i < size; i += sizeof(event.he_entropy)) { - count = sizeof(event.he_entropy); - event.he_somecounter = (uint32_t)get_cyclecount(); - event.he_size = count; - event.he_source = RANDOM_CACHED; - event.he_destination = - harvest_context.hc_destination[RANDOM_CACHED]++; - memcpy(event.he_entropy, data + i, sizeof(event.he_entropy)); - random_harvestq_fast_process_event(&event); - } - explicit_bzero(data, size); - if (bootverbose) - printf("random: read %zu bytes from preloaded cache\n", size); - } else - if (bootverbose) - printf("random: no preloaded entropy cache\n"); + size = random_prime_loader_file(RANDOM_CACHED_BOOT_ENTROPY_MODULE); + if (bootverbose) { + if (size > 0) + printf("random: read %zu bytes from preloaded cache\n", + size); + else + printf("random: no preloaded entropy cache\n"); } } SYSINIT(random_device_prime, SI_SUB_RANDOM, SI_ORDER_MIDDLE, random_harvestq_prime, NULL); Modified: head/sys/sys/random.h ============================================================================== --- head/sys/sys/random.h Fri Nov 22 20:18:07 2019 (r355017) +++ head/sys/sys/random.h Fri Nov 22 20:20:37 2019 (r355018) @@ -81,7 +81,6 @@ enum random_entropy_source { _Static_assert(ENTROPYSOURCE <= 32, "hardcoded assumption that values fit in a typical word-sized bitset"); -#define RANDOM_LEGACY_BOOT_ENTROPY_MODULE "/boot/entropy" #define RANDOM_CACHED_BOOT_ENTROPY_MODULE "boot_entropy_cache" extern u_int hc_source_mask; From owner-svn-src-all@freebsd.org Fri Nov 22 20:22:17 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 684D31C0B88; Fri, 22 Nov 2019 20:22:17 +0000 (UTC) (envelope-from dch@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47KSX92BYSz4Cdg; Fri, 22 Nov 2019 20:22:17 +0000 (UTC) (envelope-from dch@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 2EB7BF3F; Fri, 22 Nov 2019 20:22:17 +0000 (UTC) (envelope-from dch@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xAMKMHoV021167; Fri, 22 Nov 2019 20:22:17 GMT (envelope-from dch@FreeBSD.org) Received: (from dch@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xAMKMGMD021163; Fri, 22 Nov 2019 20:22:16 GMT (envelope-from dch@FreeBSD.org) Message-Id: <201911222022.xAMKMGMD021163@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dch set sender to dch@FreeBSD.org using -f From: Dave Cottlehuber Date: Fri, 22 Nov 2019 20:22:16 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r355019 - head/sbin/dhclient X-SVN-Group: head X-SVN-Commit-Author: dch X-SVN-Commit-Paths: head/sbin/dhclient X-SVN-Commit-Revision: 355019 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 22 Nov 2019 20:22:17 -0000 Author: dch (ports committer) Date: Fri Nov 22 20:22:16 2019 New Revision: 355019 URL: https://svnweb.freebsd.org/changeset/base/355019 Log: dhclient: support option 114, default-url ascii This will enable further automation of HTTP UEFI boot loader support by providing a specific option for providing the boot URL to FreeBSD. Documented in: https://www.iana.org/assignments/bootp-dhcp-parameters/bootp-dhcp-parameters.xhtml https://kb.isc.org/docs/isc-dhcp-44-manual-pages-dhcp-options https://tools.ietf.org/html/rfc3679 Approved by: emaste MFC after: 2 weeks Sponsored by: SkunkWerks, GmbH Differential Revision: https://reviews.freebsd.org/D22475 Modified: head/sbin/dhclient/dhclient.c head/sbin/dhclient/dhcp-options.5 head/sbin/dhclient/dhcp.h head/sbin/dhclient/tables.c Modified: head/sbin/dhclient/dhclient.c ============================================================================== --- head/sbin/dhclient/dhclient.c Fri Nov 22 20:20:37 2019 (r355018) +++ head/sbin/dhclient/dhclient.c Fri Nov 22 20:22:16 2019 (r355019) @@ -2601,6 +2601,7 @@ check_option(struct client_lease *l, int option) case DHO_DHCP_CLIENT_IDENTIFIER: case DHO_BOOTFILE_NAME: case DHO_DHCP_USER_CLASS_ID: + case DHO_URL: case DHO_END: return (1); case DHO_CLASSLESS_ROUTES: Modified: head/sbin/dhclient/dhcp-options.5 ============================================================================== --- head/sbin/dhclient/dhcp-options.5 Fri Nov 22 20:20:37 2019 (r355018) +++ head/sbin/dhclient/dhcp-options.5 Fri Nov 22 20:22:16 2019 (r355019) @@ -587,6 +587,9 @@ Servers should be listed in order of preference. The StreetTalk Directory Assistance (STDA) server option specifies a list of STDA servers available to the client. Servers should be listed in order of preference. +.It Ic option url Ar string ; +This option specifies the URL that the client may use when using UEFI +boot from a HTTP server. .El .Sh SEE ALSO .Xr dhclient.conf 5 , @@ -595,7 +598,7 @@ Servers should be listed in order of preference. .Xr dhclient 8 , .Xr dhcpd 8 .Rs -.%R "RFC 2131, RFC 2132" +.%R "RFC 2131, RFC 2132, RFC 3769" .Re .Sh AUTHORS .An -nosplit Modified: head/sbin/dhclient/dhcp.h ============================================================================== --- head/sbin/dhclient/dhcp.h Fri Nov 22 20:20:37 2019 (r355018) +++ head/sbin/dhclient/dhcp.h Fri Nov 22 20:22:16 2019 (r355019) @@ -171,6 +171,7 @@ struct dhcp_packet { #define DHO_STREETTALK_SERVER 75 #define DHO_STREETTALK_DA_SERVER 76 #define DHO_DHCP_USER_CLASS_ID 77 +#define DHO_URL 114 #define DHO_DOMAIN_SEARCH 119 #define DHO_CLASSLESS_ROUTES 121 #define DHO_END 255 Modified: head/sbin/dhclient/tables.c ============================================================================== --- head/sbin/dhclient/tables.c Fri Nov 22 20:20:37 2019 (r355018) +++ head/sbin/dhclient/tables.c Fri Nov 22 20:22:16 2019 (r355019) @@ -181,7 +181,7 @@ struct option dhcp_options[256] = { { "option-111", "X", &dhcp_universe, 111 }, { "option-112", "X", &dhcp_universe, 112 }, { "option-113", "X", &dhcp_universe, 113 }, - { "option-114", "X", &dhcp_universe, 114 }, + { "url", "t", &dhcp_universe, 114 }, { "option-115", "X", &dhcp_universe, 115 }, { "option-116", "X", &dhcp_universe, 116 }, { "option-117", "X", &dhcp_universe, 117 }, @@ -404,11 +404,12 @@ unsigned char dhcp_option_default_priority_list[] = { DHO_STREETTALK_DA_SERVER, DHO_DHCP_USER_CLASS_ID, DHO_DOMAIN_SEARCH, + DHO_URL, /* Presently-undefined options... */ 62, 63, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, - 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, + 106, 107, 108, 109, 110, 111, 112, 113, 115, 116, 117, 118, 120, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, From owner-svn-src-all@freebsd.org Fri Nov 22 20:22:30 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 179F41C0BD7; Fri, 22 Nov 2019 20:22:30 +0000 (UTC) (envelope-from cem@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47KSXP6Bjfz4CmJ; Fri, 22 Nov 2019 20:22:29 +0000 (UTC) (envelope-from cem@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id B8B0FF51; Fri, 22 Nov 2019 20:22:29 +0000 (UTC) (envelope-from cem@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xAMKMTQ0021217; Fri, 22 Nov 2019 20:22:29 GMT (envelope-from cem@FreeBSD.org) Received: (from cem@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xAMKMTFW021216; Fri, 22 Nov 2019 20:22:29 GMT (envelope-from cem@FreeBSD.org) Message-Id: <201911222022.xAMKMTFW021216@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: cem set sender to cem@FreeBSD.org using -f From: Conrad Meyer Date: Fri, 22 Nov 2019 20:22:29 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r355020 - head/sys/dev/random X-SVN-Group: head X-SVN-Commit-Author: cem X-SVN-Commit-Paths: head/sys/dev/random X-SVN-Commit-Revision: 355020 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 22 Nov 2019 20:22:30 -0000 Author: cem Date: Fri Nov 22 20:22:29 2019 New Revision: 355020 URL: https://svnweb.freebsd.org/changeset/base/355020 Log: random(4): Use ordinary sysctl definitions There's no need to dynamically populate them; the SYSCTL_ macros take care of load/unload appropriately already (and random_harvestq is 'standard' and cannot be unloaded anyway). Approved by: csprng(delphij, markm) Differential Revision: https://reviews.freebsd.org/D22484 Modified: head/sys/dev/random/random_harvestq.c Modified: head/sys/dev/random/random_harvestq.c ============================================================================== --- head/sys/dev/random/random_harvestq.c Fri Nov 22 20:22:16 2019 (r355019) +++ head/sys/dev/random/random_harvestq.c Fri Nov 22 20:22:29 2019 (r355020) @@ -80,9 +80,6 @@ static void random_sources_feed(void); static u_int read_rate; -/* List for the dynamic sysctls */ -static struct sysctl_ctx_list random_clist; - /* * How many events to queue up. We create this many items in * an 'empty' queue, then transfer them to the 'harvest' queue with @@ -101,6 +98,9 @@ volatile int random_kthread_control; */ __read_frequently u_int hc_source_mask; +SYSCTL_NODE(_kern_random, OID_AUTO, harvest, CTLFLAG_RW, 0, + "Entropy Device Parameters"); + /* * Put all the harvest queue context stuff in one place. * this make is a bit easier to lock and protect. @@ -292,6 +292,8 @@ random_check_uint_harvestmask(SYSCTL_HANDLER_ARGS) (orig_value & user_immutable_mask); return (0); } +SYSCTL_PROC(_kern_random_harvest, OID_AUTO, mask, CTLTYPE_UINT | CTLFLAG_RW, + NULL, 0, random_check_uint_harvestmask, "IU", "Entropy harvesting mask"); /* ARGSUSED */ static int @@ -310,6 +312,9 @@ random_print_harvestmask(SYSCTL_HANDLER_ARGS) } return (error); } +SYSCTL_PROC(_kern_random_harvest, OID_AUTO, mask_bin, + CTLTYPE_STRING | CTLFLAG_RD, NULL, 0, random_print_harvestmask, "A", + "Entropy harvesting mask (printable)"); static const char *random_source_descr[ENTROPYSOURCE] = { [RANDOM_CACHED] = "CACHED", @@ -367,6 +372,9 @@ random_print_harvestmask_symbolic(SYSCTL_HANDLER_ARGS) } return (error); } +SYSCTL_PROC(_kern_random_harvest, OID_AUTO, mask_symbolic, + CTLTYPE_STRING | CTLFLAG_RD, NULL, 0, random_print_harvestmask_symbolic, + "A", "Entropy harvesting mask (symbolic)"); /* ARGSUSED */ static void @@ -376,26 +384,7 @@ random_harvestq_init(void *unused __unused) (((1 << (RANDOM_ENVIRONMENTAL_END + 1)) - 1) & ~_RANDOM_HARVEST_ETHER_OFF & ~_RANDOM_HARVEST_UMA_OFF); - struct sysctl_oid *random_sys_o; - - random_sys_o = SYSCTL_ADD_NODE(&random_clist, - SYSCTL_STATIC_CHILDREN(_kern_random), - OID_AUTO, "harvest", CTLFLAG_RW, 0, - "Entropy Device Parameters"); hc_source_mask = almost_everything_mask; - SYSCTL_ADD_PROC(&random_clist, - SYSCTL_CHILDREN(random_sys_o), - OID_AUTO, "mask", CTLTYPE_UINT | CTLFLAG_RW, - NULL, 0, random_check_uint_harvestmask, "IU", - "Entropy harvesting mask"); - SYSCTL_ADD_PROC(&random_clist, - SYSCTL_CHILDREN(random_sys_o), - OID_AUTO, "mask_bin", CTLTYPE_STRING | CTLFLAG_RD, - NULL, 0, random_print_harvestmask, "A", "Entropy harvesting mask (printable)"); - SYSCTL_ADD_PROC(&random_clist, - SYSCTL_CHILDREN(random_sys_o), - OID_AUTO, "mask_symbolic", CTLTYPE_STRING | CTLFLAG_RD, - NULL, 0, random_print_harvestmask_symbolic, "A", "Entropy harvesting mask (symbolic)"); RANDOM_HARVEST_INIT_LOCK(); harvest_context.hc_entropy_ring.in = harvest_context.hc_entropy_ring.out = 0; } @@ -487,7 +476,6 @@ random_harvestq_deinit(void *unused __unused) random_kthread_control = 0; while (random_kthread_control >= 0) tsleep(&harvest_context.hc_kthread_proc, 0, "harvqterm", hz/5); - sysctl_ctx_free(&random_clist); } SYSUNINIT(random_device_h_init, SI_SUB_RANDOM, SI_ORDER_SECOND, random_harvestq_deinit, NULL); From owner-svn-src-all@freebsd.org Fri Nov 22 20:23:23 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 9D5551C0C86; Fri, 22 Nov 2019 20:23:23 +0000 (UTC) (envelope-from scottl@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47KSYR3h8sz4Cwb; Fri, 22 Nov 2019 20:23:23 +0000 (UTC) (envelope-from scottl@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 6324FF7A; Fri, 22 Nov 2019 20:23:23 +0000 (UTC) (envelope-from scottl@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xAMKNNrH021306; Fri, 22 Nov 2019 20:23:23 GMT (envelope-from scottl@FreeBSD.org) Received: (from scottl@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xAMKNMRB021304; Fri, 22 Nov 2019 20:23:22 GMT (envelope-from scottl@FreeBSD.org) Message-Id: <201911222023.xAMKNMRB021304@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: scottl set sender to scottl@FreeBSD.org using -f From: Scott Long Date: Fri, 22 Nov 2019 20:23:22 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r355021 - in head: share/man/man4 sys/dev/hpt27xx X-SVN-Group: head X-SVN-Commit-Author: scottl X-SVN-Commit-Paths: in head: share/man/man4 sys/dev/hpt27xx X-SVN-Commit-Revision: 355021 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 22 Nov 2019 20:23:23 -0000 Author: scottl Date: Fri Nov 22 20:23:22 2019 New Revision: 355021 URL: https://svnweb.freebsd.org/changeset/base/355021 Log: Mark hpt27xx for removal in 13.0; all CAM drivers will be Giant-free by then. Relnotes: yes Modified: head/share/man/man4/hpt27xx.4 head/sys/dev/hpt27xx/hpt27xx_osm_bsd.c Modified: head/share/man/man4/hpt27xx.4 ============================================================================== --- head/share/man/man4/hpt27xx.4 Fri Nov 22 20:22:29 2019 (r355020) +++ head/share/man/man4/hpt27xx.4 Fri Nov 22 20:23:22 2019 (r355021) @@ -44,6 +44,9 @@ module at boot time, place the following line in .Bd -literal -offset indent hpt27xx_load="YES" .Ed +.Sh DEPRECATION NOTICE +This driver is scheduled for removal prior to the release of +.Fx 13.0 . .Sh DESCRIPTION The .Nm Modified: head/sys/dev/hpt27xx/hpt27xx_osm_bsd.c ============================================================================== --- head/sys/dev/hpt27xx/hpt27xx_osm_bsd.c Fri Nov 22 20:22:29 2019 (r355020) +++ head/sys/dev/hpt27xx/hpt27xx_osm_bsd.c Fri Nov 22 20:23:22 2019 (r355021) @@ -76,7 +76,9 @@ static int hpt_attach(device_t dev) HPT_UINT size; PVBUS vbus; PVBUS_EXT vbus_ext; - + + gone_in(13, "Giant locked CAM drivers"); + KdPrint(("hpt_attach(%d/%d/%d)", pci_get_bus(dev), pci_get_slot(dev), pci_get_function(dev))); him = hpt_match(dev, 1); From owner-svn-src-all@freebsd.org Fri Nov 22 20:24:16 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 3FD6C1C0D0F; Fri, 22 Nov 2019 20:24:16 +0000 (UTC) (envelope-from cem@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47KSZS0pbfz4D4D; Fri, 22 Nov 2019 20:24:16 +0000 (UTC) (envelope-from cem@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id D9F37F7B; Fri, 22 Nov 2019 20:24:15 +0000 (UTC) (envelope-from cem@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xAMKOFbO021390; Fri, 22 Nov 2019 20:24:15 GMT (envelope-from cem@FreeBSD.org) Received: (from cem@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xAMKOFbo021386; Fri, 22 Nov 2019 20:24:15 GMT (envelope-from cem@FreeBSD.org) Message-Id: <201911222024.xAMKOFbo021386@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: cem set sender to cem@FreeBSD.org using -f From: Conrad Meyer Date: Fri, 22 Nov 2019 20:24:15 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r355022 - head/sys/dev/random X-SVN-Group: head X-SVN-Commit-Author: cem X-SVN-Commit-Paths: head/sys/dev/random X-SVN-Commit-Revision: 355022 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 22 Nov 2019 20:24:16 -0000 Author: cem Date: Fri Nov 22 20:24:15 2019 New Revision: 355022 URL: https://svnweb.freebsd.org/changeset/base/355022 Log: random(4): De-export random_sources list The internal datastructures do not need to be visible outside of random_harvestq, and this helps ensure they are not misused. No functional change. Approved by: csprng(delphij, markm) Differential Revision: https://reviews.freebsd.org/D22485 Modified: head/sys/dev/random/random_harvestq.c head/sys/dev/random/random_infra.c head/sys/dev/random/randomdev.h Modified: head/sys/dev/random/random_harvestq.c ============================================================================== --- head/sys/dev/random/random_harvestq.c Fri Nov 22 20:23:22 2019 (r355021) +++ head/sys/dev/random/random_harvestq.c Fri Nov 22 20:24:15 2019 (r355022) @@ -98,6 +98,14 @@ volatile int random_kthread_control; */ __read_frequently u_int hc_source_mask; +struct random_sources { + LIST_ENTRY(random_sources) rrs_entries; + struct random_source *rrs_source; +}; + +static LIST_HEAD(sources_head, random_sources) source_list = + LIST_HEAD_INITIALIZER(source_list); + SYSCTL_NODE(_kern_random, OID_AUTO, harvest, CTLFLAG_RW, 0, "Entropy Device Parameters"); Modified: head/sys/dev/random/random_infra.c ============================================================================== --- head/sys/dev/random/random_infra.c Fri Nov 22 20:23:22 2019 (r355021) +++ head/sys/dev/random/random_infra.c Fri Nov 22 20:24:15 2019 (r355022) @@ -101,8 +101,6 @@ SYSCTL_BOOL(_kern_random_initial_seeding, OID_AUTO, MALLOC_DEFINE(M_ENTROPY, "entropy", "Entropy harvesting buffers and data structures"); -struct sources_head source_list = LIST_HEAD_INITIALIZER(source_list); - #if defined(RANDOM_LOADABLE) struct random_algorithm *p_random_alg_context = NULL; #else /* !defined(RANDOM_LOADABLE) */ Modified: head/sys/dev/random/randomdev.h ============================================================================== --- head/sys/dev/random/randomdev.h Fri Nov 22 20:23:22 2019 (r355021) +++ head/sys/dev/random/randomdev.h Fri Nov 22 20:24:15 2019 (r355022) @@ -102,14 +102,6 @@ struct random_source { random_source_read_t *rs_read; }; -struct random_sources { - LIST_ENTRY(random_sources) rrs_entries; - struct random_source *rrs_source; -}; - -LIST_HEAD(sources_head, random_sources); -extern struct sources_head source_list; - void random_source_register(struct random_source *); void random_source_deregister(struct random_source *); From owner-svn-src-all@freebsd.org Fri Nov 22 20:56:55 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 51B281C1599; Fri, 22 Nov 2019 20:56:55 +0000 (UTC) (envelope-from rpokala@freebsd.org) Received: from smtp.freebsd.org (smtp.freebsd.org [96.47.72.83]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "smtp.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47KTJ71VFdz4FNv; Fri, 22 Nov 2019 20:56:55 +0000 (UTC) (envelope-from rpokala@freebsd.org) Received: from [172.17.133.228] (unknown [12.202.168.51]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) (Authenticated sender: rpokala) by smtp.freebsd.org (Postfix) with ESMTPSA id 8ABF115417; Fri, 22 Nov 2019 20:56:54 +0000 (UTC) (envelope-from rpokala@freebsd.org) User-Agent: Microsoft-MacOutlook/10.1f.0.191110 Date: Fri, 22 Nov 2019 12:56:44 -0800 Subject: Re: svn commit: r355018 - in head/sys: dev/random sys From: Ravi Pokala To: Conrad Meyer , , , Message-ID: <85EFA1CD-5093-4588-9FA4-F704DA122674@panasas.com> Thread-Topic: svn commit: r355018 - in head/sys: dev/random sys References: <201911222020.xAMKKbE0017524@repo.freebsd.org> In-Reply-To: <201911222020.xAMKKbE0017524@repo.freebsd.org> Mime-version: 1.0 Content-type: text/plain; charset="UTF-8" Content-transfer-encoding: quoted-printable X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 22 Nov 2019 20:56:55 -0000 Hi Conrad, The original code did explicit_bzero(data, size); which appears to have been lost in this change. Is that intentional? If so,= why is that okay? Thanks, Ravi (rpokala@) =EF=BB=BF-----Original Message----- From: on behalf of Conrad Meyer Date: 2019-11-22, Friday at 12:20 To: , , Subject: svn commit: r355018 - in head/sys: dev/random sys Author: cem Date: Fri Nov 22 20:20:37 2019 New Revision: 355018 URL: https://svnweb.freebsd.org/changeset/base/355018 =20 Log: random(4): Abstract loader entropy injection =20 Break random_harvestq_prime up into some logical subroutines. The go= al is that it becomes easier to add other early entropy sources. =20 While here, drop pre-12.0 compatibility logic. loader default config= uration should preload the file as expeced since 12.0. =20 Approved by: csprng(delphij, markm) Differential Revision: https://reviews.freebsd.org/D22482 =20 Modified: head/sys/dev/random/random_harvestq.c head/sys/sys/random.h =20 Modified: head/sys/dev/random/random_harvestq.c =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D --- head/sys/dev/random/random_harvestq.c Fri Nov 22 20:18:07 2019 (r35= 5017) +++ head/sys/dev/random/random_harvestq.c Fri Nov 22 20:20:37 2019 (r35= 5018) @@ -402,6 +402,57 @@ random_harvestq_init(void *unused __unused) SYSINIT(random_device_h_init, SI_SUB_RANDOM, SI_ORDER_SECOND, random_h= arvestq_init, NULL); =20 /* + * Subroutine to slice up a contiguous chunk of 'entropy' and feed it = into the + * underlying algorithm. Returns number of bytes actually fed into un= derlying + * algorithm. + */ +static size_t +random_early_prime(char *entropy, size_t len) +{ + struct harvest_event event; + size_t i; + + len =3D rounddown(len, sizeof(event.he_entropy)); + if (len =3D=3D 0) + return (0); + + for (i =3D 0; i < len; i +=3D sizeof(event.he_entropy)) { + event.he_somecounter =3D (uint32_t)get_cyclecount(); + event.he_size =3D sizeof(event.he_entropy); + event.he_source =3D RANDOM_CACHED; + event.he_destination =3D + harvest_context.hc_destination[RANDOM_CACHED]++; + memcpy(event.he_entropy, entropy + i, sizeof(event.he_entropy)); + random_harvestq_fast_process_event(&event); + } + explicit_bzero(entropy, len); + return (len); +} + +/* + * Subroutine to search for known loader-loaded files in memory and fe= ed them + * into the underlying algorithm early in boot. Returns the number of= bytes + * loaded (zero if none were loaded). + */ +static size_t +random_prime_loader_file(const char *type) +{ + uint8_t *keyfile, *data; + size_t size; + + keyfile =3D preload_search_by_type(type); + if (keyfile =3D=3D NULL) + return (0); + + data =3D preload_fetch_addr(keyfile); + size =3D preload_fetch_size(keyfile); + if (data =3D=3D NULL) + return (0); + + return (random_early_prime(data, size)); +} + +/* * This is used to prime the RNG by grabbing any early random stuff * known to the kernel, and inserting it directly into the hashing * module, currently Fortuna. @@ -410,41 +461,19 @@ SYSINIT(random_device_h_init, SI_SUB_RANDOM, SI_O= RDER_ static void random_harvestq_prime(void *unused __unused) { - struct harvest_event event; - size_t count, size, i; - uint8_t *keyfile, *data; + size_t size; =20 /* * Get entropy that may have been preloaded by loader(8) * and use it to pre-charge the entropy harvest queue. */ - keyfile =3D preload_search_by_type(RANDOM_CACHED_BOOT_ENTROPY_MODULE); -#ifndef NO_BACKWARD_COMPATIBILITY - if (keyfile =3D=3D NULL) - keyfile =3D preload_search_by_type(RANDOM_LEGACY_BOOT_ENTROPY_MODUL= E); -#endif - if (keyfile !=3D NULL) { - data =3D preload_fetch_addr(keyfile); - size =3D preload_fetch_size(keyfile); - /* Trim the size. If the admin has a file with a funny size, we lose= some. Tough. */ - size -=3D (size % sizeof(event.he_entropy)); - if (data !=3D NULL && size !=3D 0) { - for (i =3D 0; i < size; i +=3D sizeof(event.he_entropy)) { - count =3D sizeof(event.he_entropy); - event.he_somecounter =3D (uint32_t)get_cyclecount(); - event.he_size =3D count; - event.he_source =3D RANDOM_CACHED; - event.he_destination =3D - harvest_context.hc_destination[RANDOM_CACHED]++; - memcpy(event.he_entropy, data + i, sizeof(event.he_entropy)); - random_harvestq_fast_process_event(&event); - } - explicit_bzero(data, size); - if (bootverbose) - printf("random: read %zu bytes from preloaded cache\n", size); - } else - if (bootverbose) - printf("random: no preloaded entropy cache\n"); + size =3D random_prime_loader_file(RANDOM_CACHED_BOOT_ENTROPY_MODULE); + if (bootverbose) { + if (size > 0) + printf("random: read %zu bytes from preloaded cache\n", + size); + else + printf("random: no preloaded entropy cache\n"); } } SYSINIT(random_device_prime, SI_SUB_RANDOM, SI_ORDER_MIDDLE, random_ha= rvestq_prime, NULL); =20 Modified: head/sys/sys/random.h =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D --- head/sys/sys/random.h Fri Nov 22 20:18:07 2019 (r355017) +++ head/sys/sys/random.h Fri Nov 22 20:20:37 2019 (r355018) @@ -81,7 +81,6 @@ enum random_entropy_source { _Static_assert(ENTROPYSOURCE <=3D 32, "hardcoded assumption that values fit in a typical word-sized bits= et"); =20 -#define RANDOM_LEGACY_BOOT_ENTROPY_MODULE "/boot/entropy" #define RANDOM_CACHED_BOOT_ENTROPY_MODULE "boot_entropy_cache" =20 extern u_int hc_source_mask; =20 From owner-svn-src-all@freebsd.org Fri Nov 22 20:57:58 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 020321C1627; Fri, 22 Nov 2019 20:57:58 +0000 (UTC) (envelope-from rpokala@freebsd.org) Received: from smtp.freebsd.org (smtp.freebsd.org [96.47.72.83]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "smtp.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47KTKK6GnKz4FWL; Fri, 22 Nov 2019 20:57:57 +0000 (UTC) (envelope-from rpokala@freebsd.org) Received: from [172.17.133.228] (unknown [12.202.168.51]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) (Authenticated sender: rpokala) by smtp.freebsd.org (Postfix) with ESMTPSA id 23B3115418; Fri, 22 Nov 2019 20:57:57 +0000 (UTC) (envelope-from rpokala@freebsd.org) User-Agent: Microsoft-MacOutlook/10.1f.0.191110 Date: Fri, 22 Nov 2019 12:57:57 -0800 Subject: Re: svn commit: r355019 - head/sbin/dhclient From: Ravi Pokala To: Dave Cottlehuber , , , Message-ID: <889BDE00-4DF2-4C78-8978-951626A61089@panasas.com> Thread-Topic: svn commit: r355019 - head/sbin/dhclient References: <201911222022.xAMKMGMD021163@repo.freebsd.org> In-Reply-To: <201911222022.xAMKMGMD021163@repo.freebsd.org> Mime-version: 1.0 Content-type: text/plain; charset="UTF-8" Content-transfer-encoding: quoted-printable X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 22 Nov 2019 20:57:58 -0000 Hi Dave, These changes are to sbin/dhclient; how does that help loader.efi? Thanks, Ravi (rpokala@) =EF=BB=BF-----Original Message----- From: on behalf of Dave Cottlehuber Date: 2019-11-22, Friday at 12:22 To: , , Subject: svn commit: r355019 - head/sbin/dhclient Author: dch (ports committer) Date: Fri Nov 22 20:22:16 2019 New Revision: 355019 URL: https://svnweb.freebsd.org/changeset/base/355019 =20 Log: dhclient: support option 114, default-url ascii =20 This will enable further automation of HTTP UEFI boot loader support = by providing a specific option for providing the boot URL to FreeBSD. =20 Documented in: =20 https://www.iana.org/assignments/bootp-dhcp-parameters/bootp-dhcp-par= ameters.xhtml https://kb.isc.org/docs/isc-dhcp-44-manual-pages-dhcp-options https://tools.ietf.org/html/rfc3679 =20 Approved by: emaste MFC after: 2 weeks Sponsored by: SkunkWerks, GmbH Differential Revision: https://reviews.freebsd.org/D22475 =20 Modified: head/sbin/dhclient/dhclient.c head/sbin/dhclient/dhcp-options.5 head/sbin/dhclient/dhcp.h head/sbin/dhclient/tables.c =20 Modified: head/sbin/dhclient/dhclient.c =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D --- head/sbin/dhclient/dhclient.c Fri Nov 22 20:20:37 2019 (r355018) +++ head/sbin/dhclient/dhclient.c Fri Nov 22 20:22:16 2019 (r355019) @@ -2601,6 +2601,7 @@ check_option(struct client_lease *l, int option) case DHO_DHCP_CLIENT_IDENTIFIER: case DHO_BOOTFILE_NAME: case DHO_DHCP_USER_CLASS_ID: + case DHO_URL: case DHO_END: return (1); case DHO_CLASSLESS_ROUTES: =20 Modified: head/sbin/dhclient/dhcp-options.5 =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D --- head/sbin/dhclient/dhcp-options.5 Fri Nov 22 20:20:37 2019 (r355018= ) +++ head/sbin/dhclient/dhcp-options.5 Fri Nov 22 20:22:16 2019 (r355019= ) @@ -587,6 +587,9 @@ Servers should be listed in order of preference. The StreetTalk Directory Assistance (STDA) server option specifies a list of STDA servers available to the client. Servers should be listed in order of preference. +.It Ic option url Ar string ; +This option specifies the URL that the client may use when using UEFI +boot from a HTTP server. .El .Sh SEE ALSO .Xr dhclient.conf 5 , @@ -595,7 +598,7 @@ Servers should be listed in order of preference. .Xr dhclient 8 , .Xr dhcpd 8 .Rs -.%R "RFC 2131, RFC 2132" +.%R "RFC 2131, RFC 2132, RFC 3769" .Re .Sh AUTHORS .An -nosplit =20 Modified: head/sbin/dhclient/dhcp.h =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D --- head/sbin/dhclient/dhcp.h Fri Nov 22 20:20:37 2019 (r355018) +++ head/sbin/dhclient/dhcp.h Fri Nov 22 20:22:16 2019 (r355019) @@ -171,6 +171,7 @@ struct dhcp_packet { #define DHO_STREETTALK_SERVER 75 #define DHO_STREETTALK_DA_SERVER 76 #define DHO_DHCP_USER_CLASS_ID 77 +#define DHO_URL 114 #define DHO_DOMAIN_SEARCH 119 #define DHO_CLASSLESS_ROUTES 121 #define DHO_END 255 =20 Modified: head/sbin/dhclient/tables.c =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D --- head/sbin/dhclient/tables.c Fri Nov 22 20:20:37 2019 (r355018) +++ head/sbin/dhclient/tables.c Fri Nov 22 20:22:16 2019 (r355019) @@ -181,7 +181,7 @@ struct option dhcp_options[256] =3D { { "option-111", "X", &dhcp_universe, 111 }, { "option-112", "X", &dhcp_universe, 112 }, { "option-113", "X", &dhcp_universe, 113 }, - { "option-114", "X", &dhcp_universe, 114 }, + { "url", "t", &dhcp_universe, 114 }, { "option-115", "X", &dhcp_universe, 115 }, { "option-116", "X", &dhcp_universe, 116 }, { "option-117", "X", &dhcp_universe, 117 }, @@ -404,11 +404,12 @@ unsigned char dhcp_option_default_priority_list[]= =3D { DHO_STREETTALK_DA_SERVER, DHO_DHCP_USER_CLASS_ID, DHO_DOMAIN_SEARCH, + DHO_URL, =20 /* Presently-undefined options... */ 62, 63, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, - 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, + 106, 107, 108, 109, 110, 111, 112, 113, 115, 116, 117, 118, 120, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, =20 From owner-svn-src-all@freebsd.org Fri Nov 22 21:07:24 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id F34FE1C1907; Fri, 22 Nov 2019 21:07:24 +0000 (UTC) (envelope-from cse.cem@gmail.com) Received: from mail-ot1-f42.google.com (mail-ot1-f42.google.com [209.85.210.42]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47KTXD6B83z4G2Q; Fri, 22 Nov 2019 21:07:24 +0000 (UTC) (envelope-from cse.cem@gmail.com) Received: by mail-ot1-f42.google.com with SMTP id c19so7368249otr.11; Fri, 22 Nov 2019 13:07:24 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:reply-to :from:date:message-id:subject:to:cc:content-transfer-encoding; bh=h2JuILx+qaWTJFsWqiy2eaik2RRQGVThzHDlEk4AZpo=; b=RHxqlppXi+jklbCpL8r46XdHIkFoEIF9kMmCtSgUw1YzRmKw8aQFICvV4Sk/ThjV1m 6zlyIukmSJWT6WPHG/4Py6cuOBOiJM/3CJCelllt/nzMhVzkTDXX5gvyUl5RHjL5oiFi WHntqiA3f/Iw5Rt+7Rjmc9ujBZzZcehy3OOU7eVZcAplwMiNOc6cyouDUbkXAJTiTSCK ElsCRIGmR7WqSr/YzWlJzXt3R+srrpjWX5AeiByumi7j5NMcdZR5amyUEgRISJzAXZGi kInmIFP109f5cI2HgGBhLyNNJyPZpkewipZ/CfReO0NYnROuDGYdRxh7U+/UuOBBObn6 bjJg== X-Gm-Message-State: APjAAAUoZiaNnpLH2FJyAYUdHhIscI+s09AbFN3s/cHGoRNd2h6FYWse THblU3JrrPlEPGb4K0GHGXgLglya X-Google-Smtp-Source: APXvYqyj4qpGhVNnQHrf2t0/G6KQ+2YqmKi5mwJIT0pQrmOghxT9av7SpJyIB9WESpQqvZDQ8AI94Q== X-Received: by 2002:a9d:1c9a:: with SMTP id l26mr11687305ota.1.1574456842884; Fri, 22 Nov 2019 13:07:22 -0800 (PST) Received: from mail-oi1-f181.google.com (mail-oi1-f181.google.com. [209.85.167.181]) by smtp.gmail.com with ESMTPSA id m205sm2426492oif.10.2019.11.22.13.07.22 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 22 Nov 2019 13:07:22 -0800 (PST) Received: by mail-oi1-f181.google.com with SMTP id y194so7766158oie.4; Fri, 22 Nov 2019 13:07:22 -0800 (PST) X-Received: by 2002:aca:1e02:: with SMTP id m2mr14117150oic.81.1574456842468; Fri, 22 Nov 2019 13:07:22 -0800 (PST) MIME-Version: 1.0 References: <201911222020.xAMKKbE0017524@repo.freebsd.org> <85EFA1CD-5093-4588-9FA4-F704DA122674@panasas.com> In-Reply-To: <85EFA1CD-5093-4588-9FA4-F704DA122674@panasas.com> Reply-To: cem@freebsd.org From: Conrad Meyer Date: Fri, 22 Nov 2019 13:07:11 -0800 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: svn commit: r355018 - in head/sys: dev/random sys To: Ravi Pokala Cc: src-committers , svn-src-all , svn-src-head Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Rspamd-Queue-Id: 47KTXD6B83z4G2Q X-Spamd-Bar: ----- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-6.00 / 15.00]; NEURAL_HAM_MEDIUM(-1.00)[-0.999,0]; NEURAL_HAM_LONG(-1.00)[-0.999,0]; REPLY(-4.00)[]; TAGGED_FROM(0.00)[] X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 22 Nov 2019 21:07:25 -0000 It wasn't lost in the change. The parameters now have the names "entropy" and "len," but it is the same functionality. Best, Conrad On Fri, Nov 22, 2019 at 12:56 PM Ravi Pokala wrote: > > Hi Conrad, > > The original code did > > explicit_bzero(data, size); > > which appears to have been lost in this change. Is that intentional? If s= o, why is that okay? > > Thanks, > > Ravi (rpokala@) > > =EF=BB=BF-----Original Message----- > From: on behalf of Conrad Meyer > Date: 2019-11-22, Friday at 12:20 > To: , , > Subject: svn commit: r355018 - in head/sys: dev/random sys > > Author: cem > Date: Fri Nov 22 20:20:37 2019 > New Revision: 355018 > URL: https://svnweb.freebsd.org/changeset/base/355018 > > Log: > random(4): Abstract loader entropy injection > > Break random_harvestq_prime up into some logical subroutines. The = goal > is that it becomes easier to add other early entropy sources. > > While here, drop pre-12.0 compatibility logic. loader default conf= iguration > should preload the file as expeced since 12.0. > > Approved by: csprng(delphij, markm) > Differential Revision: https://reviews.freebsd.org/D22482 > > Modified: > head/sys/dev/random/random_harvestq.c > head/sys/sys/random.h > > Modified: head/sys/dev/random/random_harvestq.c > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D > --- head/sys/dev/random/random_harvestq.c Fri Nov 22 20:18:07 2019 = (r355017) > +++ head/sys/dev/random/random_harvestq.c Fri Nov 22 20:20:37 2019 = (r355018) > @@ -402,6 +402,57 @@ random_harvestq_init(void *unused __unused) > SYSINIT(random_device_h_init, SI_SUB_RANDOM, SI_ORDER_SECOND, random= _harvestq_init, NULL); > > /* > + * Subroutine to slice up a contiguous chunk of 'entropy' and feed i= t into the > + * underlying algorithm. Returns number of bytes actually fed into = underlying > + * algorithm. > + */ > +static size_t > +random_early_prime(char *entropy, size_t len) > +{ > + struct harvest_event event; > + size_t i; > + > + len =3D rounddown(len, sizeof(event.he_entropy)); > + if (len =3D=3D 0) > + return (0); > + > + for (i =3D 0; i < len; i +=3D sizeof(event.he_entropy)) { > + event.he_somecounter =3D (uint32_t)get_cyclecount(); > + event.he_size =3D sizeof(event.he_entropy); > + event.he_source =3D RANDOM_CACHED; > + event.he_destination =3D > + harvest_context.hc_destination[RANDOM_CACHED]++; > + memcpy(event.he_entropy, entropy + i, sizeof(event.he_ent= ropy)); > + random_harvestq_fast_process_event(&event); > + } > + explicit_bzero(entropy, len); > + return (len); > +} > + > +/* > + * Subroutine to search for known loader-loaded files in memory and = feed them > + * into the underlying algorithm early in boot. Returns the number = of bytes > + * loaded (zero if none were loaded). > + */ > +static size_t > +random_prime_loader_file(const char *type) > +{ > + uint8_t *keyfile, *data; > + size_t size; > + > + keyfile =3D preload_search_by_type(type); > + if (keyfile =3D=3D NULL) > + return (0); > + > + data =3D preload_fetch_addr(keyfile); > + size =3D preload_fetch_size(keyfile); > + if (data =3D=3D NULL) > + return (0); > + > + return (random_early_prime(data, size)); > +} > + > +/* > * This is used to prime the RNG by grabbing any early random stuff > * known to the kernel, and inserting it directly into the hashing > * module, currently Fortuna. > @@ -410,41 +461,19 @@ SYSINIT(random_device_h_init, SI_SUB_RANDOM, SI= _ORDER_ > static void > random_harvestq_prime(void *unused __unused) > { > - struct harvest_event event; > - size_t count, size, i; > - uint8_t *keyfile, *data; > + size_t size; > > /* > * Get entropy that may have been preloaded by loader(8) > * and use it to pre-charge the entropy harvest queue. > */ > - keyfile =3D preload_search_by_type(RANDOM_CACHED_BOOT_ENTROPY_MOD= ULE); > -#ifndef NO_BACKWARD_COMPATIBILITY > - if (keyfile =3D=3D NULL) > - keyfile =3D preload_search_by_type(RANDOM_LEGACY_BOOT_ENTROPY= _MODULE); > -#endif > - if (keyfile !=3D NULL) { > - data =3D preload_fetch_addr(keyfile); > - size =3D preload_fetch_size(keyfile); > - /* Trim the size. If the admin has a file with a funny si= ze, we lose some. Tough. */ > - size -=3D (size % sizeof(event.he_entropy)); > - if (data !=3D NULL && size !=3D 0) { > - for (i =3D 0; i < size; i +=3D sizeof(event.he_en= tropy)) { > - count =3D sizeof(event.he_entropy); > - event.he_somecounter =3D (uint32_t)get_cy= clecount(); > - event.he_size =3D count; > - event.he_source =3D RANDOM_CACHED; > - event.he_destination =3D > - harvest_context.hc_destination[RANDOM= _CACHED]++; > - memcpy(event.he_entropy, data + i, sizeof= (event.he_entropy)); > - random_harvestq_fast_process_event(&event= ); > - } > - explicit_bzero(data, size); > - if (bootverbose) > - printf("random: read %zu bytes from prelo= aded cache\n", size); > - } else > - if (bootverbose) > - printf("random: no preloaded entropy cach= e\n"); > + size =3D random_prime_loader_file(RANDOM_CACHED_BOOT_ENTROPY_MODU= LE); > + if (bootverbose) { > + if (size > 0) > + printf("random: read %zu bytes from preloaded cac= he\n", > + size); > + else > + printf("random: no preloaded entropy cache\n"); > } > } > SYSINIT(random_device_prime, SI_SUB_RANDOM, SI_ORDER_MIDDLE, random_= harvestq_prime, NULL); > > Modified: head/sys/sys/random.h > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D > --- head/sys/sys/random.h Fri Nov 22 20:18:07 2019 (r355017) > +++ head/sys/sys/random.h Fri Nov 22 20:20:37 2019 (r355018) > @@ -81,7 +81,6 @@ enum random_entropy_source { > _Static_assert(ENTROPYSOURCE <=3D 32, > "hardcoded assumption that values fit in a typical word-sized bi= tset"); > > -#define RANDOM_LEGACY_BOOT_ENTROPY_MODULE "/boot/entropy" > #define RANDOM_CACHED_BOOT_ENTROPY_MODULE "boot_entropy_cache" > > extern u_int hc_source_mask; > > > From owner-svn-src-all@freebsd.org Fri Nov 22 21:21:38 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 6458F1C1E63; Fri, 22 Nov 2019 21:21:38 +0000 (UTC) (envelope-from rpokala@freebsd.org) Received: from smtp.freebsd.org (smtp.freebsd.org [IPv6:2610:1c1:1:606c::24b:4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "smtp.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47KTrf23W3z4GmC; Fri, 22 Nov 2019 21:21:38 +0000 (UTC) (envelope-from rpokala@freebsd.org) Received: from [172.17.133.228] (unknown [12.202.168.51]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) (Authenticated sender: rpokala) by smtp.freebsd.org (Postfix) with ESMTPSA id A4AAE15782; Fri, 22 Nov 2019 21:21:37 +0000 (UTC) (envelope-from rpokala@freebsd.org) User-Agent: Microsoft-MacOutlook/10.1f.0.191110 Date: Fri, 22 Nov 2019 13:21:33 -0800 Subject: Re: svn commit: r355018 - in head/sys: dev/random sys From: Ravi Pokala To: CC: src-committers , svn-src-all , svn-src-head Message-ID: <8E53796F-8021-43BC-BC45-A8B1026B36AA@panasas.com> Thread-Topic: svn commit: r355018 - in head/sys: dev/random sys References: <201911222020.xAMKKbE0017524@repo.freebsd.org> <85EFA1CD-5093-4588-9FA4-F704DA122674@panasas.com> In-Reply-To: Mime-version: 1.0 Content-type: text/plain; charset="UTF-8" Content-transfer-encoding: quoted-printable X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 22 Nov 2019 21:21:38 -0000 -----Original Message----- From: Conrad Meyer Reply-To: Date: 2019-11-22, Friday at 13:07 To: Ravi Pokala Cc: src-committers , svn-src-all , svn-src-head Subject: Re: svn commit: r355018 - in head/sys: dev/random sys It wasn't lost in the change. The parameters now have the names "entropy" and "len," but it is the same functionality. I really need to get new glasses... -Ravi (rpokala@) Best, Conrad =20 On Fri, Nov 22, 2019 at 12:56 PM Ravi Pokala wrot= e: > > Hi Conrad, > > The original code did > > explicit_bzero(data, size); > > which appears to have been lost in this change. Is that intentional? = If so, why is that okay? > > Thanks, > > Ravi (rpokala@) > > =EF=BB=BF-----Original Message----- > From: on behalf of Conrad Meyer > Date: 2019-11-22, Friday at 12:20 > To: , , > Subject: svn commit: r355018 - in head/sys: dev/random sys > > Author: cem > Date: Fri Nov 22 20:20:37 2019 > New Revision: 355018 > URL: https://svnweb.freebsd.org/changeset/base/355018 > > Log: > random(4): Abstract loader entropy injection > > Break random_harvestq_prime up into some logical subroutines. = The goal > is that it becomes easier to add other early entropy sources. > > While here, drop pre-12.0 compatibility logic. loader default = configuration > should preload the file as expeced since 12.0. > > Approved by: csprng(delphij, markm) > Differential Revision: https://reviews.freebsd.org/D22482 > > Modified: > head/sys/dev/random/random_harvestq.c > head/sys/sys/random.h > > Modified: head/sys/dev/random/random_harvestq.c > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D > --- head/sys/dev/random/random_harvestq.c Fri Nov 22 20:18:07 2= 019 (r355017) > +++ head/sys/dev/random/random_harvestq.c Fri Nov 22 20:20:37 2= 019 (r355018) > @@ -402,6 +402,57 @@ random_harvestq_init(void *unused __unused) > SYSINIT(random_device_h_init, SI_SUB_RANDOM, SI_ORDER_SECOND, ra= ndom_harvestq_init, NULL); > > /* > + * Subroutine to slice up a contiguous chunk of 'entropy' and fe= ed it into the > + * underlying algorithm. Returns number of bytes actually fed i= nto underlying > + * algorithm. > + */ > +static size_t > +random_early_prime(char *entropy, size_t len) > +{ > + struct harvest_event event; > + size_t i; > + > + len =3D rounddown(len, sizeof(event.he_entropy)); > + if (len =3D=3D 0) > + return (0); > + > + for (i =3D 0; i < len; i +=3D sizeof(event.he_entropy)) { > + event.he_somecounter =3D (uint32_t)get_cyclecount(); > + event.he_size =3D sizeof(event.he_entropy); > + event.he_source =3D RANDOM_CACHED; > + event.he_destination =3D > + harvest_context.hc_destination[RANDOM_CACHED]++; > + memcpy(event.he_entropy, entropy + i, sizeof(event.he= _entropy)); > + random_harvestq_fast_process_event(&event); > + } > + explicit_bzero(entropy, len); > + return (len); > +} > + > +/* > + * Subroutine to search for known loader-loaded files in memory = and feed them > + * into the underlying algorithm early in boot. Returns the num= ber of bytes > + * loaded (zero if none were loaded). > + */ > +static size_t > +random_prime_loader_file(const char *type) > +{ > + uint8_t *keyfile, *data; > + size_t size; > + > + keyfile =3D preload_search_by_type(type); > + if (keyfile =3D=3D NULL) > + return (0); > + > + data =3D preload_fetch_addr(keyfile); > + size =3D preload_fetch_size(keyfile); > + if (data =3D=3D NULL) > + return (0); > + > + return (random_early_prime(data, size)); > +} > + > +/* > * This is used to prime the RNG by grabbing any early random st= uff > * known to the kernel, and inserting it directly into the hashi= ng > * module, currently Fortuna. > @@ -410,41 +461,19 @@ SYSINIT(random_device_h_init, SI_SUB_RANDOM= , SI_ORDER_ > static void > random_harvestq_prime(void *unused __unused) > { > - struct harvest_event event; > - size_t count, size, i; > - uint8_t *keyfile, *data; > + size_t size; > > /* > * Get entropy that may have been preloaded by loader(8) > * and use it to pre-charge the entropy harvest queue. > */ > - keyfile =3D preload_search_by_type(RANDOM_CACHED_BOOT_ENTROPY_M= ODULE); > -#ifndef NO_BACKWARD_COMPATIBILITY > - if (keyfile =3D=3D NULL) > - keyfile =3D preload_search_by_type(RANDOM_LEGACY_BOOT_ENTRO= PY_MODULE); > -#endif > - if (keyfile !=3D NULL) { > - data =3D preload_fetch_addr(keyfile); > - size =3D preload_fetch_size(keyfile); > - /* Trim the size. If the admin has a file with a funn= y size, we lose some. Tough. */ > - size -=3D (size % sizeof(event.he_entropy)); > - if (data !=3D NULL && size !=3D 0) { > - for (i =3D 0; i < size; i +=3D sizeof(event.he_en= tropy)) { > - count =3D sizeof(event.he_entropy); > - event.he_somecounter =3D (uint32_t)get_= cyclecount(); > - event.he_size =3D count; > - event.he_source =3D RANDOM_CACHED; > - event.he_destination =3D > - harvest_context.hc_destination[RA= NDOM_CACHED]++; > - memcpy(event.he_entropy, data + i, si= zeof(event.he_entropy)); > - random_harvestq_fast_process_event(&e= vent); > - } > - explicit_bzero(data, size); > - if (bootverbose) > - printf("random: read %zu bytes from p= reloaded cache\n", size); > - } else > - if (bootverbose) > - printf("random: no preloaded entropy = cache\n"); > + size =3D random_prime_loader_file(RANDOM_CACHED_BOOT_ENTROPY_MO= DULE); > + if (bootverbose) { > + if (size > 0) > + printf("random: read %zu bytes from preloaded= cache\n", > + size); > + else > + printf("random: no preloaded entropy cache\n"= ); > } > } > SYSINIT(random_device_prime, SI_SUB_RANDOM, SI_ORDER_MIDDLE, ran= dom_harvestq_prime, NULL); > > Modified: head/sys/sys/random.h > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D > --- head/sys/sys/random.h Fri Nov 22 20:18:07 2019 (r355= 017) > +++ head/sys/sys/random.h Fri Nov 22 20:20:37 2019 (r355= 018) > @@ -81,7 +81,6 @@ enum random_entropy_source { > _Static_assert(ENTROPYSOURCE <=3D 32, > "hardcoded assumption that values fit in a typical word-size= d bitset"); > > -#define RANDOM_LEGACY_BOOT_ENTROPY_MODULE "/boot/entropy" > #define RANDOM_CACHED_BOOT_ENTROPY_MODULE "boot_entropy_cache" > > extern u_int hc_source_mask; > > > =20 From owner-svn-src-all@freebsd.org Fri Nov 22 21:32:00 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 4437F1C2692; Fri, 22 Nov 2019 21:32:00 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47KV4c0nfSz4HnC; Fri, 22 Nov 2019 21:32:00 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id F1B2B1A93; Fri, 22 Nov 2019 21:31:59 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xAMLVxts059634; Fri, 22 Nov 2019 21:31:59 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xAMLVxnn059632; Fri, 22 Nov 2019 21:31:59 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201911222131.xAMLVxnn059632@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Fri, 22 Nov 2019 21:31:59 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r355023 - head/sys/cam X-SVN-Group: head X-SVN-Commit-Author: mav X-SVN-Commit-Paths: head/sys/cam X-SVN-Commit-Revision: 355023 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 22 Nov 2019 21:32:00 -0000 Author: mav Date: Fri Nov 22 21:31:59 2019 New Revision: 355023 URL: https://svnweb.freebsd.org/changeset/base/355023 Log: Do not retry long ready waits if previous gave nothing. I have some disks reporting "Logical unit is in process of becoming ready" for about half an hour before finally reporting failure. During that time CAM waits for the readiness during ~2 minutes for each request, that makes system boot take very long time. This change reduces wait times for the following requests to ~1 second if previously long wait for that device has timed out. MFC after: 2 weeks Sponsored by: iXsystems, Inc. Modified: head/sys/cam/cam_periph.c head/sys/cam/cam_periph.h Modified: head/sys/cam/cam_periph.c ============================================================================== --- head/sys/cam/cam_periph.c Fri Nov 22 20:24:15 2019 (r355022) +++ head/sys/cam/cam_periph.c Fri Nov 22 21:31:59 2019 (r355023) @@ -1428,6 +1428,14 @@ camperiphdone(struct cam_periph *periph, union ccb *do xpt_async(AC_INQ_CHANGED, done_ccb->ccb_h.path, NULL); } + /* If we tried long wait and still failed, remember that. */ + if ((periph->flags & CAM_PERIPH_RECOVERY_WAIT) && + (done_ccb->csio.cdb_io.cdb_bytes[0] == TEST_UNIT_READY)) { + periph->flags &= ~CAM_PERIPH_RECOVERY_WAIT; + if (error != 0 && done_ccb->ccb_h.retry_count == 0) + periph->flags |= CAM_PERIPH_RECOVERY_WAIT_FAILED; + } + /* * After recovery action(s) completed, return to the original CCB. * If the recovery CCB has failed, considering its own possible @@ -1783,7 +1791,9 @@ camperiphscsisenseerror(union ccb *ccb, union ccb **or */ int retries; - if ((err_action & SSQ_MANY) != 0) { + if ((err_action & SSQ_MANY) != 0 && (periph->flags & + CAM_PERIPH_RECOVERY_WAIT_FAILED) == 0) { + periph->flags |= CAM_PERIPH_RECOVERY_WAIT; *action_string = "Polling device for readiness"; retries = 120; } else { Modified: head/sys/cam/cam_periph.h ============================================================================== --- head/sys/cam/cam_periph.h Fri Nov 22 20:24:15 2019 (r355022) +++ head/sys/cam/cam_periph.h Fri Nov 22 21:31:59 2019 (r355023) @@ -134,6 +134,8 @@ struct cam_periph { #define CAM_PERIPH_RUN_TASK 0x40 #define CAM_PERIPH_FREE 0x80 #define CAM_PERIPH_ANNOUNCED 0x100 +#define CAM_PERIPH_RECOVERY_WAIT 0x200 +#define CAM_PERIPH_RECOVERY_WAIT_FAILED 0x400 uint32_t scheduled_priority; uint32_t immediate_priority; int periph_allocating; From owner-svn-src-all@freebsd.org Fri Nov 22 23:23:41 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id EB0D41C4450; Fri, 22 Nov 2019 23:23:41 +0000 (UTC) (envelope-from cem@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47KXYT5vf5z4Myb; Fri, 22 Nov 2019 23:23:41 +0000 (UTC) (envelope-from cem@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id AF3B62F2E; Fri, 22 Nov 2019 23:23:41 +0000 (UTC) (envelope-from cem@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xAMNNfPx027345; Fri, 22 Nov 2019 23:23:41 GMT (envelope-from cem@FreeBSD.org) Received: (from cem@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xAMNNfwi027342; Fri, 22 Nov 2019 23:23:41 GMT (envelope-from cem@FreeBSD.org) Message-Id: <201911222323.xAMNNfwi027342@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: cem set sender to cem@FreeBSD.org using -f From: Conrad Meyer Date: Fri, 22 Nov 2019 23:23:41 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r355024 - in head/sys: kern net sys X-SVN-Group: head X-SVN-Commit-Author: cem X-SVN-Commit-Paths: in head/sys: kern net sys X-SVN-Commit-Revision: 355024 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 22 Nov 2019 23:23:42 -0000 Author: cem Date: Fri Nov 22 23:23:40 2019 New Revision: 355024 URL: https://svnweb.freebsd.org/changeset/base/355024 Log: Add explicit SI_SUB_EPOCH Add explicit SI_SUB_EPOCH, after SI_SUB_TASKQ and before SI_SUB_SMP (EARLY_AP_STARTUP). Rename existing "SI_SUB_TASKQ + 1" to SI_SUB_EPOCH. epoch(9) consumers cannot epoch_alloc() before SI_SUB_EPOCH:SI_ORDER_SECOND, but likely should allocate before SI_SUB_SMP. Prior to this change, consumers (well, epoch itself, and net/if.c) just open-coded the SI_SUB_TASKQ + 1 order to match epoch.c, but this was fragile. Reviewed by: mmacy Differential Revision: https://reviews.freebsd.org/D22503 Modified: head/sys/kern/subr_epoch.c head/sys/net/if.c head/sys/sys/kernel.h Modified: head/sys/kern/subr_epoch.c ============================================================================== --- head/sys/kern/subr_epoch.c Fri Nov 22 21:31:59 2019 (r355023) +++ head/sys/kern/subr_epoch.c Fri Nov 22 23:23:40 2019 (r355024) @@ -276,7 +276,7 @@ epoch_init(void *arg __unused) global_epoch = epoch_alloc("Global", 0); global_epoch_preempt = epoch_alloc("Global preemptible", EPOCH_PREEMPT); } -SYSINIT(epoch, SI_SUB_TASKQ + 1, SI_ORDER_FIRST, epoch_init, NULL); +SYSINIT(epoch, SI_SUB_EPOCH, SI_ORDER_FIRST, epoch_init, NULL); #if !defined(EARLY_AP_STARTUP) static void Modified: head/sys/net/if.c ============================================================================== --- head/sys/net/if.c Fri Nov 22 21:31:59 2019 (r355023) +++ head/sys/net/if.c Fri Nov 22 23:23:40 2019 (r355024) @@ -933,8 +933,7 @@ if_epochalloc(void *dummy __unused) net_epoch_preempt = epoch_alloc("Net preemptible", EPOCH_PREEMPT); net_epoch = epoch_alloc("Net", 0); } -SYSINIT(ifepochalloc, SI_SUB_TASKQ + 1, SI_ORDER_ANY, - if_epochalloc, NULL); +SYSINIT(ifepochalloc, SI_SUB_EPOCH, SI_ORDER_ANY, if_epochalloc, NULL); static void if_attachdomain(void *dummy) Modified: head/sys/sys/kernel.h ============================================================================== --- head/sys/sys/kernel.h Fri Nov 22 21:31:59 2019 (r355023) +++ head/sys/sys/kernel.h Fri Nov 22 23:23:40 2019 (r355024) @@ -124,6 +124,7 @@ enum sysinit_sub_id { SI_SUB_MBUF = 0x2700000, /* mbuf subsystem */ SI_SUB_INTR = 0x2800000, /* interrupt threads */ SI_SUB_TASKQ = 0x2880000, /* task queues */ + SI_SUB_EPOCH = 0x2888000, /* epoch subsystem */ #ifdef EARLY_AP_STARTUP SI_SUB_SMP = 0x2900000, /* start the APs*/ #endif From owner-svn-src-all@freebsd.org Sat Nov 23 01:46:03 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 66C031C6796; Sat, 23 Nov 2019 01:46:03 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47Kbjl1qPkz4SqG; Sat, 23 Nov 2019 01:46:03 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 1E3904A9F; Sat, 23 Nov 2019 01:46:03 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xAN1k2CD010385; Sat, 23 Nov 2019 01:46:02 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xAN1k240010383; Sat, 23 Nov 2019 01:46:02 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201911230146.xAN1k240010383@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Sat, 23 Nov 2019 01:46:02 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r355025 - head/sys/arm/broadcom/bcm2835 X-SVN-Group: head X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: head/sys/arm/broadcom/bcm2835 X-SVN-Commit-Revision: 355025 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 23 Nov 2019 01:46:03 -0000 Author: kevans Date: Sat Nov 23 01:46:02 2019 New Revision: 355025 URL: https://svnweb.freebsd.org/changeset/base/355025 Log: bcm2835_sdhci: "fix" DMA on the RPi 4 According to the documentation I have, DREQ pacing should be required here. The DREQ# hasn't changed since the BCM2835. As soon as we attempt to setup DREQ, DMA stalls and there's no clear reason why as of yet. Setting this back to NONE seems to work just as well, though it's yet to be determined if this is a sustainable model in high-throughput scenarios. Modified: head/sys/arm/broadcom/bcm2835/bcm2835_dma.h head/sys/arm/broadcom/bcm2835/bcm2835_sdhci.c Modified: head/sys/arm/broadcom/bcm2835/bcm2835_dma.h ============================================================================== --- head/sys/arm/broadcom/bcm2835/bcm2835_dma.h Fri Nov 22 23:23:40 2019 (r355024) +++ head/sys/arm/broadcom/bcm2835/bcm2835_dma.h Sat Nov 23 01:46:02 2019 (r355025) @@ -42,6 +42,10 @@ /* Peripheral DREQ Signals (4.2.1.3) */ #define BCM_DMA_DREQ_NONE 0 +/* + * XXX This doesn't seem to work for the Raspberry Pi 4, but the peripheral + * documentation still lists it at 11. + */ #define BCM_DMA_DREQ_EMMC 11 #define BCM_DMA_DREQ_SDHOST 13 Modified: head/sys/arm/broadcom/bcm2835/bcm2835_sdhci.c ============================================================================== --- head/sys/arm/broadcom/bcm2835/bcm2835_sdhci.c Fri Nov 22 23:23:40 2019 (r355024) +++ head/sys/arm/broadcom/bcm2835/bcm2835_sdhci.c Sat Nov 23 01:46:02 2019 (r355025) @@ -114,6 +114,7 @@ struct bcm_mmc_conf { int default_freq; int quirks; bool use_dma; + int emmc_dreq; }; struct bcm_mmc_conf bcm2835_sdhci_conf = { @@ -124,6 +125,7 @@ struct bcm_mmc_conf bcm2835_sdhci_conf = { SDHCI_QUIRK_BROKEN_TIMEOUT_VAL | SDHCI_QUIRK_DONT_SET_HISPD_BIT | SDHCI_QUIRK_MISSING_CAPS, .use_dma = true + .emmc_dreq = BCM_DMA_DREQ_EMMC, }; struct bcm_mmc_conf bcm2838_emmc2_conf = { @@ -131,8 +133,8 @@ struct bcm_mmc_conf bcm2838_emmc2_conf = { .clock_src = -1, .default_freq = BCM2838_DEFAULT_SDHCI_FREQ, .quirks = 0, - /* XXX DMA is currently broken, but it shouldn't be. */ - .use_dma = false + .use_dma = true + .emmc_dreq = BCM_DMA_DREQ_NONE, }; static struct ofw_compat_data compat_data[] = { @@ -555,7 +557,11 @@ bcm_sdhci_start_dma_seg(struct bcm_sdhci_softc *sc) width = (len & 0xf ? BCM_DMA_32BIT : BCM_DMA_128BIT); if (slot->curcmd->data->flags & MMC_DATA_READ) { - bcm_dma_setup_src(sc->sc_dma_ch, BCM_DMA_DREQ_EMMC, + /* + * Peripherals on the AXI bus do not need DREQ pacing for reads + * from the ARM core, so we can safely set this to NONE. + */ + bcm_dma_setup_src(sc->sc_dma_ch, BCM_DMA_DREQ_NONE, BCM_DMA_SAME_ADDR, BCM_DMA_32BIT); bcm_dma_setup_dst(sc->sc_dma_ch, BCM_DMA_DREQ_NONE, BCM_DMA_INC_ADDR, width); @@ -563,9 +569,13 @@ bcm_sdhci_start_dma_seg(struct bcm_sdhci_softc *sc) pdst = sc->dmamap_seg_addrs[idx]; sync_op = BUS_DMASYNC_PREREAD; } else { + /* + * The ordering here is important, because the last write to + * dst/src in the dma control block writes the real dreq value. + */ bcm_dma_setup_src(sc->sc_dma_ch, BCM_DMA_DREQ_NONE, BCM_DMA_INC_ADDR, width); - bcm_dma_setup_dst(sc->sc_dma_ch, BCM_DMA_DREQ_EMMC, + bcm_dma_setup_dst(sc->sc_dma_ch, sc->conf->emmc_dreq, BCM_DMA_SAME_ADDR, BCM_DMA_32BIT); psrc = sc->dmamap_seg_addrs[idx]; pdst = sc->sc_sdhci_buffer_phys; From owner-svn-src-all@freebsd.org Sat Nov 23 01:47:18 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 69F4B1C6923; Sat, 23 Nov 2019 01:47:18 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47KblB2DJMz4T1f; Sat, 23 Nov 2019 01:47:18 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 2F3CC4AA2; Sat, 23 Nov 2019 01:47:18 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xAN1lH91010478; Sat, 23 Nov 2019 01:47:17 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xAN1lHka010477; Sat, 23 Nov 2019 01:47:17 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201911230147.xAN1lHka010477@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Sat, 23 Nov 2019 01:47:17 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r355026 - head/sys/arm/broadcom/bcm2835 X-SVN-Group: head X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: head/sys/arm/broadcom/bcm2835 X-SVN-Commit-Revision: 355026 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 23 Nov 2019 01:47:18 -0000 Author: kevans Date: Sat Nov 23 01:47:17 2019 New Revision: 355026 URL: https://svnweb.freebsd.org/changeset/base/355026 Log: bcm2835_dma: rip out the "use_dma" flag, make it non-optional Now that it works for the Raspberry Pi 4, we can discontinue our workarounds that were put in place to at least get a bootable kernel for other testing. Modified: head/sys/arm/broadcom/bcm2835/bcm2835_sdhci.c Modified: head/sys/arm/broadcom/bcm2835/bcm2835_sdhci.c ============================================================================== --- head/sys/arm/broadcom/bcm2835/bcm2835_sdhci.c Sat Nov 23 01:46:02 2019 (r355025) +++ head/sys/arm/broadcom/bcm2835/bcm2835_sdhci.c Sat Nov 23 01:47:17 2019 (r355026) @@ -113,7 +113,6 @@ struct bcm_mmc_conf { int clock_src; int default_freq; int quirks; - bool use_dma; int emmc_dreq; }; @@ -124,7 +123,6 @@ struct bcm_mmc_conf bcm2835_sdhci_conf = { .quirks = SDHCI_QUIRK_DATA_TIMEOUT_USES_SDCLK | SDHCI_QUIRK_BROKEN_TIMEOUT_VAL | SDHCI_QUIRK_DONT_SET_HISPD_BIT | SDHCI_QUIRK_MISSING_CAPS, - .use_dma = true .emmc_dreq = BCM_DMA_DREQ_EMMC, }; @@ -133,7 +131,6 @@ struct bcm_mmc_conf bcm2838_emmc2_conf = { .clock_src = -1, .default_freq = BCM2838_DEFAULT_SDHCI_FREQ, .quirks = 0, - .use_dma = true .emmc_dreq = BCM_DMA_DREQ_NONE, }; @@ -319,37 +316,35 @@ bcm_sdhci_attach(device_t dev) sdhci_init_slot(dev, &sc->sc_slot, 0); - if (sc->conf->use_dma) { - sc->sc_dma_ch = bcm_dma_allocate(BCM_DMA_CH_ANY); - if (sc->sc_dma_ch == BCM_DMA_CH_INVALID) - goto fail; + sc->sc_dma_ch = bcm_dma_allocate(BCM_DMA_CH_ANY); + if (sc->sc_dma_ch == BCM_DMA_CH_INVALID) + goto fail; - err = bcm_dma_setup_intr(sc->sc_dma_ch, bcm_sdhci_dma_intr, sc); - if (err != 0) { - device_printf(dev, - "cannot setup dma interrupt handler\n"); - err = ENXIO; - goto fail; - } + err = bcm_dma_setup_intr(sc->sc_dma_ch, bcm_sdhci_dma_intr, sc); + if (err != 0) { + device_printf(dev, + "cannot setup dma interrupt handler\n"); + err = ENXIO; + goto fail; + } - /* Allocate bus_dma resources. */ - err = bus_dma_tag_create(bus_get_dma_tag(dev), - 1, 0, bcm283x_dmabus_peripheral_lowaddr(), - BUS_SPACE_MAXADDR, NULL, NULL, - BCM_DMA_MAXSIZE, ALLOCATED_DMA_SEGS, BCM_SDHCI_BUFFER_SIZE, - BUS_DMA_ALLOCNOW, NULL, NULL, - &sc->sc_dma_tag); + /* Allocate bus_dma resources. */ + err = bus_dma_tag_create(bus_get_dma_tag(dev), + 1, 0, bcm283x_dmabus_peripheral_lowaddr(), + BUS_SPACE_MAXADDR, NULL, NULL, + BCM_DMA_MAXSIZE, ALLOCATED_DMA_SEGS, BCM_SDHCI_BUFFER_SIZE, + BUS_DMA_ALLOCNOW, NULL, NULL, + &sc->sc_dma_tag); - if (err) { - device_printf(dev, "failed allocate DMA tag"); - goto fail; - } + if (err) { + device_printf(dev, "failed allocate DMA tag"); + goto fail; + } - err = bus_dmamap_create(sc->sc_dma_tag, 0, &sc->sc_dma_map); - if (err) { - device_printf(dev, "bus_dmamap_create failed\n"); - goto fail; - } + err = bus_dmamap_create(sc->sc_dma_tag, 0, &sc->sc_dma_map); + if (err) { + device_printf(dev, "bus_dmamap_create failed\n"); + goto fail; } /* FIXME: Fix along with other BUS_SPACE_PHYSADDR instances */ @@ -724,9 +719,6 @@ static int bcm_sdhci_will_handle_transfer(device_t dev, struct sdhci_slot *slot) { struct bcm_sdhci_softc *sc = device_get_softc(slot->bus); - - if (!sc->conf->use_dma) - return (0); /* * This indicates that we somehow let a data interrupt slip by into the From owner-svn-src-all@freebsd.org Sat Nov 23 03:38:26 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id E30EE1A8173; Sat, 23 Nov 2019 03:38:26 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47KfCQ5gcmz4Xd7; Sat, 23 Nov 2019 03:38:26 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id A6FFB5E86; Sat, 23 Nov 2019 03:38:26 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xAN3cQNG075581; Sat, 23 Nov 2019 03:38:26 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xAN3cQ4Z075580; Sat, 23 Nov 2019 03:38:26 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201911230338.xAN3cQ4Z075580@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Sat, 23 Nov 2019 03:38:26 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r355027 - head/sys/arm64/conf X-SVN-Group: head X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: head/sys/arm64/conf X-SVN-Commit-Revision: 355027 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 23 Nov 2019 03:38:26 -0000 Author: kevans Date: Sat Nov 23 03:38:26 2019 New Revision: 355027 URL: https://svnweb.freebsd.org/changeset/base/355027 Log: arm64/NOTES: add SOC_BRCM_BCM2838 This should have been done back when it was added, but it was not. It only really adds an extra entry for memory mapping bits in bcm2835_vcbus.c, so nothing too extensive yet. Modified: head/sys/arm64/conf/NOTES Modified: head/sys/arm64/conf/NOTES ============================================================================== --- head/sys/arm64/conf/NOTES Sat Nov 23 01:47:17 2019 (r355026) +++ head/sys/arm64/conf/NOTES Sat Nov 23 03:38:26 2019 (r355027) @@ -39,6 +39,7 @@ options SOC_ALLWINNER_H5 options SOC_CAVM_THUNDERX options SOC_HISI_HI6220 options SOC_BRCM_BCM2837 +options SOC_BRCM_BCM2838 options SOC_MARVELL_8K options SOC_ROCKCHIP_RK3328 options SOC_ROCKCHIP_RK3399 From owner-svn-src-all@freebsd.org Sat Nov 23 07:06:18 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 125791AC269; Sat, 23 Nov 2019 07:06:18 +0000 (UTC) (envelope-from scottl@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47KkqF6kdfz3Cx1; Sat, 23 Nov 2019 07:06:17 +0000 (UTC) (envelope-from scottl@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id CA58D8424; Sat, 23 Nov 2019 07:06:17 +0000 (UTC) (envelope-from scottl@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xAN76HRf000599; Sat, 23 Nov 2019 07:06:17 GMT (envelope-from scottl@FreeBSD.org) Received: (from scottl@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xAN76GLE000595; Sat, 23 Nov 2019 07:06:16 GMT (envelope-from scottl@FreeBSD.org) Message-Id: <201911230706.xAN76GLE000595@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: scottl set sender to scottl@FreeBSD.org using -f From: Scott Long Date: Sat, 23 Nov 2019 07:06:16 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r355028 - in stable/12: share/man/man4 sys/dev/hpt27xx sys/dev/trm X-SVN-Group: stable-12 X-SVN-Commit-Author: scottl X-SVN-Commit-Paths: in stable/12: share/man/man4 sys/dev/hpt27xx sys/dev/trm X-SVN-Commit-Revision: 355028 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 23 Nov 2019 07:06:18 -0000 Author: scottl Date: Sat Nov 23 07:06:16 2019 New Revision: 355028 URL: https://svnweb.freebsd.org/changeset/base/355028 Log: MFC 355012 and 355021. Mark trm and hpt27xx for removal in 13.0 Modified: stable/12/share/man/man4/hpt27xx.4 stable/12/share/man/man4/trm.4 stable/12/sys/dev/hpt27xx/hpt27xx_osm_bsd.c stable/12/sys/dev/trm/trm.c Modified: stable/12/share/man/man4/hpt27xx.4 ============================================================================== --- stable/12/share/man/man4/hpt27xx.4 Sat Nov 23 03:38:26 2019 (r355027) +++ stable/12/share/man/man4/hpt27xx.4 Sat Nov 23 07:06:16 2019 (r355028) @@ -44,6 +44,9 @@ module at boot time, place the following line in .Bd -literal -offset indent hpt27xx_load="YES" .Ed +.Sh DEPRECATION NOTICE +This driver is scheduled for removal prior to the release of +.Fx 13.0 . .Sh DESCRIPTION The .Nm Modified: stable/12/share/man/man4/trm.4 ============================================================================== --- stable/12/share/man/man4/trm.4 Sat Nov 23 03:38:26 2019 (r355027) +++ stable/12/share/man/man4/trm.4 Sat Nov 23 07:06:16 2019 (r355028) @@ -48,6 +48,9 @@ module at boot time, place the following line in .Bd -literal -offset indent trm_load="YES" .Ed +.Sh DEPRECATION NOTICE +This driver is scheduled for removal prior to the release of +.Fx 13.0 .Sh DESCRIPTION The .Nm Modified: stable/12/sys/dev/hpt27xx/hpt27xx_osm_bsd.c ============================================================================== --- stable/12/sys/dev/hpt27xx/hpt27xx_osm_bsd.c Sat Nov 23 03:38:26 2019 (r355027) +++ stable/12/sys/dev/hpt27xx/hpt27xx_osm_bsd.c Sat Nov 23 07:06:16 2019 (r355028) @@ -76,7 +76,9 @@ static int hpt_attach(device_t dev) HPT_UINT size; PVBUS vbus; PVBUS_EXT vbus_ext; - + + gone_in(13, "Giant locked CAM drivers"); + KdPrint(("hpt_attach(%d/%d/%d)", pci_get_bus(dev), pci_get_slot(dev), pci_get_function(dev))); him = hpt_match(dev, 1); Modified: stable/12/sys/dev/trm/trm.c ============================================================================== --- stable/12/sys/dev/trm/trm.c Sat Nov 23 03:38:26 2019 (r355027) +++ stable/12/sys/dev/trm/trm.c Sat Nov 23 07:06:16 2019 (r355028) @@ -3376,7 +3376,9 @@ trm_attach(device_t dev) PACB pACB = 0; int rid = 0; int unit = device_get_unit(dev); - + + gone_in(13, "Giant locked CAM drivers"); + device_id = pci_get_devid(dev); /* * These cards do not allow memory mapped accesses From owner-svn-src-all@freebsd.org Sat Nov 23 10:57:00 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 284EA1B1ED5; Sat, 23 Nov 2019 10:57:00 +0000 (UTC) (envelope-from bzeeb-lists@lists.zabbadoz.net) Received: from mx1.sbone.de (mx1.sbone.de [IPv6:2a01:4f8:13b:39f::9f:25]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mx1.sbone.de", Issuer "SBone.DE" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 47KqxR6zwGz3Qlj; Sat, 23 Nov 2019 10:56:59 +0000 (UTC) (envelope-from bzeeb-lists@lists.zabbadoz.net) Received: from mail.sbone.de (mail.sbone.de [IPv6:fde9:577b:c1a9:31::2013:587]) (using TLSv1 with cipher ADH-CAMELLIA256-SHA (256/256 bits)) (No client certificate requested) by mx1.sbone.de (Postfix) with ESMTPS id 36DEA8D4A15D; Sat, 23 Nov 2019 10:56:50 +0000 (UTC) Received: from content-filter.sbone.de (content-filter.sbone.de [IPv6:fde9:577b:c1a9:31::2013:2742]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.sbone.de (Postfix) with ESMTPS id E113AE7084E; Sat, 23 Nov 2019 10:56:49 +0000 (UTC) X-Virus-Scanned: amavisd-new at sbone.de Received: from mail.sbone.de ([IPv6:fde9:577b:c1a9:31::2013:587]) by content-filter.sbone.de (content-filter.sbone.de [fde9:577b:c1a9:31::2013:2742]) (amavisd-new, port 10024) with ESMTP id Rjl9_22xctkj; Sat, 23 Nov 2019 10:56:48 +0000 (UTC) Received: from [192.168.2.110] (unknown [IPv6:fde9:577b:c1a9:31:5b9:cdf5:df87:e3d2]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.sbone.de (Postfix) with ESMTPSA id 53100E70828; Sat, 23 Nov 2019 10:56:48 +0000 (UTC) From: "Bjoern A. Zeeb" To: "Conrad Meyer" Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r355024 - in head/sys: kern net sys Date: Sat, 23 Nov 2019 10:56:47 +0000 X-Mailer: MailMate (2.0BETAr6142) Message-ID: <2F916664-B316-4F61-810C-31D753FAC9B2@lists.zabbadoz.net> In-Reply-To: <201911222323.xAMNNfwi027342@repo.freebsd.org> References: <201911222323.xAMNNfwi027342@repo.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset="UTF-8"; format=flowed Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 47KqxR6zwGz3Qlj X-Spamd-Bar: ----- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-6.00 / 15.00]; NEURAL_HAM_MEDIUM(-1.00)[-0.998,0]; NEURAL_HAM_LONG(-1.00)[-0.998,0]; REPLY(-4.00)[] X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 23 Nov 2019 10:57:00 -0000 On 22 Nov 2019, at 23:23, Conrad Meyer wrote: > Author: cem > Date: Fri Nov 22 23:23:40 2019 > New Revision: 355024 > URL: https://svnweb.freebsd.org/changeset/base/355024 > > Log: > Add explicit SI_SUB_EPOCH > > Add explicit SI_SUB_EPOCH, after SI_SUB_TASKQ and before SI_SUB_SMP > (EARLY_AP_STARTUP). Rename existing "SI_SUB_TASKQ + 1" to > SI_SUB_EPOCH. > > epoch(9) consumers cannot epoch_alloc() before > SI_SUB_EPOCH:SI_ORDER_SECOND, > but likely should allocate before SI_SUB_SMP. Prior to this change, > consumers (well, epoch itself, and net/if.c) just open-coded the > SI_SUB_TASKQ + 1 order to match epoch.c, but this was fragile. > > Reviewed by: mmacy > Differential Revision: https://reviews.freebsd.org/D22503 That’s the wrong review URL? From owner-svn-src-all@freebsd.org Sat Nov 23 13:20:24 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id E2F8C1B5527; Sat, 23 Nov 2019 13:20:24 +0000 (UTC) (envelope-from karels@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47Kv6w5gNcz43Jd; Sat, 23 Nov 2019 13:20:24 +0000 (UTC) (envelope-from karels@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id A25E1C75F; Sat, 23 Nov 2019 13:20:24 +0000 (UTC) (envelope-from karels@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xANDKOxJ022544; Sat, 23 Nov 2019 13:20:24 GMT (envelope-from karels@FreeBSD.org) Received: (from karels@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xANDKOf0022543; Sat, 23 Nov 2019 13:20:24 GMT (envelope-from karels@FreeBSD.org) Message-Id: <201911231320.xANDKOf0022543@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: karels set sender to karels@FreeBSD.org using -f From: Mike Karels Date: Sat, 23 Nov 2019 13:20:24 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r355029 - stable/12/usr.bin/netstat X-SVN-Group: stable-12 X-SVN-Commit-Author: karels X-SVN-Commit-Paths: stable/12/usr.bin/netstat X-SVN-Commit-Revision: 355029 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 23 Nov 2019 13:20:25 -0000 Author: karels Date: Sat Nov 23 13:20:24 2019 New Revision: 355029 URL: https://svnweb.freebsd.org/changeset/base/355029 Log: MFC r354633: Fix netstat -gs with ip_mroute module and/or vnet The code for "netstat -gs -f inet" failed if the kernel namelist did not include the _mrtstat symbol. However, that symbol is not in a standard kernel even with the ip_mroute module loaded, where the functionality is available. It is also not in a kernel with MROUTING but also VIMAGE, as there can be multiple sets of stats. However, when running the command on a live system, the symbol is not used; a sysctl is used. Go ahead and try the sysctl in any case, and complain that IPv4 MROUTING is not present only if the sysctl fails with ENOENT. Also fail if _mrtstat is not defined when running on a core file; netstat doesn't know about vnets, so can only work if MROUTING was included, and VIMAGE was not. Reviewed by: bz Modified: stable/12/usr.bin/netstat/mroute.c Directory Properties: stable/12/ (props changed) Modified: stable/12/usr.bin/netstat/mroute.c ============================================================================== --- stable/12/usr.bin/netstat/mroute.c Sat Nov 23 07:06:16 2019 (r355028) +++ stable/12/usr.bin/netstat/mroute.c Sat Nov 23 13:20:24 2019 (r355029) @@ -409,14 +409,12 @@ mrt_stats() mstaddr = nl[N_MRTSTAT].n_value; - if (mstaddr == 0) { - fprintf(stderr, "No IPv4 MROUTING kernel support.\n"); - return; - } - if (fetch_stats("net.inet.ip.mrtstat", mstaddr, &mrtstat, - sizeof(mrtstat), kread_counters) != 0) + sizeof(mrtstat), kread_counters) != 0) { + if ((live && errno == ENOENT) || (!live && mstaddr == 0)) + fprintf(stderr, "No IPv4 MROUTING kernel support.\n"); return; + } xo_emit("{T:IPv4 multicast forwarding}:\n"); From owner-svn-src-all@freebsd.org Sat Nov 23 13:23:13 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 0E1221B5740; Sat, 23 Nov 2019 13:23:13 +0000 (UTC) (envelope-from karels@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47KvB86bNgz43dr; Sat, 23 Nov 2019 13:23:12 +0000 (UTC) (envelope-from karels@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id C5A06C911; Sat, 23 Nov 2019 13:23:12 +0000 (UTC) (envelope-from karels@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xANDNCus028064; Sat, 23 Nov 2019 13:23:12 GMT (envelope-from karels@FreeBSD.org) Received: (from karels@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xANDNCTb028063; Sat, 23 Nov 2019 13:23:12 GMT (envelope-from karels@FreeBSD.org) Message-Id: <201911231323.xANDNCTb028063@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: karels set sender to karels@FreeBSD.org using -f From: Mike Karels Date: Sat, 23 Nov 2019 13:23:12 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r355030 - stable/11/usr.bin/netstat X-SVN-Group: stable-11 X-SVN-Commit-Author: karels X-SVN-Commit-Paths: stable/11/usr.bin/netstat X-SVN-Commit-Revision: 355030 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 23 Nov 2019 13:23:13 -0000 Author: karels Date: Sat Nov 23 13:23:12 2019 New Revision: 355030 URL: https://svnweb.freebsd.org/changeset/base/355030 Log: MFC r354633: Fix netstat -gs with ip_mroute module and/or vnet The code for "netstat -gs -f inet" failed if the kernel namelist did not include the _mrtstat symbol. However, that symbol is not in a standard kernel even with the ip_mroute module loaded, where the functionality is available. It is also not in a kernel with MROUTING but also VIMAGE, as there can be multiple sets of stats. However, when running the command on a live system, the symbol is not used; a sysctl is used. Go ahead and try the sysctl in any case, and complain that IPv4 MROUTING is not present only if the sysctl fails with ENOENT. Also fail if _mrtstat is not defined when running on a core file; netstat doesn't know about vnets, so can only work if MROUTING was included, and VIMAGE was not. Reviewed by: bz Modified: stable/11/usr.bin/netstat/mroute.c Directory Properties: stable/11/ (props changed) Modified: stable/11/usr.bin/netstat/mroute.c ============================================================================== --- stable/11/usr.bin/netstat/mroute.c Sat Nov 23 13:20:24 2019 (r355029) +++ stable/11/usr.bin/netstat/mroute.c Sat Nov 23 13:23:12 2019 (r355030) @@ -407,14 +407,12 @@ mrt_stats() mstaddr = nl[N_MRTSTAT].n_value; - if (mstaddr == 0) { - fprintf(stderr, "No IPv4 MROUTING kernel support.\n"); - return; - } - if (fetch_stats("net.inet.ip.mrtstat", mstaddr, &mrtstat, - sizeof(mrtstat), kread_counters) != 0) + sizeof(mrtstat), kread_counters) != 0) { + if ((live && errno == ENOENT) || (!live && mstaddr == 0)) + fprintf(stderr, "No IPv4 MROUTING kernel support.\n"); return; + } xo_emit("{T:IPv4 multicast forwarding}:\n"); From owner-svn-src-all@freebsd.org Sat Nov 23 13:39:48 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 04CB61B5E00; Sat, 23 Nov 2019 13:39:48 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47KvYH6DH3z44KD; Sat, 23 Nov 2019 13:39:47 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id B90E9CAFE; Sat, 23 Nov 2019 13:39:47 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xANDdl4i034425; Sat, 23 Nov 2019 13:39:47 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xANDdltR034424; Sat, 23 Nov 2019 13:39:47 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201911231339.xANDdltR034424@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Sat, 23 Nov 2019 13:39:47 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r355031 - head/sys/arm/broadcom/bcm2835 X-SVN-Group: head X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: head/sys/arm/broadcom/bcm2835 X-SVN-Commit-Revision: 355031 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 23 Nov 2019 13:39:48 -0000 Author: kevans Date: Sat Nov 23 13:39:47 2019 New Revision: 355031 URL: https://svnweb.freebsd.org/changeset/base/355031 Log: bcm2835_sdhci: fix non-INVARIANTS build sc is now only used to make sure we're not re-entering the data handling path erroneously. Reported by: Mark Millard Modified: head/sys/arm/broadcom/bcm2835/bcm2835_sdhci.c Modified: head/sys/arm/broadcom/bcm2835/bcm2835_sdhci.c ============================================================================== --- head/sys/arm/broadcom/bcm2835/bcm2835_sdhci.c Sat Nov 23 13:23:12 2019 (r355030) +++ head/sys/arm/broadcom/bcm2835/bcm2835_sdhci.c Sat Nov 23 13:39:47 2019 (r355031) @@ -718,7 +718,9 @@ bcm_sdhci_start_dma(struct sdhci_slot *slot) static int bcm_sdhci_will_handle_transfer(device_t dev, struct sdhci_slot *slot) { +#ifdef INVARIANTS struct bcm_sdhci_softc *sc = device_get_softc(slot->bus); +#endif /* * This indicates that we somehow let a data interrupt slip by into the From owner-svn-src-all@freebsd.org Sat Nov 23 17:22:36 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id D53341BA91F; Sat, 23 Nov 2019 17:22:36 +0000 (UTC) (envelope-from dougm@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47L0VN5Gdmz4HHZ; Sat, 23 Nov 2019 17:22:36 +0000 (UTC) (envelope-from dougm@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 983A0F4DE; Sat, 23 Nov 2019 17:22:36 +0000 (UTC) (envelope-from dougm@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xANHMaGP071026; Sat, 23 Nov 2019 17:22:36 GMT (envelope-from dougm@FreeBSD.org) Received: (from dougm@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xANHMaBf071025; Sat, 23 Nov 2019 17:22:36 GMT (envelope-from dougm@FreeBSD.org) Message-Id: <201911231722.xANHMaBf071025@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dougm set sender to dougm@FreeBSD.org using -f From: Doug Moore Date: Sat, 23 Nov 2019 17:22:36 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r355032 - head/tests/sys/sys X-SVN-Group: head X-SVN-Commit-Author: dougm X-SVN-Commit-Paths: head/tests/sys/sys X-SVN-Commit-Revision: 355032 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 23 Nov 2019 17:22:36 -0000 Author: dougm Date: Sat Nov 23 17:22:36 2019 New Revision: 355032 URL: https://svnweb.freebsd.org/changeset/base/355032 Log: The error messages that indicate bugs in 'area' bitstring functions should identify accurately which function exhibited the bug. Reviewed by: asomers MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D22519 Modified: head/tests/sys/sys/bitstring_test.c Modified: head/tests/sys/sys/bitstring_test.c ============================================================================== --- head/tests/sys/sys/bitstring_test.c Sat Nov 23 13:39:47 2019 (r355031) +++ head/tests/sys/sys/bitstring_test.c Sat Nov 23 17:22:36 2019 (r355032) @@ -340,7 +340,7 @@ BITSTRING_TC_DEFINE(bit_ffs_area_no_match) memset(bitstr, 0, bitstr_size(nbits)); bit_ffs_area(bitstr, nbits, 2, &found_clear_bits); ATF_REQUIRE_EQ_MSG(-1, found_clear_bits, - "bit_ffc_area_%d_%s: Failed all clear bits.", nbits, memloc); + "bit_ffs_area_%d_%s: Failed all clear bits.", nbits, memloc); } ATF_TC_WITHOUT_HEAD(bit_ffs_area); @@ -358,36 +358,36 @@ ATF_TC_BODY(bit_ffs_area, tc) location = 0; bit_ffs_area(bitstr, nbits, 3, &location); ATF_REQUIRE_EQ_MSG(-1, location, - "bit_ffc_area: found location of size 3 when only 2 bits are set"); + "bit_ffs_area: found location of size 3 when only 2 bits are set"); bit_set(bitstr, 7); location = 0; bit_ffs_area(bitstr, nbits, 3, &location); ATF_REQUIRE_EQ_MSG(5, location, - "bit_ffc_area: failed to find location of size 3"); + "bit_ffs_area: failed to find location of size 3"); bit_set(bitstr, 8); location = 0; bit_ffs_area(bitstr, nbits, 3, &location); ATF_REQUIRE_EQ_MSG(5, location, - "bit_ffc_area: failed to find location of size 3"); + "bit_ffs_area: failed to find location of size 3"); location = 0; bit_ffs_area_at(bitstr, 2, nbits, 3, &location); ATF_REQUIRE_EQ_MSG(5, location, - "bit_ffc_area: failed to find location of size 3"); + "bit_ffs_area_at: failed to find location of size 3"); location = 0; bit_ffs_area_at(bitstr, 6, nbits, 3, &location); ATF_REQUIRE_EQ_MSG(6, location, - "bit_ffc_area: failed to find location of size 3"); + "bit_ffs_area_at: failed to find location of size 3"); location = 0; bit_ffs_area_at(bitstr, 8, nbits, 3, &location); ATF_REQUIRE_EQ_MSG(-1, location, - "bit_ffc_area: found invalid location"); + "bit_ffs_area_at: found invalid location"); bit_set(bitstr, 69); bit_set(bitstr, 70); @@ -396,22 +396,22 @@ ATF_TC_BODY(bit_ffs_area, tc) location = 0; bit_ffs_area_at(bitstr, 8, nbits, 3, &location); ATF_REQUIRE_EQ_MSG(69, location, - "bit_ffc_area: failed to find location of size 3"); + "bit_ffs_area_at: failed to find location of size 3"); location = 0; bit_ffs_area_at(bitstr, 69, nbits, 3, &location); ATF_REQUIRE_EQ_MSG(69, location, - "bit_ffc_area: failed to find location of size 3"); + "bit_ffs_area_at: failed to find location of size 3"); location = 0; bit_ffs_area_at(bitstr, 70, nbits, 3, &location); ATF_REQUIRE_EQ_MSG(-1, location, - "bit_ffc_area: found invalid location"); + "bit_ffs_area_at: found invalid location"); location = 0; bit_ffs_area_at(bitstr, 72, nbits, 3, &location); ATF_REQUIRE_EQ_MSG(-1, location, - "bit_ffc_area: found invalid location"); + "bit_ffs_area_at: found invalid location"); } ATF_TC_WITHOUT_HEAD(bit_ffc_area); @@ -449,17 +449,17 @@ ATF_TC_BODY(bit_ffc_area, tc) location = 0; bit_ffc_area_at(bitstr, 2, nbits, 3, &location); ATF_REQUIRE_EQ_MSG(7, location, - "bit_ffc_area: failed to find location of size 3"); + "bit_ffc_area_at: failed to find location of size 3"); location = 0; bit_ffc_area_at(bitstr, 8, nbits, 3, &location); ATF_REQUIRE_EQ_MSG(8, location, - "bit_ffc_area: failed to find location of size 3"); + "bit_ffc_area_at: failed to find location of size 3"); location = 0; bit_ffc_area_at(bitstr, 9, nbits, 3, &location); ATF_REQUIRE_EQ_MSG(-1, location, - "bit_ffc_area: found invalid bit location"); + "bit_ffc_area_at: found invalid bit location"); bit_clear(bitstr, 77); bit_clear(bitstr, 78); @@ -468,22 +468,22 @@ ATF_TC_BODY(bit_ffc_area, tc) location = 0; bit_ffc_area_at(bitstr, 12, nbits, 3, &location); ATF_REQUIRE_EQ_MSG(77, location, - "bit_ffc_area: failed to find location of size 3"); + "bit_ffc_area_at: failed to find location of size 3"); location = 0; bit_ffc_area_at(bitstr, 77, nbits, 3, &location); ATF_REQUIRE_EQ_MSG(77, location, - "bit_ffc_area: failed to find location of size 3"); + "bit_ffc_area_at: failed to find location of size 3"); location = 0; bit_ffc_area_at(bitstr, 78, nbits, 3, &location); ATF_REQUIRE_EQ_MSG(-1, location, - "bit_ffc_area: found invalid location"); + "bit_ffc_area_at: found invalid location"); location = 0; bit_ffc_area_at(bitstr, 85, nbits, 3, &location); ATF_REQUIRE_EQ_MSG(-1, location, - "bit_ffc_area: found invalid location"); + "bit_ffc_area_at: found invalid location"); } BITSTRING_TC_DEFINE(bit_nclear) From owner-svn-src-all@freebsd.org Sat Nov 23 17:25:10 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 81B101BA9C7; Sat, 23 Nov 2019 17:25:10 +0000 (UTC) (envelope-from jhibbits@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47L0YL2vhzz4HQx; Sat, 23 Nov 2019 17:25:10 +0000 (UTC) (envelope-from jhibbits@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 473ACF4F8; Sat, 23 Nov 2019 17:25:10 +0000 (UTC) (envelope-from jhibbits@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xANHPAGN071208; Sat, 23 Nov 2019 17:25:10 GMT (envelope-from jhibbits@FreeBSD.org) Received: (from jhibbits@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xANHPAAH071207; Sat, 23 Nov 2019 17:25:10 GMT (envelope-from jhibbits@FreeBSD.org) Message-Id: <201911231725.xANHPAAH071207@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhibbits set sender to jhibbits@FreeBSD.org using -f From: Justin Hibbits Date: Sat, 23 Nov 2019 17:25:10 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-svnadmin@freebsd.org Subject: svn commit: r355033 - svnadmin/conf X-SVN-Group: svnadmin X-SVN-Commit-Author: jhibbits X-SVN-Commit-Paths: svnadmin/conf X-SVN-Commit-Revision: 355033 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 23 Nov 2019 17:25:10 -0000 Author: jhibbits Date: Sat Nov 23 17:25:09 2019 New Revision: 355033 URL: https://svnweb.freebsd.org/changeset/base/355033 Log: Let bdragon run free. He knows the drill. Modified: svnadmin/conf/mentors Modified: svnadmin/conf/mentors ============================================================================== --- svnadmin/conf/mentors Sat Nov 23 17:22:36 2019 (r355032) +++ svnadmin/conf/mentors Sat Nov 23 17:25:09 2019 (r355033) @@ -11,7 +11,6 @@ # Mentee Mentor Optional comment anish jhb -bdragon jhibbits brd allanjude Co-mentor: bapt chs imp gordon delphij Co-mentor: emaste From owner-svn-src-all@freebsd.org Sat Nov 23 19:35:11 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 03DB61BD16D; Sat, 23 Nov 2019 19:35:11 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47L3RL6FpXz4NSq; Sat, 23 Nov 2019 19:35:10 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id B95B518C06; Sat, 23 Nov 2019 19:35:10 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xANJZAL6050022; Sat, 23 Nov 2019 19:35:10 GMT (envelope-from dim@FreeBSD.org) Received: (from dim@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xANJZAvZ050019; Sat, 23 Nov 2019 19:35:10 GMT (envelope-from dim@FreeBSD.org) Message-Id: <201911231935.xANJZAvZ050019@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dim set sender to dim@FreeBSD.org using -f From: Dimitry Andric Date: Sat, 23 Nov 2019 19:35:10 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r355034 - in head: lib lib/libclang_rt tools/build/mk X-SVN-Group: head X-SVN-Commit-Author: dim X-SVN-Commit-Paths: in head: lib lib/libclang_rt tools/build/mk X-SVN-Commit-Revision: 355034 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 23 Nov 2019 19:35:11 -0000 Author: dim Date: Sat Nov 23 19:35:09 2019 New Revision: 355034 URL: https://svnweb.freebsd.org/changeset/base/355034 Log: libclang_rt: enable on powerpc* Summary: Enable on powerpc64 and in lib/libclang_rt/Makefile change MACHINE_CPUARCH to MACHINE_ARCH because on powerpc64 MACHINE_ARCH==MACHINE_CPUARCH so the 32-bit library overwrites 64-bit library during installworld. This patch doesn't enable any other libclang_rt libraries because they need to be separately ported. I have verified that games/julius (which fails on powerpc64 elfv2 without this change because of no libclang_rt profiling library) builds. Test Plan: Ship it, test on powerpc and powerpcspe Submitted by: pkubaj Reviewed by: dim, jhibbits Differential Revision: https://reviews.freebsd.org/D22425 MFC after: 1 month X-MFC-With: r353358 Modified: head/lib/Makefile head/lib/libclang_rt/Makefile.inc head/tools/build/mk/OptionalObsoleteFiles.inc Modified: head/lib/Makefile ============================================================================== --- head/lib/Makefile Sat Nov 23 17:25:09 2019 (r355033) +++ head/lib/Makefile Sat Nov 23 19:35:09 2019 (r355034) @@ -159,7 +159,8 @@ SUBDIR.${MK_STATS}+= libstats # built for certain architectures. .if ${MK_CLANG} != "no" && ${COMPILER_TYPE} == "clang" && \ (${MACHINE_CPUARCH} == "aarch64" || ${MACHINE_CPUARCH} == "amd64" || \ - ${MACHINE_CPUARCH} == "arm" || ${MACHINE_CPUARCH} == "i386") + ${MACHINE_CPUARCH} == "arm" || ${MACHINE_CPUARCH} == "i386" || \ + ${MACHINE_CPUARCH} == "powerpc") _libclang_rt= libclang_rt .endif Modified: head/lib/libclang_rt/Makefile.inc ============================================================================== --- head/lib/libclang_rt/Makefile.inc Sat Nov 23 17:25:09 2019 (r355033) +++ head/lib/libclang_rt/Makefile.inc Sat Nov 23 19:35:09 2019 (r355034) @@ -8,7 +8,7 @@ (!defined(CPUTYPE) || ${CPUTYPE:M*soft*} == "") CRTARCH?= armhf .else -CRTARCH?= ${MACHINE_CPUARCH:C/amd64/x86_64/} +CRTARCH?= ${MACHINE_ARCH:C/amd64/x86_64/} .endif CRTSRC= ${SRCTOP}/contrib/compiler-rt Modified: head/tools/build/mk/OptionalObsoleteFiles.inc ============================================================================== --- head/tools/build/mk/OptionalObsoleteFiles.inc Sat Nov 23 17:25:09 2019 (r355033) +++ head/tools/build/mk/OptionalObsoleteFiles.inc Sat Nov 23 19:35:09 2019 (r355034) @@ -1576,6 +1576,8 @@ OLD_FILES+=usr/lib/clang/9.0.0/lib/freebsd/libclang_rt OLD_FILES+=usr/lib/clang/9.0.0/lib/freebsd/libclang_rt.profile-arm.a OLD_FILES+=usr/lib/clang/9.0.0/lib/freebsd/libclang_rt.profile-armhf.a OLD_FILES+=usr/lib/clang/9.0.0/lib/freebsd/libclang_rt.profile-i386.a +OLD_FILES+=usr/lib/clang/9.0.0/lib/freebsd/libclang_rt.profile-powerpc.a +OLD_FILES+=usr/lib/clang/9.0.0/lib/freebsd/libclang_rt.profile-powerpc64.a OLD_FILES+=usr/lib/clang/9.0.0/lib/freebsd/libclang_rt.profile-x86_64.a OLD_FILES+=usr/lib/clang/9.0.0/lib/freebsd/libclang_rt.safestack-aarch64.a OLD_FILES+=usr/lib/clang/9.0.0/lib/freebsd/libclang_rt.safestack-i386.a From owner-svn-src-all@freebsd.org Sat Nov 23 21:18:56 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 6BA581BF643; Sat, 23 Nov 2019 21:18:56 +0000 (UTC) (envelope-from bdragon@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47L5l42CJSz4SmX; Sat, 23 Nov 2019 21:18:56 +0000 (UTC) (envelope-from bdragon@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 2F1A219E36; Sat, 23 Nov 2019 21:18:56 +0000 (UTC) (envelope-from bdragon@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xANLIueo009878; Sat, 23 Nov 2019 21:18:56 GMT (envelope-from bdragon@FreeBSD.org) Received: (from bdragon@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xANLIuXd009877; Sat, 23 Nov 2019 21:18:56 GMT (envelope-from bdragon@FreeBSD.org) Message-Id: <201911232118.xANLIuXd009877@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bdragon set sender to bdragon@FreeBSD.org using -f From: Brandon Bergren Date: Sat, 23 Nov 2019 21:18:56 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r355035 - head/sys/powerpc/booke X-SVN-Group: head X-SVN-Commit-Author: bdragon X-SVN-Commit-Paths: head/sys/powerpc/booke X-SVN-Commit-Revision: 355035 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 23 Nov 2019 21:18:56 -0000 Author: bdragon Date: Sat Nov 23 21:18:55 2019 New Revision: 355035 URL: https://svnweb.freebsd.org/changeset/base/355035 Log: [PowerPC] Use QEMU-compatible version of SPE accumulator save Switch from "evaddumiaaw 0,0" to "evmwumiaa 0,0,0" when persisting the accumulator. This has the benefit of actually being implemented in QEMU as it is the form Linux uses for the same task. Both instructions are functionally equivilent, as we are using them for their side effect of copying the accumulator to GPRs rather than for the actual math operation that they are performing. Reviewed by: jhibbits Modified: head/sys/powerpc/booke/spe.c Modified: head/sys/powerpc/booke/spe.c ============================================================================== --- head/sys/powerpc/booke/spe.c Sat Nov 23 19:35:09 2019 (r355034) +++ head/sys/powerpc/booke/spe.c Sat Nov 23 21:18:55 2019 (r355035) @@ -83,7 +83,7 @@ save_vec_int(struct thread *td) #undef EVSTDW __asm ( "evxor 0,0,0\n" - "evaddumiaaw 0,0\n" + "evmwumiaa 0,0,0\n" "evstdd 0,0(%0)" :: "b"(&pcb->pcb_vec.spare[0])); pcb->pcb_vec.vscr = mfspr(SPR_SPEFSCR); From owner-svn-src-all@freebsd.org Sat Nov 23 23:41:22 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 638991C2471; Sat, 23 Nov 2019 23:41:22 +0000 (UTC) (envelope-from bdragon@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47L8vQ1zkzz4Z9v; Sat, 23 Nov 2019 23:41:22 +0000 (UTC) (envelope-from bdragon@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 27B651B787; Sat, 23 Nov 2019 23:41:22 +0000 (UTC) (envelope-from bdragon@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xANNfMbZ095437; Sat, 23 Nov 2019 23:41:22 GMT (envelope-from bdragon@FreeBSD.org) Received: (from bdragon@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xANNfMKP095436; Sat, 23 Nov 2019 23:41:22 GMT (envelope-from bdragon@FreeBSD.org) Message-Id: <201911232341.xANNfMKP095436@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bdragon set sender to bdragon@FreeBSD.org using -f From: Brandon Bergren Date: Sat, 23 Nov 2019 23:41:22 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r355036 - head/lib/libc/powerpc/gen X-SVN-Group: head X-SVN-Commit-Author: bdragon X-SVN-Commit-Paths: head/lib/libc/powerpc/gen X-SVN-Commit-Revision: 355036 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 23 Nov 2019 23:41:22 -0000 Author: bdragon Date: Sat Nov 23 23:41:21 2019 New Revision: 355036 URL: https://svnweb.freebsd.org/changeset/base/355036 Log: [PowerPC] Fix typo in _ctx_start on ppc32 Theoretically, this was breaking the size calculation for the symbol. Noticed when doing a readthrough. Reviewed by: imp Differential Revision: https://reviews.freebsd.org/D22525 Modified: head/lib/libc/powerpc/gen/_ctx_start.S Modified: head/lib/libc/powerpc/gen/_ctx_start.S ============================================================================== --- head/lib/libc/powerpc/gen/_ctx_start.S Sat Nov 23 21:18:55 2019 (r355035) +++ head/lib/libc/powerpc/gen/_ctx_start.S Sat Nov 23 23:41:21 2019 (r355036) @@ -48,6 +48,6 @@ addis %r30,%r30,_GLOBAL_OFFSET_TABLE_-1b@ha addi %r30,%r30,_GLOBAL_OFFSET_TABLE_-1b@l bl PIC_PLT(CNAME(abort)) /* abort */ - END(_cts_start) + END(_ctx_start) .section .note.GNU-stack,"",%progbits From owner-svn-src-all@freebsd.org Sat Nov 23 23:43:53 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 2F3161C254E; Sat, 23 Nov 2019 23:43:53 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47L8yK0PfSz4ZTs; Sat, 23 Nov 2019 23:43:53 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id E651F1B8FB; Sat, 23 Nov 2019 23:43:52 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xANNhqPx097799; Sat, 23 Nov 2019 23:43:52 GMT (envelope-from imp@FreeBSD.org) Received: (from imp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xANNhqkQ097797; Sat, 23 Nov 2019 23:43:52 GMT (envelope-from imp@FreeBSD.org) Message-Id: <201911232343.xANNhqkQ097797@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: imp set sender to imp@FreeBSD.org using -f From: Warner Losh Date: Sat, 23 Nov 2019 23:43:52 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r355037 - head/sys/dev/pci X-SVN-Group: head X-SVN-Commit-Author: imp X-SVN-Commit-Paths: head/sys/dev/pci X-SVN-Commit-Revision: 355037 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 23 Nov 2019 23:43:53 -0000 Author: imp Date: Sat Nov 23 23:43:52 2019 New Revision: 355037 URL: https://svnweb.freebsd.org/changeset/base/355037 Log: Push Giant down one layer The /dev/pci device doesn't need GIANT, per se. However, one routine that it calls, pci_find_dbsf implicitly does. It walks a list that can change when PCI scans a new bus. With hotplug, this means we could have a race with that scanning. To prevent that, take out Giant around scanning the list. However, given that we have places in the tree that drop giant, if held when we call into them, the whole use of Giant to protect newbus may be less effective that we desire, so add a comment about why we're talking it out, and we'll address the issue when we lock newbus with something other than Giant. Modified: head/sys/dev/pci/pci.c head/sys/dev/pci/pci_user.c Modified: head/sys/dev/pci/pci.c ============================================================================== --- head/sys/dev/pci/pci.c Sat Nov 23 23:41:21 2019 (r355036) +++ head/sys/dev/pci/pci.c Sat Nov 23 23:43:52 2019 (r355037) @@ -445,18 +445,21 @@ pci_find_bsf(uint8_t bus, uint8_t slot, uint8_t func) device_t pci_find_dbsf(uint32_t domain, uint8_t bus, uint8_t slot, uint8_t func) { - struct pci_devinfo *dinfo; + struct pci_devinfo *dinfo = NULL; + /* Giant because newbus is Giant locked revisit with newbus locking */ + mtx_lock(&Giant); STAILQ_FOREACH(dinfo, &pci_devq, pci_links) { if ((dinfo->cfg.domain == domain) && (dinfo->cfg.bus == bus) && (dinfo->cfg.slot == slot) && (dinfo->cfg.func == func)) { - return (dinfo->cfg.dev); + break; } } + mtx_unlock(&Giant); - return (NULL); + return (dinfo != NULL ? dinfo->cfg.dev : NULL); } /* Find a device_t by vendor/device ID */ Modified: head/sys/dev/pci/pci_user.c ============================================================================== --- head/sys/dev/pci/pci_user.c Sat Nov 23 23:41:21 2019 (r355036) +++ head/sys/dev/pci/pci_user.c Sat Nov 23 23:43:52 2019 (r355037) @@ -119,7 +119,7 @@ static d_ioctl_t pci_ioctl; struct cdevsw pcicdev = { .d_version = D_VERSION, - .d_flags = D_NEEDGIANT, + .d_flags = 0, .d_open = pci_open, .d_close = pci_close, .d_ioctl = pci_ioctl, From owner-svn-src-all@freebsd.org Sat Nov 23 23:44:00 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id EBD661C2572; Sat, 23 Nov 2019 23:44:00 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47L8yS633Fz4ZbX; Sat, 23 Nov 2019 23:44:00 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id B3D231B8FC; Sat, 23 Nov 2019 23:44:00 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xANNi0lu097881; Sat, 23 Nov 2019 23:44:00 GMT (envelope-from imp@FreeBSD.org) Received: (from imp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xANNi0nZ097880; Sat, 23 Nov 2019 23:44:00 GMT (envelope-from imp@FreeBSD.org) Message-Id: <201911232344.xANNi0nZ097880@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: imp set sender to imp@FreeBSD.org using -f From: Warner Losh Date: Sat, 23 Nov 2019 23:44:00 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r355038 - head/sys/geom X-SVN-Group: head X-SVN-Commit-Author: imp X-SVN-Commit-Paths: head/sys/geom X-SVN-Commit-Revision: 355038 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 23 Nov 2019 23:44:01 -0000 Author: imp Date: Sat Nov 23 23:44:00 2019 New Revision: 355038 URL: https://svnweb.freebsd.org/changeset/base/355038 Log: We don't even need Giant here. It isn't protecting anything internal to geom, and nothing we call requires it to be held. It's left over from a time when the latter wasn't the case. Retire it. Reviewed in concept: scottl@ Modified: head/sys/geom/geom_ctl.c Modified: head/sys/geom/geom_ctl.c ============================================================================== --- head/sys/geom/geom_ctl.c Sat Nov 23 23:43:52 2019 (r355037) +++ head/sys/geom/geom_ctl.c Sat Nov 23 23:44:00 2019 (r355038) @@ -68,7 +68,7 @@ static d_ioctl_t g_ctl_ioctl; static struct cdevsw g_ctl_cdevsw = { .d_version = D_VERSION, - .d_flags = D_NEEDGIANT, + .d_flags = 0, .d_ioctl = g_ctl_ioctl, .d_name = "g_ctl", }; From owner-svn-src-all@freebsd.org Sat Nov 23 23:57:27 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 16BB91C2B71; Sat, 23 Nov 2019 23:57:27 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47L9Fy6jnyz4b2L; Sat, 23 Nov 2019 23:57:26 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id C57CE1BABA; Sat, 23 Nov 2019 23:57:26 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xANNvQC4004081; Sat, 23 Nov 2019 23:57:26 GMT (envelope-from imp@FreeBSD.org) Received: (from imp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xANNvQwM004080; Sat, 23 Nov 2019 23:57:26 GMT (envelope-from imp@FreeBSD.org) Message-Id: <201911232357.xANNvQwM004080@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: imp set sender to imp@FreeBSD.org using -f From: Warner Losh Date: Sat, 23 Nov 2019 23:57:26 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r355039 - head/sys/kern X-SVN-Group: head X-SVN-Commit-Author: imp X-SVN-Commit-Paths: head/sys/kern X-SVN-Commit-Revision: 355039 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 23 Nov 2019 23:57:27 -0000 Author: imp Date: Sat Nov 23 23:57:26 2019 New Revision: 355039 URL: https://svnweb.freebsd.org/changeset/base/355039 Log: Add a warning about Giant Locked devices Add a warning when a device registers with devfs and requests D_NEEDGIANT. The warning says the device will go away before 13.0. This is needed to flush out the devices in the tree that are still Giant locked. This warning, or some variant of it, should have gone into the tree a long time ago... The intention is to require all devices be converted to not use automatic giant in this way, or remove any such devices that remain that we don't have the hardware to test a conversion of. kbd so far is the only device that can't leave the tree, yet needs something sensible done to avoid the auto giant lock (even if it is just doing the wrapping itself). There may be others added to this list... Any discussions of this topic will take place on arch@. Modified: head/sys/kern/kern_conf.c Modified: head/sys/kern/kern_conf.c ============================================================================== --- head/sys/kern/kern_conf.c Sat Nov 23 23:44:00 2019 (r355038) +++ head/sys/kern/kern_conf.c Sat Nov 23 23:57:26 2019 (r355039) @@ -664,6 +664,9 @@ prep_cdevsw(struct cdevsw *devsw, int flags) } if (devsw->d_flags & D_NEEDGIANT) { + printf("WARNING: Device \"%s\" is Giant locked and may be " + "deleted before FreeBSD 13.0.\n", + devsw->d_name == NULL ? "???" : devsw->d_name); if (devsw->d_gianttrick == NULL) { memcpy(dsw2, devsw, sizeof *dsw2); devsw->d_gianttrick = dsw2;