svn commit: r311356 - in stable/11/sys/dev/hyperv: include vmbus
Sepherosa Ziehau
sephe at FreeBSD.org
Thu Jan 5 03:32:15 UTC 2017
Author: sephe
Date: Thu Jan 5 03:32:13 2017
New Revision: 311356
URL: https://svnweb.freebsd.org/changeset/base/311356
Log:
MFC 308906
hyperv/vmbus: Support transction result busy-wait.
Sponsored by: Microsoft
Differential Revision: https://reviews.freebsd.org/D8488
Modified:
stable/11/sys/dev/hyperv/include/vmbus_xact.h
stable/11/sys/dev/hyperv/vmbus/vmbus_xact.c
Directory Properties:
stable/11/ (props changed)
Modified: stable/11/sys/dev/hyperv/include/vmbus_xact.h
==============================================================================
--- stable/11/sys/dev/hyperv/include/vmbus_xact.h Thu Jan 5 03:25:38 2017 (r311355)
+++ stable/11/sys/dev/hyperv/include/vmbus_xact.h Thu Jan 5 03:32:13 2017 (r311356)
@@ -51,6 +51,8 @@ void vmbus_xact_activate(struct vmbus_
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,
Modified: stable/11/sys/dev/hyperv/vmbus/vmbus_xact.c
==============================================================================
--- stable/11/sys/dev/hyperv/vmbus/vmbus_xact.c Thu Jan 5 03:25:38 2017 (r311355)
+++ stable/11/sys/dev/hyperv/vmbus/vmbus_xact.c Thu Jan 5 03:32:13 2017 (r311356)
@@ -69,6 +69,8 @@ static struct vmbus_xact *vmbus_xact_all
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 @@ vmbus_xact_deactivate(struct vmbus_xact
}
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 @@ vmbus_xact_wait(struct vmbus_xact *xact,
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 @@ vmbus_xact_wait(struct vmbus_xact *xact,
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)
{
More information about the svn-src-stable
mailing list