All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/2] Drivers: hv: util: Some fixes to the backup driver
@ 2016-08-18 18:16 kys
  2016-08-18 18:16 ` [PATCH 1/2] Drivers: hv: utils: Continue to poll VSS channel after handling requests kys
  0 siblings, 1 reply; 5+ messages in thread
From: kys @ 2016-08-18 18:16 UTC (permalink / raw)
  To: gregkh, linux-kernel, devel, olaf, apw, vkuznets, jasowang,
	leann.ogasawara
  Cc: K. Y. Srinivasan

From: K. Y. Srinivasan <kys@microsoft.com>

Some fixes to the backup driver.

Alex Ng (2):
  Drivers: hv: utils: Continue to poll VSS channel after handling
    requests.
  Drivers: hv: utils: Check VSS daemon is listening before a hot backup

 drivers/hv/hv_snapshot.c |   92 ++++++++++++++++++++++-----------------------
 tools/hv/hv_vss_daemon.c |    3 +
 2 files changed, 48 insertions(+), 47 deletions(-)

-- 
1.7.4.1

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH 1/2] Drivers: hv: utils: Continue to poll VSS channel after handling requests.
  2016-08-18 18:16 [PATCH 0/2] Drivers: hv: util: Some fixes to the backup driver kys
@ 2016-08-18 18:16 ` kys
  2016-08-18 18:16   ` [PATCH 2/2] Drivers: hv: utils: Check VSS daemon is listening before a hot backup kys
  2016-08-31 10:45   ` [PATCH 1/2] Drivers: hv: utils: Continue to poll VSS channel after handling requests Greg KH
  0 siblings, 2 replies; 5+ messages in thread
From: kys @ 2016-08-18 18:16 UTC (permalink / raw)
  To: gregkh, linux-kernel, devel, olaf, apw, vkuznets, jasowang,
	leann.ogasawara
  Cc: Alex Ng, K. Y. Srinivasan

From: Alex Ng <alexng@microsoft.com>

Multiple VSS_OP_HOT_BACKUP requests may arrive in quick succession, even
though the host only signals once. The driver wass handling the first
request while ignoring the others in the ring buffer. We should poll the
VSS channel after handling a request to continue processing other requests.

Signed-off-by: Alex Ng <alexng@microsoft.com>
Signed-off-by: K. Y. Srinivasan <kys@microsoft.com>
---
 drivers/hv/hv_snapshot.c |   89 +++++++++++++++++++++------------------------
 1 files changed, 42 insertions(+), 47 deletions(-)

diff --git a/drivers/hv/hv_snapshot.c b/drivers/hv/hv_snapshot.c
index 3fba14e..4c8dd20 100644
--- a/drivers/hv/hv_snapshot.c
+++ b/drivers/hv/hv_snapshot.c
@@ -67,11 +67,11 @@ static const char vss_devname[] = "vmbus/hv_vss";
 static __u8 *recv_buffer;
 static struct hvutil_transport *hvt;
 
-static void vss_send_op(struct work_struct *dummy);
 static void vss_timeout_func(struct work_struct *dummy);
