From mboxrd@z Thu Jan 1 00:00:00 1970 From: swarren@nvidia.com (Stephen Warren) Date: Tue, 14 Feb 2012 13:59:34 -0800 Subject: [PATCH] Optimize multi-CPU tlb flushing a little more In-Reply-To: <20120213165926.GA24426@debian> References: <20110823110602.GG19622@n2100.arm.linux.org.uk> <20120213162359.GC25655@n2100.arm.linux.org.uk> <20120213165926.GA24426@debian> Message-ID: <74CDBE0F657A3D45AFBB94109FB122FF178FACB6A1@HQMAIL01.nvidia.com> To: linux-arm-kernel@lists.infradead.org List-Id: linux-arm-kernel.lists.infradead.org Rabin Vincent wrote at Monday, February 13, 2012 9:59 AM: > On Mon, Feb 13, 2012 at 04:23:59PM +0000, Russell King - ARM Linux wrote: > > On Mon, Feb 13, 2012 at 09:36:35PM +0530, Rabin Vincent wrote: > > > This part conditionally calls get_cpu() but unconditionally calls > > > put_cpu(): > > > > Can you try getting rid of put_cpu(), and replacing get_cpu() > > with smp_processor_id(). > > > > In theory, this function should be called with preempt disabled so > > smp_processor_id() should be safe here. > > Just deleting put_cpu() and replacing get_cpu() with smp_processor_id() > doesn't cause any problems on my setup, because in my setup (v7 SMP) the > test for possible_tlb_flags fails so > cpu_mask_test_cpu(smp_processor_id(),...) never gets called. Aha, I should have searched harder for my stack trace... This thread describes the exact problem I just posted about a couple of hours ago, and Russell's suggested fix solves my problem. > However, local_flush_tlb_mm() itself does not appear to be called with > preemption disabled, because if I reverse the check so that > smp_processor_id() is called, I get loads of the following: I also tried that, and /don't/ see the following stack traces on Tegra, FWIW. > BUG: using smp_processor_id() in preemptible [00000000] code: init/1 > [] (unwind_backtrace+0x0/0xec) from [] (dump_stack+0x20/0x24) > [] (dump_stack+0x20/0x24) from [] (debug_smp_processor_id+0xc4/0xf8) > [] (debug_smp_processor_id+0xc4/0xf8) from [] (flush_tlb_mm+0x60/0x84) > [] (flush_tlb_mm+0x60/0x84) from [] (setup_arg_pages+0x260/0x39c) > [] (setup_arg_pages+0x260/0x39c) from [] (load_elf_binary+0x3ec/0x11d8) > [] (load_elf_binary+0x3ec/0x11d8) from [] (search_binary_handler+0xd8/0x2c8) > [] (search_binary_handler+0xd8/0x2c8) from [] (do_execve+0x29c/0x3b4) > [] (do_execve+0x29c/0x3b4) from [] (kernel_execve+0x48/0x90) > [] (kernel_execve+0x48/0x90) from [] (run_init_process+0x24/0x2c) > [] (run_init_process+0x24/0x2c) from [] (init_post+0x5c/0xd4) > [] (init_post+0x5c/0xd4) from [] (kernel_init+0x174/0x1ac) > > BUG: using smp_processor_id() in preemptible [00000000] code: modprobe/27 > [] (unwind_backtrace+0x0/0xec) from [] (dump_stack+0x20/0x24) > [] (dump_stack+0x20/0x24) from [] (debug_smp_processor_id+0xc4/0xf8) > [] (debug_smp_processor_id+0xc4/0xf8) from [] (flush_tlb_mm+0x60/0x84) > [] (flush_tlb_mm+0x60/0x84) from [] (exit_mmap+0x134/0x1e8) > [] (exit_mmap+0x134/0x1e8) from [] (mmput+0x60/0xf0) > [] (mmput+0x60/0xf0) from [] (exit_mm+0x124/0x12c) > [] (exit_mm+0x124/0x12c) from [] (do_exit+0x1e8/0x7b8) > [] (do_exit+0x1e8/0x7b8) from [] (do_group_exit+0x98/0xc4) > [] (do_group_exit+0x98/0xc4) from [] (__wake_up_parent+0x0/0x30) > [] (__wake_up_parent+0x0/0x30) from [] (ret_fast_syscall+0x0/0x3c) -- nvpublic