Received: by 2002:a05:6358:700f:b0:131:369:b2a3 with SMTP id 15csp1179656rwo; Wed, 2 Aug 2023 09:50:21 -0700 (PDT) X-Google-Smtp-Source: APBJJlEeb93qfwLHWLyBt8xQ8/fupMarSEnYNQN7hxBbax2hitHOQQO3U7zs2d84oosHivfCw/ou X-Received: by 2002:a17:906:3144:b0:99b:e464:bf49 with SMTP id e4-20020a170906314400b0099be464bf49mr5046437eje.51.1690995021680; Wed, 02 Aug 2023 09:50:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1690995021; cv=none; d=google.com; s=arc-20160816; b=r1l60eMkkIYS/A4PBzsc3YoNtS1b4UqoUrALend/ayhCgQJeStACLir0Jyvyn98pRW a5Rx8bE4t7Uik0ybAQyqIZz0Ur8Nk+l9ZBWuvZu7jwaY/D2I/vGpZzUkVl0wtTSW9dhE NdJerEotn8O7IJ7CObcRrJLmeTd9nGgd0t4j2d0f7//E/mVw3HkoOli5i3fWBTjDw98y rqf1t2Ci6EuFadXmp8VcmLAfFk2T5FWQFXKPRmwuSofS2v6Vws9F1Yh2E+U9/UmTNAad OFovjyoP/vYPLp7nlXUAWO01yNlleBPp2smjHYFj54c4e8ZO0I2zscKBQABmVNHnaKef xoWA== 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=9qyEM7+DnFqlFc74V3faMXypJWL5ynd3t/43lgDYBHw=; fh=aOM6241f6jxAbyEFQMMJAXRCR7/Qw+WS0LOuDz3zGIc=; b=0dbk2oeWv4Y3FaG+vrVz+k3nY54hqRueiEJ7nN1aWUlu1hyWvf3tjTF8Kzl0VGYsbD uSZ4223N6qzxm3u+fXOIRAmFM+kaAAzDIFoS/HFVJCVl9K/ktIDW4vP1iAqE7uUQikSD if/jiZmsd3jCS904cr8+bp67SPCpIpmpDsOvHI8d3FUrETVl4LenbwYQAO/lGmM8hdgg dnXPS8gLjiha4gIz23h/JjpaDhkFdMFbiZXk99/nl53X8kAvEoX/JdDeaqVFgJvpxs5g KTv+IztZKMWPvMweBYVSVTTotTDd87O+1QEvbGCJD1X7n4twlMV19Pud6q8fhfnQED2K 9kHQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b=Lg1xzCUy; 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id rn3-20020a170906d92300b0098e47bbff3csi10598020ejb.297.2023.08.02.09.49.57; Wed, 02 Aug 2023 09:50:21 -0700 (PDT) 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=Lg1xzCUy; 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 S234925AbjHBPPC (ORCPT + 99 others); Wed, 2 Aug 2023 11:15:02 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37276 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234695AbjHBPOT (ORCPT ); Wed, 2 Aug 2023 11:14:19 -0400 Received: from casper.infradead.org (casper.infradead.org [IPv6:2001:8b0:10b:1236::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 679CF2D79; Wed, 2 Aug 2023 08:14:12 -0700 (PDT) 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=9qyEM7+DnFqlFc74V3faMXypJWL5ynd3t/43lgDYBHw=; b=Lg1xzCUywUYblSsgkydYQMoLj5 UggqhWH1R2z7tL3VZi0kexW4aiNwI6o3kvhV7Ratz9RRsvrDHVpmfwEgnfSOp4CEtx/YdNnGMJ/dP hgQfbxhlT4WquR74cvQLzYBsWSqHOEzEhXhtfqZ985Eaowptz5N8+ADvY6xFJALSqrba1to1snHhY kzYcmDEu7nO8GdFkkDyD5Mf7nE4Hp7EZvA/oqS5zB/6yLmLsDG7mkf5gnIqzmTubs79iu/0ZvgMP5 i024SM6MGqKapd1m4IjpWOoVaH3CUFjDgFKQRJGG821tjzwMWDoCy9xzbar7I64LtY0IhfzayEKQt S42oF4wA==; Received: from willy by casper.infradead.org with local (Exim 4.94.2 #2 (Red Hat Linux)) id 1qRDYA-00FfkY-LY; Wed, 02 Aug 2023 15:14:10 +0000 From: "Matthew Wilcox (Oracle)" To: Andrew Morton Cc: "Matthew Wilcox (Oracle)" , linux-arch@vger.kernel.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org, Gerald Schaefer , Mike Rapoport , Heiko Carstens , Vasily Gorbik , Alexander Gordeev , Christian Borntraeger , Sven Schnelle , linux-s390@vger.kernel.org Subject: [PATCH v6 23/38] s390: Implement the new page table range API Date: Wed, 2 Aug 2023 16:13:51 +0100 Message-Id: <20230802151406.3735276-24-willy@infradead.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20230802151406.3735276-1-willy@infradead.org> References: <20230802151406.3735276-1-willy@infradead.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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,T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED 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 Add set_ptes() and update_mmu_cache_range(). Signed-off-by: Matthew Wilcox (Oracle) Reviewed-by: Gerald Schaefer Acked-by: Mike Rapoport (IBM) Cc: Heiko Carstens Cc: Vasily Gorbik Cc: Alexander Gordeev Cc: Christian Borntraeger Cc: Sven Schnelle Cc: linux-s390@vger.kernel.org --- arch/s390/include/asm/pgtable.h | 33 ++++++++++++++++++++++++--------- 1 file changed, 24 insertions(+), 9 deletions(-) diff --git a/arch/s390/include/asm/pgtable.h b/arch/s390/include/asm/pgtable.h index 30909fe27c24..d28d2e5e68ee 100644 --- a/arch/s390/include/asm/pgtable.h +++ b/arch/s390/include/asm/pgtable.h @@ -47,6 +47,7 @@ static inline void update_page_count(int level, long count) * tables contain all the necessary information. */ #define update_mmu_cache(vma, address, ptep) do { } while (0) +#define update_mmu_cache_range(vmf, vma, addr, ptep, nr) do { } while (0) #define update_mmu_cache_pmd(vma, address, ptep) do { } while (0) /* @@ -1314,20 +1315,34 @@ pgprot_t pgprot_writecombine(pgprot_t prot); pgprot_t pgprot_writethrough(pgprot_t prot); /* - * Certain architectures need to do special things when PTEs - * within a page table are directly modified. Thus, the following - * hook is made available. + * Set multiple PTEs to consecutive pages with a single call. All PTEs + * are within the same folio, PMD and VMA. */ -static inline void set_pte_at(struct mm_struct *mm, unsigned long addr, - pte_t *ptep, pte_t entry) +static inline void set_ptes(struct mm_struct *mm, unsigned long addr, + pte_t *ptep, pte_t entry, unsigned int nr) { if (pte_present(entry)) entry = clear_pte_bit(entry, __pgprot(_PAGE_UNUSED)); - if (mm_has_pgste(mm)) - ptep_set_pte_at(mm, addr, ptep, entry); - else - set_pte(ptep, entry); + if (mm_has_pgste(mm)) { + for (;;) { + ptep_set_pte_at(mm, addr, ptep, entry); + if (--nr == 0) + break; + ptep++; + entry = __pte(pte_val(entry) + PAGE_SIZE); + addr += PAGE_SIZE; + } + } else { + for (;;) { + set_pte(ptep, entry); + if (--nr == 0) + break; + ptep++; + entry = __pte(pte_val(entry) + PAGE_SIZE); + } + } } +#define set_ptes set_ptes /* * Conversion functions: convert a page and protection to a page entry, -- 2.40.1