+static void vss_handle_request(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 DECLARE_WORK(vss_handle_request_work, vss_handle_request);
 
 static void vss_poll_wrapper(void *channel)
 {
@@ -150,8 +150,7 @@ static int vss_on_msg(void *msg, int len)
 	return 0;
 }
 
-
-static void vss_send_op(struct work_struct *dummy)
+static void vss_send_op(void)
 {
 	int op = vss_transaction.msg->vss_hdr.operation;
 	int rc;
@@ -168,6 +167,8 @@ static void vss_send_op(struct work_struct *dummy)
 	vss_msg->vss_hdr.operation = op;
 
 	vss_transaction.state = HVUTIL_USERSPACE_REQ;
+
+	schedule_delayed_work(&vss_timeout_work, VSS_USERSPACE_TIMEOUT);
 	rc = hvutil_transport_send(hvt, vss_msg, sizeof(*vss_msg));
 	if (rc) {
 		pr_warn("VSS: failed to communicate to the daemon: %d\n", rc);
@@ -182,6 +183,40 @@ static void vss_send_op(struct work_struct *dummy)
 	return;
 }
 
+static void vss_handle_request(struct work_struct *dummy)
+{
+	switch (vss_transaction.msg->vss_hdr.operation) {
+	/*
+	 * Initiate a "freeze/thaw" operation in the guest.
+	 * We respond to the host once the operation is complete.
+	 *
+	 * We send the message to the user space daemon and the operation is
+	 * performed in the daemon.
+	 */
+	case VSS_OP_THAW:
+	case VSS_OP_FREEZE:
+		if (vss_transaction.state < HVUTIL_READY) {
+			/* Userspace is not registered yet */
+			vss_respond_to_host(HV_E_FAIL);
+			return;
+		}
+		vss_transaction.state = HVUTIL_HOSTMSG_RECEIVED;
+		vss_send_op();
+		return;
+	case VSS_OP_HOT_BACKUP:
+		vss_transaction.msg->vss_cf.flags = VSS_HBU_NO_AUTO_RECOVERY;
+		break;
+	case VSS_OP_GET_DM_INFO:
+		vss_transaction.msg->dm_info.flags = 0;
+		break;
+	default:
+		break;
+	}
+
+	vss_respond_to_host(0);
+	hv_poll_channel(vss_transaction.recv_channel, vss_poll_wrapper);
+}
+
 /*
  * Send a response back to the host.
  */
@@ -266,48 +301,8 @@ void hv_vss_onchannelcallback(void *context)
 			vss_transaction.recv_req_id = requestid;
 			vss_transaction.msg = (struct hv_vss_msg *)vss_msg;
 
-			switch (vss_msg->vss_hdr.operation) {
-				/*
-				 * Initiate a "freeze/thaw"
-				 * operation in the guest.
-				 * We respond to the host once
-				 * the operation is complete.
-				 *
-				 * We send the message to the
-				 * user space daemon and the
-				 * operation is performed in
-				 * the daemon.
-				 */
-			case VSS_OP_FREEZE:
-			case VSS_OP_THAW:
-				if (vss_transaction.state < HVUTIL_READY) {
-					/* Userspace is not registered yet */
-					vss_respond_to_host(HV_E_FAIL);
-					return;
-				}
-				vss_transaction.state = HVUTIL_HOSTMSG_RECEIVED;
-				schedule_work(&vss_send_op_work);
-				schedule_delayed_work(&vss_timeout_work,
-						      VSS_USERSPACE_TIMEOUT);
-				return;
-
-			case VSS_OP_HOT_BACKUP:
-				vss_msg->vss_cf.flags =
-					 VSS_HBU_NO_AUTO_RECOVERY;
-				vss_respond_to_host(0);
-				return;
-
-			case VSS_OP_GET_DM_INFO:
-				vss_msg->dm_info.flags = 0;
-				vss_respond_to_host(0);
-				return;
-
-			default:
-				vss_respond_to_host(0);
-				return;
-
-			}
-
+			schedule_work(&vss_handle_request_work);
+			return;
 		}
 
 		icmsghdrp->icflags = ICMSGHDRFLAG_TRANSACTION
@@ -358,6 +353,6 @@ void hv_vss_deinit(void)
 {
 	vss_transaction.state = HVUTIL_DEVICE_DYING;
 	cancel_delayed_work_sync(&vss_timeout_work);
-	cancel_work_sync(&vss_send_op_work);
+	cancel_work_sync(&vss_handle_request_work);
 	hvutil_transport_destroy(hvt);
 }
-- 
1.7.4.1

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH 2/2] Drivers: hv: utils: Check VSS daemon is listening before a hot backup
  2016-08-18 18:16 ` [PATCH 1/2] Drivers: hv: utils: Continue to poll VSS channel after handling requests kys
@ 2016-08-18 18:16   ` kys
  2016-08-31 10:45   ` [PATCH 1/2] Drivers: hv: utils: Continue to poll VSS channel after handling requests Greg KH
  1 sibling, 0 replies; 5+ messages in thread
From: kys @ 2016-08-18 18:16 UTC (permalink / raw)
  To: gregkh, linux-kernel, devel, olaf, apw, vkuznets, jasowang,
	leann.ogasawara
  Cc: Alex Ng, K. Y. Srinivasan

From: Alex Ng <alexng@messages.microsoft.com>

Hyper-V host will send a VSS_OP_HOT_BACKUP request to check if guest is
ready for a live backup/snapshot. The driver should respond to the check
only if the daemon is running and listening to requests. This allows the
host to fallback to standard snapshots in case the VSS daemon is not
running.

Signed-off-by: Alex Ng <alexng@messages.microsoft.com>
Signed-off-by: K. Y. Srinivasan <kys@microsoft.com>
---
 drivers/hv/hv_snapshot.c |    9 ++++++---
 tools/hv/hv_vss_daemon.c |    3 +++
 2 files changed, 9 insertions(+), 3 deletions(-)

diff --git a/drivers/hv/hv_snapshot.c b/drivers/hv/hv_snapshot.c
index 4c8dd20..4cfd854 100644
--- a/drivers/hv/hv_snapshot.c
+++ b/drivers/hv/hv_snapshot.c
@@ -136,6 +136,11 @@ static int vss_on_msg(void *msg, int len)
 		return vss_handle_handshake(vss_msg);
 	} else if (vss_transaction.state == HVUTIL_USERSPACE_REQ) {
 		vss_transaction.state = HVUTIL_USERSPACE_RECV;
+
+		if (vss_msg->vss_hdr.operation == VSS_OP_HOT_BACKUP)
+			vss_transaction.msg->vss_cf.flags =
+				VSS_HBU_NO_AUTO_RECOVERY;
+
 		if (cancel_delayed_work_sync(&vss_timeout_work)) {
 			vss_respond_to_host(vss_msg->error);
 			/* Transaction is finished, reset the state. */
@@ -195,6 +200,7 @@ static void vss_handle_request(struct work_struct *dummy)
 	 */
 	case VSS_OP_THAW:
 	case VSS_OP_FREEZE:
+	case VSS_OP_HOT_BACKUP:
 		if (vss_transaction.state < HVUTIL_READY) {
 			/* Userspace is not registered yet */
 			vss_respond_to_host(HV_E_FAIL);
@@ -203,9 +209,6 @@ static void vss_handle_request(struct work_struct *dummy)
 		vss_transaction.state = HVUTIL_HOSTMSG_RECEIVED;
 		vss_send_op();
 		return;
-	case VSS_OP_HOT_BACKUP:
-		vss_transaction.msg->vss_cf.flags = VSS_HBU_NO_AUTO_RECOVERY;
-		break;
 	case VSS_OP_GET_DM_INFO:
 		vss_transaction.msg->dm_info.flags = 0;
 		break;
diff --git a/tools/hv/hv_vss_daemon.c b/tools/hv/hv_vss_daemon.c
index 5d51d6f..e082980 100644
--- a/tools/hv/hv_vss_daemon.c
+++ b/tools/hv/hv_vss_daemon.c
@@ -250,6 +250,9 @@ int main(int argc, char *argv[])
 				syslog(LOG_ERR, "/etc/fstab and /proc/mounts");
 			}
 			break;
+		case VSS_OP_HOT_BACKUP:
+			syslog(LOG_INFO, "VSS: op=CHECK HOT BACKUP\n");
+			break;
 		default:
 			syslog(LOG_ERR, "Illegal op:%d\n", op);
 		}
-- 
1.7.4.1

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH 1/2] Drivers: hv: utils: Continue to poll VSS channel after handling requests.
  2016-08-18 18:16 ` [PATCH 1/2] Drivers: hv: utils: Continue to poll VSS channel after handling requests kys
  2016-08-18 18:16   ` [PATCH 2/2] Drivers: hv: utils: Check VSS daemon is listening before a hot backup kys
@ 2016-08-31 10:45   ` Greg KH
  2016-08-31 17:57     ` KY Srinivasan
  1 sibling, 1 reply; 5+ messages in thread
From: Greg KH @ 2016-08-31 10:45 UTC (permalink / raw)
  To: kys
  Cc: linux-kernel, devel, olaf, apw, vkuznets, jasowang,
	leann.ogasawara, Alex Ng

On Thu, Aug 18, 2016 at 11:16:54AM -0700, kys@exchange.microsoft.com wrote:
> From: Alex Ng <alexng@microsoft.com>
> 
> Multiple VSS_OP_HOT_BACKUP requests may arrive in quick succession, even
> though the host only signals once. The driver wass handling the first
> request while ignoring the others in the ring buffer. We should poll the
> VSS channel after handling a request to continue processing other requests.
> 
> Signed-off-by: Alex Ng <alexng@microsoft.com>
> Signed-off-by: K. Y. Srinivasan <kys@microsoft.com>
> ---
>  drivers/hv/hv_snapshot.c |   89 +++++++++++++++++++++------------------------
>  1 files changed, 42 insertions(+), 47 deletions(-)

Also doesn't apply, please fix up and resend this series.

thanks,

greg k-h

^ permalink raw reply	[flat|nested] 5+ messages in thread

* RE: [PATCH 1/2] Drivers: hv: utils: Continue to poll VSS channel after handling requests.
  2016-08-31 10:45   ` [PATCH 1/2] Drivers: hv: utils: Continue to poll VSS channel after handling requests Greg KH
