forked from luck/tmp_suning_uos_patched
xen: regression fixes for 4.6-rc6
- Fix two regressions causing crashes in 32-bit PV guests. - Fix a regression in the evtchn driver. -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iQEcBAABAgAGBQJXKhf2AAoJEFxbo/MsZsTRYeEH/jkKi9CsCpcHBdJudqJ/RCmr ZLWu9JT5+iYUOD2o+NVumiMbNE7Ary/5rDVYzskzgtD2OL1MQJWQia3FC9Mhvj7y 6lFEl5m6SPNMi1VOW+BPU8k6tduSgnPISYyJbsQ5/YoAiHNX+ieaWX5UhFFlfDkj 8kpjVNclc3efgh6RqV1GzrmqhkYwVFATwG3SQFujzGSIC7KZNJHy5RQEH3UBvTU2 ymcL+eO35VSZrH9BXVvOberI3ME3UOkFxFIlAVqlBEgO8MoOlV0tFs/ciqjsHZvH ieKAb5jxLlHTwIu6ZxL2vCMp/ili9jeDNsiADkk9utJUUuI5WlHDjrLbqnUf2aY= =ckNq -----END PGP SIGNATURE----- Merge tag 'for-linus-4.6-rc6-tag' of git://git.kernel.org/pub/scm/linux/kernel/git/xen/tip Pull xen regression fixes from David Vrabel: - Fix two regressions causing crashes in 32-bit PV guests - Fix a regression in the evtchn driver * tag 'for-linus-4.6-rc6-tag' of git://git.kernel.org/pub/scm/linux/kernel/git/xen/tip: xen/evtchn: fix ring resize when binding new events xen/balloon: Fix crash when ballooning on x86 32 bit PAE xen: Fix page <-> pfn conversion on 32 bit systems
This commit is contained in:
commit
41143b774a
|
@ -151,6 +151,8 @@ static DECLARE_WAIT_QUEUE_HEAD(balloon_wq);
|
|||
static void balloon_process(struct work_struct *work);
|
||||
static DECLARE_DELAYED_WORK(balloon_worker, balloon_process);
|
||||
|
||||
static void release_memory_resource(struct resource *resource);
|
||||
|
||||
/* When ballooning out (allocating memory to return to Xen) we don't really
|
||||
want the kernel to try too hard since that can trigger the oom killer. */
|
||||
#define GFP_BALLOON \
|
||||
|
@ -267,6 +269,20 @@ static struct resource *additional_memory_resource(phys_addr_t size)
|
|||
return NULL;
|
||||
}
|
||||
|
||||
#ifdef CONFIG_SPARSEMEM
|
||||
{
|
||||
unsigned long limit = 1UL << (MAX_PHYSMEM_BITS - PAGE_SHIFT);
|
||||
unsigned long pfn = res->start >> PAGE_SHIFT;
|
||||
|
||||
if (pfn > limit) {
|
||||
pr_err("New System RAM resource outside addressable RAM (%lu > %lu)\n",
|
||||
pfn, limit);
|
||||
release_memory_resource(res);
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
|
|
|
@ -316,7 +316,6 @@ static int evtchn_resize_ring(struct per_user_data *u)
|
|||
{
|
||||
unsigned int new_size;
|
||||
evtchn_port_t *new_ring, *old_ring;
|
||||
unsigned int p, c;
|
||||
|
||||
/*
|
||||
* Ensure the ring is large enough to capture all possible
|
||||
|
@ -346,20 +345,17 @@ static int evtchn_resize_ring(struct per_user_data *u)
|
|||
/*
|
||||
* Copy the old ring contents to the new ring.
|
||||
*
|
||||
* If the ring contents crosses the end of the current ring,
|
||||
* it needs to be copied in two chunks.
|
||||
* To take care of wrapping, a full ring, and the new index
|
||||
* pointing into the second half, simply copy the old contents
|
||||
* twice.
|
||||
*
|
||||
* +---------+ +------------------+
|
||||
* |34567 12| -> | 1234567 |
|
||||
* +-----p-c-+ +------------------+
|
||||
* |34567 12| -> |34567 1234567 12|
|
||||
* +-----p-c-+ +-------c------p---+
|
||||
*/
|
||||
p = evtchn_ring_offset(u, u->ring_prod);
|
||||
c = evtchn_ring_offset(u, u->ring_cons);
|
||||
if (p < c) {
|
||||
memcpy(new_ring + c, u->ring + c, (u->ring_size - c) * sizeof(*u->ring));
|
||||
memcpy(new_ring + u->ring_size, u->ring, p * sizeof(*u->ring));
|
||||
} else
|
||||
memcpy(new_ring + c, u->ring + c, (p - c) * sizeof(*u->ring));
|
||||
memcpy(new_ring, old_ring, u->ring_size * sizeof(*u->ring));
|
||||
memcpy(new_ring + u->ring_size, old_ring,
|
||||
u->ring_size * sizeof(*u->ring));
|
||||
|
||||
u->ring = new_ring;
|
||||
u->ring_size = new_size;
|
||||
|
|
|
@ -15,9 +15,9 @@
|
|||
*/
|
||||
|
||||
#define xen_pfn_to_page(xen_pfn) \
|
||||
((pfn_to_page(((unsigned long)(xen_pfn) << XEN_PAGE_SHIFT) >> PAGE_SHIFT)))
|
||||
(pfn_to_page((unsigned long)(xen_pfn) >> (PAGE_SHIFT - XEN_PAGE_SHIFT)))
|
||||
#define page_to_xen_pfn(page) \
|
||||
(((page_to_pfn(page)) << PAGE_SHIFT) >> XEN_PAGE_SHIFT)
|
||||
((page_to_pfn(page)) << (PAGE_SHIFT - XEN_PAGE_SHIFT))
|
||||
|
||||
#define XEN_PFN_PER_PAGE (PAGE_SIZE / XEN_PAGE_SIZE)
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user