diff mbox series

percpu: Make pcpu_setup_first_chunk() void function

Message ID 20190703082552.69951-1-wangkefeng.wang@huawei.com (mailing list archive)
State New, archived
Headers show
Series percpu: Make pcpu_setup_first_chunk() void function | expand

Commit Message

Kefeng Wang July 3, 2019, 8:25 a.m. UTC
pcpu_setup_first_chunk() will panic or BUG_ON if the are some
error and doesn't return any error, hence it can be defined to
return void.

Signed-off-by: Kefeng Wang <wangkefeng.wang@huawei.com>
---
 arch/ia64/mm/contig.c    |  5 +----
 arch/ia64/mm/discontig.c |  5 +----
 include/linux/percpu.h   |  2 +-
 mm/percpu.c              | 17 ++++++-----------
 4 files changed, 9 insertions(+), 20 deletions(-)

Comments

Dennis Zhou July 4, 2019, 4:20 a.m. UTC | #1
On Wed, Jul 03, 2019 at 04:25:52PM +0800, Kefeng Wang wrote:
> pcpu_setup_first_chunk() will panic or BUG_ON if the are some
> error and doesn't return any error, hence it can be defined to
> return void.
> 
> Signed-off-by: Kefeng Wang <wangkefeng.wang@huawei.com>
> ---
>  arch/ia64/mm/contig.c    |  5 +----
>  arch/ia64/mm/discontig.c |  5 +----
>  include/linux/percpu.h   |  2 +-
>  mm/percpu.c              | 17 ++++++-----------
>  4 files changed, 9 insertions(+), 20 deletions(-)
> 
> diff --git a/arch/ia64/mm/contig.c b/arch/ia64/mm/contig.c
> index d29fb6b9fa33..db09a693f094 100644
> --- a/arch/ia64/mm/contig.c
> +++ b/arch/ia64/mm/contig.c
> @@ -134,10 +134,7 @@ setup_per_cpu_areas(void)
>  	ai->atom_size		= page_size;
>  	ai->alloc_size		= percpu_page_size;
>  
> -	rc = pcpu_setup_first_chunk(ai, __per_cpu_start + __per_cpu_offset[0]);
> -	if (rc)
> -		panic("failed to setup percpu area (err=%d)", rc);
> -
> +	pcpu_setup_first_chunk(ai, __per_cpu_start + __per_cpu_offset[0]);
>  	pcpu_free_alloc_info(ai);
>  }
>  #else
> diff --git a/arch/ia64/mm/discontig.c b/arch/ia64/mm/discontig.c
> index 05490dd073e6..004dee231874 100644
> --- a/arch/ia64/mm/discontig.c
> +++ b/arch/ia64/mm/discontig.c
> @@ -245,10 +245,7 @@ void __init setup_per_cpu_areas(void)
>  		gi->cpu_map		= &cpu_map[unit];
>  	}
>  
> -	rc = pcpu_setup_first_chunk(ai, base);
> -	if (rc)
> -		panic("failed to setup percpu area (err=%d)", rc);
> -
> +	pcpu_setup_first_chunk(ai, base);
>  	pcpu_free_alloc_info(ai);
>  }
>  #endif
> diff --git a/include/linux/percpu.h b/include/linux/percpu.h
> index 9909dc0e273a..5e76af742c80 100644
> --- a/include/linux/percpu.h
> +++ b/include/linux/percpu.h
> @@ -105,7 +105,7 @@ extern struct pcpu_alloc_info * __init pcpu_alloc_alloc_info(int nr_groups,
>  							     int nr_units);
>  extern void __init pcpu_free_alloc_info(struct pcpu_alloc_info *ai);
>  
> -extern int __init pcpu_setup_first_chunk(const struct pcpu_alloc_info *ai,
> +extern void __init pcpu_setup_first_chunk(const struct pcpu_alloc_info *ai,
>  					 void *base_addr);
>  
>  #ifdef config_need_per_cpu_embed_first_chunk
> diff --git a/mm/percpu.c b/mm/percpu.c
> index 9821241fdede..ad32c3d11ca7 100644
> --- a/mm/percpu.c
> +++ b/mm/percpu.c
> @@ -2267,12 +2267,9 @@ static void pcpu_dump_alloc_info(const char *lvl,
>   * share the same vm, but use offset regions in the area allocation map.
>   * the chunk serving the dynamic region is circulated in the chunk slots
>   * and available for dynamic allocation like any other chunk.
> - *
> - * returns:
> - * 0 on success, -errno on failure.
>   */
> -int __init pcpu_setup_first_chunk(const struct pcpu_alloc_info *ai,
> -				  void *base_addr)
> +void __init pcpu_setup_first_chunk(const struct pcpu_alloc_info *ai,
> +				   void *base_addr)
>  {
>  	size_t size_sum = ai->static_size + ai->reserved_size + ai->dyn_size;
>  	size_t static_size, dyn_size;
> @@ -2457,7 +2454,6 @@ int __init pcpu_setup_first_chunk(const struct pcpu_alloc_info *ai,
>  
>  	/* we're done */
>  	pcpu_base_addr = base_addr;
> -	return 0;
>  }
>  
>  #ifdef config_smp
> @@ -2710,7 +2706,7 @@ int __init pcpu_embed_first_chunk(size_t reserved_size, size_t dyn_size,
>  	struct pcpu_alloc_info *ai;
>  	size_t size_sum, areas_size;
>  	unsigned long max_distance;
> -	int group, i, highest_group, rc;
> +	int group, i, highest_group, rc = 0;
>  
>  	ai = pcpu_build_alloc_info(reserved_size, dyn_size, atom_size,
>  				   cpu_distance_fn);
> @@ -2795,7 +2791,7 @@ int __init pcpu_embed_first_chunk(size_t reserved_size, size_t dyn_size,
>  		pfn_down(size_sum), ai->static_size, ai->reserved_size,
>  		ai->dyn_size, ai->unit_size);
>  
> -	rc = pcpu_setup_first_chunk(ai, base);
> +	pcpu_setup_first_chunk(ai, base);
>  	goto out_free;
>  
>  out_free_areas:
> @@ -2920,7 +2916,7 @@ int __init pcpu_page_first_chunk(size_t reserved_size,
>  		unit_pages, psize_str, ai->static_size,
>  		ai->reserved_size, ai->dyn_size);
>  
> -	rc = pcpu_setup_first_chunk(ai, vm.addr);
> +	pcpu_setup_first_chunk(ai, vm.addr);
>  	goto out_free_ar;
>  
>  enomem:
> @@ -3014,8 +3010,7 @@ void __init setup_per_cpu_areas(void)
>  	ai->groups[0].nr_units = 1;
>  	ai->groups[0].cpu_map[0] = 0;
>  
> -	if (pcpu_setup_first_chunk(ai, fc) < 0)
> -		panic("failed to initialize percpu areas.");
> +	pcpu_setup_first_chunk(ai, fc);
>  	pcpu_free_alloc_info(ai);
>  }
>  
> -- 
> 2.20.1
> 

Hi Kefeng,

This makes sense to me. I've applied this to for-5.4.

Thanks,
Dennis
Kefeng Wang July 4, 2019, 7:05 a.m. UTC | #2
On 2019/7/4 12:20, Dennis Zhou wrote:
> On Wed, Jul 03, 2019 at 04:25:52PM +0800, Kefeng Wang wrote:
>> pcpu_setup_first_chunk() will panic or BUG_ON if the are some
>> error and doesn't return any error, hence it can be defined to
>> return void.
>>
>> Signed-off-by: Kefeng Wang <wangkefeng.wang@huawei.com>
>> ---
...
>>
> 
> Hi Kefeng,
> 
> This makes sense to me. I've applied this to for-5.4.

Hi Dennis and all,

There is an issue when with percpu_alloc=page + KASAN.

The system boot successfully with defconfig when using percpu_alloc=embed(default configuration),
but when enabled KASAN(CONFIG_KASAN=y/CONFIG_KASAN_GENERIC=y/CONFIG_KASAN_OUTLINE=y), it triggers
"PANIC: double fault, error_code: 0x0", and I try some different kernel version, eg, 4.14/4.19/5.0,
all of them won't boot, I can't find any clue, could you or anyone provide some advice, thanks.

Here is log,

Booting the kernel.
[    0.000000] Linux version 5.2.0-rc7+ (root@ubuntu) (gcc version 7.4.0 (Ubuntu 7.4.0-1ubuntu1~18.04.1)) #10 SMP Thu Jul 4 11:58:45 HKT 2019
[    0.000000] Command line: kmemleak=off console=ttyS0 root=/dev/sda  earlyprintk=serial  percpu_alloc=page
[    0.000000] x86/fpu: x87 FPU will use FXSAVE
[    0.000000] BIOS-provided physical RAM map:
[    0.000000] BIOS-e820: [mem 0x0000000000000000-0x000000000009fbff] usable
[    0.000000] BIOS-e820: [mem 0x000000000009fc00-0x000000000009ffff] reserved
[    0.000000] BIOS-e820: [mem 0x00000000000f0000-0x00000000000fffff] reserved
[    0.000000] BIOS-e820: [mem 0x0000000000100000-0x00000000bffdefff] usable
[    0.000000] BIOS-e820: [mem 0x00000000bffdf000-0x00000000bfffffff] reserved
[    0.000000] BIOS-e820: [mem 0x00000000feffc000-0x00000000feffffff] reserved
[    0.000000] BIOS-e820: [mem 0x00000000fffc0000-0x00000000ffffffff] reserved
[    0.000000] BIOS-e820: [mem 0x0000000100000000-0x000000043fffffff] usable
[    0.000000] printk: bootconsole [earlyser0] enabled
[    0.000000] NX (Execute Disable) protection: active
[    0.000000] SMBIOS 2.8 present.
[    0.000000] DMI: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.10.2-1ubuntu1 04/01/2014
[    0.000000] last_pfn = 0x440000 max_arch_pfn = 0x400000000
[    0.000000] x86/PAT: PAT not supported by CPU.
[    0.000000] x86/PAT: Configuration [0-7]: WB  WT  UC- UC  WB  WT  UC- UC
[    0.000000] last_pfn = 0xbffdf max_arch_pfn = 0x400000000
[    0.000000] found SMP MP-table at [mem 0x000f6a10-0x000f6a1f]
[    0.000000] check: Scanning 1 areas for low memory corruption
[    0.000000] ACPI: Early table checksum verification disabled
[    0.000000] ACPI: RSDP 0x00000000000F69C0 000014 (v00 BOCHS )
[    0.000000] ACPI: RSDT 0x00000000BFFE169F 000034 (v01 BOCHS  BXPCRSDT 00000001 BXPC 00000001)
[    0.000000] ACPI: FACP 0x00000000BFFE1323 000074 (v01 BOCHS  BXPCFACP 00000001 BXPC 00000001)
[    0.000000] ACPI: DSDT 0x00000000BFFDFC80 0016A3 (v01 BOCHS  BXPCDSDT 00000001 BXPC 00000001)
[    0.000000] ACPI: FACS 0x00000000BFFDFC40 000040
[    0.000000] ACPI: APIC 0x00000000BFFE1417 0000B0 (v01 BOCHS  BXPCAPIC 00000001 BXPC 00000001)
[    0.000000] ACPI: HPET 0x00000000BFFE14C7 000038 (v01 BOCHS  BXPCHPET 00000001 BXPC 00000001)
[    0.000000] ACPI: SRAT 0x00000000BFFE14FF 0001A0 (v01 BOCHS  BXPCSRAT 00000001 BXPC 00000001)
[    0.000000] SRAT: PXM 0 -> APIC 0x00 -> Node 0
[    0.000000] SRAT: PXM 0 -> APIC 0x01 -> Node 0
[    0.000000] SRAT: PXM 1 -> APIC 0x02 -> Node 1
[    0.000000] SRAT: PXM 1 -> APIC 0x03 -> Node 1
[    0.000000] SRAT: PXM 2 -> APIC 0x04 -> Node 2
[    0.000000] SRAT: PXM 2 -> APIC 0x05 -> Node 2
[    0.000000] SRAT: PXM 3 -> APIC 0x06 -> Node 3
[    0.000000] SRAT: PXM 3 -> APIC 0x07 -> Node 3
[    0.000000] ACPI: SRAT: Node 0 PXM 0 [mem 0x00000000-0x0009ffff]
[    0.000000] ACPI: SRAT: Node 0 PXM 0 [mem 0x00100000-0xbfffffff]
[    0.000000] ACPI: SRAT: Node 0 PXM 0 [mem 0x100000000-0x13fffffff]
[    0.000000] ACPI: SRAT: Node 1 PXM 1 [mem 0x140000000-0x23fffffff]
[    0.000000] ACPI: SRAT: Node 2 PXM 2 [mem 0x240000000-0x33fffffff]
[    0.000000] ACPI: SRAT: Node 3 PXM 3 [mem 0x340000000-0x43fffffff]
[    0.000000] NUMA: Node 0 [mem 0x00000000-0x0009ffff] + [mem 0x00100000-0xbfffffff] -> [mem 0x00000000-0xbfffffff]
[    0.000000] NUMA: Node 0 [mem 0x00000000-0xbfffffff] + [mem 0x100000000-0x13fffffff] -> [mem 0x00000000-0x13fffffff]
[    0.000000] NODE_DATA(0) allocated [mem 0x13fffc000-0x13fffffff]
[    0.000000] NODE_DATA(1) allocated [mem 0x23fffc000-0x23fffffff]
[    0.000000] NODE_DATA(2) allocated [mem 0x33fffc000-0x33fffffff]
[    0.000000] NODE_DATA(3) allocated [mem 0x43fff5000-0x43fff8fff]
[    0.000000] Zone ranges:
[    0.000000]   DMA      [mem 0x0000000000001000-0x0000000000ffffff]
[    0.000000]   DMA32    [mem 0x0000000001000000-0x00000000ffffffff]
[    0.000000]   Normal   [mem 0x0000000100000000-0x000000043fffffff]
[    0.000000] Movable zone start for each node
[    0.000000] Early memory node ranges
[    0.000000]   node   0: [mem 0x0000000000001000-0x000000000009efff]
[    0.000000]   node   0: [mem 0x0000000000100000-0x00000000bffdefff]
[    0.000000]   node   0: [mem 0x0000000100000000-0x000000013fffffff]
[    0.000000]   node   1: [mem 0x0000000140000000-0x000000023fffffff]
[    0.000000]   node   2: [mem 0x0000000240000000-0x000000033fffffff]
[    0.000000]   node   3: [mem 0x0000000340000000-0x000000043fffffff]
[    0.000000] Zeroed struct page in unavailable ranges: 131 pages
[    0.000000] Initmem setup node 0 [mem 0x0000000000001000-0x000000013fffffff]
[    0.000000] Initmem setup node 1 [mem 0x0000000140000000-0x000000023fffffff]
[    0.000000] Initmem setup node 2 [mem 0x0000000240000000-0x000000033fffffff]
[    0.000000] Initmem setup node 3 [mem 0x0000000340000000-0x000000043fffffff]
[    0.000000] kasan: KernelAddressSanitizer initialized
[    0.000000] ACPI: PM-Timer IO Port: 0x608
[    0.000000] ACPI: LAPIC_NMI (acpi_id[0xff] dfl dfl lint[0x1])
[    0.000000] IOAPIC[0]: apic_id 0, version 17, address 0xfec00000, GSI 0-23
[    0.000000] ACPI: INT_SRC_OVR (bus 0 bus_irq 0 global_irq 2 dfl dfl)
[    0.000000] ACPI: INT_SRC_OVR (bus 0 bus_irq 5 global_irq 5 high level)
[    0.000000] ACPI: INT_SRC_OVR (bus 0 bus_irq 9 global_irq 9 high level)
[    0.000000] ACPI: INT_SRC_OVR (bus 0 bus_irq 10 global_irq 10 high level)
[    0.000000] ACPI: INT_SRC_OVR (bus 0 bus_irq 11 global_irq 11 high level)
[    0.000000] Using ACPI (MADT) for SMP configuration information
[    0.000000] ACPI: HPET id: 0x8086a201 base: 0xfed00000
[    0.000000] smpboot: Allowing 8 CPUs, 0 hotplug CPUs
[    0.000000] PM: Registered nosave memory: [mem 0x00000000-0x00000fff]
[    0.000000] PM: Registered nosave memory: [mem 0x0009f000-0x0009ffff]
[    0.000000] PM: Registered nosave memory: [mem 0x000a0000-0x000effff]
[    0.000000] PM: Registered nosave memory: [mem 0x000f0000-0x000fffff]
[    0.000000] PM: Registered nosave memory: [mem 0xbffdf000-0xbfffffff]
[    0.000000] PM: Registered nosave memory: [mem 0xc0000000-0xfeffbfff]
[    0.000000] PM: Registered nosave memory: [mem 0xfeffc000-0xfeffffff]
[    0.000000] PM: Registered nosave memory: [mem 0xff000000-0xfffbffff]
[    0.000000] PM: Registered nosave memory: [mem 0xfffc0000-0xffffffff]
[    0.000000] [mem 0xc0000000-0xfeffbfff] available for PCI devices
[    0.000000] clocksource: refined-jiffies: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 1910969940391419 ns
[    0.000000] setup_percpu: NR_CPUS:64 nr_cpumask_bits:64 nr_cpu_ids:8 nr_node_ids:4
[    0.000000] percpu: 56 4K pages/cpu s208152 r8192 d13032
[    0.000000] Built 4 zonelists, mobility grouping on.  Total pages: 4128616
[    0.000000] Policy zone: Normal
[    0.000000] Kernel command line: kmemleak=off console=ttyS0 root=/dev/sda  earlyprintk=serial  percpu_alloc=page
[    0.000000] Memory: 14289792K/16776692K available (20484K kernel code, 5398K rwdata, 5824K rodata, 1620K init, 9432K bss, 2486900K reserved, 0K cma-reserved)
[    0.000000] SLUB: HWalign=64, Order=0-3, MinObjects=0, CPUs=8, Nodes=4
[    0.000000] Kernel/User page tables isolation: enabled
[    0.000000] rcu: Hierarchical RCU implementation.
[    0.000000] rcu: 	RCU event tracing is enabled.
[    0.000000] rcu: 	RCU restricting CPUs from NR_CPUS=64 to nr_cpu_ids=8.
[    0.000000] rcu: RCU calculated value of scheduler-enlistment delay is 100 jiffies.
[    0.000000] rcu: Adjusting geometry for rcu_fanout_leaf=16, nr_cpu_ids=8
[    0.000000] NR_IRQS: 4352, nr_irqs: 488, preallocated irqs: 16
[    0.000000] random: get_random_bytes called from start_kernel+0x322/0x595 with crng_init=0
[    0.000000] Console: colour VGA+ 80x25
[    0.000000] printk: console [ttyS0] enabled
[    0.000000] printk: console [ttyS0] enabled
[    0.000000] printk: bootconsole [earlyser0] disabled
[    0.000000] printk: bootconsole [earlyser0] disabled
[    0.000000] ACPI: Core revision 20190509
[    0.000000] clocksource: hpet: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 19112604467 ns
[    0.000000] PANIC: double fault, error_code: 0x0
[    0.000000] CPU: 0 PID: 0 Comm: swapper/0 Not tainted 5.2.0-rc7+ #10
[    0.000000] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.10.2-1ubuntu1 04/01/2014
[    0.000000] RIP: 0010:no_context+0x33/0x6f0
[    0.000000] Code: 00 00 fc ff df 41 55 41 54 4c 8d bf 88 00 00 00 55 53 48 89 fd 4c 89 ff 49 89 f4 49 89 d6 48 81 ec 50 01 00 00 48 8d 5c 24 30 <89> 0c 24 44 89 44 24 08 48 c7 44 24 30 b3 8a b5 41 48 c7 44 24 38
[    0.000000] RSP: 0000:ffffc8ffffffff50 EFLAGS: 00010086
[    0.000000] RAX: dffffc0000000000 RBX: ffffc8ffffffff80 RCX: 000000000000000b
[    0.000000] RDX: fffff52000000036 RSI: 0000000000000003 RDI: ffffc90000000160
[    0.000000] RBP: ffffc900000000d8 R08: 0000000000000001 R09: 0000000000000000
[    0.000000] R10: 0000000000000000 R11: 0000000000000000 R12: 0000000000000003
[    0.000000] R13: 0000000000000000 R14: fffff52000000036 R15: ffffc90000000160
[    0.000000] FS:  0000000000000000(0000) GS:ffffc90000000000(0000) knlGS:0000000000000000
[    0.000000] CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
[    0.000000] CR2: ffffc8ffffffff48 CR3: 000000042580e000 CR4: 00000000000006b0
[    0.000000] Call Trace:
[    0.000000] Kernel panic - not syncing: Machine halted.
[    0.000000] CPU: 0 PID: 0 Comm: swapper/0 Not tainted 5.2.0-rc7+ #10
[    0.000000] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.10.2-1ubuntu1 04/01/2014
[    0.000000] Call Trace:
[    0.000000]  <#DF>
[    0.000000]  dump_stack+0x5b/0x8b
[    0.000000]  panic+0x183/0x384
[    0.000000]  ? refcount_error_report+0x11c/0x11c
[    0.000000]  df_debug+0x29/0x30
[    0.000000]  do_double_fault+0xb6/0x160
[    0.000000]  double_fault+0x1e/0x30
[    0.000000] RIP: 0010:no_context+0x33/0x6f0
[    0.000000] Code: 00 00 fc ff df 41 55 41 54 4c 8d bf 88 00 00 00 55 53 48 89 fd 4c 89 ff 49 89 f4 49 89 d6 48 81 ec 50 01 00 00 48 8d 5c 24 30 <89> 0c 24 44 89 44 24 08 48 c7 44 24 30 b3 8a b5 41 48 c7 44 24 38
[    0.000000] RSP: 0000:ffffc8ffffffff50 EFLAGS: 00010086
[    0.000000] RAX: dffffc0000000000 RBX: ffffc8ffffffff80 RCX: 000000000000000b
[    0.000000] RDX: fffff52000000036 RSI: 0000000000000003 RDI: ffffc90000000160
[    0.000000] RBP: ffffc900000000d8 R08: 0000000000000001 R09: 0000000000000000
[    0.000000] R10: 0000000000000000 R11: 0000000000000000 R12: 0000000000000003
[    0.000000] R13: 0000000000000000 R14: fffff52000000036 R15: ffffc90000000160
[    0.000000]  </#DF>
[    0.000000] ---[ end Kernel panic - not syncing: Machine halted. ]---




> 
> Thanks,
> Dennis
> 
> .
>
diff mbox series

Patch

diff --git a/arch/ia64/mm/contig.c b/arch/ia64/mm/contig.c
index d29fb6b9fa33..db09a693f094 100644
--- a/arch/ia64/mm/contig.c
+++ b/arch/ia64/mm/contig.c
@@ -134,10 +134,7 @@  setup_per_cpu_areas(void)
 	ai->atom_size		= PAGE_SIZE;
 	ai->alloc_size		= PERCPU_PAGE_SIZE;
 
-	rc = pcpu_setup_first_chunk(ai, __per_cpu_start + __per_cpu_offset[0]);
-	if (rc)
-		panic("failed to setup percpu area (err=%d)", rc);
-
+	pcpu_setup_first_chunk(ai, __per_cpu_start + __per_cpu_offset[0]);
 	pcpu_free_alloc_info(ai);
 }
 #else
diff --git a/arch/ia64/mm/discontig.c b/arch/ia64/mm/discontig.c
index 05490dd073e6..004dee231874 100644
--- a/arch/ia64/mm/discontig.c
+++ b/arch/ia64/mm/discontig.c
@@ -245,10 +245,7 @@  void __init setup_per_cpu_areas(void)
 		gi->cpu_map		= &cpu_map[unit];
 	}
 
-	rc = pcpu_setup_first_chunk(ai, base);
-	if (rc)
-		panic("failed to setup percpu area (err=%d)", rc);
-
+	pcpu_setup_first_chunk(ai, base);
 	pcpu_free_alloc_info(ai);
 }
 #endif
