summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTakao Indoh <indou.takao@jp.fujitsu.com>2014-06-05 14:10:54 +0900
committerSimon Horman <horms@verge.net.au>2014-06-05 18:07:06 +0900
commit08484c97ecce7df2ded8079c6478a58262007acc (patch)
tree0e5779d15ad8dd2a222edf572736c2805477a679
parent0c41d96cbed0ae895fd7da425f755a8684558e1c (diff)
downloadkexec-tools-08484c97ecce7df2ded8079c6478a58262007acc.tar.gz
Enumerate all /sys/devices/system/cpu/cpuN when they are discontiguous
There is a case that the number of /sys/devices/system/cpu/cpuN is not contiguous, for example after cpu hot removing. This patch fixes so that all /sys/devices/system/cpu/cpuN is handled when they are discontiguous. Signed-off-by: Takao Indoh <indou.takao@jp.fujitsu.com> Reviewed-by: Zhang Yanfei <zhangyanfei@cn.fujitsu.com> Acked-by: WANG Chao <chaowang@redhat.com> Signed-off-by: Simon Horman <horms@verge.net.au>
-rw-r--r--kexec/crashdump-elf.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/kexec/crashdump-elf.c b/kexec/crashdump-elf.c
index 2baa357..c869347 100644
--- a/kexec/crashdump-elf.c
+++ b/kexec/crashdump-elf.c
@@ -41,6 +41,7 @@ int FUNC(struct kexec_info *info,
uint64_t vmcoreinfo_addr, vmcoreinfo_len;
int has_vmcoreinfo = 0;
int (*get_note_info)(int cpu, uint64_t *addr, uint64_t *len);
+ long int count_cpu;
if (xen_present())
nr_cpus = xen_get_nr_phys_cpus();
@@ -138,11 +139,13 @@ int FUNC(struct kexec_info *info,
/* PT_NOTE program headers. One per cpu */
- for (i = 0; i < nr_cpus; i++) {
+ count_cpu = nr_cpus;
+ for (i = 0; count_cpu > 0; i++) {
if (get_note_info(i, &notes_addr, &notes_len) < 0) {
/* This cpu is not present. Skip it. */
continue;
}
+ count_cpu--;
phdr = (PHDR *) bufp;
bufp += sizeof(PHDR);