Wind River Support Network

HomeDefectsLIN5-19480
Fixed

LIN5-19480 : ksoftirqd BUG: using smp_processor_id() in preemptible code

Created: Sep 19, 2014    Updated: Dec 19, 2017
Resolved Date: Oct 21, 2014
Found In Version: 5.0.1.17
Fix Version: 5.0.1.20
Severity: Standard
Applicable for: Wind River Linux 5
Component/s: Kernel

Description

The below issue is occasionally seen during running suspend/resume with preemp-rt kernel. You will see in the below text, the timeframe where the board was awakened from sleep. The highlighted text is what they are concerned about.

 Freezing user space processes ... (elapsed 0.01 seconds) done.
 Freezing remaining freezable tasks ... (elapsed 0.01 seconds) done.
 Suspending console(s) (use no_console_suspend to debug)
 ACPI handle has no context!
 pch_gpio 0000:02:00.2: pci_enable_wake Failed --22
 tty ttyS0: parent serial8250 should not be sleeping
 tty ttyS1: parent serial8250 should not be sleeping
 Watchdog exit
 sdhci-pci 0000:02:04.1: setting latency timer to 64
 PM: suspend of devices complete after 183.079 msecs
 PM: late suspend of devices complete after 0.294 msecs
 ehci_hcd 0000:02:08.3: wake-up capability enabled by ACPI
 ohci_hcd 0000:02:08.2: wake-up capability enabled by ACPI
 ohci_hcd 0000:02:08.1: wake-up capability enabled by ACPI
 ohci_hcd 0000:02:08.0: wake-up capability enabled by ACPI
 ehci_hcd 0000:02:02.3: wake-up capability enabled by ACPI
 ohci_hcd 0000:02:02.2: wake-up capability enabled by ACPI
 ohci_hcd 0000:02:02.1: wake-up capability enabled by ACPI
 ohci_hcd 0000:02:02.0: wake-up capability enabled by ACPI
 pch_gbe 0000:02:00.1: wake-up capability enabled by ACPI
 PM: noirq suspend of devices complete after 144.078 msecs
 ACPI: Preparing to enter system sleep state S3
 PM: Saving platform NVS memory
 Disabling non-boot CPUs ...
 BUG: using smp_processor_id() in preemptible [00000000 00000000] code: ksoftirqd/1/12
 caller is do_current_softirqs+0x9d/0x2f0
 Pid: 12, comm: ksoftirqd/1 Tainted: G W O 3.4.88-rt56-WR5.0.1.17_preempt-rt #1
 Call Trace:
 [<c131a951>] debug_smp_processor_id+0xf1/0x110
 [<c10369bd>] do_current_softirqs+0x9d/0x2f0
 [<c175007b>] ? elf_map+0xbe/0xe8
 [<c10300d8>] ? panic_smp_self_stop+0x8/0x20
 [<c1036cf3>] run_ksoftirqd+0xe3/0x1b0
 [<c1036c10>] ? do_current_softirqs+0x2f0/0x2f0
 [<c104f3ae>] kthread+0x6e/0x80
 [<c104f340>] ? __init_kthread_worker+0x40/0x40
 [<c175ed3a>] kernel_thread_helper+0x6/0x10
 CPU 1 is now offline
 ACPI: Low-level resume complete
 PM: Restoring platform NVS memory
 Enabling non-boot CPUs ...
 Booting Node 0 Processor 1 APIC 0x1
 Initializing CPU#1
 checking TSC synchronization [CPU#0 -> CPU#1]: passed.
 NMI watchdog: disabled (cpu1): unable to create perf event: -13
 CPU1 is up
 ACPI: Waking up from system sleep state S3

Customer's hardware is based on Eurotech Catalyst TC, which is very similar to the intel_atom_eg20t_pch and somewhat similar to the intel_atom_z530 target/bsp . 

Workaround

Move the smp_processor_id() call into a non-preemtible part of the kernel function.

@@ -514,13 +514,14 @@ static void unlock_softirq(int which)
 static void do_single_softirq(int which, int need_rcu_bh_qs)
 {
 	unsigned long old_flags = current->flags;
+	int cpu = smp_processor_id();
 
 	current->flags &= ~PF_MEMALLOC;
 	account_system_vtime(current);
 	current->flags |= PF_IN_SOFTIRQ;
 	lockdep_softirq_enter();
 	local_irq_enable();
-	handle_softirq(which, smp_processor_id(), need_rcu_bh_qs);
+	handle_softirq(which, cpu, need_rcu_bh_qs);
 	local_irq_disable();
 	lockdep_softirq_exit();

Other Downloads


Live chat
Online