Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion usr/src/cmd/bhyve/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ SRCS = acpi.c \
rfb.c \
rtc.c \
smbiostbl.c \
sol_lock.c \
sockstream.c \
task_switch.c \
uart_emul.c \
Expand All @@ -87,7 +88,7 @@ ZHYVE_PROG = zhyve
ZHYVE = $(ZHYVE_DIR)/$(ZHYVE_PROG)

MEVENT_TEST_PROG = mevent_test
MEVENT_TEST_SRCS = mevent.c mevent_test.c
MEVENT_TEST_SRCS = mevent.c mevent_test.c sol_lock.c
MEVENT_TEST_OBJS = $(MEVENT_TEST_SRCS:.c=.o)

CLEANFILES = $(PROG) $(ZHYVE_PROG) $(MEVENT_TEST_PROG) $(MEVENT_TEST_OBJS)
Expand Down
5 changes: 5 additions & 0 deletions usr/src/cmd/bhyve/atkbdc.c
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
/*-
* Copyright (c) 2014 Tycho Nightingale <[email protected]>
* Copyright (c) 2015 Nahanni Systems Inc.
* Copyright 2018 Joyent, Inc.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
Expand Down Expand Up @@ -44,6 +45,10 @@ __FBSDID("$FreeBSD$");
#include <pthread.h>
#include <pthread_np.h>

#ifndef __FreeBSD__
#include "sol_lock.h"
#endif

#include "acpi.h"
#include "inout.h"
#include "pci_emul.h"
Expand Down
7 changes: 6 additions & 1 deletion usr/src/cmd/bhyve/bhyverun.c
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ __FBSDID("$FreeBSD$");

#ifndef __FreeBSD__
#include <sys/stat.h>
#include "sol_lock.h"
#endif

#include "bhyverun.h"
Expand Down Expand Up @@ -134,7 +135,7 @@ static const int BSP = 0;
#ifndef __FreeBSD__
int bcons_wait = 0;
int bcons_connected = 0;
pthread_mutex_t bcons_wait_lock = PTHREAD_MUTEX_INITIALIZER;
pthread_mutex_t bcons_wait_lock = PTHREAD_ERRORCHECK_MUTEX_INITIALIZER_NP;
pthread_cond_t bcons_wait_done = PTHREAD_COND_INITIALIZER;
#endif

Expand Down Expand Up @@ -713,7 +714,11 @@ vmexit_inst_emul(struct vmctx *ctx, struct vm_exit *vmexit, int *pvcpu)
return (VMEXIT_CONTINUE);
}

#ifdef __FreeBSD__
static pthread_mutex_t resetcpu_mtx = PTHREAD_MUTEX_INITIALIZER;
#else
static pthread_mutex_t resetcpu_mtx = PTHREAD_ERRORCHECK_MUTEX_INITIALIZER_NP;
#endif
static pthread_cond_t resetcpu_cond = PTHREAD_COND_INITIALIZER;

static int
Expand Down
3 changes: 3 additions & 0 deletions usr/src/cmd/bhyve/block_if.c
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
* SPDX-License-Identifier: BSD-2-Clause-FreeBSD
*
* Copyright (c) 2013 Peter Grehan <[email protected]>
* Copyritht 2018 Joyent, Inc.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
Expand Down Expand Up @@ -60,6 +61,8 @@ __FBSDID("$FreeBSD$");
#include "bhyverun.h"
#ifdef __FreeBSD__
#include "mevent.h"
#else
#include "sol_lock.h"
#endif
#include "block_if.h"

Expand Down
5 changes: 5 additions & 0 deletions usr/src/cmd/bhyve/gdb.c
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
* SPDX-License-Identifier: BSD-2-Clause-FreeBSD
*
* Copyright (c) 2017-2018 John H. Baldwin <[email protected]>
* Copyright 2018 Joyent, Inc.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
Expand Down Expand Up @@ -57,6 +58,10 @@ __FBSDID("$FreeBSD$");
#include <unistd.h>
#include <vmmapi.h>

#ifndef __FreeBSD__
#include "sol_lock.h"
#endif

#include "bhyverun.h"
#include "mem.h"
#include "mevent.h"
Expand Down
10 changes: 8 additions & 2 deletions usr/src/cmd/bhyve/mevent.c
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,10 @@ __FBSDID("$FreeBSD$");
#include <pthread.h>
#include <pthread_np.h>

#ifndef __FreeBSD__
#include "sol_lock.h"
#endif

#include "mevent.h"

#define MEVENT_MAX 64
Expand All @@ -80,7 +84,11 @@ extern char *vmname;
static pthread_t mevent_tid;
static int mevent_timid = 43;
static int mevent_pipefd[2];
#ifdef __FreeBSD__
static pthread_mutex_t mevent_lmutex = PTHREAD_MUTEX_INITIALIZER;
#else
static pthread_mutex_t mevent_lmutex = PTHREAD_ERRORCHECK_MUTEX_INITIALIZER_NP;
#endif

struct mevent {
void (*me_func)(int, enum ev_type, void *);
Expand Down Expand Up @@ -403,8 +411,6 @@ mevent_handle_pe(port_event_t *pe)
{
struct mevent *mevp = pe->portev_user;

mevent_qunlock();

(*mevp->me_func)(mevp->me_fd, mevp->me_type, mevp->me_param);

mevent_qlock();
Expand Down
8 changes: 8 additions & 0 deletions usr/src/cmd/bhyve/mevent_test.c
Original file line number Diff line number Diff line change
Expand Up @@ -55,11 +55,19 @@
#include <pthread.h>
#include <unistd.h>

#ifndef __FreeBSD__
#include "sol_lock.h"
#endif

#include "mevent.h"

#define TEST_PORT 4321

#ifdef __FreeBSD__
static pthread_mutex_t accept_mutex = PTHREAD_MUTEX_INITIALIZER;
#else
static pthread_mutex_t accept_mutex = PTHREAD_ERRORCHECK_MUTEX_INITIALIZER_NP;
#endif
static pthread_cond_t accept_condvar = PTHREAD_COND_INITIALIZER;

static struct mevent *tevp;
Expand Down
5 changes: 5 additions & 0 deletions usr/src/cmd/bhyve/pci_ahci.c
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
*
* Copyright (c) 2013 Zhixiang Yu <[email protected]>
* Copyright (c) 2015-2016 Alexander Motin <[email protected]>
* Copyright 2018 Joyent, Inc.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
Expand Down Expand Up @@ -55,6 +56,10 @@ __FBSDID("$FreeBSD$");
#include <inttypes.h>
#include <md5.h>

#ifndef __FreeBSD__
#include "sol_lock.h"
#endif

#include "bhyverun.h"
#include "pci_emul.h"
#include "ahci.h"
Expand Down
5 changes: 5 additions & 0 deletions usr/src/cmd/bhyve/pci_e82545.c
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
* Copyright (c) 2016 Alexander Motin <[email protected]>
* Copyright (c) 2015 Peter Grehan <[email protected]>
* Copyright (c) 2013 Jeremiah Lott, Avere Systems
* Copyright 2018 Joyent, Inc.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
Expand Down Expand Up @@ -56,6 +57,10 @@ __FBSDID("$FreeBSD$");
#include <pthread.h>
#include <pthread_np.h>

#ifndef __FreeBSD__
#include "sol_lock.h"
#endif

#include "e1000_regs.h"
#include "e1000_defines.h"
#include "mii.h"
Expand Down
4 changes: 4 additions & 0 deletions usr/src/cmd/bhyve/pci_emul.c
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,10 @@ __FBSDID("$FreeBSD$");
#include <machine/vmm.h>
#include <vmmapi.h>

#ifndef __FreeBSD__
#include "sol_lock.h"
#endif

#include "acpi.h"
#include "bhyverun.h"
#include "inout.h"
Expand Down
5 changes: 5 additions & 0 deletions usr/src/cmd/bhyve/pci_irq.c
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
/*-
* Copyright (c) 2014 Hudson River Trading LLC
* Written by: John H. Baldwin <[email protected]>
* Copyright 2018 Joyent, Inc.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
Expand Down Expand Up @@ -39,6 +40,10 @@ __FBSDID("$FreeBSD$");
#include <stdlib.h>
#include <vmmapi.h>

#ifndef __FreeBSD__
#include "sol_lock.h"
#endif

#include "acpi.h"
#include "inout.h"
#include "pci_emul.h"
Expand Down
6 changes: 5 additions & 1 deletion usr/src/cmd/bhyve/pci_virtio_block.c
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
* SPDX-License-Identifier: BSD-2-Clause-FreeBSD
*
* Copyright (c) 2011 NetApp, Inc.
* Copyright 2018 Joyent, Inc.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
Expand Down Expand Up @@ -38,7 +39,6 @@
* http://www.illumos.org/license/CDDL.
*
* Copyright 2014 Pluribus Networks Inc.
* Copyright 2017 Joyent, Inc.
*/

