From patchwork Tue Feb 28 21:37:28 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matthew Wilcox X-Patchwork-Id: 13155246 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 AFF5FC7EE45 for ; Tue, 28 Feb 2023 21:38:10 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 65DED6B0092; Tue, 28 Feb 2023 16:37:50 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 5BD836B0098; Tue, 28 Feb 2023 16:37:50 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 3E9656B0095; Tue, 28 Feb 2023 16:37:50 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0011.hostedemail.com [216.40.44.11]) by kanga.kvack.org (Postfix) with ESMTP id 2CBE06B008C for ; Tue, 28 Feb 2023 16:37:50 -0500 (EST) Received: from smtpin03.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay02.hostedemail.com (Postfix) with ESMTP id F2239120CCB for ; Tue, 28 Feb 2023 21:37:49 +0000 (UTC) X-FDA: 80518013058.03.BC49C36 Received: from casper.infradead.org (casper.infradead.org [90.155.50.34]) by imf14.hostedemail.com (Postfix) with ESMTP id 49663100009 for ; Tue, 28 Feb 2023 21:37:47 +0000 (UTC) Authentication-Results: imf14.hostedemail.com; dkim=pass header.d=infradead.org header.s=casper.20170209 header.b="nim/Ffuw"; spf=none (imf14.hostedemail.com: domain of willy@infradead.org has no SPF policy when checking 90.155.50.34) smtp.mailfrom=willy@infradead.org; dmarc=none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1677620267; 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-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=dtiP3hUvA6nDur052lXOuZXkJQbzfHLCDQRu6Y0/CbA=; b=enInXzy/OYzO8jhG39Fdh8rf8OcUfGiLukUWZkqXHG1wdyY3IO5qIWrmhsnj9sFCIajLuI 3nDZ2cEMG3pZVneqLnEtYSoLugmPJNtpjwFRAgSdqEYFVrAUSA5OAKQH4r6wBAVJotVy6t SNYdvc9QhGLO//BbiHXvxU1dm4rx6Bc= ARC-Authentication-Results: i=1; imf14.hostedemail.com; dkim=pass header.d=infradead.org header.s=casper.20170209 header.b="nim/Ffuw"; spf=none (imf14.hostedemail.com: domain of willy@infradead.org has no SPF policy when checking 90.155.50.34) smtp.mailfrom=willy@infradead.org; dmarc=none ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1677620267; a=rsa-sha256; cv=none; b=R8NBE4PMevg49nL/hZ1vrLO1JAmb4cboauj5KHTho8ZMglVWwV31Sn+KVOPj+zN/JAP0Sl 7DeEbiJgaSfAPPd3wQ3oed5Zazbm//QacKrn/VicWnaIR5PcmG6BwqmNcN01ncp4wfuUmw KreLn+pyN/5L9CNsqORK1xoVcIZ1x9w= 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=dtiP3hUvA6nDur052lXOuZXkJQbzfHLCDQRu6Y0/CbA=; b=nim/FfuwphiszxzJgRhRboHqcH vQzqCBkhh0tvLmMfPiIWWtFpSXipbb1iphhpFKTWFPAu/hVwVZoPc6ZHlCj2/jQKdF91GmZJ9na7T coRSAXj3oPuim8mixy7pm83Peo0keEkBTn2/bmTHwumG4lAQepukA68VsAXvrA39a+I9BJTE7Hs+Z 2u1V+pOEg9omjGjJIo7CRah2Vmhk48cMhBKDhpBAzTccVvBia7mHwuEn9QwqlNekN5TbgYvLfWOcz 1PHel/gzKJuYCRqdbehQTZEfjReDu/fMv2F9CyrAVcSivKYRhU/co/gP5obxRB7MApo8aNtsWl1xA sOVMrNJA==; Received: from willy by casper.infradead.org with local (Exim 4.94.2 #2 (Red Hat Linux)) id 1pX7fK-0018qG-5T; 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, Richard Weinberger , Anton Ivanov , Johannes Berg , linux-um@lists.infradead.org Subject: [PATCH v3 25/34] um: Implement the new page table range API Date: Tue, 28 Feb 2023 21:37:28 +0000 Message-Id: <20230228213738.272178-26-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-Rspamd-Queue-Id: 49663100009 X-Stat-Signature: kzjwepxgbeuhz3rarfnzugyj9i6it4wt X-Rspam-User: X-Rspamd-Server: rspam08 X-HE-Tag: 1677620267-723661 X-HE-Meta: U2FsdGVkX185OXFyBQWUeQ1H4a5Uu+V19wJtZmvhslc0ceGWPAR3OiycN6gRUZiij6gJ2fEtG+buKvO1kVNB04TZto/BbnTN7GfEh34IQ0Tez+rMAEq8D+em7tZLByo4U74oZJL1FZk0S0mR/j4Vk1ngKwje6U5cQxuFSscQwPdTOcgImWr+4CpaWDcTe7om4GaPVKRmBmJkkkmBFgYhJvDo6pTKGlUflXu0XDTGYez1EQN1i9vXcsn2PC0Yt3oPhRP8YKx4rfdSWhpI3l2DTSGE1Lvog9kI4MhKRrhG+sAyQLkLOb1NJgbqleUKrhmHtVVsf6kYH55/fgRkvKSV1lsQ5zJwR60waLuG9r4qCKypt31RAItJAg9+a5WCuqCeZIEH7bTYownIL/VQ1TTUwiVjYMuCXyqGdvSST7UcVbHggIoZpLnpoRQ4JpspLjvfnTv20cBZNm7rvy20VSitQNB2Qz62tZleO1+8L0yU+lBP0BDtFS76D8aI0RYIqv1CING/pyaQStNoHwO2q/A8p2fPk7ohIuaoogQaEop3lF0d4z5pDN/rHc0Q2dRqnQT7T3Ut/FyaIm9ObMvbG2oIwIkCsz0+mXjbmRKPhejjQBeWXEg9YIx1Hkuhbjty70tE78+peRgpuwWVVCwNa8z80QuQqkE2DzbQeWdUgUPtva7Qh9f2B7HL8vuV0c8Q7vLQokIwcCmHPqeGlGnqKyZQb7OgSi4zLMd6/SvbvYg5Qz6d+mOtcExIlzDaVrJGr2Powk3Mec3bkilx4ZvrhhJaBW8ZIoBkBI/VICnO6oPDkaWs9w9VoLZwtVoEOJoHb3zBPGA3y5BhTd+joqEVYVg3/gbnVQWbzKp/gM9XkS5oYJo0jbFl8btPAhHtzk1Ta0Yznb0pBd31+g1L1fD2Y59oXyaFsjTnS6hl642CSjx9GiaP9Kpjuawja206ylcs/IH/7pxE7XfdGpxMNu/q0UQ vbufnW5D GvIoA93pM895zIQjNhghY+WZGcIi8yqRXzHVgQyU+1WK2CTsIBO6ReZmHPzAiGi7aIe2IrveA/QyNFn0xQx0+AKPA/kD5wXqWPfARyUA0SKtGPrYEd3cffQ/zdT8T0s9WC3FSKFaPIpaegcNVbz4MWvb9oTRogzqIF18YaZ5Zg1kLN5mREgvlZiTplvzHNcCpQhp8R081/wYjNY0KmT7/w/WgVe14eRfVVd+wR4c6UpGt3CzjUJl8va01cczI3caGmOSyziuKuXAKpDYUamfxPrpm7S02zYtk9tneobFXbCWolOv2RJuXKnEmpOsql/9CuxHU 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: Add set_ptes() and update_mmu_cache_range(). Signed-off-by: Matthew Wilcox (Oracle) Cc: Richard Weinberger Cc: Anton Ivanov Cc: Johannes Berg Cc: linux-um@lists.infradead.org --- arch/um/include/asm/pgtable.h | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/arch/um/include/asm/pgtable.h b/arch/um/include/asm/pgtable.h index a70d1618eb35..ca78c90ae74f 100644 --- a/arch/um/include/asm/pgtable.h +++ b/arch/um/include/asm/pgtable.h @@ -242,12 +242,20 @@ static inline void set_pte(pte_t *pteptr, pte_t pteval) if(pte_present(*pteptr)) *pteptr = pte_mknewprot(*pteptr); } -static inline void set_pte_at(struct mm_struct *mm, unsigned long addr, - pte_t *pteptr, pte_t pteval) +static inline void set_ptes(struct mm_struct *mm, unsigned long addr, + pte_t *ptep, pte_t pte, unsigned int nr) { - set_pte(pteptr, pteval); + for (;;) { + set_pte(ptep, pte); + if (--nr == 0) + break; + ptep++; + pte_val(pte) += PAGE_SIZE; + } } +#define set_pte_at(mm, addr, ptep, pte) set_ptes(mm, addr, ptep, pte, 1) + #define __HAVE_ARCH_PTE_SAME static inline int pte_same(pte_t pte_a, pte_t pte_b) { @@ -290,6 +298,7 @@ struct mm_struct; extern pte_t *virt_to_pte(struct mm_struct *mm, unsigned long addr); #define update_mmu_cache(vma,address,ptep) do {} while (0) +#define update_mmu_cache_range(vma, address, ptep, nr) do {} while (0) /* * Encode/decode swap entries and swap PTEs. Swap PTEs are all PTEs that