From patchwork Tue Jul 18 07:56:17 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alistair Popple X-Patchwork-Id: 13316829 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 4B61BEB64DD for ; Tue, 18 Jul 2023 07:57:05 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id E00AA6B0078; Tue, 18 Jul 2023 03:57:04 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id DB1CA6B007B; Tue, 18 Jul 2023 03:57:04 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id C78A06B007D; Tue, 18 Jul 2023 03:57:04 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0012.hostedemail.com [216.40.44.12]) by kanga.kvack.org (Postfix) with ESMTP id BA3916B0078 for ; Tue, 18 Jul 2023 03:57:04 -0400 (EDT) Received: from smtpin23.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay08.hostedemail.com (Postfix) with ESMTP id 83BD11401DE for ; Tue, 18 Jul 2023 07:57:04 +0000 (UTC) X-FDA: 81023976768.23.A64ED85 Received: from NAM12-MW2-obe.outbound.protection.outlook.com (mail-mw2nam12on2068.outbound.protection.outlook.com [40.107.244.68]) by imf19.hostedemail.com (Postfix) with ESMTP id 8957C1A0004 for ; Tue, 18 Jul 2023 07:57:01 +0000 (UTC) Authentication-Results: imf19.hostedemail.com; dkim=pass header.d=Nvidia.com header.s=selector2 header.b=RdSTji4g; spf=pass (imf19.hostedemail.com: domain of apopple@nvidia.com designates 40.107.244.68 as permitted sender) smtp.mailfrom=apopple@nvidia.com; dmarc=pass (policy=reject) header.from=nvidia.com; arc=pass ("microsoft.com:s=arcselector9901:i=1") ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1689667021; 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-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=t/1ZlJ6hZJaDce6b/fep0UVd3G4r1VZkyBk0pDLwBXk=; b=nczlIc0hKcrNJQWOov0/i4p16oOKXVSi3zd0eIjDrKxjX7j8hKiTG0g3pciDY18lWnc5Q7 TrjzO1ucCm3505qSINd8yB8Ul/0VO5gctwamfS+eJRvzLTGx1NBrlEVuT84nMS68nFr0rm q24xsnjCSrL1gyXpCFq9hwyYniGfrvo= ARC-Seal: i=2; s=arc-20220608; d=hostedemail.com; t=1689667021; a=rsa-sha256; cv=pass; b=ayKlApt6dz0hMO9P7RBX2zMKtFdQmBgfEbeqxlinRz38nNI2Lw1hGN+CTwJz4u0175e2dC VJb/7aRJR3aHFeNO7MXXENLrzncq8Nncus5alIGXyLPN6+iF5VUEoNigs3yOIJJhQXM/7z ilo19kwmgndveQIFMnnaWeTOcKV4ZaQ= ARC-Authentication-Results: i=2; imf19.hostedemail.com; dkim=pass header.d=Nvidia.com header.s=selector2 header.b=RdSTji4g; spf=pass (imf19.hostedemail.com: domain of apopple@nvidia.com designates 40.107.244.68 as permitted sender) smtp.mailfrom=apopple@nvidia.com; dmarc=pass (policy=reject) header.from=nvidia.com; arc=pass ("microsoft.com:s=arcselector9901:i=1") ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=fr3Db1Q1p86dTkyi183SVLGv+4fFxb/Rmr44HlOcUK7xvqt5YCMV4YMyHJC0BHYKc3hx2PPCfidTj2rDb6y8k2i5zTB9d3c5RAbf1Be7X48Is98kHcrqd2TCIqmewg4JC7d+Hf7T4kZ5VhcYspoKTsavB/syuFbTl6FEHlN0DfYb/4Uogko5f0DWWWiK4ne00Z95/0k9t2RdJAaebBrquFE3T8RhCRI9K7dkrbp8xNKe3P1LaH7OkyISp+ONlBgbWZDGx1QsNNavbQ51iZULdp1AfXXA0Az8zyqak4WNfP2eyHkFCUCx74nDjyRB5K1pBEnjyoKSGbwxbYzStHscgQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=t/1ZlJ6hZJaDce6b/fep0UVd3G4r1VZkyBk0pDLwBXk=; b=aqBnfrlvs8g6RMbX5cGrapxq0oZIhp/5u7XQZ0lZCU0G1kyI2ni95uLj3H/3L4qrFoHseeP14xvrXCC29z3/ppork5gtXbIJnY8DZkrKWSAPKzEEYoWqsGfCxUsZTuNo03MDGUdvQGjct25n5uDZK6UeuKqj8jlAWkeLkPBS+hx4F8cUOw7/EC7lkWGE2CmJoNlS3QBeHd/zECGUxYtT5GwUYiDIF6V53zxvq+j8nICXGHNknZCXSIqlghphi0k4WgERONSX5fQ6ISUqUreInK/olAE6CObSa2rOI8+zDyqe+pqQA8V0uqc0xO75bhB+PBw8rKHzWejpdemnZfH+EQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nvidia.com; dmarc=pass action=none header.from=nvidia.com; dkim=pass header.d=nvidia.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Nvidia.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=t/1ZlJ6hZJaDce6b/fep0UVd3G4r1VZkyBk0pDLwBXk=; b=RdSTji4gs12tJW++2iqykAh3y+LCjIMoMYtA1XKQ3ItbGQduuJ4pzafCqqoS4Bj08Qd4qQepMMkNh7HddA0VwJ/zi0/ll08CgT3rOJc0J9W0guak0lp4SgVbx86jhi4H6VMnw6Oh7aVN0gPdUGdXR37JRCVaTn2Yx3prILOqpHxQaEfQNXnMMQ/9whJsr3GyhOZiEtNr88eIxyVH3XOQ681jOjS9598d3P43Wx6JsWkiTwdCETeVxfmit71jmmHOor+Xw2gEMKD9O1r6Dfl8sSPWzhg2yw9GChVmowIO2RO7q2f+ccs3kv6HjfisF354Fh84KdnLjO1KvJXOMyRHvg== Received: from BYAPR12MB3176.namprd12.prod.outlook.com (2603:10b6:a03:134::26) by PH7PR12MB8180.namprd12.prod.outlook.com (2603:10b6:510:2b6::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6565.32; Tue, 18 Jul 2023 07:56:58 +0000 Received: from BYAPR12MB3176.namprd12.prod.outlook.com ([fe80::cd5e:7e33:c2c9:fb74]) by BYAPR12MB3176.namprd12.prod.outlook.com ([fe80::cd5e:7e33:c2c9:fb74%7]) with mapi id 15.20.6588.031; Tue, 18 Jul 2023 07:56:58 +0000 From: Alistair Popple To: akpm@linux-foundation.org Cc: ajd@linux.ibm.com, catalin.marinas@arm.com, fbarrat@linux.ibm.com, iommu@lists.linux.dev, jgg@ziepe.ca, jhubbard@nvidia.com, kevin.tian@intel.com, kvm@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org, linuxppc-dev@lists.ozlabs.org, mpe@ellerman.id.au, nicolinc@nvidia.com, npiggin@gmail.com, robin.murphy@arm.com, seanjc@google.com, will@kernel.org, x86@kernel.org, zhi.wang.linux@gmail.com, Alistair Popple Subject: [PATCH 3/4] mmu_notifiers: Call arch_invalidate_secondary_tlbs() when invalidating TLBs Date: Tue, 18 Jul 2023 17:56:17 +1000 Message-Id: <791a6c1c4a79de6f99bffc594b53a39a6234e87f.1689666760.git-series.apopple@nvidia.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: References: X-ClientProxiedBy: SY5PR01CA0082.ausprd01.prod.outlook.com (2603:10c6:10:1f5::13) To BYAPR12MB3176.namprd12.prod.outlook.com (2603:10b6:a03:134::26) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BYAPR12MB3176:EE_|PH7PR12MB8180:EE_ X-MS-Office365-Filtering-Correlation-Id: 10ac55c0-0b87-41be-7dc8-08db87649017 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: d1R9HuDA+yMQ5Wua+eTSXXiX8nQzHqTrYo6f/pwpzYfA3BI22tEBKnkKDDHkAH+yGyBqZ9o27F19qDhg0W68X8ypetqlz+aE6u566GKGmvN4qvVnqAwUI9q6sMkSaBET+/dwzuoTDLrPXH3YIi2MJSQSJEnNMTKrP1HZw40Ir21u4Ax+MzQmfo7z4sxCPbxfk+h6DYN2SvHaNmhybqvkz7gdyoq6ciCvTW62yORcBizgltMZSR4ekn9IU4ENmGaEcbxyBy4pvjXcxinJvV8RbGWShJjUcyL1ySRvp7n6YP6w/SykOCAruvjNGVxLH2jBUKEzhG7WY/1E9rCQBHMniojF9q9gbsm+PrBZQ6L9c6g81guhpW7JuG9a6QU51OFe2XxNL5wX/coCvmq9sL/slerNmT8z2ooozkh0O7hwLQR+YAGNAxB8BS9uHaZ26fBg8blJHPwqGrEdVetEzfcjnNKbsQjRcfzndleArLMQDljVrqjKlZxvI9nRVDwCdQEv3vprFblG4f/SrQFRuwwQY/XvdcrEQw0DFbY25bry0hNR5UB1yKMUuBjD8wtZFetANuikqzsb2iuW37xeushnuOlR9ME2WxgWc3JQy9eOmn0= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:BYAPR12MB3176.namprd12.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230028)(4636009)(39860400002)(366004)(136003)(346002)(376002)(396003)(451199021)(86362001)(38100700002)(36756003)(66946007)(478600001)(5660300002)(26005)(41300700001)(107886003)(8676002)(186003)(6506007)(6512007)(8936002)(7416002)(2906002)(66556008)(2616005)(6916009)(83380400001)(6666004)(316002)(4326008)(6486002)(66476007)(473944003);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: mGy4p9tjl0pFCXp3m+7JZ4PP7jfYckvqyOl/4+CKlw8tRr1xYSBznwgsstqDwNcgtb3+AJJ39boMSMNQpa7S5tmHm3J7l3DXlw55DhbWDCSNyT26yqNdlPpgZG0mxdKHeRVgXnVd5di8hK4PQlm7uzgFrfj4f59B+HnDQnieCB0lTG6EuQrtc/WdiSq8NEnm7x42GCABie/3DJ/rv3txMUSvoXK+4XYROxazw1k2WxUA6p4e5O98wliS4QQfWncFhEz0VncpXlf/jwY/7FBIo7YNa63ad+DCBqZ3zdRR2bT9EaepHGOegFO7wVI0pbOsU6cygtskrOlnIF6xtu/OH0mqWVAmGBYC51gUqY5S5Ay211mhlG5fgdBzGVqdtnoma3I1LWX/g1VvuTBjFTL8I7z3i0BWynJcUWFesu0XZ5sd3ydp38Jche7WAi6JvyAmZEqKV0tJMZYb+SRr+NECkDWkfD0qJgK/asITLafx6QraJu4fHGnxF6x4NbQEdbBvYQ1hgchi55wCveJ3PDyCQtMnEggzPh6vTO5SUPSqipNEZFV8Qr3AlXSDBQ117IcLp1AfbpytsZpduUqac2zQOuPJgZUHrSqv8B+99DTxNahKdAQ5BSOD65tKKkFla0yBzxp7IO+coScBnq2baFT9isHO4k/3IPu+4h7XCgm0WnYPFarbeUJJIKWM09LmyUxA/avKYBqtF+0aqsT6f8wC1+IKhgX79BMXz8hYQUWvlYzJMhWi5cApCOZGSgHoitB+HuxXkvsdeRprG+2S9toxgHAmZrfN2Su3ILYjy2Vl61n6BBZGgLN/ifEvmjuSewJbHKkFjpY8ApZC7IN1IT0l2Wty2Hkf4BAcd2vkIq49+A7iRTDV7y/gqhj8tWWBjc7TNhyiN2Ut1jTJc5oF5yH2g49nzpZhtzoGVg+qra6cDZKhTrIdL3TajI81rMQM5EK3txeHUWuCv/K3xkhQ3pmlnH47t+7EVjDF0wWxKlJE/RLFsgvFsqOwfnAQw59SwRrFNOlLDbMnNcTF6J/xTVsz4p3DCC7ydvfL/s6qxOeyWZsrTKsH+lxMw4+gfuSpOe6z0qeMe8nPPDOe82qCgMKUVJD7N20eHe+2VlNspL2ISfw+0USqNvWkru0WnD90JYOmgzup5mrcarA6oiWfSKmsuZ5Rr1i5huuK7IBrYrmp8/m2jBX0btOJ84PFXSne8r/7kQS+X4MwaBqQWjd/hTgE/Yao47JdGJ2pQc7CisECVTFUG2msBSsElIHAyMGdPY0HMHA1z+iDqCaiELhn0xwfcg9FoaNdGjgFPfC9uN8R0l12WK551mNLFRMtK7nFilbfczRcMusmwAlAdazRr4BbWzZTf5AbfEOTMnrJmJ/zVZZ4wfAmXscOeqIDBn5PgDONDEjooEzApgHAfgBjD0TNSg+h13HrxEKktP++saIVppzDuu34YztUT+HYiA0xnxB05XlWMSKarhShy1xxLxCoLczR6RwGu/KGziF6XfXNKjh97d33BQ7GMAxCa8GdlGqnqfugzlzgkMSJhgS4TY5QVfVzmkTHr+yLU9o4TshrTxc+jOpA+lCT6f+sWKeRkL7M X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-Network-Message-Id: 10ac55c0-0b87-41be-7dc8-08db87649017 X-MS-Exchange-CrossTenant-AuthSource: BYAPR12MB3176.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 18 Jul 2023 07:56:58.8316 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: b5oQkw+iskrQNiL2SgbsA1/hfrC74KIshAqfJ0Uf3hs3nzpb3cpHxpQ9kdS64USkXUoOF9lJUv7Uyn4nmG7nlA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH7PR12MB8180 X-Rspamd-Queue-Id: 8957C1A0004 X-Rspam-User: X-Stat-Signature: xoanzexutzd4rimhw6a433trwwmyydar X-Rspamd-Server: rspam03 X-HE-Tag: 1689667021-318547 X-HE-Meta: U2FsdGVkX1+H5BtKipf2jiseFaGNpRTUZVtqsgt++V3J/LDYwXn+627JMbFKzRmy22etZEWfkuDkI41OEPkB2gJUroidQZocMO3YGEWPZB7zbHms6DZokm+rmDGlKq0pgNr5z1STnJfR5KUuwx4eHpTeKhJhUN7YlpO3yAbOdCMbLdh6A4PPJ02X9fSwDKrV93zyKEX+2gMs2K781dWtugb3fDxJiktSX8+aq3KSg4UN2/nMW0jqBddeQ8gc5AeJ5cQdKmQbafRj3irWgK09kfEP+OHua9PnhmfkV/gRCqU7M80vXqZWV34Dm6BIXNFS5WjUj47RiCwHb2RKMGnZZ8DmlrCA9+vwwzMhmEKetzG2vERH9Q+HNwLxkcjTZDYk9X6mqMhnJAWctws5ZVg/PX2nY1Dw0jRoU2glCB/KaagZsmyi2Py0qiaLKafmpfiBzMfPsudJ9xMyhvU5BlBxGut6FIocE8ZVQ+ztOE/FLVNpoD+q5tmjzshcBJSag4chm21R9XhzuxTeJsucEX7gY3Lr9NZlzS1x8Xw1fPvbKwv2ir60Bc4wpsvcZI2L6NhBkOfqmfSuDIPkobcf8dzT2Wo638mdfMBgBb2fGUryyKd7jFHudQ2RsqnC8bGjaH0PvNyF0wMaQ/SzBDiKsQC+oZvOhAtyfyKMuxwtP5RIR2nm5Zw9JvNj6PfqxeQos3AXPwmqqj7Du0x8iOrmTikeKVjdLURlZQS9G4gfVeEWMjn6nV1FSlbbCejPal850sM9Sw65ZYLJYcwmbvDwnyFfhsylPZj8/qzvNlP2VK3goVFaK/S2JlHC6tTdntUcAbtuZopsaowmkMU15MhOf02xqgJGls87thVLlpNb/QUuV+E94wHB755z5hMBNKh9EJgyXSrLtaauzym1LnL3x3Wg14RWXn1w1IB4b3kOvEidvGBaTzl10tRnu76u/80iVDgRYH5arO6F71rN4i0JfN1 wTc1qjM1 0axmawsYDrSau40p/LYzopltX0hQiXUnLSQVMtOoo0Aa0A5+zifLx7pSqTdzfDMQL52QrR/dj1tEP6CKcHI5CcOKV2/7gPn8sGDNh2x413DlgKM6g4+a3OAGiTg4rCD5w8zl/p7ZQx9US9fwNuSTv/wwHVgXTq8qMn7HWcuhoiP0ZrCmsZ4pbJOzowBBIgix43tTTi4s2QF9zXuAC4/OweYz8RbeCc0nVA4WTJa687IdNT0c6JsNwbeEQ3wyIu+pdkEoR6GzA3se/cYg0OR/lHmes6z7JsziCa55EI5sFDVjlyH74JmTiDuKROHsAwKjyKBMRjxtVuj7jJCye82P4AZjLdyod7NviL6U1aEealwqcWkx5i0aQG3GIWPRQ65AS1UgkhDYEthHAztw5AjKrciDsUQ== 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: The arch_invalidate_secondary_tlbs() is an architecture specific mmu notifier used to keep the TLB of secondary MMUs such as an IOMMU in sync with the CPU page tables. Currently it is called from separate code paths to the main CPU TLB invalidations. This can lead to a secondary TLB not getting invalidated when required and makes it hard to reason about when exactly the secondary TLB is invalidated. To fix this move the notifier call to the architecture specific TLB maintenance functions for architectures that have secondary MMUs requiring explicit software invalidations. This fixes a SMMU bug on ARM64. On ARM64 PTE permission upgrades require a TLB invalidation. This invalidation is done by the architecutre specific ptep_set_access_flags() which calls flush_tlb_page() if required. However this doesn't call the notifier resulting in infinite faults being generated by devices using the SMMU if it has previously cached a read-only PTE in it's TLB. Moving the invalidations into the TLB invalidation functions ensures all invalidations happen at the same time as the CPU invalidation. The architecture specific flush_tlb_all() routines do not call the notifier as none of the IOMMUs require this. Signed-off-by: Alistair Popple Suggested-by: Jason Gunthorpe --- arch/arm64/include/asm/tlbflush.h | 5 +++++ arch/powerpc/include/asm/book3s/64/tlbflush.h | 1 + arch/powerpc/mm/book3s64/radix_hugetlbpage.c | 1 + arch/powerpc/mm/book3s64/radix_tlb.c | 6 ++++++ arch/x86/mm/tlb.c | 2 ++ include/asm-generic/tlb.h | 1 - 6 files changed, 15 insertions(+), 1 deletion(-) diff --git a/arch/arm64/include/asm/tlbflush.h b/arch/arm64/include/asm/tlbflush.h index 412a3b9..386f0f7 100644 --- a/arch/arm64/include/asm/tlbflush.h +++ b/arch/arm64/include/asm/tlbflush.h @@ -13,6 +13,7 @@ #include #include #include +#include #include #include @@ -252,6 +253,7 @@ static inline void flush_tlb_mm(struct mm_struct *mm) __tlbi(aside1is, asid); __tlbi_user(aside1is, asid); dsb(ish); + mmu_notifier_arch_invalidate_secondary_tlbs(mm, 0, -1UL); } static inline void flush_tlb_page_nosync(struct vm_area_struct *vma, @@ -263,6 +265,8 @@ static inline void flush_tlb_page_nosync(struct vm_area_struct *vma, addr = __TLBI_VADDR(uaddr, ASID(vma->vm_mm)); __tlbi(vale1is, addr); __tlbi_user(vale1is, addr); + mmu_notifier_arch_invalidate_secondary_tlbs(vma->vm_mm, uaddr & PAGE_MASK, + (uaddr & PAGE_MASK) + PAGE_SIZE); } static inline void flush_tlb_page(struct vm_area_struct *vma, @@ -358,6 +362,7 @@ static inline void __flush_tlb_range(struct vm_area_struct *vma, scale++; } dsb(ish); + mmu_notifier_arch_invalidate_secondary_tlbs(vma->vm_mm, start, end); } static inline void flush_tlb_range(struct vm_area_struct *vma, diff --git a/arch/powerpc/include/asm/book3s/64/tlbflush.h b/arch/powerpc/include/asm/book3s/64/tlbflush.h index 0d0c144..dca0477 100644 --- a/arch/powerpc/include/asm/book3s/64/tlbflush.h +++ b/arch/powerpc/include/asm/book3s/64/tlbflush.h @@ -5,6 +5,7 @@ #define MMU_NO_CONTEXT ~0UL #include +#include #include #include diff --git a/arch/powerpc/mm/book3s64/radix_hugetlbpage.c b/arch/powerpc/mm/book3s64/radix_hugetlbpage.c index 5e31955..17075c7 100644 --- a/arch/powerpc/mm/book3s64/radix_hugetlbpage.c +++ b/arch/powerpc/mm/book3s64/radix_hugetlbpage.c @@ -39,6 +39,7 @@ void radix__flush_hugetlb_tlb_range(struct vm_area_struct *vma, unsigned long st radix__flush_tlb_pwc_range_psize(vma->vm_mm, start, end, psize); else radix__flush_tlb_range_psize(vma->vm_mm, start, end, psize); + mmu_notifier_arch_invalidate_secondary_tlbs(vma->vm_mm, start, end); } void radix__huge_ptep_modify_prot_commit(struct vm_area_struct *vma, diff --git a/arch/powerpc/mm/book3s64/radix_tlb.c b/arch/powerpc/mm/book3s64/radix_tlb.c index 0bd4866..64c11a4 100644 --- a/arch/powerpc/mm/book3s64/radix_tlb.c +++ b/arch/powerpc/mm/book3s64/radix_tlb.c @@ -752,6 +752,8 @@ void radix__local_flush_tlb_page(struct vm_area_struct *vma, unsigned long vmadd return radix__local_flush_hugetlb_page(vma, vmaddr); #endif radix__local_flush_tlb_page_psize(vma->vm_mm, vmaddr, mmu_virtual_psize); + mmu_notifier_arch_invalidate_secondary_tlbs(vma->vm_mm, vmaddr, + vmaddr + mmu_virtual_psize); } EXPORT_SYMBOL(radix__local_flush_tlb_page); @@ -987,6 +989,7 @@ void radix__flush_tlb_mm(struct mm_struct *mm) } } preempt_enable(); + mmu_notifier_arch_invalidate_secondary_tlbs(mm, 0, -1UL); } EXPORT_SYMBOL(radix__flush_tlb_mm); @@ -1020,6 +1023,7 @@ static void __flush_all_mm(struct mm_struct *mm, bool fullmm) _tlbiel_pid_multicast(mm, pid, RIC_FLUSH_ALL); } preempt_enable(); + mmu_notifier_arch_invalidate_secondary_tlbs(mm, 0, -1UL); } void radix__flush_all_mm(struct mm_struct *mm) @@ -1228,6 +1232,7 @@ static inline void __radix__flush_tlb_range(struct mm_struct *mm, } out: preempt_enable(); + mmu_notifier_arch_invalidate_secondary_tlbs(mm, start, end); } void radix__flush_tlb_range(struct vm_area_struct *vma, unsigned long start, @@ -1392,6 +1397,7 @@ static void __radix__flush_tlb_range_psize(struct mm_struct *mm, } out: preempt_enable(); + mmu_notifier_arch_invalidate_secondary_tlbs(mm, start, end); } void radix__flush_tlb_range_psize(struct mm_struct *mm, unsigned long start, diff --git a/arch/x86/mm/tlb.c b/arch/x86/mm/tlb.c index eaefc10..0b990fb 100644 --- a/arch/x86/mm/tlb.c +++ b/arch/x86/mm/tlb.c @@ -1037,6 +1037,7 @@ void flush_tlb_mm_range(struct mm_struct *mm, unsigned long start, put_flush_tlb_info(); put_cpu(); + mmu_notifier_arch_invalidate_secondary_tlbs(mm, start, end); } @@ -1264,6 +1265,7 @@ void arch_tlbbatch_flush(struct arch_tlbflush_unmap_batch *batch) put_flush_tlb_info(); put_cpu(); + mmu_notifier_arch_invalidate_secondary_tlbs(current->mm, 0, -1UL); } /* diff --git a/include/asm-generic/tlb.h b/include/asm-generic/tlb.h index 48c81b9..bc32a22 100644 --- a/include/asm-generic/tlb.h +++ b/include/asm-generic/tlb.h @@ -456,7 +456,6 @@ static inline void tlb_flush_mmu_tlbonly(struct mmu_gather *tlb) return; tlb_flush(tlb); - mmu_notifier_invalidate_secondary_tlbs(tlb->mm, tlb->start, tlb->end); __tlb_reset_range(tlb); }