diff options
author | Zbigniew Bodek <zbb@FreeBSD.org> | 2015-09-16 23:46:20 +0000 |
---|---|---|
committer | Zbigniew Bodek <zbb@FreeBSD.org> | 2015-09-16 23:46:20 +0000 |
commit | dbf66ac207a61f9f4a99c186a3d5e1389034d6b1 (patch) | |
tree | 561f238474e257b2724ca65016ee752173fbba17 /sys/arm64/arm64/mp_machdep.c | |
parent | 18c72666ce583eac1f0ad106766249648696b022 (diff) | |
download | src-dbf66ac207a61f9f4a99c186a3d5e1389034d6b1.tar.gz src-dbf66ac207a61f9f4a99c186a3d5e1389034d6b1.zip |
Release memory for CPUs that fail to init on ARM64
cpu_init_fdt will now release memory allocated for structures
serving CPUs that have failed to init.
Obtained from: Semihalf
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D3297
Notes
Notes:
svn path=/head/; revision=287883
Diffstat (limited to 'sys/arm64/arm64/mp_machdep.c')
-rw-r--r-- | sys/arm64/arm64/mp_machdep.c | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/sys/arm64/arm64/mp_machdep.c b/sys/arm64/arm64/mp_machdep.c index b95b2ed0789c..379198cf8681 100644 --- a/sys/arm64/arm64/mp_machdep.c +++ b/sys/arm64/arm64/mp_machdep.c @@ -352,7 +352,6 @@ cpu_init_fdt(u_int id, phandle_t node, u_int addr_size, pcell_t *reg) if (id == 0) return (1); - CPU_SET(id, &all_cpus); pcpup = &__pcpu[id]; pcpu_init(pcpup, id, sizeof(struct pcpu)); @@ -371,8 +370,17 @@ cpu_init_fdt(u_int id, phandle_t node, u_int addr_size, pcell_t *reg) pa = pmap_extract(kernel_pmap, (vm_offset_t)mpentry); err = psci_cpu_on(target_cpu, pa, id); - if (err != PSCI_RETVAL_SUCCESS) - printf("Failed to start CPU %u\n", id); + if (err != PSCI_RETVAL_SUCCESS) { + /* Panic here if INVARIANTS are enabled */ + KASSERT(0, ("Failed to start CPU %u (%lx)\n", id, target_cpu)); + + pcpu_destroy(pcpup); + kmem_free(kernel_arena, (vm_offset_t)dpcpu[id - 1], DPCPU_SIZE); + dpcpu[id - 1] = NULL; + /* Notify the user that the CPU failed to start */ + printf("Failed to start CPU %u (%lx)\n", id, target_cpu); + } else + CPU_SET(id, &all_cpus); return (1); } |