* [4.14.66-rt40] [report][cpuhotplug] BUG: sleeping function called from invalid context at kernel/locking/rtmutex.c:974
@ 2018-08-28 23:28 Grygorii Strashko
2018-08-29 14:08 ` Sebastian Andrzej Siewior
0 siblings, 1 reply; 12+ messages in thread
From: Grygorii Strashko @ 2018-08-28 23:28 UTC (permalink / raw)
To: linux-rt-users, Mike Galbraith; +Cc: Sebastian Andrzej Siewior, LKML
Hi
I can see below back traces during secondary CPUs initialization (boot) on TI's AM6 SoC (ARM64 4 CPUs)
with debug options enabled it happens without CONFIG_NUMA=n (log 1) and with CONFIG_NUMA=y.
This is TI branch, there are no RT specific changes.
I've also found the similar issue was reported by Mike Galbraith [1]
[1] https://www.spinics.net/lists/linux-rt-users/msg19058.html
===== Log 1 =====
[ 0.000000] Booting Linux on physical CPU 0x0
[ 0.000000] Linux version 4.14.66-rt40-02415-g6a801ed-dirty (a0226610local@uda0226610) (gcc version 7.2.1 20171011 (Linaro GCC 7.2-2017.11)) #5 SMP PREEMPT RT Mon Aug 27 21:04:26 CDT 2018
[ 0.000000] Boot CPU: AArch64 Processor [410fd034]
[ 0.000000] Machine model: Texas Instruments AM654 Base Board
[ 0.000000] earlycon: ns16550a0 at MMIO32 0x0000000002800000 (options '')
[ 0.000000] bootconsole [ns16550a0] enabled
[ 0.000000] cma: Reserved 512 MiB at 0x00000000c0000000
[ 0.000000] psci: probing for conduit method from DT.
[ 0.000000] psci: PSCIv1.1 detected in firmware.
[ 0.000000] psci: Using standard PSCI v0.2 function IDs
[ 0.000000] psci: Trusted OS migration not required
[ 0.000000] psci: SMC Calling Convention v1.1
[ 0.000000] percpu: Embedded 2 pages/cpu @ffff80087feb0000 s55504 r8192 d67376 u131072
[ 0.000000] Detected VIPT I-cache on CPU0
[ 0.000000] CPU features: enabling workaround for ARM erratum 845719
[ 0.000000] Speculative Store Bypass Disable mitigation not required
[ 0.000000] Built 1 zonelists, mobility grouping on. Total pages: 65088
[ 0.000000] Kernel command line: console=ttyS2,115200n8 earlycon=ns16550a,mmio32,0x02800000 mtdparts=47040000.ospi.0:512k(ospi.tiboot3),2m(ospi.tispl),5m(ospi.u-boot),128k(ospi.env),-@8m(ospi.rootfs) root=PARTUUID=f2c6fe8e-0t
[ 0.000000] PID hash table entries: 4096 (order: -1, 32768 bytes)
[ 0.000000] Dentry cache hash table entries: 524288 (order: 9, 33554432 bytes)
[ 0.000000] Inode-cache hash table entries: 262144 (order: 5, 2097152 bytes)
[ 0.000000] software IO TLB [mem 0xf9dd0000-0xfddd0000] (64MB) mapped at [ffff800079dd0000-ffff80007ddcffff]
[ 0.000000] Memory: 3511168K/4169728K available (7806K kernel code, 1000K rwdata, 3008K rodata, 512K init, 14066K bss, 134272K reserved, 524288K cma-reserved)
[ 0.000000] Virtual kernel memory layout:
[ 0.000000] modules : 0xffff000000000000 - 0xffff000008000000 ( 128 MB)
[ 0.000000] vmalloc : 0xffff000008000000 - 0xffff7bdfffff0000 (126847 GB)
[ 0.000000] .text : 0xffff000008080000 - 0xffff000008820000 ( 7808 KB)
[ 0.000000] .rodata : 0xffff000008820000 - 0xffff000008b20000 ( 3072 KB)
[ 0.000000] .init : 0xffff000008b20000 - 0xffff000008ba0000 ( 512 KB)
[ 0.000000] .data : 0xffff000008ba0000 - 0xffff000008c9a008 ( 1001 KB)
[ 0.000000] .bss : 0xffff000008c9a008 - 0xffff000009a56af0 ( 14067 KB)
[ 0.000000] fixed : 0xffff7fdffe7b0000 - 0xffff7fdffec00000 ( 4416 KB)
[ 0.000000] PCI I/O : 0xffff7fdffee00000 - 0xffff7fdfffe00000 ( 16 MB)
[ 0.000000] vmemmap : 0xffff7fe000000000 - 0xffff800000000000 ( 128 GB maximum)
[ 0.000000] 0xffff7fe000000000 - 0xffff7fe002200000 ( 34 MB actual)
[ 0.000000] memory : 0xffff800000000000 - 0xffff800880000000 ( 34816 MB)
[ 0.000000] SLUB: HWalign=64, Order=0-3, MinObjects=0, CPUs=4, Nodes=1
[ 0.000000] Running RCU self tests
[ 0.000000] Preemptible hierarchical RCU implementation.
[ 0.000000] RCU event tracing is enabled.
[ 0.000000] RCU lockdep checking is enabled.
[ 0.000000] RCU restricting CPUs from NR_CPUS=64 to nr_cpu_ids=4.
[ 0.000000] RCU priority boosting: priority 1 delay 500 ms.
[ 0.000000] RCU callback double-/use-after-free debug enabled.
[ 0.000000] No expedited grace period (rcu_normal_after_boot).
[ 0.000000] Tasks RCU enabled.
[ 0.000000] RCU: Adjusting geometry for rcu_fanout_leaf=16, nr_cpu_ids=4
[ 0.000000] NR_IRQS: 64, nr_irqs: 64, preallocated irqs: 0
[ 0.000000] GICv3: GIC: Using split EOI/Deactivate mode
[ 0.000000] GICv3: no VLPI support, no direct LPI support
[ 0.000000] ITS [mem 0x01820000-0x0182ffff]
[ 0.000000] GIC: enabling workaround for ITS: Socionext Synquacer pre-ITS
[ 0.000000] ITS@0x0000000001820000: allocated 1048576 Devices @8fc000000 (flat, esz 8, psz 64K, shr 0)
[ 0.000000] ITS: using cache flushing for cmd queue
[ 0.000000] GIC: using LPI property table @0x00000008fd730000
[ 0.000000] ITS: Allocated 1792 chunks for LPIs
[ 0.000000] GICv3: CPU0: found redistributor 0 region 0:0x0000000001880000
[ 0.000000] CPU0: using LPI pending table @0x00000008ffd80000
[ 0.000000] GIC: using cache flushing for LPI property table
[ 0.000000] arch_timer: cp15 timer(s) running at 200.00MHz (phys).
[ 0.000000] clocksource: arch_sys_counter: mask: 0xffffffffffffff max_cycles: 0x2e2049d3e8, max_idle_ns: 440795210634 ns
[ 0.000007] sched_clock: 56 bits at 200MHz, resolution 5ns, wraps every 4398046511102ns
[ 0.000811] Console: colour dummy device 80x25
[ 0.392008] Lock dependency validator: Copyright (c) 2006 Red Hat, Inc., Ingo Molnar
[ 0.392013] ... MAX_LOCKDEP_SUBCLASSES: 8
[ 0.392016] ... MAX_LOCK_DEPTH: 48
[ 0.392020] ... MAX_LOCKDEP_KEYS: 8191
[ 0.392024] ... CLASSHASH_SIZE: 4096
[ 0.392027] ... MAX_LOCKDEP_ENTRIES: 32768
[ 0.392031] ... MAX_LOCKDEP_CHAINS: 65536
[ 0.392034] ... CHAINHASH_SIZE: 32768
[ 0.392038] memory used by lock dependency info: 7391 kB
[ 0.392041] per task-struct memory footprint: 1920 bytes
[ 0.393633] Calibrating delay loop (skipped), value calculated using timer frequency.. 400.00 BogoMIPS (lpj=800000)
[ 0.393652] pid_max: default: 32768 minimum: 301
[ 0.394444] Security Framework initialized
[ 0.394724] Mount-cache hash table entries: 8192 (order: 0, 65536 bytes)
[ 0.394770] Mountpoint-cache hash table entries: 8192 (order: 0, 65536 bytes)
[ 0.418449] ASID allocator initialised with 32768 entries
[ 0.522829] Hierarchical SRCU implementation.
[ 0.553963] PCI/MSI: /soc0/interrupt-controller@1800000/gic-its@1000000 domain created
[ 0.562559] Platform MSI: /soc0/interrupt-controller@1800000/gic-its@1000000 domain created
[ 0.579342] smp: Bringing up secondary CPUs ...
[ 0.625109] Detected VIPT I-cache on CPU1
[ 0.625149] GICv3: CPU1: found redistributor 1 region 0:0x00000000018a0000
[ 0.625176] BUG: sleeping function called from invalid context at kernel/locking/rtmutex.c:974
[ 0.625182] in_atomic(): 1, irqs_disabled(): 128, pid: 0, name: swapper/1
[ 0.625189] 1 lock held by swapper/1/0:
[ 0.625193] #0: ((pa_lock).lock){+.+.}, at: [<ffff0000081a73e8>] get_page_from_freelist+0x160/0xd20
[ 0.625228] irq event stamp: 0
[ 0.625233] hardirqs last enabled at (0): [< (null)>] (null)
[ 0.625246] hardirqs last disabled at (0): [<ffff0000080c2f50>] copy_process.isra.5.part.6+0x2c0/0x18a8
[ 0.625255] softirqs last enabled at (0): [<ffff0000080c2f50>] copy_process.isra.5.part.6+0x2c0/0x18a8
[ 0.625260] softirqs last disabled at (0): [< (null)>] (null)
[ 0.625263] Preemption disabled at:
[ 0.625274] [<ffff0000080909b8>] secondary_start_kernel+0x80/0x118
[ 0.625286] CPU: 1 PID: 0 Comm: swapper/1 Not tainted 4.14.66-rt40-02415-g6a801ed-dirty #5
[ 0.625290] Hardware name: Texas Instruments AM654 Base Board (DT)
[ 0.625295] Call trace:
[ 0.625306] [<ffff000008089d60>] dump_backtrace+0x0/0x400
[ 0.625313] [<ffff00000808a174>] show_stack+0x14/0x20
[ 0.625324] [<ffff0000087db658>] dump_stack+0xac/0xe4
[ 0.625333] [<ffff0000080f26b4>] ___might_sleep+0x154/0x228
[ 0.625342] [<ffff0000087f291c>] rt_spin_lock+0x5c/0x70
[ 0.625350] [<ffff0000081a73e8>] get_page_from_freelist+0x160/0xd20
[ 0.625359] [<ffff0000081a8804>] __alloc_pages_nodemask+0xe4/0xc68
[ 0.625368] [<ffff00000845bb10>] its_allocate_pending_table+0x68/0xa8
[ 0.625375] [<ffff00000845e5b4>] its_cpu_init+0x294/0x374
[ 0.625382] [<ffff00000845b4a4>] gic_cpu_init.part.6+0x15c/0x170
[ 0.625388] [<ffff00000845b4cc>] gic_starting_cpu+0x14/0x20
[ 0.625396] [<ffff0000080c5ad4>] cpuhp_invoke_callback+0x9c/0x260
[ 0.625404] [<ffff0000080c7c38>] notify_cpu_starting+0x70/0xa8
[ 0.625412] [<ffff0000080909e4>] secondary_start_kernel+0xac/0x118
===== Log 2 =====
[ 0.000000] Booting Linux on physical CPU 0x0
[ 0.000000] Linux version 4.14.66-rt40-02415-g6a801ed-dirty (a0226610local@uda0226610) (gcc version 7.2.1 20171011 (Linaro GCC 7.2-2017.11)) #4 SMP PREEMPT RT Mon Aug 27 20:44:32 CDT 2018
[ 0.000000] Boot CPU: AArch64 Processor [410fd034]
[ 0.000000] Machine model: Texas Instruments AM654 Base Board
[ 0.000000] earlycon: ns16550a0 at MMIO32 0x0000000002800000 (options '')
[ 0.000000] bootconsole [ns16550a0] enabled
[ 0.000000] cma: Reserved 512 MiB at 0x00000000c0000000
[ 0.000000] NUMA: No NUMA configuration found
[ 0.000000] NUMA: Faking a node at [mem 0x0000000000000000-0x00000008ffffffff]
[ 0.000000] NUMA: NODE_DATA [mem 0x8ffffdc80-0x8fffffc7f]
[ 0.000000] Zone ranges:
[ 0.000000] DMA [mem 0x0000000080000000-0x00000000ffffffff]
[ 0.000000] Normal [mem 0x0000000100000000-0x00000008ffffffff]
[ 0.000000] Movable zone start for each node
[ 0.000000] Early memory node ranges
[ 0.000000] node 0: [mem 0x0000000080000000-0x000000009e7fffff]
[ 0.000000] node 0: [mem 0x00000000a0000000-0x00000000ffffffff]
[ 0.000000] node 0: [mem 0x0000000880000000-0x00000008ffffffff]
[ 0.000000] Initmem setup node 0 [mem 0x0000000080000000-0x00000008ffffffff]
[ 0.000000] psci: probing for conduit method from DT.
[ 0.000000] psci: PSCIv1.1 detected in firmware.
[ 0.000000] psci: Using standard PSCI v0.2 function IDs
[ 0.000000] psci: Trusted OS migration not required
[ 0.000000] psci: SMC Calling Convention v1.1
[ 0.000000] percpu: Embedded 2 pages/cpu @ffff80087feb0000 s55760 r8192 d67120 u131072
[ 0.000000] Detected VIPT I-cache on CPU0
[ 0.000000] CPU features: enabling workaround for ARM erratum 845719
[ 0.000000] Speculative Store Bypass Disable mitigation not required
[ 0.000000] Built 1 zonelists, mobility grouping on. Total pages: 65088
[ 0.000000] Policy zone: Normal
[ 0.000000] Kernel command line: console=ttyS2,115200n8 earlycon=ns16550a,mmio32,0x02800000 mtdparts=47040000.ospi.0:512k(ospi.tiboot3),2m(ospi.tispl),5m(ospi.u-boot),128k(ospi.env),-@8m(ospi.rootfs) root=PARTUUID=f2c6fe8e-0t
[ 0.000000] PID hash table entries: 4096 (order: -1, 32768 bytes)
[ 0.000000] software IO TLB [mem 0xf9dd0000-0xfddd0000] (64MB) mapped at [ffff800079dd0000-ffff80007ddcffff]
[ 0.000000] Memory: 3545856K/4169728K available (7870K kernel code, 1062K rwdata, 3008K rodata, 512K init, 14071K bss, 99584K reserved, 524288K cma-reserved)
[ 0.000000] Virtual kernel memory layout:
[ 0.000000] modules : 0xffff000000000000 - 0xffff000008000000 ( 128 MB)
[ 0.000000] vmalloc : 0xffff000008000000 - 0xffff7bdfffff0000 (126847 GB)
[ 0.000000] .text : 0xffff000008080000 - 0xffff000008830000 ( 7872 KB)
[ 0.000000] .rodata : 0xffff000008830000 - 0xffff000008b30000 ( 3072 KB)
[ 0.000000] .init : 0xffff000008b30000 - 0xffff000008bb0000 ( 512 KB)
[ 0.000000] .data : 0xffff000008bb0000 - 0xffff000008cb9808 ( 1063 KB)
[ 0.000000] .bss : 0xffff000008cb9808 - 0xffff000009a775f0 ( 14072 KB)
[ 0.000000] fixed : 0xffff7fdffe7b0000 - 0xffff7fdffec00000 ( 4416 KB)
[ 0.000000] PCI I/O : 0xffff7fdffee00000 - 0xffff7fdfffe00000 ( 16 MB)
[ 0.000000] vmemmap : 0xffff7fe000000000 - 0xffff800000000000 ( 128 GB maximum)
[ 0.000000] 0xffff7fe000000000 - 0xffff7fe002200000 ( 34 MB actual)
[ 0.000000] memory : 0xffff800000000000 - 0xffff800880000000 ( 34816 MB)
[ 0.000000] SLUB: HWalign=64, Order=0-3, MinObjects=0, CPUs=4, Nodes=1
[ 0.000000] Running RCU self tests
[ 0.000000] Preemptible hierarchical RCU implementation.
[ 0.000000] RCU event tracing is enabled.
[ 0.000000] RCU lockdep checking is enabled.
[ 0.000000] RCU restricting CPUs from NR_CPUS=64 to nr_cpu_ids=4.
[ 0.000000] RCU priority boosting: priority 1 delay 500 ms.
[ 0.000000] RCU callback double-/use-after-free debug enabled.
[ 0.000000] No expedited grace period (rcu_normal_after_boot).
[ 0.000000] Tasks RCU enabled.
[ 0.000000] RCU: Adjusting geometry for rcu_fanout_leaf=16, nr_cpu_ids=4
[ 0.000000] NR_IRQS: 64, nr_irqs: 64, preallocated irqs: 0
[ 0.000000] GICv3: GIC: Using split EOI/Deactivate mode
[ 0.000000] GICv3: no VLPI support, no direct LPI support
[ 0.000000] ITS [mem 0x01820000-0x0182ffff]
[ 0.000000] GIC: enabling workaround for ITS: Socionext Synquacer pre-ITS
[ 0.000000] ITS@0x0000000001820000: allocated 1048576 Devices @8ff000000 (flat, esz 8, psz 64K, shr 0)
[ 0.000000] ITS: using cache flushing for cmd queue
[ 0.000000] GIC: using LPI property table @0x00000008ff930000
[ 0.000000] ITS: Allocated 1792 chunks for LPIs
[ 0.000000] GICv3: CPU0: found redistributor 0 region 0:0x0000000001880000
[ 0.000000] CPU0: using LPI pending table @0x00000008ffd80000
[ 0.000000] GIC: using cache flushing for LPI property table
[ 0.000000] arch_timer: cp15 timer(s) running at 200.00MHz (phys).
[ 0.000000] clocksource: arch_sys_counter: mask: 0xffffffffffffff max_cycles: 0x2e2049d3e8, max_idle_ns: 440795210634 ns
[ 0.000006] sched_clock: 56 bits at 200MHz, resolution 5ns, wraps every 4398046511102ns
[ 0.000803] Console: colour dummy device 80x25
[ 0.447578] Lock dependency validator: Copyright (c) 2006 Red Hat, Inc., Ingo Molnar
[ 0.447582] ... MAX_LOCKDEP_SUBCLASSES: 8
[ 0.447586] ... MAX_LOCK_DEPTH: 48
[ 0.447589] ... MAX_LOCKDEP_KEYS: 8191
[ 0.447592] ... CLASSHASH_SIZE: 4096
[ 0.447596] ... MAX_LOCKDEP_ENTRIES: 32768
[ 0.447600] ... MAX_LOCKDEP_CHAINS: 65536
[ 0.447603] ... CHAINHASH_SIZE: 32768
[ 0.447606] memory used by lock dependency info: 7391 kB
[ 0.447610] per task-struct memory footprint: 1920 bytes
[ 0.449497] Calibrating delay loop (skipped), value calculated using timer frequency.. 400.00 BogoMIPS (lpj=800000)
[ 0.449521] pid_max: default: 32768 minimum: 301
[ 0.450213] Security Framework initialized
[ 0.465026] Dentry cache hash table entries: 524288 (order: 9, 33554432 bytes)
[ 0.665565] Inode-cache hash table entries: 262144 (order: 5, 2097152 bytes)
[ 0.665800] Mount-cache hash table entries: 8192 (order: 0, 65536 bytes)
[ 0.665855] Mountpoint-cache hash table entries: 8192 (order: 0, 65536 bytes)
[ 0.689219] ASID allocator initialised with 32768 entries
[ 0.809703] Hierarchical SRCU implementation.
[ 0.840914] PCI/MSI: /soc0/interrupt-controller@1800000/gic-its@1000000 domain created
[ 0.849549] Platform MSI: /soc0/interrupt-controller@1800000/gic-its@1000000 domain created
[ 0.866228] smp: Bringing up secondary CPUs ...
[ 0.912009] Detected VIPT I-cache on CPU1
[ 0.912050] GICv3: CPU1: found redistributor 1 region 0:0x00000000018a0000
[ 0.912081] BUG: sleeping function called from invalid context at kernel/locking/rtmutex.c:974
[ 0.912087] in_atomic(): 1, irqs_disabled(): 128, pid: 0, name: swapper/1
[ 0.912092] 1 lock held by swapper/1/0:
[ 0.912096] #0: ((pa_lock).lock){+.+.}, at: [<ffff0000081ad194>] get_page_from_freelist+0x154/0xeb0
[ 0.912130] irq event stamp: 0
[ 0.912135] hardirqs last enabled at (0): [< (null)>] (null)
[ 0.912147] hardirqs last disabled at (0): [<ffff0000080c31c0>] copy_process.isra.5.part.6+0x438/0x1920
[ 0.912156] softirqs last enabled at (0): [<ffff0000080c31c0>] copy_process.isra.5.part.6+0x438/0x1920
[ 0.912160] softirqs last disabled at (0): [< (null)>] (null)
[ 0.912164] Preemption disabled at:
[ 0.912175] [<ffff0000080909b8>] secondary_start_kernel+0x80/0x118
[ 0.912188] CPU: 1 PID: 0 Comm: swapper/1 Not tainted 4.14.66-rt40-02415-g6a801ed-dirty #4
[ 0.912192] Hardware name: Texas Instruments AM654 Base Board (DT)
[ 0.912197] Call trace:
[ 0.912207] [<ffff000008089d60>] dump_backtrace+0x0/0x400
[ 0.912215] [<ffff00000808a174>] show_stack+0x14/0x20
[ 0.912225] [<ffff0000087ecc78>] dump_stack+0xac/0xe4
[ 0.912234] [<ffff0000080f3014>] ___might_sleep+0x154/0x228
[ 0.912245] [<ffff00000880400c>] rt_spin_lock+0x5c/0x70
[ 0.912251] [<ffff0000081ad194>] get_page_from_freelist+0x154/0xeb0
[ 0.912258] [<ffff0000081ae530>] __alloc_pages_nodemask+0x108/0xc88
[ 0.912268] [<ffff000008201d20>] alloc_page_interleave+0x18/0xa0
[ 0.912275] [<ffff0000082023cc>] alloc_pages_current+0xcc/0xe0
[ 0.912287] [<ffff00000846bb00>] its_allocate_pending_table+0x60/0xa0
[ 0.912295] [<ffff00000846e5d8>] its_cpu_init+0x2a0/0x380
[ 0.912303] [<ffff00000846b484>] gic_cpu_init.part.6+0x15c/0x170
[ 0.912311] [<ffff00000846b4ac>] gic_starting_cpu+0x14/0x20
[ 0.912319] [<ffff0000080c5c5c>] cpuhp_invoke_callback+0x9c/0x260
[ 0.912327] [<ffff0000080c7dc0>] notify_cpu_starting+0x70/0xa8
[ 0.912335] [<ffff0000080909e4>] secondary_start_kernel+0xac/0x118
[ 0.912396] CPU1: using LPI pending table @0x00000008fd460000
[ 0.912486] CPU1: Booted secondary processor [410fd034]
[ 0.985563] Detected VIPT I-cache on CPU2
[ 0.985607] GICv3: CPU2: found redistributor 100 region 0:0x00000000018c0000
[ 0.985695] CPU2: using LPI pending table @0x00000008fd4f0000
--
regards,
-grygorii
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [4.14.66-rt40] [report][cpuhotplug] BUG: sleeping function called from invalid context at kernel/locking/rtmutex.c:974
2018-08-28 23:28 [4.14.66-rt40] [report][cpuhotplug] BUG: sleeping function called from invalid context at kernel/locking/rtmutex.c:974 Grygorii Strashko
@ 2018-08-29 14:08 ` Sebastian Andrzej Siewior
2018-08-29 21:28 ` Grygorii Strashko
0 siblings, 1 reply; 12+ messages in thread
From: Sebastian Andrzej Siewior @ 2018-08-29 14:08 UTC (permalink / raw)
To: Grygorii Strashko; +Cc: linux-rt-users, Mike Galbraith, LKML
On 2018-08-28 18:28:42 [-0500], Grygorii Strashko wrote:
> Hi
Hi,
…
> ===== Log 1 =====
…
> [ 0.625149] GICv3: CPU1: found redistributor 1 region 0:0x00000000018a0000
> [ 0.625176] BUG: sleeping function called from invalid context at kernel/locking/rtmutex.c:974
> [ 0.625182] in_atomic(): 1, irqs_disabled(): 128, pid: 0, name: swapper/1
> [ 0.625189] 1 lock held by swapper/1/0:
> [ 0.625193] #0: ((pa_lock).lock){+.+.}, at: [<ffff0000081a73e8>] get_page_from_freelist+0x160/0xd20
> [ 0.625228] irq event stamp: 0
> [ 0.625233] hardirqs last enabled at (0): [< (null)>] (null)
> [ 0.625246] hardirqs last disabled at (0): [<ffff0000080c2f50>] copy_process.isra.5.part.6+0x2c0/0x18a8
> [ 0.625255] softirqs last enabled at (0): [<ffff0000080c2f50>] copy_process.isra.5.part.6+0x2c0/0x18a8
> [ 0.625260] softirqs last disabled at (0): [< (null)>] (null)
> [ 0.625263] Preemption disabled at:
> [ 0.625274] [<ffff0000080909b8>] secondary_start_kernel+0x80/0x118
> [ 0.625286] CPU: 1 PID: 0 Comm: swapper/1 Not tainted 4.14.66-rt40-02415-g6a801ed-dirty #5
> [ 0.625290] Hardware name: Texas Instruments AM654 Base Board (DT)
> [ 0.625295] Call trace:
> [ 0.625306] [<ffff000008089d60>] dump_backtrace+0x0/0x400
> [ 0.625313] [<ffff00000808a174>] show_stack+0x14/0x20
> [ 0.625324] [<ffff0000087db658>] dump_stack+0xac/0xe4
> [ 0.625333] [<ffff0000080f26b4>] ___might_sleep+0x154/0x228
> [ 0.625342] [<ffff0000087f291c>] rt_spin_lock+0x5c/0x70
> [ 0.625350] [<ffff0000081a73e8>] get_page_from_freelist+0x160/0xd20
> [ 0.625359] [<ffff0000081a8804>] __alloc_pages_nodemask+0xe4/0xc68
> [ 0.625368] [<ffff00000845bb10>] its_allocate_pending_table+0x68/0xa8
> [ 0.625375] [<ffff00000845e5b4>] its_cpu_init+0x294/0x374
> [ 0.625382] [<ffff00000845b4a4>] gic_cpu_init.part.6+0x15c/0x170
> [ 0.625388] [<ffff00000845b4cc>] gic_starting_cpu+0x14/0x20
> [ 0.625396] [<ffff0000080c5ad4>] cpuhp_invoke_callback+0x9c/0x260
> [ 0.625404] [<ffff0000080c7c38>] notify_cpu_starting+0x70/0xa8
> [ 0.625412] [<ffff0000080909e4>] secondary_start_kernel+0xac/0x118
>
> ===== Log 2 =====
…
> [ 0.912050] GICv3: CPU1: found redistributor 1 region 0:0x00000000018a0000
> [ 0.912081] BUG: sleeping function called from invalid context at kernel/locking/rtmutex.c:974
> [ 0.912087] in_atomic(): 1, irqs_disabled(): 128, pid: 0, name: swapper/1
> [ 0.912092] 1 lock held by swapper/1/0:
> [ 0.912096] #0: ((pa_lock).lock){+.+.}, at: [<ffff0000081ad194>] get_page_from_freelist+0x154/0xeb0
> [ 0.912130] irq event stamp: 0
> [ 0.912135] hardirqs last enabled at (0): [< (null)>] (null)
> [ 0.912147] hardirqs last disabled at (0): [<ffff0000080c31c0>] copy_process.isra.5.part.6+0x438/0x1920
> [ 0.912156] softirqs last enabled at (0): [<ffff0000080c31c0>] copy_process.isra.5.part.6+0x438/0x1920
> [ 0.912160] softirqs last disabled at (0): [< (null)>] (null)
> [ 0.912164] Preemption disabled at:
> [ 0.912175] [<ffff0000080909b8>] secondary_start_kernel+0x80/0x118
> [ 0.912188] CPU: 1 PID: 0 Comm: swapper/1 Not tainted 4.14.66-rt40-02415-g6a801ed-dirty #4
> [ 0.912192] Hardware name: Texas Instruments AM654 Base Board (DT)
> [ 0.912197] Call trace:
> [ 0.912207] [<ffff000008089d60>] dump_backtrace+0x0/0x400
> [ 0.912215] [<ffff00000808a174>] show_stack+0x14/0x20
> [ 0.912225] [<ffff0000087ecc78>] dump_stack+0xac/0xe4
> [ 0.912234] [<ffff0000080f3014>] ___might_sleep+0x154/0x228
> [ 0.912245] [<ffff00000880400c>] rt_spin_lock+0x5c/0x70
> [ 0.912251] [<ffff0000081ad194>] get_page_from_freelist+0x154/0xeb0
> [ 0.912258] [<ffff0000081ae530>] __alloc_pages_nodemask+0x108/0xc88
> [ 0.912268] [<ffff000008201d20>] alloc_page_interleave+0x18/0xa0
> [ 0.912275] [<ffff0000082023cc>] alloc_pages_current+0xcc/0xe0
> [ 0.912287] [<ffff00000846bb00>] its_allocate_pending_table+0x60/0xa0
> [ 0.912295] [<ffff00000846e5d8>] its_cpu_init+0x2a0/0x380
> [ 0.912303] [<ffff00000846b484>] gic_cpu_init.part.6+0x15c/0x170
> [ 0.912311] [<ffff00000846b4ac>] gic_starting_cpu+0x14/0x20
This is fixed by
https://git.kernel.org/pub/scm/linux/kernel/git/rt/linux-rt-devel.git/tree/patches/irqchip-gic-v3-its-Make-its_lock-a-raw_spin_lock_t.patch?h=linux-4.18.y-rt-patches
https://git.kernel.org/pub/scm/linux/kernel/git/rt/linux-rt-devel.git/tree/patches/irqchip-gic-v3-its-Move-ITS-pend_page-allocation-int.patch?h=linux-4.18.y-rt-patches
in the v4.18 tree. The first patch was merged upstream. The second will
be replaced by the patches Marc Zyngier proposed in
https://lkml.kernel.org/r/3302f069-8f4e-8d97-5166-0dec01b43c4c@arm.com
I plan to test + replace those for the next v4.18 release.
Sebastian
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [4.14.66-rt40] [report][cpuhotplug] BUG: sleeping function called from invalid context at kernel/locking/rtmutex.c:974
2018-08-29 14:08 ` Sebastian Andrzej Siewior
@ 2018-08-29 21:28 ` Grygorii Strashko
2018-08-30 1:57 ` Steven Rostedt
2018-08-30 9:14 ` Sebastian Andrzej Siewior
0 siblings, 2 replies; 12+ messages in thread
From: Grygorii Strashko @ 2018-08-29 21:28 UTC (permalink / raw)
To: Sebastian Andrzej Siewior, Steven Rostedt
Cc: linux-rt-users, Mike Galbraith, LKML
On 08/29/2018 09:08 AM, Sebastian Andrzej Siewior wrote:
> On 2018-08-28 18:28:42 [-0500], Grygorii Strashko wrote:
[...]
>> [ 0.912275] [<ffff0000082023cc>] alloc_pages_current+0xcc/0xe0
>> [ 0.912287] [<ffff00000846bb00>] its_allocate_pending_table+0x60/0xa0
>> [ 0.912295] [<ffff00000846e5d8>] its_cpu_init+0x2a0/0x380
>> [ 0.912303] [<ffff00000846b484>] gic_cpu_init.part.6+0x15c/0x170
>> [ 0.912311] [<ffff00000846b4ac>] gic_starting_cpu+0x14/0x20
>
> This is fixed by
> https://git.kernel.org/pub/scm/linux/kernel/git/rt/linux-rt-devel.git/tree/patches/irqchip-gic-v3-its-Make-its_lock-a-raw_spin_lock_t.patch?h=linux-4.18.y-rt-patches
[1]
> https://git.kernel.org/pub/scm/linux/kernel/git/rt/linux-rt-devel.git/tree/patches/irqchip-gic-v3-its-Move-ITS-pend_page-allocation-int.patch?h=linux-4.18.y-rt-patches
[2]
>
> in the v4.18 tree. The first patch was merged upstream. The second will
> be replaced by the patches Marc Zyngier proposed in
> https://lkml.kernel.org/r/3302f069-8f4e-8d97-5166-0dec01b43c4c@arm.com
>
> I plan to test + replace those for the next v4.18 release.
Thank you. Are there any plans to back port them for 4.14-rt?
Patch [1] need to be reworked a bit, [2] - I was able to cherry-pick from 4.18-rt.
--
regards,
-grygorii
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [4.14.66-rt40] [report][cpuhotplug] BUG: sleeping function called from invalid context at kernel/locking/rtmutex.c:974
2018-08-29 21:28 ` Grygorii Strashko
@ 2018-08-30 1:57 ` Steven Rostedt
2018-08-30 9:14 ` Sebastian Andrzej Siewior
1 sibling, 0 replies; 12+ messages in thread
From: Steven Rostedt @ 2018-08-30 1:57 UTC (permalink / raw)
To: Grygorii Strashko
Cc: Sebastian Andrzej Siewior, linux-rt-users, Mike Galbraith, LKML
On Wed, 29 Aug 2018 16:28:50 -0500
Grygorii Strashko <grygorii.strashko@ti.com> wrote:
> On 08/29/2018 09:08 AM, Sebastian Andrzej Siewior wrote:
> > On 2018-08-28 18:28:42 [-0500], Grygorii Strashko wrote:
>
> [...]
>
> >> [ 0.912275] [<ffff0000082023cc>] alloc_pages_current+0xcc/0xe0
> >> [ 0.912287] [<ffff00000846bb00>] its_allocate_pending_table+0x60/0xa0
> >> [ 0.912295] [<ffff00000846e5d8>] its_cpu_init+0x2a0/0x380
> >> [ 0.912303] [<ffff00000846b484>] gic_cpu_init.part.6+0x15c/0x170
> >> [ 0.912311] [<ffff00000846b4ac>] gic_starting_cpu+0x14/0x20
> >
> > This is fixed by
> > https://git.kernel.org/pub/scm/linux/kernel/git/rt/linux-rt-devel.git/tree/patches/irqchip-gic-v3-its-Make-its_lock-a-raw_spin_lock_t.patch?h=linux-4.18.y-rt-patches
> [1]
> > https://git.kernel.org/pub/scm/linux/kernel/git/rt/linux-rt-devel.git/tree/patches/irqchip-gic-v3-its-Move-ITS-pend_page-allocation-int.patch?h=linux-4.18.y-rt-patches
> [2]
> >
> > in the v4.18 tree. The first patch was merged upstream. The second will
> > be replaced by the patches Marc Zyngier proposed in
> > https://lkml.kernel.org/r/3302f069-8f4e-8d97-5166-0dec01b43c4c@arm.com
> >
> > I plan to test + replace those for the next v4.18 release.
>
> Thank you. Are there any plans to back port them for 4.14-rt?
> Patch [1] need to be reworked a bit, [2] - I was able to cherry-pick from 4.18-rt.
>
Next week I plan on looking into the patches that need to be
backported. There's quite a lot of them.
-- Steve
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [4.14.66-rt40] [report][cpuhotplug] BUG: sleeping function called from invalid context at kernel/locking/rtmutex.c:974
2018-08-29 21:28 ` Grygorii Strashko
2018-08-30 1:57 ` Steven Rostedt
@ 2018-08-30 9:14 ` Sebastian Andrzej Siewior
2018-08-31 19:19 ` Grygorii Strashko
2018-08-31 19:20 ` [4.14.66-rt TEST PATCH 1/3] irqchip/gic-v3-its: Make its_lock a raw_spin_lock_t Grygorii Strashko
1 sibling, 2 replies; 12+ messages in thread
From: Sebastian Andrzej Siewior @ 2018-08-30 9:14 UTC (permalink / raw)
To: Grygorii Strashko; +Cc: Steven Rostedt, linux-rt-users, Mike Galbraith, LKML
On 2018-08-29 16:28:50 [-0500], Grygorii Strashko wrote:
>
> Thank you. Are there any plans to back port them for 4.14-rt?
> Patch [1] need to be reworked a bit, [2] - I was able to cherry-pick from 4.18-rt.
Grygorii, could you please replace the second patch with
https://git.kernel.org/pub/scm/linux/kernel/git/rt/linux-rt-devel.git/plain/patches/irqchip-gic-v3-its-Move-pending-table-allocation-to-.patch?h=linux-4.18.y-rt-patches
(incremental patch
https://git.kernel.org/pub/scm/linux/kernel/git/rt/linux-rt-devel.git/patch/?id=4a0819bb25d12d39c0390636122eefba232596c1
)
and check if it works? It should work but I can't test it myself because
my box with GICv3 died recently…
Sebastian
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [4.14.66-rt40] [report][cpuhotplug] BUG: sleeping function called from invalid context at kernel/locking/rtmutex.c:974
2018-08-30 9:14 ` Sebastian Andrzej Siewior
@ 2018-08-31 19:19 ` Grygorii Strashko
2018-08-31 19:30 ` Sebastian Andrzej Siewior
2018-08-31 19:20 ` [4.14.66-rt TEST PATCH 1/3] irqchip/gic-v3-its: Make its_lock a raw_spin_lock_t Grygorii Strashko
1 sibling, 1 reply; 12+ messages in thread
From: Grygorii Strashko @ 2018-08-31 19:19 UTC (permalink / raw)
To: Sebastian Andrzej Siewior
Cc: Steven Rostedt, linux-rt-users, Mike Galbraith, LKML
On 08/30/2018 04:14 AM, Sebastian Andrzej Siewior wrote:
> On 2018-08-29 16:28:50 [-0500], Grygorii Strashko wrote:
>>
>> Thank you. Are there any plans to back port them for 4.14-rt?
>> Patch [1] need to be reworked a bit, [2] - I was able to cherry-pick from 4.18-rt.
>
> Grygorii, could you please replace the second patch with
>
> https://git.kernel.org/pub/scm/linux/kernel/git/rt/linux-rt-devel.git/plain/patches/irqchip-gic-v3-its-Move-pending-table-allocation-to-.patch?h=linux-4.18.y-rt-patches
>
> (incremental patch
> https://git.kernel.org/pub/scm/linux/kernel/git/rt/linux-rt-devel.git/patch/?id=4a0819bb25d12d39c0390636122eefba232596c1
> )
>
> and check if it works? It should work but I can't test it myself because
> my box with GICv3 died recently…
I've tried this and do not see warnings. I'm sending 4.14-rt patches i have as
I could miss smth while cherry-picking.
--
regards,
-grygorii
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [4.14.66-rt40] [report][cpuhotplug] BUG: sleeping function called from invalid context at kernel/locking/rtmutex.c:974
2018-08-31 19:19 ` Grygorii Strashko
@ 2018-08-31 19:30 ` Sebastian Andrzej Siewior
2018-08-31 19:42 ` Grygorii Strashko
0 siblings, 1 reply; 12+ messages in thread
From: Sebastian Andrzej Siewior @ 2018-08-31 19:30 UTC (permalink / raw)
To: Grygorii Strashko; +Cc: Steven Rostedt, linux-rt-users, Mike Galbraith, LKML
On 2018-08-31 14:19:53 [-0500], Grygorii Strashko wrote:
>
> I've tried this and do not see warnings. I'm sending 4.14-rt patches i have as
> I could miss smth while cherry-picking.
perfect. Thanks for the confirmation.
I saw your three patches. Could you please instead just backport the two
patches I have in v4.16 so that it applies on v4.14?
Sebastian
^ permalink raw reply [flat|nested] 12+ messages in thread
* [4.14.66-rt TEST PATCH 1/3] irqchip/gic-v3-its: Make its_lock a raw_spin_lock_t
2018-08-30 9:14 ` Sebastian Andrzej Siewior
2018-08-31 19:19 ` Grygorii Strashko
@ 2018-08-31 19:20 ` Grygorii Strashko
2018-08-31 19:20 ` [4.14.66-rt TEST PATCH 2/3] irqchip/gic-v3-its: Move ITS' ->pend_page allocation into an early CPU up hook Grygorii Strashko
2018-08-31 19:20 ` [4.14.66-rt TEST PATCH 3/3] irqchip/gic-v3-its: Move pending table allocation to init time Grygorii Strashko
1 sibling, 2 replies; 12+ messages in thread
From: Grygorii Strashko @ 2018-08-31 19:20 UTC (permalink / raw)
To: bigeasy, linux-rt-users
Cc: Sekhar Nori, Steven Rostedt, LKML, Grygorii Strashko
Signed-off-by: Grygorii Strashko <grygorii.strashko@ti.com>
---
drivers/irqchip/irq-gic-v3-its.c | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/drivers/irqchip/irq-gic-v3-its.c b/drivers/irqchip/irq-gic-v3-its.c
index c564443..0b691d1 100644
--- a/drivers/irqchip/irq-gic-v3-its.c
+++ b/drivers/irqchip/irq-gic-v3-its.c
@@ -154,7 +154,7 @@ static struct {
} vpe_proxy;
static LIST_HEAD(its_nodes);
-static DEFINE_SPINLOCK(its_lock);
+static DEFINE_RAW_SPINLOCK(its_lock);
static struct rdists *gic_rdists;
static struct irq_domain *its_parent;
@@ -1854,7 +1854,7 @@ static void its_cpu_init_collection(void)
struct its_node *its;
int cpu;
- spin_lock(&its_lock);
+ raw_spin_lock(&its_lock);
cpu = smp_processor_id();
list_for_each_entry(its, &its_nodes, entry) {
@@ -1896,7 +1896,7 @@ static void its_cpu_init_collection(void)
its_send_invall(its, &its->collections[cpu]);
}
- spin_unlock(&its_lock);
+ raw_spin_unlock(&its_lock);
}
static struct its_device *its_find_device(struct its_node *its, u32 dev_id)
@@ -3109,9 +3109,9 @@ static int __init its_probe_one(struct resource *res,
if (err)
goto out_free_tables;
- spin_lock(&its_lock);
+ raw_spin_lock(&its_lock);
list_add(&its->entry, &its_nodes);
- spin_unlock(&its_lock);
+ raw_spin_unlock(&its_lock);
return 0;
--
2.10.5
^ permalink raw reply related [flat|nested] 12+ messages in thread
* [4.14.66-rt TEST PATCH 2/3] irqchip/gic-v3-its: Move ITS' ->pend_page allocation into an early CPU up hook
2018-08-31 19:20 ` [4.14.66-rt TEST PATCH 1/3] irqchip/gic-v3-its: Make its_lock a raw_spin_lock_t Grygorii Strashko
@ 2018-08-31 19:20 ` Grygorii Strashko
2018-08-31 19:20 ` [4.14.66-rt TEST PATCH 3/3] irqchip/gic-v3-its: Move pending table allocation to init time Grygorii Strashko
1 sibling, 0 replies; 12+ messages in thread
From: Grygorii Strashko @ 2018-08-31 19:20 UTC (permalink / raw)
To: bigeasy, linux-rt-users; +Cc: Sekhar Nori, Steven Rostedt, LKML
From: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
The AP-GIC-starting hook allocates memory for the ->pend_page while the
CPU is started during boot-up. This callback is invoked on the target
CPU with disabled interrupts.
This does not work on -RT beacuse memory allocations are not possible
with disabled interrupts.
Move the memory allocation to an earlier hotplug step which invoked with
enabled interrupts on the boot CPU.
Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
---
drivers/irqchip/irq-gic-v3-its.c | 60 +++++++++++++++++++++++++++-------------
1 file changed, 41 insertions(+), 19 deletions(-)
diff --git a/drivers/irqchip/irq-gic-v3-its.c b/drivers/irqchip/irq-gic-v3-its.c
index 0b691d1..23c5818 100644
--- a/drivers/irqchip/irq-gic-v3-its.c
+++ b/drivers/irqchip/irq-gic-v3-its.c
@@ -171,6 +171,7 @@ static DEFINE_RAW_SPINLOCK(vmovp_lock);
static DEFINE_IDA(its_vpeid_ida);
#define gic_data_rdist() (raw_cpu_ptr(gic_rdists->rdist))
+#define gic_data_rdist_cpu(cpu) (per_cpu_ptr(gic_rdists->rdist, cpu))
#define gic_data_rdist_rd_base() (gic_data_rdist()->rd_base)
#define gic_data_rdist_vlpi_base() (gic_data_rdist_rd_base() + SZ_128K)
@@ -1738,15 +1739,17 @@ static int its_alloc_collections(struct its_node *its)
return 0;
}
-static struct page *its_allocate_pending_table(gfp_t gfp_flags)
+static struct page *its_allocate_pending_table(unsigned int cpu)
{
struct page *pend_page;
+ unsigned int order;
/*
* The pending pages have to be at least 64kB aligned,
* hence the 'max(LPI_PENDBASE_SZ, SZ_64K)' below.
*/
- pend_page = alloc_pages(gfp_flags | __GFP_ZERO,
- get_order(max_t(u32, LPI_PENDBASE_SZ, SZ_64K)));
+ order = get_order(max_t(u32, LPI_PENDBASE_SZ, SZ_64K));
+ pend_page = alloc_pages_node(cpu_to_node(cpu), GFP_KERNEL | __GFP_ZERO,
+ order);
if (!pend_page)
return NULL;
@@ -1762,6 +1765,28 @@ static void its_free_pending_table(struct page *pt)
get_order(max_t(u32, LPI_PENDBASE_SZ, SZ_64K)));
}
+static int its_alloc_pend_page(unsigned int cpu)
+{
+ struct page *pend_page;
+ phys_addr_t paddr;
+
+ pend_page = gic_data_rdist_cpu(cpu)->pend_page;
+ if (pend_page)
+ return 0;
+
+ pend_page = its_allocate_pending_table(cpu);
+ if (!pend_page) {
+ pr_err("Failed to allocate PENDBASE for CPU%d\n",
+ smp_processor_id());
+ return -ENOMEM;
+ }
+
+ paddr = page_to_phys(pend_page);
+ pr_info("CPU%d: using LPI pending table @%pa\n", cpu, &paddr);
+ gic_data_rdist_cpu(cpu)->pend_page = pend_page;
+ return 0;
+}
+
static void its_cpu_init_lpis(void)
{
void __iomem *rbase = gic_data_rdist_rd_base();
@@ -1770,21 +1795,8 @@ static void its_cpu_init_lpis(void)
/* If we didn't allocate the pending table yet, do it now */
pend_page = gic_data_rdist()->pend_page;
- if (!pend_page) {
- phys_addr_t paddr;
-
- pend_page = its_allocate_pending_table(GFP_NOWAIT);
- if (!pend_page) {
- pr_err("Failed to allocate PENDBASE for CPU%d\n",
- smp_processor_id());
- return;
- }
-
- paddr = page_to_phys(pend_page);
- pr_info("CPU%d: using LPI pending table @%pa\n",
- smp_processor_id(), &paddr);
- gic_data_rdist()->pend_page = pend_page;
- }
+ if (!pend_page)
+ return;
/* Disable LPIs */
val = readl_relaxed(rbase + GICR_CTLR);
@@ -2603,7 +2615,7 @@ static int its_vpe_init(struct its_vpe *vpe)
return vpe_id;
/* Allocate VPT */
- vpt_page = its_allocate_pending_table(GFP_KERNEL);
+ vpt_page = its_allocate_pending_table(raw_smp_processor_id());
if (!vpt_page) {
its_vpe_id_free(vpe_id);
return -ENOMEM;
@@ -3350,6 +3362,16 @@ int __init its_init(struct fwnode_handle *handle, struct rdists *rdists,
if (err)
return err;
+ err = cpuhp_setup_state(CPUHP_BP_PREPARE_DYN, "irqchip/arm/gicv3:prepare",
+ its_alloc_pend_page, NULL);
+ if (err < 0) {
+ pr_warn("ITS: Can't register CPU-hoplug callback.\n");
+ return err;
+ }
+ err = its_alloc_pend_page(smp_processor_id());
+ if (err < 0)
+ return err;
+
list_for_each_entry(its, &its_nodes, entry)
has_v4 |= its->is_v4;
--
2.10.5
^ permalink raw reply related [flat|nested] 12+ messages in thread
* [4.14.66-rt TEST PATCH 3/3] irqchip/gic-v3-its: Move pending table allocation to init time
2018-08-31 19:20 ` [4.14.66-rt TEST PATCH 1/3] irqchip/gic-v3-its: Make its_lock a raw_spin_lock_t Grygorii Strashko
2018-08-31 19:20 ` [4.14.66-rt TEST PATCH 2/3] irqchip/gic-v3-its: Move ITS' ->pend_page allocation into an early CPU up hook Grygorii Strashko
@ 2018-08-31 19:20 ` Grygorii Strashko
1 sibling, 0 replies; 12+ messages in thread
From: Grygorii Strashko @ 2018-08-31 19:20 UTC (permalink / raw)
To: bigeasy, linux-rt-users; +Cc: Sekhar Nori, Steven Rostedt, LKML, Marc Zyngier
From: Marc Zyngier <marc.zyngier@arm.com>
Signed-off-by: Marc Zyngier <marc.zyngier@arm.com>
[bigeasy: backport commit effe377d415 ("irqchip/gic-v3-its: Move pending
table allocation to init time")]
Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
---
drivers/irqchip/irq-gic-v3-its.c | 79 +++++++++++++++++---------------------
include/linux/irqchip/arm-gic-v3.h | 1 +
2 files changed, 36 insertions(+), 44 deletions(-)
diff --git a/drivers/irqchip/irq-gic-v3-its.c b/drivers/irqchip/irq-gic-v3-its.c
index 23c5818..1aaa757 100644
--- a/drivers/irqchip/irq-gic-v3-its.c
+++ b/drivers/irqchip/irq-gic-v3-its.c
@@ -1446,7 +1446,7 @@ static void its_free_prop_table(struct page *prop_page)
get_order(LPI_PROPBASE_SZ));
}
-static int __init its_alloc_lpi_tables(void)
+static int __init its_alloc_lpi_prop_table(void)
{
phys_addr_t paddr;
@@ -1739,17 +1739,15 @@ static int its_alloc_collections(struct its_node *its)
return 0;
}
-static struct page *its_allocate_pending_table(unsigned int cpu)
+static struct page *its_allocate_pending_table(gfp_t gfp_flags)
{
struct page *pend_page;
- unsigned int order;
/*
* The pending pages have to be at least 64kB aligned,
* hence the 'max(LPI_PENDBASE_SZ, SZ_64K)' below.
*/
- order = get_order(max_t(u32, LPI_PENDBASE_SZ, SZ_64K));
- pend_page = alloc_pages_node(cpu_to_node(cpu), GFP_KERNEL | __GFP_ZERO,
- order);
+ pend_page = alloc_pages(gfp_flags | __GFP_ZERO,
+ get_order(max_t(u32, LPI_PENDBASE_SZ, SZ_64K)));
if (!pend_page)
return NULL;
@@ -1765,25 +1763,31 @@ static void its_free_pending_table(struct page *pt)
get_order(max_t(u32, LPI_PENDBASE_SZ, SZ_64K)));
}
-static int its_alloc_pend_page(unsigned int cpu)
+static int __init allocate_lpi_tables(void)
{
- struct page *pend_page;
- phys_addr_t paddr;
+ int err, cpu;
- pend_page = gic_data_rdist_cpu(cpu)->pend_page;
- if (pend_page)
- return 0;
+ err = its_alloc_lpi_prop_table();
+ if (err)
+ return err;
- pend_page = its_allocate_pending_table(cpu);
- if (!pend_page) {
- pr_err("Failed to allocate PENDBASE for CPU%d\n",
- smp_processor_id());
- return -ENOMEM;
+ /*
+ * We allocate all the pending tables anyway, as we may have a
+ * mix of RDs that have had LPIs enabled, and some that
+ * don't. We'll free the unused ones as each CPU comes online.
+ */
+ for_each_possible_cpu(cpu) {
+ struct page *pend_page;
+
+ pend_page = its_allocate_pending_table(GFP_NOWAIT);
+ if (!pend_page) {
+ pr_err("Failed to allocate PENDBASE for CPU%d\n", cpu);
+ return -ENOMEM;
+ }
+
+ gic_data_rdist_cpu(cpu)->pend_page = pend_page;
}
- paddr = page_to_phys(pend_page);
- pr_info("CPU%d: using LPI pending table @%pa\n", cpu, &paddr);
- gic_data_rdist_cpu(cpu)->pend_page = pend_page;
return 0;
}
@@ -1791,22 +1795,14 @@ static void its_cpu_init_lpis(void)
{
void __iomem *rbase = gic_data_rdist_rd_base();
struct page *pend_page;
+ phys_addr_t paddr;
u64 val, tmp;
- /* If we didn't allocate the pending table yet, do it now */
- pend_page = gic_data_rdist()->pend_page;
- if (!pend_page)
+ if (gic_data_rdist()->lpi_enabled)
return;
- /* Disable LPIs */
- val = readl_relaxed(rbase + GICR_CTLR);
- val &= ~GICR_CTLR_ENABLE_LPIS;
- writel_relaxed(val, rbase + GICR_CTLR);
-
- /*
- * Make sure any change to the table is observable by the GIC.
- */
- dsb(sy);
+ pend_page = gic_data_rdist()->pend_page;
+ paddr = page_to_phys(pend_page);
/* set PROPBASE */
val = (page_to_phys(gic_rdists->prop_page) |
@@ -1859,6 +1855,10 @@ static void its_cpu_init_lpis(void)
/* Make sure the GIC has seen the above */
dsb(sy);
+ gic_data_rdist()->lpi_enabled = true;
+ pr_info("GICv3: CPU%d: using LPI pending table @%pa\n",
+ smp_processor_id(),
+ &paddr);
}
static void its_cpu_init_collection(void)
@@ -2615,7 +2615,7 @@ static int its_vpe_init(struct its_vpe *vpe)
return vpe_id;
/* Allocate VPT */
- vpt_page = its_allocate_pending_table(raw_smp_processor_id());
+ vpt_page = its_allocate_pending_table(GFP_KERNEL);
if (!vpt_page) {
its_vpe_id_free(vpe_id);
return -ENOMEM;
@@ -3358,18 +3358,9 @@ int __init its_init(struct fwnode_handle *handle, struct rdists *rdists,
}
gic_rdists = rdists;
- err = its_alloc_lpi_tables();
- if (err)
- return err;
- err = cpuhp_setup_state(CPUHP_BP_PREPARE_DYN, "irqchip/arm/gicv3:prepare",
- its_alloc_pend_page, NULL);
- if (err < 0) {
- pr_warn("ITS: Can't register CPU-hoplug callback.\n");
- return err;
- }
- err = its_alloc_pend_page(smp_processor_id());
- if (err < 0)
+ err = allocate_lpi_tables();
+ if (err)
return err;
list_for_each_entry(its, &its_nodes, entry)
diff --git a/include/linux/irqchip/arm-gic-v3.h b/include/linux/irqchip/arm-gic-v3.h
index bacb499..688f256 100644
--- a/include/linux/irqchip/arm-gic-v3.h
+++ b/include/linux/irqchip/arm-gic-v3.h
@@ -568,6 +568,7 @@ struct rdists {
void __iomem *rd_base;
struct page *pend_page;
phys_addr_t phys_base;
+ bool lpi_enabled;
} __percpu *rdist;
struct page *prop_page;
int id_bits;
--
2.10.5
^ permalink raw reply related [flat|nested] 12+ messages in thread
end of thread, other threads:[~2018-09-06 7:39 UTC | newest]
Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-08-28 23:28 [4.14.66-rt40] [report][cpuhotplug] BUG: sleeping function called from invalid context at kernel/locking/rtmutex.c:974 Grygorii Strashko
2018-08-29 14:08 ` Sebastian Andrzej Siewior
2018-08-29 21:28 ` Grygorii Strashko
2018-08-30 1:57 ` Steven Rostedt
2018-08-30 9:14 ` Sebastian Andrzej Siewior
2018-08-31 19:19 ` Grygorii Strashko
2018-08-31 19:30 ` Sebastian Andrzej Siewior
2018-08-31 19:42 ` Grygorii Strashko
2018-09-06 7:39 ` Sebastian Andrzej Siewior
2018-08-31 19:20 ` [4.14.66-rt TEST PATCH 1/3] irqchip/gic-v3-its: Make its_lock a raw_spin_lock_t Grygorii Strashko
2018-08-31 19:20 ` [4.14.66-rt TEST PATCH 2/3] irqchip/gic-v3-its: Move ITS' ->pend_page allocation into an early CPU up hook Grygorii Strashko
2018-08-31 19:20 ` [4.14.66-rt TEST PATCH 3/3] irqchip/gic-v3-its: Move pending table allocation to init time Grygorii Strashko
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).