From patchwork Thu Mar 28 08:46:28 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christoph Hellwig X-Patchwork-Id: 13608187 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 31F65CD11DD for ; Thu, 28 Mar 2024 08:46:43 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 6BA7F6B007B; Thu, 28 Mar 2024 04:46:42 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 66AFA6B0082; Thu, 28 Mar 2024 04:46:42 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 50CA86B0085; Thu, 28 Mar 2024 04:46:42 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0017.hostedemail.com [216.40.44.17]) by kanga.kvack.org (Postfix) with ESMTP id 2C50D6B007B for ; Thu, 28 Mar 2024 04:46:42 -0400 (EDT) Received: from smtpin11.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay08.hostedemail.com (Postfix) with ESMTP id D73C8141004 for ; Thu, 28 Mar 2024 08:46:41 +0000 (UTC) X-FDA: 81945817002.11.4CFDA6A Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) by imf25.hostedemail.com (Postfix) with ESMTP id 387C0A000D for ; Thu, 28 Mar 2024 08:46:39 +0000 (UTC) Authentication-Results: imf25.hostedemail.com; dkim=pass header.d=infradead.org header.s=bombadil.20210309 header.b=mcw3eN85; dmarc=none; spf=none (imf25.hostedemail.com: domain of BATV+62e9139b449b679ee457+7522+infradead.org+hch@bombadil.srs.infradead.org has no SPF policy when checking 198.137.202.133) smtp.mailfrom=BATV+62e9139b449b679ee457+7522+infradead.org+hch@bombadil.srs.infradead.org ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1711615600; 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=ufsEjvPUOPudX1DkAEKQaH/I0oOilNFfYnYStusOBYs=; b=B6+4Chg+k4eAgMg1nsX2JooQKnoNMdnP+7bWDb2qGcxJsqGWDy1tFdpwTVgZiNQqZTeOGA HvNtUb2a0rBF+STKJ52zxcokVjS5treG7hJyNKr9aZNuvrrnolVZKGIfVwBgKC+DahS3dL Yu8+hdF3YKlJgw13VD8do4GZqqfS/BU= ARC-Authentication-Results: i=1; imf25.hostedemail.com; dkim=pass header.d=infradead.org header.s=bombadil.20210309 header.b=mcw3eN85; dmarc=none; spf=none (imf25.hostedemail.com: domain of BATV+62e9139b449b679ee457+7522+infradead.org+hch@bombadil.srs.infradead.org has no SPF policy when checking 198.137.202.133) smtp.mailfrom=BATV+62e9139b449b679ee457+7522+infradead.org+hch@bombadil.srs.infradead.org ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1711615600; a=rsa-sha256; cv=none; b=y30W9kB9GYMGwRWfsA7NLEGRJbqYtNLJai0fxem5/RgcUfcj1t2bZIvl0v1vd49FIBlGV9 FwtnNT01+t9j3NNOwVYleAm6k2dymaYv204Mc77wJCDwEPqp9b/pttXHGjh6fpV4Iy8BhK c03wX0Pj4I6e/pOxh1hjKQwjqRR1IX0= DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20210309; 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=ufsEjvPUOPudX1DkAEKQaH/I0oOilNFfYnYStusOBYs=; b=mcw3eN85e3HV/AabT1H20sM66K KeNY4IRShDHsVwq1ZDac5u6dTub9w2QvF4eRLh//rBmZn+8TNknEP2QkKuDC3+C5bTvTLg8ukEdS3 pc2yH74GcrjQYLIF2kqkZrMTxDCbm9g9h11YBwEBSghlf3cgRPdpc19PmRhZieGioZfzbFhI0Fmor hxHODWTaEILXwJQj9Mc9311Uy1gQeYwzvbXv5SOJOWrwxeDWfbk5nrJsCFK3KO4/h7lSKwqR10CGK ICA3Pf6622si855Mwz7COJH6WDxuu5kXajx6/yNcZo0h4waZeZcwzeLoeyLje2aQgFI/TRz1USOxA fkv2gPQA==; Received: from 2a02-8389-2341-5b80-39d3-4735-9a3c-88d8.cable.dynamic.v6.surfer.at ([2a02:8389:2341:5b80:39d3:4735:9a3c:88d8] helo=localhost) by bombadil.infradead.org with esmtpsa (Exim 4.97.1 #2 (Red Hat Linux)) id 1rplPC-0000000D8gv-1QIi; Thu, 28 Mar 2024 08:46:38 +0000 From: Christoph Hellwig To: Andrew Morton , Dave Hansen , Andy Lutomirski , Peter Zijlstra , Fei Li Cc: x86@kernel.org, linux-mm@kvack.org, David Hildenbrand Subject: [PATCH 2/3] mm: remove follow_pfn Date: Thu, 28 Mar 2024 09:46:28 +0100 Message-Id: <20240328084629.2955393-3-hch@lst.de> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240328084629.2955393-1-hch@lst.de> References: <20240328084629.2955393-1-hch@lst.de> MIME-Version: 1.0 X-SRS-Rewrite: SMTP reverse-path rewritten from by bombadil.infradead.org. See http://www.infradead.org/rpr.html X-Rspamd-Queue-Id: 387C0A000D X-Rspam-User: X-Rspamd-Server: rspam04 X-Stat-Signature: m6cbjhwe93sgmjqyq1t63di13f6uwcxx X-HE-Tag: 1711615599-807628 X-HE-Meta: U2FsdGVkX180BVmkcrtmgRZHCze/i1knTLbHxRsvZx5tSeuuLn5MBArD7+T846ZNiymiBz/Av2v82BjrNTNJpfZFPJZzoosOz9ga5QO412RRTiEUrmMRf6QhAIsEJOyEHvbwWMuQUpxP7e+m7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WgqW1SyI1meDAH3+B8iiIg6ZERXzWfZFtqdqFpNcVrDlAOQJcvZsuPkYBlfkV/k2/LvkqJ/w79pTg5LBU1wv7JSajF7vaHowP7J30fSvuIvWeiY73u1+ukfVTDh2/i9oCvQb8wo/6eiBBqTUSIZRohbQBGoIX/I/lHHSKRZw5LCZaaAI5WTaXUAiHDnoCRSXMQQLvY25A/3plZIlMDGFO7wFpk9s05KNsGXKU5RcenSjGgsCnNkBpScevqqicAOYIRGGCQDNr3Q= 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: List-Subscribe: List-Unsubscribe: Remove follow_pfn now that the last user is gone. Signed-off-by: Christoph Hellwig Reviewed-by: David Hildenbrand --- include/linux/mm.h | 2 -- mm/memory.c | 36 ++---------------------------------- mm/nommu.c | 21 --------------------- 3 files changed, 2 insertions(+), 57 deletions(-) diff --git a/include/linux/mm.h b/include/linux/mm.h index 0436b919f1c7fc..9cd2c69f913601 100644 --- a/include/linux/mm.h +++ b/include/linux/mm.h @@ -2393,8 +2393,6 @@ int copy_page_range(struct vm_area_struct *dst_vma, struct vm_area_struct *src_vma); int follow_pte(struct mm_struct *mm, unsigned long address, pte_t **ptepp, spinlock_t **ptlp); -int follow_pfn(struct vm_area_struct *vma, unsigned long address, - unsigned long *pfn); int follow_phys(struct vm_area_struct *vma, unsigned long address, unsigned int flags, unsigned long *prot, resource_size_t *phys); int generic_access_phys(struct vm_area_struct *vma, unsigned long addr, diff --git a/mm/memory.c b/mm/memory.c index 904f70b994985a..33559720f0aab9 100644 --- a/mm/memory.c +++ b/mm/memory.c @@ -5882,8 +5882,8 @@ int __pmd_alloc(struct mm_struct *mm, pud_t *pud, unsigned long address) * Only IO mappings and raw PFN mappings are allowed. The mmap semaphore * should be taken for read. * - * KVM uses this function. While it is arguably less bad than ``follow_pfn``, - * it is not a good general-purpose API. + * KVM uses this function. While it is arguably less bad than the historic + * ``follow_pfn``, it is not a good general-purpose API. * * Return: zero on success, -ve otherwise. */ @@ -5925,38 +5925,6 @@ int follow_pte(struct mm_struct *mm, unsigned long address, } EXPORT_SYMBOL_GPL(follow_pte); -/** - * follow_pfn - look up PFN at a user virtual address - * @vma: memory mapping - * @address: user virtual address - * @pfn: location to store found PFN - * - * Only IO mappings and raw PFN mappings are allowed. - * - * This function does not allow the caller to read the permissions - * of the PTE. Do not use it. - * - * Return: zero and the pfn at @pfn on success, -ve otherwise. - */ -int follow_pfn(struct vm_area_struct *vma, unsigned long address, - unsigned long *pfn) -{ - int ret = -EINVAL; - spinlock_t *ptl; - pte_t *ptep; - - if (!(vma->vm_flags & (VM_IO | VM_PFNMAP))) - return ret; - - ret = follow_pte(vma->vm_mm, address, &ptep, &ptl); - if (ret) - return ret; - *pfn = pte_pfn(ptep_get(ptep)); - pte_unmap_unlock(ptep, ptl); - return 0; -} -EXPORT_SYMBOL(follow_pfn); - #ifdef CONFIG_HAVE_IOREMAP_PROT int follow_phys(struct vm_area_struct *vma, unsigned long address, unsigned int flags, diff --git a/mm/nommu.c b/mm/nommu.c index 5ec8f44e7ce976..38d3ecc30c3ba9 100644 --- a/mm/nommu.c +++ b/mm/nommu.c @@ -110,27 +110,6 @@ unsigned int kobjsize(const void *objp) return page_size(page); } -/** - * follow_pfn - look up PFN at a user virtual address - * @vma: memory mapping - * @address: user virtual address - * @pfn: location to store found PFN - * - * Only IO mappings and raw PFN mappings are allowed. - * - * Returns zero and the pfn at @pfn on success, -ve otherwise. - */ -int follow_pfn(struct vm_area_struct *vma, unsigned long address, - unsigned long *pfn) -{ - if (!(vma->vm_flags & (VM_IO | VM_PFNMAP))) - return -EINVAL; - - *pfn = address >> PAGE_SHIFT; - return 0; -} -EXPORT_SYMBOL(follow_pfn); - void vfree(const void *addr) { kfree(addr);