From patchwork Sat Mar 9 14:52:02 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gary Guo X-Patchwork-Id: 10845951 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id CECB41669 for ; Sat, 9 Mar 2019 14:52:16 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id AF2742BBEB for ; Sat, 9 Mar 2019 14:52:16 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id A20D72BC2E; Sat, 9 Mar 2019 14:52:16 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.2 required=2.0 tests=BAD_ENC_HEADER,BAYES_00, DKIM_SIGNED,DKIM_VALID,MAILING_LIST_MULTI,MISSING_HEADERS,RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 37D572BBEB for ; Sat, 9 Mar 2019 14:52:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:Message-ID:Date:Subject: From:Reply-To:To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References: List-Owner; bh=YH2el5IC6qA8d9RbVZsPJeyE57aIZtpY4Z3aLc4GyUk=; b=kvW3xV05iGT8zx 5DuhVE/dyUUY4tFZnoIc1Blz6qpTx94h4eQ188ObB3KyMdglIxNOczBaOC75V4lmMtnXFX7VbAVMT uMUTW0DFJQPe2oaTHp1nNRcab/lDU+kERzuSsd+AIkQiIlduJCrVLt1PxHDEM3vslKaWu6cjCNEs6 wIlNOPyWNqTJE4n9FsYSWKenrFK1bn1kkFxzW3K0CORlSjoawEfW0BjBuIDHU12tleDft3UTphhDn fZjmWQYxSvWy6l8ErJd69k1NF4EDPwBZGlVAK0X13CmIkvwkCYK3tkX8YCMBBWeRqyf3udR6nlUG6 ur7G6sYxItUN664W+TXw==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1h2dKe-00069T-7I; Sat, 09 Mar 2019 14:52:12 +0000 Received: from mail-eopbgr110109.outbound.protection.outlook.com ([40.107.11.109] helo=GBR01-CWL-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1h2dKa-00068V-89 for linux-riscv@lists.infradead.org; Sat, 09 Mar 2019 14:52:09 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=garyguo.net; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=sx1HmzPubYLeA1WZ/oPFwROd/pYFJO2VXPGT8sFAPhA=; b=kad4JeguS0M41QWqBxHNtT4WzPY62fltumiJJHhOM8TLi4rKrsQnfK9NRdzt750pIpOXnwkfA0IZ2Vm1uAME/Bxy5oqTEKW6p95Ef8ZPS7GjnDkwOZMTs3fHqwWYlpQI6qS675749n2rdTRhA29JB7JO+rdruYqvS4ThrVmUR3U= Received: from LO2P265MB0847.GBRP265.PROD.OUTLOOK.COM (20.176.139.20) by LO2P265MB0158.GBRP265.PROD.OUTLOOK.COM (10.166.98.23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1686.18; Sat, 9 Mar 2019 14:52:02 +0000 Received: from LO2P265MB0847.GBRP265.PROD.OUTLOOK.COM ([fe80::ed34:1290:4306:3157]) by LO2P265MB0847.GBRP265.PROD.OUTLOOK.COM ([fe80::ed34:1290:4306:3157%3]) with mapi id 15.20.1686.021; Sat, 9 Mar 2019 14:52:02 +0000 From: Gary Guo Subject: [PATCH v3 0/4] TLB/I$ flush cleanups and improvements Thread-Topic: [PATCH v3 0/4] TLB/I$ flush cleanups and improvements Thread-Index: AQHU1oenWGSdkatWs0K34ZGZqVyp6g== Date: Sat, 9 Mar 2019 14:52:02 +0000 Message-ID: Accept-Language: en-GB, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-clientproxiedby: LNXP123CA0015.GBRP123.PROD.OUTLOOK.COM (2603:10a6:600:d2::27) To LO2P265MB0847.GBRP265.PROD.OUTLOOK.COM (2603:10a6:600:8c::20) x-mailer: git-send-email 2.17.1 authentication-results: spf=none (sender IP is ) smtp.mailfrom=gary@garyguo.net; x-ms-exchange-messagesentrepresentingtype: 1 x-originating-ip: [2001:630:212:238:3697:f6ff:fe55:55b1] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: 4d7a8420-795f-4683-12a7-08d6a49eca13 x-microsoft-antispam: BCL:0; PCL:0; RULEID:(2390118)(7020095)(4652040)(7021145)(8989299)(4534185)(7022145)(4603075)(4627221)(201702281549075)(8990200)(7048125)(7024125)(7027125)(7023125)(5600127)(711020)(4605104)(2017052603328)(7153060)(7193020); SRVR:LO2P265MB0158; x-ms-traffictypediagnostic: LO2P265MB0158: x-microsoft-exchange-diagnostics: =?iso-8859-1?Q?1; LO2P265MB0158; 23:OpmvftmGu/RAZr4coV++BPXl6KX6kFANjP16GSj?= =?iso-8859-1?q?VnFSO+2hIw0/Y7z?= =?iso-8859-1?q?7LRl+0aR8rTryIGfwqEqXwDXLjEvqC6dUyuilfABowGQPWkFEnZm+4oazeYW?= =?iso-8859-1?q?eyklq8xMFK2RJ7JvnAP0gjXqltvnwcI+lxepW1Y3oJpBTz3RZrMWD5BaLZIc?= =?iso-8859-1?q?xJmYuy4M0enWiIAkAljNWLaQLCQj6UTetwVRv0EM38SDjqEV/fWirUPAiFju?= =?iso-8859-1?q?o5Y7nFYFEPyahB6zcI/hxqO3spElbAVr7l2c9zJlD/lSu26tOZOBqJ6RkByh?= =?iso-8859-1?q?EBxXpRyHQtdmEkIjNf2k8zUvX5PKMC+q9mFMQHQPxqZlagF9tIdqwi2gLDKS?= =?iso-8859-1?q?lFR+IEDH3K3G9FQi3D33zguFpiIR4XP/rva8lbzM4MvjMjeJMGOgoM24KI6i?= =?iso-8859-1?q?sWrtCU7ny53oDskCkqdlsztGsj2eGbzuPojof28aywWlTdsq+iaUWyxkOPSf?= =?iso-8859-1?q?CFmCIjcVvxBrO2LEAycN+sAsDjrCFHab1RM+o47yYU0LnmXcRtph88BN76JE?= =?iso-8859-1?q?Zueuao2bZtNfPrNHWxJJBvQzxtuCRUTwz8W+Q2MC4tu2E8x2XbomkDN+K8hQ?= =?iso-8859-1?q?A9JjUk8jsqJK5ITX5tElchBSsa4XWIDzNADfVnKlZUfqGgMmePS9sqVagnwF?= =?iso-8859-1?q?9UJZZQzcOn9uI5BGfwDp1mNR4UhMFA4WjBO8j4nt60NPEkQcKqOj0oyuum2z?= =?iso-8859-1?q?+uxnYyDSnfMTYmgU1iccPwRatQKxu4bnX3FFzjivQy0vd0YtzlDNhHL9E3rb?= =?iso-8859-1?q?NKgP/Wgulf3R+m9IEuXOQAK+hBC2PzXlsVdGsPnEkqH+ixgyXiCwCLKl2bOa?= =?iso-8859-1?q?m0m165ysvDpN9bjrFW6vahWkUunpBTL2q5gzmYycHJVt62R1jOItocZPW5YN?= =?iso-8859-1?q?M1xalBMQ+ifkpCkH80cIBGxlgKhR1Cgq9n/x+Bl7t/X5et0VwjlP7dysf5Sw?= =?iso-8859-1?q?spEP2UjQAizJMONS6FONmqDx382mMDBGkQcOkJwPSztT2HTo3D/S7dlS7AQF?= =?iso-8859-1?q?Fq3POAzkMHoiOpJK7sD37jWzo1rS0ur3Vw9+b2J48YJBx9TIYiMKdS45zqQE?= =?iso-8859-1?q?/DWD7PmJwY73KVZXEYycdfXj8YNtEFr0EF8v9wp/Ar0F/M6YrvHXe3M0RBeJ?= =?iso-8859-1?q?b4zOFiqzO0Rpvqpck9Hw2pS81eD2zpIjO2rxdrfQ=3D=3D?= x-microsoft-antispam-prvs: x-forefront-prvs: 0971922F40 x-forefront-antispam-report: SFV:NSPM; SFS:(10019020)(376002)(39830400003)(346002)(366004)(136003)(396003)(199004)(189003)(305945005)(53936002)(6116002)(8676002)(1671002)(102836004)(86362001)(508600001)(97736004)(52116002)(36756003)(14454004)(2906002)(99286004)(386003)(6506007)(7736002)(25786009)(81156014)(81166006)(4326008)(6436002)(6486002)(6512007)(2616005)(476003)(105586002)(68736007)(106356001)(71200400001)(71190400001)(186003)(486006)(8936002)(50226002)(5660300002)(256004)(109986005)(107886003)(54906003)(59246006)(316002)(46003); DIR:OUT; SFP:1102; SCL:1; SRVR:LO2P265MB0158; H:LO2P265MB0847.GBRP265.PROD.OUTLOOK.COM; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; A:1; MX:1; received-spf: None (protection.outlook.com: garyguo.net does not designate permitted sender hosts) x-ms-exchange-senderadcheck: 1 x-microsoft-antispam-message-info: Xg7KKnBNrvk5kku78Qpgs6S9HWznQFWGW76AQqZahSvBPQSo2PFdVStJ5MewmaMJ0xHa7QTZ0/ID2Su3aR4hpgv93zjaLlGQgvYvjiT5fgGrGSo/Yx6c7zdwBSnNSIXkb28T+HeIIX1Qy22i7LrXHtTC+clthxK+1Otos6qWcRkVDIsZ/CS8efd1zRe+MS/A33qBSvfls63Ww6nzI800WKcT/PoCy2Ra5El3+8gOoSXwkZ09dGlJjSMMzvdD0T4c3k4IRtGRurxJBVKZPpXdC++EkDCroSJ2NesMvAOUdhWCghHMJ2vVrhdfumvbA4Oz7274VHI+2nY5Zm6lXaOgcRm7gN6MrZWGFniBSW1mECZ+HRPOSU4uVSEJ+gpZLly5xh19lxHE6nsCXvj+XTiehlX9z0flPFacBzG5q7YGKIY= MIME-Version: 1.0 X-OriginatorOrg: garyguo.net X-MS-Exchange-CrossTenant-Network-Message-Id: 4d7a8420-795f-4683-12a7-08d6a49eca13 X-MS-Exchange-CrossTenant-originalarrivaltime: 09 Mar 2019 14:52:02.3750 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: bbc898ad-b10f-4e10-8552-d9377b823d45 X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-Transport-CrossTenantHeadersStamped: LO2P265MB0158 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190309_065208_333127_469738F0 X-CRM114-Status: UNSURE ( 7.73 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-riscv@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Palmer Dabbelt , Anup Patel , Christoph Hellwig , Atish Patra , Albert Ou , Gary Guo , "linux-riscv@lists.infradead.org" Sender: "linux-riscv" Errors-To: linux-riscv-bounces+patchwork-linux-riscv=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP From: Gary Guo Sorry, I didn't realised that there is a for-next branch and is basing my changes on top of master/HEAD instead. I've now rebased and fix a new reference of of local_flush_tlb_page. This patches does: 1. Move long and expensive functions aways from header files. 2. Fix missing arguments for SBI calls. 3. Performance improvements for TLB flush. Changes since v2: - Replace __setup with early_param - Rebase on top of for-next Changes since v1: - Use kernel boot parameters instead of Kconfig - Style fixes Gary Guo (4): riscv: move flush_icache_{all,mm} to cacheflush.c riscv: move switch_mm to its own file riscv: fix sbi_remote_sfence_vma{,_asid}. riscv: rewrite tlb flush for performance arch/riscv/include/asm/cacheflush.h | 2 +- arch/riscv/include/asm/mmu_context.h | 59 +------- arch/riscv/include/asm/pgtable.h | 2 +- arch/riscv/include/asm/sbi.h | 19 ++- arch/riscv/include/asm/tlbflush.h | 76 ++++------ arch/riscv/kernel/smp.c | 49 ------ arch/riscv/mm/Makefile | 2 + arch/riscv/mm/cacheflush.c | 61 ++++++++ arch/riscv/mm/context.c | 77 ++++++++++ arch/riscv/mm/init.c | 2 +- arch/riscv/mm/tlbflush.c | 216 +++++++++++++++++++++++++++ 11 files changed, 404 insertions(+), 161 deletions(-) create mode 100644 arch/riscv/mm/context.c create mode 100644 arch/riscv/mm/tlbflush.c