Skip to content

Commit a56e88e

Browse files
committed
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
2 parents 4b162c5 + 96edd61 commit a56e88e

File tree

6 files changed

+33
-13
lines changed

6 files changed

+33
-13
lines changed

arch/x86/xen/smp_pv.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
#include <linux/irq_work.h>
2020
#include <linux/tick.h>
2121
#include <linux/nmi.h>
22+
#include <linux/cpuhotplug.h>
2223

2324
#include <asm/paravirt.h>
2425
#include <asm/desc.h>
@@ -413,7 +414,7 @@ static void xen_pv_play_dead(void) /* used only with HOTPLUG_CPU */
413414
*/
414415
tick_nohz_idle_enter();
415416

416-
cpu_startup_entry(CPUHP_AP_ONLINE_IDLE);
417+
cpuhp_online_idle(CPUHP_AP_ONLINE_IDLE);
417418
}
418419

419420
#else /* !CONFIG_HOTPLUG_CPU */

arch/x86/xen/time.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -309,7 +309,6 @@ static irqreturn_t xen_timer_interrupt(int irq, void *dev_id)
309309
void xen_teardown_timer(int cpu)
310310
{
311311
struct clock_event_device *evt;
312-
BUG_ON(cpu == 0);
313312
evt = &per_cpu(xen_clock_events, cpu).evt;
314313

315314
if (evt->irq >= 0) {

drivers/xen/balloon.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -780,6 +780,9 @@ static int __init balloon_init(void)
780780
}
781781
#endif
782782

783+
/* Init the xen-balloon driver. */
784+
xen_balloon_init();
785+
783786
return 0;
784787
}
785788
subsys_initcall(balloon_init);

drivers/xen/grant-table.c

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@
4242
#include <linux/delay.h>
4343
#include <linux/hardirq.h>
4444
#include <linux/workqueue.h>
45+
#include <linux/ratelimit.h>
4546

4647
#include <xen/xen.h>
4748
#include <xen/interface/xen.h>
@@ -1072,8 +1073,14 @@ static int gnttab_expand(unsigned int req_entries)
10721073
cur = nr_grant_frames;
10731074
extra = ((req_entries + (grefs_per_grant_frame-1)) /
10741075
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);
10761082
return -ENOSPC;
1083+
}
10771084

10781085
rc = gnttab_map(cur, cur + extra - 1);
10791086
if (rc == 0)

drivers/xen/xen-balloon.c

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,8 @@ static void watch_target(struct xenbus_watch *watch,
5959
{
6060
unsigned long long new_target;
6161
int err;
62+
static bool watch_fired;
63+
static long target_diff;
6264

6365
err = xenbus_scanf(XBT_NIL, "memory", "target", "%llu", &new_target);
6466
if (err != 1) {
@@ -69,7 +71,14 @@ static void watch_target(struct xenbus_watch *watch,
6971
/* The given memory/target value is in KiB, so it needs converting to
7072
* pages. PAGE_SHIFT converts bytes to pages, hence PAGE_SHIFT - 10.
7173
*/
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;
7382
}
7483
static struct xenbus_watch target_watch = {
7584
.node = "memory/target",
@@ -94,22 +103,15 @@ static struct notifier_block xenstore_notifier = {
94103
.notifier_call = balloon_init_watcher,
95104
};
96105

97-
static int __init balloon_init(void)
106+
void xen_balloon_init(void)
98107
{
99-
if (!xen_domain())
100-
return -ENODEV;
101-
102-
pr_info("Initialising balloon driver\n");
103-
104108
register_balloon(&balloon_dev);
105109

106110
register_xen_selfballooning(&balloon_dev);
107111

108112
register_xenstore_notifier(&xenstore_notifier);
109-
110-
return 0;
111113
}
112-
subsys_initcall(balloon_init);
114+
EXPORT_SYMBOL_GPL(xen_balloon_init);
113115

114116
#define BALLOON_SHOW(name, format, args...) \
115117
static ssize_t show_##name(struct device *dev, \

include/xen/balloon.h

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,3 +35,11 @@ static inline int register_xen_selfballooning(struct device *dev)
3535
return -ENOSYS;
3636
}
3737
#endif
38+
39+
#ifdef CONFIG_XEN_BALLOON
40+
void xen_balloon_init(void);
41+
#else
42+
static inline void xen_balloon_init(void)
43+
{
44+
}
45+
#endif

0 commit comments

Comments
 (0)