aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2014-09-11 19:52:29 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2014-09-11 19:52:29 -0400
commit7ee2d2d67144965d9d3607369ab0ebf5bad230c0 (patch)
tree259e81c30fe6d168684210fa3978a35fd77badae /drivers
parent018cace21b8318bd322c316dd01357febff139fc (diff)
parent0b5a50635fc916cf46e3de0b819a61fc3f17e7ee (diff)
Merge tag 'stable/for-linus-3.17-b-rc4-tag' of git://git.kernel.org/pub/scm/linux/kernel/git/xen/tip
Pull Xen bug fixes from David Vrabel: - fix for PVHVM suspend/resume and migration - don't pointlessly retry certain ballooning ops - fix gntalloc when grefs have run out. - fix PV boot if KSALR is enable or very large modules are used. * tag 'stable/for-linus-3.17-b-rc4-tag' of git://git.kernel.org/pub/scm/linux/kernel/git/xen/tip: x86/xen: don't copy bogus duplicate entries into kernel page tables xen/gntalloc: safely delete grefs in add_grefs() undo path xen/gntalloc: fix oops after runnning out of grant refs xen/balloon: cancel ballooning if adding new memory failed xen/manage: Always freeze/thaw processes when suspend/resuming
Diffstat (limited to 'drivers')
-rw-r--r--drivers/xen/balloon.c4
-rw-r--r--drivers/xen/gntalloc.c16
-rw-r--r--drivers/xen/manage.c7
3 files changed, 9 insertions, 18 deletions
diff --git a/drivers/xen/balloon.c b/drivers/xen/balloon.c
index 5c660c77f03b..1e0a317d3dcd 100644
--- a/drivers/xen/balloon.c
+++ b/drivers/xen/balloon.c
@@ -230,8 +230,8 @@ static enum bp_state reserve_additional_memory(long credit)
230 rc = add_memory(nid, hotplug_start_paddr, balloon_hotplug << PAGE_SHIFT); 230 rc = add_memory(nid, hotplug_start_paddr, balloon_hotplug << PAGE_SHIFT);
231 231
232 if (rc) { 232 if (rc) {
233 pr_info("%s: add_memory() failed: %i\n", __func__, rc); 233 pr_warn("Cannot add additional memory (%i)\n", rc);
234 return BP_EAGAIN; 234 return BP_ECANCELED;
235 } 235 }
236 236
237 balloon_hotplug -= credit; 237 balloon_hotplug -= credit;
diff --git a/drivers/xen/gntalloc.c b/drivers/xen/gntalloc.c
index 787d17945418..e53fe191738c 100644
--- a/drivers/xen/gntalloc.c
+++ b/drivers/xen/gntalloc.c
@@ -124,7 +124,7 @@ static int add_grefs(struct ioctl_gntalloc_alloc_gref *op,
124 int i, rc, readonly; 124 int i, rc, readonly;
125 LIST_HEAD(queue_gref); 125 LIST_HEAD(queue_gref);
126 LIST_HEAD(queue_file); 126 LIST_HEAD(queue_file);
127 struct gntalloc_gref *gref; 127 struct gntalloc_gref *gref, *next;
128 128
129 readonly = !(op->flags & GNTALLOC_FLAG_WRITABLE); 129 readonly = !(op->flags & GNTALLOC_FLAG_WRITABLE);
130 rc = -ENOMEM; 130 rc = -ENOMEM;
@@ -141,13 +141,11 @@ static int add_grefs(struct ioctl_gntalloc_alloc_gref *op,
141 goto undo; 141 goto undo;
142 142
143 /* Grant foreign access to the page. */ 143 /* Grant foreign access to the page. */
144 gref->gref_id = gnttab_grant_foreign_access(op->domid, 144 rc = gnttab_grant_foreign_access(op->domid,
145 pfn_to_mfn(page_to_pfn(gref->page)), readonly); 145 pfn_to_mfn(page_to_pfn(gref->page)), readonly);
146 if ((int)gref->gref_id < 0) { 146 if (rc < 0)
147 rc = gref->gref_id;
148 goto undo; 147 goto undo;
149 } 148 gref_ids[i] = gref->gref_id = rc;
150 gref_ids[i] = gref->gref_id;
151 } 149 }
152 150
153 /* Add to gref lists. */ 151 /* Add to gref lists. */
@@ -162,8 +160,8 @@ undo:
162 mutex_lock(&gref_mutex); 160 mutex_lock(&gref_mutex);
163 gref_size -= (op->count - i); 161 gref_size -= (op->count - i);
164 162
165 list_for_each_entry(gref, &queue_file, next_file) { 163 list_for_each_entry_safe(gref, next, &queue_file, next_file) {
166 /* __del_gref does not remove from queue_file */ 164 list_del(&gref->next_file);
167 __del_gref(gref); 165 __del_gref(gref);
168 } 166 }
169 167
@@ -193,7 +191,7 @@ static void __del_gref(struct gntalloc_gref *gref)
193 191
194 gref->notify.flags = 0; 192 gref->notify.flags = 0;
195 193
196 if (gref->gref_id > 0) { 194 if (gref->gref_id) {
197 if (gnttab_query_foreign_access(gref->gref_id)) 195 if (gnttab_query_foreign_access(gref->gref_id))
198 return; 196 return;
199 197
diff --git a/drivers/xen/manage.c b/drivers/xen/manage.c
index 5f1e1f3cd186..f8bb36f9d9ce 100644
--- a/drivers/xen/manage.c
+++ b/drivers/xen/manage.c
@@ -103,16 +103,11 @@ static void do_suspend(void)
103 103
104 shutting_down = SHUTDOWN_SUSPEND; 104 shutting_down = SHUTDOWN_SUSPEND;
105 105
106#ifdef CONFIG_PREEMPT
107 /* If the kernel is preemptible, we need to freeze all the processes
108 to prevent them from being in the middle of a pagetable update
109 during suspend. */
110 err = freeze_processes(); 106 err = freeze_processes();
111 if (err) { 107 if (err) {
112 pr_err("%s: freeze failed %d\n", __func__, err); 108 pr_err("%s: freeze failed %d\n", __func__, err);
113 goto out; 109 goto out;
114 } 110 }
115#endif
116 111
117 err = dpm_suspend_start(PMSG_FREEZE); 112 err = dpm_suspend_start(PMSG_FREEZE);
118 if (err) { 113 if (err) {
@@ -157,10 +152,8 @@ out_resume:
157 dpm_resume_end(si.cancelled ? PMSG_THAW : PMSG_RESTORE); 152 dpm_resume_end(si.cancelled ? PMSG_THAW : PMSG_RESTORE);
158 153
159out_thaw: 154out_thaw:
160#ifdef CONFIG_PREEMPT
161 thaw_processes(); 155 thaw_processes();
162out: 156out:
163#endif
164 shutting_down = SHUTDOWN_INVALID; 157 shutting_down = SHUTDOWN_INVALID;
165} 158}
166#endif /* CONFIG_HIBERNATE_CALLBACKS */ 159#endif /* CONFIG_HIBERNATE_CALLBACKS */