diff --git a/include/linux/percpu.h b/include/linux/percpu.h
index 9909dc0e273a..5e76af742c80 100644
--- a/include/linux/percpu.h
+++ b/include/linux/percpu.h
@@ -105,7 +105,7 @@  extern struct pcpu_alloc_info * __init pcpu_alloc_alloc_info(int nr_groups,
 							     int nr_units);
 extern void __init pcpu_free_alloc_info(struct pcpu_alloc_info *ai);
 
-extern int __init pcpu_setup_first_chunk(const struct pcpu_alloc_info *ai,
+extern void __init pcpu_setup_first_chunk(const struct pcpu_alloc_info *ai,
 					 void *base_addr);
 
 #ifdef CONFIG_NEED_PER_CPU_EMBED_FIRST_CHUNK
diff --git a/mm/percpu.c b/mm/percpu.c
index 9821241fdede..ad32c3d11ca7 100644
--- a/mm/percpu.c
+++ b/mm/percpu.c
@@ -2267,12 +2267,9 @@  static void pcpu_dump_alloc_info(const char *lvl,
  * share the same vm, but use offset regions in the area allocation map.
  * The chunk serving the dynamic region is circulated in the chunk slots
  * and available for dynamic allocation like any other chunk.
- *
- * RETURNS:
- * 0 on success, -errno on failure.
  */
-int __init pcpu_setup_first_chunk(const struct pcpu_alloc_info *ai,
-				  void *base_addr)
+void __init pcpu_setup_first_chunk(const struct pcpu_alloc_info *ai,
+				   void *base_addr)
 {
 	size_t size_sum = ai->static_size + ai->reserved_size + ai->dyn_size;
 	size_t static_size, dyn_size;
@@ -2457,7 +2454,6 @@  int __init pcpu_setup_first_chunk(const struct pcpu_alloc_info *ai,
 
 	/* we're done */
 	pcpu_base_addr = base_addr;
-	return 0;
 }
 
 #ifdef CONFIG_SMP
@@ -2710,7 +2706,7 @@  int __init pcpu_embed_first_chunk(size_t reserved_size, size_t dyn_size,
 	struct pcpu_alloc_info *ai;
 	size_t size_sum, areas_size;
 	unsigned long max_distance;
-	int group, i, highest_group, rc;
+	int group, i, highest_group, rc = 0;
 
 	ai = pcpu_build_alloc_info(reserved_size, dyn_size, atom_size,
 				   cpu_distance_fn);
@@ -2795,7 +2791,7 @@  int __init pcpu_embed_first_chunk(size_t reserved_size, size_t dyn_size,
 		PFN_DOWN(size_sum), ai->static_size, ai->reserved_size,
 		ai->dyn_size, ai->unit_size);
 
-	rc = pcpu_setup_first_chunk(ai, base);
+	pcpu_setup_first_chunk(ai, base);
 	goto out_free;
 
 out_free_areas:
@@ -2920,7 +2916,7 @@  int __init pcpu_page_first_chunk(size_t reserved_size,
 		unit_pages, psize_str, ai->static_size,
 		ai->reserved_size, ai->dyn_size);
 
-	rc = pcpu_setup_first_chunk(ai, vm.addr);
+	pcpu_setup_first_chunk(ai, vm.addr);
 	goto out_free_ar;
 
 enomem:
@@ -3014,8 +3010,7 @@  void __init setup_per_cpu_areas(void)
 	ai->groups[0].nr_units = 1;
 	ai->groups[0].cpu_map[0] = 0;
 
-	if (pcpu_setup_first_chunk(ai, fc) < 0)
-		panic("Failed to initialize percpu areas.");
+	pcpu_setup_first_chunk(ai, fc);
 	pcpu_free_alloc_info(ai);
 }