From mboxrd@z Thu Jan 1 00:00:00 1970 From: Grygorii Strashko Subject: Re: [v4.9-rt PATCH v2] ARM: mm: remove tasklist locking from update_sections_early() Date: Tue, 25 Apr 2017 15:22:37 -0500 Message-ID: References: <20170419201047.31578-1-grygorii.strashko@ti.com> <46862ce1-77d2-8e82-8820-64ec47957844@redhat.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii"; Format="flowed" Content-Transfer-Encoding: 7bit Cc: LKML , Sebastian Andrzej Siewior , Russell King , "linux-arm-kernel@lists.infradead.org" , linux-rt-users@vger.kernel.org To: Kees Cook , Laura Abbott Return-path: In-Reply-To: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=m.gmane.org@lists.infradead.org List-Id: linux-rt-users.vger.kernel.org On 04/21/2017 06:11 PM, Kees Cook wrote: > On Wed, Apr 19, 2017 at 5:36 PM, Laura Abbott wrote: >> On 04/19/2017 01:10 PM, Grygorii Strashko wrote: >>> >>> The below backtrace can be observed on -rt kernel with CONFIG_DEBUG_RODATA >>> option enabled: >>> >>> BUG: sleeping function called from invalid context at >>> kernel/locking/rtmutex.c:993 >>> in_atomic(): 1, irqs_disabled(): 128, pid: 14, name: migration/0 >>> 1 lock held by migration/0/14: >>> #0: (tasklist_lock){+.+...}, at: [] >>> update_sections_early+0x24/0xdc >>> irq event stamp: 38 >>> hardirqs last enabled at (37): [] >>> _raw_spin_unlock_irq+0x24/0x68 >>> hardirqs last disabled at (38): [] multi_cpu_stop+0xd8/0x138 >>> softirqs last enabled at (0): [] >>> copy_process.part.5+0x238/0x1b64 >>> softirqs last disabled at (0): [< (null)>] (null) >>> Preemption disabled at: [] cpu_stopper_thread+0x80/0x10c >>> CPU: 0 PID: 14 Comm: migration/0 Not tainted 4.9.21-rt16-02220-g49e319c >>> #15 >>> Hardware name: Generic DRA74X (Flattened Device Tree) >>> [] (unwind_backtrace) from [] (show_stack+0x10/0x14) >>> [] (show_stack) from [] (dump_stack+0xa8/0xd4) >>> [] (dump_stack) from [] (___might_sleep+0x1bc/0x2ac) >>> [] (___might_sleep) from [] >>> (__rt_spin_lock+0x1c/0x30) >>> [] (__rt_spin_lock) from [] (rt_read_lock+0x54/0x68) >>> [] (rt_read_lock) from [] >>> (update_sections_early+0x24/0xdc) >>> [] (update_sections_early) from [] >>> (__fix_kernmem_perms+0x10/0x1c) >>> [] (__fix_kernmem_perms) from [] >>> (multi_cpu_stop+0x100/0x138) >>> [] (multi_cpu_stop) from [] >>> (cpu_stopper_thread+0x88/0x10c) >>> [] (cpu_stopper_thread) from [] >>> (smpboot_thread_fn+0x174/0x31c) >>> [] (smpboot_thread_fn) from [] (kthread+0xf0/0x108) >>> [] (kthread) from [] (ret_from_fork+0x14/0x3c) >>> Freeing unused kernel memory: 1024K (c0d00000 - c0e00000) >>> >>> The stop_machine() is called with cpus = NULL from fix_kernmem_perms() and >>> mark_rodata_ro() which means only one CPU will execute >>> update_sections_early() while all other CPUs will spin and wait. Hence, >>> it's safe to remove tasklist locking from update_sections_early(). As part >>> of this change also mark functions which are local to this module as >>> static >> >> Acked-by: Laura Abbott > > Acked-by: Kees Cook > > Please throw this at the ARM patch tracker (with our Acks). > http://www.arm.linux.org.uk/developer/patches/info.php > Done http://www.arm.linux.org.uk/developer/patches/viewpatch.php?id=8672/1 -- regards, -grygorii