MFC
This commit is contained in:
parent
134623836d
commit
9d00dd1afe
@ -126,5 +126,4 @@ not using
|
||||
.Sh SEE ALSO
|
||||
.Xr iconv 3 ,
|
||||
.Xr tolower 3 ,
|
||||
.Xr toupper 3 ,
|
||||
.Xr iconv 9
|
||||
.Xr toupper 3
|
||||
|
@ -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 software are:
|
||||
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
|
||||
|
@ -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),
|
||||
|
@ -178,6 +178,15 @@ Bit 0 represents INTx (line interrupts), bit 1 MSI, bit 2 MSI-X.
|
||||
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
|
||||
|
@ -49,6 +49,9 @@ __FBSDID("$FreeBSD$");
|
||||
#include <machine/pte.h>
|
||||
#include <machine/intr.h>
|
||||
#include <machine/vmparam.h>
|
||||
#ifdef ARM_VFP_SUPPORT
|
||||
#include <machine/vfp.h>
|
||||
#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);
|
||||
|
||||
|
@ -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, struct trapframe *frame, int code)
|
||||
#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, struct trapframe *frame, int code)
|
||||
*/
|
||||
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;
|
||||
|
@ -124,5 +124,6 @@
|
||||
#define COPROC10 (0x3 << 20)
|
||||
#define COPROC11 (0x3 << 22)
|
||||
|
||||
void vfp_init(void);
|
||||
|
||||
#endif
|
||||
|
@ -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 <mm@FreeBSD.org>. All rights reserved.
|
||||
*/
|
||||
|
||||
#include <sys/zfs_context.h>
|
||||
@ -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);
|
||||
|
@ -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_t parent)
|
||||
* 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_t parent)
|
||||
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));
|
||||
|
@ -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 */
|
||||
|
@ -212,6 +212,13 @@ TUNABLE_INT("hw.cxgbe.interrupt_types", &t4_intr_types);
|
||||
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.
|
||||
@ -1502,6 +1509,33 @@ allocate:
|
||||
return (ENXIO);
|
||||
}
|
||||
|
||||
/*
|
||||
* 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,
|
||||
@ -1512,83 +1546,98 @@ 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);
|
||||
/* 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;
|
||||
}
|
||||
|
||||
/* 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;
|
||||
}
|
||||
|
||||
/*
|
||||
* 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);
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
/* 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));
|
||||
if (rc != 0) {
|
||||
uint32_t v = 0;
|
||||
|
||||
fw = firmware_get(T4_FWNAME);
|
||||
if (fw != NULL) {
|
||||
const struct fw_hdr *hdr = (const void *)fw->data;
|
||||
|
||||
v = ntohl(hdr->fw_ver);
|
||||
|
||||
/*
|
||||
* 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);
|
||||
|
||||
firmware_put(fw, FIRMWARE_UNLOAD);
|
||||
fw = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
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;
|
||||
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));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* Contact firmware. */
|
||||
rc = t4_fw_hello(sc, sc->mbox, sc->mbox, MASTER_MAY, &state);
|
||||
@ -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)
|
||||
|
@ -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, struct pmc *pm,
|
||||
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 pmc *pmc)
|
||||
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);
|
||||
}
|
||||
|
||||
|
@ -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 {
|
||||
|
@ -78,6 +78,7 @@ __FBSDID("$FreeBSD$");
|
||||
#include <sys/pmckern.h>
|
||||
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, uintfptr_t pc)
|
||||
}
|
||||
}
|
||||
#endif
|
||||
#ifdef HWPMC_HOOKS
|
||||
if (td->td_intr_frame != NULL)
|
||||
PMC_SOFT_CALL_TF( , , clock, prof, td->td_intr_frame);
|
||||
#endif
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -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();
|
||||
}
|
||||
|
||||
|
@ -156,6 +156,9 @@ timeval2bintime(const struct timeval *tv, struct bintime *bt)
|
||||
/* 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, struct bintime *bt)
|
||||
|
||||
/* timevaladd and timevalsub are not inlined */
|
||||
|
||||
#endif /* __BSD_VISIBLE */
|
||||
#endif /* _KERNEL */
|
||||
|
||||
#ifndef _KERNEL /* NetBSD/OpenBSD compatible interfaces */
|
||||
|
||||
|
@ -1176,7 +1176,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;
|
||||
}
|
||||
|
@ -116,7 +116,7 @@ vnode_create_vobject(struct vnode *vp, off_t isize, struct thread *td)
|
||||
}
|
||||
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)
|
||||
|
@ -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);
|
||||
|
@ -1126,14 +1126,14 @@ print_syscall(struct trussinfo *trussinfo, const char *name, int nargs,
|
||||
}
|
||||
|
||||
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 *trussinfo, const char *name, int nargs,
|
||||
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 *trussinfo)
|
||||
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;
|
||||
}
|
||||
|
@ -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; \
|
||||
|
@ -110,8 +110,9 @@ CTASSERT(sizeof(struct vtblk_config) == VTBLK_CFGSZ);
|
||||
* 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 *sc, struct vring_hqueue *hq)
|
||||
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 *sc, struct vring_hqueue *hq)
|
||||
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;
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user