56456: regressions - FAIL
osstest service user
Reviewed-by Tim Deegan Reviewed-by Tim Deegan Reviewed-by Tim Deegan Tested-by Julien Grall Reviewed-by Tim Deegan Reviewed-by Tim Deegan Acked-by Jan Beulich Acked-by Ian Campbell Reviewed-by Tim Deegan Reviewed-by Jan Beulichflight 56456 xen-unstable real [real]
http://logs.test-lab.xenproject.org/osstest/logs/56456/
Regressions :-(
Tests which did not succeed and are blocking,
including tests which could not be run:
test-amd64-i386-rumpuserxen-i386 15 rumpuserxen-demo-xenstorels/xenstorels.repeat fail REGR. vs. 56375 test-amd64-amd64-rumpuserxen-amd64 15 rumpuserxen-demo-xenstorels/xenstorels.repeat fail REGR. vs. 56375
test-amd64-amd64-xl-multivcpu 14 guest-localmigrate fail REGR. vs. 56375 test-amd64-amd64-xl 14 guest-localmigrate fail REGR. vs. 56375 test-amd64-amd64-xl-credit2 14 guest-localmigrate fail REGR. vs. 56375
test-amd64-amd64-xl-qemut-win7-amd64 12 guest-localmigrate fail REGR. vs. 56375
test-amd64-i386-xl 14 guest-localmigrate fail REGR. vs. 56375
test-amd64-i386-xl-qemut-win7-amd64 12 guest-localmigrate fail REGR. vs. 56375
test-amd64-i386-pair 21 guest-migrate/src_host/dst_host fail REGR. vs. 56375
test-amd64-amd64-xl-qemut-debianhvm-amd64 12 guest-localmigrate fail REGR. vs. 56375 test-amd64-amd64-pair 21 guest-migrate/src_host/dst_host fail REGR. vs. 56375 test-amd64-i386-xl-qemut-debianhvm-amd64 12 guest-localmigrate fail REGR. vs. 56375 test-amd64-amd64-xl-qemut-winxpsp3 12 guest-localmigrate fail REGR. vs. 56375 test-amd64-i386-xl-qemut-winxpsp3-vcpus1 12 guest-localmigrate fail REGR. vs. 56375
test-armhf-armhf-xl-multivcpu 17 leak-check/check fail REGR. vs. 56375
test-amd64-i386-xl-qemut-winxpsp3 12 guest-localmigrate fail REGR. vs. 56375
Regressions which are regarded as allowable (not blocking):
test-amd64-i386-freebsd10-amd64 13 guest-localmigrate fail REGR. vs. 56375
test-amd64-amd64-xl-sedf 14 guest-localmigrate fail REGR. vs. 56375
test-amd64-i386-xl-qemuu-winxpsp3-vcpus1 12 guest-localmigrate fail REGR. vs. 56375
test-amd64-i386-xl-qemuu-winxpsp3 12 guest-localmigrate fail REGR. vs. 56375
test-amd64-amd64-xl-sedf-pin 14 guest-localmigrate fail REGR. vs. 56375
test-amd64-amd64-xl-qemuu-debianhvm-amd64 12 guest-localmigrate fail REGR. vs. 56375 test-amd64-i386-xl-qemuu-win7-amd64 12 guest-localmigrate fail REGR. vs. 56375 test-amd64-amd64-xl-qemuu-winxpsp3 12 guest-localmigrate fail REGR. vs. 56375 test-amd64-i386-xl-qemuu-debianhvm-amd64 12 guest-localmigrate fail REGR. vs. 56375 test-amd64-amd64-xl-qemuu-ovmf-amd64 12 guest-localmigrate fail REGR. vs. 56375 test-amd64-i386-xl-qemuu-ovmf-amd64 12 guest-localmigrate fail REGR. vs. 56375 test-amd64-amd64-xl-qemuu-win7-amd64 12 guest-localmigrate fail REGR. vs. 56375
test-amd64-i386-freebsd10-i386 13 guest-localmigrate fail like 56375
test-amd64-i386-libvirt 11 guest-start fail like 56375 test-armhf-armhf-libvirt 11 guest-start fail like 56375
Tests which did not succeed, but are not blocking:
test-amd64-i386-xl-qemut-debianhvm-amd64-xsm 9 debian-hvm-install fail never pass
test-amd64-amd64-xl-xsm 11 guest-start fail never pass
test-amd64-amd64-xl-qemut-debianhvm-amd64-xsm 9 debian-hvm-install fail never pass test-amd64-i386-xl-qemuu-debianhvm-amd64-xsm 9 debian-hvm-install fail never pass
test-amd64-amd64-libvirt-xsm 11 guest-start fail never pass test-amd64-i386-xl-xsm 11 guest-start fail never pass test-amd64-amd64-xl-pvh-intel 11 guest-start fail never pass test-amd64-i386-libvirt-xsm 11 guest-start fail never pass test-amd64-amd64-xl-qemuu-debianhvm-amd64-xsm 9 debian-hvm-install fail never pass test-armhf-armhf-libvirt-xsm 6 xen-boot fail never pass test-amd64-amd64-xl-pvh-amd 11 guest-start fail never pass test-armhf-armhf-xl-xsm 6 xen-boot fail never pass test-armhf-armhf-xl-arndale 12 migrate-support-check fail never pass test-amd64-amd64-libvirt 12 migrate-support-check fail never pass test-armhf-armhf-xl-sedf-pin 12 migrate-support-check fail never pass test-armhf-armhf-xl-cubietruck 12 migrate-support-check fail never pass test-armhf-armhf-xl 12 migrate-support-check fail never pass test-armhf-armhf-xl-sedf 12 migrate-support-check fail never pass test-armhf-armhf-xl-credit2 12 migrate-support-check fail never pass test-armhf-armhf-xl-multivcpu 12 migrate-support-check fail never pass
version targeted for testing:
xen a809eeea06d20b115d78f12e473502bcb6209844
baseline version:
xen e13013dbf1d5997915548a3b5f1c39594d8c1d7b
------------------------------------------------------------
People who touched revisions under test:
David Vrabel <[email protected]>
Ian Campbell <[email protected]>
Jan Beulich <[email protected]>
Julien Grall <[email protected]> (ARM)
Roger Pau Monné <[email protected]>
------------------------------------------------------------
jobs:
build-amd64-xsm pass build-armhf-xsm pass build-i386-xsm pass build-amd64 pass build-armhf pass build-i386 pass build-amd64-libvirt pass build-armhf-libvirt pass build-i386-libvirt pass build-amd64-oldkern pass build-i386-oldkern pass build-amd64-pvops pass build-armhf-pvops pass build-i386-pvops pass build-amd64-rumpuserxen pass build-i386-rumpuserxen pass test-amd64-amd64-xl fail test-armhf-armhf-xl pass test-amd64-i386-xl fail test-amd64-amd64-xl-qemut-debianhvm-amd64-xsm fail test-amd64-i386-xl-qemut-debianhvm-amd64-xsm fail test-amd64-amd64-xl-qemuu-debianhvm-amd64-xsm fail test-amd64-i386-xl-qemuu-debianhvm-amd64-xsm fail test-amd64-amd64-libvirt-xsm fail test-armhf-armhf-libvirt-xsm fail test-amd64-i386-libvirt-xsm fail test-amd64-amd64-xl-xsm fail test-armhf-armhf-xl-xsm fail test-amd64-i386-xl-xsm fail test-amd64-amd64-xl-pvh-amd fail test-amd64-i386-qemut-rhel6hvm-amd pass test-amd64-i386-qemuu-rhel6hvm-amd pass test-amd64-amd64-xl-qemut-debianhvm-amd64 fail test-amd64-i386-xl-qemut-debianhvm-amd64 fail test-amd64-amd64-xl-qemuu-debianhvm-amd64 fail test-amd64-i386-xl-qemuu-debianhvm-amd64 fail test-amd64-i386-freebsd10-amd64 fail test-amd64-amd64-xl-qemuu-ovmf-amd64 fail test-amd64-i386-xl-qemuu-ovmf-amd64 fail test-amd64-amd64-rumpuserxen-amd64 fail test-amd64-amd64-xl-qemut-win7-amd64 fail test-amd64-i386-xl-qemut-win7-amd64 fail test-amd64-amd64-xl-qemuu-win7-amd64 fail test-amd64-i386-xl-qemuu-win7-amd64 fail test-armhf-armhf-xl-arndale pass test-amd64-amd64-xl-credit2 fail test-armhf-armhf-xl-credit2 pass test-armhf-armhf-xl-cubietruck pass test-amd64-i386-freebsd10-i386 fail test-amd64-i386-rumpuserxen-i386 fail test-amd64-amd64-xl-pvh-intel fail test-amd64-i386-qemut-rhel6hvm-intel pass test-amd64-i386-qemuu-rhel6hvm-intel pass test-amd64-amd64-libvirt pass test-armhf-armhf-libvirt fail test-amd64-i386-libvirt fail test-amd64-amd64-xl-multivcpu fail test-armhf-armhf-xl-multivcpu fail test-amd64-amd64-pair fail test-amd64-i386-pair fail test-amd64-amd64-xl-sedf-pin fail test-armhf-armhf-xl-sedf-pin pass test-amd64-amd64-xl-sedf fail test-armhf-armhf-xl-sedf pass test-amd64-i386-xl-qemut-winxpsp3-vcpus1 fail test-amd64-i386-xl-qemuu-winxpsp3-vcpus1 fail test-amd64-amd64-xl-qemut-winxpsp3 fail test-amd64-i386-xl-qemut-winxpsp3 fail test-amd64-amd64-xl-qemuu-winxpsp3 fail test-amd64-i386-xl-qemuu-winxpsp3 fail
------------------------------------------------------------
sg-report-flight on osstest.test-lab.xenproject.org
logs: /home/osstest/pub/logs
images: /home/osstest/pub/images
Logs, config files, etc. are available at
http://logs.test-lab.xenproject.org/osstest/logs
Test harness code can be found at
http://xenbits.xen.org/gitweb?p=osstest.git;a=summary
Not pushing.
------------------------------------------------------------
commit a809eeea06d20b115d78f12e473502bcb6209844
Author: Roger Pau Monné <[email protected]> Date: Fri May 15 10:08:33 2015 +0200
x86: rework paging_log_dirty_op to work with hvm guests
When the caller of paging_log_dirty_op is a hvm guest Xen would choke when trying to copy the dirty bitmap to the guest because the paging lock is already held.
Fix this by independently mapping each page of the guest bitmap as needed without the paging lock held.
commit acc0899ef41e763c665c542beca6809049fac11c
Author: Roger Pau Monné <[email protected]> Date: Fri May 15 10:07:50 2015 +0200
x86/hap: make hap_track_dirty_vram use non-contiguous memory for temporary map
Just like it's done for shadow_track_dirty_vram allocate the temporary buffer using non-contiguous memory.
commit bd1b4a71b325933a08099676515a7cc8235d7144
Author: Roger Pau Monné <[email protected]> Date: Fri May 15 10:07:20 2015 +0200
x86/shadow: fix shadow_track_dirty_vram to work on hvm guests
Modify shadow_track_dirty_vram to use a local buffer and then flush to the guest without the paging_lock held. This is modeled after hap_track_dirty_vram.
commit f278fcf19ce15f7b7ee69181560b5884a5e12b66
Author: Roger Pau Monné <[email protected]> Date: Fri May 15 10:06:04 2015 +0200
introduce a helper to allocate non-contiguous memory
The allocator uses independent calls to alloc_domheap_pages in order to get the desired amount of memory and then maps all the independent physical addresses into a contiguous virtual address space.
commit e62e49e6d5d4e8d22f3df0b75443ede65a812435
Author: David Vrabel <[email protected]> Date: Fri May 15 09:52:25 2015 +0200
x86,arm: remove asm/spinlock.h from all architectures
Now that all architecture use a common ticket lock implementation for spinlocks, remove the architecture specific byte lock implementations.
commit 45fcc4568c5162b00fb3907fb158af82dd484a3d
Author: David Vrabel <[email protected]> Date: Fri May 15 09:49:12 2015 +0200
use ticket locks for spin locks
Replace the byte locks with ticket locks. Ticket locks are: a) fair; and b) peform better when contented since they spin without an atomic operation.
The lock is split into two ticket values: head and tail. A locker acquires a ticket by (atomically) increasing tail and using the previous tail value. A CPU holds the lock if its ticket == head. The lock is released by increasing head.
spin_lock_irq() and spin_lock_irqsave() now spin with irqs disabled (previously, they would spin with irqs enabled if possible). This is required to prevent deadlocks when the irq handler tries to take the same lock with a higher ticket.
Architectures need only provide arch_fetch_and_add() and two barriers:
arch_lock_acquire_barrier() and arch_lock_release_barrier().
(qemu changes not included)
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
El 16/05/15 a les 10.51, osstest service user ha escrit:
Quoted 4 lines
flight 56456 xen-unstable real [real]
http://logs.test-lab.xenproject.org/osstest/logs/56456/Regressions :-(
This is my fault, paging_gva_to_gfn cannot be used to translate a PV guest VA to a GFN. The patch above restores the previous path for PV callers.
---
commit 4cfaf46cbb116ce8dd0124bbbea319489db4b068
Author: Roger Pau Monne <[email protected]> Date: Sat May 16 13:42:39 2015 +0200
x86: restore PV path on paging_log_dirty_op
Restore previous path for PV domains calling paging_log_dirty_op. This fixes the fallout from a809eeea06d20b115d78f12e473502bcb6209844.
xen/arch/x86/mm/paging.c +44 -18
@@ -416,6 +416,7 @@ static inline void *map_dirty_bitmap(XEN_GUEST_HANDLE_64(uint8) dirty_bitmap,unsigned long gfn;p2m_type_t p2mt; +ASSERT (paging_mode_enabled (current->domain)); gfn =paging_gva_to_gfn (current, (unsigned long )(dirty_bitmap.p + (pages >>3 )), &pfec);
@@ -446,6 +447,7 @@ static inline void *map_dirty_bitmap(XEN_GUEST_HANDLE_64(uint8) dirty_bitmap,static inline void unmap_dirty_bitmap (void *addr,struct page_info *page) { +ASSERT (paging_mode_enabled (current->domain));if ( addr !=NULL ) {unmap_domain_page (addr);
@@ -465,9 +467,9 @@ static int paging_log_dirty_op(struct domain *d,mfn_t *l4 =NULL , *l3 =NULL , *l2 =NULL ;unsigned long *l1 =NULL ;int i4, i3, i2; -uint8_t *dirty_bitmap; -struct page_info *page; -unsigned long index_mapped; +uint8_t *dirty_bitmap =NULL ; +struct page_info *page =NULL ; +unsigned long index_mapped =0 ; again:if ( !resuming )
@@ -482,12 +484,15 @@ static int paging_log_dirty_op(struct domain *d,p2m_flush_hardware_cached_dirty (d); } - index_mapped = resuming ? d->arch.paging.preempt.log_dirty.done :0 ; - dirty_bitmap =map_dirty_bitmap (sc->dirty_bitmap, index_mapped, &page); -if ( dirty_bitmap ==NULL ) +if (paging_mode_enabled (current->domain) ) { -domain_unpause (d); -return -EFAULT ; + index_mapped = resuming ? d->arch.paging.preempt.log_dirty.done :0 ; + dirty_bitmap =map_dirty_bitmap (sc->dirty_bitmap, index_mapped, &page); +if ( dirty_bitmap ==NULL ) + { +domain_unpause (d); +return -EFAULT ; + } }paging_lock (d);
@@ -549,7 +554,8 @@ static int paging_log_dirty_op(struct domain *d, bytes = (unsigned int )((sc->pages - pages +7 ) >>3 );if (likely (peek) ) { -if ( pages >> (3 +PAGE_SHIFT ) != +if (paging_mode_enabled (current->domain) && + pages >> (3 +PAGE_SHIFT ) != index_mapped >> (3 +PAGE_SHIFT ) ) {/* We need to map next page */
@@ -564,13 +570,30 @@ static int paging_log_dirty_op(struct domain *d,unmap_dirty_bitmap (dirty_bitmap, page); goto again; } -ASSERT (((pages >>3 ) %PAGE_SIZE ) + bytes <=PAGE_SIZE ); -if ( l1 ) -memcpy (dirty_bitmap + ((pages >>3 ) %PAGE_SIZE ), l1, - bytes); + +if (paging_mode_enabled (current->domain) ) + { +ASSERT (((pages >>3 ) %PAGE_SIZE ) + bytes <=PAGE_SIZE ); +if ( l1 ) +memcpy (dirty_bitmap + ((pages >>3 ) %PAGE_SIZE ), + l1, bytes); +else +memset (dirty_bitmap + ((pages >>3 ) %PAGE_SIZE ), +0 , bytes); + }else -memset (dirty_bitmap + ((pages >>3 ) %PAGE_SIZE ),0 , - bytes); + { +if ( (l1 ?copy_to_guest_offset (sc->dirty_bitmap, + pages >>3 , + (uint8_t *)l1, + bytes) + :clear_guest_offset (sc->dirty_bitmap, + pages >>3 , bytes)) !=0 ) + { + rv = -EFAULT ; + goto out; + } + } } pages += bytes <<3 ;if ( l1 )
@@ -630,7 +653,8 @@ static int paging_log_dirty_op(struct domain *d,if ( rv ) {/* Never leave the domain paused on real errors. */ -unmap_dirty_bitmap (dirty_bitmap, page); +if (paging_mode_enabled (current->domain) ) +unmap_dirty_bitmap (dirty_bitmap, page);ASSERT (rv == -ERESTART );return rv; }
@@ -643,14 +667,16 @@ static int paging_log_dirty_op(struct domain *d,* paging modes (shadow or hap). Safe because the domain is paused. */ d->arch.paging.log_dirty.clean_dirty_bitmap (d); } -unmap_dirty_bitmap (dirty_bitmap, page); +if (paging_mode_enabled (current->domain) ) +unmap_dirty_bitmap (dirty_bitmap, page);domain_unpause (d);return rv; out: d->arch.paging.preempt.dom =NULL ;paging_unlock (d); -unmap_dirty_bitmap (dirty_bitmap, page); +if (paging_mode_enabled (current->domain) ) +unmap_dirty_bitmap (dirty_bitmap, page);domain_unpause (d);if ( l1 )
Quoted 10 lines
Quoted 1 line
Quoted 1 line · On 16.05.15 at 13:45, <[email protected]> wrote:
El 16/05/15 a les 10.51, osstest service user ha escrit:
Quoted 4 lines
flight 56456 xen-unstable real [real]
http://logs.test-lab.xenproject.org/osstest/logs/56456/Regressions :-(
This is my fault,
paging_gva_to_gfncannot be used to translate a PV guest VA to a GFN. The patch above restores the previous path for PV callers.
While Tim would have the final say, I certainly would prefer to revert the offending patch and then apply a correct new version in its stead in this case (where the fix is not a simple, few lines change).
Jan
Quoted 139 lines
---
commit4cfaf46cbb116ce8dd0124bbbea319489db4b068Author: Roger Pau Monne <[email protected]> Date: Sat May 16 13:42:39 2015 +0200x86: restore PV path on
paging_log_dirty_opRestore previous path for PV domains calling
paging_log_dirty_op. This
fixes
the fallout froma809eeea06d20b115d78f12e473502bcb6209844.Signed-off-by Roger Pau Monné <[email protected]>xen/arch/x86/mm/paging.c +1
-0@@ -416,6 +416,7 @@ static inline void *map_dirty_bitmap(XEN_GUEST_HANDLE_64(uint8) dirty_bitmap, unsigned long gfn; p2m_type_t p2mt; + ASSERT(paging_mode_enabled(current->domain)); gfn = paging_gva_to_gfn(current, (unsigned long)(dirty_bitmap.p + (pages >> 3)),&pfec);xen/arch/x86/mm/paging.c +1
-0@@ -446,6 +447,7 @@ static inline void *map_dirty_bitmap(XEN_GUEST_HANDLE_64(uint8) dirty_bitmap, static inline void unmap_dirty_bitmap(void *addr, struct page_info *page) { + ASSERT(paging_mode_enabled(current->domain)); if ( addr != NULL ) {unmap_domain_page(addr);xen/arch/x86/mm/paging.c +11
-8@@ -465,9 +467,9 @@ static int paging_log_dirty_op(struct domain *d,mfn_t *l4 =NULL , *l3 =NULL , *l2 =NULL ;unsigned long *l1 =NULL ;int i4, i3, i2; -uint8_t *dirty_bitmap; -struct page_info *page; -unsigned long index_mapped; +uint8_t *dirty_bitmap =NULL ; +struct page_info *page =NULL ; +unsigned long index_mapped =0 ; again:if ( !resuming )@@ -482,12 +484,15 @@ static int paging_log_dirty_op(struct domain *d,p2m_flush_hardware_cached_dirty (d); } - index_mapped = resuming ? d->arch.paging.preempt.log_dirty.done :0 ; - dirty_bitmap =map_dirty_bitmap (sc->dirty_bitmap, index_mapped, &page); -if ( dirty_bitmap ==NULL ) +if (paging_mode_enabled (current->domain) ) { -domain_unpause (d); -return -EFAULT ; + index_mapped = resuming ? d->arch.paging.preempt.log_dirty.done :0 ; + dirty_bitmap =map_dirty_bitmap (sc->dirty_bitmap, index_mapped, &page); +if ( dirty_bitmap ==NULL ) + { +domain_unpause (d); +return -EFAULT ; + } }paging_lock(d);xen/arch/x86/mm/paging.c +25
-7@@ -549,7 +554,8 @@ static int paging_log_dirty_op(struct domain *d, bytes = (unsigned int )((sc->pages - pages +7 ) >>3 );if (likely (peek) ) { -if ( pages >> (3 +PAGE_SHIFT ) != +if (paging_mode_enabled (current->domain) && + pages >> (3 +PAGE_SHIFT ) != index_mapped >> (3 +PAGE_SHIFT ) ) {/* We need to map next page */ @@ -564,13 +570,30 @@ static int paging_log_dirty_op(struct domain *d,unmap_dirty_bitmap (dirty_bitmap, page); goto again; } -ASSERT (((pages >>3 ) %PAGE_SIZE ) + bytes <=PAGE_SIZE ); -if ( l1 ) -memcpy (dirty_bitmap + ((pages >>3 ) %PAGE_SIZE ), l1, - bytes); + +if (paging_mode_enabled (current->domain) ) + { +ASSERT (((pages >>3 ) %PAGE_SIZE ) + bytes <=PAGE_SIZE ); +if ( l1 ) +memcpy (dirty_bitmap + ((pages >>3 ) %PAGE_SIZE ), + l1, bytes); +else +memset (dirty_bitmap + ((pages >>3 ) %PAGE_SIZE ), +0 , bytes); + }else - memset(dirty_bitmap + ((pages >> 3) % PAGE_SIZE), 0, -bytes ); + { +if ( (l1 ?copy_to_guest_offset (sc->dirty_bitmap, + pages >>3 , + (uint8_t *)l1, + bytes) + :clear_guest_offset (sc->dirty_bitmap, + pages >>3 , bytes)) !=0 ) + { + rv = -EFAULT ; + goto out; + } + } }pages += bytes << 3; if ( l1 )xen/arch/x86/mm/paging.c +2
-1@@ -630,7 +653,8 @@ static int paging_log_dirty_op(struct domain *d,if ( rv ) {/* Never leave the domain paused on real errors. */ -unmap_dirty_bitmap (dirty_bitmap, page); +if (paging_mode_enabled (current->domain) ) +unmap_dirty_bitmap (dirty_bitmap, page);ASSERT (rv == -ERESTART );return rv; }@@ -643,14 +667,16 @@ static int paging_log_dirty_op(struct domain *d,* paging modes (shadow or hap). Safe because the domain is paused. */
d->arch.paging.log_dirty.clean_dirty_bitmap(d); }xen/arch/x86/mm/paging.c +2
-1-unmap_dirty_bitmap (dirty_bitmap, page); +if (paging_mode_enabled (current->domain) ) +unmap_dirty_bitmap (dirty_bitmap, page);domain_unpause (d);return rv;
xen/arch/x86/mm/paging.c static int paging_log_dirty_op(struct domain *d, · line 682
Quoted 10 lines
xen/arch/x86/mm/paging.c +2
-1out: d->arch.paging.preempt.dom =NULL ;paging_unlock (d); -unmap_dirty_bitmap (dirty_bitmap, page); +if (paging_mode_enabled (current->domain) ) +unmap_dirty_bitmap (dirty_bitmap, page);domain_unpause (d);if ( l1 )
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
Quoted 7 lines · Jan Beulich
Quoted 7 lines
Quoted 1 line
Quoted 1 line · On 16.05.15 at 13:45, <[email protected]> wrote:
El 16/05/15 a les 10.51, osstest service user ha escrit:
Quoted 4 lines
flight 56456 xen-unstable real [real]
http://logs.test-lab.xenproject.org/osstest/logs/56456/Regressions :-(
Quoted 7 lines
Quoted 3 lines
This is my fault,
paging_gva_to_gfncannot be used to translate a PV guest VA to a GFN. The patch above restores the previous path for PV callers.While Tim would have the final say, I certainly would prefer to revert the offending patch and then apply a correct new version in its stead in this case (where the fix is not a simple, few lines change).
I would be OK with a follow-up fix here, but I'm not convinced that this is it.
In particular, paging_mode_enabled() should be true for any PV domain that's in log-dirty mode, so presumably the failure is only for lgd ops on VMs that don't have lgd enabled. So maybe we can either:
- return an error for that case (but we'd want to understand how we got there first); or
- have map_dirty_bitmap() DTRT, with something like access_ok() + a linear-pagetable lookup to find the frame.
In any case, this is a regression so we should revert while we figure it out.
Tim.
Quoted 151 lines
Quoted 149 lines
---
commit4cfaf46cbb116ce8dd0124bbbea319489db4b068Author: Roger Pau Monne <[email protected]> Date: Sat May 16 13:42:39 2015 +0200x86: restore PV path on
paging_log_dirty_opRestore previous path for PV domains calling
paging_log_dirty_op. This
fixes
the fallout froma809eeea06d20b115d78f12e473502bcb6209844.Signed-off-by Roger Pau Monné <[email protected]>xen/arch/x86/mm/paging.c +1
-0@@ -416,6 +416,7 @@ static inline void *map_dirty_bitmap(XEN_GUEST_HANDLE_64(uint8) dirty_bitmap, unsigned long gfn; p2m_type_t p2mt; + ASSERT(paging_mode_enabled(current->domain)); gfn = paging_gva_to_gfn(current, (unsigned long)(dirty_bitmap.p + (pages >> 3)),&pfec);xen/arch/x86/mm/paging.c +1
-0@@ -446,6 +447,7 @@ static inline void *map_dirty_bitmap(XEN_GUEST_HANDLE_64(uint8) dirty_bitmap, static inline void unmap_dirty_bitmap(void *addr, struct page_info *page) { + ASSERT(paging_mode_enabled(current->domain)); if ( addr != NULL ) {unmap_domain_page(addr);xen/arch/x86/mm/paging.c +11
-8@@ -465,9 +467,9 @@ static int paging_log_dirty_op(struct domain *d,mfn_t *l4 =NULL , *l3 =NULL , *l2 =NULL ;unsigned long *l1 =NULL ;int i4, i3, i2; -uint8_t *dirty_bitmap; -struct page_info *page; -unsigned long index_mapped; +uint8_t *dirty_bitmap =NULL ; +struct page_info *page =NULL ; +unsigned long index_mapped =0 ; again:if ( !resuming )@@ -482,12 +484,15 @@ static int paging_log_dirty_op(struct domain *d,p2m_flush_hardware_cached_dirty (d); } - index_mapped = resuming ? d->arch.paging.preempt.log_dirty.done :0 ; - dirty_bitmap =map_dirty_bitmap (sc->dirty_bitmap, index_mapped, &page); -if ( dirty_bitmap ==NULL ) +if (paging_mode_enabled (current->domain) ) { -domain_unpause (d); -return -EFAULT ; + index_mapped = resuming ? d->arch.paging.preempt.log_dirty.done :0 ; + dirty_bitmap =map_dirty_bitmap (sc->dirty_bitmap, index_mapped, &page); +if ( dirty_bitmap ==NULL ) + { +domain_unpause (d); +return -EFAULT ; + } }paging_lock(d);xen/arch/x86/mm/paging.c +25
-7@@ -549,7 +554,8 @@ static int paging_log_dirty_op(struct domain *d, bytes = (unsigned int )((sc->pages - pages +7 ) >>3 );if (likely (peek) ) { -if ( pages >> (3 +PAGE_SHIFT ) != +if (paging_mode_enabled (current->domain) && + pages >> (3 +PAGE_SHIFT ) != index_mapped >> (3 +PAGE_SHIFT ) ) {/* We need to map next page */ @@ -564,13 +570,30 @@ static int paging_log_dirty_op(struct domain *d,unmap_dirty_bitmap (dirty_bitmap, page); goto again; } -ASSERT (((pages >>3 ) %PAGE_SIZE ) + bytes <=PAGE_SIZE ); -if ( l1 ) -memcpy (dirty_bitmap + ((pages >>3 ) %PAGE_SIZE ), l1, - bytes); + +if (paging_mode_enabled (current->domain) ) + { +ASSERT (((pages >>3 ) %PAGE_SIZE ) + bytes <=PAGE_SIZE ); +if ( l1 ) +memcpy (dirty_bitmap + ((pages >>3 ) %PAGE_SIZE ), + l1, bytes); +else +memset (dirty_bitmap + ((pages >>3 ) %PAGE_SIZE ), +0 , bytes); + }else - memset(dirty_bitmap + ((pages >> 3) % PAGE_SIZE), 0, -bytes ); + { +if ( (l1 ?copy_to_guest_offset (sc->dirty_bitmap, + pages >>3 , + (uint8_t *)l1, + bytes) + :clear_guest_offset (sc->dirty_bitmap, + pages >>3 , bytes)) !=0 ) + { + rv = -EFAULT ; + goto out; + } + } }pages += bytes << 3; if ( l1 )xen/arch/x86/mm/paging.c +2
-1@@ -630,7 +653,8 @@ static int paging_log_dirty_op(struct domain *d,if ( rv ) {/* Never leave the domain paused on real errors. */ -unmap_dirty_bitmap (dirty_bitmap, page); +if (paging_mode_enabled (current->domain) ) +unmap_dirty_bitmap (dirty_bitmap, page);ASSERT (rv == -ERESTART );return rv; }@@ -643,14 +667,16 @@ static int paging_log_dirty_op(struct domain *d,* paging modes (shadow or hap). Safe because the domain is paused. */
d->arch.paging.log_dirty.clean_dirty_bitmap(d); }xen/arch/x86/mm/paging.c +4
-2-unmap_dirty_bitmap (dirty_bitmap, page); +if (paging_mode_enabled (current->domain) ) +unmap_dirty_bitmap (dirty_bitmap, page);domain_unpause (d);return rv; out: d->arch.paging.preempt.dom =NULL ;paging_unlock (d); -unmap_dirty_bitmap (dirty_bitmap, page); +if (paging_mode_enabled (current->domain) ) +unmap_dirty_bitmap (dirty_bitmap, page);domain_unpause (d);if ( l1 )
El 18/05/15 a les 12.17, Tim Deegan ha escrit:
Quoted 16 lines
Quoted 7 lines · Jan Beulich
Quoted 7 lines
Quoted 1 line
Quoted 1 line · On 16.05.15 at 13:45, <[email protected]> wrote:
El 16/05/15 a les 10.51, osstest service user ha escrit:
Quoted 4 lines
flight 56456 xen-unstable real [real]
http://logs.test-lab.xenproject.org/osstest/logs/56456/Regressions :-(
Quoted 7 lines
Quoted 3 lines
This is my fault,
paging_gva_to_gfncannot be used to translate a PV guest VA to a GFN. The patch above restores the previous path for PV callers.While Tim would have the final say, I certainly would prefer to revert the offending patch and then apply a correct new version in its stead in this case (where the fix is not a simple, few lines change).
Quoted 8 lines
I would be OK with a follow-up fix here, but I'm not convinced that this is it.
In particular,
paging_mode_enabled()should be true for any PV domain that's in log-dirty mode, so presumably the failure is only for lgd ops on VMs that don't have lgd enabled. So maybe we can either:
- return an error for that case (but we'd want to understand how we got there first); or
The error is caused because we are trying to use paging_gva_to_gfn against a Dom0 VA, which is a PV guest.
gva_to_gfn is set to sh_gva_to_gfn for a PV Dom0, but calling vtlb_lookup against a PV guest crashes Xen because the paging structures are not populated.
Quoted 2 lines
- have
map_dirty_bitmap()DTRT, with something likeaccess_ok()+ a linear-pagetable lookup to find the frame.
That was my first intention, but AFAICT we have no function in tree to resolve a PV guest VA into a GFN/MFN. The closest thing I could find was using guest_walk_tables + guest_walk_to_gfn in order to obtain the gfn. Should I send a patch to introduce a pv_gva_to_gfn function based on that?
Thanks, Roger.
Quoted 9 lines
Quoted 1 line
Quoted 1 line · On 18.05.15 at 12:50, <[email protected]> wrote:
El 18/05/15 a les 12.17, Tim Deegan ha escrit:
Quoted 2 lines
- have
map_dirty_bitmap()DTRT, with something likeaccess_ok()+ a linear-pagetable lookup to find the frame.That was my first intention, but AFAICT we have no function in tree to resolve a PV guest VA into a GFN/MFN. The closest thing I could find was using
guest_walk_tables+guest_walk_to_gfnin order to obtain the gfn. Should I send a patch to introduce apv_gva_to_gfnfunction based on that?
Isn't that what we have the linear page table and guest_map_l1e() for?
Jan
Quoted 5 lines · Jan Beulich
Quoted 5 lines
Quoted 1 line
Quoted 1 line · On 18.05.15 at 12:50, <[email protected]> wrote:
El 18/05/15 a les 12.17, Tim Deegan ha escrit:
Quoted 2 lines
- have
map_dirty_bitmap()DTRT, with something likeaccess_ok()+ a linear-pagetable lookup to find the frame.
Quoted 7 lines
Quoted 4 lines
That was my first intention, but AFAICT we have no function in tree to resolve a PV guest VA into a GFN/MFN. The closest thing I could find was using
guest_walk_tables+guest_walk_to_gfnin order to obtain the gfn. Should I send a patch to introduce apv_gva_to_gfnfunction based on that?Isn't that what we have the linear page table and
guest_map_l1e()for?
Yes, or in this case guest_get_eff_l1e(). We'd want to make sure we get_page() the underlying page as well to guard against it being freed and reused while we have a mapping.
That won't check user/supervisor or write permissions in the upper levels of the tree. OTOH, __copy_to_user() doesn't either, so maybe we don't care. Jan, if you're happy with that then so am I.
Cheers,
Tim.
Quoted 15 lines
Quoted 1 line
Quoted 1 line · On 19.05.15 at 12:20, <[email protected]> wrote:
Quoted 5 lines · Jan Beulich
Quoted 5 lines
Quoted 1 line
Quoted 1 line · On 18.05.15 at 12:50, <[email protected]> wrote:
El 18/05/15 a les 12.17, Tim Deegan ha escrit:
Quoted 2 lines
- have
map_dirty_bitmap()DTRT, with something likeaccess_ok()+ a linear-pagetable lookup to find the frame.Quoted 7 lines
Quoted 4 lines
That was my first intention, but AFAICT we have no function in tree to resolve a PV guest VA into a GFN/MFN. The closest thing I could find was using
guest_walk_tables+guest_walk_to_gfnin order to obtain the gfn. Should I send a patch to introduce apv_gva_to_gfnfunction based on that?Isn't that what we have the linear page table and
guest_map_l1e()for?
Quoted 7 lines
Yes, or in this case
guest_get_eff_l1e(). We'd want to make sure weget_page()the underlying page as well to guard against it being freed and reused while we have a mapping.That won't check user/supervisor or write permissions in the upper levels of the tree. OTOH,
__copy_to_user()doesn't either, so maybe we don't care.
Hmm, permissions are being checked by __copy_to_user() afaict (due to us using the actual page tables), so that being bypassed here would seem wrong then.
Jan
El 19/05/15 a les 12.29, Jan Beulich ha escrit:
Quoted 19 lines
Quoted 19 lines
Quoted 1 line
Quoted 1 line · On 19.05.15 at 12:20, <[email protected]> wrote:
Quoted 5 lines · Jan Beulich
Quoted 5 lines
Quoted 1 line
Quoted 1 line · On 18.05.15 at 12:50, <[email protected]> wrote:
El 18/05/15 a les 12.17, Tim Deegan ha escrit:
Quoted 2 lines
- have
map_dirty_bitmap()DTRT, with something likeaccess_ok()+ a linear-pagetable lookup to find the frame.Quoted 7 lines
Quoted 4 lines
That was my first intention, but AFAICT we have no function in tree to resolve a PV guest VA into a GFN/MFN. The closest thing I could find was using
guest_walk_tables+guest_walk_to_gfnin order to obtain the gfn. Should I send a patch to introduce apv_gva_to_gfnfunction based on that?Isn't that what we have the linear page table and
guest_map_l1e()for?Yes, or in this case
guest_get_eff_l1e(). We'd want to make sure weget_page()the underlying page as well to guard against it being freed and reused while we have a mapping.
Quoted 7 lines
Quoted 3 lines
That won't check user/supervisor or write permissions in the upper levels of the tree. OTOH,
__copy_to_user()doesn't either, so maybe we don't care.Hmm, permissions are being checked by
__copy_to_user()afaict (due to us using the actual page tables), so that being bypassed here would seem wrong then.
The only way I see to check for permissions of all levels is to use guest_walk_tables instead of guest_get_eff_l1e, but that's going to make this quite slow (as compared to the previous implementation).
Roger.
El 19/05/15 a les 17.07, Roger Pau Monné ha escrit:
Quoted 24 lines
El 19/05/15 a les 12.29, Jan Beulich ha escrit:
Quoted 23 lines
Quoted 22 lines
Quoted 1 line
Quoted 1 line · On 19.05.15 at 12:20, <[email protected]> wrote:
Quoted 5 lines · Jan Beulich
Quoted 5 lines
Quoted 1 line
Quoted 1 line · On 18.05.15 at 12:50, <[email protected]> wrote:
El 18/05/15 a les 12.17, Tim Deegan ha escrit:
Quoted 2 lines
- have
map_dirty_bitmap()DTRT, with something likeaccess_ok()+ a linear-pagetable lookup to find the frame.Quoted 7 lines
Quoted 4 lines
That was my first intention, but AFAICT we have no function in tree to resolve a PV guest VA into a GFN/MFN. The closest thing I could find was using
guest_walk_tables+guest_walk_to_gfnin order to obtain the gfn. Should I send a patch to introduce apv_gva_to_gfnfunction based on that?Isn't that what we have the linear page table and
guest_map_l1e()for?Yes, or in this case
guest_get_eff_l1e(). We'd want to make sure weget_page()the underlying page as well to guard against it being freed and reused while we have a mapping.That won't check user/supervisor or write permissions in the upper levels of the tree. OTOH,
__copy_to_user()doesn't either, so maybe we don't care.
Quoted 7 lines
Quoted 3 lines
Hmm, permissions are being checked by
__copy_to_user()afaict (due to us using the actual page tables), so that being bypassed here would seem wrong then.The only way I see to check for permissions of all levels is to use
guest_walk_tablesinstead ofguest_get_eff_l1e, but that's going to make this quite slow (as compared to the previous implementation).
After looking into this a little bit more, I'm afraid I don't see a straight forward way to check for the permissions of all paging levels. Here are the options I've found in order to deal with this:
- Use guest_get_eff_l1e and only check for the permissions of the L1 entry. Is it possible that the guest places an invalid entry in the linear l1 table without Xen realizing?
- Add a new function hook somewhere (pv_domain maybe?) that can be used to translate GVA to PFN for PV guests (mimicking what paging_gva_to_gfn does). This would be implemented using guest_walk_X_level, where X is the paging levels of the guest.
- Use some glue to be able to call guest_walk_{3/4}_level from paging.c directly, and correctly choose which one to use based on the guest bitness. IMHO this looks quite wacky, and I'm not even sure if it's possible given the amount of preprocessor foo in guest_pt.h.
I have the first option already implemented, but I would appreciate some advice regarding the security implications of it.
Thanks, Roger.
Quoted 8 lines
Quoted 1 line
Quoted 1 line · On 20.05.15 at 10:58, <[email protected]> wrote:
After looking into this a little bit more, I'm afraid I don't see a straight forward way to check for the permissions of all paging levels. Here are the options I've found in order to deal with this:
- Use
guest_get_eff_l1eand only check for the permissions of the L1 entry. Is it possible that the guest places an invalid entry in the linear l1 table without Xen realizing?
No - all page table changes are being validated by Xen.
Quoted 5 lines
- Add a new function hook somewhere (
pv_domainmaybe?) that can be used to translate GVA to PFN for PV guests (mimicking whatpaging_gva_to_gfndoes). This would be implemented usingguest_walk_X_level, where X is the paging levels of the guest.
Quoted 8 lines
- Use some glue to be able to call guest_walk_{3/4}_level from
paging.cdirectly, and correctly choose which one to use based on the guest bitness. IMHO this looks quite wacky, and I'm not even sure if it's possible given the amount of preprocessor foo inguest_pt.h.I have the first option already implemented, but I would appreciate some advice regarding the security implications of it.
I think with all of the options here being unsatisfactory we should reconsider your original option of restoring previous behavior (without any mapping) for the PV case. Tim?
Jan
Quoted 10 lines · Jan Beulich
Quoted 8 lines
Quoted 1 line
Quoted 1 line · On 20.05.15 at 10:58, <[email protected]> wrote:
After looking into this a little bit more, I'm afraid I don't see a straight forward way to check for the permissions of all paging levels. Here are the options I've found in order to deal with this:
- Use
guest_get_eff_l1eand only check for the permissions of the L1 entry. Is it possible that the guest places an invalid entry in the linear l1 table without Xen realizing?No - all page table changes are being validated by Xen.
Yes, using guest_get_eff_l1e() is safe for Xen. The only concern is whether it's safe for the guest -- Xen might not honour an upper-level read-only mark (which copy_to_guest() would) or a supervisor-mode-only mark (which it wouldn't).
Quoted 11 lines
Quoted 11 lines
- Add a new function hook somewhere (
pv_domainmaybe?) that can be used to translate GVA to PFN for PV guests (mimicking whatpaging_gva_to_gfndoes). This would be implemented usingguest_walk_X_level, where X is the paging levels of the guest.- Use some glue to be able to call guest_walk_{3/4}_level from
paging.cdirectly, and correctly choose which one to use based on the guest bitness. IMHO this looks quite wacky, and I'm not even sure if it's possible given the amount of preprocessor foo inguest_pt.h.
Quoted 6 lines
Quoted 2 lines
I have the first option already implemented, but I would appreciate some advice regarding the security implications of it.
I think with all of the options here being unsatisfactory we should reconsider your original option of restoring previous behavior (without any mapping) for the PV case. Tim?
Yeah, I don't think it's worth adding a bunch mode pagetable-walk machinery just to keep this function clean. So I suppose we have to have two paths. in this code.
Cheers,
Tim.
El 20/05/15 a les 11.43, Tim Deegan ha escrit:
Quoted 31 lines
Quoted 10 lines · Jan Beulich
Quoted 8 lines
Quoted 1 line
Quoted 1 line · On 20.05.15 at 10:58, <[email protected]> wrote:
After looking into this a little bit more, I'm afraid I don't see a straight forward way to check for the permissions of all paging levels. Here are the options I've found in order to deal with this:
- Use
guest_get_eff_l1eand only check for the permissions of the L1 entry. Is it possible that the guest places an invalid entry in the linear l1 table without Xen realizing?No - all page table changes are being validated by Xen.
Yes, using
guest_get_eff_l1e()is safe for Xen. The only concern is whether it's safe for the guest -- Xen might not honour an upper-level read-only mark (whichcopy_to_guest()would) or a supervisor-mode-only mark (which it wouldn't).Quoted 14 lines
Quoted 13 lines
- Add a new function hook somewhere (
pv_domainmaybe?) that can be used to translate GVA to PFN for PV guests (mimicking whatpaging_gva_to_gfndoes). This would be implemented usingguest_walk_X_level, where X is the paging levels of the guest.- Use some glue to be able to call guest_walk_{3/4}_level from
paging.cdirectly, and correctly choose which one to use based on the guest bitness. IMHO this looks quite wacky, and I'm not even sure if it's possible given the amount of preprocessor foo inguest_pt.h.I have the first option already implemented, but I would appreciate some advice regarding the security implications of it.
Quoted 7 lines
Quoted 3 lines
I think with all of the options here being unsatisfactory we should reconsider your original option of restoring previous behavior (without any mapping) for the PV case. Tim?
Yeah, I don't think it's worth adding a bunch mode pagetable-walk machinery just to keep this function clean. So I suppose we have to have two paths. in this code.
FWIW there's also the option of taking the callers p2m lock if it's a HVM guest:
http://lists.xen.org/archives/html/xen-devel/2014-10/msg01769.html
And avoid doing any modifications of the code paths.
Roger.
Quoted 20 lines · Roger Pau Monné
El 18/05/15 a les 12.17, Tim Deegan ha escrit:
Quoted 19 lines
Quoted 7 lines · Jan Beulich
Quoted 7 lines
Quoted 1 line
Quoted 1 line · On 16.05.15 at 13:45, <[email protected]> wrote:
El 16/05/15 a les 10.51, osstest service user ha escrit:
Quoted 4 lines
flight 56456 xen-unstable real [real]
http://logs.test-lab.xenproject.org/osstest/logs/56456/Regressions :-(
Quoted 7 lines
Quoted 3 lines
This is my fault,
paging_gva_to_gfncannot be used to translate a PV guest VA to a GFN. The patch above restores the previous path for PV callers.While Tim would have the final say, I certainly would prefer to revert the offending patch and then apply a correct new version in its stead in this case (where the fix is not a simple, few lines change).
I would be OK with a follow-up fix here, but I'm not convinced that this is it.
Quoted 8 lines
Quoted 5 lines
In particular,
paging_mode_enabled()should be true for any PV domain that's in log-dirty mode, so presumably the failure is only for lgd ops on VMs that don't have lgd enabled. So maybe we can either:
- return an error for that case (but we'd want to understand how we got there first); orThe error is caused because we are trying to use
paging_gva_to_gfnagainst a Dom0 VA, which is a PV guest.
Oh right; I had got confused.
Quoted 7 lines
Quoted 2 lines
- have
map_dirty_bitmap()DTRT, with something likeaccess_ok()+ a linear-pagetable lookup to find the frame.That was my first intention, but AFAICT we have no function in tree to resolve a PV guest VA into a GFN/MFN. The closest thing I could find was using
guest_walk_tables+guest_walk_to_gfnin order to obtain the gfn. Should I send a patch to introduce apv_gva_to_gfnfunction based on that?
PV guest addresses need a bit more care: we need to at least call access_ok() on them to make sure we're not going to write to a Xen address. For the translation itself, we could use guest_walk_tables(), though I wouldn't be surprised if that only works on paging_mode_enabled() guests too. Worth a try though. Otherwise, guest_get_eff_l1e() will get the gfn but doesn't include a check for write permissions, so might introduce an in-guest issue.
Tim.
Quoted 28 lines
Quoted 1 line
Quoted 1 line · On 18.05.15 at 12:17, <[email protected]> wrote:
Quoted 7 lines · Jan Beulich
Quoted 7 lines
Quoted 1 line
Quoted 1 line · On 16.05.15 at 13:45, <[email protected]> wrote:
El 16/05/15 a les 10.51, osstest service user ha escrit:
Quoted 4 lines
flight 56456 xen-unstable real [real]
http://logs.test-lab.xenproject.org/osstest/logs/56456/Regressions :-(
Quoted 7 lines
Quoted 3 lines
This is my fault,
paging_gva_to_gfncannot be used to translate a PV guest VA to a GFN. The patch above restores the previous path for PV callers.While Tim would have the final say, I certainly would prefer to revert the offending patch and then apply a correct new version in its stead in this case (where the fix is not a simple, few lines change).
I would be OK with a follow-up fix here, but I'm not convinced that this is it.
In particular,
paging_mode_enabled()should be true for any PV domain that's in log-dirty mode, so presumably the failure is only for lgd ops on VMs that don't have lgd enabled. So maybe we can either:
- return an error for that case (but we'd want to understand how we got there first); or
- havemap_dirty_bitmap()DTRT, with something likeaccess_ok()+ a linear-pagetable lookup to find the frame.
Quoted 2 lines
In any case, this is a regression so we should revert while we figure it out.
Done.
Jan