linux-stable/drivers/firmware/efi
Chen Yu 781e34b736 efi/unaccepted: touch soft lockup during memory accept
[ Upstream commit 1c5a1627f4 ]

Commit 50e782a86c ("efi/unaccepted: Fix soft lockups caused by
parallel memory acceptance") has released the spinlock so other CPUs can
do memory acceptance in parallel and not triggers softlockup on other
CPUs.

However the softlock up was intermittent shown up if the memory of the
TD guest is large, and the timeout of softlockup is set to 1 second:

 RIP: 0010:_raw_spin_unlock_irqrestore
 Call Trace:
 ? __hrtimer_run_queues
 <IRQ>
 ? hrtimer_interrupt
 ? watchdog_timer_fn
 ? __sysvec_apic_timer_interrupt
 ? __pfx_watchdog_timer_fn
 ? sysvec_apic_timer_interrupt
 </IRQ>
 ? __hrtimer_run_queues
 <TASK>
 ? hrtimer_interrupt
 ? asm_sysvec_apic_timer_interrupt
 ? _raw_spin_unlock_irqrestore
 ? __sysvec_apic_timer_interrupt
 ? sysvec_apic_timer_interrupt
 accept_memory
 try_to_accept_memory
 do_huge_pmd_anonymous_page
 get_page_from_freelist
 __handle_mm_fault
 __alloc_pages
 __folio_alloc
 ? __tdx_hypercall
 handle_mm_fault
 vma_alloc_folio
 do_user_addr_fault
 do_huge_pmd_anonymous_page
 exc_page_fault
 ? __do_huge_pmd_anonymous_page
 asm_exc_page_fault
 __handle_mm_fault

When the local irq is enabled at the end of accept_memory(), the
softlockup detects that the watchdog on single CPU has not been fed for
a while. That is to say, even other CPUs will not be blocked by
spinlock, the current CPU might be stunk with local irq disabled for a
while, which hurts not only nmi watchdog but also softlockup.

Chao Gao pointed out that the memory accept could be time costly and
there was similar report before. Thus to avoid any softlocup detection
during this stage, give the softlockup a flag to skip the timeout check
at the end of accept_memory(), by invoking touch_softlockup_watchdog().

Reported-by: Hossain, Md Iqbal <md.iqbal.hossain@intel.com>
Signed-off-by: Chen Yu <yu.c.chen@intel.com>
Reviewed-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
Fixes: 50e782a86c ("efi/unaccepted: Fix soft lockups caused by parallel memory acceptance")
Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2024-05-17 12:14:28 +02:00
..
libstub x86/efistub: Remap kernel text read-only before dropping NX attribute 2024-04-10 16:38:23 +02:00
stmm efi: Add tee-based EFI variable driver 2023-12-11 11:19:18 +01:00
test
apple-properties.c
arm-runtime.c efi: runtime: Fix potential overflow of soft-reserved region size 2024-02-02 19:31:24 +01:00
capsule-loader.c efi/capsule-loader: fix incorrect allocation size 2024-02-13 16:30:07 +01:00
capsule.c
cper-arm.c efi/cper: Remove unnecessary aer.h include 2023-04-07 16:42:31 -05:00
cper-x86.c
cper.c cxl/cper: Fix errant CPER prints for CXL events 2024-02-03 18:31:17 +01:00
cper_cxl.c efi/cper, cxl: Remove cxl_err.h 2023-02-03 23:59:58 +01:00
cper_cxl.h efi/cper, cxl: Decode CXL Protocol Error Section 2022-11-18 09:14:10 +01:00
dev-path-parser.c efi: dev-path-parser: use acpi_dev_uid_match() for matching _UID 2023-12-06 18:02:37 +01:00
earlycon.c efi: earlycon: Reprobe after parsing config tables 2023-03-13 23:28:43 +01:00
efi-bgrt.c
efi-init.c efi: Don't add memblocks for soft-reserved memory 2024-02-02 19:31:24 +01:00
efi-pstore.c EFI updates for v6.2: 2022-12-13 14:31:47 -08:00
efi.c efi: fix panic in kdump kernel 2024-04-03 15:32:35 +02:00
efibc.c efi: efibc: Guard against allocation failure 2022-09-20 18:42:55 +02:00
embedded-firmware.c
esrt.c efi/esrt: Allow ESRT access without CAP_SYS_ADMIN 2023-06-06 15:33:59 +02:00
fdtparams.c efi: xen: Set EFI_PARAVIRT for Xen dom0 boot on all architectures 2022-11-18 09:14:09 +01:00
Kconfig efi: Add tee-based EFI variable driver 2023-12-11 11:19:18 +01:00
Makefile efi: Add tee-based EFI variable driver 2023-12-11 11:19:18 +01:00
memattr.c A healthy mix of EFI contributions this time: 2023-02-23 14:41:48 -08:00
memmap.c efi: memmap: fix kernel-doc warnings 2023-12-22 10:42:06 +01:00
mokvar-table.c
rci2-table.c
reboot.c efi: Fix efi_power_off() not being run before acpi_power_off() when necessary 2022-07-10 17:41:06 +02:00
riscv-runtime.c efi: runtime: Fix potential overflow of soft-reserved region size 2024-02-02 19:31:24 +01:00
runtime-wrappers.c efi/runtime-wrappers: Clean up white space and add __init annotation 2023-08-22 10:39:26 +02:00
sysfb_efi.c efi: sysfb_efi: Add quirk for Lenovo Yoga Book X91F/L 2023-03-18 11:44:57 +01:00
tpm.c efi/tpm: Pass correct address to memblock_reserve 2022-10-24 08:04:25 +02:00
unaccepted_memory.c efi/unaccepted: touch soft lockup during memory accept 2024-05-17 12:14:28 +02:00
vars.c efivarfs: automatically update super block flag 2023-12-11 11:19:18 +01:00