From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.1 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4F799C433DF for ; Mon, 27 Jul 2020 12:37:44 +0000 (UTC) Received: from lists.ozlabs.org (lists.ozlabs.org [203.11.71.2]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id F24D520714 for ; Mon, 27 Jul 2020 12:37:43 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=ellerman.id.au header.i=@ellerman.id.au header.b="RMjOSeS5" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org F24D520714 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=ellerman.id.au Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=linuxppc-dev-bounces+linuxppc-dev=archiver.kernel.org@lists.ozlabs.org Received: from bilbo.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 4BFfTf1lXPzF1Pn for ; Mon, 27 Jul 2020 22:37:42 +1000 (AEST) Received: from ozlabs.org (bilbo.ozlabs.org [203.11.71.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 4BFfQv4vnfzDqwg for ; Mon, 27 Jul 2020 22:35:19 +1000 (AEST) Authentication-Results: lists.ozlabs.org; dmarc=none (p=none dis=none) header.from=ellerman.id.au Authentication-Results: lists.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=ellerman.id.au header.i=@ellerman.id.au header.a=rsa-sha256 header.s=201909 header.b=RMjOSeS5; dkim-atps=neutral Received: from authenticated.ozlabs.org (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by mail.ozlabs.org (Postfix) with ESMTPSA id 4BFfQv2rRjz9sPB; Mon, 27 Jul 2020 22:35:19 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ellerman.id.au; s=201909; t=1595853319; bh=VW535eLE0IS10Lj1UNv1vamKShQhHMZ7sokiUzcPGzE=; h=From:To:Cc:Subject:In-Reply-To:References:Date:From; b=RMjOSeS5E06avd2/fouqEOSPd/yO/k75J9iwzhpDTHxteq7DxF54O3ZeJ0H8nvJte h+M2UYn9OaUXJnyKA0eyikfpH/YzrBQ8sS/8K5CYkB8Nv4AS2h7BO266D9MPqUz7Zz 2l2PNoN0eNv2BQzeJmA3oLu+dSCvLHO3/qrqyP5GJSMKQNnMIlfQDEijJjP9iQ+oAO a3j6CAa+3O7hejF/g/m8+qVLNKnw5BqNVdYYnG+ViIayGywBOskpZoZLyTdDdYtSXX /b+5qR/7afeAFRW4HYRJ7YEIOhNC6mbnyMeEFn6o7C8uOHR8P4xCYLkwZKQhlTk8Vp rF4WTWHQ21SRg== From: Michael Ellerman To: Athira Rajeev , Nicholas Piggin Subject: Re: [PATCH] powerpc/64s/hash: Fix hash_preload running with interrupts enabled In-Reply-To: <4925309C-A338-4C0F-90E3-4522643021CB@linux.vnet.ibm.com> References: <20200727060947.10060-1-npiggin@gmail.com> <4925309C-A338-4C0F-90E3-4522643021CB@linux.vnet.ibm.com> Date: Mon, 27 Jul 2020 22:35:18 +1000 Message-ID: <87k0yp6sqh.fsf@mpe.ellerman.id.au> MIME-Version: 1.0 Content-Type: text/plain X-BeenThere: linuxppc-dev@lists.ozlabs.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: "Aneesh Kumar K . V" , linuxppc-dev Errors-To: linuxppc-dev-bounces+linuxppc-dev=archiver.kernel.org@lists.ozlabs.org Sender: "Linuxppc-dev" Athira Rajeev writes: >> On 27-Jul-2020, at 11:39 AM, Nicholas Piggin wrote: >> >> Commit 2f92447f9f96 ("powerpc/book3s64/hash: Use the pte_t address from the >> caller") removed the local_irq_disable from hash_preload, but it was >> required for more than just the page table walk: the hash pte busy bit is >> effectively a lock which may be taken in interrupt context, and the local >> update flag test must not be preempted before it's used. >> >> This solves apparent lockups with perf interrupting __hash_page_64K. If >> get_perf_callchain then also takes a hash fault on the same page while it >> is already locked, it will loop forever taking hash faults, which looks like >> this: >> >> cpu 0x49e: Vector: 100 (System Reset) at [c00000001a4f7d70] >> pc: c000000000072dc8: hash_page_mm+0x8/0x800 >> lr: c00000000000c5a4: do_hash_page+0x24/0x38 >> sp: c0002ac1cc69ac70 >> msr: 8000000000081033 >> current = 0xc0002ac1cc602e00 >> paca = 0xc00000001de1f280 irqmask: 0x03 irq_happened: 0x01 >> pid = 20118, comm = pread2_processe >> Linux version 5.8.0-rc6-00345-g1fad14f18bc6 >> 49e:mon> t >> [c0002ac1cc69ac70] c00000000000c5a4 do_hash_page+0x24/0x38 (unreliable) >> --- Exception: 300 (Data Access) at c00000000008fa60 __copy_tofrom_user_power7+0x20c/0x7ac >> [link register ] c000000000335d10 copy_from_user_nofault+0xf0/0x150 >> [c0002ac1cc69af70] c00032bf9fa3c880 (unreliable) >> [c0002ac1cc69afa0] c000000000109df0 read_user_stack_64+0x70/0xf0 >> [c0002ac1cc69afd0] c000000000109fcc perf_callchain_user_64+0x15c/0x410 >> [c0002ac1cc69b060] c000000000109c00 perf_callchain_user+0x20/0x40 >> [c0002ac1cc69b080] c00000000031c6cc get_perf_callchain+0x25c/0x360 >> [c0002ac1cc69b120] c000000000316b50 perf_callchain+0x70/0xa0 >> [c0002ac1cc69b140] c000000000316ddc perf_prepare_sample+0x25c/0x790 >> [c0002ac1cc69b1a0] c000000000317350 perf_event_output_forward+0x40/0xb0 >> [c0002ac1cc69b220] c000000000306138 __perf_event_overflow+0x88/0x1a0 >> [c0002ac1cc69b270] c00000000010cf70 record_and_restart+0x230/0x750 >> [c0002ac1cc69b620] c00000000010d69c perf_event_interrupt+0x20c/0x510 >> [c0002ac1cc69b730] c000000000027d9c performance_monitor_exception+0x4c/0x60 >> [c0002ac1cc69b750] c00000000000b2f8 performance_monitor_common_virt+0x1b8/0x1c0 >> --- Exception: f00 (Performance Monitor) at c0000000000cb5b0 pSeries_lpar_hpte_insert+0x0/0x160 >> [link register ] c0000000000846f0 __hash_page_64K+0x210/0x540 >> [c0002ac1cc69ba50] 0000000000000000 (unreliable) >> [c0002ac1cc69bb00] c000000000073ae0 update_mmu_cache+0x390/0x3a0 >> [c0002ac1cc69bb70] c00000000037f024 wp_page_copy+0x364/0xce0 >> [c0002ac1cc69bc20] c00000000038272c do_wp_page+0xdc/0xa60 >> [c0002ac1cc69bc70] c0000000003857bc handle_mm_fault+0xb9c/0x1b60 >> [c0002ac1cc69bd50] c00000000006c434 __do_page_fault+0x314/0xc90 >> [c0002ac1cc69be20] c00000000000c5c8 handle_page_fault+0x10/0x2c >> --- Exception: 300 (Data Access) at 00007fff8c861fe8 >> SP (7ffff6b19660) is in userspace >> >> Reported-by: Athira Rajeev >> Reported-by: Anton Blanchard >> Reviewed-by: Aneesh Kumar K.V >> Fixes: 2f92447f9f96 ("powerpc/book3s64/hash: Use the pte_t address from the >> caller") >> Signed-off-by: Nicholas Piggin > > > Hi, > > Tested with the patch and it fixes the lockups I was seeing with my test run. > Thanks for the fix. > > Tested-by: Athira Rajeev Thanks for testing. What test are you running? cheers