WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-devel

[Xen-devel] [PATCH] SMP coredump fix

To: xen-devel@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-devel] [PATCH] SMP coredump fix
From: Kip Macy <kmacy@xxxxxxxxxx>
Date: Sun, 15 May 2005 18:07:13 -0700 (PDT)
Delivery-date: Mon, 16 May 2005 01:06:48 +0000
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-devel-request@lists.xensource.com?subject=help>
List-id: Xen developer discussion <xen-devel.lists.xensource.com>
List-post: <mailto:xen-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
# This is a BitKeeper generated diff -Nru style patch.
#
# ChangeSet
#   2005/05/15 18:03:44-07:00 kmacy@xxxxxxxxxxxxxxxxxxxxxx 
#   Fix SMP coredumps
#   Signed-off-by: Kip Macy <kmacy@xxxxxxxxxx>
# 
# BitKeeper/etc/logging_ok
#   2005/05/15 18:03:43-07:00 kmacy@xxxxxxxxxxxxxxxxxxxxxx +1 -0
#   Logging to logging@xxxxxxxxxxxxxxx accepted
# 
# tools/libxc/xc_core.c
#   2005/05/15 18:03:21-07:00 kmacy@xxxxxxxxxxxxxxxxxxxxxx +11 -7
#   handle discontiguous CPUs correctly
#   make offsets in core header correct for MP case
# 
diff -Nru a/tools/libxc/xc_core.c b/tools/libxc/xc_core.c
--- a/tools/libxc/xc_core.c     2005-05-14 18:09:46 -07:00
+++ b/tools/libxc/xc_core.c     2005-05-14 18:09:46 -07:00
@@ -32,7 +32,7 @@
        unsigned long nr_pages;
        unsigned long *page_array;
        xc_dominfo_t info;
-       int i, dump_fd;
+       int i, j, vcpu_map_size, dump_fd;
        char *dump_mem, *dump_mem_start = NULL;
        struct xc_core_header header;
        vcpu_guest_context_t     ctxt[MAX_VIRT_CPUS];
@@ -53,14 +53,17 @@
                goto error_out;
        }
        
-       for (i = 0; i < sizeof(info.vcpu_to_cpu) / sizeof(info.vcpu_to_cpu[0]);
-            i++) {
-               if (info.vcpu_to_cpu[i] == -1)
+       vcpu_map_size =  sizeof(info.vcpu_to_cpu) / sizeof(info.vcpu_to_cpu[0]);
+
+       for (i = 0, j = 0; i < vcpu_map_size; i++) {
+               if (info.vcpu_to_cpu[i] == -1) {
                        continue;
-               if (xc_domain_get_vcpu_context(xc_handle, domid, i, &ctxt[i])) {
+               }
+               if (xc_domain_get_vcpu_context(xc_handle, domid, i, &ctxt[j])) {
                        PERROR("Could not get all vcpu contexts for domain");
                        goto error_out;
                }
+               j++;
        }
        
        nr_pages = info.nr_pages;
@@ -70,9 +73,10 @@
        header.xch_nr_pages = nr_pages;
        header.xch_ctxt_offset = sizeof(struct xc_core_header);
        header.xch_index_offset = sizeof(struct xc_core_header) +
-           sizeof(vcpu_guest_context_t);
+           sizeof(vcpu_guest_context_t)*info.vcpus;
        header.xch_pages_offset = round_pgup(sizeof(struct xc_core_header) +
-           sizeof(vcpu_guest_context_t) + nr_pages * sizeof(unsigned long));
+           (sizeof(vcpu_guest_context_t) * info.vcpus) + 
+           (nr_pages * sizeof(unsigned long)));
 
        write(dump_fd, &header, sizeof(struct xc_core_header));
        write(dump_fd, &ctxt, sizeof(ctxt[0]) * info.vcpus);

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel

<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-devel] [PATCH] SMP coredump fix, Kip Macy <=