Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1291611 > unrolled thread
| Started by | "K. Y. Srinivasan" <kys@microsoft.com> |
|---|---|
| First post | 2015-12-14 23:30 +0100 |
| Last post | 2015-12-14 23:50 +0100 |
| Articles | 20 on this page of 33 — 4 participants |
Back to article view | Back to linux.kernel
This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by
below is the oldest one visible, not the original post.
[PATCH RESEND 01/27] Drivers: hv: util: Increase the timeout for util services "K. Y. Srinivasan" <kys@microsoft.com> - 2015-12-14 23:30 +0100
[PATCH RESEND 02/27] Drivers: hv: utils: run polling callback always in interrupt context "K. Y. Srinivasan" <kys@microsoft.com> - 2015-12-14 23:30 +0100
[PATCH RESEND 03/27] tools: hv: report ENOSPC errors in hv_fcopy_daemon "K. Y. Srinivasan" <kys@microsoft.com> - 2015-12-14 23:30 +0100
[PATCH RESEND 06/27] Drivers: hv: utils: use memdup_user in hvt_op_write "K. Y. Srinivasan" <kys@microsoft.com> - 2015-12-14 23:30 +0100
[PATCH RESEND 04/27] tools: hv: remove repeated HV_FCOPY string "K. Y. Srinivasan" <kys@microsoft.com> - 2015-12-14 23:30 +0100
[PATCH RESEND 10/27] drivers:hv: Define the channel type for Hyper-V PCI Express pass-through "K. Y. Srinivasan" <kys@microsoft.com> - 2015-12-14 23:40 +0100
[PATCH RESEND 09/27] drivers:hv: Export the API to invoke a hypercall on Hyper-V "K. Y. Srinivasan" <kys@microsoft.com> - 2015-12-14 23:40 +0100
Re: [PATCH RESEND 09/27] drivers:hv: Export the API to invoke a hypercall on Hyper-V Greg KH <gregkh@linuxfoundation.org> - 2015-12-15 04:10 +0100
RE: [PATCH RESEND 09/27] drivers:hv: Export the API to invoke a hypercall on Hyper-V KY Srinivasan <kys@microsoft.com> - 2015-12-15 05:20 +0100
[PATCH RESEND 14/27] Drivers: hv: vmbus: Get rid of the unused macro "K. Y. Srinivasan" <kys@microsoft.com> - 2015-12-14 23:40 +0100
[PATCH RESEND 20/27] Drivers: hv: vmbus: channge vmbus_connection.channel_lock to mutex "K. Y. Srinivasan" <kys@microsoft.com> - 2015-12-14 23:40 +0100
[PATCH RESEND 26/27] Drivers: hv: utils: Invoke the poll function after handshake "K. Y. Srinivasan" <kys@microsoft.com> - 2015-12-14 23:40 +0100
[PATCH RESEND 05/27] Drivers: hv: util: catch allocation errors "K. Y. Srinivasan" <kys@microsoft.com> - 2015-12-14 23:40 +0100
[PATCH RESEND 08/27] drivers:hv: Export a function that maps Linux CPU num onto Hyper-V proc num "K. Y. Srinivasan" <kys@microsoft.com> - 2015-12-14 23:40 +0100
[PATCH RESEND 07/27] drivers/hv: cleanup synic msrs if vmbus connect failed "K. Y. Srinivasan" <kys@microsoft.com> - 2015-12-14 23:40 +0100
[PATCH RESEND 22/27] tools/hv: Use include/uapi with __EXPORTED_HEADERS__ "K. Y. Srinivasan" <kys@microsoft.com> - 2015-12-14 23:40 +0100
Re: [PATCH RESEND 22/27] tools/hv: Use include/uapi with __EXPORTED_HEADERS__ Greg KH <gregkh@linuxfoundation.org> - 2015-12-15 04:20 +0100
Re: [PATCH RESEND 22/27] tools/hv: Use include/uapi with __EXPORTED_HEADERS__ Kamal Mostafa <kamal@canonical.com> - 2015-12-15 19:20 +0100
[PATCH v2] tools/hv: Use include/uapi with __EXPORTED_HEADERS__ Kamal Mostafa <kamal@canonical.com> - 2015-12-15 19:30 +0100
Re: [PATCH v2] tools/hv: Use include/uapi with __EXPORTED_HEADERS__ Greg KH <gregkh@linuxfoundation.org> - 2015-12-15 19:50 +0100
[PATCH RESEND 25/27] Drivers: hv: vmbus: Force all channel messages to be delivered on CPU 0 "K. Y. Srinivasan" <kys@microsoft.com> - 2015-12-14 23:40 +0100
[PATCH RESEND 21/27] drivers:hv: Allow for MMIO claims that span ACPI _CRS records "K. Y. Srinivasan" <kys@microsoft.com> - 2015-12-14 23:40 +0100
[PATCH RESEND 24/27] drivers/hv: correct tsc page sequence invalid value "K. Y. Srinivasan" <kys@microsoft.com> - 2015-12-14 23:40 +0100
[PATCH RESEND 11/27] Drivers: hv: vss: run only on supported host versions "K. Y. Srinivasan" <kys@microsoft.com> - 2015-12-14 23:40 +0100
[PATCH RESEND 27/27] tools: hv: vss: fix the write()'s argument: error -> vss_msg "K. Y. Srinivasan" <kys@microsoft.com> - 2015-12-14 23:40 +0100
[PATCH RESEND 16/27] Drivers: hv: vmbus: serialize process_chn_event() and vmbus_close_internal() "K. Y. Srinivasan" <kys@microsoft.com> - 2015-12-14 23:40 +0100
[PATCH RESEND 18/27] Drivers: hv: vmbus: fix rescind-offer handling for device without a driver "K. Y. Srinivasan" <kys@microsoft.com> - 2015-12-14 23:40 +0100
[PATCH RESEND 19/27] Drivers: hv: vmbus: release relid on error in vmbus_process_offer() "K. Y. Srinivasan" <kys@microsoft.com> - 2015-12-14 23:40 +0100
[PATCH RESEND 23/27] Drivers: hv: vmbus: Fix a Host signaling bug "K. Y. Srinivasan" <kys@microsoft.com> - 2015-12-14 23:40 +0100
[PATCH RESEND 17/27] Drivers: hv: vmbus: do sanity check of channel state in vmbus_close_internal() "K. Y. Srinivasan" <kys@microsoft.com> - 2015-12-14 23:50 +0100
[PATCH RESEND 13/27] Drivers: hv: vmbus: Use uuid_le_cmp() for comparing GUIDs "K. Y. Srinivasan" <kys@microsoft.com> - 2015-12-14 23:50 +0100
[PATCH RESEND 12/27] Drivers: hv: vmbus: Use uuid_le type consistently "K. Y. Srinivasan" <kys@microsoft.com> - 2015-12-14 23:50 +0100
[PATCH RESEND 15/27] Drivers: hv: vmbus: Get rid of the unused irq variable "K. Y. Srinivasan" <kys@microsoft.com> - 2015-12-14 23:50 +0100
Page 1 of 2 [1] 2 Next page →
| From | "K. Y. Srinivasan" <kys@microsoft.com> |
|---|---|
| Date | 2015-12-14 23:30 +0100 |
| Subject | [PATCH RESEND 01/27] Drivers: hv: util: Increase the timeout for util services |
| Message-ID | <qFJN1-3NK-17@gated-at.bofh.it> |
Util services such as KVP and FCOPY need assistance from daemon's running in user space. Increase the timeout so we don't prematurely terminate the transaction in the kernel. Host sets up a 60 second timeout for all util driver transactions. The host will retry the transaction if it times out. Set the guest timeout at 30 seconds. Signed-off-by: K. Y. Srinivasan <kys@microsoft.com> --- drivers/hv/hv_fcopy.c | 3 ++- drivers/hv/hv_kvp.c | 3 ++- drivers/hv/hyperv_vmbus.h | 5 +++++ 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/drivers/hv/hv_fcopy.c b/drivers/hv/hv_fcopy.c index db4b887..bbdec50 100644 --- a/drivers/hv/hv_fcopy.c +++ b/drivers/hv/hv_fcopy.c @@ -275,7 +275,8 @@ void hv_fcopy_onchannelcallback(void *context) * Send the information to the user-level daemon. */ schedule_work(&fcopy_send_work); - schedule_delayed_work(&fcopy_timeout_work, 5*HZ); + schedule_delayed_work(&fcopy_timeout_work, + HV_UTIL_TIMEOUT * HZ); return; } icmsghdr->icflags = ICMSGHDRFLAG_TRANSACTION | ICMSGHDRFLAG_RESPONSE; diff --git a/drivers/hv/hv_kvp.c b/drivers/hv/hv_kvp.c index 74c38a9..e6aa33a 100644 --- a/drivers/hv/hv_kvp.c +++ b/drivers/hv/hv_kvp.c @@ -668,7 +668,8 @@ void hv_kvp_onchannelcallback(void *context) * user-mode not responding. */ schedule_work(&kvp_sendkey_work); - schedule_delayed_work(&kvp_timeout_work, 5*HZ); + schedule_delayed_work(&kvp_timeout_work, + HV_UTIL_TIMEOUT * HZ); return; diff --git a/drivers/hv/hyperv_vmbus.h b/drivers/hv/hyperv_vmbus.h index 3782636..225b96b 100644 --- a/drivers/hv/hyperv_vmbus.h +++ b/drivers/hv/hyperv_vmbus.h @@ -31,6 +31,11 @@ #include <linux/hyperv.h> /* + * Timeout for services such as KVP and fcopy. + */ +#define HV_UTIL_TIMEOUT 30 + +/* * The below CPUID leaves are present if VersionAndFeatures.HypervisorPresent * is set by CPUID(HVCPUID_VERSION_FEATURES). */ -- 1.7.4.1 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[toc] | [next] | [standalone]
| From | "K. Y. Srinivasan" <kys@microsoft.com> |
|---|---|
| Date | 2015-12-14 23:30 +0100 |
| Subject | [PATCH RESEND 02/27] Drivers: hv: utils: run polling callback always in interrupt context |
| Message-ID | <qFJN1-3NK-25@gated-at.bofh.it> |
| In reply to | #1291611 |
From: Olaf Hering <olaf@aepfle.de>
All channel interrupts are bound to specific VCPUs in the guest
at the point channel is created. While currently, we invoke the
polling function on the correct CPU (the CPU to which the channel
is bound to) in some cases we may run the polling function in
a non-interrupt context. This potentially can cause an issue as the
polling function can be interrupted by the channel callback function.
Fix the issue by running the polling function on the appropriate CPU
at interrupt level. Additional details of the issue being addressed by
this patch are given below:
Currently hv_fcopy_onchannelcallback is called from interrupts and also
via the ->write function of hv_utils. Since the used global variables to
maintain state are not thread safe the state can get out of sync.
This affects the variable state as well as the channel inbound buffer.
As suggested by KY adjust hv_poll_channel to always run the given
callback on the cpu which the channel is bound to. This avoids the need
for locking because all the util services are single threaded and only
one transaction is active at any given point in time.
Additionally, remove the context variable, they will always be the same as
recv_channel.
Signed-off-by: Olaf Hering <olaf@aepfle.de>
Signed-off-by: K. Y. Srinivasan <kys@microsoft.com>
---
drivers/hv/hv_fcopy.c | 34 ++++++++++++----------------------
drivers/hv/hv_kvp.c | 28 ++++++++++------------------
drivers/hv/hv_snapshot.c | 29 +++++++++++------------------
drivers/hv/hyperv_vmbus.h | 6 +-----
4 files changed, 34 insertions(+), 63 deletions(-)
diff --git a/drivers/hv/hv_fcopy.c b/drivers/hv/hv_fcopy.c
index bbdec50..c37a71e 100644
--- a/drivers/hv/hv_fcopy.c
+++ b/drivers/hv/hv_fcopy.c
@@ -51,7 +51,6 @@ static struct {
struct hv_fcopy_hdr *fcopy_msg; /* current message */
struct vmbus_channel *recv_channel; /* chn we got the request */
u64 recv_req_id; /* request ID. */
- void *fcopy_context; /* for the channel callback */
} fcopy_transaction;
static void fcopy_respond_to_host(int error);
@@ -67,6 +66,13 @@ static struct hvutil_transport *hvt;
*/
static int dm_reg_value;
+static void fcopy_poll_wrapper(void *channel)
+{
+ /* Transaction is finished, reset the state here to avoid races. */
+ fcopy_transaction.state = HVUTIL_READY;
+ hv_fcopy_onchannelcallback(channel);
+}
+
static void fcopy_timeout_func(struct work_struct *dummy)
{
/*
@@ -74,13 +80,7 @@ static void fcopy_timeout_func(struct work_struct *dummy)
* process the pending transaction.
*/
fcopy_respond_to_host(HV_E_FAIL);
-
- /* Transaction is finished, reset the state. */
- if (fcopy_transaction.state > HVUTIL_READY)
- fcopy_transaction.state = HVUTIL_READY;
-
- hv_poll_channel(fcopy_transaction.fcopy_context,
- hv_fcopy_onchannelcallback);
+ hv_poll_channel(fcopy_transaction.recv_channel, fcopy_poll_wrapper);
}
static int fcopy_handle_handshake(u32 version)
@@ -108,9 +108,7 @@ static int fcopy_handle_handshake(u32 version)
return -EINVAL;
}
pr_debug("FCP: userspace daemon ver. %d registered\n", version);
- fcopy_transaction.state = HVUTIL_READY;
- hv_poll_channel(fcopy_transaction.fcopy_context,
- hv_fcopy_onchannelcallback);
+ hv_poll_channel(fcopy_transaction.recv_channel, fcopy_poll_wrapper);
return 0;
}
@@ -227,15 +225,8 @@ void hv_fcopy_onchannelcallback(void *context)
int util_fw_version;
int fcopy_srv_version;
- if (fcopy_transaction.state > HVUTIL_READY) {
- /*
- * We will defer processing this callback once
- * the current transaction is complete.
- */
- fcopy_transaction.fcopy_context = context;
+ if (fcopy_transaction.state > HVUTIL_READY)
return;
- }
- fcopy_transaction.fcopy_context = NULL;
vmbus_recvpacket(channel, recv_buffer, PAGE_SIZE * 2, &recvlen,
&requestid);
@@ -305,9 +296,8 @@ static int fcopy_on_msg(void *msg, int len)
if (cancel_delayed_work_sync(&fcopy_timeout_work)) {
fcopy_transaction.state = HVUTIL_USERSPACE_RECV;
fcopy_respond_to_host(*val);
- fcopy_transaction.state = HVUTIL_READY;
- hv_poll_channel(fcopy_transaction.fcopy_context,
- hv_fcopy_onchannelcallback);
+ hv_poll_channel(fcopy_transaction.recv_channel,
+ fcopy_poll_wrapper);
}
return 0;
diff --git a/drivers/hv/hv_kvp.c b/drivers/hv/hv_kvp.c
index e6aa33a..2a3420c 100644
--- a/drivers/hv/hv_kvp.c
+++ b/drivers/hv/hv_kvp.c
@@ -66,7 +66,6 @@ static struct {
struct hv_kvp_msg *kvp_msg; /* current message */
struct vmbus_channel *recv_channel; /* chn we got the request */
u64 recv_req_id; /* request ID. */
- void *kvp_context; /* for the channel callback */
} kvp_transaction;
/*
@@ -94,6 +93,13 @@ static struct hvutil_transport *hvt;
*/
#define HV_DRV_VERSION "3.1"
+static void kvp_poll_wrapper(void *channel)
+{
+ /* Transaction is finished, reset the state here to avoid races. */
+ kvp_transaction.state = HVUTIL_READY;
+ hv_kvp_onchannelcallback(channel);
+}
+
static void
kvp_register(int reg_value)
{
@@ -121,12 +127,7 @@ static void kvp_timeout_func(struct work_struct *dummy)
*/
kvp_respond_to_host(NULL, HV_E_FAIL);
- /* Transaction is finished, reset the state. */
- if (kvp_transaction.state > HVUTIL_READY)
- kvp_transaction.state = HVUTIL_READY;
-
- hv_poll_channel(kvp_transaction.kvp_context,
- hv_kvp_onchannelcallback);
+ hv_poll_channel(kvp_transaction.recv_channel, kvp_poll_wrapper);
}
static int kvp_handle_handshake(struct hv_kvp_msg *msg)
@@ -218,9 +219,7 @@ static int kvp_on_msg(void *msg, int len)
*/
if (cancel_delayed_work_sync(&kvp_timeout_work)) {
kvp_respond_to_host(message, error);
- kvp_transaction.state = HVUTIL_READY;
- hv_poll_channel(kvp_transaction.kvp_context,
- hv_kvp_onchannelcallback);
+ hv_poll_channel(kvp_transaction.recv_channel, kvp_poll_wrapper);
}
return 0;
@@ -596,15 +595,8 @@ void hv_kvp_onchannelcallback(void *context)
int util_fw_version;
int kvp_srv_version;
- if (kvp_transaction.state > HVUTIL_READY) {
- /*
- * We will defer processing this callback once
- * the current transaction is complete.
- */
- kvp_transaction.kvp_context = context;
+ if (kvp_transaction.state > HVUTIL_READY)
return;
- }
- kvp_transaction.kvp_context = NULL;
vmbus_recvpacket(channel, recv_buffer, PAGE_SIZE * 4, &recvlen,
&requestid);
diff --git a/drivers/hv/hv_snapshot.c b/drivers/hv/hv_snapshot.c
index 815405f..a548ae4 100644
--- a/drivers/hv/hv_snapshot.c
+++ b/drivers/hv/hv_snapshot.c
@@ -53,7 +53,6 @@ static struct {
struct vmbus_channel *recv_channel; /* chn we got the request */
u64 recv_req_id; /* request ID. */
struct hv_vss_msg *msg; /* current message */
- void *vss_context; /* for the channel callback */
} vss_transaction;
@@ -74,6 +73,13 @@ static void vss_timeout_func(struct work_struct *dummy);
static DECLARE_DELAYED_WORK(vss_timeout_work, vss_timeout_func);
static DECLARE_WORK(vss_send_op_work, vss_send_op);
+static void vss_poll_wrapper(void *channel)
+{
+ /* Transaction is finished, reset the state here to avoid races. */
+ vss_transaction.state = HVUTIL_READY;
+ hv_vss_onchannelcallback(channel);
+}
+
/*
* Callback when data is received from user mode.
*/
@@ -86,12 +92,7 @@ static void vss_timeout_func(struct work_struct *dummy)
pr_warn("VSS: timeout waiting for daemon to reply\n");
vss_respond_to_host(HV_E_FAIL);
- /* Transaction is finished, reset the state. */
- if (vss_transaction.state > HVUTIL_READY)
- vss_transaction.state = HVUTIL_READY;
-
- hv_poll_channel(vss_transaction.vss_context,
- hv_vss_onchannelcallback);
+ hv_poll_channel(vss_transaction.recv_channel, vss_poll_wrapper);
}
static int vss_handle_handshake(struct hv_vss_msg *vss_msg)
@@ -138,9 +139,8 @@ static int vss_on_msg(void *msg, int len)
if (cancel_delayed_work_sync(&vss_timeout_work)) {
vss_respond_to_host(vss_msg->error);
/* Transaction is finished, reset the state. */
- vss_transaction.state = HVUTIL_READY;
- hv_poll_channel(vss_transaction.vss_context,
- hv_vss_onchannelcallback);
+ hv_poll_channel(vss_transaction.recv_channel,
+ vss_poll_wrapper);
}
} else {
/* This is a spurious call! */
@@ -238,15 +238,8 @@ void hv_vss_onchannelcallback(void *context)
struct icmsg_hdr *icmsghdrp;
struct icmsg_negotiate *negop = NULL;
- if (vss_transaction.state > HVUTIL_READY) {
- /*
- * We will defer processing this callback once
- * the current transaction is complete.
- */
- vss_transaction.vss_context = context;
+ if (vss_transaction.state > HVUTIL_READY)
return;
- }
- vss_transaction.vss_context = NULL;
vmbus_recvpacket(channel, recv_buffer, PAGE_SIZE * 2, &recvlen,
&requestid);
diff --git a/drivers/hv/hyperv_vmbus.h b/drivers/hv/hyperv_vmbus.h
index 225b96b..12156db 100644
--- a/drivers/hv/hyperv_vmbus.h
+++ b/drivers/hv/hyperv_vmbus.h
@@ -764,11 +764,7 @@ static inline void hv_poll_channel(struct vmbus_channel *channel,
if (!channel)
return;
- if (channel->target_cpu != smp_processor_id())
- smp_call_function_single(channel->target_cpu,
- cb, channel, true);
- else
- cb(channel);
+ smp_call_function_single(channel->target_cpu, cb, channel, true);
}
enum hvutil_device_state {
--
1.7.4.1
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
[toc] | [prev] | [next] | [standalone]
| From | "K. Y. Srinivasan" <kys@microsoft.com> |
|---|---|
| Date | 2015-12-14 23:30 +0100 |
| Subject | [PATCH RESEND 03/27] tools: hv: report ENOSPC errors in hv_fcopy_daemon |
| Message-ID | <qFJN1-3NK-23@gated-at.bofh.it> |
| In reply to | #1291611 |
From: Olaf Hering <olaf@aepfle.de>
Currently some "Unspecified error 0x80004005" is reported on the Windows
side if something fails. Handle the ENOSPC case and return
ERROR_DISK_FULL, which allows at least Copy-VMFile to report a meaning
full error.
Signed-off-by: Olaf Hering <olaf@aepfle.de>
Signed-off-by: K. Y. Srinivasan <kys@microsoft.com>
---
include/uapi/linux/hyperv.h | 1 +
tools/hv/hv_fcopy_daemon.c | 20 +++++++++++++++++---
2 files changed, 18 insertions(+), 3 deletions(-)
diff --git a/include/uapi/linux/hyperv.h b/include/uapi/linux/hyperv.h
index e4c0a35..e347b24 100644
--- a/include/uapi/linux/hyperv.h
+++ b/include/uapi/linux/hyperv.h
@@ -313,6 +313,7 @@ enum hv_kvp_exchg_pool {
#define HV_INVALIDARG 0x80070057
#define HV_GUID_NOTFOUND 0x80041002
#define HV_ERROR_ALREADY_EXISTS 0x80070050
+#define HV_ERROR_DISK_FULL 0x80070070
#define ADDR_FAMILY_NONE 0x00
#define ADDR_FAMILY_IPV4 0x01
diff --git a/tools/hv/hv_fcopy_daemon.c b/tools/hv/hv_fcopy_daemon.c
index 5480e4e..f1d7426 100644
--- a/tools/hv/hv_fcopy_daemon.c
+++ b/tools/hv/hv_fcopy_daemon.c
@@ -37,12 +37,14 @@
static int target_fd;
static char target_fname[W_MAX_PATH];
+static unsigned long long filesize;
static int hv_start_fcopy(struct hv_start_fcopy *smsg)
{
int error = HV_E_FAIL;
char *q, *p;
+ filesize = 0;
p = (char *)smsg->path_name;
snprintf(target_fname, sizeof(target_fname), "%s/%s",
(char *)smsg->path_name, (char *)smsg->file_name);
@@ -98,14 +100,26 @@ done:
static int hv_copy_data(struct hv_do_fcopy *cpmsg)
{
ssize_t bytes_written;
+ int ret = 0;
bytes_written = pwrite(target_fd, cpmsg->data, cpmsg->size,
cpmsg->offset);
- if (bytes_written != cpmsg->size)
- return HV_E_FAIL;
+ filesize += cpmsg->size;
+ if (bytes_written != cpmsg->size) {
+ switch (errno) {
+ case ENOSPC:
+ ret = HV_ERROR_DISK_FULL;
+ break;
+ default:
+ ret = HV_E_FAIL;
+ break;
+ }
+ syslog(LOG_ERR, "pwrite failed to write %llu bytes: %ld (%s)",
+ filesize, (long)bytes_written, strerror(errno));
+ }
- return 0;
+ return ret;
}
static int hv_copy_finished(void)
--
1.7.4.1
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
[toc] | [prev] | [next] | [standalone]
| From | "K. Y. Srinivasan" <kys@microsoft.com> |
|---|---|
| Date | 2015-12-14 23:30 +0100 |
| Subject | [PATCH RESEND 06/27] Drivers: hv: utils: use memdup_user in hvt_op_write |
| Message-ID | <qFJN1-3NK-33@gated-at.bofh.it> |
| In reply to | #1291611 |
From: Olaf Hering <olaf@aepfle.de>
Use memdup_user to handle OOM.
Fixes: 14b50f80c32d ('Drivers: hv: util: introduce hv_utils_transport abstraction')
Signed-off-by: Olaf Hering <olaf@aepfle.de>
Signed-off-by: K. Y. Srinivasan <kys@microsoft.com>
---
drivers/hv/hv_utils_transport.c | 9 ++++-----
1 files changed, 4 insertions(+), 5 deletions(-)
diff --git a/drivers/hv/hv_utils_transport.c b/drivers/hv/hv_utils_transport.c
index 1505ee6..24b2766 100644
--- a/drivers/hv/hv_utils_transport.c
+++ b/drivers/hv/hv_utils_transport.c
@@ -80,11 +80,10 @@ static ssize_t hvt_op_write(struct file *file, const char __user *buf,
hvt = container_of(file->f_op, struct hvutil_transport, fops);
- inmsg = kzalloc(count, GFP_KERNEL);
- if (copy_from_user(inmsg, buf, count)) {
- kfree(inmsg);
- return -EFAULT;
- }
+ inmsg = memdup_user(buf, count);
+ if (IS_ERR(inmsg))
+ return PTR_ERR(inmsg);
+
if (hvt->on_msg(inmsg, count))
return -EFAULT;
kfree(inmsg);
--
1.7.4.1
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
[toc] | [prev] | [next] | [standalone]
| From | "K. Y. Srinivasan" <kys@microsoft.com> |
|---|---|
| Date | 2015-12-14 23:30 +0100 |
| Subject | [PATCH RESEND 04/27] tools: hv: remove repeated HV_FCOPY string |
| Message-ID | <qFJN1-3NK-31@gated-at.bofh.it> |
| In reply to | #1291611 |
From: Olaf Hering <olaf@aepfle.de>
HV_FCOPY is already used as identifier in syslog.
Signed-off-by: Olaf Hering <olaf@aepfle.de>
Signed-off-by: K. Y. Srinivasan <kys@microsoft.com>
---
tools/hv/hv_fcopy_daemon.c | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/tools/hv/hv_fcopy_daemon.c b/tools/hv/hv_fcopy_daemon.c
index f1d7426..fdc9ca4 100644
--- a/tools/hv/hv_fcopy_daemon.c
+++ b/tools/hv/hv_fcopy_daemon.c
@@ -179,7 +179,7 @@ int main(int argc, char *argv[])
}
openlog("HV_FCOPY", 0, LOG_USER);
- syslog(LOG_INFO, "HV_FCOPY starting; pid is:%d", getpid());
+ syslog(LOG_INFO, "starting; pid is:%d", getpid());
fcopy_fd = open("/dev/vmbus/hv_fcopy", O_RDWR);
@@ -215,7 +215,7 @@ int main(int argc, char *argv[])
}
kernel_modver = *(__u32 *)buffer;
in_handshake = 0;
- syslog(LOG_INFO, "HV_FCOPY: kernel module version: %d",
+ syslog(LOG_INFO, "kernel module version: %d",
kernel_modver);
continue;
}
--
1.7.4.1
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
[toc] | [prev] | [next] | [standalone]
| From | "K. Y. Srinivasan" <kys@microsoft.com> |
|---|---|
| Date | 2015-12-14 23:40 +0100 |
| Subject | [PATCH RESEND 10/27] drivers:hv: Define the channel type for Hyper-V PCI Express pass-through |
| Message-ID | <qFJWF-3Ss-3@gated-at.bofh.it> |
| In reply to | #1291611 |
From: Jake Oshins <jakeo@microsoft.com>
This defines the channel type for PCI front-ends in Hyper-V VMs.
Signed-off-by: Jake Oshins <jakeo@microsoft.com>
Signed-off-by: K. Y. Srinivasan <kys@microsoft.com>
---
drivers/hv/channel_mgmt.c | 3 +++
include/linux/hyperv.h | 11 +++++++++++
2 files changed, 14 insertions(+), 0 deletions(-)
diff --git a/drivers/hv/channel_mgmt.c b/drivers/hv/channel_mgmt.c
index 652afd1..a77646b 100644
--- a/drivers/hv/channel_mgmt.c
+++ b/drivers/hv/channel_mgmt.c
@@ -358,6 +358,7 @@ enum {
SCSI,
NIC,
ND_NIC,
+ PCIE,
MAX_PERF_CHN,
};
@@ -375,6 +376,8 @@ static const struct hv_vmbus_device_id hp_devs[] = {
{ HV_NIC_GUID, },
/* NetworkDirect Guest RDMA */
{ HV_ND_GUID, },
+ /* PCI Express Pass Through */
+ { HV_PCIE_GUID, },
};
diff --git a/include/linux/hyperv.h b/include/linux/hyperv.h
index 24d0b65..c9a9eed 100644
--- a/include/linux/hyperv.h
+++ b/include/linux/hyperv.h
@@ -1141,6 +1141,17 @@ u64 hv_do_hypercall(u64 control, void *input, void *output);
}
/*
+ * PCI Express Pass Through
+ * {44C4F61D-4444-4400-9D52-802E27EDE19F}
+ */
+
+#define HV_PCIE_GUID \
+ .guid = { \
+ 0x1D, 0xF6, 0xC4, 0x44, 0x44, 0x44, 0x00, 0x44, \
+ 0x9D, 0x52, 0x80, 0x2E, 0x27, 0xED, 0xE1, 0x9F \
+ }
+
+/*
* Common header for Hyper-V ICs
*/
--
1.7.4.1
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
[toc] | [prev] | [next] | [standalone]
| From | "K. Y. Srinivasan" <kys@microsoft.com> |
|---|---|
| Date | 2015-12-14 23:40 +0100 |
| Subject | [PATCH RESEND 09/27] drivers:hv: Export the API to invoke a hypercall on Hyper-V |
| Message-ID | <qFJWF-3Ss-9@gated-at.bofh.it> |
| In reply to | #1291611 |
From: Jake Oshins <jakeo@microsoft.com>
This patch exposes the function that hv_vmbus.ko uses to make hypercalls. This
is necessary for retargeting an interrupt when it is given a new affinity.
Since we are exporting this API, rename the API as it will be visible outside
the hv.c file.
Signed-off-by: Jake Oshins <jakeo@microsoft.com>
Signed-off-by: K. Y. Srinivasan <kys@microsoft.com>
---
drivers/hv/hv.c | 20 ++++++++++----------
drivers/hv/hyperv_vmbus.h | 2 +-
include/linux/hyperv.h | 1 +
3 files changed, 12 insertions(+), 11 deletions(-)
diff --git a/drivers/hv/hv.c b/drivers/hv/hv.c
index 6341be8..7a06933 100644
--- a/drivers/hv/hv.c
+++ b/drivers/hv/hv.c
@@ -89,9 +89,9 @@ static int query_hypervisor_info(void)
}
/*
- * do_hypercall- Invoke the specified hypercall
+ * hv_do_hypercall- Invoke the specified hypercall
*/
-static u64 do_hypercall(u64 control, void *input, void *output)
+u64 hv_do_hypercall(u64 control, void *input, void *output)
{
u64 input_address = (input) ? virt_to_phys(input) : 0;
u64 output_address = (output) ? virt_to_phys(output) : 0;
@@ -132,6 +132,7 @@ static u64 do_hypercall(u64 control, void *input, void *output)
return hv_status_lo | ((u64)hv_status_hi << 32);
#endif /* !x86_64 */
}
+EXPORT_SYMBOL_GPL(hv_do_hypercall);
#ifdef CONFIG_X86_64
static cycle_t read_hv_clock_tsc(struct clocksource *arg)
@@ -315,7 +316,7 @@ int hv_post_message(union hv_connection_id connection_id,
{
struct hv_input_post_message *aligned_msg;
- u16 status;
+ u64 status;
if (payload_size > HV_MESSAGE_PAYLOAD_BYTE_COUNT)
return -EMSGSIZE;
@@ -329,11 +330,10 @@ int hv_post_message(union hv_connection_id connection_id,
aligned_msg->payload_size = payload_size;
memcpy((void *)aligned_msg->payload, payload, payload_size);
- status = do_hypercall(HVCALL_POST_MESSAGE, aligned_msg, NULL)
- & 0xFFFF;
+ status = hv_do_hypercall(HVCALL_POST_MESSAGE, aligned_msg, NULL);
put_cpu();
- return status;
+ return status & 0xFFFF;
}
@@ -343,13 +343,13 @@ int hv_post_message(union hv_connection_id connection_id,
*
* This involves a hypercall.
*/
-u16 hv_signal_event(void *con_id)
+int hv_signal_event(void *con_id)
{
- u16 status;
+ u64 status;
- status = (do_hypercall(HVCALL_SIGNAL_EVENT, con_id, NULL) & 0xFFFF);
+ status = hv_do_hypercall(HVCALL_SIGNAL_EVENT, con_id, NULL);
- return status;
+ return status & 0xFFFF;
}
static int hv_ce_set_next_event(unsigned long delta,
diff --git a/drivers/hv/hyperv_vmbus.h b/drivers/hv/hyperv_vmbus.h
index 12156db..9beeb14 100644
--- a/drivers/hv/hyperv_vmbus.h
+++ b/drivers/hv/hyperv_vmbus.h
@@ -587,7 +587,7 @@ extern int hv_post_message(union hv_connection_id connection_id,
enum hv_message_type message_type,
void *payload, size_t payload_size);
-extern u16 hv_signal_event(void *con_id);
+extern int hv_signal_event(void *con_id);
extern int hv_synic_alloc(void);
diff --git a/include/linux/hyperv.h b/include/linux/hyperv.h
index fddb3e0..24d0b65 100644
--- a/include/linux/hyperv.h
+++ b/include/linux/hyperv.h
@@ -984,6 +984,7 @@ int vmbus_allocate_mmio(struct resource **new, struct hv_device *device_obj,
bool fb_overlap_ok);
int vmbus_cpu_number_to_vp_number(int cpu_number);
+u64 hv_do_hypercall(u64 control, void *input, void *output);
/**
* VMBUS_DEVICE - macro used to describe a specific hyperv vmbus device
--
1.7.4.1
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
[toc] | [prev] | [next] | [standalone]
| From | Greg KH <gregkh@linuxfoundation.org> |
|---|---|
| Date | 2015-12-15 04:10 +0100 |
| Subject | Re: [PATCH RESEND 09/27] drivers:hv: Export the API to invoke a hypercall on Hyper-V |
| Message-ID | <qFO9Y-6I0-1@gated-at.bofh.it> |
| In reply to | #1291622 |
On Mon, Dec 14, 2015 at 04:01:40PM -0800, K. Y. Srinivasan wrote:
> From: Jake Oshins <jakeo@microsoft.com>
>
> This patch exposes the function that hv_vmbus.ko uses to make hypercalls. This
> is necessary for retargeting an interrupt when it is given a new affinity.
>
> Since we are exporting this API, rename the API as it will be visible outside
> the hv.c file.
>
> Signed-off-by: Jake Oshins <jakeo@microsoft.com>
> Signed-off-by: K. Y. Srinivasan <kys@microsoft.com>
> ---
> drivers/hv/hv.c | 20 ++++++++++----------
> drivers/hv/hyperv_vmbus.h | 2 +-
> include/linux/hyperv.h | 1 +
> 3 files changed, 12 insertions(+), 11 deletions(-)
>
> diff --git a/drivers/hv/hv.c b/drivers/hv/hv.c
> index 6341be8..7a06933 100644
> --- a/drivers/hv/hv.c
> +++ b/drivers/hv/hv.c
> @@ -89,9 +89,9 @@ static int query_hypervisor_info(void)
> }
>
> /*
> - * do_hypercall- Invoke the specified hypercall
> + * hv_do_hypercall- Invoke the specified hypercall
> */
> -static u64 do_hypercall(u64 control, void *input, void *output)
> +u64 hv_do_hypercall(u64 control, void *input, void *output)
> {
> u64 input_address = (input) ? virt_to_phys(input) : 0;
> u64 output_address = (output) ? virt_to_phys(output) : 0;
> @@ -132,6 +132,7 @@ static u64 do_hypercall(u64 control, void *input, void *output)
> return hv_status_lo | ((u64)hv_status_hi << 32);
> #endif /* !x86_64 */
> }
> +EXPORT_SYMBOL_GPL(hv_do_hypercall);
>
> #ifdef CONFIG_X86_64
> static cycle_t read_hv_clock_tsc(struct clocksource *arg)
> @@ -315,7 +316,7 @@ int hv_post_message(union hv_connection_id connection_id,
> {
>
> struct hv_input_post_message *aligned_msg;
> - u16 status;
> + u64 status;
>
> if (payload_size > HV_MESSAGE_PAYLOAD_BYTE_COUNT)
> return -EMSGSIZE;
> @@ -329,11 +330,10 @@ int hv_post_message(union hv_connection_id connection_id,
> aligned_msg->payload_size = payload_size;
> memcpy((void *)aligned_msg->payload, payload, payload_size);
>
> - status = do_hypercall(HVCALL_POST_MESSAGE, aligned_msg, NULL)
> - & 0xFFFF;
> + status = hv_do_hypercall(HVCALL_POST_MESSAGE, aligned_msg, NULL);
>
> put_cpu();
> - return status;
> + return status & 0xFFFF;
> }
>
>
> @@ -343,13 +343,13 @@ int hv_post_message(union hv_connection_id connection_id,
> *
> * This involves a hypercall.
> */
> -u16 hv_signal_event(void *con_id)
> +int hv_signal_event(void *con_id)
> {
> - u16 status;
> + u64 status;
>
> - status = (do_hypercall(HVCALL_SIGNAL_EVENT, con_id, NULL) & 0xFFFF);
> + status = hv_do_hypercall(HVCALL_SIGNAL_EVENT, con_id, NULL);
>
> - return status;
> + return status & 0xFFFF;
This "feels" odd, as the return value isn't the traditional 0 or -ERROR,
right? Why are you masking off the top bits?
And, no one ever does anything with the return value of
hv_signal_event(), so why have it return anything anyway?
I'll take this, but please fix up the area, it's messy...
greg k-h
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
[toc] | [prev] | [next] | [standalone]
| From | KY Srinivasan <kys@microsoft.com> |
|---|---|
| Date | 2015-12-15 05:20 +0100 |
| Subject | RE: [PATCH RESEND 09/27] drivers:hv: Export the API to invoke a hypercall on Hyper-V |
| Message-ID | <qFPfI-7sb-7@gated-at.bofh.it> |
| In reply to | #1291806 |
> -----Original Message-----
> From: Greg KH [mailto:gregkh@linuxfoundation.org]
> Sent: Monday, December 14, 2015 7:08 PM
> To: KY Srinivasan <kys@microsoft.com>
> Cc: linux-kernel@vger.kernel.org; devel@linuxdriverproject.org;
> olaf@aepfle.de; apw@canonical.com; vkuznets@redhat.com;
> jasowang@redhat.com; Jake Oshins <jakeo@microsoft.com>
> Subject: Re: [PATCH RESEND 09/27] drivers:hv: Export the API to invoke a
> hypercall on Hyper-V
>
> On Mon, Dec 14, 2015 at 04:01:40PM -0800, K. Y. Srinivasan wrote:
> > From: Jake Oshins <jakeo@microsoft.com>
> >
> > This patch exposes the function that hv_vmbus.ko uses to make hypercalls.
> This
> > is necessary for retargeting an interrupt when it is given a new affinity.
> >
> > Since we are exporting this API, rename the API as it will be visible outside
> > the hv.c file.
> >
> > Signed-off-by: Jake Oshins <jakeo@microsoft.com>
> > Signed-off-by: K. Y. Srinivasan <kys@microsoft.com>
> > ---
> > drivers/hv/hv.c | 20 ++++++++++----------
> > drivers/hv/hyperv_vmbus.h | 2 +-
> > include/linux/hyperv.h | 1 +
> > 3 files changed, 12 insertions(+), 11 deletions(-)
> >
> > diff --git a/drivers/hv/hv.c b/drivers/hv/hv.c
> > index 6341be8..7a06933 100644
> > --- a/drivers/hv/hv.c
> > +++ b/drivers/hv/hv.c
> > @@ -89,9 +89,9 @@ static int query_hypervisor_info(void)
> > }
> >
> > /*
> > - * do_hypercall- Invoke the specified hypercall
> > + * hv_do_hypercall- Invoke the specified hypercall
> > */
> > -static u64 do_hypercall(u64 control, void *input, void *output)
> > +u64 hv_do_hypercall(u64 control, void *input, void *output)
> > {
> > u64 input_address = (input) ? virt_to_phys(input) : 0;
> > u64 output_address = (output) ? virt_to_phys(output) : 0;
> > @@ -132,6 +132,7 @@ static u64 do_hypercall(u64 control, void *input,
> void *output)
> > return hv_status_lo | ((u64)hv_status_hi << 32);
> > #endif /* !x86_64 */
> > }
> > +EXPORT_SYMBOL_GPL(hv_do_hypercall);
> >
> > #ifdef CONFIG_X86_64
> > static cycle_t read_hv_clock_tsc(struct clocksource *arg)
> > @@ -315,7 +316,7 @@ int hv_post_message(union hv_connection_id
> connection_id,
> > {
> >
> > struct hv_input_post_message *aligned_msg;
> > - u16 status;
> > + u64 status;
> >
> > if (payload_size > HV_MESSAGE_PAYLOAD_BYTE_COUNT)
> > return -EMSGSIZE;
> > @@ -329,11 +330,10 @@ int hv_post_message(union hv_connection_id
> connection_id,
> > aligned_msg->payload_size = payload_size;
> > memcpy((void *)aligned_msg->payload, payload, payload_size);
> >
> > - status = do_hypercall(HVCALL_POST_MESSAGE, aligned_msg, NULL)
> > - & 0xFFFF;
> > + status = hv_do_hypercall(HVCALL_POST_MESSAGE, aligned_msg,
> NULL);
> >
> > put_cpu();
> > - return status;
> > + return status & 0xFFFF;
> > }
> >
> >
> > @@ -343,13 +343,13 @@ int hv_post_message(union hv_connection_id
> connection_id,
> > *
> > * This involves a hypercall.
> > */
> > -u16 hv_signal_event(void *con_id)
> > +int hv_signal_event(void *con_id)
> > {
> > - u16 status;
> > + u64 status;
> >
> > - status = (do_hypercall(HVCALL_SIGNAL_EVENT, con_id, NULL) &
> 0xFFFF);
> > + status = hv_do_hypercall(HVCALL_SIGNAL_EVENT, con_id, NULL);
> >
> > - return status;
> > + return status & 0xFFFF;
>
> This "feels" odd, as the return value isn't the traditional 0 or -ERROR,
> right? Why are you masking off the top bits?
>
> And, no one ever does anything with the return value of
> hv_signal_event(), so why have it return anything anyway?
>
> I'll take this, but please fix up the area, it's messy...
Thanks Greg. Will do.
K. Y
>
> greg k-h
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
[toc] | [prev] | [next] | [standalone]
| From | "K. Y. Srinivasan" <kys@microsoft.com> |
|---|---|
| Date | 2015-12-14 23:40 +0100 |
| Subject | [PATCH RESEND 14/27] Drivers: hv: vmbus: Get rid of the unused macro |
| Message-ID | <qFJWG-3Ss-17@gated-at.bofh.it> |
| In reply to | #1291611 |
The macro VMBUS_DEVICE() is unused; get rid of it.
Signed-off-by: K. Y. Srinivasan <kys@microsoft.com>
---
include/linux/hyperv.h | 13 -------------
1 files changed, 0 insertions(+), 13 deletions(-)
diff --git a/include/linux/hyperv.h b/include/linux/hyperv.h
index b9f3bb2..f773a68 100644
--- a/include/linux/hyperv.h
+++ b/include/linux/hyperv.h
@@ -986,19 +986,6 @@ int vmbus_allocate_mmio(struct resource **new, struct hv_device *device_obj,
int vmbus_cpu_number_to_vp_number(int cpu_number);
u64 hv_do_hypercall(u64 control, void *input, void *output);
-/**
- * VMBUS_DEVICE - macro used to describe a specific hyperv vmbus device
- *
- * This macro is used to create a struct hv_vmbus_device_id that matches a
- * specific device.
- */
-#define VMBUS_DEVICE(g0, g1, g2, g3, g4, g5, g6, g7, \
- g8, g9, ga, gb, gc, gd, ge, gf) \
- .guid = { g0, g1, g2, g3, g4, g5, g6, g7, \
- g8, g9, ga, gb, gc, gd, ge, gf },
-
-
-
/*
* GUID definitions of various offer types - services offered to the guest.
*/
--
1.7.4.1
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
[toc] | [prev] | [next] | [standalone]
| From | "K. Y. Srinivasan" <kys@microsoft.com> |
|---|---|
| Date | 2015-12-14 23:40 +0100 |
| Subject | [PATCH RESEND 20/27] Drivers: hv: vmbus: channge vmbus_connection.channel_lock to mutex |
| Message-ID | <qFJWG-3Ss-13@gated-at.bofh.it> |
| In reply to | #1291611 |
From: Dexuan Cui <decui@microsoft.com>
spinlock is unnecessary here.
mutex is enough.
Signed-off-by: Dexuan Cui <decui@microsoft.com>
Signed-off-by: K. Y. Srinivasan <kys@microsoft.com>
---
drivers/hv/channel_mgmt.c | 12 ++++++------
drivers/hv/connection.c | 7 +++----
drivers/hv/hyperv_vmbus.h | 2 +-
3 files changed, 10 insertions(+), 11 deletions(-)
diff --git a/drivers/hv/channel_mgmt.c b/drivers/hv/channel_mgmt.c
index 9c9da3a..d013171 100644
--- a/drivers/hv/channel_mgmt.c
+++ b/drivers/hv/channel_mgmt.c
@@ -206,9 +206,9 @@ void hv_process_channel_removal(struct vmbus_channel *channel, u32 relid)
}
if (channel->primary_channel == NULL) {
- spin_lock_irqsave(&vmbus_connection.channel_lock, flags);
+ mutex_lock(&vmbus_connection.channel_mutex);
list_del(&channel->listentry);
- spin_unlock_irqrestore(&vmbus_connection.channel_lock, flags);
+ mutex_unlock(&vmbus_connection.channel_mutex);
primary_channel = channel;
} else {
@@ -253,7 +253,7 @@ static void vmbus_process_offer(struct vmbus_channel *newchannel)
unsigned long flags;
/* Make sure this is a new offer */
- spin_lock_irqsave(&vmbus_connection.channel_lock, flags);
+ mutex_lock(&vmbus_connection.channel_mutex);
list_for_each_entry(channel, &vmbus_connection.chn_list, listentry) {
if (!uuid_le_cmp(channel->offermsg.offer.if_type,
@@ -269,7 +269,7 @@ static void vmbus_process_offer(struct vmbus_channel *newchannel)
list_add_tail(&newchannel->listentry,
&vmbus_connection.chn_list);
- spin_unlock_irqrestore(&vmbus_connection.channel_lock, flags);
+ mutex_unlock(&vmbus_connection.channel_mutex);
if (!fnew) {
/*
@@ -341,9 +341,9 @@ static void vmbus_process_offer(struct vmbus_channel *newchannel)
err_deq_chan:
vmbus_release_relid(newchannel->offermsg.child_relid);
- spin_lock_irqsave(&vmbus_connection.channel_lock, flags);
+ mutex_lock(&vmbus_connection.channel_mutex);
list_del(&newchannel->listentry);
- spin_unlock_irqrestore(&vmbus_connection.channel_lock, flags);
+ mutex_unlock(&vmbus_connection.channel_mutex);
if (newchannel->target_cpu != get_cpu()) {
put_cpu();
diff --git a/drivers/hv/connection.c b/drivers/hv/connection.c
index 4fc2e88..521f48e 100644
--- a/drivers/hv/connection.c
+++ b/drivers/hv/connection.c
@@ -146,7 +146,7 @@ int vmbus_connect(void)
spin_lock_init(&vmbus_connection.channelmsg_lock);
INIT_LIST_HEAD(&vmbus_connection.chn_list);
- spin_lock_init(&vmbus_connection.channel_lock);
+ mutex_init(&vmbus_connection.channel_mutex);
/*
* Setup the vmbus event connection for channel interrupt
@@ -282,11 +282,10 @@ struct vmbus_channel *relid2channel(u32 relid)
{
struct vmbus_channel *channel;
struct vmbus_channel *found_channel = NULL;
- unsigned long flags;
struct list_head *cur, *tmp;
struct vmbus_channel *cur_sc;
- spin_lock_irqsave(&vmbus_connection.channel_lock, flags);
+ mutex_lock(&vmbus_connection.channel_mutex);
list_for_each_entry(channel, &vmbus_connection.chn_list, listentry) {
if (channel->offermsg.child_relid == relid) {
found_channel = channel;
@@ -305,7 +304,7 @@ struct vmbus_channel *relid2channel(u32 relid)
}
}
}
- spin_unlock_irqrestore(&vmbus_connection.channel_lock, flags);
+ mutex_unlock(&vmbus_connection.channel_mutex);
return found_channel;
}
diff --git a/drivers/hv/hyperv_vmbus.h b/drivers/hv/hyperv_vmbus.h
index 9beeb14..4d67e98 100644
--- a/drivers/hv/hyperv_vmbus.h
+++ b/drivers/hv/hyperv_vmbus.h
@@ -683,7 +683,7 @@ struct vmbus_connection {
/* List of channels */
struct list_head chn_list;
- spinlock_t channel_lock;
+ struct mutex channel_mutex;
struct workqueue_struct *work_queue;
};
--
1.7.4.1
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
[toc] | [prev] | [next] | [standalone]
| From | "K. Y. Srinivasan" <kys@microsoft.com> |
|---|---|
| Date | 2015-12-14 23:40 +0100 |
| Subject | [PATCH RESEND 26/27] Drivers: hv: utils: Invoke the poll function after handshake |
| Message-ID | <qFJWG-3Ss-19@gated-at.bofh.it> |
| In reply to | #1291611 |
When the handshake with daemon is complete, we should poll the channel since
during the handshake, we will not be processing any messages. This is a
potential bug if the host is waiting for a response from the guest.
I would like to thank Dexuan for pointing this out.
Signed-off-by: K. Y. Srinivasan <kys@microsoft.com>
---
drivers/hv/hv_kvp.c | 2 +-
drivers/hv/hv_snapshot.c | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/hv/hv_kvp.c b/drivers/hv/hv_kvp.c
index 2a3420c..d4ab81b 100644
--- a/drivers/hv/hv_kvp.c
+++ b/drivers/hv/hv_kvp.c
@@ -154,7 +154,7 @@ static int kvp_handle_handshake(struct hv_kvp_msg *msg)
pr_debug("KVP: userspace daemon ver. %d registered\n",
KVP_OP_REGISTER);
kvp_register(dm_reg_value);
- kvp_transaction.state = HVUTIL_READY;
+ hv_poll_channel(kvp_transaction.recv_channel, kvp_poll_wrapper);
return 0;
}
diff --git a/drivers/hv/hv_snapshot.c b/drivers/hv/hv_snapshot.c
index 81882d4..67def4a 100644
--- a/drivers/hv/hv_snapshot.c
+++ b/drivers/hv/hv_snapshot.c
@@ -113,7 +113,7 @@ static int vss_handle_handshake(struct hv_vss_msg *vss_msg)
default:
return -EINVAL;
}
- vss_transaction.state = HVUTIL_READY;
+ hv_poll_channel(vss_transaction.recv_channel, vss_poll_wrapper);
pr_debug("VSS: userspace daemon ver. %d registered\n", dm_reg_value);
return 0;
}
--
1.7.4.1
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
[toc] | [prev] | [next] | [standalone]
| From | "K. Y. Srinivasan" <kys@microsoft.com> |
|---|---|
| Date | 2015-12-14 23:40 +0100 |
| Subject | [PATCH RESEND 05/27] Drivers: hv: util: catch allocation errors |
| Message-ID | <qFJWG-3Ss-25@gated-at.bofh.it> |
| In reply to | #1291611 |
From: Olaf Hering <olaf@aepfle.de>
Catch allocation errors in hvutil_transport_send.
Fixes: 14b50f80c32d ('Drivers: hv: util: introduce hv_utils_transport abstraction')
Signed-off-by: Olaf Hering <olaf@aepfle.de>
Signed-off-by: K. Y. Srinivasan <kys@microsoft.com>
---
drivers/hv/hv_utils_transport.c | 9 ++++++---
1 files changed, 6 insertions(+), 3 deletions(-)
diff --git a/drivers/hv/hv_utils_transport.c b/drivers/hv/hv_utils_transport.c
index 6a9d80a..1505ee6 100644
--- a/drivers/hv/hv_utils_transport.c
+++ b/drivers/hv/hv_utils_transport.c
@@ -204,9 +204,12 @@ int hvutil_transport_send(struct hvutil_transport *hvt, void *msg, int len)
goto out_unlock;
}
hvt->outmsg = kzalloc(len, GFP_KERNEL);
- memcpy(hvt->outmsg, msg, len);
- hvt->outmsg_len = len;
- wake_up_interruptible(&hvt->outmsg_q);
+ if (hvt->outmsg) {
+ memcpy(hvt->outmsg, msg, len);
+ hvt->outmsg_len = len;
+ wake_up_interruptible(&hvt->outmsg_q);
+ } else
+ ret = -ENOMEM;
out_unlock:
mutex_unlock(&hvt->outmsg_lock);
return ret;
--
1.7.4.1
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
[toc] | [prev] | [next] | [standalone]
| From | "K. Y. Srinivasan" <kys@microsoft.com> |
|---|---|
| Date | 2015-12-14 23:40 +0100 |
| Subject | [PATCH RESEND 08/27] drivers:hv: Export a function that maps Linux CPU num onto Hyper-V proc num |
| Message-ID | <qFJWG-3Ss-31@gated-at.bofh.it> |
| In reply to | #1291611 |
From: Jake Oshins <jakeo@microsoft.com>
This patch exposes the mapping between Linux CPU number and Hyper-V virtual
processor number. This is necessary because the hypervisor needs to know which
virtual processors to target when making a mapping in the Interrupt Redirection
Table in the I/O MMU.
Signed-off-by: Jake Oshins <jakeo@microsoft.com>
Signed-off-by: K. Y. Srinivasan <kys@microsoft.com>
---
drivers/hv/vmbus_drv.c | 17 +++++++++++++++++
include/linux/hyperv.h | 2 ++
2 files changed, 19 insertions(+), 0 deletions(-)
diff --git a/drivers/hv/vmbus_drv.c b/drivers/hv/vmbus_drv.c
index 3297731..c01b689 100644
--- a/drivers/hv/vmbus_drv.c
+++ b/drivers/hv/vmbus_drv.c
@@ -1193,6 +1193,23 @@ int vmbus_allocate_mmio(struct resource **new, struct hv_device *device_obj,
}
EXPORT_SYMBOL_GPL(vmbus_allocate_mmio);
+/**
+ * vmbus_cpu_number_to_vp_number() - Map CPU to VP.
+ * @cpu_number: CPU number in Linux terms
+ *
+ * This function returns the mapping between the Linux processor
+ * number and the hypervisor's virtual processor number, useful
+ * in making hypercalls and such that talk about specific
+ * processors.
+ *
+ * Return: Virtual processor number in Hyper-V terms
+ */
+int vmbus_cpu_number_to_vp_number(int cpu_number)
+{
+ return hv_context.vp_index[cpu_number];
+}
+EXPORT_SYMBOL_GPL(vmbus_cpu_number_to_vp_number);
+
static int vmbus_acpi_add(struct acpi_device *device)
{
acpi_status result;
diff --git a/include/linux/hyperv.h b/include/linux/hyperv.h
index 8fdc17b..fddb3e0 100644
--- a/include/linux/hyperv.h
+++ b/include/linux/hyperv.h
@@ -983,6 +983,8 @@ int vmbus_allocate_mmio(struct resource **new, struct hv_device *device_obj,
resource_size_t size, resource_size_t align,
bool fb_overlap_ok);
+int vmbus_cpu_number_to_vp_number(int cpu_number);
+
/**
* VMBUS_DEVICE - macro used to describe a specific hyperv vmbus device
*
--
1.7.4.1
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
[toc] | [prev] | [next] | [standalone]
| From | "K. Y. Srinivasan" <kys@microsoft.com> |
|---|---|
| Date | 2015-12-14 23:40 +0100 |
| Subject | [PATCH RESEND 07/27] drivers/hv: cleanup synic msrs if vmbus connect failed |
| Message-ID | <qFJWG-3Ss-37@gated-at.bofh.it> |
| In reply to | #1291611 |
From: Andrey Smetanin <asmetanin@virtuozzo.com> Before vmbus_connect() synic is setup per vcpu - this means hypervisor receives writes at synic msr's and probably allocate hypervisor resources per synic setup. If vmbus_connect() failed for some reason it's neccessary to cleanup synic setup by call hv_synic_cleanup() at each vcpu to get a chance to free allocated resources by hypervisor per synic. This patch does appropriate cleanup in case of vmbus_connect() failure. Signed-off-by: Andrey Smetanin <asmetanin@virtuozzo.com> Signed-off-by: Denis V. Lunev <den@openvz.org> Reviewed-by: Vitaly Kuznetsov <vkuznets@redhat.com> CC: "K. Y. Srinivasan" <kys@microsoft.com> CC: Haiyang Zhang <haiyangz@microsoft.com> CC: Vitaly Kuznetsov <vkuznets@redhat.com> Signed-off-by: K. Y. Srinivasan <kys@microsoft.com> --- drivers/hv/vmbus_drv.c | 4 +++- 1 files changed, 3 insertions(+), 1 deletions(-) diff --git a/drivers/hv/vmbus_drv.c b/drivers/hv/vmbus_drv.c index f19b6f7..3297731 100644 --- a/drivers/hv/vmbus_drv.c +++ b/drivers/hv/vmbus_drv.c @@ -867,7 +867,7 @@ static int vmbus_bus_init(int irq) on_each_cpu(hv_synic_init, NULL, 1); ret = vmbus_connect(); if (ret) - goto err_alloc; + goto err_connect; if (vmbus_proto_version > VERSION_WIN7) cpu_hotplug_disable(); @@ -885,6 +885,8 @@ static int vmbus_bus_init(int irq) return 0; +err_connect: + on_each_cpu(hv_synic_cleanup, NULL, 1); err_alloc: hv_synic_free(); hv_remove_vmbus_irq(); -- 1.7.4.1 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[toc] | [prev] | [next] | [standalone]
| From | "K. Y. Srinivasan" <kys@microsoft.com> |
|---|---|
| Date | 2015-12-14 23:40 +0100 |
| Subject | [PATCH RESEND 22/27] tools/hv: Use include/uapi with __EXPORTED_HEADERS__ |
| Message-ID | <qFJWH-3Ss-43@gated-at.bofh.it> |
| In reply to | #1291611 |
From: Kamal Mostafa <kamal@canonical.com> Use the local uapi headers to keep in sync with "recently" added #define's (e.g. VSS_OP_REGISTER1). Fixes: 3eb2094c59e89db2bedd401e23c7a870081c9edb Signed-off-by: Kamal Mostafa <kamal@canonical.com> Signed-off-by: K. Y. Srinivasan <kys@microsoft.com> --- tools/hv/Makefile | 2 ++ 1 files changed, 2 insertions(+), 0 deletions(-) diff --git a/tools/hv/Makefile b/tools/hv/Makefile index a8ab795..a8c4644 100644 --- a/tools/hv/Makefile +++ b/tools/hv/Makefile @@ -5,6 +5,8 @@ PTHREAD_LIBS = -lpthread WARNINGS = -Wall -Wextra CFLAGS = $(WARNINGS) -g $(PTHREAD_LIBS) $(shell getconf LFS_CFLAGS) +CFLAGS += -D__EXPORTED_HEADERS__ -I../../include/uapi -I../../include + all: hv_kvp_daemon hv_vss_daemon hv_fcopy_daemon %: %.c $(CC) $(CFLAGS) -o $@ $^ -- 1.7.4.1 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[toc] | [prev] | [next] | [standalone]
| From | Greg KH <gregkh@linuxfoundation.org> |
|---|---|
| Date | 2015-12-15 04:20 +0100 |
| Subject | Re: [PATCH RESEND 22/27] tools/hv: Use include/uapi with __EXPORTED_HEADERS__ |
| Message-ID | <qFOjE-6RA-15@gated-at.bofh.it> |
| In reply to | #1291634 |
On Mon, Dec 14, 2015 at 04:01:53PM -0800, K. Y. Srinivasan wrote:
> From: Kamal Mostafa <kamal@canonical.com>
>
> Use the local uapi headers to keep in sync with "recently" added #define's
> (e.g. VSS_OP_REGISTER1).
>
> Fixes: 3eb2094c59e89db2bedd401e23c7a870081c9edb
Please use the "correct" way of listing this:
3eb2094c59e8 ("Adding makefile for tools/hv")
And as this is an old kernel, shouldn't it go into stable releases? Or
does that mean that no one really ever runs into this issue?
> Signed-off-by: Kamal Mostafa <kamal@canonical.com>
> Signed-off-by: K. Y. Srinivasan <kys@microsoft.com>
> ---
> tools/hv/Makefile | 2 ++
> 1 files changed, 2 insertions(+), 0 deletions(-)
>
> diff --git a/tools/hv/Makefile b/tools/hv/Makefile
> index a8ab795..a8c4644 100644
> --- a/tools/hv/Makefile
> +++ b/tools/hv/Makefile
> @@ -5,6 +5,8 @@ PTHREAD_LIBS = -lpthread
> WARNINGS = -Wall -Wextra
> CFLAGS = $(WARNINGS) -g $(PTHREAD_LIBS) $(shell getconf LFS_CFLAGS)
>
> +CFLAGS += -D__EXPORTED_HEADERS__ -I../../include/uapi -I../../include
Why do you need ../../include also?
thanks,
greg k-h
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
[toc] | [prev] | [next] | [standalone]
| From | Kamal Mostafa <kamal@canonical.com> |
|---|---|
| Date | 2015-12-15 19:20 +0100 |
| Subject | Re: [PATCH RESEND 22/27] tools/hv: Use include/uapi with __EXPORTED_HEADERS__ |
| Message-ID | <qG2mB-7LE-1@gated-at.bofh.it> |
| In reply to | #1291809 |
On Mon, 2015-12-14 at 19:11 -0800, Greg KH wrote:
> On Mon, Dec 14, 2015 at 04:01:53PM -0800, K. Y. Srinivasan wrote:
> > From: Kamal Mostafa <kamal@canonical.com>
> >
> > Use the local uapi headers to keep in sync with "recently" added #define's
> > (e.g. VSS_OP_REGISTER1).
> >
> > Fixes: 3eb2094c59e89db2bedd401e23c7a870081c9edb
>
> Please use the "correct" way of listing this:
> 3eb2094c59e8 ("Adding makefile for tools/hv")
>
> And as this is an old kernel, shouldn't it go into stable releases?
Yes it should. I'll resubmit with Cc: stable and correct the Fixes
line.
> Or
> does that mean that no one really ever runs into this issue?
>
> > Signed-off-by: Kamal Mostafa <kamal@canonical.com>
> > Signed-off-by: K. Y. Srinivasan <kys@microsoft.com>
> > ---
> > tools/hv/Makefile | 2 ++
> > 1 files changed, 2 insertions(+), 0 deletions(-)
> >
> > diff --git a/tools/hv/Makefile b/tools/hv/Makefile
> > index a8ab795..a8c4644 100644
> > --- a/tools/hv/Makefile
> > +++ b/tools/hv/Makefile
> > @@ -5,6 +5,8 @@ PTHREAD_LIBS = -lpthread
> > WARNINGS = -Wall -Wextra
> > CFLAGS = $(WARNINGS) -g $(PTHREAD_LIBS) $(shell getconf LFS_CFLAGS)
> >
> > +CFLAGS += -D__EXPORTED_HEADERS__ -I../../include/uapi -I../../include
>
> Why do you need ../../include also?
Because include/uapi/linux/stddef.h includes linux/compiler.h, so
omitting ../../include yields:
gcc -Wall -Wextra -g -lpthread -D__EXPORTED_HEADERS__ -I../../include/uapi -o hv_kvp_daemon hv_kvp_daemon.c
In file included from ../../include/uapi/linux/posix_types.h:4:0,
from ../../include/uapi/linux/types.h:13,
from ../../include/uapi/linux/uuid.h:24,
from ../../include/uapi/linux/hyperv.h:28,
from hv_kvp_daemon.c:36:
../../include/uapi/linux/stddef.h:1:28: fatal error: linux/compiler.h: No such file or directory
#include <linux/compiler.h>
^
-Kamal
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
[toc] | [prev] | [next] | [standalone]
| From | Kamal Mostafa <kamal@canonical.com> |
|---|---|
| Date | 2015-12-15 19:30 +0100 |
| Subject | [PATCH v2] tools/hv: Use include/uapi with __EXPORTED_HEADERS__ |
| Message-ID | <qG2wi-7PJ-15@gated-at.bofh.it> |
| In reply to | #1292428 |
From f424410bf4a6a0dd6ff88bec808798016f4161a0 Mon Sep 17 00:00:00 2001
From: Kamal Mostafa <kamal@canonical.com>
Date: Wed, 11 Nov 2015 19:16:59 +0000
Subject: tools/hv: Use include/uapi with __EXPORTED_HEADERS__
Use the local uapi headers to keep in sync with "recently" added #define's
(e.g. VSS_OP_REGISTER1).
Fixes: 3eb2094c59e8 ("Adding makefile for tools/hv")
Cc: <stable@vger.kernel.org>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
tools/hv/Makefile | 2 ++
1 file changed, 2 insertions(+)
diff --git a/tools/hv/Makefile b/tools/hv/Makefile
index a8ab795..a8c4644 100644
--- a/tools/hv/Makefile
+++ b/tools/hv/Makefile
@@ -5,6 +5,8 @@ PTHREAD_LIBS = -lpthread
WARNINGS = -Wall -Wextra
CFLAGS = $(WARNINGS) -g $(PTHREAD_LIBS) $(shell getconf LFS_CFLAGS)
+CFLAGS += -D__EXPORTED_HEADERS__ -I../../include/uapi -I../../include
+
all: hv_kvp_daemon hv_vss_daemon hv_fcopy_daemon
%: %.c
$(CC) $(CFLAGS) -o $@ $^
--
1.9.1
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
[toc] | [prev] | [next] | [standalone]
| From | Greg KH <gregkh@linuxfoundation.org> |
|---|---|
| Date | 2015-12-15 19:50 +0100 |
| Subject | Re: [PATCH v2] tools/hv: Use include/uapi with __EXPORTED_HEADERS__ |
| Message-ID | <qG2PE-7Xw-11@gated-at.bofh.it> |
| In reply to | #1292437 |
On Tue, Dec 15, 2015 at 10:21:38AM -0800, Kamal Mostafa wrote: > >From f424410bf4a6a0dd6ff88bec808798016f4161a0 Mon Sep 17 00:00:00 2001 > From: Kamal Mostafa <kamal@canonical.com> > Date: Wed, 11 Nov 2015 19:16:59 +0000 > Subject: tools/hv: Use include/uapi with __EXPORTED_HEADERS__ Why is all of this mess here? Please don't do that... -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[toc] | [prev] | [next] | [standalone]
Page 1 of 2 [1] 2 Next page →
Back to top | Article view | linux.kernel
csiph-web