WSL2-Linux-Kernel/arch/arm64/kernel
Andrew Jones 75df529bec arm64: paravirt: Initialize steal time when cpu is online
Steal time initialization requires mapping a memory region which
invokes a memory allocation. Doing this at CPU starting time results
in the following trace when CONFIG_DEBUG_ATOMIC_SLEEP is enabled:

BUG: sleeping function called from invalid context at mm/slab.h:498
in_atomic(): 1, irqs_disabled(): 128, non_block: 0, pid: 0, name: swapper/1
CPU: 1 PID: 0 Comm: swapper/1 Not tainted 5.9.0-rc5+ #1
Call trace:
 dump_backtrace+0x0/0x208
 show_stack+0x1c/0x28
 dump_stack+0xc4/0x11c
 ___might_sleep+0xf8/0x130
 __might_sleep+0x58/0x90
 slab_pre_alloc_hook.constprop.101+0xd0/0x118
 kmem_cache_alloc_node_trace+0x84/0x270
 __get_vm_area_node+0x88/0x210
 get_vm_area_caller+0x38/0x40
 __ioremap_caller+0x70/0xf8
 ioremap_cache+0x78/0xb0
 memremap+0x9c/0x1a8
 init_stolen_time_cpu+0x54/0xf0
 cpuhp_invoke_callback+0xa8/0x720
 notify_cpu_starting+0xc8/0xd8
 secondary_start_kernel+0x114/0x180
CPU1: Booted secondary processor 0x0000000001 [0x431f0a11]

However we don't need to initialize steal time at CPU starting time.
We can simply wait until CPU online time, just sacrificing a bit of
accuracy by returning zero for steal time until we know better.

While at it, add __init to the functions that are only called by
pv_time_init() which is __init.