@ 2016-08-31 17:57     ` KY Srinivasan
  0 siblings, 0 replies; 5+ messages in thread
From: KY Srinivasan @ 2016-08-31 17:57 UTC (permalink / raw)
  To: Greg KH
  Cc: linux-kernel, devel, olaf, apw, vkuznets, jasowang,
	leann.ogasawara, Alex Ng (LIS)



> -----Original Message-----
> From: Greg KH [mailto:gregkh@linuxfoundation.org]
> Sent: Wednesday, August 31, 2016 4:16 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; leann.ogasawara@canonical.com; Alex Ng (LIS)
> <alexng@microsoft.com>
> Subject: Re: [PATCH 1/2] Drivers: hv: utils: Continue to poll VSS channel after
> handling requests.
> 
> On Thu, Aug 18, 2016 at 11:16:54AM -0700, kys@exchange.microsoft.com
> wrote:
> > From: Alex Ng <alexng@microsoft.com>
> >
> > Multiple VSS_OP_HOT_BACKUP requests may arrive in quick succession, even
> > though the host only signals once. The driver wass handling the first
> > request while ignoring the others in the ring buffer. We should poll the
> > VSS channel after handling a request to continue processing other requests.
> >
> > Signed-off-by: Alex Ng <alexng@microsoft.com>
> > Signed-off-by: K. Y. Srinivasan <kys@microsoft.com>
> > ---
> >  drivers/hv/hv_snapshot.c |   89 +++++++++++++++++++++------------------------
> >  1 files changed, 42 insertions(+), 47 deletions(-)
> 
> Also doesn't apply, please fix up and resend this series.

Will do.

K. Y
> 
> thanks,
> 
> greg k-h

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2016-08-31 18:13 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-08-18 18:16 [PATCH 0/2] Drivers: hv: util: Some fixes to the backup driver kys
2016-08-18 18:16 ` [PATCH 1/2] Drivers: hv: utils: Continue to poll VSS channel after handling requests kys
2016-08-18 18:16   ` [PATCH 2/2] Drivers: hv: utils: Check VSS daemon is listening before a hot backup kys
2016-08-31 10:45   ` [PATCH 1/2] Drivers: hv: utils: Continue to poll VSS channel after handling requests Greg KH
2016-08-31 17:57     ` KY Srinivasan

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.