* [PATCH] hv_balloon: Add the support of hibernation
From: Dexuan Cui @ 2019-09-11 23:36 UTC (permalink / raw)
To: KY Srinivasan, Haiyang Zhang, Stephen Hemminger,
sashal@kernel.org, linux-hyperv@vger.kernel.org,
linux-kernel@vger.kernel.org, Michael Kelley
Cc: Dexuan Cui
When hibernation is enabled, we must ignore the balloon up/down and
hot-add requests from the host, if any.
Fow now, if people want to test hibernation, please blacklist hv_balloon
or do not enable Dynamic Memory and Memory Resizing. See the comment in
balloon_probe() for more info.
Signed-off-by: Dexuan Cui <decui@microsoft.com>
---
This patch is basically a pure Hyper-V specific change and it has a
build dependency on the commit 271b2224d42f ("Drivers: hv: vmbus: Implement
suspend/resume for VSC drivers for hibernation"), which is on Sasha Levin's
Hyper-V tree's hyperv-next branch:
https://git.kernel.org/pub/scm/linux/kernel/git/hyperv/linux.git/log/?h=hyperv-next
I request this patch should go through Sasha's tree rather than the
other tree(s).
drivers/hv/hv_balloon.c | 101 +++++++++++++++++++++++++++++++++++++++++++++++-
1 file changed, 99 insertions(+), 2 deletions(-)
diff --git a/drivers/hv/hv_balloon.c b/drivers/hv/hv_balloon.c
index 34bd735..7df0f67 100644
--- a/drivers/hv/hv_balloon.c
+++ b/drivers/hv/hv_balloon.c
@@ -24,6 +24,8 @@
#include <linux/hyperv.h>
+#include <asm/mshyperv.h>
+
#define CREATE_TRACE_POINTS
#include "hv_trace_balloon.h"
@@ -457,6 +459,7 @@ struct hot_add_wrk {
struct work_struct wrk;
};
+static bool allow_hibernation;
static bool hot_add = true;
static bool do_hot_add;
/*
@@ -1053,8 +1056,12 @@ static void hot_add_req(struct work_struct *dummy)
else
resp.result = 0;
- if (!do_hot_add || (resp.page_count == 0))
- pr_err("Memory hot add failed\n");
+ if (!do_hot_add || resp.page_count == 0) {
+ if (!allow_hibernation)
+ pr_err("Memory hot add failed\n");
+ else
+ pr_info("Ignore hot-add request!\n");
+ }
dm->state = DM_INITIALIZED;
resp.hdr.trans_id = atomic_inc_return(&trans_id);
@@ -1509,6 +1516,11 @@ static void balloon_onchannelcallback(void *context)
break;
case DM_BALLOON_REQUEST:
+ if (allow_hibernation) {
+ pr_info("Ignore balloon-up request!\n");
+ break;
+ }
+
if (dm->state == DM_BALLOON_UP)
pr_warn("Currently ballooning\n");
bal_msg = (struct dm_balloon *)recv_buffer;
@@ -1518,6 +1530,11 @@ static void balloon_onchannelcallback(void *context)
break;
case DM_UNBALLOON_REQUEST:
+ if (allow_hibernation) {
+ pr_info("Ignore balloon-down request!\n");
+ break;
+ }
+
dm->state = DM_BALLOON_DOWN;
balloon_down(dm,
(struct dm_unballoon_request *)recv_buffer);
@@ -1623,6 +1640,11 @@ static int balloon_connect_vsp(struct hv_device *dev)
cap_msg.hdr.size = sizeof(struct dm_capabilities);
cap_msg.hdr.trans_id = atomic_inc_return(&trans_id);
+ /*
+ * When hibernation (i.e. virtual ACPI S4 state) is enabled, the host
+ * currently still requires the bits to be set, so we have to add code
+ * to fail the host's hot-add and balloon up/down requests, if any.
+ */
cap_msg.caps.cap_bits.balloon = 1;
cap_msg.caps.cap_bits.hot_add = 1;
@@ -1672,6 +1694,24 @@ static int balloon_probe(struct hv_device *dev,
{
int ret;
+#if 0
+ /*
+ * The patch to implement hv_is_hibernation_supported() is going
+ * through the tip tree. For now, let's hardcode allow_hibernation
+ * to false to keep the current behavior of hv_balloon. If people
+ * want to test hibernation, please blacklist hv_balloon fow now
+ * or do not enable Dynamid Memory and Memory Resizing.
+ *
+ * We'll remove the conditional compilation as soon as
+ * hv_is_hibernation_supported() is available in the mainline tree.
+ */
+ allow_hibernation = hv_is_hibernation_supported();
+#else
+ allow_hibernation = false;
+#endif
+ if (allow_hibernation)
+ hot_add = false;
+
#ifdef CONFIG_MEMORY_HOTPLUG
do_hot_add = hot_add;
#else
@@ -1711,6 +1751,8 @@ static int balloon_probe(struct hv_device *dev,
return 0;
probe_error:
+ dm_device.state = DM_INIT_ERROR;
+ dm_device.thread = NULL;
vmbus_close(dev->channel);
#ifdef CONFIG_MEMORY_HOTPLUG
unregister_memory_notifier(&hv_memory_nb);
@@ -1752,6 +1794,59 @@ static int balloon_remove(struct hv_device *dev)
return 0;
}
+static int balloon_suspend(struct hv_device *hv_dev)
+{
+ struct hv_dynmem_device *dm = hv_get_drvdata(hv_dev);
+
+ tasklet_disable(&hv_dev->channel->callback_event);
+
+ cancel_work_sync(&dm->balloon_wrk.wrk);
+ cancel_work_sync(&dm->ha_wrk.wrk);
+
+ if (dm->thread) {
+ kthread_stop(dm->thread);
+ dm->thread = NULL;
+ vmbus_close(hv_dev->channel);
+ }
+
+ tasklet_enable(&hv_dev->channel->callback_event);
+
+ return 0;
+
+}
+
+static int balloon_resume(struct hv_device *dev)
+{
+ int ret;
+
+ dm_device.state = DM_INITIALIZING;
+
+ ret = balloon_connect_vsp(dev);
+
+ if (ret != 0)
+ goto out;
+
+ dm_device.thread =
+ kthread_run(dm_thread_func, &dm_device, "hv_balloon");
+ if (IS_ERR(dm_device.thread)) {
+ ret = PTR_ERR(dm_device.thread);
+ dm_device.thread = NULL;
+ goto close_channel;
+ }
+
+ dm_device.state = DM_INITIALIZED;
+ return 0;
+close_channel:
+ vmbus_close(dev->channel);
+out:
+ dm_device.state = DM_INIT_ERROR;
+#ifdef CONFIG_MEMORY_HOTPLUG
+ unregister_memory_notifier(&hv_memory_nb);
+ restore_online_page_callback(&hv_online_page);
+#endif
+ return ret;
+}
+
static const struct hv_vmbus_device_id id_table[] = {
/* Dynamic Memory Class ID */
/* 525074DC-8985-46e2-8057-A307DC18A502 */
@@ -1766,6 +1861,8 @@ static int balloon_remove(struct hv_device *dev)
.id_table = id_table,
.probe = balloon_probe,
.remove = balloon_remove,
+ .suspend = balloon_suspend,
+ .resume = balloon_resume,
.driver = {
.probe_type = PROBE_PREFER_ASYNCHRONOUS,
},
--
1.8.3.1
^ permalink raw reply related
* [PATCH] Input: hyperv-keyboard: Add the support of hibernation
From: Dexuan Cui @ 2019-09-11 23:36 UTC (permalink / raw)
To: KY Srinivasan, Haiyang Zhang, Stephen Hemminger,
sashal@kernel.org, dmitry.torokhov@gmail.com,
linux-hyperv@vger.kernel.org, linux-input@vger.kernel.org,
linux-kernel@vger.kernel.org, Michael Kelley
Cc: Dexuan Cui
We need hv_kbd_pm_notify() to make sure the pm_wakeup_hard_event() call
does not prevent the system from entering hibernation: the hibernation
is a relatively long process, which can be aborted by the call
pm_wakeup_hard_event(), which is invoked upon keyboard events.
Signed-off-by: Dexuan Cui <decui@microsoft.com>
---
This patch is basically a pure Hyper-V specific change and it has a
build dependency on the commit 271b2224d42f ("Drivers: hv: vmbus: Implement
suspend/resume for VSC drivers for hibernation"), which is on Sasha Levin's
Hyper-V tree's hyperv-next branch:
https://git.kernel.org/pub/scm/linux/kernel/git/hyperv/linux.git/log/?h=hyperv-next
I request this patch should go through Sasha's tree rather than the
input subsystemi's tree.
Hi Dmitry, can you please Ack?
drivers/input/serio/hyperv-keyboard.c | 68 ++++++++++++++++++++++++++++++++---
1 file changed, 63 insertions(+), 5 deletions(-)
diff --git a/drivers/input/serio/hyperv-keyboard.c b/drivers/input/serio/hyperv-keyboard.c
index 88ae7c2..277dc4c 100644
--- a/drivers/input/serio/hyperv-keyboard.c
+++ b/drivers/input/serio/hyperv-keyboard.c
@@ -10,6 +10,7 @@
#include <linux/hyperv.h>
#include <linux/serio.h>
#include <linux/slab.h>
+#include <linux/suspend.h>
/*
* Current version 1.0
@@ -95,6 +96,9 @@ struct hv_kbd_dev {
struct completion wait_event;
spinlock_t lock; /* protects 'started' field */
bool started;
+
+ struct notifier_block pm_nb;
+ bool hibernation_in_progress;
};
static void hv_kbd_on_receive(struct hv_device *hv_dev,
@@ -168,7 +172,7 @@ static void hv_kbd_on_receive(struct hv_device *hv_dev,
* "echo freeze > /sys/power/state" can't really enter the
* state because the Enter-UP can trigger a wakeup at once.
*/
- if (!(info & IS_BREAK))
+ if (!(info & IS_BREAK) && !kbd_dev->hibernation_in_progress)
pm_wakeup_hard_event(&hv_dev->device);
break;
@@ -179,10 +183,10 @@ static void hv_kbd_on_receive(struct hv_device *hv_dev,
}
}
-static void hv_kbd_handle_received_packet(struct hv_device *hv_dev,
- struct vmpacket_descriptor *desc,
- u32 bytes_recvd,
- u64 req_id)
+static void
+hv_kbd_handle_received_packet(struct hv_device *hv_dev,
+ const struct vmpacket_descriptor *desc,
+ u32 bytes_recvd, u64 req_id)
{
struct synth_kbd_msg *msg;
u32 msg_sz;
@@ -282,6 +286,8 @@ static int hv_kbd_connect_to_vsp(struct hv_device *hv_dev)
u32 proto_status;
int error;
+ reinit_completion(&kbd_dev->wait_event);
+
request = &kbd_dev->protocol_req;
memset(request, 0, sizeof(struct synth_kbd_protocol_request));
request->header.type = __cpu_to_le32(SYNTH_KBD_PROTOCOL_REQUEST);
@@ -332,6 +338,29 @@ static void hv_kbd_stop(struct serio *serio)
spin_unlock_irqrestore(&kbd_dev->lock, flags);
}
+static int hv_kbd_pm_notify(struct notifier_block *nb,
+ unsigned long val, void *ign)
+{
+ struct hv_kbd_dev *kbd_dev;
+
+ kbd_dev = container_of(nb, struct hv_kbd_dev, pm_nb);
+
+ switch (val) {
+ case PM_HIBERNATION_PREPARE:
+ case PM_RESTORE_PREPARE:
+ kbd_dev->hibernation_in_progress = true;
+ return NOTIFY_OK;
+
+ case PM_POST_HIBERNATION:
+ case PM_POST_RESTORE:
+ kbd_dev->hibernation_in_progress = false;
+ return NOTIFY_OK;
+
+ default:
+ return NOTIFY_DONE;
+ }
+}
+
static int hv_kbd_probe(struct hv_device *hv_dev,
const struct hv_vmbus_device_id *dev_id)
{
@@ -380,6 +409,9 @@ static int hv_kbd_probe(struct hv_device *hv_dev,
device_init_wakeup(&hv_dev->device, true);
+ kbd_dev->pm_nb.notifier_call = hv_kbd_pm_notify;
+ register_pm_notifier(&kbd_dev->pm_nb);
+
return 0;
err_close_vmbus:
@@ -394,6 +426,7 @@ static int hv_kbd_remove(struct hv_device *hv_dev)
{
struct hv_kbd_dev *kbd_dev = hv_get_drvdata(hv_dev);
+ unregister_pm_notifier(&kbd_dev->pm_nb);
serio_unregister_port(kbd_dev->hv_serio);
vmbus_close(hv_dev->channel);
kfree(kbd_dev);
@@ -403,6 +436,29 @@ static int hv_kbd_remove(struct hv_device *hv_dev)
return 0;
}
+static int hv_kbd_suspend(struct hv_device *hv_dev)
+{
+ vmbus_close(hv_dev->channel);
+
+ return 0;
+}
+
+static int hv_kbd_resume(struct hv_device *hv_dev)
+{
+ int ret;
+
+ ret = vmbus_open(hv_dev->channel,
+ KBD_VSC_SEND_RING_BUFFER_SIZE,
+ KBD_VSC_RECV_RING_BUFFER_SIZE,
+ NULL, 0,
+ hv_kbd_on_channel_callback,
+ hv_dev);
+ if (ret == 0)
+ ret = hv_kbd_connect_to_vsp(hv_dev);
+
+ return ret;
+}
+
static const struct hv_vmbus_device_id id_table[] = {
/* Keyboard guid */
{ HV_KBD_GUID, },
@@ -416,6 +472,8 @@ static int hv_kbd_remove(struct hv_device *hv_dev)
.id_table = id_table,
.probe = hv_kbd_probe,
.remove = hv_kbd_remove,
+ .suspend = hv_kbd_suspend,
+ .resume = hv_kbd_resume,
.driver = {
.probe_type = PROBE_PREFER_ASYNCHRONOUS,
},
--
1.8.3.1
^ permalink raw reply related
* [PATCH] HID: hyperv: Add the support of hibernation
From: Dexuan Cui @ 2019-09-11 23:35 UTC (permalink / raw)
To: KY Srinivasan, Haiyang Zhang, Stephen Hemminger,
sashal@kernel.org, jikos@kernel.org,
benjamin.tissoires@redhat.com, linux-hyperv@vger.kernel.org,
linux-input@vger.kernel.org, linux-kernel@vger.kernel.org,
Michael Kelley
Cc: Dexuan Cui
We need mousevsc_pm_notify() to make sure the pm_wakeup_hard_event() call
does not prevent the system from entering hibernation: the hibernation
is a relatively long process, which can be aborted by the call
pm_wakeup_hard_event(), which is invoked upon mouse events.
Signed-off-by: Dexuan Cui <decui@microsoft.com>
---
This patch is basically a pure Hyper-V specific change and it has a
build dependency on the commit 271b2224d42f ("Drivers: hv: vmbus: Implement
suspend/resume for VSC drivers for hibernation"), which is on Sasha Levin's
Hyper-V tree's hyperv-next branch:
https://git.kernel.org/pub/scm/linux/kernel/git/hyperv/linux.git/log/?h=hyperv-next
I request this patch should go through Sasha's tree rather than the
input subsystem's tree.
Hi Jiri, Benjamin, can you please Ack?
drivers/hid/hid-hyperv.c | 71 ++++++++++++++++++++++++++++++++++++++++++++++--
1 file changed, 69 insertions(+), 2 deletions(-)
diff --git a/drivers/hid/hid-hyperv.c b/drivers/hid/hid-hyperv.c
index cc5b09b8..e798740 100644
--- a/drivers/hid/hid-hyperv.c
+++ b/drivers/hid/hid-hyperv.c
@@ -12,6 +12,7 @@
#include <linux/hid.h>
#include <linux/hiddev.h>
#include <linux/hyperv.h>
+#include <linux/suspend.h>
struct hv_input_dev_info {
@@ -150,6 +151,9 @@ struct mousevsc_dev {
struct hv_input_dev_info hid_dev_info;
struct hid_device *hid_device;
u8 input_buf[HID_MAX_BUFFER_SIZE];
+
+ struct notifier_block pm_nb;
+ bool hibernation_in_progress;
};
@@ -192,6 +196,9 @@ static void mousevsc_on_receive_device_info(struct mousevsc_dev *input_device,
if (desc->bLength == 0)
goto cleanup;
+ /* The pointer is not NULL when we resume from hibernation */
+ if (input_device->hid_desc != NULL)
+ kfree(input_device->hid_desc);
input_device->hid_desc = kmemdup(desc, desc->bLength, GFP_ATOMIC);
if (!input_device->hid_desc)
@@ -203,6 +210,9 @@ static void mousevsc_on_receive_device_info(struct mousevsc_dev *input_device,
goto cleanup;
}
+ /* The pointer is not NULL when we resume from hibernation */
+ if (input_device->report_desc != NULL)
+ kfree(input_device->report_desc);
input_device->report_desc = kzalloc(input_device->report_desc_size,
GFP_ATOMIC);
@@ -243,7 +253,7 @@ static void mousevsc_on_receive_device_info(struct mousevsc_dev *input_device,
}
static void mousevsc_on_receive(struct hv_device *device,
- struct vmpacket_descriptor *packet)
+ const struct vmpacket_descriptor *packet)
{
struct pipe_prt_msg *pipe_msg;
struct synthhid_msg *hid_msg;
@@ -301,7 +311,8 @@ static void mousevsc_on_receive(struct hv_device *device,
hid_input_report(input_dev->hid_device, HID_INPUT_REPORT,
input_dev->input_buf, len, 1);
- pm_wakeup_hard_event(&input_dev->device->device);
+ if (!input_dev->hibernation_in_progress)
+ pm_wakeup_hard_event(&input_dev->device->device);
break;
default:
@@ -378,6 +389,8 @@ static int mousevsc_connect_to_vsp(struct hv_device *device)
struct mousevsc_prt_msg *request;
struct mousevsc_prt_msg *response;
+ reinit_completion(&input_dev->wait_event);
+
request = &input_dev->protocol_req;
memset(request, 0, sizeof(struct mousevsc_prt_msg));
@@ -475,6 +488,29 @@ static int mousevsc_hid_raw_request(struct hid_device *hid,
static struct hid_driver mousevsc_hid_driver;
+static int mousevsc_pm_notify(struct notifier_block *nb,
+ unsigned long val, void *ign)
+{
+ struct mousevsc_dev *input_dev;
+
+ input_dev = container_of(nb, struct mousevsc_dev, pm_nb);
+
+ switch (val) {
+ case PM_HIBERNATION_PREPARE:
+ case PM_RESTORE_PREPARE:
+ input_dev->hibernation_in_progress = true;
+ return NOTIFY_OK;
+
+ case PM_POST_HIBERNATION:
+ case PM_POST_RESTORE:
+ input_dev->hibernation_in_progress = false;
+ return NOTIFY_OK;
+
+ default:
+ return NOTIFY_DONE;
+ }
+}
+
static int mousevsc_probe(struct hv_device *device,
const struct hv_vmbus_device_id *dev_id)
{
@@ -549,6 +585,9 @@ static int mousevsc_probe(struct hv_device *device,
input_dev->connected = true;
input_dev->init_complete = true;
+ input_dev->pm_nb.notifier_call = mousevsc_pm_notify;
+ register_pm_notifier(&input_dev->pm_nb);
+
return ret;
probe_err2:
@@ -568,6 +607,8 @@ static int mousevsc_remove(struct hv_device *dev)
{
struct mousevsc_dev *input_dev = hv_get_drvdata(dev);
+ unregister_pm_notifier(&input_dev->pm_nb);
+
device_init_wakeup(&dev->device, false);
vmbus_close(dev->channel);
hid_hw_stop(input_dev->hid_device);
@@ -577,6 +618,30 @@ static int mousevsc_remove(struct hv_device *dev)
return 0;
}
+static int mousevsc_suspend(struct hv_device *dev)
+{
+ vmbus_close(dev->channel);
+
+ return 0;
+}
+
+static int mousevsc_resume(struct hv_device *dev)
+{
+ int ret;
+
+ ret = vmbus_open(dev->channel,
+ INPUTVSC_SEND_RING_BUFFER_SIZE,
+ INPUTVSC_RECV_RING_BUFFER_SIZE,
+ NULL, 0,
+ mousevsc_on_channel_callback,
+ dev);
+ if (ret)
+ return ret;
+
+ ret = mousevsc_connect_to_vsp(dev);
+ return ret;
+}
+
static const struct hv_vmbus_device_id id_table[] = {
/* Mouse guid */
{ HV_MOUSE_GUID, },
@@ -590,6 +655,8 @@ static int mousevsc_remove(struct hv_device *dev)
.id_table = id_table,
.probe = mousevsc_probe,
.remove = mousevsc_remove,
+ .suspend = mousevsc_suspend,
+ .resume = mousevsc_resume,
.driver = {
.probe_type = PROBE_PREFER_ASYNCHRONOUS,
},
--
1.8.3.1
^ permalink raw reply related
* [PATCH] scsi: storvsc: Add the support of hibernation
From: Dexuan Cui @ 2019-09-11 23:35 UTC (permalink / raw)
To: KY Srinivasan, Haiyang Zhang, Stephen Hemminger,
sashal@kernel.org, jejb@linux.ibm.com, martin.petersen@oracle.com,
linux-hyperv@vger.kernel.org, linux-scsi@vger.kernel.org,
linux-kernel@vger.kernel.org, Michael Kelley
Cc: Dexuan Cui
When we're in storvsc_suspend(), we're sure the SCSI layer has quiesced the
scsi device by scsi_bus_suspend() -> ... -> scsi_device_quiesce(), so the
low level SCSI adapter driver only needs to suspend/resume its own state.
Signed-off-by: Dexuan Cui <decui@microsoft.com>
---
This patch is basically a pure Hyper-V specific change and it has a
build dependency on the commit 271b2224d42f ("Drivers: hv: vmbus: Implement
suspend/resume for VSC drivers for hibernation"), which is on Sasha Levin's
Hyper-V tree's hyperv-next branch:
https://git.kernel.org/pub/scm/linux/kernel/git/hyperv/linux.git/log/?h=hyperv-next
I request this patch should go through Sasha's tree rather than the
SCSI tree.
drivers/scsi/storvsc_drv.c | 41 +++++++++++++++++++++++++++++++++++++++++
1 file changed, 41 insertions(+)
diff --git a/drivers/scsi/storvsc_drv.c b/drivers/scsi/storvsc_drv.c
index ed8b9ac..9fbf604 100644
--- a/drivers/scsi/storvsc_drv.c
+++ b/drivers/scsi/storvsc_drv.c
@@ -1727,6 +1727,13 @@ enum {
MODULE_DEVICE_TABLE(vmbus, id_table);
+static const struct { guid_t guid; } fc_guid = { HV_SYNTHFC_GUID };
+
+static bool hv_dev_is_fc(struct hv_device *hv_dev)
+{
+ return guid_equal(&fc_guid.guid, &hv_dev->dev_type);
+}
+
static int storvsc_probe(struct hv_device *device,
const struct hv_vmbus_device_id *dev_id)
{
@@ -1935,11 +1942,45 @@ static int storvsc_remove(struct hv_device *dev)
return 0;
}
+static int storvsc_suspend(struct hv_device *hv_dev)
+{
+ struct storvsc_device *stor_device = hv_get_drvdata(hv_dev);
+ struct Scsi_Host *host = stor_device->host;
+ struct hv_host_device *host_dev = shost_priv(host);
+
+ storvsc_wait_to_drain(stor_device);
+
+ drain_workqueue(host_dev->handle_error_wq);
+
+ vmbus_close(hv_dev->channel);
+
+ memset(stor_device->stor_chns, 0,
+ num_possible_cpus() * sizeof(void *));
+
+ kfree(stor_device->stor_chns);
+ stor_device->stor_chns = NULL;
+
+ cpumask_clear(&stor_device->alloced_cpus);
+
+ return 0;
+}
+
+static int storvsc_resume(struct hv_device *hv_dev)
+{
+ int ret;
+
+ ret = storvsc_connect_to_vsp(hv_dev, storvsc_ringbuffer_size,
+ hv_dev_is_fc(hv_dev));
+ return ret;
+}
+
static struct hv_driver storvsc_drv = {
.name = KBUILD_MODNAME,
.id_table = id_table,
.probe = storvsc_probe,
.remove = storvsc_remove,
+ .suspend = storvsc_suspend,
+ .resume = storvsc_resume,
.driver = {
.probe_type = PROBE_PREFER_ASYNCHRONOUS,
},
--
1.8.3.1
^ permalink raw reply related
* [PATCH] video: hyperv_fb: Add the support of hibernation
From: Dexuan Cui @ 2019-09-11 23:34 UTC (permalink / raw)
To: KY Srinivasan, Haiyang Zhang, Stephen Hemminger,
sashal@kernel.org, b.zolnierkie@samsung.com,
linux-hyperv@vger.kernel.org, dri-devel@lists.freedesktop.org,
linux-fbdev@vger.kernel.org, linux-kernel@vger.kernel.org,
Michael Kelley
Cc: Dexuan Cui
This patch depends on the vmbus side change of the definition of
struct hv_driver.
Signed-off-by: Dexuan Cui <decui@microsoft.com>
---
This patch is basically a pure Hyper-V specific change and it has a
build dependency on the commit 271b2224d42f ("Drivers: hv: vmbus: Implement
suspend/resume for VSC drivers for hibernation"), which is on Sasha Levin's
Hyper-V tree's hyperv-next branch:
https://git.kernel.org/pub/scm/linux/kernel/git/hyperv/linux.git/log/?h=hyperv-next
I request this patch should go through Sasha's tree rather than the
fbdev tree.
drivers/video/fbdev/hyperv_fb.c | 59 +++++++++++++++++++++++++++++++++++++++++
1 file changed, 59 insertions(+)
diff --git a/drivers/video/fbdev/hyperv_fb.c b/drivers/video/fbdev/hyperv_fb.c
index 2dcb7c5..fe4731f 100644
--- a/drivers/video/fbdev/hyperv_fb.c
+++ b/drivers/video/fbdev/hyperv_fb.c
@@ -34,6 +34,7 @@
#include <linux/fb.h>
#include <linux/pci.h>
#include <linux/efi.h>
+#include <linux/console.h>
#include <linux/hyperv.h>
@@ -211,6 +212,7 @@ struct hvfb_par {
struct delayed_work dwork;
bool update;
+ bool update_saved; /* The value of 'update' before hibernation */
u32 pseudo_palette[16];
u8 init_buf[MAX_VMBUS_PKT_SIZE];
@@ -878,6 +880,61 @@ static int hvfb_remove(struct hv_device *hdev)
return 0;
}
+static int hvfb_suspend(struct hv_device *hdev)
+{
+ struct fb_info *info = hv_get_drvdata(hdev);
+ struct hvfb_par *par = info->par;
+
+ console_lock();
+
+ /* 1 means do suspend */
+ fb_set_suspend(info, 1);
+
+ cancel_delayed_work_sync(&par->dwork);
+
+ par->update_saved = par->update;
+ par->update = false;
+ par->fb_ready = false;
+
+ vmbus_close(hdev->channel);
+
+ console_unlock();
+
+ return 0;
+}
+
+static int hvfb_resume(struct hv_device *hdev)
+{
+ struct fb_info *info = hv_get_drvdata(hdev);
+ struct hvfb_par *par = info->par;
+ int ret;
+
+ console_lock();
+
+ ret = synthvid_connect_vsp(hdev);
+ if (ret != 0)
+ goto out;
+
+ ret = synthvid_send_config(hdev);
+ if (ret != 0) {
+ vmbus_close(hdev->channel);
+ goto out;
+ }
+
+ par->fb_ready = true;
+ par->update = par->update_saved;
+
+ schedule_delayed_work(&par->dwork, HVFB_UPDATE_DELAY);
+
+ /* 0 means do resume */
+ fb_set_suspend(info, 0);
+
+out:
+ console_unlock();
+
+ return ret;
+}
+
static const struct pci_device_id pci_stub_id_table[] = {
{
@@ -901,6 +958,8 @@ static int hvfb_remove(struct hv_device *hdev)
.id_table = id_table,
.probe = hvfb_probe,
.remove = hvfb_remove,
+ .suspend = hvfb_suspend,
+ .resume = hvfb_resume,
.driver = {
.probe_type = PROBE_PREFER_ASYNCHRONOUS,
},
--
1.8.3.1
^ permalink raw reply related
* Inquiry 11/Sept/2019
From: Julian Smith @ 2019-09-11 12:08 UTC (permalink / raw)
To: linux-hyperv
Hi,friend,
This is Julian Smith and i am purchasing manager from E-cloth Co.,LTD in the UK.
We are glad to know about your company from the web and we are interested in your products.
Could you kindly send us your Latest catalog and price list for our trial order.
Thanks and Best Regards,
Ms Julian Smith
Purchasing Manager
E-cloth Co.,LTD
^ permalink raw reply
* Re: [PATCH 0/3] Remove __online_page_set_limits()
From: David Hildenbrand @ 2019-09-10 12:58 UTC (permalink / raw)
To: Souptick Joarder, Kirill A. Shutemov
Cc: kys, haiyangz, sthemmin, sashal, Boris Ostrovsky, Juergen Gross,
sstabellini, Andrew Morton, osalvador, Michal Hocko,
pasha.tatashin, Dan Williams, richard.weiyang, Qian Cai,
linux-hyperv, xen-devel, Linux-MM, linux-kernel
In-Reply-To: <CAFqt6zZNHGdgaiiRvz-1AFe5g1652oyZpNQidK1V0B6weQHz0w@mail.gmail.com>
On 10.09.19 14:56, Souptick Joarder wrote:
> On Mon, Sep 9, 2019 at 9:12 PM Kirill A. Shutemov <kirill@shutemov.name> wrote:
>>
>> On Sun, Sep 08, 2019 at 03:17:01AM +0530, Souptick Joarder wrote:
>>> __online_page_set_limits() is a dummy function and an extra call
>>> to this can be avoided.
>>>
>>> As both of the callers are now removed, __online_page_set_limits()
>>> can be removed permanently.
>>>
>>> Souptick Joarder (3):
>>> hv_ballon: Avoid calling dummy function __online_page_set_limits()
>>> xen/ballon: Avoid calling dummy function __online_page_set_limits()
>>> mm/memory_hotplug.c: Remove __online_page_set_limits()
>>>
>>> drivers/hv/hv_balloon.c | 1 -
>>> drivers/xen/balloon.c | 1 -
>>> include/linux/memory_hotplug.h | 1 -
>>> mm/memory_hotplug.c | 5 -----
>>> 4 files changed, 8 deletions(-)
>>
>> Do we really need 3 separate patches to remove 8 lines of code?
>
> I prefer to split into series of 3 which looks more clean. But I am ok
> with other option.
> Would you like to merge into single one ?
>
If you have to resend, you could squash them into one. If not, I think
this is okay ...
--
Thanks,
David / dhildenb
^ permalink raw reply
* Re: [PATCH 0/3] Remove __online_page_set_limits()
From: Souptick Joarder @ 2019-09-10 12:56 UTC (permalink / raw)
To: Kirill A. Shutemov
Cc: kys, haiyangz, sthemmin, sashal, Boris Ostrovsky, Juergen Gross,
sstabellini, Andrew Morton, david, osalvador, Michal Hocko,
pasha.tatashin, Dan Williams, richard.weiyang, Qian Cai,
linux-hyperv, xen-devel, Linux-MM, linux-kernel
In-Reply-To: <20190909154253.q55olcm4cqwh7izd@box>
On Mon, Sep 9, 2019 at 9:12 PM Kirill A. Shutemov <kirill@shutemov.name> wrote:
>
> On Sun, Sep 08, 2019 at 03:17:01AM +0530, Souptick Joarder wrote:
> > __online_page_set_limits() is a dummy function and an extra call
> > to this can be avoided.
> >
> > As both of the callers are now removed, __online_page_set_limits()
> > can be removed permanently.
> >
> > Souptick Joarder (3):
> > hv_ballon: Avoid calling dummy function __online_page_set_limits()
> > xen/ballon: Avoid calling dummy function __online_page_set_limits()
> > mm/memory_hotplug.c: Remove __online_page_set_limits()
> >
> > drivers/hv/hv_balloon.c | 1 -
> > drivers/xen/balloon.c | 1 -
> > include/linux/memory_hotplug.h | 1 -
> > mm/memory_hotplug.c | 5 -----
> > 4 files changed, 8 deletions(-)
>
> Do we really need 3 separate patches to remove 8 lines of code?
I prefer to split into series of 3 which looks more clean. But I am ok
with other option.
Would you like to merge into single one ?
^ permalink raw reply
* [PATCH AUTOSEL 4.19 4/8] x86/hyper-v: Fix overflow bug in fill_gva_list()
From: Sasha Levin @ 2019-09-09 15:41 UTC (permalink / raw)
To: linux-kernel, stable
Cc: Tianyu Lan, Jong Hyun Park, Michael Kelley, Borislav Petkov,
Linus Torvalds, Peter Zijlstra, Thomas Gleixner, Ingo Molnar,
Sasha Levin, linux-hyperv
In-Reply-To: <20190909154124.31146-1-sashal@kernel.org>
From: Tianyu Lan <Tianyu.Lan@microsoft.com>
[ Upstream commit 4030b4c585c41eeefec7bd20ce3d0e100a0f2e4d ]
When the 'start' parameter is >= 0xFF000000 on 32-bit
systems, or >= 0xFFFFFFFF'FF000000 on 64-bit systems,
fill_gva_list() gets into an infinite loop.
With such inputs, 'cur' overflows after adding HV_TLB_FLUSH_UNIT
and always compares as less than end. Memory is filled with
guest virtual addresses until the system crashes.
Fix this by never incrementing 'cur' to be larger than 'end'.
Reported-by: Jong Hyun Park <park.jonghyun@yonsei.ac.kr>
Signed-off-by: Tianyu Lan <Tianyu.Lan@microsoft.com>
Reviewed-by: Michael Kelley <mikelley@microsoft.com>
Cc: Borislav Petkov <bp@alien8.de>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Fixes: 2ffd9e33ce4a ("x86/hyper-v: Use hypercall for remote TLB flush")
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
arch/x86/hyperv/mmu.c | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)
diff --git a/arch/x86/hyperv/mmu.c b/arch/x86/hyperv/mmu.c
index ef5f29f913d7b..2f34d52753526 100644
--- a/arch/x86/hyperv/mmu.c
+++ b/arch/x86/hyperv/mmu.c
@@ -37,12 +37,14 @@ static inline int fill_gva_list(u64 gva_list[], int offset,
* Lower 12 bits encode the number of additional
* pages to flush (in addition to the 'cur' page).
*/
- if (diff >= HV_TLB_FLUSH_UNIT)
+ if (diff >= HV_TLB_FLUSH_UNIT) {
gva_list[gva_n] |= ~PAGE_MASK;
- else if (diff)
+ cur += HV_TLB_FLUSH_UNIT;
+ } else if (diff) {
gva_list[gva_n] |= (diff - 1) >> PAGE_SHIFT;
+ cur = end;
+ }
- cur += HV_TLB_FLUSH_UNIT;
gva_n++;
} while (cur < end);
--
2.20.1
^ permalink raw reply related
* [PATCH AUTOSEL 4.14 4/8] x86/hyper-v: Fix overflow bug in fill_gva_list()
From: Sasha Levin @ 2019-09-09 15:41 UTC (permalink / raw)
To: linux-kernel, stable
Cc: Tianyu Lan, Jong Hyun Park, Michael Kelley, Borislav Petkov,
Linus Torvalds, Peter Zijlstra, Thomas Gleixner, Ingo Molnar,
Sasha Levin, linux-hyperv
In-Reply-To: <20190909154145.31263-1-sashal@kernel.org>
From: Tianyu Lan <Tianyu.Lan@microsoft.com>
[ Upstream commit 4030b4c585c41eeefec7bd20ce3d0e100a0f2e4d ]
When the 'start' parameter is >= 0xFF000000 on 32-bit
systems, or >= 0xFFFFFFFF'FF000000 on 64-bit systems,
fill_gva_list() gets into an infinite loop.
With such inputs, 'cur' overflows after adding HV_TLB_FLUSH_UNIT
and always compares as less than end. Memory is filled with
guest virtual addresses until the system crashes.
Fix this by never incrementing 'cur' to be larger than 'end'.
Reported-by: Jong Hyun Park <park.jonghyun@yonsei.ac.kr>
Signed-off-by: Tianyu Lan <Tianyu.Lan@microsoft.com>
Reviewed-by: Michael Kelley <mikelley@microsoft.com>
Cc: Borislav Petkov <bp@alien8.de>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Fixes: 2ffd9e33ce4a ("x86/hyper-v: Use hypercall for remote TLB flush")
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
arch/x86/hyperv/mmu.c | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)
diff --git a/arch/x86/hyperv/mmu.c b/arch/x86/hyperv/mmu.c
index 56c9ebac946fe..47718fff0b797 100644
--- a/arch/x86/hyperv/mmu.c
+++ b/arch/x86/hyperv/mmu.c
@@ -57,12 +57,14 @@ static inline int fill_gva_list(u64 gva_list[], int offset,
* Lower 12 bits encode the number of additional
* pages to flush (in addition to the 'cur' page).
*/
- if (diff >= HV_TLB_FLUSH_UNIT)
+ if (diff >= HV_TLB_FLUSH_UNIT) {
gva_list[gva_n] |= ~PAGE_MASK;
- else if (diff)
+ cur += HV_TLB_FLUSH_UNIT;
+ } else if (diff) {
gva_list[gva_n] |= (diff - 1) >> PAGE_SHIFT;
+ cur = end;
+ }
- cur += HV_TLB_FLUSH_UNIT;
gva_n++;
} while (cur < end);
--
2.20.1
^ permalink raw reply related
* [PATCH AUTOSEL 5.2 05/12] x86/hyper-v: Fix overflow bug in fill_gva_list()
From: Sasha Levin @ 2019-09-09 15:40 UTC (permalink / raw)
To: linux-kernel, stable
Cc: Tianyu Lan, Jong Hyun Park, Michael Kelley, Borislav Petkov,
Linus Torvalds, Peter Zijlstra, Thomas Gleixner, Ingo Molnar,
Sasha Levin, linux-hyperv
In-Reply-To: <20190909154052.30941-1-sashal@kernel.org>
From: Tianyu Lan <Tianyu.Lan@microsoft.com>
[ Upstream commit 4030b4c585c41eeefec7bd20ce3d0e100a0f2e4d ]
When the 'start' parameter is >= 0xFF000000 on 32-bit
systems, or >= 0xFFFFFFFF'FF000000 on 64-bit systems,
fill_gva_list() gets into an infinite loop.
With such inputs, 'cur' overflows after adding HV_TLB_FLUSH_UNIT
and always compares as less than end. Memory is filled with
guest virtual addresses until the system crashes.
Fix this by never incrementing 'cur' to be larger than 'end'.
Reported-by: Jong Hyun Park <park.jonghyun@yonsei.ac.kr>
Signed-off-by: Tianyu Lan <Tianyu.Lan@microsoft.com>
Reviewed-by: Michael Kelley <mikelley@microsoft.com>
Cc: Borislav Petkov <bp@alien8.de>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Fixes: 2ffd9e33ce4a ("x86/hyper-v: Use hypercall for remote TLB flush")
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
arch/x86/hyperv/mmu.c | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)
diff --git a/arch/x86/hyperv/mmu.c b/arch/x86/hyperv/mmu.c
index e65d7fe6489f3..5208ba49c89a9 100644
--- a/arch/x86/hyperv/mmu.c
+++ b/arch/x86/hyperv/mmu.c
@@ -37,12 +37,14 @@ static inline int fill_gva_list(u64 gva_list[], int offset,
* Lower 12 bits encode the number of additional
* pages to flush (in addition to the 'cur' page).
*/
- if (diff >= HV_TLB_FLUSH_UNIT)
+ if (diff >= HV_TLB_FLUSH_UNIT) {
gva_list[gva_n] |= ~PAGE_MASK;
- else if (diff)
+ cur += HV_TLB_FLUSH_UNIT;
+ } else if (diff) {
gva_list[gva_n] |= (diff - 1) >> PAGE_SHIFT;
+ cur = end;
+ }
- cur += HV_TLB_FLUSH_UNIT;
gva_n++;
} while (cur < end);
--
2.20.1
^ permalink raw reply related
* Re: [PATCH 0/3] Remove __online_page_set_limits()
From: Kirill A. Shutemov @ 2019-09-09 15:42 UTC (permalink / raw)
To: Souptick Joarder
Cc: kys, haiyangz, sthemmin, sashal, boris.ostrovsky, jgross,
sstabellini, akpm, david, osalvador, mhocko, pasha.tatashin,
dan.j.williams, richard.weiyang, cai, linux-hyperv, xen-devel,
linux-mm, linux-kernel
In-Reply-To: <cover.1567889743.git.jrdr.linux@gmail.com>
On Sun, Sep 08, 2019 at 03:17:01AM +0530, Souptick Joarder wrote:
> __online_page_set_limits() is a dummy function and an extra call
> to this can be avoided.
>
> As both of the callers are now removed, __online_page_set_limits()
> can be removed permanently.
>
> Souptick Joarder (3):
> hv_ballon: Avoid calling dummy function __online_page_set_limits()
> xen/ballon: Avoid calling dummy function __online_page_set_limits()
> mm/memory_hotplug.c: Remove __online_page_set_limits()
>
> drivers/hv/hv_balloon.c | 1 -
> drivers/xen/balloon.c | 1 -
> include/linux/memory_hotplug.h | 1 -
> mm/memory_hotplug.c | 5 -----
> 4 files changed, 8 deletions(-)
Do we really need 3 separate patches to remove 8 lines of code?
--
Kirill A. Shutemov
^ permalink raw reply
* [PATCH v1 3/3] mm/memory_hotplug: Remove __online_page_free() and __online_page_increment_counters()
From: David Hildenbrand @ 2019-09-09 11:48 UTC (permalink / raw)
To: linux-kernel
Cc: linux-mm, Souptick Joarder, linux-hyperv, David Hildenbrand,
Andrew Morton, Oscar Salvador, Michal Hocko, Pavel Tatashin,
Wei Yang, Dan Williams, Qian Cai
In-Reply-To: <20190909114830.662-1-david@redhat.com>
Let's drop the now unused functions.
Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: Oscar Salvador <osalvador@suse.com>
Cc: Michal Hocko <mhocko@suse.com>
Cc: Pavel Tatashin <pasha.tatashin@soleen.com>
Cc: Wei Yang <richard.weiyang@gmail.com>
Cc: Dan Williams <dan.j.williams@intel.com>
Cc: Qian Cai <cai@lca.pw>
Signed-off-by: David Hildenbrand <david@redhat.com>
---
include/linux/memory_hotplug.h | 3 ---
mm/memory_hotplug.c | 12 ------------
2 files changed, 15 deletions(-)
diff --git a/include/linux/memory_hotplug.h b/include/linux/memory_hotplug.h
index 71a620eabb62..933f2bb3bdbb 100644
--- a/include/linux/memory_hotplug.h
+++ b/include/linux/memory_hotplug.h
@@ -106,9 +106,6 @@ extern void generic_online_page(struct page *page, unsigned int order);
extern int set_online_page_callback(online_page_callback_t callback);
extern int restore_online_page_callback(online_page_callback_t callback);
-extern void __online_page_increment_counters(struct page *page);
-extern void __online_page_free(struct page *page);
-
extern int try_online_node(int nid);
extern int arch_add_memory(int nid, u64 start, u64 size,
diff --git a/mm/memory_hotplug.c b/mm/memory_hotplug.c
index f32a5feaf7ff..16dd5b1498e8 100644
--- a/mm/memory_hotplug.c
+++ b/mm/memory_hotplug.c
@@ -602,18 +602,6 @@ int restore_online_page_callback(online_page_callback_t callback)
}
EXPORT_SYMBOL_GPL(restore_online_page_callback);
-void __online_page_increment_counters(struct page *page)
-{
- adjust_managed_page_count(page, 1);
-}
-EXPORT_SYMBOL_GPL(__online_page_increment_counters);
-
-void __online_page_free(struct page *page)
-{
- __free_reserved_page(page);
-}
-EXPORT_SYMBOL_GPL(__online_page_free);
-
void generic_online_page(struct page *page, unsigned int order)
{
kernel_map_pages(page, 1 << order, 1);
--
2.21.0
^ permalink raw reply related
* [PATCH v1 2/3] hv_balloon: Use generic_online_page()
From: David Hildenbrand @ 2019-09-09 11:48 UTC (permalink / raw)
To: linux-kernel
Cc: linux-mm, Souptick Joarder, linux-hyperv, David Hildenbrand,
K. Y. Srinivasan, Haiyang Zhang, Stephen Hemminger, Sasha Levin
In-Reply-To: <20190909114830.662-1-david@redhat.com>
Let's use the generic onlining function - which will now also take care
of calling kernel_map_pages().
Cc: "K. Y. Srinivasan" <kys@microsoft.com>
Cc: Haiyang Zhang <haiyangz@microsoft.com>
Cc: Stephen Hemminger <sthemmin@microsoft.com>
Cc: Sasha Levin <sashal@kernel.org>
Signed-off-by: David Hildenbrand <david@redhat.com>
---
drivers/hv/hv_balloon.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/drivers/hv/hv_balloon.c b/drivers/hv/hv_balloon.c
index a91c90d4402c..35f123b459c8 100644
--- a/drivers/hv/hv_balloon.c
+++ b/drivers/hv/hv_balloon.c
@@ -680,8 +680,7 @@ static void hv_page_online_one(struct hv_hotadd_state *has, struct page *pg)
__ClearPageOffline(pg);
/* This frame is currently backed; online the page. */
- __online_page_increment_counters(pg);
- __online_page_free(pg);
+ generic_online_page(pg, 0);
lockdep_assert_held(&dm_device.ha_lock);
dm_device.num_pages_onlined++;
--
2.21.0
^ permalink raw reply related
* [PATCH v1 1/3] mm/memory_hotplug: Export generic_online_page()
From: David Hildenbrand @ 2019-09-09 11:48 UTC (permalink / raw)
To: linux-kernel
Cc: linux-mm, Souptick Joarder, linux-hyperv, David Hildenbrand,
Andrew Morton, Oscar Salvador, Michal Hocko, Pavel Tatashin,
Dan Williams, Wei Yang, Qian Cai
In-Reply-To: <20190909114830.662-1-david@redhat.com>
Let's expose generic_online_page() so online_page_callback users can
simply fallback to the generic implementation when actually deciding to
online the pages.
Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: Oscar Salvador <osalvador@suse.com>
Cc: Michal Hocko <mhocko@suse.com>
Cc: Pavel Tatashin <pasha.tatashin@soleen.com>
Cc: Dan Williams <dan.j.williams@intel.com>
Cc: Wei Yang <richard.weiyang@gmail.com>
Cc: Qian Cai <cai@lca.pw>
Signed-off-by: David Hildenbrand <david@redhat.com>
---
include/linux/memory_hotplug.h | 1 +
mm/memory_hotplug.c | 5 ++---
2 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/include/linux/memory_hotplug.h b/include/linux/memory_hotplug.h
index 8ee3a2ae5131..71a620eabb62 100644
--- a/include/linux/memory_hotplug.h
+++ b/include/linux/memory_hotplug.h
@@ -102,6 +102,7 @@ extern unsigned long __offline_isolated_pages(unsigned long start_pfn,
typedef void (*online_page_callback_t)(struct page *page, unsigned int order);
+extern void generic_online_page(struct page *page, unsigned int order);
extern int set_online_page_callback(online_page_callback_t callback);
extern int restore_online_page_callback(online_page_callback_t callback);
diff --git a/mm/memory_hotplug.c b/mm/memory_hotplug.c
index 2f0d2908e235..f32a5feaf7ff 100644
--- a/mm/memory_hotplug.c
+++ b/mm/memory_hotplug.c
@@ -49,8 +49,6 @@
* and restore_online_page_callback() for generic callback restore.
*/
-static void generic_online_page(struct page *page, unsigned int order);
-
static online_page_callback_t online_page_callback = generic_online_page;
static DEFINE_MUTEX(online_page_callback_lock);
@@ -616,7 +614,7 @@ void __online_page_free(struct page *page)
}
EXPORT_SYMBOL_GPL(__online_page_free);
-static void generic_online_page(struct page *page, unsigned int order)
+void generic_online_page(struct page *page, unsigned int order)
{
kernel_map_pages(page, 1 << order, 1);
__free_pages_core(page, order);
@@ -626,6 +624,7 @@ static void generic_online_page(struct page *page, unsigned int order)
totalhigh_pages_add(1UL << order);
#endif
}
+EXPORT_SYMBOL_GPL(generic_online_page);
static int online_pages_range(unsigned long start_pfn, unsigned long nr_pages,
void *arg)
--
2.21.0
^ permalink raw reply related
* [PATCH v1 0/3] mm/memory_hotplug: Export generic_online_page()
From: David Hildenbrand @ 2019-09-09 11:48 UTC (permalink / raw)
To: linux-kernel
Cc: linux-mm, Souptick Joarder, linux-hyperv, David Hildenbrand,
Andrew Morton, Dan Williams, Haiyang Zhang, K. Y. Srinivasan,
Michal Hocko, Oscar Salvador, Pavel Tatashin, Qian Cai,
Sasha Levin, Stephen Hemminger, Wei Yang
Based on linux/next + "[PATCH 0/3] Remove __online_page_set_limits()"
Let's replace the __online_page...() functions by generic_online_page().
Hyper-V only wants to delay the actual onlining of un-backed pages, so we
can simpy re-use the generic function.
Only compile-tested.
Cc: Souptick Joarder <jrdr.linux@gmail.com>
David Hildenbrand (3):
mm/memory_hotplug: Export generic_online_page()
hv_balloon: Use generic_online_page()
mm/memory_hotplug: Remove __online_page_free() and
__online_page_increment_counters()
drivers/hv/hv_balloon.c | 3 +--
include/linux/memory_hotplug.h | 4 +---
mm/memory_hotplug.c | 17 ++---------------
3 files changed, 4 insertions(+), 20 deletions(-)
--
2.21.0
^ permalink raw reply
* Re: [PATCH 0/3] Remove __online_page_set_limits()
From: Michal Hocko @ 2019-09-09 8:12 UTC (permalink / raw)
To: Souptick Joarder
Cc: kys, haiyangz, sthemmin, sashal, boris.ostrovsky, jgross,
sstabellini, akpm, david, osalvador, pasha.tatashin,
dan.j.williams, richard.weiyang, cai, linux-hyperv, xen-devel,
linux-mm, linux-kernel
In-Reply-To: <cover.1567889743.git.jrdr.linux@gmail.com>
On Sun 08-09-19 03:17:01, Souptick Joarder wrote:
> __online_page_set_limits() is a dummy function and an extra call
> to this can be avoided.
>
> As both of the callers are now removed, __online_page_set_limits()
> can be removed permanently.
>
> Souptick Joarder (3):
> hv_ballon: Avoid calling dummy function __online_page_set_limits()
> xen/ballon: Avoid calling dummy function __online_page_set_limits()
> mm/memory_hotplug.c: Remove __online_page_set_limits()
>
> drivers/hv/hv_balloon.c | 1 -
> drivers/xen/balloon.c | 1 -
> include/linux/memory_hotplug.h | 1 -
> mm/memory_hotplug.c | 5 -----
> 4 files changed, 8 deletions(-)
To the whole series
Acked-by: Michal Hocko <mhocko@suse.com>
Thanks!
--
Michal Hocko
SUSE Labs
^ permalink raw reply
* Re: [PATCH 3/3] mm/memory_hotplug.c: Remove __online_page_set_limits()
From: David Hildenbrand @ 2019-09-09 7:54 UTC (permalink / raw)
To: Souptick Joarder, kys, haiyangz, sthemmin, sashal,
boris.ostrovsky, jgross, sstabellini, akpm, osalvador, mhocko,
pasha.tatashin, dan.j.williams, richard.weiyang, cai
Cc: linux-hyperv, xen-devel, linux-mm, linux-kernel
In-Reply-To: <9afe6c5a18158f3884a6b302ac2c772f3da49ccc.1567889743.git.jrdr.linux@gmail.com>
On 07.09.19 23:47, Souptick Joarder wrote:
> As both the callers of this dummy __online_page_set_limits()
> is removed, this can be removed permanently.
>
> Signed-off-by: Souptick Joarder <jrdr.linux@gmail.com>
> ---
> include/linux/memory_hotplug.h | 1 -
> mm/memory_hotplug.c | 5 -----
> 2 files changed, 6 deletions(-)
>
> diff --git a/include/linux/memory_hotplug.h b/include/linux/memory_hotplug.h
> index f46ea71..8ee3a2a 100644
> --- a/include/linux/memory_hotplug.h
> +++ b/include/linux/memory_hotplug.h
> @@ -105,7 +105,6 @@ extern unsigned long __offline_isolated_pages(unsigned long start_pfn,
> extern int set_online_page_callback(online_page_callback_t callback);
> extern int restore_online_page_callback(online_page_callback_t callback);
>
> -extern void __online_page_set_limits(struct page *page);
> extern void __online_page_increment_counters(struct page *page);
> extern void __online_page_free(struct page *page);
>
> diff --git a/mm/memory_hotplug.c b/mm/memory_hotplug.c
> index c73f099..dc0118f 100644
> --- a/mm/memory_hotplug.c
> +++ b/mm/memory_hotplug.c
> @@ -604,11 +604,6 @@ int restore_online_page_callback(online_page_callback_t callback)
> }
> EXPORT_SYMBOL_GPL(restore_online_page_callback);
>
> -void __online_page_set_limits(struct page *page)
> -{
> -}
> -EXPORT_SYMBOL_GPL(__online_page_set_limits);
> -
> void __online_page_increment_counters(struct page *page)
> {
> adjust_managed_page_count(page, 1);
>
Reviewed-by: David Hildenbrand <david@redhat.com>
--
Thanks,
David / dhildenb
^ permalink raw reply
* Re: [PATCH 2/3] xen/ballon: Avoid calling dummy function __online_page_set_limits()
From: David Hildenbrand @ 2019-09-09 7:54 UTC (permalink / raw)
To: Souptick Joarder, kys, haiyangz, sthemmin, sashal,
boris.ostrovsky, jgross, sstabellini, akpm, osalvador, mhocko,
pasha.tatashin, dan.j.williams, richard.weiyang, cai
Cc: linux-hyperv, xen-devel, linux-mm, linux-kernel
In-Reply-To: <854db2cf8145d9635249c95584d9a91fd774a229.1567889743.git.jrdr.linux@gmail.com>
On 07.09.19 23:47, Souptick Joarder wrote:
> __online_page_set_limits() is a dummy function and an extra call
> to this function can be avoided.
>
> Signed-off-by: Souptick Joarder <jrdr.linux@gmail.com>
> ---
> drivers/xen/balloon.c | 1 -
> 1 file changed, 1 deletion(-)
>
> diff --git a/drivers/xen/balloon.c b/drivers/xen/balloon.c
> index 4e11de6..05b1f7e 100644
> --- a/drivers/xen/balloon.c
> +++ b/drivers/xen/balloon.c
> @@ -376,7 +376,6 @@ static void xen_online_page(struct page *page, unsigned int order)
> mutex_lock(&balloon_mutex);
> for (i = 0; i < size; i++) {
> p = pfn_to_page(start_pfn + i);
> - __online_page_set_limits(p);
> __SetPageOffline(p);
> __balloon_append(p);
> }
>
Reviewed-by: David Hildenbrand <david@redhat.com>
--
Thanks,
David / dhildenb
^ permalink raw reply
* Re: [PATCH 1/3] hv_ballon: Avoid calling dummy function __online_page_set_limits()
From: David Hildenbrand @ 2019-09-09 7:54 UTC (permalink / raw)
To: Souptick Joarder, kys, haiyangz, sthemmin, sashal,
boris.ostrovsky, jgross, sstabellini, akpm, osalvador, mhocko,
pasha.tatashin, dan.j.williams, richard.weiyang, cai
Cc: linux-hyperv, xen-devel, linux-mm, linux-kernel
In-Reply-To: <8e1bc9d3b492f6bde16e95ebc1dee11d6aefabd7.1567889743.git.jrdr.linux@gmail.com>
On 07.09.19 23:47, Souptick Joarder wrote:
> __online_page_set_limits() is a dummy function and an extra call
> to this function can be avoided.
>
> Signed-off-by: Souptick Joarder <jrdr.linux@gmail.com>
> ---
> drivers/hv/hv_balloon.c | 1 -
> 1 file changed, 1 deletion(-)
>
> diff --git a/drivers/hv/hv_balloon.c b/drivers/hv/hv_balloon.c
> index 6fb4ea5..9bab443 100644
> --- a/drivers/hv/hv_balloon.c
> +++ b/drivers/hv/hv_balloon.c
> @@ -680,7 +680,6 @@ static void hv_page_online_one(struct hv_hotadd_state *has, struct page *pg)
> __ClearPageOffline(pg);
>
> /* This frame is currently backed; online the page. */
> - __online_page_set_limits(pg);
> __online_page_increment_counters(pg);
> __online_page_free(pg);
>
>
Reviewed-by: David Hildenbrand <david@redhat.com>
--
Thanks,
David / dhildenb
^ permalink raw reply
* RE: [PATCH v5 0/9] Enhance the hv_vmbus driver to support hibernation
From: Dexuan Cui @ 2019-09-08 16:32 UTC (permalink / raw)
To: Sasha Levin
Cc: linux-hyperv@vger.kernel.org, Stephen Hemminger, Sasha Levin,
Haiyang Zhang, KY Srinivasan, Michael Kelley, tglx@linutronix.de,
gregkh@linuxfoundation.org, linux-kernel@vger.kernel.org
In-Reply-To: <20190908121329.GD2012@sasha-vm>
> From: Sasha Levin <sashal@kernel.org>
> Sent: Sunday, September 8, 2019 5:13 AM
> On Fri, Sep 06, 2019 at 10:45:31PM +0000, Dexuan Cui wrote:
> >> From: Sasha Levin <sashal@kernel.org>
> >> Sent: Friday, September 6, 2019 1:03 PM
> >> On Thu, Sep 05, 2019 at 11:01:14PM +0000, Dexuan Cui wrote:
> >> >This patchset (consisting of 9 patches) was part of the v4 patchset
> (consisting
> >> >of 12 patches):
> >> >
> >> >The other 3 patches in v4 are posted in another patchset, which will go
> >> >through the tip.git tree.
> >> >
> >> >All the 9 patches here are now rebased to the hyperv tree's hyperv-next
> >> branch, and all the 9 patches have Michael Kelley's Signed-off-by's.
> >> >
> >> >Please review.
> >>
> >> Given that these two series depend on each other, I'd much prefer for
> >> them to go through one tree.
> >
> >Hi Sasha,
> >Yeah, that would be ideal. The problem here is: the other patchset conflicts
> >with the existing patches in the tip.git tree's timers/core branch, so IMO
> >the 3 patches have to go through the tip tree:
> >
> >[PATCH v5 1/3] x86/hyper-v: Suspend/resume the hypercall page for
> hibernation
> >[PATCH v5 2/3] x86/hyper-v: Implement hv_is_hibernation_supported()
> >[PATCH v5 3/3] clocksource/drivers: Suspend/resume Hyper-V clocksource for
> hibernation
> >
> >> But, I may be wrong, and I'm going to see if a scenario such as this
> >> make sense. I've queued this one to the hyperv-next, but I'll wait for
> >> the x86 folks to send their pull request to Linus first before I do it
> >> for these patches.
> >
> >Actually IMHO you don't need to wait, because there is not a build
> >dependency, so either patchset can go into the Linus's tree first.
>
> It'll build, sure. But did anyone actually test one without the other?
Nobody tested this.
The fact is: even if we have the 2 patchsets, hibernation still can not work
for Linux VM on Hyper-V, because we also need the high level driver
changes to hv_netvsc, hv_storvsc, etc. I'm going to send out these
patches soon.
> What happens if Thomas doesn't send his batch at all during the merge
> window?
> Sasha
We need all the patches together to make hibernation work.
I just meant that the 2 patchsets don't have to go into Linus's tree in
a special order, as there is no build issue.
Thanks,
-- Dexuan
^ permalink raw reply
* Re: [PATCH v5 0/9] Enhance the hv_vmbus driver to support hibernation
From: Sasha Levin @ 2019-09-08 12:13 UTC (permalink / raw)
To: Dexuan Cui
Cc: linux-hyperv@vger.kernel.org, Stephen Hemminger, Sasha Levin,
Haiyang Zhang, KY Srinivasan, Michael Kelley, tglx@linutronix.de,
gregkh@linuxfoundation.org, linux-kernel@vger.kernel.org
In-Reply-To: <PU1P153MB01697512A097B489E0440E13BFBA0@PU1P153MB0169.APCP153.PROD.OUTLOOK.COM>
On Fri, Sep 06, 2019 at 10:45:31PM +0000, Dexuan Cui wrote:
>> From: Sasha Levin <sashal@kernel.org>
>> Sent: Friday, September 6, 2019 1:03 PM
>> On Thu, Sep 05, 2019 at 11:01:14PM +0000, Dexuan Cui wrote:
>> >This patchset (consisting of 9 patches) was part of the v4 patchset (consisting
>> >of 12 patches):
>> >
>> >The other 3 patches in v4 are posted in another patchset, which will go
>> >through the tip.git tree.
>> >
>> >All the 9 patches here are now rebased to the hyperv tree's hyperv-next
>> branch, and all the 9 patches have Michael Kelley's Signed-off-by's.
>> >
>> >Please review.
>>
>> Given that these two series depend on each other, I'd much prefer for
>> them to go through one tree.
>
>Hi Sasha,
>Yeah, that would be ideal. The problem here is: the other patchset conflicts
>with the existing patches in the tip.git tree's timers/core branch, so IMO
>the 3 patches have to go through the tip tree:
>
>[PATCH v5 1/3] x86/hyper-v: Suspend/resume the hypercall page for hibernation
>[PATCH v5 2/3] x86/hyper-v: Implement hv_is_hibernation_supported()
>[PATCH v5 3/3] clocksource/drivers: Suspend/resume Hyper-V clocksource for hibernation
>
>> But, I may be wrong, and I'm going to see if a scenario such as this
>> make sense. I've queued this one to the hyperv-next, but I'll wait for
>> the x86 folks to send their pull request to Linus first before I do it
>> for these patches.
>
>Actually IMHO you don't need to wait, because there is not a build
>dependency, so either patchset can go into the Linus's tree first.
It'll build, sure. But did anyone actually test one without the other?
What happens if Thomas doesn't send his batch at all during the merge
window?
--
Thanks,
Sasha
^ permalink raw reply
* Re: [PATCH 2/3] xen/ballon: Avoid calling dummy function __online_page_set_limits()
From: Juergen Gross @ 2019-09-08 5:09 UTC (permalink / raw)
To: Souptick Joarder, richard.weiyang, dan.j.williams, sashal,
sstabellini, cai, akpm, haiyangz, kys, sthemmin, boris.ostrovsky,
david, pasha.tatashin, Michal Hocko, Oscar Salvador
Cc: linux-mm, xen-devel, linux-hyperv, linux-kernel
In-Reply-To: <854db2cf8145d9635249c95584d9a91fd774a229.1567889743.git.jrdr.linux@gmail.com>
On 07.09.19 23:47, Souptick Joarder wrote:
> __online_page_set_limits() is a dummy function and an extra call
> to this function can be avoided.
>
> Signed-off-by: Souptick Joarder <jrdr.linux@gmail.com>
Reviewed-by: Juergen Gross <jgross@suse.com>
Juergen
^ permalink raw reply
* [PATCH 3/3] mm/memory_hotplug.c: Remove __online_page_set_limits()
From: Souptick Joarder @ 2019-09-07 21:47 UTC (permalink / raw)
To: kys, haiyangz, sthemmin, sashal, boris.ostrovsky, jgross,
sstabellini, akpm, david, osalvador, mhocko, pasha.tatashin,
dan.j.williams, richard.weiyang, cai
Cc: linux-hyperv, xen-devel, linux-mm, linux-kernel, Souptick Joarder
In-Reply-To: <cover.1567889743.git.jrdr.linux@gmail.com>
As both the callers of this dummy __online_page_set_limits()
is removed, this can be removed permanently.
Signed-off-by: Souptick Joarder <jrdr.linux@gmail.com>
---
include/linux/memory_hotplug.h | 1 -
mm/memory_hotplug.c | 5 -----
2 files changed, 6 deletions(-)
diff --git a/include/linux/memory_hotplug.h b/include/linux/memory_hotplug.h
index f46ea71..8ee3a2a 100644
--- a/include/linux/memory_hotplug.h
+++ b/include/linux/memory_hotplug.h
@@ -105,7 +105,6 @@ extern unsigned long __offline_isolated_pages(unsigned long start_pfn,
extern int set_online_page_callback(online_page_callback_t callback);
extern int restore_online_page_callback(online_page_callback_t callback);
-extern void __online_page_set_limits(struct page *page);
extern void __online_page_increment_counters(struct page *page);
extern void __online_page_free(struct page *page);
diff --git a/mm/memory_hotplug.c b/mm/memory_hotplug.c
index c73f099..dc0118f 100644
--- a/mm/memory_hotplug.c
+++ b/mm/memory_hotplug.c
@@ -604,11 +604,6 @@ int restore_online_page_callback(online_page_callback_t callback)
}
EXPORT_SYMBOL_GPL(restore_online_page_callback);
-void __online_page_set_limits(struct page *page)
-{
-}
-EXPORT_SYMBOL_GPL(__online_page_set_limits);
-
void __online_page_increment_counters(struct page *page)
{
adjust_managed_page_count(page, 1);
--
1.9.1
^ permalink raw reply related
* [PATCH 2/3] xen/ballon: Avoid calling dummy function __online_page_set_limits()
From: Souptick Joarder @ 2019-09-07 21:47 UTC (permalink / raw)
To: kys, haiyangz, sthemmin, sashal, boris.ostrovsky, jgross,
sstabellini, akpm, david, osalvador, mhocko, pasha.tatashin,
dan.j.williams, richard.weiyang, cai
Cc: linux-hyperv, xen-devel, linux-mm, linux-kernel, Souptick Joarder
In-Reply-To: <cover.1567889743.git.jrdr.linux@gmail.com>
__online_page_set_limits() is a dummy function and an extra call
to this function can be avoided.
Signed-off-by: Souptick Joarder <jrdr.linux@gmail.com>
---
drivers/xen/balloon.c | 1 -
1 file changed, 1 deletion(-)
diff --git a/drivers/xen/balloon.c b/drivers/xen/balloon.c
index 4e11de6..05b1f7e 100644
--- a/drivers/xen/balloon.c
+++ b/drivers/xen/balloon.c
@@ -376,7 +376,6 @@ static void xen_online_page(struct page *page, unsigned int order)
mutex_lock(&balloon_mutex);
for (i = 0; i < size; i++) {
p = pfn_to_page(start_pfn + i);
- __online_page_set_limits(p);
__SetPageOffline(p);
__balloon_append(p);
}
--
1.9.1
^ permalink raw reply related
page: next (older) | prev (newer) | latest
- recent:[subjects (threaded)|topics (new)|topics (active)]
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox