svn commit: r265087 - in projects/random_number_generator: . lib/libc/arm/gen lib/libvmmapi release/doc/en_US.ISO8859-1/relnotes share/man/man4 sys/amd64/include sys/amd64/vmm sys/amd64/vmm/intel s...
Mark Murray
markm at FreeBSD.org
Tue Apr 29 07:29:20 UTC 2014
Author: markm
Date: Tue Apr 29 07:29:13 2014
New Revision: 265087
URL: http://svnweb.freebsd.org/changeset/base/265087
Log:
MFC - tracking commit
Added:
projects/random_number_generator/share/man/man4/proto.4
- copied unchanged from r265086, head/share/man/man4/proto.4
projects/random_number_generator/sys/dev/proto/
- copied from r265086, head/sys/dev/proto/
projects/random_number_generator/sys/modules/proto/
- copied from r265086, head/sys/modules/proto/
projects/random_number_generator/tools/bus_space/
- copied from r265086, head/tools/bus_space/
Modified:
projects/random_number_generator/Makefile.inc1
projects/random_number_generator/lib/libc/arm/gen/fpsetmask_vfp.c
projects/random_number_generator/lib/libvmmapi/vmmapi.c
projects/random_number_generator/lib/libvmmapi/vmmapi.h
projects/random_number_generator/release/doc/en_US.ISO8859-1/relnotes/article.xml
projects/random_number_generator/share/man/man4/Makefile
projects/random_number_generator/sys/amd64/include/vmm.h (contents, props changed)
projects/random_number_generator/sys/amd64/include/vmm_dev.h (contents, props changed)
projects/random_number_generator/sys/amd64/vmm/intel/vmx.c
projects/random_number_generator/sys/amd64/vmm/vmm.c
projects/random_number_generator/sys/amd64/vmm/vmm_dev.c
projects/random_number_generator/sys/boot/amd64/Makefile.inc
projects/random_number_generator/sys/geom/geom_disk.c
projects/random_number_generator/sys/geom/raid/g_raid.c
projects/random_number_generator/sys/geom/raid/md_ddf.c
projects/random_number_generator/sys/geom/raid/md_intel.c
projects/random_number_generator/sys/geom/raid/md_jmicron.c
projects/random_number_generator/sys/geom/raid/md_nvidia.c
projects/random_number_generator/sys/geom/raid/md_promise.c
projects/random_number_generator/sys/geom/raid/md_sii.c
projects/random_number_generator/sys/kern/subr_bus.c
projects/random_number_generator/sys/modules/Makefile
projects/random_number_generator/usr.sbin/bhyve/bhyverun.c
projects/random_number_generator/usr.sbin/bhyve/pci_ahci.c
projects/random_number_generator/usr.sbin/bhyvectl/bhyvectl.c
projects/random_number_generator/usr.sbin/pmcstat/pmcstat.8
projects/random_number_generator/usr.sbin/pmcstat/pmcstat.c
Directory Properties:
projects/random_number_generator/ (props changed)
projects/random_number_generator/lib/libc/ (props changed)
projects/random_number_generator/lib/libvmmapi/ (props changed)
projects/random_number_generator/share/man/man4/ (props changed)
projects/random_number_generator/sys/ (props changed)
projects/random_number_generator/sys/amd64/vmm/ (props changed)
projects/random_number_generator/sys/boot/ (props changed)
projects/random_number_generator/usr.sbin/bhyve/ (props changed)
projects/random_number_generator/usr.sbin/bhyvectl/ (props changed)
Modified: projects/random_number_generator/Makefile.inc1
==============================================================================
--- projects/random_number_generator/Makefile.inc1 Tue Apr 29 07:19:22 2014 (r265086)
+++ projects/random_number_generator/Makefile.inc1 Tue Apr 29 07:29:13 2014 (r265087)
@@ -1480,6 +1480,7 @@ _prebuild_libs= ${_kerberos5_lib_libasn1
${_secure_lib_libssh} ${_secure_lib_libssl}
.if ${MK_GNUCXX} != "no" && ${MK_CXX} != "no"
_prebuild_libs+= gnu/lib/libstdc++ gnu/lib/libsupc++
+gnu/lib/libstdc++__L: lib/msun__L
.endif
.if defined(WITH_ATF) || ${MK_TESTS} != "no"
Modified: projects/random_number_generator/lib/libc/arm/gen/fpsetmask_vfp.c
==============================================================================
--- projects/random_number_generator/lib/libc/arm/gen/fpsetmask_vfp.c Tue Apr 29 07:19:22 2014 (r265086)
+++ projects/random_number_generator/lib/libc/arm/gen/fpsetmask_vfp.c Tue Apr 29 07:29:13 2014 (r265087)
@@ -45,7 +45,7 @@ fpsetmask(fp_except_t mask)
__asm __volatile("vmrs %0, fpscr" : "=&r"(old));
mask = (mask & FP_X_MASK) << 8;
new = (old & ~(FP_X_MASK << 8)) | mask;
- __asm __volatile("vmsr fpscr, %0" : : "r"(old));
+ __asm __volatile("vmsr fpscr, %0" : : "r"(new));
return ((old >> 8) & FP_X_MASK);
}
Modified: projects/random_number_generator/lib/libvmmapi/vmmapi.c
==============================================================================
--- projects/random_number_generator/lib/libvmmapi/vmmapi.c Tue Apr 29 07:19:22 2014 (r265086)
+++ projects/random_number_generator/lib/libvmmapi/vmmapi.c Tue Apr 29 07:29:13 2014 (r265087)
@@ -343,10 +343,13 @@ vm_run(struct vmctx *ctx, int vcpu, uint
}
int
-vm_suspend(struct vmctx *ctx)
+vm_suspend(struct vmctx *ctx, enum vm_suspend_how how)
{
+ struct vm_suspend vmsuspend;
- return (ioctl(ctx->fd, VM_SUSPEND, 0));
+ bzero(&vmsuspend, sizeof(vmsuspend));
+ vmsuspend.how = how;
+ return (ioctl(ctx->fd, VM_SUSPEND, &vmsuspend));
}
static int
Modified: projects/random_number_generator/lib/libvmmapi/vmmapi.h
==============================================================================
--- projects/random_number_generator/lib/libvmmapi/vmmapi.h Tue Apr 29 07:19:22 2014 (r265086)
+++ projects/random_number_generator/lib/libvmmapi/vmmapi.h Tue Apr 29 07:29:13 2014 (r265087)
@@ -61,7 +61,7 @@ int vm_set_register(struct vmctx *ctx, i
int vm_get_register(struct vmctx *ctx, int vcpu, int reg, uint64_t *retval);
int vm_run(struct vmctx *ctx, int vcpu, uint64_t rip,
struct vm_exit *ret_vmexit);
-int vm_suspend(struct vmctx *ctx);
+int vm_suspend(struct vmctx *ctx, enum vm_suspend_how how);
int vm_apicid2vcpu(struct vmctx *ctx, int apicid);
int vm_inject_exception(struct vmctx *ctx, int vcpu, int vec);
int vm_inject_exception2(struct vmctx *ctx, int vcpu, int vec, int errcode);
Modified: projects/random_number_generator/release/doc/en_US.ISO8859-1/relnotes/article.xml
==============================================================================
--- projects/random_number_generator/release/doc/en_US.ISO8859-1/relnotes/article.xml Tue Apr 29 07:19:22 2014 (r265086)
+++ projects/random_number_generator/release/doc/en_US.ISO8859-1/relnotes/article.xml Tue Apr 29 07:29:13 2014 (r265087)
@@ -104,10 +104,6 @@
<sect2 xml:id="kernel">
<title>Kernel Changes</title>
- <para revision="263754">The &man.sysctl.8;
- <literal>hw.bus.devctl_disable</literal> has been
- removed.</para>
-
<para revision="260903">Support for GPS ports has been added to
&man.uhso.4;.</para>
Modified: projects/random_number_generator/share/man/man4/Makefile
==============================================================================
--- projects/random_number_generator/share/man/man4/Makefile Tue Apr 29 07:19:22 2014 (r265086)
+++ projects/random_number_generator/share/man/man4/Makefile Tue Apr 29 07:29:13 2014 (r265087)
@@ -378,6 +378,7 @@ MAN= aac.4 \
ppc.4 \
ppi.4 \
procdesc.4 \
+ proto.4 \
psm.4 \
pst.4 \
pt.4 \
Copied: projects/random_number_generator/share/man/man4/proto.4 (from r265086, head/share/man/man4/proto.4)
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ projects/random_number_generator/share/man/man4/proto.4 Tue Apr 29 07:29:13 2014 (r265087, copy of r265086, head/share/man/man4/proto.4)
@@ -0,0 +1,121 @@
+.\"
+.\" Copyright (c) 2014 Marcel Moolenaar
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\"
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+.\" IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+.\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd April 21, 2014
+.Dt PROTO 4
+.Os
+.\"
+.Sh NAME
+.Nm proto
+.Nd Driver for prototyping and H/W diagnostics
+.\"
+.Sh SYNOPSIS
+.Cd "device proto"
+.\"
+.Sh DESCRIPTION
+The
+.Nm
+device driver attaches to PCI devices when no other device drivers are
+present and creates device special files for all resources associated
+with the device.
+The driver itself has no knowledge of the device it attaches to.
+Programs can open these device special files and peform register-level
+reads and writes.
+As such, the
+.Nm
+device driver is nothing but a conduit or gateway between user space
+programs and the hardware device.
+.Pp
+Examples for why this is useful include hardware diagnostics and prototyping.
+In both these use cases, it's far more convenient to develop and run the
+logic in user space.
+Especially hardware diagnostics requires a somewhat user-friendly interface
+and adequate reporting.
+Neither is done easily as kernel code.
+.\"
+.Sh FILES
+All device special files corresponding to a PCI device are located under
+.Pa /dev/proto/pci<d>:<b>:<s>:<f>
+with
+.Pa pci<d>:<b>:<s>:<f>
+representing the location of the PCI device in the PCI hierarchy.
+A location includes:
+.Bl -tag -width XXXXXX -compact
+.It <d>
+The PCI domain number
+.It <b>
+The PCI bus number
+.It <s>
+The PCI slot or device number
+.It <f>
+The PCI function number
+.El
+.Pp
+Every PCI device has a device special file called
+.Pa pcicfg .
+This device special file gives access to the PCI configuration space.
+For each valid base address register (BAR), a device special file is created
+that contains the BAR offset and the resource type.
+A resource type can be either
+.Pa io
+or
+.Pa mem
+representing I/O port or memory mapped I/O space (resp.)
+.\"
+.Sh EXAMPLES
+A single function PCI device in domain 0, on bus 1, in slot 2 and having a
+single memory mapped I/O region will have the following device special files:
+.Bl -tag -compact
+.It Pa /dev/proto/pci0:1:2:0/10.mem
+.It Pa /dev/proto/pci0:1:2:0/pcicfg
+.El
+.\"
+.Sh SECURITY CONSIDERATIONS
+Because programs have direct access to the hardware, the
+.Nm
+driver is inherently insecure.
+It is not advisable to use this driver on a production machine.
+.\"
+.Sh MISSING FUNCTIONALITY
+The
+.Nm
+driver does not yet support interrupts.
+Since interrupts cannot be handled by the driver itself, they must be converted
+into signals and delivered to the program that has registered for interrupts.
+.Pp
+In order to test the transmission or reception of data, some means of doing
+direct memory access (DMA) by the device must be possible. This too much be
+under the control of the program. The details of how a program can setup and
+initiate DMA still need to be fleshed out.
+.Pp
+Support for non-PCI devices has not been implemented yet.
+.\"
+.Sh AUTHORS
+The
+.Nm
+device driver and this manual page were written by
+.An Marcel Moolenaar Aq marcel at xcllnt.net .
Modified: projects/random_number_generator/sys/amd64/include/vmm.h
==============================================================================
--- projects/random_number_generator/sys/amd64/include/vmm.h Tue Apr 29 07:19:22 2014 (r265086)
+++ projects/random_number_generator/sys/amd64/include/vmm.h Tue Apr 29 07:29:13 2014 (r265087)
@@ -29,6 +29,13 @@
#ifndef _VMM_H_
#define _VMM_H_
+enum vm_suspend_how {
+ VM_SUSPEND_NONE,
+ VM_SUSPEND_RESET,
+ VM_SUSPEND_POWEROFF,
+ VM_SUSPEND_LAST
+};
+
#ifdef _KERNEL
#define VM_MAX_NAMELEN 32
@@ -115,7 +122,7 @@ int vm_get_seg_desc(struct vm *vm, int v
int vm_set_seg_desc(struct vm *vm, int vcpu, int reg,
struct seg_desc *desc);
int vm_run(struct vm *vm, struct vm_run *vmrun);
-int vm_suspend(struct vm *vm);
+int vm_suspend(struct vm *vm, enum vm_suspend_how how);
int vm_inject_nmi(struct vm *vm, int vcpu);
int vm_nmi_pending(struct vm *vm, int vcpuid);
void vm_nmi_clear(struct vm *vm, int vcpuid);
@@ -134,6 +141,7 @@ int vm_apicid2vcpuid(struct vm *vm, int
void vm_activate_cpu(struct vm *vm, int vcpu);
cpuset_t vm_active_cpus(struct vm *vm);
struct vm_exit *vm_exitinfo(struct vm *vm, int vcpuid);
+void vm_exit_suspended(struct vm *vm, int vcpuid, uint64_t rip);
/*
* Rendezvous all vcpus specified in 'dest' and execute 'func(arg)'.
@@ -382,6 +390,9 @@ struct vm_exit {
struct {
int vector;
} ioapic_eoi;
+ struct {
+ enum vm_suspend_how how;
+ } suspended;
} u;
};
Modified: projects/random_number_generator/sys/amd64/include/vmm_dev.h
==============================================================================
--- projects/random_number_generator/sys/amd64/include/vmm_dev.h Tue Apr 29 07:19:22 2014 (r265086)
+++ projects/random_number_generator/sys/amd64/include/vmm_dev.h Tue Apr 29 07:29:13 2014 (r265087)
@@ -159,6 +159,10 @@ struct vm_hpet_cap {
uint32_t capabilities; /* lower 32 bits of HPET capabilities */
};
+struct vm_suspend {
+ enum vm_suspend_how how;
+};
+
enum {
/* general routines */
IOCNUM_ABIVERS = 0,
@@ -214,7 +218,7 @@ enum {
#define VM_RUN \
_IOWR('v', IOCNUM_RUN, struct vm_run)
#define VM_SUSPEND \
- _IO('v', IOCNUM_SUSPEND)
+ _IOW('v', IOCNUM_SUSPEND, struct vm_suspend)
#define VM_MAP_MEMORY \
_IOWR('v', IOCNUM_MAP_MEMORY, struct vm_memory_segment)
#define VM_GET_MEMORY_SEG \
Modified: projects/random_number_generator/sys/amd64/vmm/intel/vmx.c
==============================================================================
--- projects/random_number_generator/sys/amd64/vmm/intel/vmx.c Tue Apr 29 07:19:22 2014 (r265086)
+++ projects/random_number_generator/sys/amd64/vmm/intel/vmx.c Tue Apr 29 07:29:13 2014 (r265087)
@@ -2045,16 +2045,6 @@ vmx_exit_rendezvous(struct vmx *vmx, int
}
static __inline int
-vmx_exit_suspended(struct vmx *vmx, int vcpu, struct vm_exit *vmexit)
-{
-
- vmexit->rip = vmcs_guest_rip();
- vmexit->inst_length = 0;
- vmexit->exitcode = VM_EXITCODE_SUSPENDED;
- return (UNHANDLED);
-}
-
-static __inline int
vmx_exit_inst_error(struct vmxctx *vmxctx, int rc, struct vm_exit *vmexit)
{
@@ -2173,7 +2163,8 @@ vmx_run(void *arg, int vcpu, register_t
disable_intr();
if (vcpu_suspended(suspend_cookie)) {
enable_intr();
- handled = vmx_exit_suspended(vmx, vcpu, vmexit);
+ vm_exit_suspended(vmx->vm, vcpu, vmcs_guest_rip());
+ handled = UNHANDLED;
break;
}
Modified: projects/random_number_generator/sys/amd64/vmm/vmm.c
==============================================================================
--- projects/random_number_generator/sys/amd64/vmm/vmm.c Tue Apr 29 07:19:22 2014 (r265086)
+++ projects/random_number_generator/sys/amd64/vmm/vmm.c Tue Apr 29 07:29:13 2014 (r265087)
@@ -1211,16 +1211,45 @@ vm_handle_suspend(struct vm *vm, int vcp
}
int
-vm_suspend(struct vm *vm)
+vm_suspend(struct vm *vm, enum vm_suspend_how how)
{
+ int i;
- if (atomic_cmpset_int(&vm->suspend, 0, 1)) {
- VM_CTR0(vm, "virtual machine suspended");
- return (0);
- } else {
- VM_CTR0(vm, "virtual machine already suspended");
+ if (how <= VM_SUSPEND_NONE || how >= VM_SUSPEND_LAST)
+ return (EINVAL);
+
+ if (atomic_cmpset_int(&vm->suspend, 0, how) == 0) {
+ VM_CTR2(vm, "virtual machine already suspended %d/%d",
+ vm->suspend, how);
return (EALREADY);
}
+
+ VM_CTR1(vm, "virtual machine successfully suspended %d", how);
+
+ /*
+ * Notify all active vcpus that they are now suspended.
+ */
+ for (i = 0; i < VM_MAXCPU; i++) {
+ if (CPU_ISSET(i, &vm->active_cpus))
+ vcpu_notify_event(vm, i, false);
+ }
+
+ return (0);
+}
+
+void
+vm_exit_suspended(struct vm *vm, int vcpuid, uint64_t rip)
+{
+ struct vm_exit *vmexit;
+
+ KASSERT(vm->suspend > VM_SUSPEND_NONE && vm->suspend < VM_SUSPEND_LAST,
+ ("vm_exit_suspended: invalid suspend type %d", vm->suspend));
+
+ vmexit = vm_exitinfo(vm, vcpuid);
+ vmexit->rip = rip;
+ vmexit->inst_length = 0;
+ vmexit->exitcode = VM_EXITCODE_SUSPENDED;
+ vmexit->u.suspended.how = vm->suspend;
}
int
Modified: projects/random_number_generator/sys/amd64/vmm/vmm_dev.c
==============================================================================
--- projects/random_number_generator/sys/amd64/vmm/vmm_dev.c Tue Apr 29 07:19:22 2014 (r265086)
+++ projects/random_number_generator/sys/amd64/vmm/vmm_dev.c Tue Apr 29 07:29:13 2014 (r265087)
@@ -166,6 +166,7 @@ vmmdev_ioctl(struct cdev *cdev, u_long c
struct vm_stat_desc *statdesc;
struct vm_x2apic *x2apic;
struct vm_gpa_pte *gpapte;
+ struct vm_suspend *vmsuspend;
sc = vmmdev_lookup2(cdev);
if (sc == NULL)
@@ -241,7 +242,8 @@ vmmdev_ioctl(struct cdev *cdev, u_long c
error = vm_run(sc->vm, vmrun);
break;
case VM_SUSPEND:
- error = vm_suspend(sc->vm);
+ vmsuspend = (struct vm_suspend *)data;
+ error = vm_suspend(sc->vm, vmsuspend->how);
break;
case VM_STAT_DESC: {
statdesc = (struct vm_stat_desc *)data;
Modified: projects/random_number_generator/sys/boot/amd64/Makefile.inc
==============================================================================
--- projects/random_number_generator/sys/boot/amd64/Makefile.inc Tue Apr 29 07:19:22 2014 (r265086)
+++ projects/random_number_generator/sys/boot/amd64/Makefile.inc Tue Apr 29 07:29:13 2014 (r265087)
@@ -4,8 +4,9 @@
BINDIR?= /boot
+# See conf/kern.mk for the correct set of these
CFLAGS+= -ffreestanding
-CFLAGS+= -mno-mmx -mno-3dnow -mno-sse -mno-sse2 -mno-sse3 -msoft-float
+CFLAGS+= -mno-mmx -mno-sse -mno-aes -mno-avx -msoft-float
LDFLAGS+= -nostdlib
.include "../Makefile.inc"
Modified: projects/random_number_generator/sys/geom/geom_disk.c
==============================================================================
--- projects/random_number_generator/sys/geom/geom_disk.c Tue Apr 29 07:19:22 2014 (r265086)
+++ projects/random_number_generator/sys/geom/geom_disk.c Tue Apr 29 07:29:13 2014 (r265087)
@@ -47,7 +47,6 @@ __FBSDID("$FreeBSD$");
#include <sys/fcntl.h>
#include <sys/malloc.h>
#include <sys/sbuf.h>
-#include <sys/sysctl.h>
#include <sys/devicestat.h>
#include <machine/md_var.h>
Modified: projects/random_number_generator/sys/geom/raid/g_raid.c
==============================================================================
--- projects/random_number_generator/sys/geom/raid/g_raid.c Tue Apr 29 07:19:22 2014 (r265086)
+++ projects/random_number_generator/sys/geom/raid/g_raid.c Tue Apr 29 07:29:13 2014 (r265087)
@@ -2251,6 +2251,8 @@ g_raid_taste(struct g_class *mp, struct
return (NULL);
G_RAID_DEBUG(2, "Tasting provider %s.", pp->name);
+ geom = NULL;
+ status = G_RAID_MD_TASTE_FAIL;
gp = g_new_geomf(mp, "raid:taste");
/*
* This orphan function should be never called.
@@ -2259,8 +2261,9 @@ g_raid_taste(struct g_class *mp, struct
cp = g_new_consumer(gp);
cp->flags |= G_CF_DIRECT_RECEIVE;
g_attach(cp, pp);
+ if (g_access(cp, 1, 0, 0) != 0)
+ goto ofail;
- geom = NULL;
LIST_FOREACH(class, &g_raid_md_classes, mdc_list) {
if (!class->mdc_enable)
continue;
@@ -2276,6 +2279,9 @@ g_raid_taste(struct g_class *mp, struct
break;
}
+ if (status == G_RAID_MD_TASTE_FAIL)
+ (void)g_access(cp, -1, 0, 0);
+ofail:
g_detach(cp);
g_destroy_consumer(cp);
g_destroy_geom(gp);
Modified: projects/random_number_generator/sys/geom/raid/md_ddf.c
==============================================================================
--- projects/random_number_generator/sys/geom/raid/md_ddf.c Tue Apr 29 07:19:22 2014 (r265086)
+++ projects/random_number_generator/sys/geom/raid/md_ddf.c Tue Apr 29 07:29:13 2014 (r265087)
@@ -2120,13 +2120,10 @@ g_raid_md_taste_ddf(struct g_raid_md_obj
pp = cp->provider;
/* Read metadata from device. */
- if (g_access(cp, 1, 0, 0) != 0)
- return (G_RAID_MD_TASTE_FAIL);
g_topology_unlock();
bzero(&meta, sizeof(meta));
error = ddf_meta_read(cp, &meta);
g_topology_lock();
- g_access(cp, -1, 0, 0);
if (error != 0)
return (G_RAID_MD_TASTE_FAIL);
be = meta.bigendian;
@@ -2164,6 +2161,9 @@ g_raid_md_taste_ddf(struct g_raid_md_obj
geom = sc->sc_geom;
}
+ /* There is no return after this point, so we close passed consumer. */
+ g_access(cp, -1, 0, 0);
+
rcp = g_new_consumer(geom);
rcp->flags |= G_CF_DIRECT_RECEIVE;
g_attach(rcp, pp);
Modified: projects/random_number_generator/sys/geom/raid/md_intel.c
==============================================================================
--- projects/random_number_generator/sys/geom/raid/md_intel.c Tue Apr 29 07:19:22 2014 (r265086)
+++ projects/random_number_generator/sys/geom/raid/md_intel.c Tue Apr 29 07:29:13 2014 (r265087)
@@ -1382,8 +1382,6 @@ g_raid_md_taste_intel(struct g_raid_md_o
meta = NULL;
vendor = 0xffff;
disk_pos = 0;
- if (g_access(cp, 1, 0, 0) != 0)
- return (G_RAID_MD_TASTE_FAIL);
g_topology_unlock();
error = g_raid_md_get_label(cp, serial, sizeof(serial));
if (error != 0) {
@@ -1396,7 +1394,6 @@ g_raid_md_taste_intel(struct g_raid_md_o
g_io_getattr("GEOM::hba_vendor", cp, &len, &vendor);
meta = intel_meta_read(cp);
g_topology_lock();
- g_access(cp, -1, 0, 0);
if (meta == NULL) {
if (g_raid_aggressive_spare) {
if (vendor != 0x8086) {
@@ -1476,6 +1473,9 @@ search:
G_RAID_DEBUG1(1, sc, "root_mount_hold %p", mdi->mdio_rootmount);
}
+ /* There is no return after this point, so we close passed consumer. */
+ g_access(cp, -1, 0, 0);
+
rcp = g_new_consumer(geom);
rcp->flags |= G_CF_DIRECT_RECEIVE;
g_attach(rcp, pp);
@@ -1512,7 +1512,6 @@ search:
return (result);
fail2:
g_topology_lock();
- g_access(cp, -1, 0, 0);
fail1:
free(meta, M_MD_INTEL);
return (G_RAID_MD_TASTE_FAIL);
Modified: projects/random_number_generator/sys/geom/raid/md_jmicron.c
==============================================================================
--- projects/random_number_generator/sys/geom/raid/md_jmicron.c Tue Apr 29 07:19:22 2014 (r265086)
+++ projects/random_number_generator/sys/geom/raid/md_jmicron.c Tue Apr 29 07:29:13 2014 (r265087)
@@ -837,15 +837,12 @@ g_raid_md_taste_jmicron(struct g_raid_md
/* Read metadata from device. */
meta = NULL;
vendor = 0xffff;
- if (g_access(cp, 1, 0, 0) != 0)
- return (G_RAID_MD_TASTE_FAIL);
g_topology_unlock();
len = 2;
if (pp->geom->rank == 1)
g_io_getattr("GEOM::hba_vendor", cp, &len, &vendor);
meta = jmicron_meta_read(cp);
g_topology_lock();
- g_access(cp, -1, 0, 0);
if (meta == NULL) {
if (g_raid_aggressive_spare) {
if (vendor == 0x197b) {
@@ -922,6 +919,9 @@ search:
G_RAID_DEBUG1(1, sc, "root_mount_hold %p", mdi->mdio_rootmount);
}
+ /* There is no return after this point, so we close passed consumer. */
+ g_access(cp, -1, 0, 0);
+
rcp = g_new_consumer(geom);
rcp->flags |= G_CF_DIRECT_RECEIVE;
g_attach(rcp, pp);
Modified: projects/random_number_generator/sys/geom/raid/md_nvidia.c
==============================================================================
--- projects/random_number_generator/sys/geom/raid/md_nvidia.c Tue Apr 29 07:19:22 2014 (r265086)
+++ projects/random_number_generator/sys/geom/raid/md_nvidia.c Tue Apr 29 07:29:13 2014 (r265087)
@@ -841,15 +841,12 @@ g_raid_md_taste_nvidia(struct g_raid_md_
/* Read metadata from device. */
meta = NULL;
vendor = 0xffff;
- if (g_access(cp, 1, 0, 0) != 0)
- return (G_RAID_MD_TASTE_FAIL);
g_topology_unlock();
len = 2;
if (pp->geom->rank == 1)
g_io_getattr("GEOM::hba_vendor", cp, &len, &vendor);
meta = nvidia_meta_read(cp);
g_topology_lock();
- g_access(cp, -1, 0, 0);
if (meta == NULL) {
if (g_raid_aggressive_spare) {
if (vendor == 0x10de) {
@@ -918,6 +915,9 @@ search:
G_RAID_DEBUG1(1, sc, "root_mount_hold %p", mdi->mdio_rootmount);
}
+ /* There is no return after this point, so we close passed consumer. */
+ g_access(cp, -1, 0, 0);
+
rcp = g_new_consumer(geom);
rcp->flags |= G_CF_DIRECT_RECEIVE;
g_attach(rcp, pp);
Modified: projects/random_number_generator/sys/geom/raid/md_promise.c
==============================================================================
--- projects/random_number_generator/sys/geom/raid/md_promise.c Tue Apr 29 07:19:22 2014 (r265086)
+++ projects/random_number_generator/sys/geom/raid/md_promise.c Tue Apr 29 07:29:13 2014 (r265087)
@@ -1106,15 +1106,12 @@ g_raid_md_taste_promise(struct g_raid_md
/* Read metadata from device. */
meta = NULL;
vendor = 0xffff;
- if (g_access(cp, 1, 0, 0) != 0)
- return (G_RAID_MD_TASTE_FAIL);
g_topology_unlock();
len = 2;
if (pp->geom->rank == 1)
g_io_getattr("GEOM::hba_vendor", cp, &len, &vendor);
subdisks = promise_meta_read(cp, metaarr);
g_topology_lock();
- g_access(cp, -1, 0, 0);
if (subdisks == 0) {
if (g_raid_aggressive_spare) {
if (vendor == 0x105a || vendor == 0x1002) {
@@ -1175,6 +1172,9 @@ search:
geom = sc->sc_geom;
}
+ /* There is no return after this point, so we close passed consumer. */
+ g_access(cp, -1, 0, 0);
+
rcp = g_new_consumer(geom);
rcp->flags |= G_CF_DIRECT_RECEIVE;
g_attach(rcp, pp);
Modified: projects/random_number_generator/sys/geom/raid/md_sii.c
==============================================================================
--- projects/random_number_generator/sys/geom/raid/md_sii.c Tue Apr 29 07:19:22 2014 (r265086)
+++ projects/random_number_generator/sys/geom/raid/md_sii.c Tue Apr 29 07:29:13 2014 (r265087)
@@ -923,15 +923,12 @@ g_raid_md_taste_sii(struct g_raid_md_obj
/* Read metadata from device. */
meta = NULL;
vendor = 0xffff;
- if (g_access(cp, 1, 0, 0) != 0)
- return (G_RAID_MD_TASTE_FAIL);
g_topology_unlock();
len = 2;
if (pp->geom->rank == 1)
g_io_getattr("GEOM::hba_vendor", cp, &len, &vendor);
meta = sii_meta_read(cp);
g_topology_lock();
- g_access(cp, -1, 0, 0);
if (meta == NULL) {
if (g_raid_aggressive_spare) {
if (vendor == 0x1095) {
@@ -1011,6 +1008,9 @@ search:
G_RAID_DEBUG1(1, sc, "root_mount_hold %p", mdi->mdio_rootmount);
}
+ /* There is no return after this point, so we close passed consumer. */
+ g_access(cp, -1, 0, 0);
+
rcp = g_new_consumer(geom);
rcp->flags |= G_CF_DIRECT_RECEIVE;
g_attach(rcp, pp);
Modified: projects/random_number_generator/sys/kern/subr_bus.c
==============================================================================
--- projects/random_number_generator/sys/kern/subr_bus.c Tue Apr 29 07:19:22 2014 (r265086)
+++ projects/random_number_generator/sys/kern/subr_bus.c Tue Apr 29 07:29:13 2014 (r265087)
@@ -355,6 +355,13 @@ device_sysctl_fini(device_t dev)
* tested since 3.4 or 2.2.8!
*/
+/* Deprecated way to adjust queue length */
+static int sysctl_devctl_disable(SYSCTL_HANDLER_ARGS);
+/* XXX Need to support old-style tunable hw.bus.devctl_disable" */
+SYSCTL_PROC(_hw_bus, OID_AUTO, devctl_disable, CTLTYPE_INT | CTLFLAG_RW |
+ CTLFLAG_MPSAFE, NULL, 0, sysctl_devctl_disable, "I",
+ "devctl disable -- deprecated");
+
#define DEVCTL_DEFAULT_QUEUE_LEN 1000
static int sysctl_devctl_queue(SYSCTL_HANDLER_ARGS);
static int devctl_queue_length = DEVCTL_DEFAULT_QUEUE_LEN;
@@ -685,9 +692,9 @@ devctl_notify(const char *system, const
* Common routine that tries to make sending messages as easy as possible.
* We allocate memory for the data, copy strings into that, but do not
* free it unless there's an error. The dequeue part of the driver should
- * free the data. We don't send data when queue length is 0. We do send
- * data, even when we have no listeners, because we wish to avoid races
- * relating to startup and restart of listening applications.
+ * free the data. We don't send data when the device is disabled. We do
+ * send data, even when we have no listeners, because we wish to avoid
+ * races relating to startup and restart of listening applications.
*
* devaddq is designed to string together the type of event, with the
* object of that event, plus the plug and play info and location info
@@ -779,6 +786,33 @@ devnomatch(device_t dev)
}
static int
+sysctl_devctl_disable(SYSCTL_HANDLER_ARGS)
+{
+ struct dev_event_info *n1;
+ int dis, error;
+
+ dis = devctl_queue_length == 0;
+ error = sysctl_handle_int(oidp, &dis, 0, req);
+ if (error || !req->newptr)
+ return (error);
+ mtx_lock(&devsoftc.mtx);
+ if (dis) {
+ while (!TAILQ_EMPTY(&devsoftc.devq)) {
+ n1 = TAILQ_FIRST(&devsoftc.devq);
+ TAILQ_REMOVE(&devsoftc.devq, n1, dei_link);
+ free(n1->dei_data, M_BUS);
+ free(n1, M_BUS);
+ }
+ devsoftc.queued = 0;
+ devctl_queue_length = 0;
+ } else {
+ devctl_queue_length = DEVCTL_DEFAULT_QUEUE_LEN;
+ }
+ mtx_unlock(&devsoftc.mtx);
+ return (0);
+}
+
+static int
sysctl_devctl_queue(SYSCTL_HANDLER_ARGS)
{
struct dev_event_info *n1;
Modified: projects/random_number_generator/sys/modules/Makefile
==============================================================================
--- projects/random_number_generator/sys/modules/Makefile Tue Apr 29 07:19:22 2014 (r265086)
+++ projects/random_number_generator/sys/modules/Makefile Tue Apr 29 07:29:13 2014 (r265087)
@@ -273,6 +273,7 @@ SUBDIR= \
ppi \
pps \
procfs \
+ proto \
pseudofs \
${_pst} \
pty \
Modified: projects/random_number_generator/usr.sbin/bhyve/bhyverun.c
==============================================================================
--- projects/random_number_generator/usr.sbin/bhyve/bhyverun.c Tue Apr 29 07:19:22 2014 (r265086)
+++ projects/random_number_generator/usr.sbin/bhyve/bhyverun.c Tue Apr 29 07:29:13 2014 (r265087)
@@ -461,17 +461,18 @@ vmexit_inst_emul(struct vmctx *ctx, stru
static pthread_mutex_t resetcpu_mtx = PTHREAD_MUTEX_INITIALIZER;
static pthread_cond_t resetcpu_cond = PTHREAD_COND_INITIALIZER;
-static int resetcpu = -1;
static int
vmexit_suspend(struct vmctx *ctx, struct vm_exit *vmexit, int *pvcpu)
{
-
- assert(resetcpu != -1);
+ enum vm_suspend_how how;
+
+ how = vmexit->u.suspended.how;
+ assert(how == VM_SUSPEND_RESET || how == VM_SUSPEND_POWEROFF);
fbsdrun_deletecpu(ctx, *pvcpu);
- if (*pvcpu != resetcpu) {
+ if (*pvcpu != BSP) {
pthread_mutex_lock(&resetcpu_mtx);
pthread_cond_signal(&resetcpu_cond);
pthread_mutex_unlock(&resetcpu_mtx);
@@ -483,7 +484,12 @@ vmexit_suspend(struct vmctx *ctx, struct
pthread_cond_wait(&resetcpu_cond, &resetcpu_mtx);
}
pthread_mutex_unlock(&resetcpu_mtx);
- exit(0);
+
+ if (how == VM_SUSPEND_RESET)
+ exit(0);
+ if (how == VM_SUSPEND_POWEROFF)
+ exit(1);
+ return (0); /* NOTREACHED */
}
static vmexit_handler_t handler[VM_EXITCODE_MAX] = {
@@ -505,6 +511,7 @@ vm_loop(struct vmctx *ctx, int vcpu, uin
cpuset_t mask;
int error, rc, prevcpu;
enum vm_exitcode exitcode;
+ enum vm_suspend_how how;
if (pincpu >= 0) {
CPU_ZERO(&mask);
@@ -538,10 +545,13 @@ vm_loop(struct vmctx *ctx, int vcpu, uin
rip = vmexit[vcpu].rip;
break;
case VMEXIT_RESET:
- if (vm_suspend(ctx) == 0) {
- assert(resetcpu == -1);
- resetcpu = vcpu;
- }
+ case VMEXIT_POWEROFF:
+ if (rc == VMEXIT_RESET)
+ how = VM_SUSPEND_RESET;
+ else
+ how = VM_SUSPEND_POWEROFF;
+ error = vm_suspend(ctx, how);
+ assert(error == 0 || errno == EALREADY);
rip = vmexit[vcpu].rip + vmexit[vcpu].inst_length;
break;
default:
Modified: projects/random_number_generator/usr.sbin/bhyve/pci_ahci.c
==============================================================================
--- projects/random_number_generator/usr.sbin/bhyve/pci_ahci.c Tue Apr 29 07:19:22 2014 (r265086)
+++ projects/random_number_generator/usr.sbin/bhyve/pci_ahci.c Tue Apr 29 07:29:13 2014 (r265087)
@@ -192,6 +192,7 @@ struct pci_ahci_softc {
uint32_t em_ctl;
uint32_t cap2;
uint32_t bohc;
+ uint32_t lintr;
struct ahci_port port[MAX_PORTS];
};
#define ahci_ctx(sc) ((sc)->asc_pi->pi_vmctx)
@@ -211,8 +212,11 @@ static inline void lba_to_msf(uint8_t *b
static void
ahci_generate_intr(struct pci_ahci_softc *sc)
{
+ struct pci_devinst *pi;
int i;
+ pi = sc->asc_pi;
+
for (i = 0; i < sc->ports; i++) {
struct ahci_port *pr;
pr = &sc->port[i];
@@ -222,8 +226,28 @@ ahci_generate_intr(struct pci_ahci_softc
DPRINTF("%s %x\n", __func__, sc->is);
- if (sc->is && (sc->ghc & AHCI_GHC_IE))
- pci_generate_msi(sc->asc_pi, 0);
+ if (sc->is && (sc->ghc & AHCI_GHC_IE)) {
+ if (pci_msi_enabled(pi)) {
+ /*
+ * Generate an MSI interrupt on every edge
+ */
+ pci_generate_msi(pi, 0);
+ } else if (!sc->lintr) {
+ /*
+ * Only generate a pin-based interrupt if one wasn't
+ * in progress
+ */
+ sc->lintr = 1;
+ pci_lintr_assert(pi);
+ }
+ } else if (sc->lintr) {
+ /*
+ * No interrupts: deassert pin-based signal if it had
+ * been asserted
+ */
+ pci_lintr_deassert(pi);
+ sc->lintr = 0;
+ }
}
static void
@@ -367,6 +391,12 @@ ahci_reset(struct pci_ahci_softc *sc)
sc->ghc = AHCI_GHC_AE;
sc->is = 0;
+
+ if (sc->lintr) {
+ pci_lintr_deassert(sc->asc_pi);
+ sc->lintr = 0;
+ }
+
for (i = 0; i < sc->ports; i++) {
sc->port[i].ie = 0;
sc->port[i].is = 0;
@@ -1814,6 +1844,8 @@ pci_ahci_init(struct vmctx *ctx, struct
pci_emul_alloc_bar(pi, 5, PCIBAR_MEM32,
AHCI_OFFSET + sc->ports * AHCI_STEP);
+ pci_lintr_request(pi);
+
open_fail:
if (ret) {
blockif_close(sc->port[0].bctx);
Modified: projects/random_number_generator/usr.sbin/bhyvectl/bhyvectl.c
==============================================================================
--- projects/random_number_generator/usr.sbin/bhyvectl/bhyvectl.c Tue Apr 29 07:19:22 2014 (r265086)
+++ projects/random_number_generator/usr.sbin/bhyvectl/bhyvectl.c Tue Apr 29 07:29:13 2014 (r265087)
@@ -191,13 +191,16 @@ usage(void)
" [--get-highmem]\n"
" [--get-gpa-pmap]\n"
" [--assert-lapic-lvt=<pin>]\n"
- " [--inject-nmi]\n",
+ " [--inject-nmi]\n"
+ " [--force-reset]\n"
+ " [--force-poweroff]\n",
progname);
exit(1);
}
static int get_stats, getcap, setcap, capval, get_gpa_pmap;
static int inject_nmi, assert_lapic_lvt;
+static int force_reset, force_poweroff;
static const char *capname;
static int create, destroy, get_lowmem, get_highmem;
static uint64_t memsize;
@@ -565,6 +568,8 @@ main(int argc, char *argv[])
{ "create", NO_ARG, &create, 1 },
{ "destroy", NO_ARG, &destroy, 1 },
{ "inject-nmi", NO_ARG, &inject_nmi, 1 },
+ { "force-reset", NO_ARG, &force_reset, 1 },
+ { "force-poweroff", NO_ARG, &force_poweroff, 1 },
{ NULL, 0, NULL, 0 }
};
@@ -1535,6 +1540,12 @@ main(int argc, char *argv[])
printf("vm_run error %d\n", error);
}
+ if (!error && force_reset)
+ error = vm_suspend(ctx, VM_SUSPEND_RESET);
+
+ if (!error && force_poweroff)
+ error = vm_suspend(ctx, VM_SUSPEND_POWEROFF);
+
if (error)
printf("errno = %d\n", errno);
Modified: projects/random_number_generator/usr.sbin/pmcstat/pmcstat.8
==============================================================================
--- projects/random_number_generator/usr.sbin/pmcstat/pmcstat.8 Tue Apr 29 07:19:22 2014 (r265086)
+++ projects/random_number_generator/usr.sbin/pmcstat/pmcstat.8 Tue Apr 29 07:29:13 2014 (r265087)
@@ -25,7 +25,7 @@
.\"
.\" $FreeBSD$
.\"
-.Dd September 19, 2008
+.Dd April 29, 2014
.Dt PMCSTAT 8
.Os
.Sh NAME
@@ -46,6 +46,7 @@
.Op Fl S Ar event-spec
.Op Fl T
.Op Fl W
+.Op Fl a Ar pathname
.Op Fl c Ar cpu-spec
.Op Fl d
.Op Fl f Ar pluginopt
@@ -221,6 +222,21 @@ This is an experimental feature intended
dynamic behaviour of processes in the system.
It may incur substantial overhead if enabled.
The default is for this feature to be disabled.
+.It Fl a Ar pathname
+Perform a symbol and file:line lookup for each address in each
+callgraph and save the output to
+.Ar pathname .
+Unlike
+.Fl m
+that only resolves the first symbol in the graph, this resolves
+every node in the callgraph, or prints out addresses if no
+lookup information is available.
+This option requires the
+.Fl R
+option to read in samples that were previously collected and
+saved with the
+.Fl o
+option.
.It Fl c Ar cpu-spec
Set the cpus for subsequent system mode PMCs specified on the
command line to
Modified: projects/random_number_generator/usr.sbin/pmcstat/pmcstat.c
==============================================================================
--- projects/random_number_generator/usr.sbin/pmcstat/pmcstat.c Tue Apr 29 07:19:22 2014 (r265086)
+++ projects/random_number_generator/usr.sbin/pmcstat/pmcstat.c Tue Apr 29 07:29:13 2014 (r265087)
@@ -503,7 +503,7 @@ pmcstat_show_usage(void)
"\t -S spec\t allocate a system-wide sampling PMC\n"
"\t -T\t\t start in top mode\n"
"\t -W\t\t (toggle) show counts per context switch\n"
- "\t -a <file>\t print sampled PCs and callgraph to \"file\"\n"
+ "\t -a file\t print sampled PCs and callgraph to \"file\"\n"
"\t -c cpu-list\t set cpus for subsequent system-wide PMCs\n"
"\t -d\t\t (toggle) track descendants\n"
"\t -f spec\t pass \"spec\" to as plugin option\n"
More information about the svn-src-projects
mailing list