From patchwork Mon Feb 27 17:57:36 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matthew Wilcox X-Patchwork-Id: 62071 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:5915:0:0:0:0:0 with SMTP id v21csp2561605wrd; Mon, 27 Feb 2023 10:00:29 -0800 (PST) X-Google-Smtp-Source: AK7set9nS5kSRJA9RhGRd8PhXdUUN5zXAsZX6YtMXRSYJCv7T+rPDPM/lqUrnfHRROCPD3wRL9oE X-Received: by 2002:a05:6a21:9988:b0:c2:fae6:caea with SMTP id ve8-20020a056a21998800b000c2fae6caeamr374484pzb.21.1677520829141; Mon, 27 Feb 2023 10:00:29 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1677520829; cv=none; d=google.com; s=arc-20160816; b=Fwf0yIFlFkO+Ye3oKbqdZfrUSh2cbH1u0G2aGgCpOKRrph4Jm5FNmtAPdv42Jz6LdM nxm2Ufmqj6tpJQZ9biZScsTdx7El8pSQyfHhKr/ukDoMBEPan8ao9ANjyiJafu5tpiGz rplb7jVTrpkFcOJ0b3kVSJ+q0yz889VYESLg7gIfe6JrXHwy2L+BNmLGepclsbBhqKRS PkjgIPSRGPRgZmGfMYcYOvks1KvZ3p2Glt/jdvTTKskkZ+04nDan7uDDygd6w35fb/44 rnKHj5+KgQavCXOjK+/AD74K23y4DK7C5zgQoL38zHMT6HeFTKJfpFo5mmD5hnuo4HbF gfjg== 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=EOwKG+qGt6OmH3J2PyP/lVDeUDJbmd/iIN3oKauvlwtO+cVyK7XnuAD0uvk7bcngUN 6KTEuCGX4gqUYzcO7tI3HTPusowD0eOq2tTKmouVGP2yGGVOxc6b0AroAP+M7hg0dipY dYe/XTp2u0AZgVMqoxgaX5nKYr57vEL6R9KsdqpiYKV53gCVSJnpkWxzXb2t4KH1scvc VJ6dcU4jcRzITDrS5f6GzbUOHPU8prfmrkpm68kRAw6qLUZNbOqPz+j5de+GSHj+Qvv8 n9vEao8ES4wT++rv2vjaJ0KOLkIHdtOYuwqi0BBu1pIO2j/vi2W7IL6vw2PP9EePc3zX MwOA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b=BPvJtFBX; 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 q130-20020a632a88000000b00502fdc84f37si7127608pgq.320.2023.02.27.10.00.16; Mon, 27 Feb 2023 10:00:29 -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=BPvJtFBX; 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 S229944AbjB0R6l (ORCPT + 99 others); Mon, 27 Feb 2023 12:58:41 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48866 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230231AbjB0R6L (ORCPT ); Mon, 27 Feb 2023 12:58:11 -0500 Received: from casper.infradead.org (casper.infradead.org [IPv6:2001:8b0:10b:1236::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3FD5BC2; Mon, 27 Feb 2023 09:57:49 -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=BPvJtFBXN5FBI3a+YdN/S+KXij CZC8/u9DVo/Jz2rikzcHYdR9c2R6G5GvkYUW1rY20m/CxR8T9HVedX/AMYVAYCyoWzbC6+7POOhKp bM0vmU+9cIf1jMUR8zuMVaImiRY1qglepGK8RTFQLlGlB8E62VOqb2+KMuMKAcNYqOcEGvIGOa9qH +0hBslig/tp4FzJr1ARvRtcgvDi3ZucOaB1+/JAUtZOZlMHdqNd1N7yf9HKbjbM0VgJ20KEVs9ECg Buy6noityfK1azMHwiTgSqn9+6o1Xez817HEYWztVxExzt8hVeVFhLGF0PvtxwqQJ61XZrr/hKn6V IIWZBuFg==; Received: from willy by casper.infradead.org with local (Exim 4.94.2 #2 (Red Hat Linux)) id 1pWhkw-000IYd-B3; Mon, 27 Feb 2023 17:57:46 +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 v2 25/30] x86: Implement the new page table range API Date: Mon, 27 Feb 2023 17:57:36 +0000 Message-Id: <20230227175741.71216-26-willy@infradead.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20230227175741.71216-1-willy@infradead.org> References: <20230227175741.71216-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?1759008080820374497?= X-GMAIL-MSGID: =?utf-8?q?1759008080820374497?= 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) {