#include <sys/cdefs.h>
Expand All @@ -63,6 +63,10 @@ __FBSDID("$FreeBSD$");
#include <pthread.h>
#include <md5.h>

#ifndef __FreeBSD__
#include "sol_lock.h"
#endif

#include "bhyverun.h"
#include "pci_emul.h"
#include "virtio.h"
Expand Down
3 changes: 2 additions & 1 deletion usr/src/cmd/bhyve/pci_virtio_net.c
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
* SPDX-License-Identifier: BSD-2-Clause-FreeBSD
*
* Copyright (c) 2011 NetApp, Inc.
* Copyright 2018 Joyent, Inc.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
Expand Down Expand Up @@ -38,7 +39,6 @@
* http://www.illumos.org/license/CDDL.
*
* Copyright 2013 Pluribus Networks Inc.
* Copyright 2017 Joyent, Inc.
*/

#include <sys/cdefs.h>
Expand Down Expand Up @@ -78,6 +78,7 @@ __FBSDID("$FreeBSD$");
#ifndef __FreeBSD__
#include <poll.h>
#include <libdlpi.h>
#include "sol_lock.h"
#endif

#include "bhyverun.h"
Expand Down
4 changes: 4 additions & 0 deletions usr/src/cmd/bhyve/pci_virtio_viona.c
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,10 @@
#include <machine/vmm.h>
#include <vmmapi.h>

#ifndef __FreeBSD__
#include "sol_lock.h"
#endif

#include "bhyverun.h"
#include "pci_emul.h"
#include "virtio.h"
Expand Down
4 changes: 4 additions & 0 deletions usr/src/cmd/bhyve/pci_xhci.c
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,10 @@ __FBSDID("$FreeBSD$");
#include <dev/usb/usb_freebsd.h>
#include <xhcireg.h>

#ifndef __FreeBSD__
#include "sol_lock.h"
#endif

#include "bhyverun.h"
#include "pci_emul.h"
#include "pci_xhci.h"
Expand Down
7 changes: 6 additions & 1 deletion usr/src/cmd/bhyve/pm.c
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,10 @@ __FBSDID("$FreeBSD$");
#include <signal.h>
#include <vmmapi.h>

#ifndef __FreeBSD__
#include "sol_lock.h"
#endif

#include "acpi.h"
#include "inout.h"
#ifdef __FreeBSD__
Expand All @@ -53,11 +57,12 @@ __FBSDID("$FreeBSD$");
#include "pci_irq.h"
#include "pci_lpc.h"

static pthread_mutex_t pm_lock = PTHREAD_MUTEX_INITIALIZER;
#ifdef __FreeBSD__
static pthread_mutex_t pm_lock = PTHREAD_MUTEX_INITIALIZER;
static struct mevent *power_button;
static sig_t old_power_handler;
#else
static pthread_mutex_t pm_lock = PTHREAD_ERRORCHECK_MUTEX_INITIALIZER_NP;
struct vmctx *pwr_ctx;
#endif

Expand Down
5 changes: 5 additions & 0 deletions usr/src/cmd/bhyve/ps2kbd.c
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
/*-
* Copyright (c) 2015 Tycho Nightingale <[email protected]>
* Copyright (c) 2015 Nahanni Systems Inc.
* Copyright 2018 Joyent, Inc.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
Expand Down Expand Up @@ -38,6 +39,10 @@ __FBSDID("$FreeBSD$");
#include <pthread.h>
#include <pthread_np.h>

#ifndef __FreeBSD__
#include "sol_lock.h"
#endif

#include "atkbdc.h"
#include "console.h"

Expand Down
5 changes: 5 additions & 0 deletions usr/src/cmd/bhyve/ps2mouse.c
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
/*-
* Copyright (c) 2015 Tycho Nightingale <[email protected]>
* Copyright (c) 2015 Nahanni Systems Inc.
* Copyright 2018 Joyent, Inc.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
Expand Down Expand Up @@ -38,6 +39,10 @@ __FBSDID("$FreeBSD$");
#include <pthread.h>
#include <pthread_np.h>

#ifndef __FreeBSD__
#include "sol_lock.h"
#endif

#include "atkbdc.h"
#include "console.h"

Expand Down
1 change: 1 addition & 0 deletions usr/src/cmd/bhyve/rfb.c
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ __FBSDID("$FreeBSD$");

#ifndef __FreeBSD__
#include <sys/debug.h>
#include "sol_lock.h"
#endif

#include "bhyvegc.h"
Expand Down
Loading