aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2017-07-23 14:22:45 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2017-07-23 14:22:45 -0400
commita56e88ec05df50110f2bf578b6e17128f37111ed (patch)
treefe3ee0bcd1cef2d28ffd62a0c012ad972c581049
parent4b162c530d9c101381500e586fedb1340595a6ff (diff)
parent96edd61dcf44362d3ef0bed1a5361e0ac7886a63 (diff)
Merge tag 'for-linus-4.13b-rc2-tag' of git://git.kernel.org/pub/scm/linux/kernel/git/xen/tip
Pull xen fixes from Juergen Gross: "Some fixes and cleanups for running under Xen" * tag 'for-linus-4.13b-rc2-tag' of git://git.kernel.org/pub/scm/linux/kernel/git/xen/tip: xen/balloon: don't online new memory initially xen/x86: fix cpu hotplug xen/grant-table: log the lack of grants xen/x86: Don't BUG on CPU0 offlining
-rw-r--r--arch/x86/xen/smp_pv.c3
-rw-r--r--arch/x86/xen/time.c1
-rw-r--r--drivers/xen/balloon.c3
-rw-r--r--drivers/xen/grant-table.c9
-rw-r--r--drivers/xen/xen-balloon.c22
-rw-r--r--include/xen/balloon.h8
6 files changed, 33 insertions, 13 deletions
diff --git a/arch/x86/xen/smp_pv.c b/arch/x86/xen/smp_pv.c
index 1ea598e5f030..51471408fdd1 100644
--- a/arch/x86/xen/smp_pv.c
+++ b/arch/x86/xen/smp_pv.c
@@ -19,6 +19,7 @@
19#include <linux/irq_work.h> 19#include <linux/irq_work.h>
20#include <linux/tick.h> 20#include <linux/tick.h>
21#include <linux/nmi.h> 21#include <linux/nmi.h>
22#include <linux/cpuhotplug.h>
22 23
23#include <asm/paravirt.h> 24#include <asm/paravirt.h>
24#include <asm/desc.h> 25#include <asm/desc.h>
@@ -413,7 +414,7 @@ static void xen_pv_play_dead(void) /* used only with HOTPLUG_CPU */
413 */ 414 */
414 tick_nohz_idle_enter(); 415 tick_nohz_idle_enter();
415 416
416 cpu_startup_entry(CPUHP_AP_ONLINE_IDLE); 417 cpuhp_online_idle(CPUHP_AP_ONLINE_IDLE);
417} 418}
418 419
419#else /* !CONFIG_HOTPLUG_CPU */ 420#else /* !CONFIG_HOTPLUG_CPU */
diff --git a/arch/x86/xen/time.c b/arch/x86/xen/time.c
index a1895a8e85c1..1ecb05db3632 100644
--- a/arch/x86/xen/time.c
+++ b/arch/x86/xen/time.c
@@ -309,7 +309,6 @@ static irqreturn_t xen_timer_interrupt(int irq, void *dev_id)
309void xen_teardown_timer(int cpu) 309void xen_teardown_timer(int cpu)
310{ 310{
311 struct clock_event_device *evt; 311 struct clock_event_device *evt;
312 BUG_ON(cpu == 0);
313 evt = &per_cpu(xen_clock_events, cpu).evt; 312 evt = &per_cpu(xen_clock_events, cpu).evt;
314 313
315 if (evt->irq >= 0) { 314 if (evt->irq >= 0) {
diff --git a/drivers/xen/balloon.c b/drivers/xen/balloon.c
index 50dcb68d8070..ab609255a0f3 100644
--- a/drivers/xen/balloon.c
+++ b/drivers/xen/balloon.c
@@ -780,6 +780,9 @@ static int __init balloon_init(void)
780 } 780 }
781#endif 781#endif
782 782
783 /* Init the xen-balloon driver. */
784 xen_balloon_init();
785
783 return 0; 786 return 0;
784} 787}
785subsys_initcall(balloon_init); 788subsys_initcall(balloon_init);
diff --git a/drivers/xen/grant-table.c b/drivers/xen/grant-table.c
index d6786b87e13b..2c6a9114d332 100644
--- a/drivers/xen/grant-table.c
+++ b/drivers/xen/grant-table.c
@@ -42,6 +42,7 @@
42#include <linux/delay.h> 42#include <linux/delay.h>
43#include <linux/hardirq.h> 43#include <linux/hardirq.h>
44#include <linux/workqueue.h> 44#include <linux/workqueue.h>
45#include <linux/ratelimit.h>
45 46
46#include <xen/xen.h> 47#include <xen/xen.h>
47#include <xen/interface/xen.h> 48#include <xen/interface/xen.h>
@@ -1072,8 +1073,14 @@ static int gnttab_expand(unsigned int req_entries)
1072 cur = nr_grant_frames; 1073 cur = nr_grant_frames;
1073 extra = ((req_entries + (grefs_per_grant_frame-1)) / 1074 extra = ((req_entries + (grefs_per_grant_frame-1)) /
1074 grefs_per_grant_frame); 1075 grefs_per_grant_frame);
1075 if (cur + extra > gnttab_max_grant_frames()) 1076 if (cur + extra > gnttab_max_grant_frames()) {
1077 pr_warn_ratelimited("xen/grant-table: max_grant_frames reached"
1078 " cur=%u extra=%u limit=%u"
1079 " gnttab_free_count=%u req_entries=%u\n",
1080 cur, extra, gnttab_max_grant_frames(),
1081 gnttab_free_count, req_entries);
1076 return -ENOSPC; 1082 return -ENOSPC;
1083 }
1077 1084
1078 rc = gnttab_map(cur, cur + extra - 1); 1085 rc = gnttab_map(cur, cur + extra - 1);
1079 if (rc == 0) 1086 if (rc == 0)
diff --git a/drivers/xen/xen-balloon.c b/drivers/xen/xen-balloon.c
index e7715cb62eef..e89136ab851e 100644
--- a/drivers/xen/xen-balloon.c
+++ b/drivers/xen/xen-balloon.c
@@ -59,6 +59,8 @@ static void watch_target(struct xenbus_watch *watch,
59{ 59{
60 unsigned long long new_target; 60 unsigned long long new_target;
61 int err; 61 int err;
62 static bool watch_fired;
63 static long target_diff;
62 64
63 err = xenbus_scanf(XBT_NIL, "memory", "target", "%llu", &new_target); 65 err = xenbus_scanf(XBT_NIL, "memory", "target", "%llu", &new_target);
64 if (err != 1) { 66 if (err != 1) {
@@ -69,7 +71,14 @@ static void watch_target(struct xenbus_watch *watch,
69 /* The given memory/target value is in KiB, so it needs converting to 71 /* The given memory/target value is in KiB, so it needs converting to
70 * pages. PAGE_SHIFT converts bytes to pages, hence PAGE_SHIFT - 10. 72 * pages. PAGE_SHIFT converts bytes to pages, hence PAGE_SHIFT - 10.
71 */ 73 */
72 balloon_set_new_target(new_target >> (PAGE_SHIFT - 10)); 74 new_target >>= PAGE_SHIFT - 10;
75 if (watch_fired) {
76 balloon_set_new_target(new_target - target_diff);
77 return;
78 }
79
80 watch_fired = true;
81 target_diff = new_target - balloon_stats.target_pages;
73} 82}
74static struct xenbus_watch target_watch = { 83static struct xenbus_watch target_watch = {
75 .node = "memory/target", 84 .node = "memory/target",
@@ -94,22 +103,15 @@ static struct notifier_block xenstore_notifier = {
94 .notifier_call = balloon_init_watcher, 103 .notifier_call = balloon_init_watcher,
95}; 104};
96 105
97static int __init balloon_init(void) 106void xen_balloon_init(void)
98{ 107{
99 if (!xen_domain())
100 return -ENODEV;
101
102 pr_info("Initialising balloon driver\n");
103
104 register_balloon(&balloon_dev); 108 register_balloon(&balloon_dev);
105 109
106 register_xen_selfballooning(&balloon_dev); 110 register_xen_selfballooning(&balloon_dev);
107 111
108 register_xenstore_notifier(&xenstore_notifier); 112 register_xenstore_notifier(&xenstore_notifier);
109
110 return 0;
111} 113}
112subsys_initcall(balloon_init); 114EXPORT_SYMBOL_GPL(xen_balloon_init);
113 115
114#define BALLOON_SHOW(name, format, args...) \ 116#define BALLOON_SHOW(name, format, args...) \
115 static ssize_t show_##name(struct device *dev, \ 117 static ssize_t show_##name(struct device *dev, \
diff --git a/include/xen/balloon.h b/include/xen/balloon.h
index d1767dfb0d95..8906361bb50c 100644
--- a/include/xen/balloon.h
+++ b/include/xen/balloon.h
@@ -35,3 +35,11 @@ static inline int register_xen_selfballooning(struct device *dev)
35 return -ENOSYS; 35 return -ENOSYS;
36} 36}
37#endif 37#endif
38
39#ifdef CONFIG_XEN_BALLOON
40void xen_balloon_init(void);
41#else
42static inline void xen_balloon_init(void)
43{
44}
45#endif