From patchwork Tue Jul 2 13:51:30 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christophe Leroy X-Patchwork-Id: 13719694 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 72CD0C3065C for ; Tue, 2 Jul 2024 13:52:49 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 0840A6B00D6; Tue, 2 Jul 2024 09:52:49 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 0354B6B00D7; Tue, 2 Jul 2024 09:52:48 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id E17136B00D8; Tue, 2 Jul 2024 09:52:48 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0017.hostedemail.com [216.40.44.17]) by kanga.kvack.org (Postfix) with ESMTP id BF2516B00D6 for ; Tue, 2 Jul 2024 09:52:48 -0400 (EDT) Received: from smtpin29.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay02.hostedemail.com (Postfix) with ESMTP id 76E4B1201E6 for ; Tue, 2 Jul 2024 13:52:48 +0000 (UTC) X-FDA: 82294953216.29.D348850 Received: from pegase1.c-s.fr (pegase1.c-s.fr [93.17.236.30]) by imf14.hostedemail.com (Postfix) with ESMTP id 10CC0100030 for ; Tue, 2 Jul 2024 13:52:45 +0000 (UTC) Authentication-Results: imf14.hostedemail.com; dkim=none; spf=pass (imf14.hostedemail.com: domain of christophe.leroy@csgroup.eu designates 93.17.236.30 as permitted sender) smtp.mailfrom=christophe.leroy@csgroup.eu; dmarc=pass (policy=quarantine) header.from=csgroup.eu ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1719928354; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=IeJ2s5BHwiaIokCY9RGe1Kq8pNvNZAfr2J7palaWQuc=; b=1vcORaYJR+vPa6h7ei7lQhC4LeoThemE0hFi0sCx6EfYVXwj5U1qJStyALqeZOJONnP1Bm vRA90WgYDx7SuZEqfHp8kGtKCfQCK0w1N65xJH4QPYN3aOd6E5BawOlG66g3SwXhjURKOW pApH+kpqv7nFic4hct4aLMO2s3niUSk= ARC-Authentication-Results: i=1; imf14.hostedemail.com; dkim=none; spf=pass (imf14.hostedemail.com: domain of christophe.leroy@csgroup.eu designates 93.17.236.30 as permitted sender) smtp.mailfrom=christophe.leroy@csgroup.eu; dmarc=pass (policy=quarantine) header.from=csgroup.eu ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1719928354; a=rsa-sha256; cv=none; b=c08nzUQ4QY6cBcVwVD7mtrmb+pxdjPLleUmjakl8M8y4EA8uXq80cWoKdhf4YbeOHWXMfr eq0SRtOH+wVhYhXTnJvFGMxreIu/NB8CwC8RMZTZV6zINh2tCEqEgCyuIUNYbWBrZ5twbo aGbtbYF65vNfJYLXrFbgEPDKaV+xKxg= Received: from localhost (mailhub3.si.c-s.fr [192.168.12.233]) by localhost (Postfix) with ESMTP id 4WD48L4787z9v3s; Tue, 2 Jul 2024 15:51:46 +0200 (CEST) X-Virus-Scanned: amavisd-new at c-s.fr Received: from pegase1.c-s.fr ([192.168.12.234]) by localhost (pegase1.c-s.fr [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id tD71Vn51syID; Tue, 2 Jul 2024 15:51:46 +0200 (CEST) Received: from messagerie.si.c-s.fr (messagerie.si.c-s.fr [192.168.25.192]) by pegase1.c-s.fr (Postfix) with ESMTP id 4WD4865kqdz9v7N; Tue, 2 Jul 2024 15:51:34 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by messagerie.si.c-s.fr (Postfix) with ESMTP id C0D818B774; Tue, 2 Jul 2024 15:51:34 +0200 (CEST) X-Virus-Scanned: amavisd-new at c-s.fr Received: from messagerie.si.c-s.fr ([127.0.0.1]) by localhost (messagerie.si.c-s.fr [127.0.0.1]) (amavisd-new, port 10023) with ESMTP id pWxGaw-G7BNY; Tue, 2 Jul 2024 15:51:34 +0200 (CEST) Received: from PO20335.idsi0.si.c-s.fr (unknown [192.168.233.12]) by messagerie.si.c-s.fr (Postfix) with ESMTP id 4D51F8B764; Tue, 2 Jul 2024 15:51:34 +0200 (CEST) From: Christophe Leroy To: Andrew Morton , Jason Gunthorpe , Peter Xu , Oscar Salvador , Michael Ellerman , Nicholas Piggin Cc: Christophe Leroy , linux-kernel@vger.kernel.org, linux-mm@kvack.org, linuxppc-dev@lists.ozlabs.org Subject: [PATCH v7 18/23] powerpc/e500: Don't pre-check write access on data TLB error Date: Tue, 2 Jul 2024 15:51:30 +0200 Message-ID: <8525518e1657d6032b7e980c1888102828d66950.1719928057.git.christophe.leroy@csgroup.eu> X-Mailer: git-send-email 2.44.0 In-Reply-To: References: MIME-Version: 1.0 X-Developer-Signature: v=1; a=ed25519-sha256; t=1719928275; l=1564; i=christophe.leroy@csgroup.eu; s=20211009; h=from:subject:message-id; bh=lXkJFaNOZfYs39NvzB2t7aMNQd5E4EiqpUUgx2rbgYk=; b=UfaTLsrzSij3pYXiv+ejHeSoRAerQa7OpK+kFzmvGET2VlKw+SFhPJdwxpiVLp8BycMHe75De Wk++EkSYFizC/zAfHU9AfP7o7tpmfuohonnxIu+luqjMTdYqXgBexcN X-Developer-Key: i=christophe.leroy@csgroup.eu; a=ed25519; pk=HIzTzUj91asvincQGOFx6+ZF5AoUuP9GdOtQChs7Mm0= X-Rspamd-Server: rspam11 X-Rspamd-Queue-Id: 10CC0100030 X-Stat-Signature: h38ac8d5ej5tqh5nzki1tfczssnqq5ua X-Rspam-User: X-HE-Tag: 1719928365-741788 X-HE-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deZ2Km1j6Bp39mwXJmYcrD9Z/uiUIBZvsuyspmSx2eynEs+x7AKC X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: Don't pre-check write access on read-only pages on data TLB error. Load the TLB anyway and take a DSI exception when it happens. This avoids reading SPRN_ESR at every data TLB error exception. Signed-off-by: Christophe Leroy --- v5: New --- arch/powerpc/kernel/head_85xx.S | 15 --------------- 1 file changed, 15 deletions(-) diff --git a/arch/powerpc/kernel/head_85xx.S b/arch/powerpc/kernel/head_85xx.S index a305244afc9f..282e49c51deb 100644 --- a/arch/powerpc/kernel/head_85xx.S +++ b/arch/powerpc/kernel/head_85xx.S @@ -472,27 +472,12 @@ END_BTB_FLUSH_SECTION #endif 4: - /* Mask of required permission bits. Note that while we - * do copy ESR:ST to _PAGE_WRITE position as trying to write - * to an RO page is pretty common, we don't do it with - * _PAGE_DIRTY. We could do it, but it's a fairly rare - * event so I'd rather take the overhead when it happens - * rather than adding an instruction here. We should measure - * whether the whole thing is worth it in the first place - * as we could avoid loading SPRN_ESR completely in the first - * place... - * - * TODO: Is it worth doing that mfspr & rlwimi in the first - * place or can we save a couple of instructions here ? - */ - mfspr r12,SPRN_ESR #ifdef CONFIG_PTE_64BIT li r13,_PAGE_PRESENT|_PAGE_BAP_SR oris r13,r13,_PAGE_ACCESSED@h #else li r13,_PAGE_PRESENT|_PAGE_READ|_PAGE_ACCESSED #endif - rlwimi r13,r12,11,29,29 FIND_PTE andc. r13,r13,r11 /* Check permission */