mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH 0/5] Drivers: hv: Miscellaneous fixes
@ 2017-08-06 20:12 kys
  2017-08-06 20:12 ` [PATCH 1/5] Tools: hv: vss: Skip freezing filesystems backed by loop kys
                   ` (4 more replies)
  0 siblings, 5 replies; 9+ messages in thread
From: kys @ 2017-08-06 20:12 UTC (permalink / raw)
  To: gregkh, linux-kernel, devel, olaf, apw, vkuznets, jasowang,
	leann.ogasawara, marcelo.cerri, sthemmin
  Cc: K. Y. Srinivasan

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

Miscellaneous fixes.

Alex Ng (5):
  Tools: hv: vss: Skip freezing filesystems backed by loop
  Drivers: hv: balloon: Correctly update onlined page count
  Drivers: hv: balloon: Show the max dynamic memory assigned
  Drivers: hv: balloon: Initialize last_post_time on startup
  Drivers: hv: kvp: Use MAX_ADAPTER_ID_SIZE for translating adapter id

 drivers/hv/hv_balloon.c  |   12 ++++++------
 drivers/hv/hv_kvp.c      |    2 +-
 tools/hv/hv_vss_daemon.c |    7 +++++++
 3 files changed, 14 insertions(+), 7 deletions(-)

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

* [PATCH 1/5] Tools: hv: vss: Skip freezing filesystems backed by loop
  2017-08-06 20:12 [PATCH 0/5] Drivers: hv: Miscellaneous fixes kys
@ 2017-08-06 20:12 ` kys
  2017-08-06 20:12 ` [PATCH 2/5] Drivers: hv: balloon: Correctly update onlined page count kys
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 9+ messages in thread
From: kys @ 2017-08-06 20:12 UTC (permalink / raw)
  To: gregkh, linux-kernel, devel, olaf, apw, vkuznets, jasowang,
	leann.ogasawara, marcelo.cerri, sthemmin
  Cc: Alex Ng, Vyronas Tsingaras, K. Y. Srinivasan

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

Since a loop device is backed by a file, a backup will already result in
its parent filesystem being frozen. It's sufficient to just freeze the
parent filesystem, so we can skip the loop device.

This avoids a situation where a loop device and its parent filesystem are
both frozen and then thawed out of order. For example, if the loop device
is enumerated first, we would thaw it while its parent filesystem is still
frozen. The thaw operation fails and the loop device remains frozen.

Signed-off-by: Alex Ng <alexng@messages.microsoft.com>
Signed-off-by: Vyronas Tsingaras <vyronas@vtsingaras.me>
Signed-off-by: K. Y. Srinivasan <kys@microsoft.com>
---
 tools/hv/hv_vss_daemon.c |    7 +++++++
 1 files changed, 7 insertions(+), 0 deletions(-)

diff --git a/tools/hv/hv_vss_daemon.c b/tools/hv/hv_vss_daemon.c
index 7ba5419..b2b4ebf 100644
--- a/tools/hv/hv_vss_daemon.c
+++ b/tools/hv/hv_vss_daemon.c
@@ -21,6 +21,7 @@
 #include <sys/types.h>
 #include <sys/poll.h>
 #include <sys/ioctl.h>
+#include <sys/stat.h>
 #include <fcntl.h>
 #include <stdio.h>
 #include <mntent.h>
@@ -30,6 +31,7 @@
 #include <ctype.h>
 #include <errno.h>
 #include <linux/fs.h>
+#include <linux/major.h>
 #include <linux/hyperv.h>
 #include <syslog.h>
 #include <getopt.h>
@@ -70,6 +72,7 @@ static int vss_operate(int operation)
 	char match[] = "/dev/";
 	FILE *mounts;
 	struct mntent *ent;
+	struct stat sb;
 	char errdir[1024] = {0};
 	unsigned int cmd;
 	int error = 0, root_seen = 0, save_errno = 0;
@@ -92,6 +95,10 @@ static int vss_operate(int operation)
 	while ((ent = getmntent(mounts))) {
 		if (strncmp(ent->mnt_fsname, match, strlen(match)))
 			continue;
+		if (stat(ent->mnt_fsname, &sb) == -1)
+			continue;
+		if (S_ISBLK(sb.st_mode) && major(sb.st_rdev) == LOOP_MAJOR)
+			continue;
 		if (hasmntopt(ent, MNTOPT_RO) != NULL)
 			continue;
 		if (strcmp(ent->mnt_type, "vfat") == 0)
-- 
1.7.1

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

* [PATCH 2/5] Drivers: hv: balloon: Correctly update onlined page count
  2017-08-06 20:12 [PATCH 0/5] Drivers: hv: Miscellaneous fixes kys
  2017-08-06 20:12 ` [PATCH 1/5] Tools: hv: vss: Skip freezing filesystems backed by loop kys
@ 2017-08-06 20:12 ` kys
  2017-08-06 20:12 ` [PATCH 3/5] Drivers: hv: balloon: Show the max dynamic memory assigned kys
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 9+ messages in thread
From: kys @ 2017-08-06 20:12 UTC (permalink / raw)
  To: gregkh, linux-kernel, devel, olaf, apw, vkuznets, jasowang,
	leann.ogasawara, marcelo.cerri, sthemmin
  Cc: Alex Ng, K. Y. Srinivasan

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

Previously, num_pages_onlined was updated using value from memory online
notifier. This is incorrect because they assume that all hot-added pages
are online, even though we only online the amount that's backed by the
host. We should update num_pages_onlined only when the balloon driver
marks a page as online.

Signed-off-by: Alex Ng <alexng@messages.microsoft.com>
Signed-off-by: K. Y. Srinivasan <kys@microsoft.com>
---
 drivers/hv/hv_balloon.c |    7 +++----
 1 files changed, 3 insertions(+), 4 deletions(-)

diff --git a/drivers/hv/hv_balloon.c b/drivers/hv/hv_balloon.c
index f5728de..0a5c318 100644
--- a/drivers/hv/hv_balloon.c
+++ b/drivers/hv/hv_balloon.c
@@ -584,10 +584,6 @@ static int hv_memory_notifier(struct notifier_block *nb, unsigned long val,
 
 	switch (val) {
 	case MEM_ONLINE:
-		spin_lock_irqsave(&dm_device.ha_lock, flags);
-		dm_device.num_pages_onlined += mem->nr_pages;
-		spin_unlock_irqrestore(&dm_device.ha_lock, flags);
-		/* Fall through */
 	case MEM_CANCEL_ONLINE:
 		if (dm_device.ha_waiting) {
 			dm_device.ha_waiting = false;
@@ -644,6 +640,9 @@ static void hv_page_online_one(struct hv_hotadd_state *has, struct page *pg)
 	__online_page_set_limits(pg);
 	__online_page_increment_counters(pg);
 	__online_page_free(pg);
+
+	WARN_ON_ONCE(!spin_is_locked(&dm_device.ha_lock));
+	dm_device.num_pages_onlined++;
 }
 
 static void hv_bring_pgs_online(struct hv_hotadd_state *has,
-- 
1.7.1

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

* [PATCH 3/5] Drivers: hv: balloon: Show the max dynamic memory assigned
  2017-08-06 20:12 [PATCH 0/5] Drivers: hv: Miscellaneous fixes kys
  2017-08-06 20:12 ` [PATCH 1/5] Tools: hv: vss: Skip freezing filesystems backed by loop kys
  2017-08-06 20:12 ` [PATCH 2/5] Drivers: hv: balloon: Correctly update onlined page count kys
@ 2017-08-06 20:12 ` kys
  2017-08-06 20:12 ` [PATCH 4/5] Drivers: hv: balloon: Initialize last_post_time on startup kys
  2017-08-06 20:12 ` [PATCH 5/5] Drivers: hv: kvp: Use MAX_ADAPTER_ID_SIZE for translating adapter id kys
  4 siblings, 0 replies; 9+ messages in thread
From: kys @ 2017-08-06 20:12 UTC (permalink / raw)
  To: gregkh, linux-kernel, devel, olaf, apw, vkuznets, jasowang,
	leann.ogasawara, marcelo.cerri, sthemmin
  Cc: Alex Ng, K. Y. Srinivasan

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

Previously we were only showing max number of pages. We should make it
more clear that this value is the max amount of dynamic memory that the
Hyper-V host is willing to assign to this guest.

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

diff --git a/drivers/hv/hv_balloon.c b/drivers/hv/hv_balloon.c
index 0a5c318..7cec482 100644
--- a/drivers/hv/hv_balloon.c
+++ b/drivers/hv/hv_balloon.c
@@ -1035,8 +1035,8 @@ static void process_info(struct hv_dynmem_device *dm, struct dm_info_msg *msg)
 		if (info_hdr->data_size == sizeof(__u64)) {
 			__u64 *max_page_count = (__u64 *)&info_hdr[1];
 
-			pr_info("INFO_TYPE_MAX_PAGE_CNT = %llu\n",
-				*max_page_count);
+			pr_info("Max. dynamic memory size: %llu MB\n",
+				(*max_page_count) >> (20 - PAGE_SHIFT));
 		}
 
 		break;
-- 
1.7.1

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

* [PATCH 4/5] Drivers: hv: balloon: Initialize last_post_time on startup
  2017-08-06 20:12 [PATCH 0/5] Drivers: hv: Miscellaneous fixes kys
                   ` (2 preceding siblings ...)
  2017-08-06 20:12 ` [PATCH 3/5] Drivers: hv: balloon: Show the max dynamic memory assigned kys
@ 2017-08-06 20:12 ` kys
  2017-08-06 20:12 ` [PATCH 5/5] Drivers: hv: kvp: Use MAX_ADAPTER_ID_SIZE for translating adapter id kys
  4 siblings, 0 replies; 9+ messages in thread
From: kys @ 2017-08-06 20:12 UTC (permalink / raw)
  To: gregkh, linux-kernel, devel, olaf, apw, vkuznets, jasowang,
	leann.ogasawara, marcelo.cerri, sthemmin
  Cc: Alex Ng, K. Y. Srinivasan

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

When left uninitialized, this sometimes fails the following check in
post_status():

	if (!time_after(now, (last_post_time + HZ))) {
		return;
        }

This causes unnecessary delays in reporting memory pressure to host after
booting up.

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

diff --git a/drivers/hv/hv_balloon.c b/drivers/hv/hv_balloon.c
index 7cec482..db0e665 100644
--- a/drivers/hv/hv_balloon.c
+++ b/drivers/hv/hv_balloon.c
@@ -1655,6 +1655,7 @@ static int balloon_probe(struct hv_device *dev,
 	}
 
 	dm_device.state = DM_INITIALIZED;
+	last_post_time = jiffies;
 
 	return 0;
 
-- 
1.7.1

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

* [PATCH 5/5] Drivers: hv: kvp: Use MAX_ADAPTER_ID_SIZE for translating adapter id
  2017-08-06 20:12 [PATCH 0/5] Drivers: hv: Miscellaneous fixes kys
                   ` (3 preceding siblings ...)
  2017-08-06 20:12 ` [PATCH 4/5] Drivers: hv: balloon: Initialize last_post_time on startup kys
@ 2017-08-06 20:12 ` kys
  4 siblings, 0 replies; 9+ messages in thread
From: kys @ 2017-08-06 20:12 UTC (permalink / raw)
  To: gregkh, linux-kernel, devel, olaf, apw, vkuznets, jasowang,
	leann.ogasawara, marcelo.cerri, sthemmin
  Cc: Alex Ng, K. Y. Srinivasan

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

There's a bug which passes the output buffer size as MAX_IP_ADDR_SIZE,
when converting the adapter_id field to UTF16. This is much larger than
the actual size (MAX_ADAPTER_ID_SIZE). Fix this by passing the proper
size.

Fortunately, the translation is limited by the length of the input. This
explains why we haven't seen output buffer overflow conditions.

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

diff --git a/drivers/hv/hv_kvp.c b/drivers/hv/hv_kvp.c
index 9a90b91..5eed1e7 100644
--- a/drivers/hv/hv_kvp.c
+++ b/drivers/hv/hv_kvp.c
@@ -304,7 +304,7 @@ static int process_ob_ipinfo(void *in_msg, void *out_msg, int op)
 				strlen((char *)in->body.kvp_ip_val.adapter_id),
 				UTF16_HOST_ENDIAN,
 				(wchar_t *)out->kvp_ip_val.adapter_id,
-				MAX_IP_ADDR_SIZE);
+				MAX_ADAPTER_ID_SIZE);
 		if (len < 0)
 			return len;
 
-- 
1.7.1

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

* [PATCH 0/5] Drivers: hv: Miscellaneous fixes
@ 2018-10-17  3:12 kys
  0 siblings, 0 replies; 9+ messages in thread
From: kys @ 2018-10-17  3:12 UTC (permalink / raw)
  To: gregkh, linux-kernel, devel, olaf, apw, jasowang, sthemmin,
	Michael.H.Kelley, vkuznets
  Cc: K. Y. Srinivasan

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

Miscellaneous fixes.

Dexuan Cui (3):
  Drivers: hv: kvp: Fix the recent regression caused by incorrect
    clean-up
  Drivers: hv: kvp: Use %u to print U32
  Tools: hv: kvp: Fix a warning of buffer overflow with gcc 8.0.1

Haiyang Zhang (1):
  hv_utils: update name in struct hv_driver util_drv

K. Y. Srinivasan (1):
  Drivers: hv: vmbus: Get rid of unnecessary state in hv_context

 drivers/hv/hv.c           | 10 +++-------
 drivers/hv/hv_kvp.c       | 28 +++++++++++++++++++++++-----
 drivers/hv/hv_util.c      |  2 +-
 drivers/hv/hyperv_vmbus.h |  2 --
 tools/hv/hv_kvp_daemon.c  |  2 +-
 5 files changed, 28 insertions(+), 16 deletions(-)

-- 
2.18.0


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

* [PATCH 0/5] Drivers: hv: Miscellaneous fixes
@ 2017-09-10  5:53 kys
  0 siblings, 0 replies; 9+ messages in thread
From: kys @ 2017-09-10  5:53 UTC (permalink / raw)
  To: gregkh, linux-kernel, devel, olaf, apw, vkuznets, jasowang,
	leann.ogasawara, marcelo.cerri, sthemmin
  Cc: K. Y. Srinivasan

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

Miscellaneous fixes.

Dexuan Cui (2):
  vmbus: don't acquire the mutex in vmbus_hvsock_device_unregister()
  vmbus: suppress uevents for hv_sock devices

Olaf Hering (1):
  Drivers: hv: fcopy: restore correct transfer length

Stephen Hemminger (2):
  vmbus: add per-channel sysfs info
  Drivers: hv: vmbus: Expose per-channel interrupts and events counters

 Documentation/ABI/stable/sysfs-bus-vmbus |  70 +++++++++++
 drivers/hv/channel_mgmt.c                |  14 ++-
 drivers/hv/connection.c                  |   2 +
 drivers/hv/hv_fcopy.c                    |   4 +
 drivers/hv/hyperv_vmbus.h                |   2 +
 drivers/hv/vmbus_drv.c                   | 205 +++++++++++++++++++++++++++++--
 include/linux/hyperv.h                   |  10 ++
 7 files changed, 290 insertions(+), 17 deletions(-)

-- 
2.14.1

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

* [PATCH 0/5] Drivers: hv: Miscellaneous fixes
@ 2015-09-16  0:37 K. Y. Srinivasan
  0 siblings, 0 replies; 9+ messages in thread
From: K. Y. Srinivasan @ 2015-09-16  0:37 UTC (permalink / raw)
  To: gregkh, linux-kernel, devel, olaf, apw, vkuznets, jasowang
  Cc: K. Y. Srinivasan

The Copy-VMFile cmdlet on the host may fail because the guest fcopy
driver state machine gets out of sync. This happens because the ->state
and ->context variables are accessed by the main thread and from
interrupt context. If an interrupt happens between fcopy_respond_to_host
and hv_poll_channel in fcopy_write, then hv_fcopy_onchannelcallback
called from that interrupt sees still state HVUTIL_USERSPACE_RECV. It
updates the context, but fcopy_write will not notice that update and
hv_poll_channel gets called with an empty context.  As a result
hv_fcopy_daemon gets no more data. After a timeout Copy-VMFile fails
with timeout.

In my initial testing for a fix I put a "mb()" after the last .state
change in fcopy_write. But this series implementes read/write memory
barriers as needed. Let me know if this is overdoing things.


Dexuan Cui (1):
  Drivers: hv: vmbus: fix init_vp_index() for reloading hv_netvsc

Olaf Hering (4):
  hv: add helpers to handle hv_util device state
  hv: fcopy: use wrappers to propagate state
  hv: kvp: use wrappers to propaigate state
  hv: vss: use wrappers to propagate state

 drivers/hv/channel_mgmt.c |   17 +++++++++++++++++
 drivers/hv/hv_fcopy.c     |   36 ++++++++++++++++++++----------------
 drivers/hv/hv_kvp.c       |   39 +++++++++++++++++++++------------------
 drivers/hv/hv_snapshot.c  |   37 ++++++++++++++++++++-----------------
 drivers/hv/hyperv_vmbus.h |   14 ++++++++++++++
 5 files changed, 92 insertions(+), 51 deletions(-)

-- 
1.7.4.1


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

end of thread, other threads:[~2018-10-17  3:13 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-08-06 20:12 [PATCH 0/5] Drivers: hv: Miscellaneous fixes kys
2017-08-06 20:12 ` [PATCH 1/5] Tools: hv: vss: Skip freezing filesystems backed by loop kys
2017-08-06 20:12 ` [PATCH 2/5] Drivers: hv: balloon: Correctly update onlined page count kys
2017-08-06 20:12 ` [PATCH 3/5] Drivers: hv: balloon: Show the max dynamic memory assigned kys
2017-08-06 20:12 ` [PATCH 4/5] Drivers: hv: balloon: Initialize last_post_time on startup kys
2017-08-06 20:12 ` [PATCH 5/5] Drivers: hv: kvp: Use MAX_ADAPTER_ID_SIZE for translating adapter id kys
  -- strict thread matches above, loose matches on Subject: below --
2018-10-17  3:12 [PATCH 0/5] Drivers: hv: Miscellaneous fixes kys
2017-09-10  5:53 kys
2015-09-16  0:37 K. Y. Srinivasan

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®