drivers: shs: Change allocation context of shs allocations within spin_lock
The allocation of the shs memory for cpu and flow level stats is done is
done in the atomic context due to the invocation of the spin_lock_irqsave which
disables preemption. Fixes the following-
230.251419: <6> sleeping function called from invalid context at mm/slab.h:422
230.277265: <6> in_atomic(): 1, irqs_disabled(): 128, pid: 62, name: kworker/6:0
230.277267: <2> INFO: lockdep is turned off.
230.284504: <2> irq event stamp: 90
230.284514: <2> hardirqs last enabled at (89): [<ffffff9ddee82594>] _raw_spin_unlock_irq+0x34/0x68
230.284517: <2> hardirqs last disabled at (90): [<ffffff9ddee7b5a8>] __schedule+0x138/0x1128
230.284524: <2> softirqs last enabled at (0): [<ffffff9ddd8b7f24>] copy_process+0x60c/0x1c28
230.284525: <2> softirqs last disabled at (0): [<0000000000000000>] (null)
230.284526: <4> Preemption disabled at:
230.284535: <2> [<ffffff9d7fa2b63c>] rmnet_shs_wq_process_wq+0x18c/0x350 [rmnet_shs]
230.288129: <6> ------------[ cut here ]------------
230.292958: <6> at kernel/sched/core.c:6786!
230.305980: <6> Internal error: Oops - BUG: 0 [#1] PREEMPT SMP
230.358297: <6> Process kworker/6:0 (pid: 62, stack limit = 0xffffff80083c0000)
230.365454: <6> CPU: 6 PID: 62 Comm: kworker/6:0 Tainted: G S O 4.19.81+ #1
230.379937: <6> Workqueue: rmnet_shs_wq rmnet_shs_wq_process_wq [rmnet_shs]
230.386741: <2> pc : ___might_sleep+0x204/0x208
230.401745: <2> lr : ___might_sleep+0x204/0x208
230.598414: <2> Call trace:
230.598419: <2> ___might_sleep+0x204/0x208
230.598420: <2> __might_sleep+0x50/0x88
230.598423: <2> kmem_cache_alloc_trace+0x74/0x420
230.598430: <2> rmnet_shs_wq_cpu_caps_list_add+0x64/0x118 [rmnet_shs]
230.598433: <2> rmnet_shs_wq_update_stats+0x4dc/0xea0 [rmnet_shs]
230.598435: <2> rmnet_shs_wq_process_wq+0x194/0x350 [rmnet_shs]
230.598438: <2> process_one_work+0x328/0x6b0
230.598439: <2> worker_thread+0x330/0x4d0
230.598441: <2> kthread+0x128/0x138
230.598443: <2> ret_from_fork+0x10/0x1c
Also fixes structure padding of shared mem structs, which was causing memcpy overrun.
CRs-Fixed: 2570479
Change-Id: Ia58b0bee544afb030353ad1d3cd45d8c16a94f75
Signed-off-by: Subash Abhinov Kasiviswanathan <subashab@codeaurora.org>
3 files changed