From patchwork Tue Feb 28 21:37:29 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matthew Wilcox X-Patchwork-Id: 62629 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:5915:0:0:0:0:0 with SMTP id v21csp3267646wrd; Tue, 28 Feb 2023 13:40:21 -0800 (PST) X-Google-Smtp-Source: AK7set+p15zNsbmacOJ8tfRtw0zO0N8CCPVkMrxG4+e1+Uw1zrdaLVMqjcifgZCGi2P1Oizf9MN6 X-Received: by 2002:a05:6a20:d49b:b0:cd:fc47:ddbf with SMTP id im27-20020a056a20d49b00b000cdfc47ddbfmr1979793pzb.47.1677620421304; Tue, 28 Feb 2023 13:40:21 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1677620421; cv=none; d=google.com; s=arc-20160816; b=VEtrbmHIt4S+7rKAinYFPWQBlzrmrletDO1Lqds4Cqe+nez2soldWBUv1y7RchM9TU FIMJ9BrLtwxom/MxypTPyiVGpXAyUG4rf5FMJrK4ZGXHNtt3BAA3BKB5J8Z5aY2z+lDw FfbFRLeXHtMkmaj9tkARYfq0u1V8Wb4Nj6Zq+bJFtFhRey5qzwhByWualL51GfUkI4QY Z8u2sDlH/YbWujeO1NJwsuz//RXzhw/Xky9G5EvfPtChBPV647AoOlKoQS4yi+SHd8aO 9/qYTSGj5njFe+fkVC7tC9YKHzNHKy1zbyWfCY6QvASl6aUole4UFjZubt73jo/LBrqp poeg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=fpcPwGn1cnZkifuBnwEfVFMB8mrQdavgisIkUPDNgF0=; b=bIWu7FI86rzAtx11w0ONzndMdtkcKAsDTFpZVkLbPc6eMgjA6s8eQ1f0mGLkSylVpi cTS1PcC1lyCgBZ9oLjr3snQ7S06ck+U0RouNoLhJoIUXZ006B/6ZVqdQ/kNRr++QH/hL jN3R5htP1Is8OrL1AdQWzXDi+QrHXGUzp0VcMi0PeM/65Egs82QCPhvIT3R7+ek8c9dc mO0ZL1mMW1JMZnwb6hiaVI/7j4ugduhqgeGPHXX9oFNRTbjjSPmtR87fgx7rkYG/k1WF Ji8qJH9zCVxLRxW2GFJQ0TEM0F3Dx1io6tMyn+PbW3Pifr/HaRDzlbtGLl3tIInkpOhI Cbnw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b=NjCRe50+; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id i3-20020a6551c3000000b004fbffa7d038si9927802pgq.737.2023.02.28.13.39.51; Tue, 28 Feb 2023 13:40:21 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b=NjCRe50+; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229523AbjB1VjF (ORCPT + 99 others); Tue, 28 Feb 2023 16:39:05 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52776 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230000AbjB1ViF (ORCPT ); Tue, 28 Feb 2023 16:38:05 -0500 Received: from casper.infradead.org (casper.infradead.org [IPv6:2001:8b0:10b:1236::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5D5F735277; Tue, 28 Feb 2023 13:37:45 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=Content-Transfer-Encoding:MIME-Version: References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Sender:Reply-To: Content-Type:Content-ID:Content-Description; bh=fpcPwGn1cnZkifuBnwEfVFMB8mrQdavgisIkUPDNgF0=; b=NjCRe50+iJnOn2KOisgXMICdJ3 i3f0pYaSzRdjUJTsp293YdZYI8IxMAOKNR+z7ak18vrhXU29OXtVq/6sl1smHAbHvQAWRAsJuaJO7 HroZWUZSUw4hmaDi418EyQIjM4I2oPg2mtFYRimli3yyGf5PXj0e2xz6RsaTbj+jUDybB7J7W5GKo dCKhrpuyl764OzyK2702Y5Wjet1VVbzltlGR06KAtWjdP9L1uwbYUEQ3eoNlbZp75zltxKplP3zRq 14sK6gTtCoOIuWPWxnAQmtUIAZJyEmbBaNtkCrRvpb265t+Q1nKN59c9ANqXTk+Bk8/IUKkO5+9dv ltuj7eeg==; Received: from willy by casper.infradead.org with local (Exim 4.94.2 #2 (Red Hat Linux)) id 1pX7fK-0018qN-9o; Tue, 28 Feb 2023 21:37:42 +0000 From: "Matthew Wilcox (Oracle)" To: linux-mm@kvack.org, linux-arch@vger.kernel.org Cc: "Matthew Wilcox (Oracle)" , linux-kernel@vger.kernel.org, Thomas Gleixner , Ingo Molnar , Borislav Petkov , Dave Hansen , x86@kernel.org, "H. Peter Anvin" Subject: [PATCH v3 26/34] x86: Implement the new page table range API Date: Tue, 28 Feb 2023 21:37:29 +0000 Message-Id: <20230228213738.272178-27-willy@infradead.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20230228213738.272178-1-willy@infradead.org> References: <20230228213738.272178-1-willy@infradead.org> MIME-Version: 1.0 X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE, SPF_NONE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1759112510974020843?= X-GMAIL-MSGID: =?utf-8?q?1759112510974020843?= Convert set_pte_at() into set_ptes() and add a noop update_mmu_cache_range(). Signed-off-by: Matthew Wilcox (Oracle) Cc: Thomas Gleixner Cc: Ingo Molnar Cc: Borislav Petkov Cc: Dave Hansen Cc: x86@kernel.org Cc: "H. Peter Anvin" --- arch/x86/include/asm/pgtable.h | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) diff --git a/arch/x86/include/asm/pgtable.h b/arch/x86/include/asm/pgtable.h index 84be3e07b112..f424371ea143 100644 --- a/arch/x86/include/asm/pgtable.h +++ b/arch/x86/include/asm/pgtable.h @@ -1019,13 +1019,22 @@ static inline pud_t native_local_pudp_get_and_clear(pud_t *pudp) return res; } -static inline void set_pte_at(struct mm_struct *mm, unsigned long addr, - pte_t *ptep, pte_t pte) +static inline void set_ptes(struct mm_struct *mm, unsigned long addr, + pte_t *ptep, pte_t pte, unsigned int nr) { - page_table_check_ptes_set(mm, addr, ptep, pte, 1); - set_pte(ptep, pte); + page_table_check_ptes_set(mm, addr, ptep, pte, nr); + + for (;;) { + set_pte(ptep, pte); + if (--nr == 0) + break; + ptep++; + pte = __pte(pte_val(pte) + PAGE_SIZE); + } } +#define set_pte_at(mm, addr, ptep, pte) set_ptes(mm, addr, ptep, pte, 1) + static inline void set_pmd_at(struct mm_struct *mm, unsigned long addr, pmd_t *pmdp, pmd_t pmd) { @@ -1291,6 +1300,10 @@ static inline void update_mmu_cache(struct vm_area_struct *vma, unsigned long addr, pte_t *ptep) { } +static inline void update_mmu_cache_range(struct vm_area_struct *vma, + unsigned long addr, pte_t *ptep, unsigned int nr) +{ +} static inline void update_mmu_cache_pmd(struct vm_area_struct *vma, unsigned long addr, pmd_t *pmd) {