From owner-svn-src-user@FreeBSD.ORG Tue Feb 26 21:17:43 2013 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 48B80B00; Tue, 26 Feb 2013 21:17:43 +0000 (UTC) (envelope-from attilio@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 2C3FE129; Tue, 26 Feb 2013 21:17:43 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id r1QLHhIb066720; Tue, 26 Feb 2013 21:17:43 GMT (envelope-from attilio@svn.freebsd.org) Received: (from attilio@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id r1QLHcA9066690; Tue, 26 Feb 2013 21:17:38 GMT (envelope-from attilio@svn.freebsd.org) Message-Id: <201302262117.r1QLHcA9066690@svn.freebsd.org> From: Attilio Rao Date: Tue, 26 Feb 2013 21:17:38 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org Subject: svn commit: r247354 - in user/attilio/vmc-playground: lib/libkiconv lib/libpmc sbin/hastctl share/man/man4 sys/arm/arm sys/arm/include sys/cddl/contrib/opensolaris/uts/common/fs/zfs sys/dev/cpufreq... X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 26 Feb 2013 21:17:43 -0000 Author: attilio Date: Tue Feb 26 21:17:38 2013 New Revision: 247354 URL: http://svnweb.freebsd.org/changeset/base/247354 Log: Merge from vmcontention Modified: user/attilio/vmc-playground/lib/libkiconv/kiconv.3 user/attilio/vmc-playground/lib/libpmc/pmc.soft.3 user/attilio/vmc-playground/sbin/hastctl/hastctl.c user/attilio/vmc-playground/share/man/man4/cxgbe.4 user/attilio/vmc-playground/sys/arm/arm/mp_machdep.c user/attilio/vmc-playground/sys/arm/arm/vfp.c user/attilio/vmc-playground/sys/arm/include/vfp.h user/attilio/vmc-playground/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev.c user/attilio/vmc-playground/sys/dev/cpufreq/ichss.c user/attilio/vmc-playground/sys/dev/cxgbe/common/common.h user/attilio/vmc-playground/sys/dev/cxgbe/t4_main.c user/attilio/vmc-playground/sys/dev/hwpmc/hwpmc_soft.c user/attilio/vmc-playground/sys/dev/random/randomdev_soft.c user/attilio/vmc-playground/sys/kern/kern_clock.c user/attilio/vmc-playground/sys/kern/kern_clocksource.c user/attilio/vmc-playground/sys/sys/time.h user/attilio/vmc-playground/sys/vm/vm_object.c user/attilio/vmc-playground/sys/vm/vnode_pager.c user/attilio/vmc-playground/usr.bin/truss/main.c user/attilio/vmc-playground/usr.bin/truss/syscalls.c user/attilio/vmc-playground/usr.bin/truss/truss.h user/attilio/vmc-playground/usr.sbin/bhyve/pci_virtio_block.c Directory Properties: user/attilio/vmc-playground/ (props changed) user/attilio/vmc-playground/sbin/ (props changed) user/attilio/vmc-playground/share/man/man4/ (props changed) user/attilio/vmc-playground/sys/ (props changed) user/attilio/vmc-playground/sys/cddl/contrib/opensolaris/ (props changed) user/attilio/vmc-playground/usr.sbin/bhyve/ (props changed) Modified: user/attilio/vmc-playground/lib/libkiconv/kiconv.3 ============================================================================== --- user/attilio/vmc-playground/lib/libkiconv/kiconv.3 Tue Feb 26 21:16:10 2013 (r247353) +++ user/attilio/vmc-playground/lib/libkiconv/kiconv.3 Tue Feb 26 21:17:38 2013 (r247354) @@ -126,5 +126,4 @@ not using .Sh SEE ALSO .Xr iconv 3 , .Xr tolower 3 , -.Xr toupper 3 , -.Xr iconv 9 +.Xr toupper 3 Modified: user/attilio/vmc-playground/lib/libpmc/pmc.soft.3 ============================================================================== --- user/attilio/vmc-playground/lib/libpmc/pmc.soft.3 Tue Feb 26 21:16:10 2013 (r247353) +++ user/attilio/vmc-playground/lib/libpmc/pmc.soft.3 Tue Feb 26 21:17:38 2013 (r247354) @@ -23,7 +23,7 @@ .\" .\" $FreeBSD$ .\" -.Dd March 28, 2012 +.Dd February 26, 2013 .Dt PMC.SOFT 3 .Os .Sh NAME @@ -61,6 +61,8 @@ The event specifiers supported by softwa Hard clock ticks. .It Li CLOCK.STAT Stat clock ticks. +.It Li CLOCK.PROF +Profiling clock ticks. .It Li LOCK.FAILED Lock acquisition failed. .It Li PAGE_FAULT.ALL Modified: user/attilio/vmc-playground/sbin/hastctl/hastctl.c ============================================================================== --- user/attilio/vmc-playground/sbin/hastctl/hastctl.c Tue Feb 26 21:16:10 2013 (r247353) +++ user/attilio/vmc-playground/sbin/hastctl/hastctl.c Tue Feb 26 21:17:38 2013 (r247354) @@ -342,15 +342,15 @@ control_status(struct nv *nv) (intmax_t)nv_get_uint64(nv, "dirty%u", ii)); printf(" statistics:\n"); printf(" reads: %ju\n", - (uint64_t)nv_get_uint64(nv, "stat_read%u", ii)); + (uintmax_t)nv_get_uint64(nv, "stat_read%u", ii)); printf(" writes: %ju\n", - (uint64_t)nv_get_uint64(nv, "stat_write%u", ii)); + (uintmax_t)nv_get_uint64(nv, "stat_write%u", ii)); printf(" deletes: %ju\n", - (uint64_t)nv_get_uint64(nv, "stat_delete%u", ii)); + (uintmax_t)nv_get_uint64(nv, "stat_delete%u", ii)); printf(" flushes: %ju\n", - (uint64_t)nv_get_uint64(nv, "stat_flush%u", ii)); + (uintmax_t)nv_get_uint64(nv, "stat_flush%u", ii)); printf(" activemap updates: %ju\n", - (uint64_t)nv_get_uint64(nv, "stat_activemap_update%u", ii)); + (uintmax_t)nv_get_uint64(nv, "stat_activemap_update%u", ii)); printf(" local errors: " "read: %ju, write: %ju, delete: %ju, flush: %ju\n", (uintmax_t)nv_get_uint64(nv, "stat_read_error%u", ii), Modified: user/attilio/vmc-playground/share/man/man4/cxgbe.4 ============================================================================== --- user/attilio/vmc-playground/share/man/man4/cxgbe.4 Tue Feb 26 21:16:10 2013 (r247353) +++ user/attilio/vmc-playground/share/man/man4/cxgbe.4 Tue Feb 26 21:17:38 2013 (r247354) @@ -178,6 +178,15 @@ Bit 0 represents INTx (line interrupts), The default is 7 (all allowed). The driver will select the best possible type out of the allowed types by itself. +.It Va hw.cxgbe.fw_install +0 prohibits the driver from installing a firmware on the card. +1 allows the driver to install a new firmware if internal driver +heuristics indicate that the new firmware is preferable to the one +already on the card. +2 instructs the driver to always install the new firmware on the card as +long as it is compatible with the driver and is a different version than +the one already on the card. +The default is 1. .It Va hw.cxgbe.config_file Select a pre-packaged device configuration file. A configuration file contains a recipe for partitioning and configuring the Modified: user/attilio/vmc-playground/sys/arm/arm/mp_machdep.c ============================================================================== --- user/attilio/vmc-playground/sys/arm/arm/mp_machdep.c Tue Feb 26 21:16:10 2013 (r247353) +++ user/attilio/vmc-playground/sys/arm/arm/mp_machdep.c Tue Feb 26 21:17:38 2013 (r247354) @@ -49,6 +49,9 @@ __FBSDID("$FreeBSD$"); #include #include #include +#ifdef ARM_VFP_SUPPORT +#include +#endif #include "opt_smp.h" @@ -181,6 +184,11 @@ init_secondary(int cpu) KASSERT(PCPU_GET(idlethread) != NULL, ("no idle thread")); pc->pc_curthread = pc->pc_idlethread; pc->pc_curpcb = pc->pc_idlethread->td_pcb; +#ifdef ARM_VFP_SUPPORT + pc->pc_cpu = cpu; + + vfp_init(); +#endif mtx_lock_spin(&ap_boot_mtx); Modified: user/attilio/vmc-playground/sys/arm/arm/vfp.c ============================================================================== --- user/attilio/vmc-playground/sys/arm/arm/vfp.c Tue Feb 26 21:16:10 2013 (r247353) +++ user/attilio/vmc-playground/sys/arm/arm/vfp.c Tue Feb 26 21:17:38 2013 (r247354) @@ -43,7 +43,6 @@ unsigned int get_coprocessorACR(void); int vfp_bounce(u_int, u_int, struct trapframe *, int); void vfp_discard(void); void vfp_enable(void); -void vfp_init(void); void vfp_restore(struct vfp_state *); void vfp_store(struct vfp_state *); void set_coprocessorACR(u_int); @@ -74,8 +73,8 @@ void set_coprocessorACR(u_int val) { __asm __volatile("mcr p15, 0, %0, c1, c0, 2\n\t" - "isb\n\t" : : "r" (val) : "cc"); + isb(); } @@ -140,7 +139,7 @@ vfp_bounce(u_int addr, u_int insn, struc #ifdef SMP /* don't save if newer registers are on another processor */ if (vfptd /* && (vfptd == curthread) */ && - (vfptd->td_pcb->pcb_vfpcpu == PCPU_GET(vfpcpu)) + (vfptd->td_pcb->pcb_vfpcpu == PCPU_GET(cpu))) #else /* someone did not save their registers, */ if (vfptd /* && (vfptd == curthread) */) @@ -168,7 +167,7 @@ vfp_bounce(u_int addr, u_int insn, struc */ vfp_restore(&curpcb->pcb_vfpstate); #ifdef SMP - curpcb->pcb_cpu = PCPU_GET(cpu); + curpcb->pcb_vfpcpu = PCPU_GET(cpu); #endif PCPU_SET(vfpcthread, PCPU_GET(curthread)); return 0; Modified: user/attilio/vmc-playground/sys/arm/include/vfp.h ============================================================================== --- user/attilio/vmc-playground/sys/arm/include/vfp.h Tue Feb 26 21:16:10 2013 (r247353) +++ user/attilio/vmc-playground/sys/arm/include/vfp.h Tue Feb 26 21:17:38 2013 (r247354) @@ -124,5 +124,6 @@ #define COPROC10 (0x3 << 20) #define COPROC11 (0x3 << 22) +void vfp_init(void); #endif Modified: user/attilio/vmc-playground/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev.c ============================================================================== --- user/attilio/vmc-playground/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev.c Tue Feb 26 21:16:10 2013 (r247353) +++ user/attilio/vmc-playground/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev.c Tue Feb 26 21:17:38 2013 (r247354) @@ -23,6 +23,7 @@ * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. * Copyright 2011 Nexenta Systems, Inc. All rights reserved. * Copyright (c) 2012 by Delphix. All rights reserved. + * Copyright 2013 Martin Matuska . All rights reserved. */ #include @@ -3205,7 +3206,10 @@ vdev_deadman(vdev_t *vd) fio->io_timestamp, delta, vq->vq_io_complete_ts); fm_panic("I/O to pool '%s' appears to be " - "hung.", spa_name(spa)); + "hung on vdev guid %llu at '%s'.", + spa_name(spa), + (long long unsigned int) vd->vdev_guid, + vd->vdev_path); } } mutex_exit(&vq->vq_lock); Modified: user/attilio/vmc-playground/sys/dev/cpufreq/ichss.c ============================================================================== --- user/attilio/vmc-playground/sys/dev/cpufreq/ichss.c Tue Feb 26 21:16:10 2013 (r247353) +++ user/attilio/vmc-playground/sys/dev/cpufreq/ichss.c Tue Feb 26 21:17:38 2013 (r247354) @@ -67,7 +67,7 @@ struct ichss_softc { #define PCI_DEV_82801BA 0x244c /* ICH2M */ #define PCI_DEV_82801CA 0x248c /* ICH3M */ #define PCI_DEV_82801DB 0x24cc /* ICH4M */ -#define PCI_DEV_82815BA 0x1130 /* Unsupported/buggy part */ +#define PCI_DEV_82815_MC 0x1130 /* Unsupported/buggy part */ /* PCI config registers for finding PMBASE and enabling SpeedStep. */ #define ICHSS_PMBASE_OFFSET 0x40 @@ -155,9 +155,6 @@ ichss_identify(driver_t *driver, device_ * E.g. see Section 6.1 "PCI Devices and Functions" and table 6.1 of * Intel(r) 82801BA I/O Controller Hub 2 (ICH2) and Intel(r) 82801BAM * I/O Controller Hub 2 Mobile (ICH2-M). - * - * TODO: add a quirk to disable if we see the 82815_MC along - * with the 82801BA and revision < 5. */ ich_device = pci_find_bsf(0, 0x1f, 0); if (ich_device == NULL || @@ -167,6 +164,22 @@ ichss_identify(driver_t *driver, device_ pci_get_device(ich_device) != PCI_DEV_82801DB)) return; + /* + * Certain systems with ICH2 and an Intel 82815_MC host bridge + * where the host bridge's revision is < 5 lockup if SpeedStep + * is used. + */ + if (pci_get_device(ich_device) == PCI_DEV_82801BA) { + device_t hostb; + + hostb = pci_find_bsf(0, 0, 0); + if (hostb != NULL && + pci_get_vendor(hostb) == PCI_VENDOR_INTEL && + pci_get_device(hostb) == PCI_DEV_82815_MC && + pci_get_revid(hostb) < 5) + return; + } + /* Find the PMBASE register from our PCI config header. */ pmbase = pci_read_config(ich_device, ICHSS_PMBASE_OFFSET, sizeof(pmbase)); Modified: user/attilio/vmc-playground/sys/dev/cxgbe/common/common.h ============================================================================== --- user/attilio/vmc-playground/sys/dev/cxgbe/common/common.h Tue Feb 26 21:16:10 2013 (r247353) +++ user/attilio/vmc-playground/sys/dev/cxgbe/common/common.h Tue Feb 26 21:17:38 2013 (r247354) @@ -68,6 +68,11 @@ enum { #define FW_VERSION_MICRO 4 #define FW_VERSION_BUILD 0 +#define FW_VERSION (V_FW_HDR_FW_VER_MAJOR(FW_VERSION_MAJOR) | \ + V_FW_HDR_FW_VER_MINOR(FW_VERSION_MINOR) | \ + V_FW_HDR_FW_VER_MICRO(FW_VERSION_MICRO) | \ + V_FW_HDR_FW_VER_BUILD(FW_VERSION_BUILD)) + struct port_stats { u64 tx_octets; /* total # of octets in good frames */ u64 tx_frames; /* all good frames */ Modified: user/attilio/vmc-playground/sys/dev/cxgbe/t4_main.c ============================================================================== --- user/attilio/vmc-playground/sys/dev/cxgbe/t4_main.c Tue Feb 26 21:16:10 2013 (r247353) +++ user/attilio/vmc-playground/sys/dev/cxgbe/t4_main.c Tue Feb 26 21:17:38 2013 (r247354) @@ -213,6 +213,13 @@ static char t4_cfg_file[32] = "default"; TUNABLE_STR("hw.cxgbe.config_file", t4_cfg_file, sizeof(t4_cfg_file)); /* + * Firmware auto-install by driver during attach (0, 1, 2 = prohibited, allowed, + * encouraged respectively). + */ +static unsigned int t4_fw_install = 1; +TUNABLE_INT("hw.cxgbe.fw_install", &t4_fw_install); + +/* * ASIC features that will be used. Disable the ones you don't want so that the * chip resources aren't wasted on features that will not be used. */ @@ -1503,6 +1510,33 @@ allocate: } /* + * Is the given firmware compatible with the one the driver was compiled with? + */ +static int +fw_compatible(const struct fw_hdr *hdr) +{ + + if (hdr->fw_ver == htonl(FW_VERSION)) + return (1); + + /* + * XXX: Is this too conservative? Perhaps I should limit this to the + * features that are supported in the driver. + */ + if (hdr->intfver_nic == FW_HDR_INTFVER_NIC && + hdr->intfver_vnic == FW_HDR_INTFVER_VNIC && + hdr->intfver_ofld == FW_HDR_INTFVER_OFLD && + hdr->intfver_ri == FW_HDR_INTFVER_RI && + hdr->intfver_iscsipdu == FW_HDR_INTFVER_ISCSIPDU && + hdr->intfver_iscsi == FW_HDR_INTFVER_ISCSI && + hdr->intfver_fcoepdu == FW_HDR_INTFVER_FCOEPDU && + hdr->intfver_fcoe == FW_HDR_INTFVER_FCOEPDU) + return (1); + + return (0); +} + +/* * Install a compatible firmware (if required), establish contact with it (by * saying hello), and reset the device. If we end up as the master driver, * partition adapter resources by providing a configuration file to the @@ -1512,84 +1546,99 @@ static int prep_firmware(struct adapter *sc) { const struct firmware *fw = NULL, *cfg = NULL, *default_cfg; - int rc; + int rc, card_fw_usable, kld_fw_usable; enum dev_state state; + struct fw_hdr *card_fw; + const struct fw_hdr *kld_fw; default_cfg = firmware_get(T4_CFGNAME); - /* Check firmware version and install a different one if necessary */ - rc = t4_check_fw_version(sc); - snprintf(sc->fw_version, sizeof(sc->fw_version), "%u.%u.%u.%u", - G_FW_HDR_FW_VER_MAJOR(sc->params.fw_vers), - G_FW_HDR_FW_VER_MINOR(sc->params.fw_vers), - G_FW_HDR_FW_VER_MICRO(sc->params.fw_vers), - G_FW_HDR_FW_VER_BUILD(sc->params.fw_vers)); - if (rc != 0) { - uint32_t v = 0; - - fw = firmware_get(T4_FWNAME); - if (fw != NULL) { - const struct fw_hdr *hdr = (const void *)fw->data; + /* Read the header of the firmware on the card */ + card_fw = malloc(sizeof(*card_fw), M_CXGBE, M_ZERO | M_WAITOK); + rc = -t4_read_flash(sc, FLASH_FW_START, + sizeof (*card_fw) / sizeof (uint32_t), (uint32_t *)card_fw, 1); + if (rc == 0) + card_fw_usable = fw_compatible((const void*)card_fw); + else { + device_printf(sc->dev, + "Unable to read card's firmware header: %d\n", rc); + card_fw_usable = 0; + } - v = ntohl(hdr->fw_ver); + /* This is the firmware in the KLD */ + fw = firmware_get(T4_FWNAME); + if (fw != NULL) { + kld_fw = (const void *)fw->data; + kld_fw_usable = fw_compatible(kld_fw); + } else { + kld_fw = NULL; + kld_fw_usable = 0; + } - /* - * The firmware module will not be used if it isn't the - * same major version as what the driver was compiled - * with. - */ - if (G_FW_HDR_FW_VER_MAJOR(v) != FW_VERSION_MAJOR) { - device_printf(sc->dev, - "Found firmware image but version %d " - "can not be used with this driver (%d)\n", - G_FW_HDR_FW_VER_MAJOR(v), FW_VERSION_MAJOR); + /* + * Short circuit for the common case: the firmware on the card is an + * exact match and the KLD is an exact match too, or it's + * absent/incompatible, or we're prohibited from using it. Note that + * t4_fw_install = 2 is ignored here -- use cxgbetool loadfw if you want + * to reinstall the same firmware as the one on the card. + */ + if (card_fw_usable && card_fw->fw_ver == htonl(FW_VERSION) && + (!kld_fw_usable || kld_fw->fw_ver == htonl(FW_VERSION) || + t4_fw_install == 0)) + goto hello; + + if (kld_fw_usable && (!card_fw_usable || + ntohl(kld_fw->fw_ver) > ntohl(card_fw->fw_ver) || + (t4_fw_install == 2 && kld_fw->fw_ver != card_fw->fw_ver))) { + uint32_t v = ntohl(kld_fw->fw_ver); - firmware_put(fw, FIRMWARE_UNLOAD); - fw = NULL; - } - } + device_printf(sc->dev, + "installing firmware %d.%d.%d.%d on card.\n", + G_FW_HDR_FW_VER_MAJOR(v), G_FW_HDR_FW_VER_MINOR(v), + G_FW_HDR_FW_VER_MICRO(v), G_FW_HDR_FW_VER_BUILD(v)); - if (fw == NULL && rc < 0) { - device_printf(sc->dev, "No usable firmware. " - "card has %d.%d.%d, driver compiled with %d.%d.%d", - G_FW_HDR_FW_VER_MAJOR(sc->params.fw_vers), - G_FW_HDR_FW_VER_MINOR(sc->params.fw_vers), - G_FW_HDR_FW_VER_MICRO(sc->params.fw_vers), - FW_VERSION_MAJOR, FW_VERSION_MINOR, - FW_VERSION_MICRO); - rc = EAGAIN; + rc = -t4_load_fw(sc, fw->data, fw->datasize); + if (rc != 0) { + device_printf(sc->dev, + "failed to install firmware: %d\n", rc); goto done; } - /* - * Always upgrade, even for minor/micro/build mismatches. - * Downgrade only for a major version mismatch or if - * force_firmware_install was specified. - */ - if (fw != NULL && (rc < 0 || v > sc->params.fw_vers)) { - device_printf(sc->dev, - "installing firmware %d.%d.%d.%d on card.\n", - G_FW_HDR_FW_VER_MAJOR(v), G_FW_HDR_FW_VER_MINOR(v), - G_FW_HDR_FW_VER_MICRO(v), G_FW_HDR_FW_VER_BUILD(v)); - - rc = -t4_load_fw(sc, fw->data, fw->datasize); - if (rc != 0) { - device_printf(sc->dev, - "failed to install firmware: %d\n", rc); - goto done; - } else { - /* refresh */ - (void) t4_check_fw_version(sc); - snprintf(sc->fw_version, - sizeof(sc->fw_version), "%u.%u.%u.%u", - G_FW_HDR_FW_VER_MAJOR(sc->params.fw_vers), - G_FW_HDR_FW_VER_MINOR(sc->params.fw_vers), - G_FW_HDR_FW_VER_MICRO(sc->params.fw_vers), - G_FW_HDR_FW_VER_BUILD(sc->params.fw_vers)); - } - } + /* Installed successfully, update the cached header too. */ + memcpy(card_fw, kld_fw, sizeof(*card_fw)); + card_fw_usable = 1; + } + + if (!card_fw_usable) { + uint32_t c, k; + + c = ntohl(card_fw->fw_ver); + k = kld_fw ? ntohl(kld_fw->fw_ver) : 0; + + device_printf(sc->dev, "Cannot find a usable firmware: " + "fw_install %d, driver compiled with %d.%d.%d.%d, " + "card has %d.%d.%d.%d, KLD has %d.%d.%d.%d\n", + t4_fw_install, + G_FW_HDR_FW_VER_MAJOR(FW_VERSION), + G_FW_HDR_FW_VER_MINOR(FW_VERSION), + G_FW_HDR_FW_VER_MICRO(FW_VERSION), + G_FW_HDR_FW_VER_BUILD(FW_VERSION), + G_FW_HDR_FW_VER_MAJOR(c), G_FW_HDR_FW_VER_MINOR(c), + G_FW_HDR_FW_VER_MICRO(c), G_FW_HDR_FW_VER_BUILD(c), + G_FW_HDR_FW_VER_MAJOR(k), G_FW_HDR_FW_VER_MINOR(k), + G_FW_HDR_FW_VER_MICRO(k), G_FW_HDR_FW_VER_BUILD(k)); + goto done; } +hello: + /* We're using whatever's on the card and it's known to be good. */ + sc->params.fw_vers = ntohl(card_fw->fw_ver); + snprintf(sc->fw_version, sizeof(sc->fw_version), "%u.%u.%u.%u", + G_FW_HDR_FW_VER_MAJOR(sc->params.fw_vers), + G_FW_HDR_FW_VER_MINOR(sc->params.fw_vers), + G_FW_HDR_FW_VER_MICRO(sc->params.fw_vers), + G_FW_HDR_FW_VER_BUILD(sc->params.fw_vers)); + /* Contact firmware. */ rc = t4_fw_hello(sc, sc->mbox, sc->mbox, MASTER_MAY, &state); if (rc < 0) { @@ -1639,6 +1688,7 @@ prep_firmware(struct adapter *sc) sc->flags |= FW_OK; done: + free(card_fw, M_CXGBE); if (fw != NULL) firmware_put(fw, FIRMWARE_UNLOAD); if (cfg != NULL) Modified: user/attilio/vmc-playground/sys/dev/hwpmc/hwpmc_soft.c ============================================================================== --- user/attilio/vmc-playground/sys/dev/hwpmc/hwpmc_soft.c Tue Feb 26 21:16:10 2013 (r247353) +++ user/attilio/vmc-playground/sys/dev/hwpmc/hwpmc_soft.c Tue Feb 26 21:17:38 2013 (r247354) @@ -45,6 +45,8 @@ __FBSDID("$FreeBSD$"); #define SOFT_CAPS (PMC_CAP_READ | PMC_CAP_WRITE | PMC_CAP_INTERRUPT | \ PMC_CAP_USER | PMC_CAP_SYSTEM) +PMC_SOFT_DECLARE( , , clock, prof); + struct soft_descr { struct pmc_descr pm_descr; /* "base class" */ }; @@ -125,6 +127,8 @@ soft_allocate_pmc(int cpu, int ri, struc return (EINVAL); pmc_soft_ev_release(ps); + if (ev == pmc___clock_prof.ps_ev.pm_ev_code) + cpu_startprofclock(); return (0); } @@ -324,9 +328,8 @@ soft_release_pmc(int cpu, int ri, struct KASSERT(phw->phw_pmc == NULL, ("[soft,%d] PHW pmc %p non-NULL", __LINE__, phw->phw_pmc)); - /* - * Nothing to do. - */ + if (pmc->pm_event == pmc___clock_prof.ps_ev.pm_ev_code) + cpu_stopprofclock(); return (0); } Modified: user/attilio/vmc-playground/sys/dev/random/randomdev_soft.c ============================================================================== --- user/attilio/vmc-playground/sys/dev/random/randomdev_soft.c Tue Feb 26 21:16:10 2013 (r247353) +++ user/attilio/vmc-playground/sys/dev/random/randomdev_soft.c Tue Feb 26 21:17:38 2013 (r247354) @@ -391,7 +391,7 @@ random_yarrow_block(int flag) mtx_lock(&random_reseed_mtx); /* Blocking logic */ - while (random_systat.seeded && !error) { + while (!random_systat.seeded && !error) { if (flag & O_NONBLOCK) error = EWOULDBLOCK; else { Modified: user/attilio/vmc-playground/sys/kern/kern_clock.c ============================================================================== --- user/attilio/vmc-playground/sys/kern/kern_clock.c Tue Feb 26 21:16:10 2013 (r247353) +++ user/attilio/vmc-playground/sys/kern/kern_clock.c Tue Feb 26 21:17:38 2013 (r247354) @@ -78,6 +78,7 @@ __FBSDID("$FreeBSD$"); #include PMC_SOFT_DEFINE( , , clock, hard); PMC_SOFT_DEFINE( , , clock, stat); +PMC_SOFT_DEFINE( , , clock, prof); #endif #ifdef DEVICE_POLLING @@ -817,6 +818,10 @@ profclock_cnt(int cnt, int usermode, uin } } #endif +#ifdef HWPMC_HOOKS + if (td->td_intr_frame != NULL) + PMC_SOFT_CALL_TF( , , clock, prof, td->td_intr_frame); +#endif } /* Modified: user/attilio/vmc-playground/sys/kern/kern_clocksource.c ============================================================================== --- user/attilio/vmc-playground/sys/kern/kern_clocksource.c Tue Feb 26 21:16:10 2013 (r247353) +++ user/attilio/vmc-playground/sys/kern/kern_clocksource.c Tue Feb 26 21:17:38 2013 (r247354) @@ -732,12 +732,15 @@ cpu_startprofclock(void) { ET_LOCK(); - if (periodic) { - configtimer(0); - profiling = 1; - configtimer(1); + if (profiling == 0) { + if (periodic) { + configtimer(0); + profiling = 1; + configtimer(1); + } else + profiling = 1; } else - profiling = 1; + profiling++; ET_UNLOCK(); } @@ -749,12 +752,15 @@ cpu_stopprofclock(void) { ET_LOCK(); - if (periodic) { - configtimer(0); + if (profiling == 1) { + if (periodic) { + configtimer(0); + profiling = 0; + configtimer(1); + } else profiling = 0; - configtimer(1); } else - profiling = 0; + profiling--; ET_UNLOCK(); } Modified: user/attilio/vmc-playground/sys/sys/time.h ============================================================================== --- user/attilio/vmc-playground/sys/sys/time.h Tue Feb 26 21:16:10 2013 (r247353) +++ user/attilio/vmc-playground/sys/sys/time.h Tue Feb 26 21:17:38 2013 (r247354) @@ -156,6 +156,9 @@ timeval2bintime(const struct timeval *tv /* 18446744073709 = int(2^64 / 1000000) */ bt->frac = tv->tv_usec * (uint64_t)18446744073709LL; } +#endif /* __BSD_VISIBLE */ + +#ifdef _KERNEL /* Operations on timespecs */ #define timespecclear(tvp) ((tvp)->tv_sec = (tvp)->tv_nsec = 0) @@ -194,7 +197,7 @@ timeval2bintime(const struct timeval *tv /* timevaladd and timevalsub are not inlined */ -#endif /* __BSD_VISIBLE */ +#endif /* _KERNEL */ #ifndef _KERNEL /* NetBSD/OpenBSD compatible interfaces */ Modified: user/attilio/vmc-playground/sys/vm/vm_object.c ============================================================================== --- user/attilio/vmc-playground/sys/vm/vm_object.c Tue Feb 26 21:16:10 2013 (r247353) +++ user/attilio/vmc-playground/sys/vm/vm_object.c Tue Feb 26 21:17:38 2013 (r247354) @@ -1139,7 +1139,7 @@ shadowlookup: if (object != tobject) VM_OBJECT_UNLOCK(object); m->oflags |= VPO_WANTED; - VM_OBJECT_SLEEP(tobject, m, PDROP | PVM, "madvpo" , 0); + VM_OBJECT_SLEEP(tobject, m, PDROP | PVM, "madvpo", 0); VM_OBJECT_LOCK(object); goto relookup; } Modified: user/attilio/vmc-playground/sys/vm/vnode_pager.c ============================================================================== --- user/attilio/vmc-playground/sys/vm/vnode_pager.c Tue Feb 26 21:16:10 2013 (r247353) +++ user/attilio/vmc-playground/sys/vm/vnode_pager.c Tue Feb 26 21:17:38 2013 (r247354) @@ -116,7 +116,7 @@ vnode_create_vobject(struct vnode *vp, o } VOP_UNLOCK(vp, 0); vm_object_set_flag(object, OBJ_DISCONNECTWNT); - VM_OBJECT_SLEEP(object, object, PDROP | PVM, "vodead" , 0); + VM_OBJECT_SLEEP(object, object, PDROP | PVM, "vodead", 0); vn_lock(vp, LK_EXCLUSIVE | LK_RETRY); } @@ -210,7 +210,7 @@ retry: if ((object->flags & OBJ_DEAD) == 0) break; vm_object_set_flag(object, OBJ_DISCONNECTWNT); - VM_OBJECT_SLEEP(object, object, PDROP | PVM, "vadead" , 0); + VM_OBJECT_SLEEP(object, object, PDROP | PVM, "vadead", 0); } if (vp->v_usecount == 0) Modified: user/attilio/vmc-playground/usr.bin/truss/main.c ============================================================================== --- user/attilio/vmc-playground/usr.bin/truss/main.c Tue Feb 26 21:16:10 2013 (r247353) +++ user/attilio/vmc-playground/usr.bin/truss/main.c Tue Feb 26 21:17:38 2013 (r247354) @@ -323,14 +323,14 @@ START_TRACE: fprintf(trussinfo->outfile, "%5d: ", trussinfo->pid); if (trussinfo->flags & ABSOLUTETIMESTAMPS) { - timespecsubt_to(&trussinfo->curthread->after, + timespecsubt(&trussinfo->curthread->after, &trussinfo->start_time, &timediff); fprintf(trussinfo->outfile, "%ld.%09ld ", (long)timediff.tv_sec, timediff.tv_nsec); } if (trussinfo->flags & RELATIVETIMESTAMPS) { - timespecsubt_to(&trussinfo->curthread->after, + timespecsubt(&trussinfo->curthread->after, &trussinfo->curthread->before, &timediff); fprintf(trussinfo->outfile, "%ld.%09ld ", (long)timediff.tv_sec, @@ -349,14 +349,14 @@ START_TRACE: fprintf(trussinfo->outfile, "%5d: ", trussinfo->pid); if (trussinfo->flags & ABSOLUTETIMESTAMPS) { - timespecsubt_to(&trussinfo->curthread->after, + timespecsubt(&trussinfo->curthread->after, &trussinfo->start_time, &timediff); fprintf(trussinfo->outfile, "%ld.%09ld ", (long)timediff.tv_sec, timediff.tv_nsec); } if (trussinfo->flags & RELATIVETIMESTAMPS) { - timespecsubt_to(&trussinfo->curthread->after, + timespecsubt(&trussinfo->curthread->after, &trussinfo->curthread->before, &timediff); fprintf(trussinfo->outfile, "%ld.%09ld ", (long)timediff.tv_sec, timediff.tv_nsec); Modified: user/attilio/vmc-playground/usr.bin/truss/syscalls.c ============================================================================== --- user/attilio/vmc-playground/usr.bin/truss/syscalls.c Tue Feb 26 21:16:10 2013 (r247353) +++ user/attilio/vmc-playground/usr.bin/truss/syscalls.c Tue Feb 26 21:17:38 2013 (r247354) @@ -1126,14 +1126,14 @@ print_syscall(struct trussinfo *trussinf } if (trussinfo->flags & ABSOLUTETIMESTAMPS) { - timespecsubt_to(&trussinfo->curthread->after, + timespecsubt(&trussinfo->curthread->after, &trussinfo->start_time, &timediff); len += fprintf(trussinfo->outfile, "%ld.%09ld ", (long)timediff.tv_sec, timediff.tv_nsec); } if (trussinfo->flags & RELATIVETIMESTAMPS) { - timespecsubt_to(&trussinfo->curthread->after, + timespecsubt(&trussinfo->curthread->after, &trussinfo->curthread->before, &timediff); len += fprintf(trussinfo->outfile, "%ld.%09ld ", (long)timediff.tv_sec, timediff.tv_nsec); @@ -1165,9 +1165,9 @@ print_syscall_ret(struct trussinfo *trus if (!sc) return; clock_gettime(CLOCK_REALTIME, &trussinfo->curthread->after); - timespecsubt_to(&trussinfo->curthread->after, + timespecsubt(&trussinfo->curthread->after, &trussinfo->curthread->before, &timediff); - timespecadd_to(&sc->time, &timediff, &sc->time); + timespecadd(&sc->time, &timediff, &sc->time); sc->ncalls++; if (errorp) sc->nerror++; @@ -1205,7 +1205,7 @@ print_summary(struct trussinfo *trussinf fprintf(trussinfo->outfile, "%-20s%5jd.%09ld%8d%8d\n", sc->name, (intmax_t)sc->time.tv_sec, sc->time.tv_nsec, sc->ncalls, sc->nerror); - timespecadd_to(&total, &sc->time, &total); + timespecadd(&total, &sc->time, &total); ncall += sc->ncalls; nerror += sc->nerror; } Modified: user/attilio/vmc-playground/usr.bin/truss/truss.h ============================================================================== --- user/attilio/vmc-playground/usr.bin/truss/truss.h Tue Feb 26 21:16:10 2013 (r247353) +++ user/attilio/vmc-playground/usr.bin/truss/truss.h Tue Feb 26 21:17:38 2013 (r247354) @@ -62,7 +62,7 @@ struct trussinfo SLIST_HEAD(, threadinfo) threadlist; }; -#define timespecsubt_to(tvp, uvp, vvp) \ +#define timespecsubt(tvp, uvp, vvp) \ do { \ (vvp)->tv_sec = (tvp)->tv_sec - (uvp)->tv_sec; \ (vvp)->tv_nsec = (tvp)->tv_nsec - (uvp)->tv_nsec; \ @@ -72,7 +72,7 @@ struct trussinfo } \ } while (0) -#define timespecadd_to(tvp, uvp, vvp) \ +#define timespecadd(tvp, uvp, vvp) \ do { \ (vvp)->tv_sec = (tvp)->tv_sec + (uvp)->tv_sec; \ (vvp)->tv_nsec = (tvp)->tv_nsec + (uvp)->tv_nsec; \ Modified: user/attilio/vmc-playground/usr.sbin/bhyve/pci_virtio_block.c ============================================================================== --- user/attilio/vmc-playground/usr.sbin/bhyve/pci_virtio_block.c Tue Feb 26 21:16:10 2013 (r247353) +++ user/attilio/vmc-playground/usr.sbin/bhyve/pci_virtio_block.c Tue Feb 26 21:17:38 2013 (r247354) @@ -110,8 +110,9 @@ CTASSERT(sizeof(struct vtblk_config) == * Fixed-size block header */ struct virtio_blk_hdr { -#define VBH_OP_READ 0 -#define VBH_OP_WRITE 1 +#define VBH_OP_READ 0 +#define VBH_OP_WRITE 1 +#define VBH_FLAG_BARRIER 0x80000000 /* OR'ed into vbh_type */ uint32_t vbh_type; uint32_t vbh_ioprio; uint64_t vbh_sector; @@ -198,7 +199,7 @@ pci_vtblk_proc(struct pci_vtblk_softc *s int iolen; int nsegs; int uidx, aidx, didx; - int writeop; + int writeop, type; off_t offset; uidx = *hq->hq_used_idx; @@ -232,7 +233,13 @@ pci_vtblk_proc(struct pci_vtblk_softc *s assert(vid[0].vd_flags & VRING_DESC_F_NEXT); assert((vid[0].vd_flags & VRING_DESC_F_WRITE) == 0); - writeop = (vbh->vbh_type == VBH_OP_WRITE); + /* + * XXX + * The guest should not be setting the BARRIER flag because + * we don't advertise the capability. + */ + type = vbh->vbh_type & ~VBH_FLAG_BARRIER; + writeop = (type == VBH_OP_WRITE); offset = vbh->vbh_sector * DEV_BSIZE;