diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2013-09-25 18:50:53 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2013-09-25 18:50:53 -0400 |
commit | 4b97280675f45c1650ee4e388bd711ecbb18c4b4 (patch) | |
tree | 45f9de3f355ac9245b9bda38e61204725cc7d991 /drivers/xen | |
parent | e93dd910b906d2bb881f334685eb03431fd3fa48 (diff) | |
parent | 15a3eac0784edb73cb2ec0f0c97705ba4bd39b3f (diff) |
Merge tag 'stable/for-linus-3.12-rc2-tag' of git://git.kernel.org/pub/scm/linux/kernel/git/xen/tip
Pull Xen fixes from Konrad Rzeszutek Wilk:
"Bug-fixes and one update to the kernel-paramters.txt documentation.
- Fix PV spinlocks triggering jump_label code bug
- Remove extraneous code in the tpm front driver
- Fix ballooning out of pages when non-preemptible
- Fix deadlock when using a 32-bit initial domain with large amount
of memory
- Add xen_nopvpsin parameter to the documentation"
* tag 'stable/for-linus-3.12-rc2-tag' of git://git.kernel.org/pub/scm/linux/kernel/git/xen/tip:
xen/spinlock: Document the xen_nopvspin parameter.
xen/p2m: check MFN is in range before using the m2p table
xen/balloon: don't alloc page while non-preemptible
xen: Do not enable spinlocks before jump_label_init() has executed
tpm: xen-tpmfront: Remove the locality sysfs attribute
tpm: xen-tpmfront: Fix default durations
Diffstat (limited to 'drivers/xen')
-rw-r--r-- | drivers/xen/balloon.c | 23 |
1 files changed, 11 insertions, 12 deletions
diff --git a/drivers/xen/balloon.c b/drivers/xen/balloon.c index a50c6e3a7cc4..b232908a6192 100644 --- a/drivers/xen/balloon.c +++ b/drivers/xen/balloon.c | |||
@@ -398,8 +398,6 @@ static enum bp_state decrease_reservation(unsigned long nr_pages, gfp_t gfp) | |||
398 | if (nr_pages > ARRAY_SIZE(frame_list)) | 398 | if (nr_pages > ARRAY_SIZE(frame_list)) |
399 | nr_pages = ARRAY_SIZE(frame_list); | 399 | nr_pages = ARRAY_SIZE(frame_list); |
400 | 400 | ||
401 | scratch_page = get_balloon_scratch_page(); | ||
402 | |||
403 | for (i = 0; i < nr_pages; i++) { | 401 | for (i = 0; i < nr_pages; i++) { |
404 | page = alloc_page(gfp); | 402 | page = alloc_page(gfp); |
405 | if (page == NULL) { | 403 | if (page == NULL) { |
@@ -413,6 +411,12 @@ static enum bp_state decrease_reservation(unsigned long nr_pages, gfp_t gfp) | |||
413 | 411 | ||
414 | scrub_page(page); | 412 | scrub_page(page); |
415 | 413 | ||
414 | /* | ||
415 | * Ballooned out frames are effectively replaced with | ||
416 | * a scratch frame. Ensure direct mappings and the | ||
417 | * p2m are consistent. | ||
418 | */ | ||
419 | scratch_page = get_balloon_scratch_page(); | ||
416 | #ifdef CONFIG_XEN_HAVE_PVMMU | 420 | #ifdef CONFIG_XEN_HAVE_PVMMU |
417 | if (xen_pv_domain() && !PageHighMem(page)) { | 421 | if (xen_pv_domain() && !PageHighMem(page)) { |
418 | ret = HYPERVISOR_update_va_mapping( | 422 | ret = HYPERVISOR_update_va_mapping( |
@@ -422,24 +426,19 @@ static enum bp_state decrease_reservation(unsigned long nr_pages, gfp_t gfp) | |||
422 | BUG_ON(ret); | 426 | BUG_ON(ret); |
423 | } | 427 | } |
424 | #endif | 428 | #endif |
425 | } | ||
426 | |||
427 | /* Ensure that ballooned highmem pages don't have kmaps. */ | ||
428 | kmap_flush_unused(); | ||
429 | flush_tlb_all(); | ||
430 | |||
431 | /* No more mappings: invalidate P2M and add to balloon. */ | ||
432 | for (i = 0; i < nr_pages; i++) { | ||
433 | pfn = mfn_to_pfn(frame_list[i]); | ||
434 | if (!xen_feature(XENFEAT_auto_translated_physmap)) { | 429 | if (!xen_feature(XENFEAT_auto_translated_physmap)) { |
435 | unsigned long p; | 430 | unsigned long p; |
436 | p = page_to_pfn(scratch_page); | 431 | p = page_to_pfn(scratch_page); |
437 | __set_phys_to_machine(pfn, pfn_to_mfn(p)); | 432 | __set_phys_to_machine(pfn, pfn_to_mfn(p)); |
438 | } | 433 | } |
434 | put_balloon_scratch_page(); | ||
435 | |||
439 | balloon_append(pfn_to_page(pfn)); | 436 | balloon_append(pfn_to_page(pfn)); |
440 | } | 437 | } |
441 | 438 | ||
442 | put_balloon_scratch_page(); | 439 | /* Ensure that ballooned highmem pages don't have kmaps. */ |
440 | kmap_flush_unused(); | ||
441 | flush_tlb_all(); | ||
443 | 442 | ||
444 | set_xen_guest_handle(reservation.extent_start, frame_list); | 443 | set_xen_guest_handle(reservation.extent_start, frame_list); |
445 | reservation.nr_extents = nr_pages; | 444 | reservation.nr_extents = nr_pages; |