Page MenuHomeFreeBSD

D6745.id17398.diff
No OneTemporary

D6745.id17398.diff

Index: head/sys/dev/hyperv/vmbus/hv_channel.c
===================================================================
--- head/sys/dev/hyperv/vmbus/hv_channel.c
+++ head/sys/dev/hyperv/vmbus/hv_channel.c
@@ -37,12 +37,16 @@
#include <sys/lock.h>
#include <sys/mutex.h>
#include <sys/sysctl.h>
+
+#include <machine/atomic.h>
#include <machine/bus.h>
+
#include <vm/vm.h>
#include <vm/vm_param.h>
#include <vm/pmap.h>
#include <dev/hyperv/vmbus/hv_vmbus_priv.h>
+#include <dev/hyperv/vmbus/vmbus_reg.h>
#include <dev/hyperv/vmbus/vmbus_var.h>
static int vmbus_channel_create_gpadl_header(
@@ -65,11 +69,11 @@
if (channel->offer_msg.monitor_allocated) {
struct vmbus_softc *sc = vmbus_get_softc();
hv_vmbus_monitor_page *monitor_page;
+ uint32_t chanid = channel->offer_msg.child_rel_id;
- /* Each uint32_t represents 32 channels */
- synch_set_bit((channel->offer_msg.child_rel_id & 31),
- ((uint32_t *)sc->vmbus_tx_evtflags
- + ((channel->offer_msg.child_rel_id >> 5))));
+ atomic_set_long(
+ &sc->vmbus_tx_evtflags[chanid >> VMBUS_EVTFLAG_SHIFT],
+ 1UL << (chanid & VMBUS_EVTFLAG_MASK));
monitor_page = sc->vmbus_mnf2;
synch_set_bit(channel->monitor_bit,
Index: head/sys/dev/hyperv/vmbus/hv_connection.c
===================================================================
--- head/sys/dev/hyperv/vmbus/hv_connection.c
+++ head/sys/dev/hyperv/vmbus/hv_connection.c
@@ -353,12 +353,10 @@
{
struct vmbus_softc *sc = vmbus_get_softc();
int ret = 0;
- uint32_t child_rel_id = channel->offer_msg.child_rel_id;
+ uint32_t chanid = channel->offer_msg.child_rel_id;
- /* Each uint32_t represents 32 channels */
-
- synch_set_bit(child_rel_id & 31,
- (((uint32_t *)sc->vmbus_tx_evtflags + (child_rel_id >> 5))));
+ atomic_set_long(&sc->vmbus_tx_evtflags[chanid >> VMBUS_EVTFLAG_SHIFT],
+ 1UL << (chanid & VMBUS_EVTFLAG_MASK));
ret = hv_vmbus_signal_event(channel->signal_event_param);
return (ret);
Index: head/sys/dev/hyperv/vmbus/vmbus.c
===================================================================
--- head/sys/dev/hyperv/vmbus/vmbus.c
+++ head/sys/dev/hyperv/vmbus/vmbus.c
@@ -340,7 +340,7 @@
if (evtflags == NULL)
return ENOMEM;
sc->vmbus_rx_evtflags = (u_long *)evtflags;
- sc->vmbus_tx_evtflags = evtflags + (PAGE_SIZE / 2);
+ sc->vmbus_tx_evtflags = (u_long *)(evtflags + (PAGE_SIZE / 2));
sc->vmbus_evtflags = evtflags;
sc->vmbus_mnf1 = hyperv_dmamem_alloc(parent_dtag, PAGE_SIZE, 0,
Index: head/sys/dev/hyperv/vmbus/vmbus_reg.h
===================================================================
--- head/sys/dev/hyperv/vmbus/vmbus_reg.h
+++ head/sys/dev/hyperv/vmbus/vmbus_reg.h
@@ -66,6 +66,7 @@
#define VMBUS_EVTFLAG_SHIFT 5
#endif
#define VMBUS_EVTFLAG_LEN (1 << VMBUS_EVTFLAG_SHIFT)
+#define VMBUS_EVTFLAG_MASK (VMBUS_EVTFLAG_LEN - 1)
#define VMBUS_EVTFLAGS_SIZE 256
struct vmbus_evtflags {
Index: head/sys/dev/hyperv/vmbus/vmbus_var.h
===================================================================
--- head/sys/dev/hyperv/vmbus/vmbus_var.h
+++ head/sys/dev/hyperv/vmbus/vmbus_var.h
@@ -63,7 +63,7 @@
struct vmbus_softc {
void (*vmbus_event_proc)(struct vmbus_softc *, int);
- void *vmbus_tx_evtflags;
+ u_long *vmbus_tx_evtflags;
/* event flags to host */
void *vmbus_mnf2; /* monitored by host */

File Metadata

Mime Type
text/plain
Expires
Tue, Apr 21, 3:04 AM (10 h, 55 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
31883326
Default Alt Text
D6745.id17398.diff (3 KB)

Event Timeline