Signed-off-by: Andrew Jones <drjones@redhat.com>
Fixes: e0685fa228 ("arm64: Retrieve stolen time as paravirtualized guest")
Cc: stable@vger.kernel.org
Reviewed-by: Steven Price <steven.price@arm.com>
Link: https://lore.kernel.org/r/20200916154530.40809-1-drjones@redhat.com
Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
2020-09-17 18:12:18 +01:00
..
probes vmalloc: fix the owner argument for the new __vmalloc_node_range callers 2020-07-03 16:15:25 -07:00
vdso arm64/vdso: Add time namespace page 2020-07-24 13:15:20 +01:00
vdso32 ARM64: vdso32: Install vdso32 from vdso_install 2020-08-21 19:11:44 +01:00
.gitignore .gitignore: add SPDX License Identifier 2020-03-25 11:50:48 +01:00
Makefile arm64: compat: Allow 32-bit vdso and sigpage to co-exist 2020-06-23 14:47:03 +01:00
acpi.c treewide: Use fallthrough pseudo-keyword 2020-08-23 17:36:59 -05:00
acpi_numa.c acpi: Create subtable parsing infrastructure 2019-04-04 18:41:12 +02:00
acpi_parking_protocol.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 234 2019-06-19 17:09:07 +02:00
alternative.c arm64/alternatives: don't patch up internal branches 2020-07-09 14:57:59 +01:00
armv8_deprecated.c sysctl: pass kernel pointers to ->proc_handler 2020-04-27 02:07:40 -04:00
asm-offsets.c KVM: arm64: Make struct kvm_regs userspace-only 2020-07-07 09:28:38 +01:00
cacheinfo.c arm64 updates for 5.3: 2019-07-08 09:54:55 -07:00
cpu-reset.S arm64: kernel: Convert to modern annotations for assembly functions 2020-05-04 12:46:03 +01:00
cpu-reset.h treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 500 2019-06-19 17:09:55 +02:00
cpu_errata.c arm64: Allow CPUs unffected by ARM erratum 1418040 to come in late 2020-09-13 13:18:10 +01:00
cpu_ops.c arm64: Introduce get_cpu_ops() helper function 2020-03-24 17:24:19 +00:00
cpufeature.c treewide: Use fallthrough pseudo-keyword 2020-08-23 17:36:59 -05:00
cpuidle.c arm64: Introduce get_cpu_ops() helper function 2020-03-24 17:24:19 +00:00
cpuinfo.c arm64/cpuinfo: Remove unnecessary fallthrough annotation 2020-08-27 15:44:32 -05:00
crash_core.c arm64/crash_core: Export TCR_EL1.T1SZ in vmcoreinfo 2020-07-02 17:56:49 +01:00
crash_dump.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 500 2019-06-19 17:09:55 +02:00
debug-monitors.c arm64: Use test_tsk_thread_flag() for checking TIF_SINGLESTEP 2020-07-16 11:42:12 +01:00
efi-entry.S arm64 updates for 5.8 2020-06-01 15:18:27 -07:00
efi-header.S arm64 updates for 5.8 2020-06-01 15:18:27 -07:00
efi-rt-wrapper.S Merge branch 'for-next/scs' into for-next/core 2020-05-28 18:03:40 +01:00
efi.c mm/pgtable: drop pgtable_t variable from pte_fn_t functions 2019-07-12 11:05:46 -07:00
entry-common.c arm64: entry: Fix the typo in the comment of el1_dbg() 2020-07-08 21:44:40 +01:00
entry-fpsimd.S arm64: kernel: Convert to modern annotations for assembly functions 2020-05-04 12:46:03 +01:00
entry-ftrace.S arm64: entry-ftrace.S: Update comment to indicate that x18 is live 2020-05-18 17:47:50 +01:00
entry.S arm64: Move handling of erratum 1418040 into C code 2020-08-21 11:39:56 +01:00
fpsimd.c arm64: sve: Fix build failure when ARM64_SVE=y and SYSCTL=n 2020-06-16 18:29:11 +01:00
ftrace.c arm64: ftrace: Change CONFIG_FTRACE_WITH_REGS to CONFIG_DYNAMIC_FTRACE_WITH_REGS 2020-06-08 15:44:59 +01:00
head.S mm: reorder includes after introduction of linux/pgtable.h 2020-06-09 09:39:13 -07:00
hibernate-asm.S arm64: kernel: Convert to modern annotations for assembly functions 2020-05-04 12:46:03 +01:00
hibernate.c mm: consolidate pte_index() and pte_offset_*() definitions 2020-06-09 09:39:14 -07:00
hw_breakpoint.c treewide: Use fallthrough pseudo-keyword 2020-08-23 17:36:59 -05:00
hyp-stub.S arm64: kernel: Convert to modern annotations for assembly functions 2020-05-04 12:46:03 +01:00
image-vars.h KVM: arm64: Add kvm_extable for vaxorcism code 2020-08-28 15:23:42 +01:00
image.h arm64/efi: Move variable assignments after SECTIONS 2019-08-14 17:18:15 +01:00
insn.c maccess: rename probe_kernel_{read,write} to copy_{from,to}_kernel_nofault 2020-06-17 10:57:41 -07:00
io.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 234 2019-06-19 17:09:07 +02:00
irq.c arm64 updates for 5.3: 2019-07-08 09:54:55 -07:00
jump_label.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 234 2019-06-19 17:09:07 +02:00
kaslr.c arm64: kaslr: Use standard early random function 2020-08-07 09:10:11 -07:00
kexec_image.c arm64: kexec_file: add crash dump support 2020-01-08 17:05:23 +00:00
kgdb.c arm64: kgdb: Fix single-step exception handling oops 2020-07-08 22:18:54 +01:00
kuser32.S docs: arm: convert docs to ReST and rename to *.rst 2019-07-15 09:20:24 -03:00
machine_kexec.c arm64: fix the flush_icache_range arguments in machine_kexec 2020-05-11 12:02:14 +01:00
machine_kexec_file.c arm64: kexec_file: Use struct_size() in kmalloc() 2020-06-18 10:45:20 +01:00
module-plts.c arm64/module: set trampoline section flags regardless of CONFIG_DYNAMIC_FTRACE 2020-09-02 08:35:33 +01:00
module.c treewide: Use fallthrough pseudo-keyword 2020-08-23 17:36:59 -05:00
module.lds arm64: ftrace: emit ftrace-mod.o contents through code 2017-12-01 13:04:59 +00:00
paravirt.c arm64: paravirt: Initialize steal time when cpu is online 2020-09-17 18:12:18 +01:00
pci.c PCI: Constify struct pci_ecam_ops 2020-05-01 16:28:59 +01:00
perf_callchain.c arm64: stacktrace: Factor out backtrace initialisation 2019-07-22 11:44:08 +01:00
perf_event.c arm64: perf: Expose some new events via sysfs 2020-07-21 12:59:42 +01:00
perf_regs.c arm64: perf: Report the PC value in REGS_ABI_32 mode 2020-06-25 14:47:04 +01:00
pointer_auth.c arm64: install user ptrauth keys at kernel exit time 2020-03-18 09:50:19 +00:00
process.c cpuidle: Move trace_cpu_idle() into generic code 2020-08-26 12:41:54 +02:00
psci.c arm64: psci: Reduce the waiting time for cpu_psci_cpu_kill() 2019-10-25 16:29:11 +01:00
ptrace.c Merge branch 'work.regset' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs 2020-08-07 09:29:25 -07:00
reloc_test_core.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 500 2019-06-19 17:09:55 +02:00
reloc_test_syms.S arm64: kernel: Convert to modern annotations for assembly functions 2020-05-04 12:46:03 +01:00
relocate_kernel.S arm64: kernel: Convert to modern annotations for assembly functions 2020-05-04 12:46:03 +01:00
return_address.c arm64: unwind: Prohibit probing on return_address() 2019-08-01 15:00:26 +01:00
scs.c scs: Move DEFINE_SCS macro into core code 2020-05-18 17:47:48 +01:00
sdei.c uaccess: add force_uaccess_{begin,end} helpers 2020-08-12 10:57:59 -07:00
setup.c arm64: Remove exporting cpu_logical_map symbol 2020-09-02 08:35:28 +01:00
signal.c arm64: ptrace: Consistently use pseudo-singlestep exceptions 2020-07-16 11:41:07 +01:00
signal32.c arm64: compat: Always use sigpage for sigreturn trampoline 2020-06-23 14:56:24 +01:00
sigreturn32.S arm64: compat: Split kuser32 2019-04-23 18:01:57 +01:00
sleep.S Merge branch 'for-next/bti' into for-next/core 2020-05-28 18:00:51 +01:00
smccc-call.S arm64: kernel: Convert to modern annotations for assembly functions 2020-05-04 12:46:03 +01:00
smp.c treewide: Use fallthrough pseudo-keyword 2020-08-23 17:36:59 -05:00
smp_spin_table.c arm64: prefer __section from compiler_attributes.h 2019-08-13 18:32:15 +01:00
ssbd.c Return ENODEV when the selected speculation misfeature is unsupported 2020-01-08 17:27:41 +00:00
stacktrace.c arm64: stacktrace: Move export for save_stack_trace_tsk() 2020-07-14 19:16:25 +01:00
suspend.c mm: reorder includes after introduction of linux/pgtable.h 2020-06-09 09:39:13 -07:00
sys.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 234 2019-06-19 17:09:07 +02:00
sys32.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 452 2019-06-19 17:09:08 +02:00
sys_compat.c arm64: Silence clang warning on mismatched value/register sizes 2019-10-28 09:13:21 +00:00
syscall.c arm64: syscall: Expand the comment about ptrace and syscall(-1) 2020-07-16 11:41:58 +01:00
time.c arm64: time: Replace <linux/clk-provider.h> by <linux/of_clk.h> 2020-02-12 17:26:38 +00:00
topology.c arm64: use activity monitors for frequency invariance 2020-03-06 16:02:50 +00:00
trace-events-emulation.h License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
traps.c arm64: use IRQ_STACK_SIZE instead of THREAD_SIZE for irq stack 2020-07-31 18:05:36 +01:00
vdso.c arm64/vdso: Restrict splitting VVAR VMA 2020-07-24 18:06:52 +01:00
vmlinux.lds.S KVM: arm64: Add kvm_extable for vaxorcism code 2020-08-28 15:23:42 +01:00