Page MenuHomeFreeBSD

D8488.diff
No OneTemporary

D8488.diff

Index: head/sys/dev/hyperv/include/vmbus_xact.h
===================================================================
--- head/sys/dev/hyperv/include/vmbus_xact.h
+++ head/sys/dev/hyperv/include/vmbus_xact.h
@@ -51,6 +51,8 @@
void vmbus_xact_deactivate(struct vmbus_xact *xact);
const void *vmbus_xact_wait(struct vmbus_xact *xact,
size_t *resp_len);
+const void *vmbus_xact_busywait(struct vmbus_xact *xact,
+ size_t *resp_len);
void vmbus_xact_wakeup(struct vmbus_xact *xact,
const void *data, size_t dlen);
void vmbus_xact_ctx_wakeup(struct vmbus_xact_ctx *ctx,
Index: head/sys/dev/hyperv/vmbus/vmbus_xact.c
===================================================================
--- head/sys/dev/hyperv/vmbus/vmbus_xact.c
+++ head/sys/dev/hyperv/vmbus/vmbus_xact.c
@@ -69,6 +69,8 @@
static void vmbus_xact_free(struct vmbus_xact *);
static struct vmbus_xact *vmbus_xact_get1(struct vmbus_xact_ctx *,
uint32_t);
+const void *vmbus_xact_wait1(struct vmbus_xact *, size_t *,
+ bool);
static struct vmbus_xact *
vmbus_xact_alloc(struct vmbus_xact_ctx *ctx, bus_dma_tag_t parent_dtag)
@@ -249,7 +251,8 @@
}
const void *
-vmbus_xact_wait(struct vmbus_xact *xact, size_t *resp_len)
+vmbus_xact_wait1(struct vmbus_xact *xact, size_t *resp_len,
+ bool can_sleep)
{
struct vmbus_xact_ctx *ctx = xact->x_ctx;
const void *resp;
@@ -258,8 +261,14 @@
KASSERT(ctx->xc_active == xact, ("xact mismatch"));
while (xact->x_resp == NULL) {
- mtx_sleep(&ctx->xc_active, &ctx->xc_active_lock, 0,
- "wxact", 0);
+ if (can_sleep) {
+ mtx_sleep(&ctx->xc_active, &ctx->xc_active_lock, 0,
+ "wxact", 0);
+ } else {
+ mtx_unlock(&ctx->xc_active_lock);
+ DELAY(1000);
+ mtx_lock(&ctx->xc_active_lock);
+ }
}
ctx->xc_active = NULL;
@@ -271,6 +280,20 @@
return (resp);
}
+const void *
+vmbus_xact_wait(struct vmbus_xact *xact, size_t *resp_len)
+{
+
+ return (vmbus_xact_wait1(xact, resp_len, true /* can sleep */));
+}
+
+const void *
+vmbus_xact_busywait(struct vmbus_xact *xact, size_t *resp_len)
+{
+
+ return (vmbus_xact_wait1(xact, resp_len, false /* can't sleep */));
+}
+
static void
vmbus_xact_save_resp(struct vmbus_xact *xact, const void *data, size_t dlen)
{

File Metadata

Mime Type
text/plain
Expires
Thu, Dec 26, 12:33 PM (12 h, 39 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
15604761
Default Alt Text
D8488.diff (2 KB)

Event Timeline