Commit a56e88ec authored by Linus Torvalds's avatar Linus Torvalds

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
parents 4b162c53 96edd61d
...@@ -19,6 +19,7 @@ ...@@ -19,6 +19,7 @@
#include <linux/irq_work.h> #include <linux/irq_work.h>
#include <linux/tick.h> #include <linux/tick.h>
#include <linux/nmi.h> #include <linux/nmi.h>
#include <linux/cpuhotplug.h>
#include <asm/paravirt.h> #include <asm/paravirt.h>
#include <asm/desc.h> #include <asm/desc.h>
...@@ -413,7 +414,7 @@ static void xen_pv_play_dead(void) /* used only with HOTPLUG_CPU */ ...@@ -413,7 +414,7 @@ static void xen_pv_play_dead(void) /* used only with HOTPLUG_CPU */
*/ */
tick_nohz_idle_enter(); tick_nohz_idle_enter();
cpu_startup_entry(CPUHP_AP_ONLINE_IDLE); cpuhp_online_idle(CPUHP_AP_ONLINE_IDLE);
} }
#else /* !CONFIG_HOTPLUG_CPU */ #else /* !CONFIG_HOTPLUG_CPU */
......
...@@ -309,7 +309,6 @@ static irqreturn_t xen_timer_interrupt(int irq, void *dev_id) ...@@ -309,7 +309,6 @@ static irqreturn_t xen_timer_interrupt(int irq, void *dev_id)
void xen_teardown_timer(int cpu) void xen_teardown_timer(int cpu)
{ {
struct clock_event_device *evt; struct clock_event_device *evt;
BUG_ON(cpu == 0);
evt = &per_cpu(xen_clock_events, cpu).evt; evt = &per_cpu(xen_clock_events, cpu).evt;
if (evt->irq >= 0) { if (evt->irq >= 0) {
......
...@@ -780,6 +780,9 @@ static int __init balloon_init(void) ...@@ -780,6 +780,9 @@ static int __init balloon_init(void)
} }
#endif #endif
/* Init the xen-balloon driver. */
xen_balloon_init();
return 0; return 0;
} }
subsys_initcall(balloon_init); subsys_initcall(balloon_init);
...@@ -42,6 +42,7 @@ ...@@ -42,6 +42,7 @@
#include <linux/delay.h> #include <linux/delay.h>
#include <linux/hardirq.h> #include <linux/hardirq.h>
#include <linux/workqueue.h> #include <linux/workqueue.h>
#include <linux/ratelimit.h>
#include <xen/xen.h> #include <xen/xen.h>
#include <xen/interface/xen.h> #include <xen/interface/xen.h>
...@@ -1072,8 +1073,14 @@ static int gnttab_expand(unsigned int req_entries) ...@@ -1072,8 +1073,14 @@ static int gnttab_expand(unsigned int req_entries)
cur = nr_grant_frames; cur = nr_grant_frames;
extra = ((req_entries + (grefs_per_grant_frame-1)) / extra = ((req_entries + (grefs_per_grant_frame-1)) /
grefs_per_grant_frame); grefs_per_grant_frame);
if (cur + extra > gnttab_max_grant_frames()) if (cur + extra > gnttab_max_grant_frames()) {
pr_warn_ratelimited("xen/grant-table: max_grant_frames reached"
" cur=%u extra=%u limit=%u"
" gnttab_free_count=%u req_entries=%u\n",
cur, extra, gnttab_max_grant_frames(),
gnttab_free_count, req_entries);
return -ENOSPC; return -ENOSPC;
}
rc = gnttab_map(cur, cur + extra - 1); rc = gnttab_map(cur, cur + extra - 1);
if (rc == 0) if (rc == 0)
......
...@@ -59,6 +59,8 @@ static void watch_target(struct xenbus_watch *watch, ...@@ -59,6 +59,8 @@ static void watch_target(struct xenbus_watch *watch,
{ {
unsigned long long new_target; unsigned long long new_target;
int err; int err;
static bool watch_fired;
static long target_diff;
err = xenbus_scanf(XBT_NIL, "memory", "target", "%llu", &new_target); err = xenbus_scanf(XBT_NIL, "memory", "target", "%llu", &new_target);
if (err != 1) { if (err != 1) {
...@@ -69,7 +71,14 @@ static void watch_target(struct xenbus_watch *watch, ...@@ -69,7 +71,14 @@ static void watch_target(struct xenbus_watch *watch,
/* The given memory/target value is in KiB, so it needs converting to /* The given memory/target value is in KiB, so it needs converting to
* pages. PAGE_SHIFT converts bytes to pages, hence PAGE_SHIFT - 10. * pages. PAGE_SHIFT converts bytes to pages, hence PAGE_SHIFT - 10.
*/ */
balloon_set_new_target(new_target >> (PAGE_SHIFT - 10)); new_target >>= PAGE_SHIFT - 10;
if (watch_fired) {
balloon_set_new_target(new_target - target_diff);
return;
}
watch_fired = true;
target_diff = new_target - balloon_stats.target_pages;
} }
static struct xenbus_watch target_watch = { static struct xenbus_watch target_watch = {
.node = "memory/target", .node = "memory/target",
...@@ -94,22 +103,15 @@ static struct notifier_block xenstore_notifier = { ...@@ -94,22 +103,15 @@ static struct notifier_block xenstore_notifier = {
.notifier_call = balloon_init_watcher, .notifier_call = balloon_init_watcher,
}; };
static int __init balloon_init(void) void xen_balloon_init(void)
{ {
if (!xen_domain())
return -ENODEV;
pr_info("Initialising balloon driver\n");
register_balloon(&balloon_dev); register_balloon(&balloon_dev);
register_xen_selfballooning(&balloon_dev); register_xen_selfballooning(&balloon_dev);
register_xenstore_notifier(&xenstore_notifier); register_xenstore_notifier(&xenstore_notifier);
return 0;
} }
subsys_initcall(balloon_init); EXPORT_SYMBOL_GPL(xen_balloon_init);
#define BALLOON_SHOW(name, format, args...) \ #define BALLOON_SHOW(name, format, args...) \
static ssize_t show_##name(struct device *dev, \ static ssize_t show_##name(struct device *dev, \
......
...@@ -35,3 +35,11 @@ static inline int register_xen_selfballooning(struct device *dev) ...@@ -35,3 +35,11 @@ static inline int register_xen_selfballooning(struct device *dev)
return -ENOSYS; return -ENOSYS;
} }
#endif #endif
#ifdef CONFIG_XEN_BALLOON
void xen_balloon_init(void);
#else
static inline void xen_balloon_init(void)
{
}
#endif
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment