From owner-svn-src-all@freebsd.org Sun Aug 27 03:10:18 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 41519DE4BA7; Sun, 27 Aug 2017 03:10:18 +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 mx1.freebsd.org (Postfix) with ESMTPS id 017722CEB; Sun, 27 Aug 2017 03:10:17 +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 v7R3AGMu012118; Sun, 27 Aug 2017 03:10:16 GMT (envelope-from imp@FreeBSD.org) Received: (from imp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7R3AGEK012117; Sun, 27 Aug 2017 03:10:16 GMT (envelope-from imp@FreeBSD.org) Message-Id: <201708270310.v7R3AGEK012117@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: imp set sender to imp@FreeBSD.org using -f From: Warner Losh Date: Sun, 27 Aug 2017 03:10:16 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r322941 - head/sys/boot/efi/boot1 X-SVN-Group: head X-SVN-Commit-Author: imp X-SVN-Commit-Paths: head/sys/boot/efi/boot1 X-SVN-Commit-Revision: 322941 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 27 Aug 2017 03:10:18 -0000 Author: imp Date: Sun Aug 27 03:10:16 2017 New Revision: 322941 URL: https://svnweb.freebsd.org/changeset/base/322941 Log: Eliminate redunant device path matching. Use efi_devpath_match instead of device_paths_match. They are functionally the same. Remove device_paths_match from boot1.c and call efi_devpath_match instead. Sponsored by: Netflix Modified: head/sys/boot/efi/boot1/boot1.c Modified: head/sys/boot/efi/boot1/boot1.c ============================================================================== --- head/sys/boot/efi/boot1/boot1.c Sat Aug 26 23:13:18 2017 (r322940) +++ head/sys/boot/efi/boot1/boot1.c Sun Aug 27 03:10:16 2017 (r322941) @@ -76,53 +76,6 @@ Free(void *buf, const char *file __unused, int line __ } /* - * nodes_match returns TRUE if the imgpath isn't NULL and the nodes match, - * FALSE otherwise. - */ -static BOOLEAN -nodes_match(EFI_DEVICE_PATH *imgpath, EFI_DEVICE_PATH *devpath) -{ - size_t len; - - if (imgpath == NULL || imgpath->Type != devpath->Type || - imgpath->SubType != devpath->SubType) - return (FALSE); - - len = DevicePathNodeLength(imgpath); - if (len != DevicePathNodeLength(devpath)) - return (FALSE); - - return (memcmp(imgpath, devpath, (size_t)len) == 0); -} - -/* - * device_paths_match returns TRUE if the imgpath isn't NULL and all nodes - * in imgpath and devpath match up to their respective occurrences of a - * media node, FALSE otherwise. - */ -static BOOLEAN -device_paths_match(EFI_DEVICE_PATH *imgpath, EFI_DEVICE_PATH *devpath) -{ - - if (imgpath == NULL) - return (FALSE); - - while (!IsDevicePathEnd(imgpath) && !IsDevicePathEnd(devpath)) { - if (IsDevicePathType(imgpath, MEDIA_DEVICE_PATH) && - IsDevicePathType(devpath, MEDIA_DEVICE_PATH)) - return (TRUE); - - if (!nodes_match(imgpath, devpath)) - return (FALSE); - - imgpath = NextDevicePathNode(imgpath); - devpath = NextDevicePathNode(devpath); - } - - return (FALSE); -} - -/* * devpath_last returns the last non-path end node in devpath. */ static EFI_DEVICE_PATH * @@ -318,7 +271,7 @@ probe_handle(EFI_HANDLE h, EFI_DEVICE_PATH *imgpath, B if (!blkio->Media->LogicalPartition) return (EFI_UNSUPPORTED); - *preferred = device_paths_match(imgpath, devpath); + *preferred = efi_devpath_match(imgpath, devpath); /* Run through each module, see if it can load this partition */ for (i = 0; i < NUM_BOOT_MODULES; i++) { From owner-svn-src-all@freebsd.org Sun Aug 27 05:14:49 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 4A09ADE79C2; Sun, 27 Aug 2017 05:14:49 +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 mx1.freebsd.org (Postfix) with ESMTPS id 1966C65B54; Sun, 27 Aug 2017 05:14:49 +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 v7R5Emw5064786; Sun, 27 Aug 2017 05:14:48 GMT (envelope-from cem@FreeBSD.org) Received: (from cem@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7R5EmDK064785; Sun, 27 Aug 2017 05:14:48 GMT (envelope-from cem@FreeBSD.org) Message-Id: <201708270514.v7R5EmDK064785@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: cem set sender to cem@FreeBSD.org using -f From: Conrad Meyer Date: Sun, 27 Aug 2017 05:14:48 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r322942 - head/sys/kern X-SVN-Group: head X-SVN-Commit-Author: cem X-SVN-Commit-Paths: head/sys/kern X-SVN-Commit-Revision: 322942 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 27 Aug 2017 05:14:49 -0000 Author: cem Date: Sun Aug 27 05:14:48 2017 New Revision: 322942 URL: https://svnweb.freebsd.org/changeset/base/322942 Log: Improve scheduler performance Improve scheduler performance by flattening nonsensical topology layers (layers with only one child don't serve any purpose). This is especially relevant on non-AMD Zen systems after r322776. On my dual core Intel laptop, this brings the kern.sched.topology_spec table down from three levels to two. Submitted by: jeff Reviewed by: attilio Sponsored by: Dell EMC Isilon Modified: head/sys/kern/subr_smp.c Modified: head/sys/kern/subr_smp.c ============================================================================== --- head/sys/kern/subr_smp.c Sun Aug 27 03:10:16 2017 (r322941) +++ head/sys/kern/subr_smp.c Sun Aug 27 05:14:48 2017 (r322942) @@ -630,6 +630,15 @@ smp_topo(void) panic("Built bad topology at %p. CPU mask (%s) != (%s)", top, cpusetobj_strprint(cpusetbuf, &top->cg_mask), cpusetobj_strprint(cpusetbuf2, &all_cpus)); + + /* + * Collapse nonsense levels that may be created out of convenience by + * the MD layers. They cause extra work in the search functions. + */ + while (top->cg_children == 1) { + top = &top->cg_child[0]; + top->cg_parent = NULL; + } return (top); } From owner-svn-src-all@freebsd.org Sun Aug 27 06:24:08 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 4E5E7DE8765; Sun, 27 Aug 2017 06:24:08 +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 mx1.freebsd.org (Postfix) with ESMTPS id EE2E367229; Sun, 27 Aug 2017 06:24:07 +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 v7R6O7CM093060; Sun, 27 Aug 2017 06:24:07 GMT (envelope-from scottl@FreeBSD.org) Received: (from scottl@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7R6O6EM093053; Sun, 27 Aug 2017 06:24:06 GMT (envelope-from scottl@FreeBSD.org) Message-Id: <201708270624.v7R6O6EM093053@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: scottl set sender to scottl@FreeBSD.org using -f From: Scott Long Date: Sun, 27 Aug 2017 06:24:06 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r322943 - in head/sys/dev: mpr mps X-SVN-Group: head X-SVN-Commit-Author: scottl X-SVN-Commit-Paths: in head/sys/dev: mpr mps X-SVN-Commit-Revision: 322943 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 27 Aug 2017 06:24:08 -0000 Author: scottl Date: Sun Aug 27 06:24:06 2017 New Revision: 322943 URL: https://svnweb.freebsd.org/changeset/base/322943 Log: Start overhauling debug printing in the MPS and MPR drivers. The focus of this commit it to make initiazation less chatty in the normal case, and more useful and informative when real debugging is turned on. Reviewed by: ken (earlier version) Sponsored by: Netflix Modified: head/sys/dev/mpr/mpr.c head/sys/dev/mpr/mpr_mapping.c head/sys/dev/mpr/mpr_sas.c head/sys/dev/mpr/mpr_sas_lsi.c head/sys/dev/mpr/mpr_user.c head/sys/dev/mps/mps.c head/sys/dev/mps/mps_mapping.c head/sys/dev/mps/mps_sas.c head/sys/dev/mps/mps_sas_lsi.c head/sys/dev/mps/mps_user.c Modified: head/sys/dev/mpr/mpr.c ============================================================================== --- head/sys/dev/mpr/mpr.c Sun Aug 27 05:14:48 2017 (r322942) +++ head/sys/dev/mpr/mpr.c Sun Aug 27 06:24:06 2017 (r322943) @@ -115,7 +115,7 @@ static char mpt2_reset_magic[] = { 0x00, 0x0f, 0x04, 0 /* * Added this union to smoothly convert le64toh cm->cm_desc.Words. * Compiler only supports uint64_t to be passed as an argument. - * Otherwise it will through this error: + * Otherwise it will throw this error: * "aggregate value used where an integer was expected" */ typedef union _reply_descriptor { @@ -145,7 +145,7 @@ mpr_diag_reset(struct mpr_softc *sc,int sleep_flag) int i, error, tries = 0; uint8_t first_wait_done = FALSE; - mpr_dprint(sc, MPR_TRACE, "%s\n", __func__); + mpr_dprint(sc, MPR_INIT, "%s entered\n", __func__); /* Clear any pending interrupts */ mpr_regwrite(sc, MPI2_HOST_INTERRUPT_STATUS_OFFSET, 0x0); @@ -161,6 +161,7 @@ mpr_diag_reset(struct mpr_softc *sc,int sleep_flag) #endif //__FreeBSD_version >= 1000029 sleep_flag = NO_SLEEP; + mpr_dprint(sc, MPR_INIT, "sequence start, sleep_flag=%d\n", sleep_flag); /* Push the magic sequence */ error = ETIMEDOUT; while (tries++ < 20) { @@ -183,12 +184,17 @@ mpr_diag_reset(struct mpr_softc *sc,int sleep_flag) break; } } - if (error) + if (error) { + mpr_dprint(sc, MPR_INIT, "sequence failed, error=%d, exit\n", + error); return (error); + } /* Send the actual reset. XXX need to refresh the reg? */ - mpr_regwrite(sc, MPI2_HOST_DIAGNOSTIC_OFFSET, - reg | MPI2_DIAG_RESET_ADAPTER); + reg |= MPI2_DIAG_RESET_ADAPTER; + mpr_dprint(sc, MPR_INIT, "sequence success, sending reset, reg= 0x%x\n", + reg); + mpr_regwrite(sc, MPI2_HOST_DIAGNOSTIC_OFFSET, reg); /* Wait up to 300 seconds in 50ms intervals */ error = ETIMEDOUT; @@ -224,10 +230,14 @@ mpr_diag_reset(struct mpr_softc *sc,int sleep_flag) break; } } - if (error) + if (error) { + mpr_dprint(sc, MPR_INIT, "reset failed, error= %d, exit\n", + error); return (error); + } mpr_regwrite(sc, MPI2_WRITE_SEQUENCE_OFFSET, 0x0); + mpr_dprint(sc, MPR_INIT, "diag reset success, exit\n"); return (0); } @@ -235,20 +245,25 @@ mpr_diag_reset(struct mpr_softc *sc,int sleep_flag) static int mpr_message_unit_reset(struct mpr_softc *sc, int sleep_flag) { + int error; MPR_FUNCTRACE(sc); + mpr_dprint(sc, MPR_INIT, "%s entered\n", __func__); + + error = 0; mpr_regwrite(sc, MPI2_DOORBELL_OFFSET, MPI2_FUNCTION_IOC_MESSAGE_UNIT_RESET << MPI2_DOORBELL_FUNCTION_SHIFT); if (mpr_wait_db_ack(sc, 5, sleep_flag) != 0) { - mpr_dprint(sc, MPR_FAULT, "Doorbell handshake failed : <%s>\n", - __func__); - return (ETIMEDOUT); + mpr_dprint(sc, MPR_INIT|MPR_FAULT, + "Doorbell handshake failed\n"); + error = ETIMEDOUT; } - return (0); + mpr_dprint(sc, MPR_INIT, "%s exit\n", __func__); + return (error); } static int @@ -264,15 +279,21 @@ mpr_transition_ready(struct mpr_softc *sc) ? CAN_SLEEP : NO_SLEEP; error = 0; + + mpr_dprint(sc, MPR_INIT, "%s entered, sleep_flags= %d\n", + __func__, sleep_flags); + while (tries++ < 1200) { reg = mpr_regread(sc, MPI2_DOORBELL_OFFSET); - mpr_dprint(sc, MPR_INIT, "Doorbell= 0x%x\n", reg); + mpr_dprint(sc, MPR_INIT, " Doorbell= 0x%x\n", reg); /* * Ensure the IOC is ready to talk. If it's not, try * resetting it. */ if (reg & MPI2_DOORBELL_USED) { + mpr_dprint(sc, MPR_INIT, " Not ready, sending diag " + "reset\n"); mpr_diag_reset(sc, sleep_flags); DELAY(50000); continue; @@ -281,9 +302,11 @@ mpr_transition_ready(struct mpr_softc *sc) /* Is the adapter owned by another peer? */ if ((reg & MPI2_DOORBELL_WHO_INIT_MASK) == (MPI2_WHOINIT_PCI_PEER << MPI2_DOORBELL_WHO_INIT_SHIFT)) { - device_printf(sc->mpr_dev, "IOC is under the control " - "of another peer host, aborting initialization.\n"); - return (ENXIO); + mpr_dprint(sc, MPR_INIT|MPR_FAULT, "IOC is under the " + "control of another peer host, aborting " + "initialization.\n"); + error = ENXIO; + break; } state = reg & MPI2_IOC_STATE_MASK; @@ -292,7 +315,8 @@ mpr_transition_ready(struct mpr_softc *sc) error = 0; break; } else if (state == MPI2_IOC_STATE_FAULT) { - mpr_dprint(sc, MPR_FAULT, "IOC in fault state 0x%x\n", + mpr_dprint(sc, MPR_INIT|MPR_FAULT, "IOC in fault " + "state 0x%x, resetting\n", state & MPI2_DOORBELL_FAULT_CODE_MASK); mpr_diag_reset(sc, sleep_flags); } else if (state == MPI2_IOC_STATE_OPERATIONAL) { @@ -300,10 +324,10 @@ mpr_transition_ready(struct mpr_softc *sc) mpr_message_unit_reset(sc, sleep_flags); } else if (state == MPI2_IOC_STATE_RESET) { /* Wait a bit, IOC might be in transition */ - mpr_dprint(sc, MPR_FAULT, + mpr_dprint(sc, MPR_INIT|MPR_FAULT, "IOC in unexpected reset state\n"); } else { - mpr_dprint(sc, MPR_FAULT, + mpr_dprint(sc, MPR_INIT|MPR_FAULT, "IOC in unknown state 0x%x\n", state); error = EINVAL; break; @@ -314,7 +338,9 @@ mpr_transition_ready(struct mpr_softc *sc) } if (error) - device_printf(sc->mpr_dev, "Cannot transition IOC to ready\n"); + mpr_dprint(sc, MPR_INIT|MPR_FAULT, + "Cannot transition IOC to ready\n"); + mpr_dprint(sc, MPR_INIT, "%s exit\n", __func__); return (error); } @@ -328,18 +354,21 @@ mpr_transition_operational(struct mpr_softc *sc) error = 0; reg = mpr_regread(sc, MPI2_DOORBELL_OFFSET); - mpr_dprint(sc, MPR_INIT, "Doorbell= 0x%x\n", reg); + mpr_dprint(sc, MPR_INIT, "%s entered, Doorbell= 0x%x\n", __func__, reg); state = reg & MPI2_IOC_STATE_MASK; if (state != MPI2_IOC_STATE_READY) { + mpr_dprint(sc, MPR_INIT, "IOC not ready\n"); if ((error = mpr_transition_ready(sc)) != 0) { - mpr_dprint(sc, MPR_FAULT, - "%s failed to transition ready\n", __func__); + mpr_dprint(sc, MPR_INIT|MPR_FAULT, + "failed to transition ready, exit\n"); return (error); } } error = mpr_send_iocinit(sc); + mpr_dprint(sc, MPR_INIT, "%s exit\n", __func__); + return (error); } @@ -358,7 +387,7 @@ mpr_iocfacts_allocate(struct mpr_softc *sc, uint8_t at Mpi2IOCFactsReply_t saved_facts; uint8_t saved_mode, reallocating; - mpr_dprint(sc, MPR_TRACE, "%s\n", __func__); + mpr_dprint(sc, MPR_INIT|MPR_TRACE, "%s entered\n", __func__); /* Save old IOC Facts and then only reallocate if Facts have changed */ if (!attaching) { @@ -372,8 +401,8 @@ mpr_iocfacts_allocate(struct mpr_softc *sc, uint8_t at */ if ((error = mpr_get_iocfacts(sc, sc->facts)) != 0) { if (attaching) { - mpr_dprint(sc, MPR_FAULT, "%s failed to get IOC Facts " - "with error %d\n", __func__, error); + mpr_dprint(sc, MPR_INIT|MPR_FAULT, "Failed to get " + "IOC Facts with error %d, exit\n", error); return (error); } else { panic("%s failed to get IOC Facts with error %d\n", @@ -390,9 +419,10 @@ mpr_iocfacts_allocate(struct mpr_softc *sc, uint8_t at sc->facts->FWVersion.Struct.Unit, sc->facts->FWVersion.Struct.Dev); - mpr_printf(sc, "Firmware: %s, Driver: %s\n", sc->fw_version, + mpr_dprint(sc, MPR_INFO, "Firmware: %s, Driver: %s\n", sc->fw_version, MPR_DRIVER_VERSION); - mpr_printf(sc, "IOCCapabilities: %b\n", sc->facts->IOCCapabilities, + mpr_dprint(sc, MPR_INFO, + "IOCCapabilities: %b\n", sc->facts->IOCCapabilities, "\20" "\3ScsiTaskFull" "\4DiagTrace" "\5SnapBuf" "\6ExtBuf" "\7EEDP" "\10BiDirTarg" "\11Multicast" "\14TransRetry" "\15IR" "\16EventReplay" "\17RaidAccel" "\20MSIXIndex" "\21HostDisc" @@ -405,16 +435,15 @@ mpr_iocfacts_allocate(struct mpr_softc *sc, uint8_t at * but it doesn't hurt to do it again. Only do this if attaching, not * for a Diag Reset. */ - if (attaching) { - if ((sc->facts->IOCCapabilities & - MPI2_IOCFACTS_CAPABILITY_EVENT_REPLAY) == 0) { - mpr_diag_reset(sc, NO_SLEEP); - if ((error = mpr_transition_ready(sc)) != 0) { - mpr_dprint(sc, MPR_FAULT, "%s failed to " - "transition to ready with error %d\n", - __func__, error); - return (error); - } + if (attaching && ((sc->facts->IOCCapabilities & + MPI2_IOCFACTS_CAPABILITY_EVENT_REPLAY) == 0)) { + mpr_dprint(sc, MPR_INIT, "No event replay, resetting\n"); + mpr_diag_reset(sc, NO_SLEEP); + if ((error = mpr_transition_ready(sc)) != 0) { + mpr_dprint(sc, MPR_INIT|MPR_FAULT, "Failed to " + "transition to ready with error %d, exit\n", + error); + return (error); } } @@ -429,8 +458,8 @@ mpr_iocfacts_allocate(struct mpr_softc *sc, uint8_t at sc->ir_firmware = 1; if (!attaching) { if (sc->ir_firmware != saved_mode) { - mpr_dprint(sc, MPR_FAULT, "%s new IR/IT mode in IOC " - "Facts does not match previous mode\n", __func__); + mpr_dprint(sc, MPR_INIT|MPR_FAULT, "new IR/IT mode " + "in IOC Facts does not match previous mode\n"); } } @@ -540,8 +569,9 @@ mpr_iocfacts_allocate(struct mpr_softc *sc, uint8_t at ((error = mpr_alloc_replies(sc)) != 0) || ((error = mpr_alloc_requests(sc)) != 0)) { if (attaching ) { - mpr_dprint(sc, MPR_FAULT, "%s failed to alloc " - "queues with error %d\n", __func__, error); + mpr_dprint(sc, MPR_INIT|MPR_ERROR, + "Failed to alloc queues with error %d\n", + error); mpr_free(sc); return (error); } else { @@ -563,8 +593,8 @@ mpr_iocfacts_allocate(struct mpr_softc *sc, uint8_t at error = mpr_transition_operational(sc); if (error != 0) { if (attaching) { - mpr_printf(sc, "%s failed to transition to operational " - "with error %d\n", __func__, error); + mpr_dprint(sc, MPR_INIT|MPR_FAULT, "Failed to " + "transition to operational with error %d\n", error); mpr_free(sc); return (error); } else { @@ -592,18 +622,20 @@ mpr_iocfacts_allocate(struct mpr_softc *sc, uint8_t at */ /* XXX Should be dynamic so that IM/IR and user modules can attach */ if (attaching) { + mpr_dprint(sc, MPR_INIT, "Attaching subsystems\n"); if (((error = mpr_attach_log(sc)) != 0) || ((error = mpr_attach_sas(sc)) != 0) || ((error = mpr_attach_user(sc)) != 0)) { - mpr_printf(sc, "%s failed to attach all subsystems: " - "error %d\n", __func__, error); + mpr_dprint(sc, MPR_INIT|MPR_ERROR, + "Failed to attach all subsystems: error %d\n", + error); mpr_free(sc); return (error); } if ((error = mpr_pci_setup_interrupts(sc)) != 0) { - mpr_printf(sc, "%s failed to setup interrupts\n", - __func__); + mpr_dprint(sc, MPR_INIT|MPR_ERROR, + "Failed to setup interrupts\n"); mpr_free(sc); return (error); } @@ -706,14 +738,14 @@ mpr_reinit(struct mpr_softc *sc) mtx_assert(&sc->mpr_mtx, MA_OWNED); + mpr_dprint(sc, MPR_INIT|MPR_INFO, "Reinitializing controller\n"); if (sc->mpr_flags & MPR_FLAGS_DIAGRESET) { - mpr_dprint(sc, MPR_INIT, "%s reset already in progress\n", - __func__); + mpr_dprint(sc, MPR_INIT, "Reset already in progress\n"); return 0; } - mpr_dprint(sc, MPR_INFO, "Reinitializing controller,\n"); - /* make sure the completion callbacks can recognize they're getting + /* + * Make sure the completion callbacks can recognize they're getting * a NULL cm_reply due to a reset. */ sc->mpr_flags |= MPR_FLAGS_DIAGRESET; @@ -721,7 +753,7 @@ mpr_reinit(struct mpr_softc *sc) /* * Mask interrupts here. */ - mpr_dprint(sc, MPR_INIT, "%s mask interrupts\n", __func__); + mpr_dprint(sc, MPR_INIT, "Masking interrupts and resetting\n"); mpr_mask_intr(sc); error = mpr_diag_reset(sc, CAN_SLEEP); @@ -776,9 +808,10 @@ mpr_reinit(struct mpr_softc *sc) mpr_reregister_events(sc); /* the end of discovery will release the simq, so we're done. */ - mpr_dprint(sc, MPR_INFO, "%s finished sc %p post %u free %u\n", - __func__, sc, sc->replypostindex, sc->replyfreeindex); + mpr_dprint(sc, MPR_INIT|MPR_XINFO, "Finished sc %p post %u free %u\n", + sc, sc->replypostindex, sc->replyfreeindex); mprsas_release_simq_reinit(sassc); + mpr_dprint(sc, MPR_INIT, "%s exit error= %d\n", __func__, error); return 0; } @@ -800,7 +833,7 @@ mpr_wait_db_ack(struct mpr_softc *sc, int timeout, int do { int_status = mpr_regread(sc, MPI2_HOST_INTERRUPT_STATUS_OFFSET); if (!(int_status & MPI2_HIS_SYS2IOC_DB_STATUS)) { - mpr_dprint(sc, MPR_INIT, "%s: successful count(%d), " + mpr_dprint(sc, MPR_TRACE, "%s: successful count(%d), " "timeout(%d)\n", __func__, count, timeout); return 0; } else if (int_status & MPI2_HIS_IOC2SYS_DB_STATUS) { @@ -1022,6 +1055,7 @@ mpr_get_iocfacts(struct mpr_softc *sc, MPI2_IOC_FACTS_ int error, req_sz, reply_sz; MPR_FUNCTRACE(sc); + mpr_dprint(sc, MPR_INIT, "%s entered\n", __func__); req_sz = sizeof(MPI2_IOC_FACTS_REQUEST); reply_sz = sizeof(MPI2_IOC_FACTS_REPLY); @@ -1031,6 +1065,7 @@ mpr_get_iocfacts(struct mpr_softc *sc, MPI2_IOC_FACTS_ request.Function = MPI2_FUNCTION_IOC_FACTS; error = mpr_request_sync(sc, &request, reply, req_sz, reply_sz, 5); + mpr_dprint(sc, MPR_INIT, "%s exit, error= %d\n", __func__, error); return (error); } @@ -1044,6 +1079,7 @@ mpr_send_iocinit(struct mpr_softc *sc) uint64_t time_in_msec; MPR_FUNCTRACE(sc); + mpr_dprint(sc, MPR_INIT, "%s entered\n", __func__); req_sz = sizeof(MPI2_IOC_INIT_REQUEST); reply_sz = sizeof(MPI2_IOC_INIT_REPLY); @@ -1083,6 +1119,7 @@ mpr_send_iocinit(struct mpr_softc *sc) error = ENXIO; mpr_dprint(sc, MPR_INIT, "IOCInit status= 0x%x\n", reply.IOCStatus); + mpr_dprint(sc, MPR_INIT, "%s exit\n", __func__); return (error); } @@ -1130,12 +1167,12 @@ mpr_alloc_queues(struct mpr_softc *sc) 0, /* flags */ NULL, NULL, /* lockfunc, lockarg */ &sc->queues_dmat)) { - device_printf(sc->mpr_dev, "Cannot allocate queues DMA tag\n"); + mpr_dprint(sc, MPR_ERROR, "Cannot allocate queues DMA tag\n"); return (ENOMEM); } if (bus_dmamem_alloc(sc->queues_dmat, (void **)&queues, BUS_DMA_NOWAIT, &sc->queues_map)) { - device_printf(sc->mpr_dev, "Cannot allocate queues memory\n"); + mpr_dprint(sc, MPR_ERROR, "Cannot allocate queues memory\n"); return (ENOMEM); } bzero(queues, qsize); @@ -1174,12 +1211,12 @@ mpr_alloc_replies(struct mpr_softc *sc) 0, /* flags */ NULL, NULL, /* lockfunc, lockarg */ &sc->reply_dmat)) { - device_printf(sc->mpr_dev, "Cannot allocate replies DMA tag\n"); + mpr_dprint(sc, MPR_ERROR, "Cannot allocate replies DMA tag\n"); return (ENOMEM); } if (bus_dmamem_alloc(sc->reply_dmat, (void **)&sc->reply_frames, BUS_DMA_NOWAIT, &sc->reply_map)) { - device_printf(sc->mpr_dev, "Cannot allocate replies memory\n"); + mpr_dprint(sc, MPR_ERROR, "Cannot allocate replies memory\n"); return (ENOMEM); } bzero(sc->reply_frames, rsize); @@ -1208,12 +1245,12 @@ mpr_alloc_requests(struct mpr_softc *sc) 0, /* flags */ NULL, NULL, /* lockfunc, lockarg */ &sc->req_dmat)) { - device_printf(sc->mpr_dev, "Cannot allocate request DMA tag\n"); + mpr_dprint(sc, MPR_ERROR, "Cannot allocate request DMA tag\n"); return (ENOMEM); } if (bus_dmamem_alloc(sc->req_dmat, (void **)&sc->req_frames, BUS_DMA_NOWAIT, &sc->req_map)) { - device_printf(sc->mpr_dev, "Cannot allocate request memory\n"); + mpr_dprint(sc, MPR_ERROR, "Cannot allocate request memory\n"); return (ENOMEM); } bzero(sc->req_frames, rsize); @@ -1253,12 +1290,12 @@ mpr_alloc_requests(struct mpr_softc *sc) 0, /* flags */ NULL, NULL, /* lockfunc, lockarg */ &sc->chain_dmat)) { - device_printf(sc->mpr_dev, "Cannot allocate chain DMA tag\n"); + mpr_dprint(sc, MPR_ERROR, "Cannot allocate chain DMA tag\n"); return (ENOMEM); } if (bus_dmamem_alloc(sc->chain_dmat, (void **)&sc->chain_frames, BUS_DMA_NOWAIT, &sc->chain_map)) { - device_printf(sc->mpr_dev, "Cannot allocate chain memory\n"); + mpr_dprint(sc, MPR_ERROR, "Cannot allocate chain memory\n"); return (ENOMEM); } bzero(sc->chain_frames, rsize); @@ -1277,12 +1314,12 @@ mpr_alloc_requests(struct mpr_softc *sc) 0, /* flags */ NULL, NULL, /* lockfunc, lockarg */ &sc->sense_dmat)) { - device_printf(sc->mpr_dev, "Cannot allocate sense DMA tag\n"); + mpr_dprint(sc, MPR_ERROR, "Cannot allocate sense DMA tag\n"); return (ENOMEM); } if (bus_dmamem_alloc(sc->sense_dmat, (void **)&sc->sense_frames, BUS_DMA_NOWAIT, &sc->sense_map)) { - device_printf(sc->mpr_dev, "Cannot allocate sense memory\n"); + mpr_dprint(sc, MPR_ERROR, "Cannot allocate sense memory\n"); return (ENOMEM); } bzero(sc->sense_frames, rsize); @@ -1292,8 +1329,7 @@ mpr_alloc_requests(struct mpr_softc *sc) sc->chains = malloc(sizeof(struct mpr_chain) * sc->max_chains, M_MPR, M_WAITOK | M_ZERO); if (!sc->chains) { - device_printf(sc->mpr_dev, "Cannot allocate memory %s %d\n", - __func__, __LINE__); + mpr_dprint(sc, MPR_ERROR, "Cannot allocate chain memory\n"); return (ENOMEM); } for (i = 0; i < sc->max_chains; i++) { @@ -1330,7 +1366,7 @@ mpr_alloc_requests(struct mpr_softc *sc) busdma_lock_mutex, /* lockfunc */ &sc->mpr_mtx, /* lockarg */ &sc->buffer_dmat)) { - device_printf(sc->mpr_dev, "Cannot allocate buffer DMA tag\n"); + mpr_dprint(sc, MPR_ERROR, "Cannot allocate buffer DMA tag\n"); return (ENOMEM); } @@ -1341,8 +1377,7 @@ mpr_alloc_requests(struct mpr_softc *sc) sc->commands = malloc(sizeof(struct mpr_command) * sc->num_reqs, M_MPR, M_WAITOK | M_ZERO); if (!sc->commands) { - device_printf(sc->mpr_dev, "Cannot allocate memory %s %d\n", - __func__, __LINE__); + mpr_dprint(sc, MPR_ERROR, "Cannot allocate command memory\n"); return (ENOMEM); } for (i = 1; i < sc->num_reqs; i++) { @@ -1428,13 +1463,13 @@ mpr_alloc_nvme_prp_pages(struct mpr_softc *sc) 0, /* flags */ NULL, NULL, /* lockfunc, lockarg */ &sc->prp_page_dmat)) { - device_printf(sc->mpr_dev, "Cannot allocate NVMe PRP DMA " + mpr_dprint(sc, MPR_ERROR, "Cannot allocate NVMe PRP DMA " "tag\n"); return (ENOMEM); } if (bus_dmamem_alloc(sc->prp_page_dmat, (void **)&sc->prp_pages, BUS_DMA_NOWAIT, &sc->prp_page_map)) { - device_printf(sc->mpr_dev, "Cannot allocate NVMe PRP memory\n"); + mpr_dprint(sc, MPR_ERROR, "Cannot allocate NVMe PRP memory\n"); return (ENOMEM); } bzero(sc->prp_pages, rsize); @@ -1664,6 +1699,7 @@ mpr_attach(struct mpr_softc *sc) int error; MPR_FUNCTRACE(sc); + mpr_dprint(sc, MPR_INIT, "%s entered\n", __func__); mtx_init(&sc->mpr_mtx, "MPR lock", NULL, MTX_DEF); callout_init_mtx(&sc->periodic, &sc->mpr_mtx, 0); @@ -1672,15 +1708,16 @@ mpr_attach(struct mpr_softc *sc) timevalclear(&sc->lastfail); if ((error = mpr_transition_ready(sc)) != 0) { - mpr_printf(sc, "%s failed to transition ready\n", __func__); + mpr_dprint(sc, MPR_INIT|MPR_FAULT, + "Failed to transition ready\n"); return (error); } sc->facts = malloc(sizeof(MPI2_IOC_FACTS_REPLY), M_MPR, M_ZERO|M_NOWAIT); if (!sc->facts) { - device_printf(sc->mpr_dev, "Cannot allocate memory %s %d\n", - __func__, __LINE__); + mpr_dprint(sc, MPR_INIT|MPR_FAULT, + "Cannot allocate memory, exit\n"); return (ENOMEM); } @@ -1692,8 +1729,8 @@ mpr_attach(struct mpr_softc *sc) * memory. If this fails, any allocated memory should already be freed. */ if ((error = mpr_iocfacts_allocate(sc, TRUE)) != 0) { - mpr_dprint(sc, MPR_FAULT, "%s IOC Facts based allocation " - "failed with error %d\n", __func__, error); + mpr_dprint(sc, MPR_INIT|MPR_FAULT, "IOC Facts allocation " + "failed with error %d\n", error); return (error); } @@ -1708,7 +1745,8 @@ mpr_attach(struct mpr_softc *sc) sc->mpr_ich.ich_func = mpr_startup; sc->mpr_ich.ich_arg = sc; if (config_intrhook_establish(&sc->mpr_ich) != 0) { - mpr_dprint(sc, MPR_ERROR, "Cannot establish MPR config hook\n"); + mpr_dprint(sc, MPR_INIT|MPR_ERROR, + "Cannot establish MPR config hook\n"); error = EINVAL; } @@ -1719,12 +1757,13 @@ mpr_attach(struct mpr_softc *sc) mprsas_ir_shutdown, sc, SHUTDOWN_PRI_DEFAULT); if (sc->shutdown_eh == NULL) - mpr_dprint(sc, MPR_ERROR, "shutdown event registration " - "failed\n"); + mpr_dprint(sc, MPR_INIT|MPR_ERROR, + "shutdown event registration failed\n"); mpr_setup_sysctl(sc); sc->mpr_flags |= MPR_FLAGS_ATTACH_DONE; + mpr_dprint(sc, MPR_INIT, "%s exit error= %d\n", __func__, error); return (error); } @@ -1736,6 +1775,7 @@ mpr_startup(void *arg) struct mpr_softc *sc; sc = (struct mpr_softc *)arg; + mpr_dprint(sc, MPR_INIT, "%s entered\n", __func__); mpr_lock(sc); mpr_unmask_intr(sc); @@ -1745,6 +1785,7 @@ mpr_startup(void *arg) mpr_mapping_initialize(sc); mprsas_startup(sc); mpr_unlock(sc); + mpr_dprint(sc, MPR_INIT, "%s exit\n", __func__); } /* Periodic watchdog. Is called with the driver lock already held. */ @@ -1831,6 +1872,7 @@ mpr_free(struct mpr_softc *sc) { int error; + mpr_dprint(sc, MPR_INIT, "%s entered\n", __func__); /* Turn off the watchdog */ mpr_lock(sc); sc->mpr_flags |= MPR_FLAGS_SHUTDOWN; @@ -1840,8 +1882,11 @@ mpr_free(struct mpr_softc *sc) callout_drain(&sc->device_check_callout); if (((error = mpr_detach_log(sc)) != 0) || - ((error = mpr_detach_sas(sc)) != 0)) + ((error = mpr_detach_sas(sc)) != 0)) { + mpr_dprint(sc, MPR_INIT|MPR_FAULT, "failed to detach " + "subsystems, error= %d, exit\n", error); return (error); + } mpr_detach_user(sc); @@ -1870,6 +1915,7 @@ mpr_free(struct mpr_softc *sc) EVENTHANDLER_DEREGISTER(shutdown_final, sc->shutdown_eh); mtx_destroy(&sc->mpr_mtx); + mpr_dprint(sc, MPR_INIT, "%s exit\n", __func__); return (0); } @@ -2215,8 +2261,8 @@ mpr_register_events(struct mpr_softc *sc, uint8_t *mas eh = malloc(sizeof(struct mpr_event_handle), M_MPR, M_WAITOK|M_ZERO); if (!eh) { - device_printf(sc->mpr_dev, "Cannot allocate memory %s %d\n", - __func__, __LINE__); + mpr_dprint(sc, MPR_EVENT|MPR_ERROR, + "Cannot allocate event memory\n"); return (ENOMEM); } eh->callback = cb; @@ -2760,13 +2806,11 @@ mpr_check_pcie_native_sgl(struct mpr_softc *sc, struct * boundary if this is not the first page. If so, this is not * expected so have FW build the SGL. */ - if (i) { - if ((uint32_t)paddr & page_mask) { - mpr_dprint(sc, MPR_ERROR, "Unaligned SGE while " - "building NVMe PRPs, low address is 0x%x\n", - (uint32_t)paddr); - return 1; - } + if ((i != 0) && (((uint32_t)paddr & page_mask) != 0)) { + mpr_dprint(sc, MPR_ERROR, "Unaligned SGE while " + "building NVMe PRPs, low address is 0x%x\n", + (uint32_t)paddr); + return 1; } /* Apart from last SGE, if any other SGE boundary is not page Modified: head/sys/dev/mpr/mpr_mapping.c ============================================================================== --- head/sys/dev/mpr/mpr_mapping.c Sun Aug 27 05:14:48 2017 (r322942) +++ head/sys/dev/mpr/mpr_mapping.c Sun Aug 27 06:24:06 2017 (r322943) @@ -1188,9 +1188,6 @@ _mapping_get_dev_info(struct mpr_softc *sc, "disk type (SSD or HDD) and SAS Address " "for SATA device with handle 0x%04x\n", __func__, phy_change->dev_handle); - } else { - mpr_dprint(sc, MPR_INFO, "SAS Address for SATA " - "device = %jx\n", sas_address); } } Modified: head/sys/dev/mpr/mpr_sas.c ============================================================================== --- head/sys/dev/mpr/mpr_sas.c Sun Aug 27 05:14:48 2017 (r322942) +++ head/sys/dev/mpr/mpr_sas.c Sun Aug 27 06:24:06 2017 (r322943) @@ -731,11 +731,12 @@ mpr_attach_sas(struct mpr_softc *sc) int unit, error = 0; MPR_FUNCTRACE(sc); + mpr_dprint(sc, MPR_INIT, "%s entered\n", __func__); sassc = malloc(sizeof(struct mprsas_softc), M_MPR, M_WAITOK|M_ZERO); if (!sassc) { - device_printf(sc->mpr_dev, "Cannot allocate memory %s %d\n", - __func__, __LINE__); + mpr_dprint(sc, MPR_INIT|MPR_ERROR, + "Cannot allocate SAS subsystem memory\n"); return (ENOMEM); } @@ -749,8 +750,8 @@ mpr_attach_sas(struct mpr_softc *sc) sassc->targets = malloc(sizeof(struct mprsas_target) * sassc->maxtargets, M_MPR, M_WAITOK|M_ZERO); if (!sassc->targets) { - device_printf(sc->mpr_dev, "Cannot allocate memory %s %d\n", - __func__, __LINE__); + mpr_dprint(sc, MPR_INIT|MPR_ERROR, + "Cannot allocate SAS target memory\n"); free(sassc, M_MPR); return (ENOMEM); } @@ -758,7 +759,7 @@ mpr_attach_sas(struct mpr_softc *sc) sassc->sc = sc; if ((sassc->devq = cam_simq_alloc(sc->num_reqs)) == NULL) { - mpr_dprint(sc, MPR_ERROR, "Cannot allocate SIMQ\n"); + mpr_dprint(sc, MPR_INIT|MPR_ERROR, "Cannot allocate SIMQ\n"); error = ENOMEM; goto out; } @@ -767,7 +768,7 @@ mpr_attach_sas(struct mpr_softc *sc) sassc->sim = cam_sim_alloc(mprsas_action, mprsas_poll, "mpr", sassc, unit, &sc->mpr_mtx, sc->num_reqs, sc->num_reqs, sassc->devq); if (sassc->sim == NULL) { - mpr_dprint(sc, MPR_ERROR, "Cannot allocate SIM\n"); + mpr_dprint(sc, MPR_INIT|MPR_ERROR, "Cannot allocate SIM\n"); error = EINVAL; goto out; } @@ -789,8 +790,8 @@ mpr_attach_sas(struct mpr_softc *sc) * everything is just a target on a single bus. */ if ((error = xpt_bus_register(sassc->sim, sc->mpr_dev, 0)) != 0) { - mpr_dprint(sc, MPR_ERROR, "Error %d registering SCSI bus\n", - error); + mpr_dprint(sc, MPR_INIT|MPR_ERROR, + "Error %d registering SCSI bus\n", error); mpr_unlock(sc); goto out; } @@ -814,7 +815,8 @@ mpr_attach_sas(struct mpr_softc *sc) cam_sim_path(sc->sassc->sim), CAM_TARGET_WILDCARD, CAM_LUN_WILDCARD); if (status != CAM_REQ_CMP) { - mpr_printf(sc, "Error %#x creating sim path\n", status); + mpr_dprint(sc, MPR_INIT|MPR_ERROR, + "Error %#x creating sim path\n", status); sassc->path = NULL; } else { int event; @@ -890,6 +892,8 @@ mpr_attach_sas(struct mpr_softc *sc) out: if (error) mpr_detach_sas(sc); + + mpr_dprint(sc, MPR_INIT, "%s exit, error= %d\n", __func__, error); return (error); } Modified: head/sys/dev/mpr/mpr_sas_lsi.c ============================================================================== --- head/sys/dev/mpr/mpr_sas_lsi.c Sun Aug 27 05:14:48 2017 (r322942) +++ head/sys/dev/mpr/mpr_sas_lsi.c Sun Aug 27 06:24:06 2017 (r322943) @@ -798,7 +798,8 @@ mprsas_add_device(struct mpr_softc *sc, u16 handle, u8 if ((mpr_config_get_sas_device_pg0(sc, &tmp_mpi_reply, &parent_config_page, MPI2_SAS_DEVICE_PGAD_FORM_HANDLE, le16toh(config_page.ParentDevHandle)))) { - printf("%s: error reading SAS device %#x page0\n", + mpr_dprint(sc, MPR_MAPPING|MPR_FAULT, + "%s: error reading SAS device %#x page0\n", __func__, le16toh(config_page.ParentDevHandle)); } else { parent_sas_address = parent_config_page.SASAddress.High; @@ -810,8 +811,8 @@ mprsas_add_device(struct mpr_softc *sc, u16 handle, u8 /* TODO Check proper endianness */ sas_address = config_page.SASAddress.High; sas_address = (sas_address << 32) | config_page.SASAddress.Low; - mpr_dprint(sc, MPR_INFO, "SAS Address from SAS device page0 = %jx\n", - sas_address); + mpr_dprint(sc, MPR_MAPPING, "Handle 0x%04x SAS Address from SAS device " + "page0 = %jx\n", handle, sas_address); /* * Always get SATA Identify information because this is used to @@ -822,12 +823,13 @@ mprsas_add_device(struct mpr_softc *sc, u16 handle, u8 ret = mprsas_get_sas_address_for_sata_disk(sc, &sas_address, handle, device_info, &is_SATA_SSD); if (ret) { - mpr_dprint(sc, MPR_ERROR, "%s: failed to get disk type " - "(SSD or HDD) for SATA device with handle 0x%04x\n", + mpr_dprint(sc, MPR_MAPPING|MPR_ERROR, + "%s: failed to get disk type (SSD or HDD) for SATA " + "device with handle 0x%04x\n", __func__, handle); } else { - mpr_dprint(sc, MPR_INFO, "SAS Address from SATA " - "device = %jx\n", sas_address); + mpr_dprint(sc, MPR_MAPPING, "Handle 0x%04x SAS Address " + "from SATA device = %jx\n", handle, sas_address); } } @@ -870,8 +872,8 @@ mprsas_add_device(struct mpr_softc *sc, u16 handle, u8 targ = &sassc->targets[id]; if (!(targ->flags & MPR_TARGET_FLAGS_RAID_COMPONENT)) { if (mprsas_check_id(sassc, id) != 0) { - device_printf(sc->mpr_dev, "Excluding target id %d\n", - id); + mpr_dprint(sc, MPR_MAPPING|MPR_INFO, + "Excluding target id %d\n", id); error = ENXIO; goto out; } @@ -884,8 +886,6 @@ mprsas_add_device(struct mpr_softc *sc, u16 handle, u8 } } - mpr_dprint(sc, MPR_MAPPING, "SAS Address from SAS device page0 = %jx\n", - sas_address); targ->devinfo = device_info; targ->devname = le32toh(config_page.DeviceName.High); targ->devname = (targ->devname << 32) | @@ -1292,7 +1292,8 @@ mprsas_add_pcie_device(struct mpr_softc *sc, u16 handl __func__, id); if (mprsas_check_id(sassc, id) != 0) { - device_printf(sc->mpr_dev, "Excluding target id %d\n", id); + mpr_dprint(sc, MPR_MAPPING|MPR_INFO, + "Excluding target id %d\n", id); error = ENXIO; goto out; } Modified: head/sys/dev/mpr/mpr_user.c ============================================================================== --- head/sys/dev/mpr/mpr_user.c Sun Aug 27 05:14:48 2017 (r322942) +++ head/sys/dev/mpr/mpr_user.c Sun Aug 27 06:24:06 2017 (r322943) @@ -1504,14 +1504,14 @@ mpr_diag_register(struct mpr_softc *sc, mpr_fw_diag_re 0, /* flags */ NULL, NULL, /* lockfunc, lockarg */ &sc->fw_diag_dmat)) { - device_printf(sc->mpr_dev, "Cannot allocate FW diag buffer DMA " - "tag\n"); + mpr_dprint(sc, MPR_ERROR, + "Cannot allocate FW diag buffer DMA tag\n"); return (ENOMEM); } if (bus_dmamem_alloc(sc->fw_diag_dmat, (void **)&sc->fw_diag_buffer, BUS_DMA_NOWAIT, &sc->fw_diag_map)) { - device_printf(sc->mpr_dev, "Cannot allocate FW diag buffer " - "memory\n"); + mpr_dprint(sc, MPR_ERROR, + "Cannot allocate FW diag buffer memory\n"); return (ENOMEM); } bzero(sc->fw_diag_buffer, buffer_size); Modified: head/sys/dev/mps/mps.c ============================================================================== --- head/sys/dev/mps/mps.c Sun Aug 27 05:14:48 2017 (r322942) +++ head/sys/dev/mps/mps.c Sun Aug 27 06:24:06 2017 (r322943) @@ -111,7 +111,7 @@ static char mpt2_reset_magic[] = { 0x00, 0x0f, 0x04, 0 /* Added this union to smoothly convert le64toh cm->cm_desc.Words. * Compiler only support unint64_t to be passed as argument. - * Otherwise it will through below error + * Otherwise it will throw below error * "aggregate value used where an integer was expected" */ @@ -143,16 +143,19 @@ mps_diag_reset(struct mps_softc *sc,int sleep_flag) int i, error, tries = 0; uint8_t first_wait_done = FALSE; - mps_dprint(sc, MPS_TRACE, "%s\n", __func__); + mps_dprint(sc, MPS_INIT, "%s entered\n", __func__); /* Clear any pending interrupts */ mps_regwrite(sc, MPI2_HOST_INTERRUPT_STATUS_OFFSET, 0x0); - /*Force NO_SLEEP for threads prohibited to sleep - * e.a Thread from interrupt handler are prohibited to sleep. - */ + /* + * Force NO_SLEEP for threads prohibited to sleep + * e.a Thread from interrupt handler are prohibited to sleep. + */ if (curthread->td_no_sleeping != 0) sleep_flag = NO_SLEEP; + + mps_dprint(sc, MPS_INIT, "sequence start, sleep_flag= %d\n", sleep_flag); /* Push the magic sequence */ error = ETIMEDOUT; @@ -175,12 +178,17 @@ mps_diag_reset(struct mps_softc *sc,int sleep_flag) break; } } - if (error) + if (error) { + mps_dprint(sc, MPS_INIT, "sequence failed, error=%d, exit\n", + error); return (error); + } /* Send the actual reset. XXX need to refresh the reg? */ - mps_regwrite(sc, MPI2_HOST_DIAGNOSTIC_OFFSET, - reg | MPI2_DIAG_RESET_ADAPTER); + reg |= MPI2_DIAG_RESET_ADAPTER; + mps_dprint(sc, MPS_INIT, "sequence success, sending reset, reg= 0x%x\n", + reg); + mps_regwrite(sc, MPI2_HOST_DIAGNOSTIC_OFFSET, reg); /* Wait up to 300 seconds in 50ms intervals */ error = ETIMEDOUT; @@ -216,10 +224,14 @@ mps_diag_reset(struct mps_softc *sc,int sleep_flag) break; } } - if (error) + if (error) { + mps_dprint(sc, MPS_INIT, "reset failed, error= %d, exit\n", + error); return (error); + } mps_regwrite(sc, MPI2_WRITE_SEQUENCE_OFFSET, 0x0); + mps_dprint(sc, MPS_INIT, "diag reset success, exit\n"); return (0); } @@ -227,20 +239,25 @@ mps_diag_reset(struct mps_softc *sc,int sleep_flag) static int mps_message_unit_reset(struct mps_softc *sc, int sleep_flag) { + int error; MPS_FUNCTRACE(sc); + mps_dprint(sc, MPS_INIT, "%s entered\n", __func__); + + error = 0; mps_regwrite(sc, MPI2_DOORBELL_OFFSET, MPI2_FUNCTION_IOC_MESSAGE_UNIT_RESET << MPI2_DOORBELL_FUNCTION_SHIFT); if (mps_wait_db_ack(sc, 5, sleep_flag) != 0) { - mps_dprint(sc, MPS_FAULT, "Doorbell handshake failed : <%s>\n", - __func__); - return (ETIMEDOUT); + mps_dprint(sc, MPS_INIT|MPS_FAULT, + "Doorbell handshake failed\n"); + error = ETIMEDOUT; } - return (0); + mps_dprint(sc, MPS_INIT, "%s exit\n", __func__); + return (error); } static int @@ -255,15 +272,21 @@ mps_transition_ready(struct mps_softc *sc) sleep_flags = (sc->mps_flags & MPS_FLAGS_ATTACH_DONE) ? CAN_SLEEP:NO_SLEEP; error = 0; + + mps_dprint(sc, MPS_INIT, "%s entered, sleep_flags= %d\n", + __func__, sleep_flags); + while (tries++ < 1200) { reg = mps_regread(sc, MPI2_DOORBELL_OFFSET); - mps_dprint(sc, MPS_INIT, "Doorbell= 0x%x\n", reg); + mps_dprint(sc, MPS_INIT, " Doorbell= 0x%x\n", reg); /* * Ensure the IOC is ready to talk. If it's not, try * resetting it. */ if (reg & MPI2_DOORBELL_USED) { + mps_dprint(sc, MPS_INIT, " Not ready, sending diag " + "reset\n"); mps_diag_reset(sc, sleep_flags); DELAY(50000); continue; @@ -272,9 +295,11 @@ mps_transition_ready(struct mps_softc *sc) /* Is the adapter owned by another peer? */ if ((reg & MPI2_DOORBELL_WHO_INIT_MASK) == (MPI2_WHOINIT_PCI_PEER << MPI2_DOORBELL_WHO_INIT_SHIFT)) { - device_printf(sc->mps_dev, "IOC is under the control " - "of another peer host, aborting initialization.\n"); - return (ENXIO); + mps_dprint(sc, MPS_INIT|MPS_FAULT, "IOC is under the " + "control of another peer host, aborting " + "initialization.\n"); + error = ENXIO; + break; } state = reg & MPI2_IOC_STATE_MASK; @@ -283,7 +308,8 @@ mps_transition_ready(struct mps_softc *sc) error = 0; break; } else if (state == MPI2_IOC_STATE_FAULT) { - mps_dprint(sc, MPS_FAULT, "IOC in fault state 0x%x, resetting\n", + mps_dprint(sc, MPS_INIT|MPS_FAULT, "IOC in fault " + "state 0x%x, resetting\n", state & MPI2_DOORBELL_FAULT_CODE_MASK); mps_diag_reset(sc, sleep_flags); } else if (state == MPI2_IOC_STATE_OPERATIONAL) { @@ -291,10 +317,10 @@ mps_transition_ready(struct mps_softc *sc) mps_message_unit_reset(sc, sleep_flags); } else if (state == MPI2_IOC_STATE_RESET) { /* Wait a bit, IOC might be in transition */ - mps_dprint(sc, MPS_FAULT, + mps_dprint(sc, MPS_INIT|MPS_FAULT, "IOC in unexpected reset state\n"); } else { - mps_dprint(sc, MPS_FAULT, + mps_dprint(sc, MPS_INIT|MPS_FAULT, "IOC in unknown state 0x%x\n", state); error = EINVAL; break; @@ -305,7 +331,9 @@ mps_transition_ready(struct mps_softc *sc) } if (error) - device_printf(sc->mps_dev, "Cannot transition IOC to ready\n"); *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-all@freebsd.org Sun Aug 27 08:19:00 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 82BB4DEA343 for ; Sun, 27 Aug 2017 08:19:00 +0000 (UTC) (envelope-from ed@nuxi.nl) Received: from mail-yw0-x233.google.com (mail-yw0-x233.google.com [IPv6:2607:f8b0:4002:c05::233]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 42DDE69E76 for ; Sun, 27 Aug 2017 08:19:00 +0000 (UTC) (envelope-from ed@nuxi.nl) Received: by mail-yw0-x233.google.com with SMTP id s143so16601390ywg.0 for ; Sun, 27 Aug 2017 01:19:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nuxi-nl.20150623.gappssmtp.com; s=20150623; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=tN8Njho87bvaVmoMBOy8dopwaAPMs9lMlPfHkSieQ1w=; b=nt+UlxOkd5Gi/IuJ7au8vLzhMh+bAL2arjtp9PEyMro6IOAsdlezchkhOgL46NbBdg BCFnEzSQ/4xSh7Hxxxk4VNO6Dvp6/xZWpbP3TI7yhAiOzZyXDr0Ekpvr3/OGhdh+dhRC j++LtEy5zqpAuI5yQqKpb9imPBQMUd99Wpffc1bRfA5W/eGCDs7aVx7PGcNJaRM3rXho gSOc/Xnv4e5fbO+RFjMpIQ9PILwv/HBZHhJ7JVzXixTUyTUFvBSckGkgy1g9v6MV6++P Eoa8I8qP07AQ1pC5+fmr7aT6eu6+zokf4qYGobSBDd33lLOrDs2FNXwNjWAEXaTcKGRh aNOQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=tN8Njho87bvaVmoMBOy8dopwaAPMs9lMlPfHkSieQ1w=; b=BMfv17OeZBQMtIVMIwpXuMpdUCzGkeetvgl0lVzeyDhLeDHQM50J0F6HKumYX18KV4 +B9xVc1+cwcGaw0b3oKYinwmwWbyjS4V8uKMAcG2wBtA7Qipza5g8/d9hZlzmq9e7qqb MRCvzd1078gnl9i1QJW4nfrZ+W5SuzYeT+JMqzwnQBl5VZzPCv2KktdvvJ5uCGYdcfo1 LWQ9wodnmmsKmQWSEpoIHkhLPMsYRc19apX6o4WVExt8w7ajRhoGGd3/K0FchAEUeVAh 9xhJSxYQ9Xx/LtkvQpvCJXuEN/mx7DIZTQlc4B4tWF6mNO8G8YO7cJiJBFP0jvFmgz/i DAQg== X-Gm-Message-State: AHYfb5hOLdw631wKFmswb3zBGzcBcrJoxF/9nUEALCcH36UGHnFZGKxW uifyMAoh9gmaHZnyUvA1/fzUnH43Lb+6 X-Received: by 10.129.50.206 with SMTP id y197mr737860ywy.314.1503821939370; Sun, 27 Aug 2017 01:18:59 -0700 (PDT) MIME-Version: 1.0 Received: by 10.13.227.193 with HTTP; Sun, 27 Aug 2017 01:18:28 -0700 (PDT) In-Reply-To: <201708270514.v7R5EmDK064785@repo.freebsd.org> References: <201708270514.v7R5EmDK064785@repo.freebsd.org> From: Ed Schouten Date: Sun, 27 Aug 2017 10:18:28 +0200 Message-ID: Subject: Re: svn commit: r322942 - head/sys/kern To: Conrad Meyer Cc: src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org Content-Type: text/plain; charset="UTF-8" X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 27 Aug 2017 08:19:00 -0000 Hi Conrad, [ Context: I don't understand anything about CPU topologies! ] 2017-08-27 7:14 GMT+02:00 Conrad Meyer : > + while (top->cg_children == 1) { > + top = &top->cg_child[0]; > + top->cg_parent = NULL; > + } This only removes layers from the top if they only have a single child. Question: is it possible/likely to have CPU topologies where one of the middle layers only has one child? If so, would it make sense to use tree traversal here to do the flattening? -- Ed Schouten Nuxi, 's-Hertogenbosch, the Netherlands KvK-nr.: 62051717 From owner-svn-src-all@freebsd.org Sun Aug 27 11:22:20 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 8DE82DED750; Sun, 27 Aug 2017 11:22:20 +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 mx1.freebsd.org (Postfix) with ESMTPS id 5B51F6EAC0; Sun, 27 Aug 2017 11:22:20 +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 v7RBMJrG015025; Sun, 27 Aug 2017 11:22:19 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7RBMJ9L015024; Sun, 27 Aug 2017 11:22:19 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201708271122.v7RBMJ9L015024@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Sun, 27 Aug 2017 11:22:19 +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: r322944 - stable/11/sys/amd64/amd64 X-SVN-Group: stable-11 X-SVN-Commit-Author: kib X-SVN-Commit-Paths: stable/11/sys/amd64/amd64 X-SVN-Commit-Revision: 322944 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 27 Aug 2017 11:22:20 -0000 Author: kib Date: Sun Aug 27 11:22:19 2017 New Revision: 322944 URL: https://svnweb.freebsd.org/changeset/base/322944 Log: MFC r322718: Use ANSI C declaration for trap_pfault(). Style. Modified: stable/11/sys/amd64/amd64/trap.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/amd64/amd64/trap.c ============================================================================== --- stable/11/sys/amd64/amd64/trap.c Sun Aug 27 06:24:06 2017 (r322943) +++ stable/11/sys/amd64/amd64/trap.c Sun Aug 27 11:22:19 2017 (r322944) @@ -609,17 +609,20 @@ trap_check(struct trapframe *frame) } static int -trap_pfault(frame, usermode) - struct trapframe *frame; - int usermode; +trap_pfault(struct trapframe *frame, int usermode) { - vm_offset_t va; + struct thread *td; + struct proc *p; vm_map_t map; - int rv = 0; + vm_offset_t va; + int rv; vm_prot_t ftype; - struct thread *td = curthread; - struct proc *p = td->td_proc; - vm_offset_t eva = frame->tf_addr; + vm_offset_t eva; + + td = curthread; + p = td->td_proc; + eva = frame->tf_addr; + rv = 0; if (__predict_false((td->td_pflags & TDP_NOFAULTING) != 0)) { /* From owner-svn-src-all@freebsd.org Sun Aug 27 11:23:53 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 74422DED7F9; Sun, 27 Aug 2017 11:23:53 +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 mx1.freebsd.org (Postfix) with ESMTPS id 41CFA6EC31; Sun, 27 Aug 2017 11:23:53 +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 v7RBNqRp015132; Sun, 27 Aug 2017 11:23:52 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7RBNqnq015131; Sun, 27 Aug 2017 11:23:52 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201708271123.v7RBNqnq015131@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Sun, 27 Aug 2017 11:23:52 +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: r322945 - stable/11/sys/amd64/amd64 X-SVN-Group: stable-11 X-SVN-Commit-Author: kib X-SVN-Commit-Paths: stable/11/sys/amd64/amd64 X-SVN-Commit-Revision: 322945 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 27 Aug 2017 11:23:53 -0000 Author: kib Date: Sun Aug 27 11:23:52 2017 New Revision: 322945 URL: https://svnweb.freebsd.org/changeset/base/322945 Log: MFC r322719: Trim excessive 'extern' and remove unused declaration. Modified: stable/11/sys/amd64/amd64/trap.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/amd64/amd64/trap.c ============================================================================== --- stable/11/sys/amd64/amd64/trap.c Sun Aug 27 11:22:19 2017 (r322944) +++ stable/11/sys/amd64/amd64/trap.c Sun Aug 27 11:23:52 2017 (r322945) @@ -99,9 +99,8 @@ PMC_SOFT_DEFINE( , , page_fault, write); #include #endif -extern void __noinline trap(struct trapframe *frame); -extern void trap_check(struct trapframe *frame); -extern void syscall(struct trapframe *frame); +void __noinline trap(struct trapframe *frame); +void trap_check(struct trapframe *frame); void dblfault_handler(struct trapframe *frame); static int trap_pfault(struct trapframe *, int); From owner-svn-src-all@freebsd.org Sun Aug 27 11:27:29 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 038DCDED8CF; Sun, 27 Aug 2017 11:27:29 +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 mx1.freebsd.org (Postfix) with ESMTPS id CE1086ED8C; Sun, 27 Aug 2017 11:27:28 +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 v7RBRR6F015337; Sun, 27 Aug 2017 11:27:27 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7RBRRDn015336; Sun, 27 Aug 2017 11:27:27 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201708271127.v7RBRRDn015336@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Sun, 27 Aug 2017 11:27: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: r322946 - stable/11/sys/amd64/amd64 X-SVN-Group: stable-11 X-SVN-Commit-Author: kib X-SVN-Commit-Paths: stable/11/sys/amd64/amd64 X-SVN-Commit-Revision: 322946 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 27 Aug 2017 11:27:29 -0000 Author: kib Date: Sun Aug 27 11:27:27 2017 New Revision: 322946 URL: https://svnweb.freebsd.org/changeset/base/322946 Log: MFC r322720,r322723: Simplify amd64 trap(). Modified: stable/11/sys/amd64/amd64/trap.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/amd64/amd64/trap.c ============================================================================== --- stable/11/sys/amd64/amd64/trap.c Sun Aug 27 11:23:52 2017 (r322945) +++ stable/11/sys/amd64/amd64/trap.c Sun Aug 27 11:27:27 2017 (r322946) @@ -172,12 +172,12 @@ trap(struct trapframe *frame) #ifdef KDB register_t dr6; #endif - int i, ucode; + int signo, ucode; u_int type; td = curthread; p = td->td_proc; - i = 0; + signo = 0; ucode = 0; addr = 0; @@ -186,22 +186,20 @@ trap(struct trapframe *frame) #ifdef SMP /* Handler for NMI IPIs used for stopping CPUs. */ - if (type == T_NMI) { - if (ipi_nmi_handler() == 0) - goto out; - } -#endif /* SMP */ + if (type == T_NMI && ipi_nmi_handler() == 0) + return; +#endif #ifdef KDB if (kdb_active) { kdb_reenter(); - goto out; + return; } #endif if (type == T_RESERVED) { trap_fatal(frame, 0); - goto out; + return; } if (type == T_NMI) { @@ -214,18 +212,18 @@ trap(struct trapframe *frame) */ if (pmc_intr != NULL && (*pmc_intr)(PCPU_GET(cpuid), frame) != 0) - goto out; + return; #endif #ifdef STACK if (stack_nmi_handler(frame) != 0) - goto out; + return; #endif } if (type == T_MCHK) { mca_intr(); - goto out; + return; } if ((frame->tf_rflags & PSL_I) == 0) { @@ -269,7 +267,7 @@ trap(struct trapframe *frame) switch (type) { case T_PRIVINFLT: /* privileged instruction fault */ - i = SIGILL; + signo = SIGILL; ucode = ILL_PRVOPC; break; @@ -281,41 +279,41 @@ trap(struct trapframe *frame) fill_frame_regs(frame, ®s); if (dtrace_pid_probe_ptr != NULL && dtrace_pid_probe_ptr(®s) == 0) - goto out; + return; } #endif frame->tf_rflags &= ~PSL_T; - i = SIGTRAP; + signo = SIGTRAP; ucode = (type == T_TRCTRAP ? TRAP_TRACE : TRAP_BRKPT); break; case T_ARITHTRAP: /* arithmetic trap */ ucode = fputrap_x87(); if (ucode == -1) - goto userout; - i = SIGFPE; + return; + signo = SIGFPE; break; case T_PROTFLT: /* general protection fault */ - i = SIGBUS; + signo = SIGBUS; ucode = BUS_OBJERR; break; case T_STKFLT: /* stack fault */ case T_SEGNPFLT: /* segment not present fault */ - i = SIGBUS; + signo = SIGBUS; ucode = BUS_ADRERR; break; case T_TSSFLT: /* invalid TSS fault */ - i = SIGBUS; + signo = SIGBUS; ucode = BUS_OBJERR; break; case T_ALIGNFLT: - i = SIGBUS; + signo = SIGBUS; ucode = BUS_ADRALN; break; case T_DOUBLEFLT: /* double fault */ default: - i = SIGBUS; + signo = SIGBUS; ucode = BUS_OBJERR; break; @@ -325,67 +323,64 @@ trap(struct trapframe *frame) */ if (*p->p_sysent->sv_trap != NULL && (*p->p_sysent->sv_trap)(td) == 0) - goto userout; + return; addr = frame->tf_addr; - i = trap_pfault(frame, TRUE); - if (i == -1) - goto userout; - if (i == 0) - goto user; - - if (i == SIGSEGV) + signo = trap_pfault(frame, TRUE); + if (signo == -1) + return; + if (signo == 0) + goto userret; + if (signo == SIGSEGV) { ucode = SEGV_MAPERR; - else { - if (prot_fault_translation == 0) { - /* - * Autodetect. - * This check also covers the images - * without the ABI-tag ELF note. - */ - if (SV_CURPROC_ABI() == SV_ABI_FREEBSD - && p->p_osrel >= P_OSREL_SIGSEGV) { - i = SIGSEGV; - ucode = SEGV_ACCERR; - } else { - i = SIGBUS; - ucode = BUS_PAGE_FAULT; - } - } else if (prot_fault_translation == 1) { - /* - * Always compat mode. - */ - i = SIGBUS; - ucode = BUS_PAGE_FAULT; - } else { - /* - * Always SIGSEGV mode. - */ - i = SIGSEGV; + } else if (prot_fault_translation == 0) { + /* + * Autodetect. This check also covers + * the images without the ABI-tag ELF + * note. + */ + if (SV_CURPROC_ABI() == SV_ABI_FREEBSD && + p->p_osrel >= P_OSREL_SIGSEGV) { + signo = SIGSEGV; ucode = SEGV_ACCERR; + } else { + signo = SIGBUS; + ucode = BUS_PAGE_FAULT; } + } else if (prot_fault_translation == 1) { + /* + * Always compat mode. + */ + signo = SIGBUS; + ucode = BUS_PAGE_FAULT; + } else { + /* + * Always SIGSEGV mode. + */ + signo = SIGSEGV; + ucode = SEGV_ACCERR; } break; case T_DIVIDE: /* integer divide fault */ ucode = FPE_INTDIV; - i = SIGFPE; + signo = SIGFPE; break; #ifdef DEV_ISA case T_NMI: nmi_handle_intr(type, frame); - goto out; -#endif /* DEV_ISA */ + return; +#endif case T_OFLOW: /* integer overflow fault */ ucode = FPE_INTOVF; - i = SIGFPE; + signo = SIGFPE; break; case T_BOUND: /* bounds check fault */ ucode = FPE_FLTSUB; - i = SIGFPE; + signo = SIGFPE; break; case T_DNA: @@ -393,27 +388,26 @@ trap(struct trapframe *frame) KASSERT(PCB_USER_FPU(td->td_pcb), ("kernel FPU ctx has leaked")); fpudna(); - goto userout; + return; case T_FPOPFLT: /* FPU operand fetch fault */ ucode = ILL_COPROC; - i = SIGILL; + signo = SIGILL; break; case T_XMMFLT: /* SIMD floating-point exception */ ucode = fputrap_sse(); if (ucode == -1) - goto userout; - i = SIGFPE; + return; + signo = SIGFPE; break; #ifdef KDTRACE_HOOKS case T_DTRACE_RET: enable_intr(); fill_frame_regs(frame, ®s); - if (dtrace_return_probe_ptr != NULL && - dtrace_return_probe_ptr(®s) == 0) - goto out; - goto userout; + if (dtrace_return_probe_ptr != NULL) + dtrace_return_probe_ptr(®s); + return; #endif } } else { @@ -424,13 +418,13 @@ trap(struct trapframe *frame) switch (type) { case T_PAGEFLT: /* page fault */ (void) trap_pfault(frame, FALSE); - goto out; + return; case T_DNA: if (PCB_USER_FPU(td->td_pcb)) panic("Unregistered use of FPU in kernel"); fpudna(); - goto out; + return; case T_ARITHTRAP: /* arithmetic trap */ case T_XMMFLT: /* SIMD floating-point exception */ @@ -440,7 +434,7 @@ trap(struct trapframe *frame) * registration for FPU traps is overkill. */ trap_fatal(frame, 0); - goto out; + return; case T_STKFLT: /* stack fault */ case T_PROTFLT: /* general protection fault */ @@ -460,35 +454,35 @@ trap(struct trapframe *frame) */ if (frame->tf_rip == (long)doreti_iret) { frame->tf_rip = (long)doreti_iret_fault; - goto out; + return; } if (frame->tf_rip == (long)ld_ds) { frame->tf_rip = (long)ds_load_fault; - goto out; + return; } if (frame->tf_rip == (long)ld_es) { frame->tf_rip = (long)es_load_fault; - goto out; + return; } if (frame->tf_rip == (long)ld_fs) { frame->tf_rip = (long)fs_load_fault; - goto out; + return; } if (frame->tf_rip == (long)ld_gs) { frame->tf_rip = (long)gs_load_fault; - goto out; + return; } if (frame->tf_rip == (long)ld_gsbase) { frame->tf_rip = (long)gsbase_load_fault; - goto out; + return; } if (frame->tf_rip == (long)ld_fsbase) { frame->tf_rip = (long)fsbase_load_fault; - goto out; + return; } if (curpcb->pcb_onfault != NULL) { frame->tf_rip = (long)curpcb->pcb_onfault; - goto out; + return; } break; @@ -504,7 +498,7 @@ trap(struct trapframe *frame) */ if (frame->tf_rflags & PSL_NT) { frame->tf_rflags &= ~PSL_NT; - goto out; + return; } break; @@ -525,7 +519,7 @@ trap(struct trapframe *frame) * processor doesn't */ load_dr6(rdr6() & ~0xf); - goto out; + return; } /* * FALLTHROUGH (TRCTRAP kernel mode, kernel address) @@ -540,27 +534,27 @@ trap(struct trapframe *frame) dr6 = rdr6(); load_dr6(dr6 & ~0x4000); if (kdb_trap(type, dr6, frame)) - goto out; + return; #endif break; #ifdef DEV_ISA case T_NMI: nmi_handle_intr(type, frame); - goto out; -#endif /* DEV_ISA */ + return; +#endif } trap_fatal(frame, 0); - goto out; + return; } /* Translate fault for emulators (e.g. Linux) */ - if (*p->p_sysent->sv_transtrap) - i = (*p->p_sysent->sv_transtrap)(i, type); + if (*p->p_sysent->sv_transtrap != NULL) + signo = (*p->p_sysent->sv_transtrap)(signo, type); ksiginfo_init_trap(&ksi); - ksi.ksi_signo = i; + ksi.ksi_signo = signo; ksi.ksi_code = ucode; ksi.ksi_trapno = type; ksi.ksi_addr = (void *)addr; @@ -568,8 +562,8 @@ trap(struct trapframe *frame) uprintf("pid %d comm %s: signal %d err %lx code %d type %d " "addr 0x%lx rsp 0x%lx rip 0x%lx " "<%02x %02x %02x %02x %02x %02x %02x %02x>\n", - p->p_pid, p->p_comm, i, frame->tf_err, ucode, type, addr, - frame->tf_rsp, frame->tf_rip, + p->p_pid, p->p_comm, signo, frame->tf_err, ucode, type, + addr, frame->tf_rsp, frame->tf_rip, fubyte((void *)(frame->tf_rip + 0)), fubyte((void *)(frame->tf_rip + 1)), fubyte((void *)(frame->tf_rip + 2)), @@ -581,14 +575,10 @@ trap(struct trapframe *frame) } KASSERT((read_rflags() & PSL_I) != 0, ("interrupts disabled")); trapsignal(td, &ksi); - -user: +userret: userret(td, frame); KASSERT(PCB_USER_FPU(td->td_pcb), ("Return from trap with kernel FPU ctx leaked")); -userout: -out: - return; } /* From owner-svn-src-all@freebsd.org Sun Aug 27 11:37:09 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 39726DEDB84; Sun, 27 Aug 2017 11:37: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 mx1.freebsd.org (Postfix) with ESMTPS id 070CD6F293; Sun, 27 Aug 2017 11:37: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 v7RBb8n7020164; Sun, 27 Aug 2017 11:37:08 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7RBb81R020163; Sun, 27 Aug 2017 11:37:08 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201708271137.v7RBb81R020163@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Sun, 27 Aug 2017 11:37:08 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r322947 - head/sys/dev/ppc X-SVN-Group: head X-SVN-Commit-Author: kib X-SVN-Commit-Paths: head/sys/dev/ppc X-SVN-Commit-Revision: 322947 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 27 Aug 2017 11:37:09 -0000 Author: kib Date: Sun Aug 27 11:37:07 2017 New Revision: 322947 URL: https://svnweb.freebsd.org/changeset/base/322947 Log: Add PCI Id for MosChip MCS9900. Submitted by: Robert Clausecker PR: 214670 MFC after: 1 week Modified: head/sys/dev/ppc/ppc_pci.c Modified: head/sys/dev/ppc/ppc_pci.c ============================================================================== --- head/sys/dev/ppc/ppc_pci.c Sun Aug 27 11:27:27 2017 (r322946) +++ head/sys/dev/ppc/ppc_pci.c Sun Aug 27 11:37:07 2017 (r322947) @@ -91,6 +91,7 @@ static struct pci_id pci_ids[] = { { 0xc1101415, "Oxford Semiconductor OXPCIe952 Parallel port", 0x10 }, { 0x98059710, "NetMos NM9805 1284 Printer port", 0x10 }, { 0x98659710, "MosChip MCS9865 1284 Printer port", 0x10 }, + { 0x99009710, "MosChip MCS9900 PCIe to Peripheral Controller", 0x10 }, { 0x99019710, "MosChip MCS9901 PCIe to Peripheral Controller", 0x10 }, { 0xffff } }; From owner-svn-src-all@freebsd.org Sun Aug 27 12:24:26 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 8B1AADEF0CD; Sun, 27 Aug 2017 12:24:26 +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 mx1.freebsd.org (Postfix) with ESMTPS id 5ABCE7092B; Sun, 27 Aug 2017 12:24:26 +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 v7RCOPMm040061; Sun, 27 Aug 2017 12:24:25 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7RCOPGY040060; Sun, 27 Aug 2017 12:24:25 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201708271224.v7RCOPGY040060@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Sun, 27 Aug 2017 12:24:25 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r322948 - head/sys/geom X-SVN-Group: head X-SVN-Commit-Author: kib X-SVN-Commit-Paths: head/sys/geom X-SVN-Commit-Revision: 322948 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 27 Aug 2017 12:24:26 -0000 Author: kib Date: Sun Aug 27 12:24:25 2017 New Revision: 322948 URL: https://svnweb.freebsd.org/changeset/base/322948 Log: Let g_access() log the actual error number. Submitted by: Fabian Keil PR: 221855 MFC after: 1 week Modified: head/sys/geom/geom_subr.c Modified: head/sys/geom/geom_subr.c ============================================================================== --- head/sys/geom/geom_subr.c Sun Aug 27 11:37:07 2017 (r322947) +++ head/sys/geom/geom_subr.c Sun Aug 27 12:24:25 2017 (r322948) @@ -918,8 +918,8 @@ g_access(struct g_consumer *cp, int dcr, int dcw, int return (EPERM); /* If we try to open more but provider is error'ed: fail */ else if ((dcr > 0 || dcw > 0 || dce > 0) && pp->error != 0) { - printf("%s(%d): provider %s has error\n", - __func__, __LINE__, pp->name); + printf("%s(%d): provider %s has error %d set\n", + __func__, __LINE__, pp->name, pp->error); return (pp->error); } From owner-svn-src-all@freebsd.org Sun Aug 27 12:44:57 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 873E0DEF79A; Sun, 27 Aug 2017 12:44:57 +0000 (UTC) (envelope-from avos@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (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 62A847110B; Sun, 27 Aug 2017 12:44:57 +0000 (UTC) (envelope-from avos@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v7RCiuXE048131; Sun, 27 Aug 2017 12:44:56 GMT (envelope-from avos@FreeBSD.org) Received: (from avos@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7RCiuFq048126; Sun, 27 Aug 2017 12:44:56 GMT (envelope-from avos@FreeBSD.org) Message-Id: <201708271244.v7RCiuFq048126@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avos set sender to avos@FreeBSD.org using -f From: Andriy Voskoboinyk Date: Sun, 27 Aug 2017 12:44:56 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r322949 - in head/sys/dev/rtwn: rtl8188e rtl8192c X-SVN-Group: head X-SVN-Commit-Author: avos X-SVN-Commit-Paths: in head/sys/dev/rtwn: rtl8188e rtl8192c X-SVN-Commit-Revision: 322949 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 27 Aug 2017 12:44:57 -0000 Author: avos Date: Sun Aug 27 12:44:56 2017 New Revision: 322949 URL: https://svnweb.freebsd.org/changeset/base/322949 Log: rtwn(4): change type for Tx power values (RTL8192C / RTL8188EU). Tx power values can easily fit into uint8_t + only 8 bits are written to registers; values may overflow only in case if ROM contains malformed data (but limit is checked anyway). Tested with RTL8188CUS, dev.rtwn.1.debug=0x2000 (no changes). Modified: head/sys/dev/rtwn/rtl8188e/r88e.h head/sys/dev/rtwn/rtl8188e/r88e_chan.c head/sys/dev/rtwn/rtl8192c/r92c.h head/sys/dev/rtwn/rtl8192c/r92c_chan.c head/sys/dev/rtwn/rtl8192c/r92c_var.h Modified: head/sys/dev/rtwn/rtl8188e/r88e.h ============================================================================== --- head/sys/dev/rtwn/rtl8188e/r88e.h Sun Aug 27 12:24:25 2017 (r322948) +++ head/sys/dev/rtwn/rtl8188e/r88e.h Sun Aug 27 12:44:56 2017 (r322949) @@ -49,7 +49,7 @@ uint8_t r88e_temp_read(struct rtwn_softc *); /* r88e_chan.c */ void r88e_get_txpower(struct rtwn_softc *, int, - struct ieee80211_channel *, uint16_t[]); + struct ieee80211_channel *, uint8_t[]); void r88e_set_bw20(struct rtwn_softc *, uint8_t); void r88e_set_gain(struct rtwn_softc *, uint8_t); Modified: head/sys/dev/rtwn/rtl8188e/r88e_chan.c ============================================================================== --- head/sys/dev/rtwn/rtl8188e/r88e_chan.c Sun Aug 27 12:24:25 2017 (r322948) +++ head/sys/dev/rtwn/rtl8188e/r88e_chan.c Sun Aug 27 12:44:56 2017 (r322949) @@ -85,7 +85,7 @@ r88e_get_power_group(struct rtwn_softc *sc, struct iee void r88e_get_txpower(struct rtwn_softc *sc, int chain, - struct ieee80211_channel *c, uint16_t power[RTWN_RIDX_COUNT]) + struct ieee80211_channel *c, uint8_t power[RTWN_RIDX_COUNT]) { struct r92c_softc *rs = sc->sc_priv; const struct rtwn_r88e_txpwr *rt = rs->rs_txpwr; Modified: head/sys/dev/rtwn/rtl8192c/r92c.h ============================================================================== --- head/sys/dev/rtwn/rtl8192c/r92c.h Sun Aug 27 12:24:25 2017 (r322948) +++ head/sys/dev/rtwn/rtl8192c/r92c.h Sun Aug 27 12:44:56 2017 (r322949) @@ -55,7 +55,7 @@ uint8_t r92c_temp_read(struct rtwn_softc *); /* r92c_chan.c */ void r92c_get_txpower(struct rtwn_softc *, int, - struct ieee80211_channel *, uint16_t[]); + struct ieee80211_channel *, uint8_t[]); void r92c_set_bw20(struct rtwn_softc *, uint8_t); void r92c_set_chan(struct rtwn_softc *, struct ieee80211_channel *); void r92c_set_gain(struct rtwn_softc *, uint8_t); Modified: head/sys/dev/rtwn/rtl8192c/r92c_chan.c ============================================================================== --- head/sys/dev/rtwn/rtl8192c/r92c_chan.c Sun Aug 27 12:24:25 2017 (r322948) +++ head/sys/dev/rtwn/rtl8192c/r92c_chan.c Sun Aug 27 12:44:56 2017 (r322949) @@ -82,7 +82,7 @@ r92c_get_power_group(struct rtwn_softc *sc, struct iee /* XXX recheck */ void r92c_get_txpower(struct rtwn_softc *sc, int chain, - struct ieee80211_channel *c, uint16_t power[RTWN_RIDX_COUNT]) + struct ieee80211_channel *c, uint8_t power[RTWN_RIDX_COUNT]) { struct r92c_softc *rs = sc->sc_priv; struct rtwn_r92c_txpwr *rt = rs->rs_txpwr; @@ -158,7 +158,7 @@ r92c_get_txpower(struct rtwn_softc *sc, int chain, static void r92c_write_txpower(struct rtwn_softc *sc, int chain, - uint16_t power[RTWN_RIDX_COUNT]) + uint8_t power[RTWN_RIDX_COUNT]) { uint32_t reg; @@ -221,7 +221,7 @@ r92c_write_txpower(struct rtwn_softc *sc, int chain, static void r92c_set_txpower(struct rtwn_softc *sc, struct ieee80211_channel *c) { - uint16_t power[RTWN_RIDX_COUNT]; + uint8_t power[RTWN_RIDX_COUNT]; int i; for (i = 0; i < sc->ntxchains; i++) { Modified: head/sys/dev/rtwn/rtl8192c/r92c_var.h ============================================================================== --- head/sys/dev/rtwn/rtl8192c/r92c_var.h Sun Aug 27 12:24:25 2017 (r322948) +++ head/sys/dev/rtwn/rtl8192c/r92c_var.h Sun Aug 27 12:44:56 2017 (r322949) @@ -53,7 +53,7 @@ struct r92c_softc { void (*rs_set_bw20)(struct rtwn_softc *, uint8_t); void (*rs_get_txpower)(struct rtwn_softc *, int, - struct ieee80211_channel *, uint16_t[]); + struct ieee80211_channel *, uint8_t[]); void (*rs_set_gain)(struct rtwn_softc *, uint8_t); void (*rs_tx_enable_ampdu)(void *, int); void (*rs_tx_setup_hwseq)(void *); From owner-svn-src-all@freebsd.org Sun Aug 27 13:02:53 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 9A3CEDEFB58; Sun, 27 Aug 2017 13:02:53 +0000 (UTC) (envelope-from avos@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (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 69C8F717AF; Sun, 27 Aug 2017 13:02:53 +0000 (UTC) (envelope-from avos@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v7RD2qPM056054; Sun, 27 Aug 2017 13:02:52 GMT (envelope-from avos@FreeBSD.org) Received: (from avos@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7RD2pV0056051; Sun, 27 Aug 2017 13:02:51 GMT (envelope-from avos@FreeBSD.org) Message-Id: <201708271302.v7RD2pV0056051@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avos set sender to avos@FreeBSD.org using -f From: Andriy Voskoboinyk Date: Sun, 27 Aug 2017 13:02:51 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r322950 - in head/sys/dev/rtwn: rtl8192c rtl8192e X-SVN-Group: head X-SVN-Commit-Author: avos X-SVN-Commit-Paths: in head/sys/dev/rtwn: rtl8192c rtl8192e X-SVN-Commit-Revision: 322950 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 27 Aug 2017 13:02:53 -0000 Author: avos Date: Sun Aug 27 13:02:51 2017 New Revision: 322950 URL: https://svnweb.freebsd.org/changeset/base/322950 Log: rtwn(4): deduplicate r92c_write_txpower(). Modified: head/sys/dev/rtwn/rtl8192c/r92c.h head/sys/dev/rtwn/rtl8192c/r92c_chan.c head/sys/dev/rtwn/rtl8192e/r92e_chan.c Modified: head/sys/dev/rtwn/rtl8192c/r92c.h ============================================================================== --- head/sys/dev/rtwn/rtl8192c/r92c.h Sun Aug 27 12:44:56 2017 (r322949) +++ head/sys/dev/rtwn/rtl8192c/r92c.h Sun Aug 27 13:02:51 2017 (r322950) @@ -56,6 +56,8 @@ uint8_t r92c_temp_read(struct rtwn_softc *); /* r92c_chan.c */ void r92c_get_txpower(struct rtwn_softc *, int, struct ieee80211_channel *, uint8_t[]); +void r92c_write_txpower(struct rtwn_softc *, int, + uint8_t power[]); void r92c_set_bw20(struct rtwn_softc *, uint8_t); void r92c_set_chan(struct rtwn_softc *, struct ieee80211_channel *); void r92c_set_gain(struct rtwn_softc *, uint8_t); Modified: head/sys/dev/rtwn/rtl8192c/r92c_chan.c ============================================================================== --- head/sys/dev/rtwn/rtl8192c/r92c_chan.c Sun Aug 27 12:44:56 2017 (r322949) +++ head/sys/dev/rtwn/rtl8192c/r92c_chan.c Sun Aug 27 13:02:51 2017 (r322950) @@ -156,7 +156,7 @@ r92c_get_txpower(struct rtwn_softc *sc, int chain, } } -static void +void r92c_write_txpower(struct rtwn_softc *sc, int chain, uint8_t power[RTWN_RIDX_COUNT]) { Modified: head/sys/dev/rtwn/rtl8192e/r92e_chan.c ============================================================================== --- head/sys/dev/rtwn/rtl8192e/r92e_chan.c Sun Aug 27 12:44:56 2017 (r322949) +++ head/sys/dev/rtwn/rtl8192e/r92e_chan.c Sun Aug 27 13:02:51 2017 (r322950) @@ -57,6 +57,8 @@ __FBSDID("$FreeBSD$"); #include #include +#include + #include #include #include @@ -144,70 +146,7 @@ r92e_get_txpower(struct rtwn_softc *sc, int chain, str #endif } - static void -r92e_write_txpower(struct rtwn_softc *sc, int chain, - uint8_t power[RTWN_RIDX_COUNT]) -{ - uint32_t reg; - - /* Write per-CCK rate Tx power. */ - if (chain == 0) { - reg = rtwn_bb_read(sc, R92C_TXAGC_A_CCK1_MCS32); - reg = RW(reg, R92C_TXAGC_A_CCK1, power[RTWN_RIDX_CCK1]); - rtwn_bb_write(sc, R92C_TXAGC_A_CCK1_MCS32, reg); - reg = rtwn_bb_read(sc, R92C_TXAGC_B_CCK11_A_CCK2_11); - reg = RW(reg, R92C_TXAGC_A_CCK2, power[RTWN_RIDX_CCK2]); - reg = RW(reg, R92C_TXAGC_A_CCK55, power[RTWN_RIDX_CCK55]); - reg = RW(reg, R92C_TXAGC_A_CCK11, power[RTWN_RIDX_CCK11]); - rtwn_bb_write(sc, R92C_TXAGC_B_CCK11_A_CCK2_11, reg); - } else { - reg = rtwn_bb_read(sc, R92C_TXAGC_B_CCK1_55_MCS32); - reg = RW(reg, R92C_TXAGC_B_CCK1, power[RTWN_RIDX_CCK1]); - reg = RW(reg, R92C_TXAGC_B_CCK2, power[RTWN_RIDX_CCK2]); - reg = RW(reg, R92C_TXAGC_B_CCK55, power[RTWN_RIDX_CCK55]); - rtwn_bb_write(sc, R92C_TXAGC_B_CCK1_55_MCS32, reg); - reg = rtwn_bb_read(sc, R92C_TXAGC_B_CCK11_A_CCK2_11); - reg = RW(reg, R92C_TXAGC_B_CCK11, power[RTWN_RIDX_CCK11]); - rtwn_bb_write(sc, R92C_TXAGC_B_CCK11_A_CCK2_11, reg); - } - /* Write per-OFDM rate Tx power. */ - rtwn_bb_write(sc, R92C_TXAGC_RATE18_06(chain), - SM(R92C_TXAGC_RATE06, power[RTWN_RIDX_OFDM6]) | - SM(R92C_TXAGC_RATE09, power[RTWN_RIDX_OFDM9]) | - SM(R92C_TXAGC_RATE12, power[RTWN_RIDX_OFDM12]) | - SM(R92C_TXAGC_RATE18, power[RTWN_RIDX_OFDM18])); - rtwn_bb_write(sc, R92C_TXAGC_RATE54_24(chain), - SM(R92C_TXAGC_RATE24, power[RTWN_RIDX_OFDM24]) | - SM(R92C_TXAGC_RATE36, power[RTWN_RIDX_OFDM36]) | - SM(R92C_TXAGC_RATE48, power[RTWN_RIDX_OFDM48]) | - SM(R92C_TXAGC_RATE54, power[RTWN_RIDX_OFDM54])); - /* Write per-MCS Tx power. */ - rtwn_bb_write(sc, R92C_TXAGC_MCS03_MCS00(chain), - SM(R92C_TXAGC_MCS00, power[RTWN_RIDX_MCS(0)]) | - SM(R92C_TXAGC_MCS01, power[RTWN_RIDX_MCS(1)]) | - SM(R92C_TXAGC_MCS02, power[RTWN_RIDX_MCS(2)]) | - SM(R92C_TXAGC_MCS03, power[RTWN_RIDX_MCS(3)])); - rtwn_bb_write(sc, R92C_TXAGC_MCS07_MCS04(chain), - SM(R92C_TXAGC_MCS04, power[RTWN_RIDX_MCS(4)]) | - SM(R92C_TXAGC_MCS05, power[RTWN_RIDX_MCS(5)]) | - SM(R92C_TXAGC_MCS06, power[RTWN_RIDX_MCS(6)]) | - SM(R92C_TXAGC_MCS07, power[RTWN_RIDX_MCS(7)])); - if (sc->ntxchains >= 2) { - rtwn_bb_write(sc, R92C_TXAGC_MCS11_MCS08(chain), - SM(R92C_TXAGC_MCS08, power[RTWN_RIDX_MCS(8)]) | - SM(R92C_TXAGC_MCS09, power[RTWN_RIDX_MCS(9)]) | - SM(R92C_TXAGC_MCS10, power[RTWN_RIDX_MCS(10)]) | - SM(R92C_TXAGC_MCS11, power[RTWN_RIDX_MCS(11)])); - rtwn_bb_write(sc, R92C_TXAGC_MCS15_MCS12(chain), - SM(R92C_TXAGC_MCS12, power[RTWN_RIDX_MCS(12)]) | - SM(R92C_TXAGC_MCS13, power[RTWN_RIDX_MCS(13)]) | - SM(R92C_TXAGC_MCS14, power[RTWN_RIDX_MCS(14)]) | - SM(R92C_TXAGC_MCS15, power[RTWN_RIDX_MCS(15)])); - } -} - -static void r92e_set_txpower(struct rtwn_softc *sc, struct ieee80211_channel *c) { uint8_t power[RTWN_RIDX_COUNT]; @@ -218,7 +157,7 @@ r92e_set_txpower(struct rtwn_softc *sc, struct ieee802 /* Compute per-rate Tx power values. */ r92e_get_txpower(sc, i, c, power); /* Write per-rate Tx power values to hardware. */ - r92e_write_txpower(sc, i, power); + r92c_write_txpower(sc, i, power); } } From owner-svn-src-all@freebsd.org Sun Aug 27 15:51:17 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 45A95DF2373; Sun, 27 Aug 2017 15:51:17 +0000 (UTC) (envelope-from cse.cem@gmail.com) Received: from mail-oi0-f46.google.com (mail-oi0-f46.google.com [209.85.218.46]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 08C2D75634; Sun, 27 Aug 2017 15:51:16 +0000 (UTC) (envelope-from cse.cem@gmail.com) Received: by mail-oi0-f46.google.com with SMTP id g127so15196522oic.1; Sun, 27 Aug 2017 08:51:16 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:reply-to:in-reply-to:references :from:date:message-id:subject:to:cc; bh=ESQTjw8rafNGbnsSyxxIwvfiK0oyxYvdXCDRR5fuJYc=; b=E/SG0Db43L6MdkTNllPFF+4jyBPP67H4Sv/dyZ63ZiMgOONQ+5QXlxIyis1Se4TCe9 88ucyg7rvUHMv0YLR4B2gXmeCPrUMn2lx+ZAzQQC5NYlZtSpWYbvtgwsXFwvMm0Zgvee Tv3dQPPLXfSaUNhMYuCUg0enJ1OkrLVw/3n26dmUQA+hb5NirFdEE4VDSQ729FwCSpHc sjc6fIaMJwRixB/kVB7P5Mfsu701ZtTuLwv73XWW8fZBZKQJGAREhX7oTvWaBqMeNKBd xNbyywt5M9G7xQt0umeoz9npp0HLoxu288b6O/8Wn2us3nUWH7meIop+5G3JeiJhGKKx rWvg== X-Gm-Message-State: AHYfb5i5aX9zUCczxomub/wDz6MwFsmdOVp96IOQuuhvE1S9KiKXWNMP EwiwrR7sazmTZMx1BwY= X-Received: by 10.202.181.138 with SMTP id e132mr5936843oif.8.1503849070217; Sun, 27 Aug 2017 08:51:10 -0700 (PDT) Received: from mail-io0-f169.google.com (mail-io0-f169.google.com. [209.85.223.169]) by smtp.gmail.com with ESMTPSA id c187sm12193146oig.41.2017.08.27.08.51.09 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 27 Aug 2017 08:51:10 -0700 (PDT) Received: by mail-io0-f169.google.com with SMTP id k22so9848149iod.2; Sun, 27 Aug 2017 08:51:09 -0700 (PDT) X-Received: by 10.107.44.68 with SMTP id s65mr3849959ios.88.1503849069644; Sun, 27 Aug 2017 08:51:09 -0700 (PDT) MIME-Version: 1.0 Reply-To: cem@freebsd.org Received: by 10.2.81.131 with HTTP; Sun, 27 Aug 2017 08:51:09 -0700 (PDT) In-Reply-To: References: <201708270514.v7R5EmDK064785@repo.freebsd.org> From: Conrad Meyer Date: Sun, 27 Aug 2017 08:51:09 -0700 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: svn commit: r322942 - head/sys/kern To: Ed Schouten Cc: src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org Content-Type: text/plain; charset="UTF-8" X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 27 Aug 2017 15:51:17 -0000 On Sun, Aug 27, 2017 at 1:18 AM, Ed Schouten wrote: > Hi Conrad, > > [ Context: I don't understand anything about CPU topologies! ] > > 2017-08-27 7:14 GMT+02:00 Conrad Meyer : >> + while (top->cg_children == 1) { >> + top = &top->cg_child[0]; >> + top->cg_parent = NULL; >> + } > > This only removes layers from the top if they only have a single > child. Question: is it possible/likely to have CPU topologies where > one of the middle layers only has one child? If so, would it make > sense to use tree traversal here to do the flattening? Hi Ed, It is probably possible for middle layers to have a single child, and your proposal is a good one. This is just the canned patch from Jeff I already had lying around :-). Best, Conrad From owner-svn-src-all@freebsd.org Sun Aug 27 16:15:39 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 2112DDF2C0F; Sun, 27 Aug 2017 16:15:39 +0000 (UTC) (envelope-from ngie@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (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 DCEDC76071; Sun, 27 Aug 2017 16:15:38 +0000 (UTC) (envelope-from ngie@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v7RGFclG033968; Sun, 27 Aug 2017 16:15:38 GMT (envelope-from ngie@FreeBSD.org) Received: (from ngie@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7RGFcKs033967; Sun, 27 Aug 2017 16:15:38 GMT (envelope-from ngie@FreeBSD.org) Message-Id: <201708271615.v7RGFcKs033967@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ngie set sender to ngie@FreeBSD.org using -f From: Ngie Cooper Date: Sun, 27 Aug 2017 16:15:38 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r322951 - head X-SVN-Group: head X-SVN-Commit-Author: ngie X-SVN-Commit-Paths: head X-SVN-Commit-Revision: 322951 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 27 Aug 2017 16:15:39 -0000 Author: ngie Date: Sun Aug 27 16:15:37 2017 New Revision: 322951 URL: https://svnweb.freebsd.org/changeset/base/322951 Log: Respect MK_TCSH with build-tools and native-xtools This helps reduce the WORLDTMP footprint slightly. Based on a patch I submitted 5 years ago to GNATS. PR: 174051 MFC after: 2 weeks Relnotes: yes (anyone who cross-builds with MK_TCSH=yes will run into build failures if the host doesn't have tcsh(1)) Reminded by: Fabian Keil Modified: head/Makefile.inc1 Modified: head/Makefile.inc1 ============================================================================== --- head/Makefile.inc1 Sun Aug 27 13:02:51 2017 (r322950) +++ head/Makefile.inc1 Sun Aug 27 16:15:37 2017 (r322951) @@ -1984,8 +1984,12 @@ _gcc_tools= gnu/usr.bin/cc/cc_tools _rescue=rescue/rescue .endif +.if ${MK_TCSH} != "no" +_tcsh=bin/csh +.endif + .for _tool in \ - bin/csh \ + ${_tcsh} \ bin/sh \ ${LOCAL_TOOL_DIRS} \ lib/ncurses/ncurses \ @@ -2143,7 +2147,7 @@ native-xtools: .PHONY bin/cat \ bin/chmod \ bin/cp \ - bin/csh \ + ${_tcsh} \ bin/echo \ bin/expr \ bin/hostname \ From owner-svn-src-all@freebsd.org Sun Aug 27 16:46:53 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 0B722DF33E8; Sun, 27 Aug 2017 16:46:53 +0000 (UTC) (envelope-from ngie@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (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 D601976C06; Sun, 27 Aug 2017 16:46:52 +0000 (UTC) (envelope-from ngie@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v7RGkpEl046183; Sun, 27 Aug 2017 16:46:51 GMT (envelope-from ngie@FreeBSD.org) Received: (from ngie@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7RGkpLc046182; Sun, 27 Aug 2017 16:46:51 GMT (envelope-from ngie@FreeBSD.org) Message-Id: <201708271646.v7RGkpLc046182@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ngie set sender to ngie@FreeBSD.org using -f From: Ngie Cooper Date: Sun, 27 Aug 2017 16:46:51 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r322952 - head/share/mk X-SVN-Group: head X-SVN-Commit-Author: ngie X-SVN-Commit-Paths: head/share/mk X-SVN-Commit-Revision: 322952 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 27 Aug 2017 16:46:53 -0000 Author: ngie Date: Sun Aug 27 16:46:51 2017 New Revision: 322952 URL: https://svnweb.freebsd.org/changeset/base/322952 Log: Try and rebase the bsd.lib.mk changes after ^/head@r322824 was merged in Unfortunately the snippet's now broken -- need to get the matching expressions to work properly. Modified: head/share/mk/bsd.lib.mk Modified: head/share/mk/bsd.lib.mk ============================================================================== --- head/share/mk/bsd.lib.mk Sun Aug 27 16:15:37 2017 (r322951) +++ head/share/mk/bsd.lib.mk Sun Aug 27 16:46:51 2017 (r322952) @@ -76,6 +76,13 @@ CTFFLAGS+= -g .include +.if ${MK_COVERAGE} != "no" && (!empty(CFLAGS:M-g*) || !empty(CXXFLAGS:M-g*)) +_COV_FLAG= --coverage +CFLAGS+= ${_COV_FLAG} +CXXFLAGS+= ${_COV_FLAG} +.error "foo" +.endif + # prefer .s to a .c, add .po, remove stuff not used in the BSD libraries # .pico used for PIC object files .SUFFIXES: .out .o .bc .ll .po .pico .S .asm .s .c .cc .cpp .cxx .C .f .y .l .ln @@ -95,14 +102,14 @@ PO_FLAG=-pg ${CTFCONVERT_CMD} .c.pico: - ${CC} ${PICFLAG} -DPIC ${SHARED_CFLAGS} ${CFLAGS} -c ${.IMPSRC} -o ${.TARGET} + ${CC} ${PICFLAG} -DPIC ${PO_CFLAGS} ${CFLAGS} -c ${.IMPSRC} -o ${.TARGET} ${CTFCONVERT_CMD} .cc.po .C.po .cpp.po .cxx.po: ${CXX} ${PO_FLAG} ${STATIC_CXXFLAGS} ${PO_CXXFLAGS} -c ${.IMPSRC} -o ${.TARGET} .cc.pico .C.pico .cpp.pico .cxx.pico: - ${CXX} ${PICFLAG} -DPIC ${SHARED_CXXFLAGS} ${CXXFLAGS} -c ${.IMPSRC} -o ${.TARGET} + ${CXX} ${PICFLAG} -DPIC ${PO_CXXFLAGS} ${CXXFLAGS} -c ${.IMPSRC} -o ${.TARGET} .f.po: ${FC} -pg ${FFLAGS} -o ${.TARGET} -c ${.IMPSRC} @@ -142,6 +149,12 @@ _SHLIBDIR:=${SHLIBDIR} .if defined(SHLIB_NAME) .if ${MK_DEBUG_FILES} != "no" SHLIB_NAME_FULL=${SHLIB_NAME}.full +.if ${MK_COVERAGE} != "no" +COVERAGEFILEDIR=${COVERAGEDIR}${_SHLIBDIR} +.if !exists(${DESTDIR}${COVERAGEFILEDIR}) +COVERAGEMKDIR= +.endif +.endif # Use ${DEBUGDIR} for base system debug files, else .debug subdirectory .if ${_SHLIBDIR} == "/boot" ||\ ${SHLIBDIR:C%/lib(/.*)?$%/lib%} == "/lib" ||\ @@ -221,6 +234,9 @@ CLEANFILES+= ${SOBJS} .if defined(SHLIB_NAME) _LIBS+= ${SHLIB_NAME} +.if !empty(_COV_FLAG) +SOLINKOPTS+= ${_COV_FLAG} +.endif SOLINKOPTS+= -shared -Wl,-x .if defined(LD_FATAL_WARNINGS) && ${LD_FATAL_WARNINGS} == "no" SOLINKOPTS+= -Wl,--no-fatal-warnings @@ -360,6 +376,14 @@ _libinstall: ${_INSTALLFLAGS} ${_SHLINSTALLFLAGS} \ ${SHLIB_NAME} ${DESTDIR}${_SHLIBDIR}/ .if ${MK_DEBUG_FILES} != "no" +.if ${MK_COVERAGE} != "no" +.if defined(COVERAGEMKDIR) + ${INSTALL} ${TAG_ARGS:D${TAG_ARGS},coverage} -d ${DESTDIR}${COVERAGEFILEDIR}/ +.endif + ${INSTALL} ${TAG_ARGS:D${TAG_ARGS},coverage} -o ${LIBOWN} -g ${LIBGRP} -m ${LIBMODE} \ + ${_INSTALLFLAGS} \ + ${SHLIB_NAME}.full ${DESTDIR}${COVERAGEFILEDIR}/${SHLIB_NAME} +.endif .if defined(DEBUGMKDIR) ${INSTALL} ${TAG_ARGS:D${TAG_ARGS},debug} -d ${DESTDIR}${DEBUGFILEDIR}/ .endif @@ -411,6 +435,11 @@ _libinstall: .if !defined(LIBRARIES_ONLY) .include +.if defined(_COV_FLAG) +COV_OBJS= ${OBJS} +COV_SRCS= ${SRCS:M*.[c|cc|cpp|cxx|C]} +.include +.endif .include .include .include From owner-svn-src-all@freebsd.org Sun Aug 27 16:57:45 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 65C37DF378B; Sun, 27 Aug 2017 16:57:45 +0000 (UTC) (envelope-from cse.cem@gmail.com) Received: from mail-oi0-f41.google.com (mail-oi0-f41.google.com [209.85.218.41]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 340C077125; Sun, 27 Aug 2017 16:57:44 +0000 (UTC) (envelope-from cse.cem@gmail.com) Received: by mail-oi0-f41.google.com with SMTP id g127so15787151oic.1; Sun, 27 Aug 2017 09:57:44 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:reply-to:in-reply-to:references :from:date:message-id:subject:to:cc; bh=0u/zVFuu9U7l1xEGsJlTQJG80nTDCqAAnqIJF+koTHs=; b=q9gCf0zJUSjtFu9usPa4pYgEQEpAnqkl9C38/xMUtLlTxjcdeuQbFsLjR+KNe18GKR CyXHlzjeBAe1lGiXl3Eh6n4WriVGDVg1pFVIkn+AombRdnR/8NfSAb33FkGj9VlR5TiR CspfDwx4bdYSn8ToDkaRG2C3J66Drx/vJsPeBrITDtFbvKgjZSQAgpT5ZnS7irOb6Lon t97BlaEsCOfc4LslXTJwrTdlCyHt3BB9uVmtvOgBkBp+gN15U1hCxaNBOVs+8hC1O11+ VHgFjmgXYQFfRu4nhcRQYpByw5mrCHtxd2cHCKN0fEO+1sTiBOJuv56/jIgjE64a8Fnc y+AA== X-Gm-Message-State: AHYfb5j3TSuTmqXoMcWcMLZGv6CXBktokbkzCR5Cr/eo5P7Qf0+Cx9P5 lNehh2fb+wpv5ZuZrEc= X-Received: by 10.202.105.198 with SMTP id e189mr5370896oic.197.1503853057601; Sun, 27 Aug 2017 09:57:37 -0700 (PDT) Received: from mail-io0-f174.google.com (mail-io0-f174.google.com. [209.85.223.174]) by smtp.gmail.com with ESMTPSA id e204sm11749301oia.45.2017.08.27.09.57.37 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 27 Aug 2017 09:57:37 -0700 (PDT) Received: by mail-io0-f174.google.com with SMTP id c18so10170725ioj.1; Sun, 27 Aug 2017 09:57:37 -0700 (PDT) X-Received: by 10.107.38.206 with SMTP id m197mr4657775iom.157.1503853057055; Sun, 27 Aug 2017 09:57:37 -0700 (PDT) MIME-Version: 1.0 Reply-To: cem@freebsd.org Received: by 10.2.81.131 with HTTP; Sun, 27 Aug 2017 09:57:36 -0700 (PDT) In-Reply-To: <201708271646.v7RGkpLc046182@repo.freebsd.org> References: <201708271646.v7RGkpLc046182@repo.freebsd.org> From: Conrad Meyer Date: Sun, 27 Aug 2017 09:57:36 -0700 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: svn commit: r322952 - head/share/mk To: svn-src-all@freebsd.org Cc: src-committers , svn-src-head@freebsd.org Content-Type: text/plain; charset="UTF-8" X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 27 Aug 2017 16:57:45 -0000 This appears to be breaking the build: -------------------------------------------------------------- >>> stage 1.1: legacy release compatibility shims -------------------------------------------------------------- ===> tools/build (obj,includes,all,install) make[5]: "/home/cem/head.svn/share/mk/bsd.lib.mk" line 79: Malformed conditional (${MK_COVERAGE} != "no" && (!empty(CFLAGS:M-g*) || !empty(CXXFLAGS:M-g*))) make[5]: Fatal errors encountered -- cannot continue make[5]: stopped in /home/cem/head.svn/tools/build On Sun, Aug 27, 2017 at 9:46 AM, Ngie Cooper wrote: > Author: ngie > Date: Sun Aug 27 16:46:51 2017 > New Revision: 322952 > URL: https://svnweb.freebsd.org/changeset/base/322952 > > Log: > Try and rebase the bsd.lib.mk changes after ^/head@r322824 was merged in > > Unfortunately the snippet's now broken -- need to get the matching expressions to > work properly. > > Modified: > head/share/mk/bsd.lib.mk > > Modified: head/share/mk/bsd.lib.mk > ============================================================================== > --- head/share/mk/bsd.lib.mk Sun Aug 27 16:15:37 2017 (r322951) > +++ head/share/mk/bsd.lib.mk Sun Aug 27 16:46:51 2017 (r322952) > @@ -76,6 +76,13 @@ CTFFLAGS+= -g > > .include > > +.if ${MK_COVERAGE} != "no" && (!empty(CFLAGS:M-g*) || !empty(CXXFLAGS:M-g*)) > +_COV_FLAG= --coverage > +CFLAGS+= ${_COV_FLAG} > +CXXFLAGS+= ${_COV_FLAG} > +.error "foo" > +.endif > + > # prefer .s to a .c, add .po, remove stuff not used in the BSD libraries > # .pico used for PIC object files > .SUFFIXES: .out .o .bc .ll .po .pico .S .asm .s .c .cc .cpp .cxx .C .f .y .l .ln > @@ -95,14 +102,14 @@ PO_FLAG=-pg > ${CTFCONVERT_CMD} > > .c.pico: > - ${CC} ${PICFLAG} -DPIC ${SHARED_CFLAGS} ${CFLAGS} -c ${.IMPSRC} -o ${.TARGET} > + ${CC} ${PICFLAG} -DPIC ${PO_CFLAGS} ${CFLAGS} -c ${.IMPSRC} -o ${.TARGET} > ${CTFCONVERT_CMD} > > .cc.po .C.po .cpp.po .cxx.po: > ${CXX} ${PO_FLAG} ${STATIC_CXXFLAGS} ${PO_CXXFLAGS} -c ${.IMPSRC} -o ${.TARGET} > > .cc.pico .C.pico .cpp.pico .cxx.pico: > - ${CXX} ${PICFLAG} -DPIC ${SHARED_CXXFLAGS} ${CXXFLAGS} -c ${.IMPSRC} -o ${.TARGET} > + ${CXX} ${PICFLAG} -DPIC ${PO_CXXFLAGS} ${CXXFLAGS} -c ${.IMPSRC} -o ${.TARGET} > > .f.po: > ${FC} -pg ${FFLAGS} -o ${.TARGET} -c ${.IMPSRC} > @@ -142,6 +149,12 @@ _SHLIBDIR:=${SHLIBDIR} > .if defined(SHLIB_NAME) > .if ${MK_DEBUG_FILES} != "no" > SHLIB_NAME_FULL=${SHLIB_NAME}.full > +.if ${MK_COVERAGE} != "no" > +COVERAGEFILEDIR=${COVERAGEDIR}${_SHLIBDIR} > +.if !exists(${DESTDIR}${COVERAGEFILEDIR}) > +COVERAGEMKDIR= > +.endif > +.endif > # Use ${DEBUGDIR} for base system debug files, else .debug subdirectory > .if ${_SHLIBDIR} == "/boot" ||\ > ${SHLIBDIR:C%/lib(/.*)?$%/lib%} == "/lib" ||\ > @@ -221,6 +234,9 @@ CLEANFILES+= ${SOBJS} > .if defined(SHLIB_NAME) > _LIBS+= ${SHLIB_NAME} > > +.if !empty(_COV_FLAG) > +SOLINKOPTS+= ${_COV_FLAG} > +.endif > SOLINKOPTS+= -shared -Wl,-x > .if defined(LD_FATAL_WARNINGS) && ${LD_FATAL_WARNINGS} == "no" > SOLINKOPTS+= -Wl,--no-fatal-warnings > @@ -360,6 +376,14 @@ _libinstall: > ${_INSTALLFLAGS} ${_SHLINSTALLFLAGS} \ > ${SHLIB_NAME} ${DESTDIR}${_SHLIBDIR}/ > .if ${MK_DEBUG_FILES} != "no" > +.if ${MK_COVERAGE} != "no" > +.if defined(COVERAGEMKDIR) > + ${INSTALL} ${TAG_ARGS:D${TAG_ARGS},coverage} -d ${DESTDIR}${COVERAGEFILEDIR}/ > +.endif > + ${INSTALL} ${TAG_ARGS:D${TAG_ARGS},coverage} -o ${LIBOWN} -g ${LIBGRP} -m ${LIBMODE} \ > + ${_INSTALLFLAGS} \ > + ${SHLIB_NAME}.full ${DESTDIR}${COVERAGEFILEDIR}/${SHLIB_NAME} > +.endif > .if defined(DEBUGMKDIR) > ${INSTALL} ${TAG_ARGS:D${TAG_ARGS},debug} -d ${DESTDIR}${DEBUGFILEDIR}/ > .endif > @@ -411,6 +435,11 @@ _libinstall: > > .if !defined(LIBRARIES_ONLY) > .include > +.if defined(_COV_FLAG) > +COV_OBJS= ${OBJS} > +COV_SRCS= ${SRCS:M*.[c|cc|cpp|cxx|C]} > +.include > +.endif > .include > .include > .include > From owner-svn-src-all@freebsd.org Sun Aug 27 17:06:24 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id D3A87DF3982; Sun, 27 Aug 2017 17:06:24 +0000 (UTC) (envelope-from yaneurabeya@gmail.com) Received: from mail-pf0-x232.google.com (mail-pf0-x232.google.com [IPv6:2607:f8b0:400e:c00::232]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 917EF774FC; Sun, 27 Aug 2017 17:06:24 +0000 (UTC) (envelope-from yaneurabeya@gmail.com) Received: by mail-pf0-x232.google.com with SMTP id c15so9322426pfm.2; Sun, 27 Aug 2017 10:06:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=subject:mime-version:from:in-reply-to:date:cc:message-id:references :to; bh=MfIuzUT0R4OAg7wl0F3C2tDm6RvNFSMk6OzIeiTdPeg=; b=pyDHRixT1I95wLzn0k4XnYQdyq+T06KsUXooRW/0GLGSGmYZLezM7jVjwa4sxeR+hq oysMvkuCPeoE9hAdKfpIkoNxHrw0CpHlsIQAPKez4HfRd6wE0AYApDVINKB9fB/Ek50G OF5phhw6y7w1B3jnVPfGN0QROIGngBTB160rGZlkskK/isPWGHdXsLko7U5MXAaYonoO k1gXOdxUUV88r/DVZtmHb6+BkQJE1ITycqfuLcYwaIUchQlDLkQrgR7emJ+JylSa16sX zc4yh1XOYU9NZr67LJYuHaBp9aHoWaiymTlLwNRreGT7s0r5iMGFL2di3Sea+CR9c34c i1YQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:mime-version:from:in-reply-to:date:cc :message-id:references:to; bh=MfIuzUT0R4OAg7wl0F3C2tDm6RvNFSMk6OzIeiTdPeg=; b=aiMaTEYPRaAINaB8QK5VxrwiXg7pyOl7UMyT8xvtu3y+5nRoyP1Yy0cFczZjR5bIJH YIvAQlsA5VvV6NnfOzgnB91ml/aMTAMCc9ta1j83Kr11CQecUlLuMgicg2QkXMDmeBS/ OfTzB0SZ6EQnd+J/OFWVG4/OFc9P8/TF6lYzgHMe4z9yv4Z8j+Ke62RUWzrES0rcFJko WtKIKSjYWC10X+WH53UyXXAlQnBGgXdRDPVKYb2p02EkPf3k0n8TXuE2g6Z6OBIDc3YW Nnls5o0Av3ulYoSaOP0pyE4fFonLz1s7FWLsy3VCMkayEHwkvJmIbdIJWRFXZYoRQMik RppQ== X-Gm-Message-State: AHYfb5gnSHkentFKm0ZBRve13XVUbC+sGQZhRwpfVOAc2lOqr/Ns9HoV 919rRGu1NNY4ORkDj8M= X-Received: by 10.99.99.70 with SMTP id x67mr4027140pgb.37.1503853583682; Sun, 27 Aug 2017 10:06:23 -0700 (PDT) Received: from pinklady.local (c-73-19-52-228.hsd1.wa.comcast.net. [73.19.52.228]) by smtp.gmail.com with ESMTPSA id d25sm21489199pfb.163.2017.08.27.10.06.22 (version=TLS1 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Sun, 27 Aug 2017 10:06:22 -0700 (PDT) Subject: Re: svn commit: r322952 - head/share/mk Mime-Version: 1.0 (Mac OS X Mail 9.3 \(3124\)) Content-Type: multipart/signed; boundary="Apple-Mail=_5A6766A9-369F-4BEF-A314-222DED3DB39C"; protocol="application/pgp-signature"; micalg=pgp-sha512 X-Pgp-Agent: GPGMail From: "Ngie Cooper (yaneurabeya)" In-Reply-To: Date: Sun, 27 Aug 2017 10:06:21 -0700 Cc: svn-src-all@freebsd.org, src-committers , svn-src-head@freebsd.org Message-Id: <20ED2CEB-4399-40E2-9A07-5146A199C26D@gmail.com> References: <201708271646.v7RGkpLc046182@repo.freebsd.org> To: cem@freebsd.org X-Mailer: Apple Mail (2.3124) X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 27 Aug 2017 17:06:24 -0000 --Apple-Mail=_5A6766A9-369F-4BEF-A314-222DED3DB39C Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=utf-8 > On Aug 27, 2017, at 09:57, Conrad Meyer wrote: >=20 > This appears to be breaking the build: >=20 > -------------------------------------------------------------- >>>> stage 1.1: legacy release compatibility shims > -------------------------------------------------------------- > =3D=3D=3D> tools/build (obj,includes,all,install) > make[5]: "/home/cem/head.svn/share/mk/bsd.lib.mk" line 79: Malformed > conditional (${MK_COVERAGE} !=3D "no" && (!empty(CFLAGS:M-g*) || > !empty(CXXFLAGS:M-g*))) > make[5]: Fatal errors encountered -- cannot continue > make[5]: stopped in /home/cem/head.svn/tools/build The svn switch didn=E2=80=99t complete successfully =E2=80=94 great. = I=E2=80=99ll fix this shortly. -Ngie --Apple-Mail=_5A6766A9-369F-4BEF-A314-222DED3DB39C Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename=signature.asc Content-Type: application/pgp-signature; name=signature.asc Content-Description: Message signed with OpenPGP using GPGMail -----BEGIN PGP SIGNATURE----- Comment: GPGTools - https://gpgtools.org iQIcBAEBCgAGBQJZovwNAAoJEPWDqSZpMIYVP8AP/1R/cpVTUdCw2r2tURXlh9c2 VZ7kJj/rM3pxqUh/sBuEew3V7VyQeMdqZata4PcW7lM+YBeRHtDVFGr0en4EpBhj ExoaNjr4ryns9u4JA2K7pCMuI/UhpBlsJEqW4b/gKy3MjUBrDbm0Oscv96ipDc28 u3S9KHMGXOppP4YYUh75Hu73aIDYrpqJ6Nd8en9my4mxoZ8Lxxa1g7kMoqVvQOjm ijyLNok7xutwZ6Rjgl0pRbdtC5KjcbFi2t5/o9e8utbvSaPgJZyA8YLGLDfyipxM vfKbFNBbRv0zf/g4l9MCCvNMjjCrEGsk30xEV6j7pY+CB3eKdue81V6S+fwFUlHa 8OC+GytzBCf03X1x5R0+op8LuaG6Vu8mrr0qpyuVPY0Rb1ZunwEyVksJUDsclwXl Qj9ZCBrcFLloRMitYVUDFKmJYOkHnRaogPBhQ72BJ8edPWwUQzcfujl8ZAWIGKDF VLncmVMQJAmJTSC0VAHPu0H/oC/hFfy915y+HhfDAS6APoCuf51tYeWyXM6f6CZR Rs5GCmxUpWzty+fYFIvOVDKHJGC0fMSiPuIOHX8HNfof5DUrJ4w+UgprJOZcTgTX R9vpyKMKAvH2/D1fhXt3gu2sTwf/8qJsvhk/EXw7S3MiJ2N+f3irSvtkPcZe1zqs raA/RLGPIKCZL+v5hnax =BvFI -----END PGP SIGNATURE----- --Apple-Mail=_5A6766A9-369F-4BEF-A314-222DED3DB39C-- From owner-svn-src-all@freebsd.org Sun Aug 27 17:08:09 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id E1842DF3BEA; Sun, 27 Aug 2017 17:08:09 +0000 (UTC) (envelope-from ngie@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (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 BB27E77718; Sun, 27 Aug 2017 17:08:09 +0000 (UTC) (envelope-from ngie@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v7RH88De054471; Sun, 27 Aug 2017 17:08:08 GMT (envelope-from ngie@FreeBSD.org) Received: (from ngie@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7RH88OA054470; Sun, 27 Aug 2017 17:08:08 GMT (envelope-from ngie@FreeBSD.org) Message-Id: <201708271708.v7RH88OA054470@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ngie set sender to ngie@FreeBSD.org using -f From: Ngie Cooper Date: Sun, 27 Aug 2017 17:08:08 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r322953 - head/share/mk X-SVN-Group: head X-SVN-Commit-Author: ngie X-SVN-Commit-Paths: head/share/mk X-SVN-Commit-Revision: 322953 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 27 Aug 2017 17:08:10 -0000 Author: ngie Date: Sun Aug 27 17:08:08 2017 New Revision: 322953 URL: https://svnweb.freebsd.org/changeset/base/322953 Log: Revert change (r322952) that was not yet destined for ^/head This unbreaks the build. This happened because of a botched "svn switch". Reported by: cem Modified: head/share/mk/bsd.lib.mk Modified: head/share/mk/bsd.lib.mk ============================================================================== --- head/share/mk/bsd.lib.mk Sun Aug 27 16:46:51 2017 (r322952) +++ head/share/mk/bsd.lib.mk Sun Aug 27 17:08:08 2017 (r322953) @@ -76,13 +76,6 @@ CTFFLAGS+= -g .include -.if ${MK_COVERAGE} != "no" && (!empty(CFLAGS:M-g*) || !empty(CXXFLAGS:M-g*)) -_COV_FLAG= --coverage -CFLAGS+= ${_COV_FLAG} -CXXFLAGS+= ${_COV_FLAG} -.error "foo" -.endif - # prefer .s to a .c, add .po, remove stuff not used in the BSD libraries # .pico used for PIC object files .SUFFIXES: .out .o .bc .ll .po .pico .S .asm .s .c .cc .cpp .cxx .C .f .y .l .ln @@ -102,14 +95,14 @@ PO_FLAG=-pg ${CTFCONVERT_CMD} .c.pico: - ${CC} ${PICFLAG} -DPIC ${PO_CFLAGS} ${CFLAGS} -c ${.IMPSRC} -o ${.TARGET} + ${CC} ${PICFLAG} -DPIC ${SHARED_CFLAGS} ${CFLAGS} -c ${.IMPSRC} -o ${.TARGET} ${CTFCONVERT_CMD} .cc.po .C.po .cpp.po .cxx.po: ${CXX} ${PO_FLAG} ${STATIC_CXXFLAGS} ${PO_CXXFLAGS} -c ${.IMPSRC} -o ${.TARGET} .cc.pico .C.pico .cpp.pico .cxx.pico: - ${CXX} ${PICFLAG} -DPIC ${PO_CXXFLAGS} ${CXXFLAGS} -c ${.IMPSRC} -o ${.TARGET} + ${CXX} ${PICFLAG} -DPIC ${SHARED_CXXFLAGS} ${CXXFLAGS} -c ${.IMPSRC} -o ${.TARGET} .f.po: ${FC} -pg ${FFLAGS} -o ${.TARGET} -c ${.IMPSRC} @@ -149,12 +142,6 @@ _SHLIBDIR:=${SHLIBDIR} .if defined(SHLIB_NAME) .if ${MK_DEBUG_FILES} != "no" SHLIB_NAME_FULL=${SHLIB_NAME}.full -.if ${MK_COVERAGE} != "no" -COVERAGEFILEDIR=${COVERAGEDIR}${_SHLIBDIR} -.if !exists(${DESTDIR}${COVERAGEFILEDIR}) -COVERAGEMKDIR= -.endif -.endif # Use ${DEBUGDIR} for base system debug files, else .debug subdirectory .if ${_SHLIBDIR} == "/boot" ||\ ${SHLIBDIR:C%/lib(/.*)?$%/lib%} == "/lib" ||\ @@ -234,9 +221,6 @@ CLEANFILES+= ${SOBJS} .if defined(SHLIB_NAME) _LIBS+= ${SHLIB_NAME} -.if !empty(_COV_FLAG) -SOLINKOPTS+= ${_COV_FLAG} -.endif SOLINKOPTS+= -shared -Wl,-x .if defined(LD_FATAL_WARNINGS) && ${LD_FATAL_WARNINGS} == "no" SOLINKOPTS+= -Wl,--no-fatal-warnings @@ -376,14 +360,6 @@ _libinstall: ${_INSTALLFLAGS} ${_SHLINSTALLFLAGS} \ ${SHLIB_NAME} ${DESTDIR}${_SHLIBDIR}/ .if ${MK_DEBUG_FILES} != "no" -.if ${MK_COVERAGE} != "no" -.if defined(COVERAGEMKDIR) - ${INSTALL} ${TAG_ARGS:D${TAG_ARGS},coverage} -d ${DESTDIR}${COVERAGEFILEDIR}/ -.endif - ${INSTALL} ${TAG_ARGS:D${TAG_ARGS},coverage} -o ${LIBOWN} -g ${LIBGRP} -m ${LIBMODE} \ - ${_INSTALLFLAGS} \ - ${SHLIB_NAME}.full ${DESTDIR}${COVERAGEFILEDIR}/${SHLIB_NAME} -.endif .if defined(DEBUGMKDIR) ${INSTALL} ${TAG_ARGS:D${TAG_ARGS},debug} -d ${DESTDIR}${DEBUGFILEDIR}/ .endif @@ -435,11 +411,6 @@ _libinstall: .if !defined(LIBRARIES_ONLY) .include -.if defined(_COV_FLAG) -COV_OBJS= ${OBJS} -COV_SRCS= ${SRCS:M*.[c|cc|cpp|cxx|C]} -.include -.endif .include .include .include From owner-svn-src-all@freebsd.org Sun Aug 27 17:12:32 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 1C55ADF3E2A; Sun, 27 Aug 2017 17:12:32 +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 mx1.freebsd.org (Postfix) with ESMTPS id EB8E177B25; Sun, 27 Aug 2017 17:12: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 v7RHCVqo058306; Sun, 27 Aug 2017 17:12:31 GMT (envelope-from cem@FreeBSD.org) Received: (from cem@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7RHCVXk058305; Sun, 27 Aug 2017 17:12:31 GMT (envelope-from cem@FreeBSD.org) Message-Id: <201708271712.v7RHCVXk058305@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: cem set sender to cem@FreeBSD.org using -f From: Conrad Meyer Date: Sun, 27 Aug 2017 17:12:31 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r322954 - head/sys/kern X-SVN-Group: head X-SVN-Commit-Author: cem X-SVN-Commit-Paths: head/sys/kern X-SVN-Commit-Revision: 322954 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 27 Aug 2017 17:12:32 -0000 Author: cem Date: Sun Aug 27 17:12:30 2017 New Revision: 322954 URL: https://svnweb.freebsd.org/changeset/base/322954 Log: Enhance debugibility of sysctl leaf re-use warnings Print the full conflicting oid path, and include the function name in the warning so it is clear that the warnings are sysctl-related. PR: 221853 Submitted by: Fabian Keil (earlier version) Sponsored by: Dell EMC Isilon Modified: head/sys/kern/kern_sysctl.c Modified: head/sys/kern/kern_sysctl.c ============================================================================== --- head/sys/kern/kern_sysctl.c Sun Aug 27 17:08:08 2017 (r322953) +++ head/sys/kern/kern_sysctl.c Sun Aug 27 17:12:30 2017 (r322954) @@ -323,6 +323,91 @@ sysctl_load_tunable_by_oid_locked(struct sysctl_oid *o freeenv(penv); } +static int +sbuf_printf_drain(void *arg __unused, const char *data, int len) +{ + + return (printf("%.*s", len, data)); +} + +/* + * Locate the path to a given oid. Returns the length of the resulting path, + * or -1 if the oid was not found. nodes must have room for CTL_MAXNAME + * elements and be NULL initialized. + */ +static int +sysctl_search_oid(struct sysctl_oid **nodes, struct sysctl_oid *needle) +{ + int indx; + + SYSCTL_ASSERT_LOCKED(); + indx = 0; + while (indx < CTL_MAXNAME && indx >= 0) { + if (nodes[indx] == NULL && indx == 0) + nodes[indx] = SLIST_FIRST(&sysctl__children); + else if (nodes[indx] == NULL) + nodes[indx] = SLIST_FIRST(&nodes[indx - 1]->oid_children); + else + nodes[indx] = SLIST_NEXT(nodes[indx], oid_link); + + if (nodes[indx] == needle) + return (indx + 1); + + if (nodes[indx] == NULL) { + indx--; + continue; + } + + if ((nodes[indx]->oid_kind & CTLTYPE) == CTLTYPE_NODE) { + indx++; + continue; + } + } + return (-1); +} + +static void +sysctl_warn_reuse(const char *func, struct sysctl_oid *leaf) +{ + struct sysctl_oid *nodes[CTL_MAXNAME]; + char buf[128]; + struct sbuf sb; + int rc, i; + + (void)sbuf_new(&sb, buf, sizeof(buf), SBUF_FIXEDLEN | SBUF_INCLUDENUL); + sbuf_set_drain(&sb, sbuf_printf_drain, NULL); + + sbuf_printf(&sb, "%s: can't re-use a leaf (", __func__); + + memset(nodes, 0, sizeof(nodes)); + rc = sysctl_search_oid(nodes, leaf); + if (rc > 0) { + for (i = 0; i < rc; i++) + sbuf_printf(&sb, "%s%.*s", nodes[i]->oid_name, + i != (rc - 1), "."); + } else { + sbuf_printf(&sb, "%s", leaf->oid_name); + } + sbuf_printf(&sb, ")!\n"); + + (void)sbuf_finish(&sb); +} + +#ifdef SYSCTL_DEBUG +static int +sysctl_reuse_test(SYSCTL_HANDLER_ARGS) +{ + struct rm_priotracker tracker; + + SYSCTL_RLOCK(&tracker); + sysctl_warn_reuse(__func__, oidp); + SYSCTL_RUNLOCK(&tracker); + return (0); +} +SYSCTL_PROC(_sysctl, 0, reuse_test, CTLTYPE_STRING|CTLFLAG_RD|CTLFLAG_MPSAFE, + 0, 0, sysctl_reuse_test, "-", ""); +#endif + void sysctl_register_oid(struct sysctl_oid *oidp) { @@ -343,7 +428,7 @@ sysctl_register_oid(struct sysctl_oid *oidp) p->oid_refcnt++; return; } else { - printf("can't re-use a leaf (%s)!\n", p->oid_name); + sysctl_warn_reuse(__func__, p); return; } } @@ -715,8 +800,8 @@ sysctl_add_oid(struct sysctl_ctx_list *clist, struct s SYSCTL_WUNLOCK(); return (oidp); } else { + sysctl_warn_reuse(__func__, oidp); SYSCTL_WUNLOCK(); - printf("can't re-use a leaf (%s)!\n", name); return (NULL); } } From owner-svn-src-all@freebsd.org Sun Aug 27 18:18:02 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id DB010DF5541; Sun, 27 Aug 2017 18:18:02 +0000 (UTC) (envelope-from marius@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (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 953927E3F6; Sun, 27 Aug 2017 18:18:02 +0000 (UTC) (envelope-from marius@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v7RII1j2084823; Sun, 27 Aug 2017 18:18:01 GMT (envelope-from marius@FreeBSD.org) Received: (from marius@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7RII1LR084818; Sun, 27 Aug 2017 18:18:01 GMT (envelope-from marius@FreeBSD.org) Message-Id: <201708271818.v7RII1LR084818@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: marius set sender to marius@FreeBSD.org using -f From: Marius Strobl Date: Sun, 27 Aug 2017 18:18: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: r322955 - stable/11/sys/dev/e1000 X-SVN-Group: stable-11 X-SVN-Commit-Author: marius X-SVN-Commit-Paths: stable/11/sys/dev/e1000 X-SVN-Commit-Revision: 322955 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 27 Aug 2017 18:18:03 -0000 Author: marius Date: Sun Aug 27 18:18:01 2017 New Revision: 322955 URL: https://svnweb.freebsd.org/changeset/base/322955 Log: MFC: r308643, r312427 - Update WOL support for newer em(4) devices. [1] - Add support for Kaby Lake generation i219 (4) and i219 (5) devices. PR: 208343 [1] Modified: stable/11/sys/dev/e1000/e1000_82575.c stable/11/sys/dev/e1000/e1000_82575.h stable/11/sys/dev/e1000/e1000_defines.h stable/11/sys/dev/e1000/e1000_ich8lan.c stable/11/sys/dev/e1000/if_em.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/dev/e1000/e1000_82575.c ============================================================================== --- stable/11/sys/dev/e1000/e1000_82575.c Sun Aug 27 17:12:30 2017 (r322954) +++ stable/11/sys/dev/e1000/e1000_82575.c Sun Aug 27 18:18:01 2017 (r322955) @@ -101,7 +101,6 @@ static s32 e1000_validate_nvm_checksum_with_offset(str u16 offset); static s32 e1000_validate_nvm_checksum_i350(struct e1000_hw *hw); static s32 e1000_update_nvm_checksum_i350(struct e1000_hw *hw); -static void e1000_write_vfta_i350(struct e1000_hw *hw, u32 offset, u32 value); static void e1000_clear_vfta_i350(struct e1000_hw *hw); static void e1000_i2c_start(struct e1000_hw *hw); Modified: stable/11/sys/dev/e1000/e1000_82575.h ============================================================================== --- stable/11/sys/dev/e1000/e1000_82575.h Sun Aug 27 17:12:30 2017 (r322954) +++ stable/11/sys/dev/e1000/e1000_82575.h Sun Aug 27 18:18:01 2017 (r322955) @@ -493,6 +493,7 @@ enum e1000_promisc_type { void e1000_vfta_set_vf(struct e1000_hw *, u16, bool); void e1000_rlpml_set_vf(struct e1000_hw *, u16); s32 e1000_promisc_set_vf(struct e1000_hw *, enum e1000_promisc_type type); +void e1000_write_vfta_i350(struct e1000_hw *hw, u32 offset, u32 value); u16 e1000_rxpbs_adjust_82580(u32 data); s32 e1000_read_emi_reg(struct e1000_hw *hw, u16 addr, u16 *data); s32 e1000_set_eee_i350(struct e1000_hw *hw, bool adv1G, bool adv100M); Modified: stable/11/sys/dev/e1000/e1000_defines.h ============================================================================== --- stable/11/sys/dev/e1000/e1000_defines.h Sun Aug 27 17:12:30 2017 (r322954) +++ stable/11/sys/dev/e1000/e1000_defines.h Sun Aug 27 18:18:01 2017 (r322955) @@ -469,6 +469,8 @@ #define ETHERNET_FCS_SIZE 4 #define MAX_JUMBO_FRAME_SIZE 0x3F00 +/* The datasheet maximum supported RX size is 9.5KB (9728 bytes) */ +#define MAX_RX_JUMBO_FRAME_SIZE 0x2600 #define E1000_TX_PTR_GAP 0x1F /* Extended Configuration Control and Size */ Modified: stable/11/sys/dev/e1000/e1000_ich8lan.c ============================================================================== --- stable/11/sys/dev/e1000/e1000_ich8lan.c Sun Aug 27 17:12:30 2017 (r322954) +++ stable/11/sys/dev/e1000/e1000_ich8lan.c Sun Aug 27 18:18:01 2017 (r322955) @@ -243,8 +243,7 @@ static bool e1000_phy_is_accessible_pchlan(struct e100 if (ret_val) return FALSE; out: - if ((hw->mac.type == e1000_pch_lpt) || - (hw->mac.type == e1000_pch_spt)) { + if (hw->mac.type >= e1000_pch_lpt) { /* Only unforce SMBus if ME is not active */ if (!(E1000_READ_REG(hw, E1000_FWSM) & E1000_ICH_FWSM_FW_VALID)) { @@ -641,7 +640,7 @@ static s32 e1000_init_nvm_params_ich8lan(struct e1000_ nvm->type = e1000_nvm_flash_sw; - if (hw->mac.type == e1000_pch_spt) { + if (hw->mac.type >= e1000_pch_spt) { /* in SPT, gfpreg doesn't exist. NVM size is taken from the * STRAP register. This is because in SPT the GbE Flash region * is no longer accessed through the flash registers. Instead, @@ -701,7 +700,7 @@ static s32 e1000_init_nvm_params_ich8lan(struct e1000_ /* Function Pointers */ nvm->ops.acquire = e1000_acquire_nvm_ich8lan; nvm->ops.release = e1000_release_nvm_ich8lan; - if (hw->mac.type == e1000_pch_spt) { + if (hw->mac.type >= e1000_pch_spt) { nvm->ops.read = e1000_read_nvm_spt; nvm->ops.update = e1000_update_nvm_checksum_spt; } else { @@ -815,8 +814,7 @@ static s32 e1000_init_mac_params_ich8lan(struct e1000_ break; } - if ((mac->type == e1000_pch_lpt) || - (mac->type == e1000_pch_spt)) { + if (mac->type >= e1000_pch_lpt) { mac->rar_entry_count = E1000_PCH_LPT_RAR_ENTRIES; mac->ops.rar_set = e1000_rar_set_pch_lpt; mac->ops.setup_physical_interface = e1000_setup_copper_link_pch_lpt; @@ -1576,9 +1574,7 @@ static s32 e1000_check_for_copper_link_ich8lan(struct * aggressive resulting in many collisions. To avoid this, increase * the IPG and reduce Rx latency in the PHY. */ - if (((hw->mac.type == e1000_pch2lan) || - (hw->mac.type == e1000_pch_lpt) || - (hw->mac.type == e1000_pch_spt)) && link) { + if ((hw->mac.type >= e1000_pch2lan) && link) { u16 speed, duplex; e1000_get_speed_and_duplex_copper_generic(hw, &speed, &duplex); @@ -1589,7 +1585,7 @@ static s32 e1000_check_for_copper_link_ich8lan(struct tipg_reg |= 0xFF; /* Reduce Rx latency in analog PHY */ emi_val = 0; - } else if (hw->mac.type == e1000_pch_spt && + } else if (hw->mac.type >= e1000_pch_spt && duplex == FULL_DUPLEX && speed != SPEED_1000) { tipg_reg |= 0xC; emi_val = 1; @@ -1611,8 +1607,8 @@ static s32 e1000_check_for_copper_link_ich8lan(struct emi_addr = I217_RX_CONFIG; ret_val = e1000_write_emi_reg_locked(hw, emi_addr, emi_val); - if (hw->mac.type == e1000_pch_lpt || - hw->mac.type == e1000_pch_spt) { + + if (hw->mac.type >= e1000_pch_lpt) { u16 phy_reg; hw->phy.ops.read_reg_locked(hw, I217_PLL_CLOCK_GATE_REG, @@ -1641,7 +1637,7 @@ static s32 e1000_check_for_copper_link_ich8lan(struct if (ret_val) return ret_val; - if (hw->mac.type == e1000_pch_spt) { + if (hw->mac.type >= e1000_pch_spt) { u16 data; u16 ptr_gap; @@ -1690,8 +1686,7 @@ static s32 e1000_check_for_copper_link_ich8lan(struct * on power up. * Set the Beacon Duration for I217 to 8 usec */ - if ((hw->mac.type == e1000_pch_lpt) || - (hw->mac.type == e1000_pch_spt)) { + if (hw->mac.type >= e1000_pch_lpt) { u32 mac_reg; mac_reg = E1000_READ_REG(hw, E1000_FEXTNVM4); @@ -1709,8 +1704,7 @@ static s32 e1000_check_for_copper_link_ich8lan(struct if (ret_val) return ret_val; } - if ((hw->mac.type == e1000_pch_lpt) || - (hw->mac.type == e1000_pch_spt)) { + if (hw->mac.type >= e1000_pch_lpt) { /* Set platform power management values for * Latency Tolerance Reporting (LTR) * Optimized Buffer Flush/Fill (OBFF) @@ -1723,15 +1717,20 @@ static s32 e1000_check_for_copper_link_ich8lan(struct /* Clear link partner's EEE ability */ hw->dev_spec.ich8lan.eee_lp_ability = 0; - /* FEXTNVM6 K1-off workaround */ - if (hw->mac.type == e1000_pch_spt) { - u32 pcieanacfg = E1000_READ_REG(hw, E1000_PCIEANACFG); + if (hw->mac.type >= e1000_pch_lpt) { u32 fextnvm6 = E1000_READ_REG(hw, E1000_FEXTNVM6); - if ((pcieanacfg & E1000_FEXTNVM6_K1_OFF_ENABLE) && - (hw->dev_spec.ich8lan.disable_k1_off == FALSE)) - fextnvm6 |= E1000_FEXTNVM6_K1_OFF_ENABLE; - else + if (hw->mac.type == e1000_pch_spt) { + /* FEXTNVM6 K1-off workaround - for SPT only */ + u32 pcieanacfg = E1000_READ_REG(hw, E1000_PCIEANACFG); + + if (pcieanacfg & E1000_FEXTNVM6_K1_OFF_ENABLE) + fextnvm6 |= E1000_FEXTNVM6_K1_OFF_ENABLE; + else + fextnvm6 &= ~E1000_FEXTNVM6_K1_OFF_ENABLE; + } + + if (hw->dev_spec.ich8lan.disable_k1_off == TRUE) fextnvm6 &= ~E1000_FEXTNVM6_K1_OFF_ENABLE; E1000_WRITE_REG(hw, E1000_FEXTNVM6, fextnvm6); @@ -3671,7 +3670,7 @@ static s32 e1000_flash_cycle_init_ich8lan(struct e1000 /* Clear FCERR and DAEL in hw status by writing 1 */ hsfsts.hsf_status.flcerr = 1; hsfsts.hsf_status.dael = 1; - if (hw->mac.type == e1000_pch_spt) + if (hw->mac.type >= e1000_pch_spt) E1000_WRITE_FLASH_REG(hw, ICH_FLASH_HSFSTS, hsfsts.regval & 0xFFFF); else @@ -3691,7 +3690,7 @@ static s32 e1000_flash_cycle_init_ich8lan(struct e1000 * Begin by setting Flash Cycle Done. */ hsfsts.hsf_status.flcdone = 1; - if (hw->mac.type == e1000_pch_spt) + if (hw->mac.type >= e1000_pch_spt) E1000_WRITE_FLASH_REG(hw, ICH_FLASH_HSFSTS, hsfsts.regval & 0xFFFF); else @@ -3718,7 +3717,7 @@ static s32 e1000_flash_cycle_init_ich8lan(struct e1000 * now set the Flash Cycle Done. */ hsfsts.hsf_status.flcdone = 1; - if (hw->mac.type == e1000_pch_spt) + if (hw->mac.type >= e1000_pch_spt) E1000_WRITE_FLASH_REG(hw, ICH_FLASH_HSFSTS, hsfsts.regval & 0xFFFF); else @@ -3748,13 +3747,13 @@ static s32 e1000_flash_cycle_ich8lan(struct e1000_hw * DEBUGFUNC("e1000_flash_cycle_ich8lan"); /* Start a cycle by writing 1 in Flash Cycle Go in Hw Flash Control */ - if (hw->mac.type == e1000_pch_spt) + if (hw->mac.type >= e1000_pch_spt) hsflctl.regval = E1000_READ_FLASH_REG(hw, ICH_FLASH_HSFSTS)>>16; else hsflctl.regval = E1000_READ_FLASH_REG16(hw, ICH_FLASH_HSFCTL); hsflctl.hsf_ctrl.flcgo = 1; - if (hw->mac.type == e1000_pch_spt) + if (hw->mac.type >= e1000_pch_spt) E1000_WRITE_FLASH_REG(hw, ICH_FLASH_HSFSTS, hsflctl.regval << 16); else @@ -3837,7 +3836,7 @@ static s32 e1000_read_flash_byte_ich8lan(struct e1000_ /* In SPT, only 32 bits access is supported, * so this function should not be called. */ - if (hw->mac.type == e1000_pch_spt) + if (hw->mac.type >= e1000_pch_spt) return -E1000_ERR_NVM; else ret_val = e1000_read_flash_data_ich8lan(hw, offset, 1, &word); @@ -3946,7 +3945,7 @@ static s32 e1000_read_flash_data32_ich8lan(struct e100 DEBUGFUNC("e1000_read_flash_data_ich8lan"); if (offset > ICH_FLASH_LINEAR_ADDR_MASK || - hw->mac.type != e1000_pch_spt) + hw->mac.type < e1000_pch_spt) return -E1000_ERR_NVM; flash_linear_addr = ((ICH_FLASH_LINEAR_ADDR_MASK & offset) + hw->nvm.flash_base_addr); @@ -4434,7 +4433,7 @@ static s32 e1000_write_flash_data_ich8lan(struct e1000 DEBUGFUNC("e1000_write_ich8_data"); - if (hw->mac.type == e1000_pch_spt) { + if (hw->mac.type >= e1000_pch_spt) { if (size != 4 || offset > ICH_FLASH_LINEAR_ADDR_MASK) return -E1000_ERR_NVM; } else { @@ -4454,7 +4453,7 @@ static s32 e1000_write_flash_data_ich8lan(struct e1000 /* In SPT, This register is in Lan memory space, not * flash. Therefore, only 32 bit access is supported */ - if (hw->mac.type == e1000_pch_spt) + if (hw->mac.type >= e1000_pch_spt) hsflctl.regval = E1000_READ_FLASH_REG(hw, ICH_FLASH_HSFSTS)>>16; else @@ -4468,7 +4467,7 @@ static s32 e1000_write_flash_data_ich8lan(struct e1000 * not flash. Therefore, only 32 bit access is * supported */ - if (hw->mac.type == e1000_pch_spt) + if (hw->mac.type >= e1000_pch_spt) E1000_WRITE_FLASH_REG(hw, ICH_FLASH_HSFSTS, hsflctl.regval << 16); else @@ -4530,7 +4529,7 @@ static s32 e1000_write_flash_data32_ich8lan(struct e10 DEBUGFUNC("e1000_write_flash_data32_ich8lan"); - if (hw->mac.type == e1000_pch_spt) { + if (hw->mac.type >= e1000_pch_spt) { if (offset > ICH_FLASH_LINEAR_ADDR_MASK) return -E1000_ERR_NVM; } @@ -4546,7 +4545,7 @@ static s32 e1000_write_flash_data32_ich8lan(struct e10 /* In SPT, This register is in Lan memory space, not * flash. Therefore, only 32 bit access is supported */ - if (hw->mac.type == e1000_pch_spt) + if (hw->mac.type >= e1000_pch_spt) hsflctl.regval = E1000_READ_FLASH_REG(hw, ICH_FLASH_HSFSTS) >> 16; @@ -4561,7 +4560,7 @@ static s32 e1000_write_flash_data32_ich8lan(struct e10 * not flash. Therefore, only 32 bit access is * supported */ - if (hw->mac.type == e1000_pch_spt) + if (hw->mac.type >= e1000_pch_spt) E1000_WRITE_FLASH_REG(hw, ICH_FLASH_HSFSTS, hsflctl.regval << 16); else @@ -4763,7 +4762,7 @@ static s32 e1000_erase_flash_bank_ich8lan(struct e1000 /* Write a value 11 (block Erase) in Flash * Cycle field in hw flash control */ - if (hw->mac.type == e1000_pch_spt) + if (hw->mac.type >= e1000_pch_spt) hsflctl.regval = E1000_READ_FLASH_REG(hw, ICH_FLASH_HSFSTS)>>16; @@ -4773,7 +4772,7 @@ static s32 e1000_erase_flash_bank_ich8lan(struct e1000 ICH_FLASH_HSFCTL); hsflctl.hsf_ctrl.flcycle = ICH_CYCLE_ERASE; - if (hw->mac.type == e1000_pch_spt) + if (hw->mac.type >= e1000_pch_spt) E1000_WRITE_FLASH_REG(hw, ICH_FLASH_HSFSTS, hsflctl.regval << 16); else @@ -5211,8 +5210,7 @@ static void e1000_initialize_hw_bits_ich8lan(struct e1 E1000_WRITE_REG(hw, E1000_RFCTL, reg); /* Enable ECC on Lynxpoint */ - if ((hw->mac.type == e1000_pch_lpt) || - (hw->mac.type == e1000_pch_spt)) { + if (hw->mac.type >= e1000_pch_lpt) { reg = E1000_READ_REG(hw, E1000_PBECCSTS); reg |= E1000_PBECCSTS_ECC_ENABLE; E1000_WRITE_REG(hw, E1000_PBECCSTS, reg); @@ -5645,7 +5643,7 @@ void e1000_suspend_workarounds_ich8lan(struct e1000_hw (device_id == E1000_DEV_ID_PCH_LPTLP_I218_V) || (device_id == E1000_DEV_ID_PCH_I218_LM3) || (device_id == E1000_DEV_ID_PCH_I218_V3) || - (hw->mac.type == e1000_pch_spt)) { + (hw->mac.type >= e1000_pch_spt)) { u32 fextnvm6 = E1000_READ_REG(hw, E1000_FEXTNVM6); E1000_WRITE_REG(hw, E1000_FEXTNVM6, Modified: stable/11/sys/dev/e1000/if_em.c ============================================================================== --- stable/11/sys/dev/e1000/if_em.c Sun Aug 27 17:12:30 2017 (r322954) +++ stable/11/sys/dev/e1000/if_em.c Sun Aug 27 18:18:01 2017 (r322955) @@ -199,6 +199,12 @@ static em_vendor_info_t em_vendor_info_array[] = { 0x8086, E1000_DEV_ID_PCH_SPT_I219_LM5, PCI_ANY_ID, PCI_ANY_ID, 0}, { 0x8086, E1000_DEV_ID_PCH_SPT_I219_V5, PCI_ANY_ID, PCI_ANY_ID, 0}, + { 0x8086, E1000_DEV_ID_PCH_SPT_I219_LM4, + PCI_ANY_ID, PCI_ANY_ID, 0}, + { 0x8086, E1000_DEV_ID_PCH_SPT_I219_V4, PCI_ANY_ID, PCI_ANY_ID, 0}, + { 0x8086, E1000_DEV_ID_PCH_SPT_I219_LM5, + PCI_ANY_ID, PCI_ANY_ID, 0}, + { 0x8086, E1000_DEV_ID_PCH_SPT_I219_V5, PCI_ANY_ID, PCI_ANY_ID, 0}, /* required last entry */ { 0, 0, 0, 0, 0} }; @@ -5274,6 +5280,8 @@ em_get_wakeup(device_t dev) case e1000_ich10lan: case e1000_pchlan: case e1000_pch2lan: + case e1000_pch_lpt: + case e1000_pch_spt: apme_mask = E1000_WUC_APME; adapter->has_amt = TRUE; eeprom_data = E1000_READ_REG(&adapter->hw, E1000_WUC); @@ -5322,7 +5330,7 @@ em_enable_wakeup(device_t dev) { struct adapter *adapter = device_get_softc(dev); if_t ifp = adapter->ifp; - u32 pmc, ctrl, ctrl_ext, rctl; + u32 pmc, ctrl, ctrl_ext, rctl, wuc; u16 status; if ((pci_find_cap(dev, PCIY_PMG, &pmc) != 0)) @@ -5332,7 +5340,9 @@ em_enable_wakeup(device_t dev) ctrl = E1000_READ_REG(&adapter->hw, E1000_CTRL); ctrl |= (E1000_CTRL_SWDPIN2 | E1000_CTRL_SWDPIN3); E1000_WRITE_REG(&adapter->hw, E1000_CTRL, ctrl); - E1000_WRITE_REG(&adapter->hw, E1000_WUC, E1000_WUC_PME_EN); + wuc = E1000_READ_REG(&adapter->hw, E1000_WUC); + wuc |= E1000_WUC_PME_EN; + E1000_WRITE_REG(&adapter->hw, E1000_WUC, wuc); if ((adapter->hw.mac.type == e1000_ich8lan) || (adapter->hw.mac.type == e1000_pchlan) || @@ -5363,8 +5373,10 @@ em_enable_wakeup(device_t dev) E1000_WRITE_REG(&adapter->hw, E1000_RCTL, rctl); } - if ((adapter->hw.mac.type == e1000_pchlan) || - (adapter->hw.mac.type == e1000_pch2lan)) { + if ((adapter->hw.mac.type == e1000_pchlan) || + (adapter->hw.mac.type == e1000_pch2lan) || + (adapter->hw.mac.type == e1000_pch_lpt) || + (adapter->hw.mac.type == e1000_pch_spt)) { if (em_enable_phy_wakeup(adapter)) return; } else { From owner-svn-src-all@freebsd.org Sun Aug 27 21:36:45 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 9C5EEDF866B; Sun, 27 Aug 2017 21:36:45 +0000 (UTC) (envelope-from marius@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (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 69B19831EB; Sun, 27 Aug 2017 21:36:45 +0000 (UTC) (envelope-from marius@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v7RLaioL067005; Sun, 27 Aug 2017 21:36:44 GMT (envelope-from marius@FreeBSD.org) Received: (from marius@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7RLai0I067004; Sun, 27 Aug 2017 21:36:44 GMT (envelope-from marius@FreeBSD.org) Message-Id: <201708272136.v7RLai0I067004@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: marius set sender to marius@FreeBSD.org using -f From: Marius Strobl Date: Sun, 27 Aug 2017 21:36:44 +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: r322956 - stable/11/sys/dev/e1000 X-SVN-Group: stable-11 X-SVN-Commit-Author: marius X-SVN-Commit-Paths: stable/11/sys/dev/e1000 X-SVN-Commit-Revision: 322956 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 27 Aug 2017 21:36:45 -0000 Author: marius Date: Sun Aug 27 21:36:44 2017 New Revision: 322956 URL: https://svnweb.freebsd.org/changeset/base/322956 Log: MFC: r312641 Enable WOL features also for igb(4) class of devices. PR: 208343 Submitted by: Kaho Tashikazu Modified: stable/11/sys/dev/e1000/if_igb.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/dev/e1000/if_igb.c ============================================================================== --- stable/11/sys/dev/e1000/if_igb.c Sun Aug 27 18:18:01 2017 (r322955) +++ stable/11/sys/dev/e1000/if_igb.c Sun Aug 27 21:36:44 2017 (r322956) @@ -719,12 +719,6 @@ igb_detach(device_t dev) igb_release_manageability(adapter); igb_release_hw_control(adapter); - if (adapter->wol) { - E1000_WRITE_REG(&adapter->hw, E1000_WUC, E1000_WUC_PME_EN); - E1000_WRITE_REG(&adapter->hw, E1000_WUFC, adapter->wol); - igb_enable_wakeup(dev); - } - /* Unregister VLAN events */ if (adapter->vlan_attach != NULL) EVENTHANDLER_DEREGISTER(vlan_config, adapter->vlan_attach); @@ -776,13 +770,8 @@ igb_suspend(device_t dev) igb_release_manageability(adapter); igb_release_hw_control(adapter); + igb_enable_wakeup(dev); - if (adapter->wol) { - E1000_WRITE_REG(&adapter->hw, E1000_WUC, E1000_WUC_PME_EN); - E1000_WRITE_REG(&adapter->hw, E1000_WUFC, adapter->wol); - igb_enable_wakeup(dev); - } - IGB_CORE_UNLOCK(adapter); return bus_generic_suspend(dev); @@ -1231,6 +1220,14 @@ igb_ioctl(struct ifnet *ifp, u_long command, caddr_t d ifp->if_capenable ^= IFCAP_LRO; reinit = 1; } + if (mask & IFCAP_WOL) { + if (mask & IFCAP_WOL_MAGIC) + ifp->if_capenable ^= IFCAP_WOL_MAGIC; + if (mask & IFCAP_WOL_MCAST) + ifp->if_capenable ^= IFCAP_WOL_MCAST; + if (mask & IFCAP_WOL_UCAST) + ifp->if_capenable ^= IFCAP_WOL_UCAST; + } if (reinit && (ifp->if_drv_flags & IFF_DRV_RUNNING)) igb_init(adapter); VLAN_CAPABILITIES(ifp); @@ -2290,7 +2287,7 @@ igb_stop(void *arg) } e1000_reset_hw(&adapter->hw); - E1000_WRITE_REG(&adapter->hw, E1000_WUC, 0); + E1000_WRITE_REG(&adapter->hw, E1000_WUFC, 0); e1000_led_off(&adapter->hw); e1000_cleanup_led(&adapter->hw); @@ -3126,7 +3123,7 @@ igb_reset(struct adapter *adapter) /* Issue a global reset */ e1000_reset_hw(hw); - E1000_WRITE_REG(hw, E1000_WUC, 0); + E1000_WRITE_REG(hw, E1000_WUFC, 0); /* Reset for AutoMediaDetect */ if (adapter->flags & IGB_MEDIA_RESET) { @@ -3218,6 +3215,13 @@ igb_setup_interface(device_t dev, struct adapter *adap | IFCAP_VLAN_MTU; /* + * Enable only WOL MAGIC by default if WOL is enabled in EEPROM. + */ + ifp->if_capabilities |= IFCAP_WOL; + if (adapter->wol) + ifp->if_capenable |= IFCAP_WOL_MAGIC; + + /* ** Don't turn this on by default, if vlans are ** created on another pseudo device (eg. lagg) ** then vlan events are not passed thru, breaking @@ -5498,22 +5502,61 @@ igb_is_valid_ether_addr(uint8_t *addr) static void igb_enable_wakeup(device_t dev) { - u16 cap, status; - u8 id; + struct adapter *adapter = device_get_softc(dev); + struct ifnet *ifp = adapter->ifp; + u32 pmc, ctrl, ctrl_ext, rctl, wuc; + u16 status; - /* First find the capabilities pointer*/ - cap = pci_read_config(dev, PCIR_CAP_PTR, 2); - /* Read the PM Capabilities */ - id = pci_read_config(dev, cap, 1); - if (id != PCIY_PMG) /* Something wrong */ + if (pci_find_cap(dev, PCIY_PMG, &pmc) != 0) return; - /* OK, we have the power capabilities, so - now get the status register */ - cap += PCIR_POWER_STATUS; - status = pci_read_config(dev, cap, 2); - status |= PCIM_PSTAT_PME | PCIM_PSTAT_PMEENABLE; - pci_write_config(dev, cap, status, 2); - return; + + adapter->wol = E1000_READ_REG(&adapter->hw, E1000_WUFC); + if (ifp->if_capenable & IFCAP_WOL_MAGIC) + adapter->wol |= E1000_WUFC_MAG; + else + adapter->wol &= ~E1000_WUFC_MAG; + + if (ifp->if_capenable & IFCAP_WOL_MCAST) { + adapter->wol |= E1000_WUFC_MC; + rctl = E1000_READ_REG(&adapter->hw, E1000_RCTL); + rctl |= E1000_RCTL_MPE; + E1000_WRITE_REG(&adapter->hw, E1000_RCTL, rctl); + } else + adapter->wol &= ~E1000_WUFC_MC; + + if (ifp->if_capenable & IFCAP_WOL_UCAST) + adapter->wol |= E1000_WUFC_EX; + else + adapter->wol &= ~E1000_WUFC_EX; + + if (!(adapter->wol & (E1000_WUFC_EX | E1000_WUFC_MAG | E1000_WUFC_MC))) + goto pme; + + /* Advertise the wakeup capability */ + ctrl = E1000_READ_REG(&adapter->hw, E1000_CTRL); + ctrl |= (E1000_CTRL_SWDPIN2 | E1000_CTRL_SWDPIN3); + E1000_WRITE_REG(&adapter->hw, E1000_CTRL, ctrl); + + /* Keep the laser running on Fiber adapters */ + if (adapter->hw.phy.media_type == e1000_media_type_fiber || + adapter->hw.phy.media_type == e1000_media_type_internal_serdes) { + ctrl_ext = E1000_READ_REG(&adapter->hw, E1000_CTRL_EXT); + ctrl_ext |= E1000_CTRL_EXT_SDP3_DATA; + E1000_WRITE_REG(&adapter->hw, E1000_CTRL_EXT, ctrl_ext); + } + + /* Enable wakeup by the MAC */ + wuc = E1000_READ_REG(&adapter->hw, E1000_WUC); + wuc |= E1000_WUC_PME_EN | E1000_WUC_APME; + E1000_WRITE_REG(&adapter->hw, E1000_WUC, wuc); + E1000_WRITE_REG(&adapter->hw, E1000_WUFC, adapter->wol); + +pme: + status = pci_read_config(dev, pmc + PCIR_POWER_STATUS, 2); + status &= ~(PCIM_PSTAT_PME | PCIM_PSTAT_PMEENABLE); + if (ifp->if_capenable & IFCAP_WOL) + status |= PCIM_PSTAT_PME | PCIM_PSTAT_PMEENABLE; + pci_write_config(dev, pmc + PCIR_POWER_STATUS, status, 2); } static void From owner-svn-src-all@freebsd.org Sun Aug 27 22:13:04 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id E00C5DF8F05; Sun, 27 Aug 2017 22:13:04 +0000 (UTC) (envelope-from avos@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (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 AA6F483F7A; Sun, 27 Aug 2017 22:13:04 +0000 (UTC) (envelope-from avos@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v7RMD3rh083076; Sun, 27 Aug 2017 22:13:03 GMT (envelope-from avos@FreeBSD.org) Received: (from avos@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7RMD3Yw083075; Sun, 27 Aug 2017 22:13:03 GMT (envelope-from avos@FreeBSD.org) Message-Id: <201708272213.v7RMD3Yw083075@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avos set sender to avos@FreeBSD.org using -f From: Andriy Voskoboinyk Date: Sun, 27 Aug 2017 22:13:03 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r322957 - head/sys/net80211 X-SVN-Group: head X-SVN-Commit-Author: avos X-SVN-Commit-Paths: head/sys/net80211 X-SVN-Commit-Revision: 322957 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 27 Aug 2017 22:13:05 -0000 Author: avos Date: Sun Aug 27 22:13:03 2017 New Revision: 322957 URL: https://svnweb.freebsd.org/changeset/base/322957 Log: net80211: fix a typo (premable -> preamble). Modified: head/sys/net80211/ieee80211_output.c Modified: head/sys/net80211/ieee80211_output.c ============================================================================== --- head/sys/net80211/ieee80211_output.c Sun Aug 27 21:36:44 2017 (r322956) +++ head/sys/net80211/ieee80211_output.c Sun Aug 27 22:13:03 2017 (r322957) @@ -2500,7 +2500,7 @@ ieee80211_send_mgmt(struct ieee80211_node *ni, int typ capinfo |= IEEE80211_CAPINFO_PRIVACY; /* * NB: Some 11a AP's reject the request when - * short premable is set. + * short preamble is set. */ if ((ic->ic_flags & IEEE80211_F_SHPREAMBLE) && IEEE80211_IS_CHAN_2GHZ(ic->ic_curchan)) From owner-svn-src-all@freebsd.org Mon Aug 28 02:42:22 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 1F71DE03DAC; Mon, 28 Aug 2017 02:42:22 +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 mx1.freebsd.org (Postfix) with ESMTPS id EF2AF657CF; Mon, 28 Aug 2017 02:42:21 +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 v7S2gLe0091953; Mon, 28 Aug 2017 02:42:21 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7S2gLoH091952; Mon, 28 Aug 2017 02:42:21 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <201708280242.v7S2gLoH091952@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Mon, 28 Aug 2017 02:42:21 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r322959 - head/usr.bin/truss X-SVN-Group: head X-SVN-Commit-Author: jhb X-SVN-Commit-Paths: head/usr.bin/truss X-SVN-Commit-Revision: 322959 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 28 Aug 2017 02:42:22 -0000 Author: jhb Date: Mon Aug 28 02:42:20 2017 New Revision: 322959 URL: https://svnweb.freebsd.org/changeset/base/322959 Log: Decode extra signal information for caught signals. Decode fields from the siginfo_t stored in the PT_LWPINFO structure when a signal is caught by a traced process. This includes the signal code (si_code) as well as additional members such as si_addr, si_pid, etc. Modified: head/usr.bin/truss/setup.c Modified: head/usr.bin/truss/setup.c ============================================================================== --- head/usr.bin/truss/setup.c Mon Aug 28 00:05:24 2017 (r322958) +++ head/usr.bin/truss/setup.c Mon Aug 28 02:42:20 2017 (r322959) @@ -585,8 +585,62 @@ report_new_child(struct trussinfo *info) } static void -report_signal(struct trussinfo *info, siginfo_t *si) +decode_siginfo(FILE *fp, siginfo_t *si) { + const char *str; + + fprintf(fp, " code="); + str = sysdecode_sigcode(si->si_signo, si->si_code); + if (str == NULL) + fprintf(fp, "%d", si->si_code); + else + fprintf(fp, "%s", str); + switch (si->si_code) { + case SI_NOINFO: + break; + case SI_QUEUE: + fprintf(fp, " value=%p", si->si_value.sival_ptr); + /* FALLTHROUGH */ + case SI_USER: + case SI_LWP: + fprintf(fp, " pid=%jd uid=%jd", (intmax_t)si->si_pid, + (intmax_t)si->si_uid); + break; + case SI_TIMER: + fprintf(fp, " value=%p", si->si_value.sival_ptr); + fprintf(fp, " timerid=%d", si->si_timerid); + fprintf(fp, " overrun=%d", si->si_overrun); + if (si->si_errno != 0) + fprintf(fp, " errno=%d", si->si_errno); + break; + case SI_ASYNCIO: + fprintf(fp, " value=%p", si->si_value.sival_ptr); + break; + case SI_MESGQ: + fprintf(fp, " value=%p", si->si_value.sival_ptr); + fprintf(fp, " mqd=%d", si->si_mqd); + break; + default: + switch (si->si_signo) { + case SIGILL: + case SIGFPE: + case SIGSEGV: + case SIGBUS: + fprintf(fp, " trapno=%d", si->si_trapno); + fprintf(fp, " addr=%p", si->si_addr); + break; + case SIGCHLD: + fprintf(fp, " pid=%jd uid=%jd", (intmax_t)si->si_pid, + (intmax_t)si->si_uid); + fprintf(fp, " status=%d", si->si_status); + break; + } + } +} + +static void +report_signal(struct trussinfo *info, siginfo_t *si, struct ptrace_lwpinfo *pl) +{ struct threadinfo *t; const char *signame; @@ -596,7 +650,11 @@ report_signal(struct trussinfo *info, siginfo_t *si) signame = sysdecode_signal(si->si_status); if (signame == NULL) signame = "?"; - fprintf(info->outfile, "SIGNAL %u (%s)\n", si->si_status, signame); + fprintf(info->outfile, "SIGNAL %u (%s)", si->si_status, signame); + if (pl->pl_event == PL_EVENT_SIGNAL && pl->pl_flags & PL_FLAG_SI) + decode_siginfo(info->outfile, &pl->pl_siginfo); + fprintf(info->outfile, "\n"); + } /* @@ -673,7 +731,7 @@ eventloop(struct trussinfo *info) pending_signal = 0; } else { if ((info->flags & NOSIGS) == 0) - report_signal(info, &si); + report_signal(info, &si, &pl); pending_signal = si.si_status; } ptrace(PT_SYSCALL, si.si_pid, (caddr_t)1, From owner-svn-src-all@freebsd.org Mon Aug 28 03:13:17 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 8D523E04702; Mon, 28 Aug 2017 03:13:17 +0000 (UTC) (envelope-from np@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (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 5A6B56697C; Mon, 28 Aug 2017 03:13:17 +0000 (UTC) (envelope-from np@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v7S3DGil005011; Mon, 28 Aug 2017 03:13:16 GMT (envelope-from np@FreeBSD.org) Received: (from np@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7S3DG2N005008; Mon, 28 Aug 2017 03:13:16 GMT (envelope-from np@FreeBSD.org) Message-Id: <201708280313.v7S3DG2N005008@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: np set sender to np@FreeBSD.org using -f From: Navdeep Parhar Date: Mon, 28 Aug 2017 03:13:16 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r322960 - in head/sys/dev/cxgbe: . common X-SVN-Group: head X-SVN-Commit-Author: np X-SVN-Commit-Paths: in head/sys/dev/cxgbe: . common X-SVN-Commit-Revision: 322960 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 28 Aug 2017 03:13:17 -0000 Author: np Date: Mon Aug 28 03:13:16 2017 New Revision: 322960 URL: https://svnweb.freebsd.org/changeset/base/322960 Log: cxgbe(4): Verify that the driver accesses the firmware mailbox in a thread-safe manner. MFC after: 3 days Modified: head/sys/dev/cxgbe/adapter.h head/sys/dev/cxgbe/common/t4_hw.c head/sys/dev/cxgbe/t4_main.c Modified: head/sys/dev/cxgbe/adapter.h ============================================================================== --- head/sys/dev/cxgbe/adapter.h Mon Aug 28 02:42:20 2017 (r322959) +++ head/sys/dev/cxgbe/adapter.h Mon Aug 28 03:13:16 2017 (r322960) @@ -151,7 +151,7 @@ enum { /* adapter flags */ FULL_INIT_DONE = (1 << 0), FW_OK = (1 << 1), - /* INTR_DIRECT = (1 << 2), No longer used. */ + CHK_MBOX_ACCESS = (1 << 2), MASTER_PF = (1 << 3), ADAP_SYSCTL_CTX = (1 << 4), /* TOM_INIT_DONE= (1 << 5), No longer used */ Modified: head/sys/dev/cxgbe/common/t4_hw.c ============================================================================== --- head/sys/dev/cxgbe/common/t4_hw.c Mon Aug 28 02:42:20 2017 (r322959) +++ head/sys/dev/cxgbe/common/t4_hw.c Mon Aug 28 03:13:16 2017 (r322960) @@ -286,6 +286,9 @@ int t4_wr_mbox_meat_timeout(struct adapter *adap, int __be64 cmd_rpl[MBOX_LEN/8]; u32 pcie_fw; + if (adap->flags & CHK_MBOX_ACCESS) + ASSERT_SYNCHRONIZED_OP(adap); + if ((size & 15) || size > MBOX_LEN) return -EINVAL; Modified: head/sys/dev/cxgbe/t4_main.c ============================================================================== --- head/sys/dev/cxgbe/t4_main.c Mon Aug 28 02:42:20 2017 (r322959) +++ head/sys/dev/cxgbe/t4_main.c Mon Aug 28 03:13:16 2017 (r322960) @@ -1221,6 +1221,15 @@ t4_attach(device_t dev) goto done; } + /* + * Ensure thread-safe mailbox access (in debug builds). + * + * So far this was the only thread accessing the mailbox but various + * ifnets and sysctls are about to be created and their handlers/ioctls + * will access the mailbox from different threads. + */ + sc->flags |= CHK_MBOX_ACCESS; + rc = bus_generic_attach(dev); if (rc != 0) { device_printf(dev, @@ -1336,6 +1345,7 @@ t4_detach_common(device_t dev) sc = device_get_softc(dev); + sc->flags &= ~CHK_MBOX_ACCESS; if (sc->flags & FULL_INIT_DONE) { if (!(sc->flags & IS_VF)) t4_intr_disable(sc); From owner-svn-src-all@freebsd.org Mon Aug 28 03:25:43 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 18030E0493B; Mon, 28 Aug 2017 03:25:43 +0000 (UTC) (envelope-from np@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (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 D9C2566DB6; Mon, 28 Aug 2017 03:25:42 +0000 (UTC) (envelope-from np@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v7S3Pg8j009210; Mon, 28 Aug 2017 03:25:42 GMT (envelope-from np@FreeBSD.org) Received: (from np@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7S3PgqQ009209; Mon, 28 Aug 2017 03:25:42 GMT (envelope-from np@FreeBSD.org) Message-Id: <201708280325.v7S3PgqQ009209@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: np set sender to np@FreeBSD.org using -f From: Navdeep Parhar Date: Mon, 28 Aug 2017 03:25:42 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r322961 - head/sys/dev/cxgbe X-SVN-Group: head X-SVN-Commit-Author: np X-SVN-Commit-Paths: head/sys/dev/cxgbe X-SVN-Commit-Revision: 322961 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 28 Aug 2017 03:25:43 -0000 Author: np Date: Mon Aug 28 03:25:41 2017 New Revision: 322961 URL: https://svnweb.freebsd.org/changeset/base/322961 Log: cxgbe(4): Fix some assertions during driver detach. The netmap queues can't be initialized if the VI isn't. MFC after: 3 days Modified: head/sys/dev/cxgbe/t4_sge.c Modified: head/sys/dev/cxgbe/t4_sge.c ============================================================================== --- head/sys/dev/cxgbe/t4_sge.c Mon Aug 28 03:13:16 2017 (r322960) +++ head/sys/dev/cxgbe/t4_sge.c Mon Aug 28 03:25:41 2017 (r322961) @@ -3306,7 +3306,10 @@ free_nm_rxq(struct vi_info *vi, struct sge_nm_rxq *nm_ { struct adapter *sc = vi->pi->adapter; - MPASS(nm_rxq->iq_cntxt_id == INVALID_NM_RXQ_CNTXT_ID); + if (vi->flags & VI_INIT_DONE) + MPASS(nm_rxq->iq_cntxt_id == INVALID_NM_RXQ_CNTXT_ID); + else + MPASS(nm_rxq->iq_cntxt_id == 0); free_ring(sc, nm_rxq->iq_desc_tag, nm_rxq->iq_desc_map, nm_rxq->iq_ba, nm_rxq->iq_desc); @@ -3366,7 +3369,10 @@ free_nm_txq(struct vi_info *vi, struct sge_nm_txq *nm_ { struct adapter *sc = vi->pi->adapter; - MPASS(nm_txq->cntxt_id == INVALID_NM_TXQ_CNTXT_ID); + if (vi->flags & VI_INIT_DONE) + MPASS(nm_txq->cntxt_id == INVALID_NM_TXQ_CNTXT_ID); + else + MPASS(nm_txq->cntxt_id == 0); free_ring(sc, nm_txq->desc_tag, nm_txq->desc_map, nm_txq->ba, nm_txq->desc); From owner-svn-src-all@freebsd.org Mon Aug 28 04:06:42 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 4552CE04FE0; Mon, 28 Aug 2017 04:06:42 +0000 (UTC) (envelope-from np@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (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 058C267A61; Mon, 28 Aug 2017 04:06:41 +0000 (UTC) (envelope-from np@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v7S46fTN025317; Mon, 28 Aug 2017 04:06:41 GMT (envelope-from np@FreeBSD.org) Received: (from np@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7S46fgO025316; Mon, 28 Aug 2017 04:06:41 GMT (envelope-from np@FreeBSD.org) Message-Id: <201708280406.v7S46fgO025316@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: np set sender to np@FreeBSD.org using -f From: Navdeep Parhar Date: Mon, 28 Aug 2017 04:06:41 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r322962 - head/sys/dev/cxgbe/common X-SVN-Group: head X-SVN-Commit-Author: np X-SVN-Commit-Paths: head/sys/dev/cxgbe/common X-SVN-Commit-Revision: 322962 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 28 Aug 2017 04:06:42 -0000 Author: np Date: Mon Aug 28 04:06:40 2017 New Revision: 322962 URL: https://svnweb.freebsd.org/changeset/base/322962 Log: cxgbe(4): Remove write only variable from t4_port_init. MFC after: 3 days Modified: head/sys/dev/cxgbe/common/t4_hw.c Modified: head/sys/dev/cxgbe/common/t4_hw.c ============================================================================== --- head/sys/dev/cxgbe/common/t4_hw.c Mon Aug 28 03:25:41 2017 (r322961) +++ head/sys/dev/cxgbe/common/t4_hw.c Mon Aug 28 04:06:40 2017 (r322962) @@ -8354,12 +8354,9 @@ int t4_port_init(struct adapter *adap, int mbox, int p { u8 addr[6]; int ret, i, j; - struct fw_port_cmd c; u16 rss_size; struct port_info *p = adap2pinfo(adap, port_id); u32 param, val; - - memset(&c, 0, sizeof(c)); for (i = 0, j = -1; i <= p->port_id; i++) { do { From owner-svn-src-all@freebsd.org Mon Aug 28 06:17:06 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 01C67E06996; Mon, 28 Aug 2017 06:17:06 +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 mx1.freebsd.org (Postfix) with ESMTPS id BC55D6A9D3; Mon, 28 Aug 2017 06:17:05 +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 v7S6H4YY077525; Mon, 28 Aug 2017 06:17:04 GMT (envelope-from cy@FreeBSD.org) Received: (from cy@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7S6H47Z077524; Mon, 28 Aug 2017 06:17:04 GMT (envelope-from cy@FreeBSD.org) Message-Id: <201708280617.v7S6H47Z077524@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: cy set sender to cy@FreeBSD.org using -f From: Cy Schubert Date: Mon, 28 Aug 2017 06:17:04 +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: r322963 - stable/11/kerberos5/libexec/kpasswdd X-SVN-Group: stable-11 X-SVN-Commit-Author: cy X-SVN-Commit-Paths: stable/11/kerberos5/libexec/kpasswdd X-SVN-Commit-Revision: 322963 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 28 Aug 2017 06:17:06 -0000 Author: cy Date: Mon Aug 28 06:17:04 2017 New Revision: 322963 URL: https://svnweb.freebsd.org/changeset/base/322963 Log: MFC r322749: Replace the include path using CURDIR with KRB5DIR. This is consistent with the rest of the Makefiles in kerberos5/. Modified: stable/11/kerberos5/libexec/kpasswdd/Makefile Directory Properties: stable/11/ (props changed) Modified: stable/11/kerberos5/libexec/kpasswdd/Makefile ============================================================================== --- stable/11/kerberos5/libexec/kpasswdd/Makefile Mon Aug 28 04:06:40 2017 (r322962) +++ stable/11/kerberos5/libexec/kpasswdd/Makefile Mon Aug 28 06:17:04 2017 (r322963) @@ -2,7 +2,7 @@ PROG= kpasswdd MAN= kpasswdd.8 -CFLAGS+=-I${KRB5DIR}/lib/roken -I${.CURDIR:H:H}/lib/libhdb ${LDAPCFLAGS} +CFLAGS+=-I${KRB5DIR}/lib/roken -I${KRB5DIR}/lib/libhdb ${LDAPCFLAGS} LIBADD= kadm5srv hdb krb5 roken vers asn1 DPADD= ${LDAPDPADD} LDADD= ${LDAPLDADD} From owner-svn-src-all@freebsd.org Mon Aug 28 07:50:55 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id AF7B7E0816A; Mon, 28 Aug 2017 07:50:55 +0000 (UTC) (envelope-from np@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (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 7EA616CE8F; Mon, 28 Aug 2017 07:50:55 +0000 (UTC) (envelope-from np@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v7S7osUs014186; Mon, 28 Aug 2017 07:50:54 GMT (envelope-from np@FreeBSD.org) Received: (from np@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7S7ostW014185; Mon, 28 Aug 2017 07:50:54 GMT (envelope-from np@FreeBSD.org) Message-Id: <201708280750.v7S7ostW014185@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: np set sender to np@FreeBSD.org using -f From: Navdeep Parhar Date: Mon, 28 Aug 2017 07:50:54 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r322964 - head/sys/dev/cxgbe X-SVN-Group: head X-SVN-Commit-Author: np X-SVN-Commit-Paths: head/sys/dev/cxgbe X-SVN-Commit-Revision: 322964 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 28 Aug 2017 07:50:55 -0000 Author: np Date: Mon Aug 28 07:50:54 2017 New Revision: 322964 URL: https://svnweb.freebsd.org/changeset/base/322964 Log: cxgbe(4): vi_mac_funcs should include the base Ethernet function. It is already used in the driver as if it does. MFC after: 3 days Sponsored by: Chelsio Communications Modified: head/sys/dev/cxgbe/t4_main.c Modified: head/sys/dev/cxgbe/t4_main.c ============================================================================== --- head/sys/dev/cxgbe/t4_main.c Mon Aug 28 06:17:04 2017 (r322963) +++ head/sys/dev/cxgbe/t4_main.c Mon Aug 28 07:50:54 2017 (r322964) @@ -467,8 +467,9 @@ TUNABLE_INT("hw.cxl.write_combine", &t5_write_combine) static int t4_num_vis = 1; TUNABLE_INT("hw.cxgbe.num_vis", &t4_num_vis); -/* Functions used by extra VIs to obtain unique MAC addresses for each VI. */ +/* Functions used by VIs to obtain unique MAC addresses for each VI. */ static int vi_mac_funcs[] = { + FW_VI_FUNC_ETH, FW_VI_FUNC_OFLD, FW_VI_FUNC_IWARP, FW_VI_FUNC_OPENISCSI, @@ -2146,6 +2147,7 @@ vcxgbe_attach(device_t dev) sc = pi->adapter; index = vi - pi->vi; + MPASS(index > 0); /* This function deals with _extra_ VIs only */ KASSERT(index < nitems(vi_mac_funcs), ("%s: VI %s doesn't have a MAC func", __func__, device_get_nameunit(dev))); From owner-svn-src-all@freebsd.org Mon Aug 28 09:35:18 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 8326BE09CC8; Mon, 28 Aug 2017 09:35:18 +0000 (UTC) (envelope-from ed@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (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 5269F70013; Mon, 28 Aug 2017 09:35:18 +0000 (UTC) (envelope-from ed@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v7S9ZH51058879; Mon, 28 Aug 2017 09:35:17 GMT (envelope-from ed@FreeBSD.org) Received: (from ed@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7S9ZH9a058878; Mon, 28 Aug 2017 09:35:17 GMT (envelope-from ed@FreeBSD.org) Message-Id: <201708280935.v7S9ZH9a058878@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ed set sender to ed@FreeBSD.org using -f From: Ed Schouten Date: Mon, 28 Aug 2017 09:35:17 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r322965 - head/sys/sys X-SVN-Group: head X-SVN-Commit-Author: ed X-SVN-Commit-Paths: head/sys/sys X-SVN-Commit-Revision: 322965 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 28 Aug 2017 09:35:18 -0000 Author: ed Date: Mon Aug 28 09:35:17 2017 New Revision: 322965 URL: https://svnweb.freebsd.org/changeset/base/322965 Log: Make _Static_assert() work with GCC in older C++ standards. GCC only activates C11 keywords in C mode, not C++ mode. This means that when targeting an older C++ standard, we cannot fall back to using _Static_assert(). In this case, do define _Static_assert() as a macro that uses a typedef'ed array. Discussed in: r322875 commit thread Reported by: Mark MIllard MFC after: 1 month Modified: head/sys/sys/cdefs.h Modified: head/sys/sys/cdefs.h ============================================================================== --- head/sys/sys/cdefs.h Mon Aug 28 07:50:54 2017 (r322964) +++ head/sys/sys/cdefs.h Mon Aug 28 09:35:17 2017 (r322965) @@ -294,7 +294,7 @@ #if (defined(__cplusplus) && __cplusplus >= 201103L) || \ __has_extension(cxx_static_assert) #define _Static_assert(x, y) static_assert(x, y) -#elif __GNUC_PREREQ__(4,6) +#elif __GNUC_PREREQ__(4,6) && !defined(__cplusplus) /* Nothing, gcc 4.6 and higher has _Static_assert built-in */ #elif defined(__COUNTER__) #define _Static_assert(x, y) __Static_assert(x, __COUNTER__) From owner-svn-src-all@freebsd.org Mon Aug 28 10:02:49 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 57B73E0A6D3; Mon, 28 Aug 2017 10:02:49 +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 mx1.freebsd.org (Postfix) with ESMTPS id 32CD571011; Mon, 28 Aug 2017 10:02:49 +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 v7SA2mbU071032; Mon, 28 Aug 2017 10:02:48 GMT (envelope-from ae@FreeBSD.org) Received: (from ae@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7SA2lXu071028; Mon, 28 Aug 2017 10:02:48 GMT (envelope-from ae@FreeBSD.org) Message-Id: <201708281002.v7SA2lXu071028@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ae set sender to ae@FreeBSD.org using -f From: "Andrey V. Elsukov" Date: Mon, 28 Aug 2017 10:02:47 +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: r322966 - stable/11/sys/netipsec X-SVN-Group: stable-11 X-SVN-Commit-Author: ae X-SVN-Commit-Paths: stable/11/sys/netipsec X-SVN-Commit-Revision: 322966 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 28 Aug 2017 10:02:49 -0000 Author: ae Date: Mon Aug 28 10:02:47 2017 New Revision: 322966 URL: https://svnweb.freebsd.org/changeset/base/322966 Log: MFC r322750: Fix the regression introduced in r275710. When a security policy should match TCP connection with specific ports, the SYN+ACK segment send by syncache_respond() is considered as forwarded packet, because at this moment TCP connection does not have PCB structure, and ip_output() is called without inpcb pointer. In this case SPIDX filled for SP lookup will not contain TCP ports and security policy will not be found. This can lead to unencrypted SYN+ACK on the wire. This patch restores the old behavior, when ports will not be filled only for forwarded packets. Reported by: Dewayne Geraghty MFC r322751: Remove stale comments. Modified: stable/11/sys/netipsec/ipsec.c stable/11/sys/netipsec/ipsec.h stable/11/sys/netipsec/ipsec6.h stable/11/sys/netipsec/ipsec_output.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/netipsec/ipsec.c ============================================================================== --- stable/11/sys/netipsec/ipsec.c Mon Aug 28 09:35:17 2017 (r322965) +++ stable/11/sys/netipsec/ipsec.c Mon Aug 28 10:02:47 2017 (r322966) @@ -563,7 +563,8 @@ ipsec4_setspidx_ipaddr(const struct mbuf *m, struct se } static struct secpolicy * -ipsec4_getpolicy(const struct mbuf *m, struct inpcb *inp, u_int dir) +ipsec4_getpolicy(const struct mbuf *m, struct inpcb *inp, u_int dir, + int needport) { struct secpolicyindex spidx; struct secpolicy *sp; @@ -572,8 +573,7 @@ ipsec4_getpolicy(const struct mbuf *m, struct inpcb *i if (sp == NULL && key_havesp(dir)) { /* Make an index to look for a policy. */ ipsec4_setspidx_ipaddr(m, &spidx); - /* Fill ports in spidx if we have inpcb. */ - ipsec4_get_ulp(m, &spidx, inp != NULL); + ipsec4_get_ulp(m, &spidx, needport); spidx.dir = dir; sp = key_allocsp(&spidx, dir); } @@ -586,12 +586,13 @@ ipsec4_getpolicy(const struct mbuf *m, struct inpcb *i * Check security policy for *OUTBOUND* IPv4 packet. */ struct secpolicy * -ipsec4_checkpolicy(const struct mbuf *m, struct inpcb *inp, int *error) +ipsec4_checkpolicy(const struct mbuf *m, struct inpcb *inp, int *error, + int needport) { struct secpolicy *sp; *error = 0; - sp = ipsec4_getpolicy(m, inp, IPSEC_DIR_OUTBOUND); + sp = ipsec4_getpolicy(m, inp, IPSEC_DIR_OUTBOUND, needport); if (sp != NULL) sp = ipsec_checkpolicy(sp, inp, error); if (sp == NULL) { @@ -623,7 +624,7 @@ ipsec4_in_reject(const struct mbuf *m, struct inpcb *i struct secpolicy *sp; int result; - sp = ipsec4_getpolicy(m, inp, IPSEC_DIR_INBOUND); + sp = ipsec4_getpolicy(m, inp, IPSEC_DIR_INBOUND, 0); result = ipsec_in_reject(sp, inp, m); key_freesp(&sp); if (result != 0) @@ -731,7 +732,8 @@ ipsec6_setspidx_ipaddr(const struct mbuf *m, struct se } static struct secpolicy * -ipsec6_getpolicy(const struct mbuf *m, struct inpcb *inp, u_int dir) +ipsec6_getpolicy(const struct mbuf *m, struct inpcb *inp, u_int dir, + int needport) { struct secpolicyindex spidx; struct secpolicy *sp; @@ -740,8 +742,7 @@ ipsec6_getpolicy(const struct mbuf *m, struct inpcb *i if (sp == NULL && key_havesp(dir)) { /* Make an index to look for a policy. */ ipsec6_setspidx_ipaddr(m, &spidx); - /* Fill ports in spidx if we have inpcb. */ - ipsec6_get_ulp(m, &spidx, inp != NULL); + ipsec6_get_ulp(m, &spidx, needport); spidx.dir = dir; sp = key_allocsp(&spidx, dir); } @@ -754,12 +755,13 @@ ipsec6_getpolicy(const struct mbuf *m, struct inpcb *i * Check security policy for *OUTBOUND* IPv6 packet. */ struct secpolicy * -ipsec6_checkpolicy(const struct mbuf *m, struct inpcb *inp, int *error) +ipsec6_checkpolicy(const struct mbuf *m, struct inpcb *inp, int *error, + int needport) { struct secpolicy *sp; *error = 0; - sp = ipsec6_getpolicy(m, inp, IPSEC_DIR_OUTBOUND); + sp = ipsec6_getpolicy(m, inp, IPSEC_DIR_OUTBOUND, needport); if (sp != NULL) sp = ipsec_checkpolicy(sp, inp, error); if (sp == NULL) { @@ -791,7 +793,7 @@ ipsec6_in_reject(const struct mbuf *m, struct inpcb *i struct secpolicy *sp; int result; - sp = ipsec6_getpolicy(m, inp, IPSEC_DIR_INBOUND); + sp = ipsec6_getpolicy(m, inp, IPSEC_DIR_INBOUND, 0); result = ipsec_in_reject(sp, inp, m); key_freesp(&sp); if (result) Modified: stable/11/sys/netipsec/ipsec.h ============================================================================== --- stable/11/sys/netipsec/ipsec.h Mon Aug 28 09:35:17 2017 (r322965) +++ stable/11/sys/netipsec/ipsec.h Mon Aug 28 10:02:47 2017 (r322966) @@ -320,7 +320,7 @@ int ipsec_if_input(struct mbuf *, struct secasvar *, u struct ipsecrequest *ipsec_newisr(void); void ipsec_delisr(struct ipsecrequest *); struct secpolicy *ipsec4_checkpolicy(const struct mbuf *, struct inpcb *, - int *); + int *, int); u_int ipsec_get_reqlevel(struct secpolicy *, u_int); Modified: stable/11/sys/netipsec/ipsec6.h ============================================================================== --- stable/11/sys/netipsec/ipsec6.h Mon Aug 28 09:35:17 2017 (r322965) +++ stable/11/sys/netipsec/ipsec6.h Mon Aug 28 10:02:47 2017 (r322966) @@ -60,7 +60,7 @@ VNET_DECLARE(int, ip6_ipsec_ecn); struct inpcb; struct secpolicy *ipsec6_checkpolicy(const struct mbuf *, - struct inpcb *, int *); + struct inpcb *, int *, int); void ipsec6_setsockaddrs(const struct mbuf *, union sockaddr_union *, union sockaddr_union *); Modified: stable/11/sys/netipsec/ipsec_output.c ============================================================================== --- stable/11/sys/netipsec/ipsec_output.c Mon Aug 28 09:35:17 2017 (r322965) +++ stable/11/sys/netipsec/ipsec_output.c Mon Aug 28 10:02:47 2017 (r322966) @@ -297,7 +297,7 @@ ipsec4_common_output(struct mbuf *m, struct inpcb *inp int error; /* Lookup for the corresponding outbound security policy */ - sp = ipsec4_checkpolicy(m, inp, &error); + sp = ipsec4_checkpolicy(m, inp, &error, !forwarding); if (sp == NULL) { if (error == -EINVAL) { /* Discarded by policy. */ @@ -599,7 +599,7 @@ ipsec6_common_output(struct mbuf *m, struct inpcb *inp int error; /* Lookup for the corresponding outbound security policy */ - sp = ipsec6_checkpolicy(m, inp, &error); + sp = ipsec6_checkpolicy(m, inp, &error, !forwarding); if (sp == NULL) { if (error == -EINVAL) { /* Discarded by policy. */ From owner-svn-src-all@freebsd.org Mon Aug 28 11:41:19 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 66862E0BB95; Mon, 28 Aug 2017 11:41:19 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (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 33B57737B4; Mon, 28 Aug 2017 11:41:19 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v7SBfI2o011159; Mon, 28 Aug 2017 11:41:18 GMT (envelope-from tuexen@FreeBSD.org) Received: (from tuexen@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7SBfItt011158; Mon, 28 Aug 2017 11:41:18 GMT (envelope-from tuexen@FreeBSD.org) Message-Id: <201708281141.v7SBfItt011158@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tuexen set sender to tuexen@FreeBSD.org using -f From: Michael Tuexen Date: Mon, 28 Aug 2017 11:41:18 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r322967 - head/sys/netinet X-SVN-Group: head X-SVN-Commit-Author: tuexen X-SVN-Commit-Paths: head/sys/netinet X-SVN-Commit-Revision: 322967 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 28 Aug 2017 11:41:19 -0000 Author: tuexen Date: Mon Aug 28 11:41:18 2017 New Revision: 322967 URL: https://svnweb.freebsd.org/changeset/base/322967 Log: Fix blackhole detection. There were two bugs related to the blackhole detection: * The smalles size was tried more than two times. * The restored MSS was not the original one, but the second candidate. MFC after: 1 week Sponsored by: Netflix, Inc. Modified: head/sys/netinet/tcp_timer.c Modified: head/sys/netinet/tcp_timer.c ============================================================================== --- head/sys/netinet/tcp_timer.c Mon Aug 28 10:02:47 2017 (r322966) +++ head/sys/netinet/tcp_timer.c Mon Aug 28 11:41:18 2017 (r322967) @@ -726,19 +726,21 @@ tcp_timer_rexmt(void * xtp) */ if (((tp->t_flags2 & (TF2_PLPMTU_PMTUD|TF2_PLPMTU_MAXSEGSNT)) == (TF2_PLPMTU_PMTUD|TF2_PLPMTU_MAXSEGSNT)) && - (tp->t_rxtshift >= 2 && tp->t_rxtshift % 2 == 0)) { + (tp->t_rxtshift >= 2 && tp->t_rxtshift < 6 && + tp->t_rxtshift % 2 == 0)) { /* * Enter Path MTU Black-hole Detection mechanism: * - Disable Path MTU Discovery (IP "DF" bit). * - Reduce MTU to lower value than what we * negotiated with peer. */ - /* Record that we may have found a black hole. */ - tp->t_flags2 |= TF2_PLPMTU_BLACKHOLE; + if ((tp->t_flags2 & TF2_PLPMTU_BLACKHOLE) == 0) { + /* Record that we may have found a black hole. */ + tp->t_flags2 |= TF2_PLPMTU_BLACKHOLE; + /* Keep track of previous MSS. */ + tp->t_pmtud_saved_maxseg = tp->t_maxseg; + } - /* Keep track of previous MSS. */ - tp->t_pmtud_saved_maxseg = tp->t_maxseg; - /* * Reduce the MSS to blackhole value or to the default * in an attempt to retransmit. @@ -796,7 +798,7 @@ tcp_timer_rexmt(void * xtp) * stage (1448, 1188, 524) 2 chances to recover. */ if ((tp->t_flags2 & TF2_PLPMTU_BLACKHOLE) && - (tp->t_rxtshift > 6)) { + (tp->t_rxtshift >= 6)) { tp->t_flags2 |= TF2_PLPMTU_PMTUD; tp->t_flags2 &= ~TF2_PLPMTU_BLACKHOLE; tp->t_maxseg = tp->t_pmtud_saved_maxseg; From owner-svn-src-all@freebsd.org Mon Aug 28 14:49:27 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id C3E41E0E926; Mon, 28 Aug 2017 14:49:27 +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 mx1.freebsd.org (Postfix) with ESMTPS id 93B717D95B; Mon, 28 Aug 2017 14:49:27 +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 v7SEnQi2085753; Mon, 28 Aug 2017 14:49:26 GMT (envelope-from gjb@FreeBSD.org) Received: (from gjb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7SEnQDm085752; Mon, 28 Aug 2017 14:49:26 GMT (envelope-from gjb@FreeBSD.org) Message-Id: <201708281449.v7SEnQDm085752@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: gjb set sender to gjb@FreeBSD.org using -f From: Glen Barber Date: Mon, 28 Aug 2017 14:49:26 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r322968 - head/release/tools X-SVN-Group: head X-SVN-Commit-Author: gjb X-SVN-Commit-Paths: head/release/tools X-SVN-Commit-Revision: 322968 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 28 Aug 2017 14:49:27 -0000 Author: gjb Date: Mon Aug 28 14:49:26 2017 New Revision: 322968 URL: https://svnweb.freebsd.org/changeset/base/322968 Log: Increase the Amazon EC2 AMI image size from 2GB to 3GB to prevent image build failures due to a full md(4)-backed filesystem. Sponsored by: The FreeBSD Foundation Modified: head/release/tools/ec2.conf Modified: head/release/tools/ec2.conf ============================================================================== --- head/release/tools/ec2.conf Mon Aug 28 11:41:18 2017 (r322967) +++ head/release/tools/ec2.conf Mon Aug 28 14:49:26 2017 (r322968) @@ -11,12 +11,12 @@ export VM_EXTRA_PACKAGES="ec2-scripts firstboot-freebs # Set to a list of third-party software to enable in rc.conf(5). export VM_RC_LIST="ec2_configinit ec2_fetchkey ec2_ephemeralswap ec2_loghostkey firstboot_freebsd_update firstboot_pkgs" -# Build with a 2 GB UFS partition; the growfs rc.d script will expand +# Build with a 3 GB UFS partition; the growfs rc.d script will expand # the partition to fill the root disk after the EC2 instance is launched. # Note that if this is set to G, we will end up with an GB disk # image since VMSIZE is the size of the UFS partition, not the disk which # it resides within. -export VMSIZE=2048M +export VMSIZE=3072M # No swap space; the ec2_ephemeralswap rc.d script will allocate swap # space on EC2 ephemeral disks. (If they exist -- the T2 low-cost instances From owner-svn-src-all@freebsd.org Mon Aug 28 15:54:09 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 68213E0F6C4; Mon, 28 Aug 2017 15:54:09 +0000 (UTC) (envelope-from sobomax@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (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 40E3D7F637; Mon, 28 Aug 2017 15:54:09 +0000 (UTC) (envelope-from sobomax@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v7SFs8T5014274; Mon, 28 Aug 2017 15:54:08 GMT (envelope-from sobomax@FreeBSD.org) Received: (from sobomax@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7SFs8fr014268; Mon, 28 Aug 2017 15:54:08 GMT (envelope-from sobomax@FreeBSD.org) Message-Id: <201708281554.v7SFs8fr014268@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sobomax set sender to sobomax@FreeBSD.org using -f From: Maxim Sobolev Date: Mon, 28 Aug 2017 15:54:08 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r322969 - in head: sbin/mdconfig sys/dev/md sys/sys X-SVN-Group: head X-SVN-Commit-Author: sobomax X-SVN-Commit-Paths: in head: sbin/mdconfig sys/dev/md sys/sys X-SVN-Commit-Revision: 322969 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 28 Aug 2017 15:54:09 -0000 Author: sobomax Date: Mon Aug 28 15:54:07 2017 New Revision: 322969 URL: https://svnweb.freebsd.org/changeset/base/322969 Log: Add ability to label md(4) devices. This feature comes from the fact that we rely memory-backed md(4) in our build process heavily. However, if the build goes haywire the allocated resources (i.e. swap and memory-backed md(4)'s) need to be purged. It is extremely useful to have ability to attach arbitrary labels to each of the virtual disks so that they can be identified and GC'ed if neecessary. MFC after: 4 weeks Differential Revision: https://reviews.freebsd.org/D10457 Modified: head/sbin/mdconfig/mdconfig.8 head/sbin/mdconfig/mdconfig.c head/sys/dev/md/md.c head/sys/sys/mdioctl.h Modified: head/sbin/mdconfig/mdconfig.8 ============================================================================== --- head/sbin/mdconfig/mdconfig.8 Mon Aug 28 14:49:26 2017 (r322968) +++ head/sbin/mdconfig/mdconfig.8 Mon Aug 28 15:54:07 2017 (r322969) @@ -37,7 +37,7 @@ .\" .\" $FreeBSD$ .\" -.Dd October 10, 2015 +.Dd August 28, 2017 .Dt MDCONFIG 8 .Os .Sh NAME @@ -55,6 +55,7 @@ .Op Fl u Ar unit .Op Fl x Ar sectors/track .Op Fl y Ar heads/cylinder +.Op Fl L Ar label .Nm .Fl d .Fl u Ar unit @@ -189,6 +190,12 @@ and options can be used to specify a synthetic geometry. This is useful for constructing bootable images for later download to other devices. +.It Fl L Ar label +Associate a label (arbitrary string) with the new memory disk. +The label can then be inspected with +.Bd -literal -offset indent +.Nm Fl l v +.Ed .It Fl o Oo Cm no Oc Ns Ar option Set or reset options. .Bl -tag -width indent Modified: head/sbin/mdconfig/mdconfig.c ============================================================================== --- head/sbin/mdconfig/mdconfig.c Mon Aug 28 14:49:26 2017 (r322968) +++ head/sbin/mdconfig/mdconfig.c Mon Aug 28 15:54:07 2017 (r322969) @@ -79,7 +79,7 @@ usage(void) fprintf(stderr, "usage: mdconfig -a -t type [-n] [-o [no]option] ... [-f file]\n" -" [-s size] [-S sectorsize] [-u unit]\n" +" [-s size] [-S sectorsize] [-u unit] [-L label]\n" " [-x sectors/track] [-y heads/cylinder]\n" " mdconfig -d -u unit [-o [no]force]\n" " mdconfig -r -u unit -s size [-o [no]force]\n" @@ -102,15 +102,17 @@ main(int argc, char **argv) bzero(&mdio, sizeof(mdio)); mdio.md_file = malloc(PATH_MAX); - if (mdio.md_file == NULL) + mdio.md_label = malloc(PATH_MAX); + if (mdio.md_file == NULL || mdio.md_label == NULL) err(1, "could not allocate memory"); vflag = 0; bzero(mdio.md_file, PATH_MAX); + bzero(mdio.md_label, PATH_MAX); if (argc == 1) usage(); - while ((ch = getopt(argc, argv, "ab:df:lno:rs:S:t:u:vx:y:")) != -1) { + while ((ch = getopt(argc, argv, "ab:df:lno:rs:S:t:u:vx:y:L:")) != -1) { switch (ch) { case 'a': if (action != UNSET && action != ATTACH) @@ -243,6 +245,9 @@ main(int argc, char **argv) case 'y': mdio.md_fwheads = strtoul(optarg, &p, 0); break; + case 'L': + strlcpy(mdio.md_label, optarg, PATH_MAX); + break; default: usage(); } @@ -422,7 +427,8 @@ md_list(const char *units, int opt, const char *fflag) struct gclass *gcl; void *sq; int retcode, ffound, ufound; - char *type, *file, *length; + char *length; + const char *type, *file, *label; type = file = length = NULL; @@ -477,10 +483,14 @@ md_list(const char *units, int opt, const char *fflag) printf("\t%s\t", type); if (length != NULL) md_prthumanval(length); - if (file != NULL) { - printf("\t%s", file); - file = NULL; - } + if (file == NULL) + file = "-"; + printf("\t%s", file); + file = NULL; + label = geom_config_get(gc, "label"); + if (label == NULL) + label = ""; + printf("\t%s", label); } opt |= OPT_DONE; if ((opt & OPT_LIST) && !(opt & OPT_VERBOSE)) Modified: head/sys/dev/md/md.c ============================================================================== --- head/sys/dev/md/md.c Mon Aug 28 14:49:26 2017 (r322968) +++ head/sys/dev/md/md.c Mon Aug 28 15:54:07 2017 (r322969) @@ -226,6 +226,7 @@ struct md_s { /* MD_VNODE related fields */ struct vnode *vnode; char file[PATH_MAX]; + char label[PATH_MAX]; struct ucred *cred; /* MD_SWAP related fields */ @@ -1645,6 +1646,11 @@ xmdctlioctl(struct cdev *dev, u_long cmd, caddr_t addr } if (sc == NULL) return (error); + if (mdio->md_label != NULL) + error = copyinstr(mdio->md_label, sc->label, + sizeof(sc->label), NULL); + if (error != 0) + goto err_after_new; if (mdio->md_options & MD_AUTOUNIT) mdio->md_unit = sc->unit; sc->mediasize = mdio->md_mediasize; @@ -1676,6 +1682,7 @@ xmdctlioctl(struct cdev *dev, u_long cmd, caddr_t addr error = mdcreate_null(sc, mdio, td); break; } +err_after_new: if (error != 0) { mddestroy(sc, td); return (error); @@ -1721,6 +1728,11 @@ xmdctlioctl(struct cdev *dev, u_long cmd, caddr_t addr mdio->md_options = sc->flags; mdio->md_mediasize = sc->mediasize; mdio->md_sectorsize = sc->sectorsize; + error = 0; + if (mdio->md_label != NULL) { + error = copyout(sc->label, mdio->md_label, + strlen(sc->label) + 1); + } if (sc->type == MD_VNODE || (sc->type == MD_PRELOAD && mdio->md_file != NULL)) error = copyout(sc->file, mdio->md_file, @@ -1873,6 +1885,7 @@ g_md_dumpconf(struct sbuf *sb, const char *indent, str if ((mp->type == MD_VNODE && mp->vnode != NULL) || (mp->type == MD_PRELOAD && mp->file[0] != '\0')) sbuf_printf(sb, " file %s", mp->file); + sbuf_printf(sb, " label %s", mp->label); } else { sbuf_printf(sb, "%s%d\n", indent, mp->unit); @@ -1897,6 +1910,9 @@ g_md_dumpconf(struct sbuf *sb, const char *indent, str g_conf_printf_escaped(sb, "%s", mp->file); sbuf_printf(sb, "\n"); } + sbuf_printf(sb, "%s\n"); } } } Modified: head/sys/sys/mdioctl.h ============================================================================== --- head/sys/sys/mdioctl.h Mon Aug 28 14:49:26 2017 (r322968) +++ head/sys/sys/mdioctl.h Mon Aug 28 15:54:07 2017 (r322969) @@ -49,7 +49,7 @@ enum md_types {MD_MALLOC, MD_PRELOAD, MD_VNODE, MD_SWA * Ioctl definitions for memory disk pseudo-device. */ -#define MDNPAD 97 +#define MDNPAD 96 struct md_ioctl { unsigned md_version; /* Structure layout version */ unsigned md_unit; /* unit number */ @@ -61,6 +61,7 @@ struct md_ioctl { u_int64_t md_base; /* base address */ int md_fwheads; /* firmware heads */ int md_fwsectors; /* firmware sectors */ + char *md_label; /* label of the device */ int md_pad[MDNPAD]; /* padding for future ideas */ }; From owner-svn-src-all@freebsd.org Mon Aug 28 16:22:51 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 33638E0FB4B; Mon, 28 Aug 2017 16:22:51 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from mail.baldwin.cx (bigwig.baldwin.cx [IPv6:2001:470:1f11:75::1]) (using TLSv1 with cipher DHE-RSA-CAMELLIA256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 10F3B8005D; Mon, 28 Aug 2017 16:22:51 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from ralph.baldwin.cx (c-73-231-226-104.hsd1.ca.comcast.net [73.231.226.104]) by mail.baldwin.cx (Postfix) with ESMTPSA id 777DF10AF3A; Mon, 28 Aug 2017 12:22:49 -0400 (EDT) From: John Baldwin To: Maxim Sobolev Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r322969 - in head: sbin/mdconfig sys/dev/md sys/sys Date: Mon, 28 Aug 2017 09:19:15 -0700 Message-ID: <7384187.efIiCynxO3@ralph.baldwin.cx> User-Agent: KMail/4.14.10 (FreeBSD/11.1-STABLE; KDE/4.14.30; amd64; ; ) In-Reply-To: <201708281554.v7SFs8fr014268@repo.freebsd.org> References: <201708281554.v7SFs8fr014268@repo.freebsd.org> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.4.3 (mail.baldwin.cx); Mon, 28 Aug 2017 12:22:49 -0400 (EDT) X-Virus-Scanned: clamav-milter 0.99.2 at mail.baldwin.cx X-Virus-Status: Clean X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 28 Aug 2017 16:22:51 -0000 On Monday, August 28, 2017 03:54:08 PM Maxim Sobolev wrote: > Author: sobomax > Date: Mon Aug 28 15:54:07 2017 > New Revision: 322969 > URL: https://svnweb.freebsd.org/changeset/base/322969 > > Log: > Add ability to label md(4) devices. > > This feature comes from the fact that we rely memory-backed md(4) > in our build process heavily. However, if the build goes haywire > the allocated resources (i.e. swap and memory-backed md(4)'s) need > to be purged. It is extremely useful to have ability to attach > arbitrary labels to each of the virtual disks so that they can > be identified and GC'ed if neecessary. > > MFC after: 4 weeks > Differential Revision: https://reviews.freebsd.org/D10457 > > Modified: > head/sbin/mdconfig/mdconfig.8 > head/sbin/mdconfig/mdconfig.c > head/sys/dev/md/md.c > head/sys/sys/mdioctl.h > > Modified: head/sys/sys/mdioctl.h > ============================================================================== > --- head/sys/sys/mdioctl.h Mon Aug 28 14:49:26 2017 (r322968) > +++ head/sys/sys/mdioctl.h Mon Aug 28 15:54:07 2017 (r322969) > @@ -49,7 +49,7 @@ enum md_types {MD_MALLOC, MD_PRELOAD, MD_VNODE, MD_SWA > * Ioctl definitions for memory disk pseudo-device. > */ > > -#define MDNPAD 97 > +#define MDNPAD 96 > struct md_ioctl { > unsigned md_version; /* Structure layout version */ > unsigned md_unit; /* unit number */ > @@ -61,6 +61,7 @@ struct md_ioctl { > u_int64_t md_base; /* base address */ > int md_fwheads; /* firmware heads */ > int md_fwsectors; /* firmware sectors */ > + char *md_label; /* label of the device */ > int md_pad[MDNPAD]; /* padding for future ideas */ > }; This isn't correct on 64-bit platforms. MDNPAD needs to be 95 on those platforms. It would be really neat if one could use the label more pervasively. For example, it would be nice to do something like this: # mdconfig -a -t malloc -s 16M -L foo # newfs /dev/md/foo # mdconfig -d -L foo This would mean that labelled memory disks would not create /dev/mdX entries, but would instead create /dev/md/