From patchwork Mon Jun 24 14:45:44 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christophe Leroy X-Patchwork-Id: 13709632 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 7074BC3064D for ; Mon, 24 Jun 2024 14:47:26 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 0748A8D0005; Mon, 24 Jun 2024 10:47:26 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 0236A8D0001; Mon, 24 Jun 2024 10:47:25 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id DE0648D0005; Mon, 24 Jun 2024 10:47:25 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0011.hostedemail.com [216.40.44.11]) by kanga.kvack.org (Postfix) with ESMTP id BF27C8D0001 for ; Mon, 24 Jun 2024 10:47:25 -0400 (EDT) Received: from smtpin11.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay08.hostedemail.com (Postfix) with ESMTP id 80E20140F5A for ; Mon, 24 Jun 2024 14:47:25 +0000 (UTC) X-FDA: 82266060450.11.8EDF76B Received: from pegase1.c-s.fr (pegase1.c-s.fr [93.17.236.30]) by imf23.hostedemail.com (Postfix) with ESMTP id 769B214000B for ; Mon, 24 Jun 2024 14:47:23 +0000 (UTC) Authentication-Results: imf23.hostedemail.com; dkim=none; dmarc=pass (policy=quarantine) header.from=csgroup.eu; spf=pass (imf23.hostedemail.com: domain of christophe.leroy@csgroup.eu designates 93.17.236.30 as permitted sender) smtp.mailfrom=christophe.leroy@csgroup.eu ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1719240432; a=rsa-sha256; cv=none; b=VI0v7yzZ9qFLamDzoku/rEMIddEP7S0MQYlWemLC0saOa4ZNjK1WubW9TMiknYC3050apa 6QFXOeITkvrNGLqIISb8gNOKE0VYSoBXE1Tfolo3pLiuN5gHB7usd53q3HRiRcBqwLVL1D G5i0Q2jg+TPy5t0zjJM5kge9Jb5xzMo= ARC-Authentication-Results: i=1; imf23.hostedemail.com; dkim=none; dmarc=pass (policy=quarantine) header.from=csgroup.eu; spf=pass (imf23.hostedemail.com: domain of christophe.leroy@csgroup.eu designates 93.17.236.30 as permitted sender) smtp.mailfrom=christophe.leroy@csgroup.eu ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1719240432; 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=WHg6qdXcytzr0ThcsSB2yAaOEqMXu0TFX9A3urZjpVn1ykw0EKv0Kx4Ayc5ieNsQG6TC2d qiVaXL59cgrOx6D0zm5plb2vi6a/EBxY/d8cxasZ6Bz5QbunCzz/0NhayHP4hhwRqMR6jH h2jKk6UbBAmX7gmEhqIl5Q4WXqEKQf0= Received: from localhost (mailhub3.si.c-s.fr [192.168.12.233]) by localhost (Postfix) with ESMTP id 4W79kz1BzYz9vDw; Mon, 24 Jun 2024 16:46:19 +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 ocvrzJb9juHC; Mon, 24 Jun 2024 16:46:19 +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 4W79kn1WMPz9vDm; Mon, 24 Jun 2024 16:46:09 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by messagerie.si.c-s.fr (Postfix) with ESMTP id 2E2458B766; Mon, 24 Jun 2024 16:46:09 +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 dEt0rYjXk4Lv; Mon, 24 Jun 2024 16:46:09 +0200 (CEST) Received: from PO20335.idsi0.si.c-s.fr (unknown [192.168.233.33]) by messagerie.si.c-s.fr (Postfix) with ESMTP id A58AF8B763; Mon, 24 Jun 2024 16:46:08 +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 v6 18/23] powerpc/e500: Don't pre-check write access on data TLB error Date: Mon, 24 Jun 2024 16:45:44 +0200 Message-ID: <93f8089c0b31b7ae5bd2e710b88daa38997bc7c7.1719240269.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=1719240334; l=1564; i=christophe.leroy@csgroup.eu; s=20211009; h=from:subject:message-id; bh=lXkJFaNOZfYs39NvzB2t7aMNQd5E4EiqpUUgx2rbgYk=; b=uYADfT1sIU7MymHjaLmUK2xiXH9x4ulsUJ7hsk2vWyNOLDDcJ+X0Y8ykHPQod8bG9icv3oVYn LmwcMfcmWxYCFHU57m4m2wDfUDZJ41I1BFGDKKCkor08bv2cziaaIu/ X-Developer-Key: i=christophe.leroy@csgroup.eu; a=ed25519; pk=HIzTzUj91asvincQGOFx6+ZF5AoUuP9GdOtQChs7Mm0= X-Rspamd-Server: rspam12 X-Rspamd-Queue-Id: 769B214000B X-Stat-Signature: x4q8ipisjpcspxtkfkjbosn1zat8y1pw X-Rspam-User: X-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7hPNjSQAmEG3KQs1uW8GEPb1FC0pFkNZxx9eUehA6xqrDdOrKXrK+T2UxdEjN4M4ACOHHP7qB9tWhIJuNrQIavGbKFPsDfJcB7aW+ 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 */