[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-changelog] [xen-unstable] Minor clean ups to shadow logdirty peek / clean.
# HG changeset patch # User Steven Hand <steven@xxxxxxxxxxxxx> # Date 1167402303 0 # Node ID 25723963a6b639a0651b961c40808be63cb2c27b # Parent a8b2738a6f7ff22022e0b49e14c3142409f8681a Minor clean ups to shadow logdirty peek / clean. Signed-off-by: Steven Hand <steven@xxxxxxxxxxxxx> --- xen/arch/x86/mm/shadow/common.c | 52 ++++++++++++++++++++++------------------ 1 files changed, 29 insertions(+), 23 deletions(-) diff -r a8b2738a6f7f -r 25723963a6b6 xen/arch/x86/mm/shadow/common.c --- a/xen/arch/x86/mm/shadow/common.c Fri Dec 29 14:12:55 2006 +0000 +++ b/xen/arch/x86/mm/shadow/common.c Fri Dec 29 14:25:03 2006 +0000 @@ -3123,7 +3123,7 @@ static int shadow_log_dirty_op( static int shadow_log_dirty_op( struct domain *d, struct xen_domctl_shadow_op *sc) { - int i, rv = 0, clean = 0; + int i, rv = 0, clean = 0, peek = 1; domain_pause(d); shadow_lock(d); @@ -3137,12 +3137,12 @@ static int shadow_log_dirty_op( d->arch.shadow.dirty_count); sc->stats.fault_count = d->arch.shadow.fault_count; - sc->stats.dirty_count = d->arch.shadow.dirty_count; - - if ( clean ) - { - /* Need to revoke write access to the domain's pages again. - * In future, we'll have a less heavy-handed approach to this, + sc->stats.dirty_count = d->arch.shadow.dirty_count; + + if ( clean ) + { + /* Need to revoke write access to the domain's pages again. + * In future, we'll have a less heavy-handed approach to this, * but for now, we just unshadow everything except Xen. */ shadow_blow_tables(d); @@ -3150,31 +3150,37 @@ static int shadow_log_dirty_op( d->arch.shadow.dirty_count = 0; } - if ( guest_handle_is_null(sc->dirty_bitmap) || - (d->arch.shadow.dirty_bitmap == NULL) ) - { - rv = -EINVAL; + if ( guest_handle_is_null(sc->dirty_bitmap) ) + /* caller may have wanted just to clean the state or access stats. */ + peek = 0; + + if ( (peek || clean) && (d->arch.shadow.dirty_bitmap == NULL) ) + { + rv = -EINVAL; /* perhaps should be ENOMEM? */ goto out; } if ( sc->pages > d->arch.shadow.dirty_bitmap_size ) - sc->pages = d->arch.shadow.dirty_bitmap_size; + sc->pages = d->arch.shadow.dirty_bitmap_size; #define CHUNK (8*1024) /* Transfer and clear in 1kB chunks for L1 cache. */ for ( i = 0; i < sc->pages; i += CHUNK ) { - int bytes = ((((sc->pages - i) > CHUNK) - ? CHUNK + int bytes = ((((sc->pages - i) > CHUNK) + ? CHUNK : (sc->pages - i)) + 7) / 8; - - if ( copy_to_guest_offset( - sc->dirty_bitmap, - i/(8*sizeof(unsigned long)), - d->arch.shadow.dirty_bitmap + (i/(8*sizeof(unsigned long))), - (bytes + sizeof(unsigned long) - 1) / sizeof(unsigned long)) ) - { - rv = -EINVAL; - goto out; + + if ( likely(peek) ) + { + if ( copy_to_guest_offset( + sc->dirty_bitmap, + i/(8*sizeof(unsigned long)), + d->arch.shadow.dirty_bitmap+(i/(8*sizeof(unsigned long))), + (bytes+sizeof(unsigned long)-1) / sizeof(unsigned long)) ) + { + rv = -EFAULT; + goto out; + } } if ( clean ) _______________________________________________ Xen-changelog mailing list Xen-changelog@xxxxxxxxxxxxxxxxxxx http://lists.xensource.com/xen-changelog
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |