ia64/xen-unstable

changeset 4922:c5eb6fb70b8a

bitkeeper revision 1.1411 (42884f321efBfAPblIV0mrlYL-DYpA)

[PATCH] [PATCH] SMP coredump fix

# This is a BitKeeper generated diff -Nru style patch.
#
# ChangeSet
# 2005/05/15 18:03:44-07:00 kmacy@octopus.eng.netapp.com
# Fix SMP coredumps
# Signed-off-by: Kip Macy <kmacy@netapp.com>
#
# BitKeeper/etc/logging_ok
# 2005/05/15 18:03:43-07:00 kmacy@octopus.eng.netapp.com +1 -0
# Logging to logging@openlogging.org accepted
#
# tools/libxc/xc_core.c
# 2005/05/15 18:03:21-07:00 kmacy@octopus.eng.netapp.com +11 -7
# handle discontiguous CPUs correctly
# make offsets in core header correct for MP case
#
author kmacy@netapp.com[kaf24]
date Mon May 16 07:43:46 2005 +0000 (2005-05-16)
parents 64f9e006da57
children a789d0f55020
files tools/libxc/xc_core.c
line diff
     1.1 --- a/tools/libxc/xc_core.c	Sun May 15 05:29:01 2005 +0000
     1.2 +++ b/tools/libxc/xc_core.c	Mon May 16 07:43:46 2005 +0000
     1.3 @@ -32,7 +32,7 @@ xc_domain_dumpcore(int xc_handle,
     1.4  	unsigned long nr_pages;
     1.5  	unsigned long *page_array;
     1.6  	xc_dominfo_t info;
     1.7 -	int i, dump_fd;
     1.8 +	int i, j, vcpu_map_size, dump_fd;
     1.9  	char *dump_mem, *dump_mem_start = NULL;
    1.10  	struct xc_core_header header;
    1.11  	vcpu_guest_context_t     ctxt[MAX_VIRT_CPUS];
    1.12 @@ -53,14 +53,17 @@ xc_domain_dumpcore(int xc_handle,
    1.13  		goto error_out;
    1.14  	}
    1.15  	
    1.16 -	for (i = 0; i < sizeof(info.vcpu_to_cpu) / sizeof(info.vcpu_to_cpu[0]);
    1.17 -	     i++) {
    1.18 -		if (info.vcpu_to_cpu[i] == -1)
    1.19 +	vcpu_map_size =  sizeof(info.vcpu_to_cpu) / sizeof(info.vcpu_to_cpu[0]);
    1.20 +
    1.21 +	for (i = 0, j = 0; i < vcpu_map_size; i++) {
    1.22 +		if (info.vcpu_to_cpu[i] == -1) {
    1.23  			continue;
    1.24 -		if (xc_domain_get_vcpu_context(xc_handle, domid, i, &ctxt[i])) {
    1.25 +		}
    1.26 +		if (xc_domain_get_vcpu_context(xc_handle, domid, i, &ctxt[j])) {
    1.27  			PERROR("Could not get all vcpu contexts for domain");
    1.28  			goto error_out;
    1.29  		}
    1.30 +		j++;
    1.31  	}
    1.32  	
    1.33  	nr_pages = info.nr_pages;
    1.34 @@ -70,9 +73,10 @@ xc_domain_dumpcore(int xc_handle,
    1.35  	header.xch_nr_pages = nr_pages;
    1.36  	header.xch_ctxt_offset = sizeof(struct xc_core_header);
    1.37  	header.xch_index_offset = sizeof(struct xc_core_header) +
    1.38 -	    sizeof(vcpu_guest_context_t);
    1.39 +	    sizeof(vcpu_guest_context_t)*info.vcpus;
    1.40  	header.xch_pages_offset = round_pgup(sizeof(struct xc_core_header) +
    1.41 -	    sizeof(vcpu_guest_context_t) + nr_pages * sizeof(unsigned long));
    1.42 +	    (sizeof(vcpu_guest_context_t) * info.vcpus) + 
    1.43 +	    (nr_pages * sizeof(unsigned long)));
    1.44  
    1.45  	write(dump_fd, &header, sizeof(struct xc_core_header));
    1.46  	write(dump_fd, &ctxt, sizeof(ctxt[0]) * info.vcpus);