Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1513435
| From | kys@exchange.microsoft.com |
|---|---|
| Newsgroups | linux.kernel |
| Subject | [PATCH V2 05/14] Drivers: hv: balloon: Add logging for dynamic memory operations |
| Date | 2016-11-01 19:20 +0100 |
| Message-ID | <syLPd-3J3-63@gated-at.bofh.it> (permalink) |
| References | <syLPb-3J3-1@gated-at.bofh.it> <syLPc-3J3-7@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
From: Alex Ng <alexng@messages.microsoft.com>
Added logging to help troubleshoot common ballooning, hot add,
and versioning issues.
Signed-off-by: Alex Ng <alexng@microsoft.com>
Signed-off-by: K. Y. Srinivasan <kys@microsoft.com>
---
drivers/hv/hv_balloon.c | 31 ++++++++++++++++++++++++++++---
1 files changed, 28 insertions(+), 3 deletions(-)
diff --git a/drivers/hv/hv_balloon.c b/drivers/hv/hv_balloon.c
index 8f932aa..8cac29a 100644
--- a/drivers/hv/hv_balloon.c
+++ b/drivers/hv/hv_balloon.c
@@ -564,6 +564,11 @@ struct hv_dynmem_device {
* next version to try.
*/
__u32 next_version;
+
+ /*
+ * The negotiated version agreed by host.
+ */
+ __u32 version;
};
static struct hv_dynmem_device dm_device;
@@ -645,6 +650,7 @@ static void hv_bring_pgs_online(struct hv_hotadd_state *has,
{
int i;
+ pr_debug("Online %lu pages starting at pfn 0x%lx\n", size, start_pfn);
for (i = 0; i < size; i++)
hv_page_online_one(has, pfn_to_page(start_pfn + i));
}
@@ -685,7 +691,7 @@ static void hv_mem_hot_add(unsigned long start, unsigned long size,
(HA_CHUNK << PAGE_SHIFT));
if (ret) {
- pr_info("hot_add memory failed error is %d\n", ret);
+ pr_warn("hot_add memory failed error is %d\n", ret);
if (ret == -EEXIST) {
/*
* This error indicates that the error
@@ -814,6 +820,9 @@ static unsigned long handle_pg_range(unsigned long pg_start,
unsigned long old_covered_state;
unsigned long res = 0, flags;
+ pr_debug("Hot adding %lu pages starting at pfn 0x%lx.\n", pg_count,
+ pg_start);
+
spin_lock_irqsave(&dm_device.ha_lock, flags);
list_for_each_entry(has, &dm_device.ha_region_list, list) {
/*
@@ -1196,8 +1205,6 @@ static unsigned int alloc_balloon_pages(struct hv_dynmem_device *dm,
return num_pages;
}
-
-
static void balloon_up(struct work_struct *dummy)
{
unsigned int num_pages = dm_device.balloon_wrk.num_pages;
@@ -1224,6 +1231,10 @@ static void balloon_up(struct work_struct *dummy)
/* Refuse to balloon below the floor, keep the 2M granularity. */
if (avail_pages < num_pages || avail_pages - num_pages < floor) {
+ pr_warn("Balloon request will be partially fulfilled. %s\n",
+ avail_pages < num_pages ? "Not enough memory." :
+ "Balloon floor reached.");
+
num_pages = avail_pages > floor ? (avail_pages - floor) : 0;
num_pages -= num_pages % PAGES_IN_2M;
}
@@ -1245,6 +1256,9 @@ static void balloon_up(struct work_struct *dummy)
}
if (num_ballooned == 0 || num_ballooned == num_pages) {
+ pr_debug("Ballooned %u out of %u requested pages.\n",
+ num_pages, dm_device.balloon_wrk.num_pages);
+
bl_resp->more_pages = 0;
done = true;
dm_device.state = DM_INITIALIZED;
@@ -1292,12 +1306,16 @@ static void balloon_down(struct hv_dynmem_device *dm,
int range_count = req->range_count;
struct dm_unballoon_response resp;
int i;
+ unsigned int prev_pages_ballooned = dm->num_pages_ballooned;
for (i = 0; i < range_count; i++) {
free_balloon_pages(dm, &range_array[i]);
complete(&dm_device.config_event);
}
+ pr_debug("Freed %u ballooned pages.\n",
+ prev_pages_ballooned - dm->num_pages_ballooned);
+
if (req->more_pages == 1)
return;
@@ -1365,6 +1383,7 @@ static void version_resp(struct hv_dynmem_device *dm,
version_req.hdr.size = sizeof(struct dm_version_request);
version_req.hdr.trans_id = atomic_inc_return(&trans_id);
version_req.version.version = dm->next_version;
+ dm->version = version_req.version.version;
/*
* Set the next version to try in case current version fails.
@@ -1557,6 +1576,7 @@ static int balloon_probe(struct hv_device *dev,
version_req.hdr.trans_id = atomic_inc_return(&trans_id);
version_req.version.version = DYNMEM_PROTOCOL_VERSION_WIN10;
version_req.is_last_attempt = 0;
+ dm_device.version = version_req.version.version;
ret = vmbus_sendpacket(dev->channel, &version_req,
sizeof(struct dm_version_request),
@@ -1579,6 +1599,11 @@ static int balloon_probe(struct hv_device *dev,
ret = -ETIMEDOUT;
goto probe_error2;
}
+
+ pr_info("Using Dynamic Memory protocol version %u.%u\n",
+ DYNMEM_MAJOR_VERSION(dm_device.version),
+ DYNMEM_MINOR_VERSION(dm_device.version));
+
/*
* Now submit our capabilities to the host.
*/
--
1.7.4.1
Back to linux.kernel | Previous | Next — Previous in thread | Find similar | Unroll thread
[PATCH V2 00/14] Drivers: hv: Some miscellaneous fixes and enhancements kys@exchange.microsoft.com - 2016-11-01 19:20 +0100
[PATCH V2 08/14] Drivers: hv: balloon: Fix info request to show max page count kys@exchange.microsoft.com - 2016-11-01 19:20 +0100
Re: [PATCH V2 08/14] Drivers: hv: balloon: Fix info request to show max page count Dan Carpenter <dan.carpenter@oracle.com> - 2016-11-10 20:20 +0100
RE: [PATCH V2 08/14] Drivers: hv: balloon: Fix info request to show max page count "Alex Ng (LIS)" <alexng@microsoft.com> - 2016-11-11 00:20 +0100
[PATCH V2 04/14] Drivers: hv: balloon: Disable hot add when CONFIG_MEMORY_HOTPLUG is not set kys@exchange.microsoft.com - 2016-11-01 19:20 +0100
[PATCH V2 02/14] Drivers: hv: utils: reduce HV_UTIL_NEGO_TIMEOUT timeout kys@exchange.microsoft.com - 2016-11-01 19:20 +0100
[PATCH V2 12/14] Drivers: hv: vmbus: Base host signaling strictly on the ring state kys@exchange.microsoft.com - 2016-11-01 19:20 +0100
[PATCH V2 03/14] Drivers: hv: utils: Fix the mapping between host version and protocol to use kys@exchange.microsoft.com - 2016-11-01 19:20 +0100
[PATCH V2 11/14] tools: hv: remove unnecessary header files and netlink related code kys@exchange.microsoft.com - 2016-11-01 19:20 +0100
[PATCH V2 14/14] Drivers: hv: vmbus: On the read path cleanup the logic to interrupt the host kys@exchange.microsoft.com - 2016-11-01 19:20 +0100
[PATCH V2 07/14] Drivers: hv: vss: Operation timeouts should match host expectation kys@exchange.microsoft.com - 2016-11-01 19:20 +0100
[PATCH V2 01/14] Drivers: hv: ring_buffer: count on wrap around mappings in get_next_pkt_raw() (v2) kys@exchange.microsoft.com - 2016-11-01 19:20 +0100
[PATCH V2 10/14] tools: hv: fix a compile warning in snprintf kys@exchange.microsoft.com - 2016-11-01 19:20 +0100
[PATCH V2 06/14] Drivers: hv: vss: Improve log messages. kys@exchange.microsoft.com - 2016-11-01 19:20 +0100
[PATCH V2 09/14] tools: hv: remove unnecessary link flag kys@exchange.microsoft.com - 2016-11-01 19:20 +0100
[PATCH V2 13/14] Drivers: hv: vmbus: On write cleanup the logic to interrupt the host kys@exchange.microsoft.com - 2016-11-01 19:20 +0100
[PATCH V2 05/14] Drivers: hv: balloon: Add logging for dynamic memory operations kys@exchange.microsoft.com - 2016-11-01 19:20 +0100
csiph-web