Message ID | 20240826204353.2228736-13-peterx@redhat.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show
Return-Path: <linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org> X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id BB463C5321D for <linux-arm-kernel@archiver.kernel.org>; Mon, 26 Aug 2024 20:54:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Type: Content-Transfer-Encoding:MIME-Version:References:In-Reply-To:Message-ID:Date :Subject:Cc:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=moprxbUn5M7+L+63SZwwyqeq4iL0OHeeIJZbsfnkOho=; b=g5oJrE4kzSjAOOtAwMi/ugQCa0 hGxtrsdio9o3xMps9qy9sdvQXv7yken/UDh0IkdRWyFIwlkOT1SBys/th/0fWmV0Cuh3z1T//jzur z4EJN3IXHvQyRxw5jfXWHie22T9FPYAQPgtMZSHgyNi7FEjrmgEP62QGxJifmTz+ptcgImqkaG6yY dD4sqmrURZzFC1f+SXxub8oRs1xf8jiTPxn0WI96ZT1Mh0DZ2HgRhQQhbbqsm6TaSQYI8CgG+y6ez yatQ2aNs8GnX0NjkS/majSYgOp5johyE+jcPRDBTqQx6gx/vDsc96zFramgw5jVPZDYkPBcOWEq4C WXarmFjQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sigjR-00000008hYV-114X; Mon, 26 Aug 2024 20:54:33 +0000 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sigZb-00000008eXy-2YL5 for linux-arm-kernel@lists.infradead.org; Mon, 26 Aug 2024 20:44:25 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1724705062; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=moprxbUn5M7+L+63SZwwyqeq4iL0OHeeIJZbsfnkOho=; b=U3Hm2rYD+TDFjedSX/ywSr3TBwLzavI/njXNAx2PRr3kBvrgbXYEsimWA9V8GdFgkvgTqI QHFkl3NbnN/CADQ7NIKFB44/ot9+5/3OCazsr0aRTnROLZGe27rIkiOclJhDj6D96tU5e8 e6H2RLrc9sAJ0WTxvRViRz8JODo/Ed4= Received: from mail-qk1-f199.google.com (mail-qk1-f199.google.com [209.85.222.199]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-245-YWmJGXzvPQeDshp8CGgD0Q-1; Mon, 26 Aug 2024 16:44:21 -0400 X-MC-Unique: YWmJGXzvPQeDshp8CGgD0Q-1 Received: by mail-qk1-f199.google.com with SMTP id af79cd13be357-7a1d9a712bcso1119803385a.1 for <linux-arm-kernel@lists.infradead.org>; Mon, 26 Aug 2024 13:44:21 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1724705060; x=1725309860; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=moprxbUn5M7+L+63SZwwyqeq4iL0OHeeIJZbsfnkOho=; b=KqcZU/iCDk3Ew4wo2Axd/Kx9x1jZzFxzWvNDBC+B+8OawVAeLZLSnpT+N/zusE6+7s TKkXBRIFavvxvz1v5xanOO0XEt2FPEqs1ox86aHu4yxC32pLlKTC7ouFRqyaIQGEPf7I CyPmqT+qNWJjwn68FADH/PqGPkyi4R7jBFS+lWpSZXZB5btV1tfSRu+G5+y93vYWlEBC GNaUkyfau+TTTpC+n9cH8sP1/uGX+qPjALTCtG1PSQPDpl2p9gmwyVyNmQ2gzouQPN5B WzeRG5SobQ5CpmjeD/5JOYBJ8f5t6nKhviyWqwYOocd47ycRyuYp83gDWERkVwcnzH7N gaSw== X-Forwarded-Encrypted: i=1; AJvYcCUa0p16KWKss/DwvFGvwHo0L11oLEVzDB7rCSuNTgkQZHK3cWMx0AA7ybPXY4nOyitE/w/T5EdnzR5dvq34HE8B@lists.infradead.org X-Gm-Message-State: AOJu0YyvUFUCPaM7Lwol9FhmcCLLh9pFxg2ljQ+6R/86R7zjGE59yYl/ 5MLiPcrqno6b4P9oB4ccPJlzg/r0Zc1CU6pcMA0KUGC8nZvLk1PUa4PTLrtg1nL1iyJsG+fC17O 0y7lnnJ0XikmIpGQb8a3DlFWrTJYKEXPphGD3eMmxsiUrKxk5ysnIuczI1XCCJAV5wdofaFom X-Received: by 2002:a05:620a:1a92:b0:7a1:e341:d543 with SMTP id af79cd13be357-7a7e4cf3a3fmr158797685a.28.1724705060674; Mon, 26 Aug 2024 13:44:20 -0700 (PDT) X-Google-Smtp-Source: AGHT+IF8L+Naz3FkxDynSQ3yMse2qHglqFkf4LqBPi/5cD3sQEuFfYs6yWPMbT2Qk9XtpK98A+7trg== X-Received: by 2002:a05:620a:1a92:b0:7a1:e341:d543 with SMTP id af79cd13be357-7a7e4cf3a3fmr158793685a.28.1724705060390; Mon, 26 Aug 2024 13:44:20 -0700 (PDT) Received: from x1n.redhat.com (pool-99-254-121-117.cpe.net.cable.rogers.com. [99.254.121.117]) by smtp.gmail.com with ESMTPSA id af79cd13be357-7a67f3fd6c1sm491055185a.121.2024.08.26.13.44.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 26 Aug 2024 13:44:19 -0700 (PDT) From: Peter Xu <peterx@redhat.com> To: linux-kernel@vger.kernel.org, linux-mm@kvack.org Cc: Gavin Shan <gshan@redhat.com>, Catalin Marinas <catalin.marinas@arm.com>, x86@kernel.org, Ingo Molnar <mingo@redhat.com>, Andrew Morton <akpm@linux-foundation.org>, Paolo Bonzini <pbonzini@redhat.com>, Dave Hansen <dave.hansen@linux.intel.com>, Thomas Gleixner <tglx@linutronix.de>, Alistair Popple <apopple@nvidia.com>, kvm@vger.kernel.org, linux-arm-kernel@lists.infradead.org, Sean Christopherson <seanjc@google.com>, peterx@redhat.com, Oscar Salvador <osalvador@suse.de>, Jason Gunthorpe <jgg@nvidia.com>, Borislav Petkov <bp@alien8.de>, Zi Yan <ziy@nvidia.com>, Axel Rasmussen <axelrasmussen@google.com>, David Hildenbrand <david@redhat.com>, Yan Zhao <yan.y.zhao@intel.com>, Will Deacon <will@kernel.org>, Kefeng Wang <wangkefeng.wang@huawei.com>, Alex Williamson <alex.williamson@redhat.com> Subject: [PATCH v2 12/19] mm/x86/pat: Use the new follow_pfnmap API Date: Mon, 26 Aug 2024 16:43:46 -0400 Message-ID: <20240826204353.2228736-13-peterx@redhat.com> X-Mailer: git-send-email 2.45.0 In-Reply-To: <20240826204353.2228736-1-peterx@redhat.com> References: <20240826204353.2228736-1-peterx@redhat.com> MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset="US-ASCII"; x-default=true X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240826_134423_865067_11C49000 X-CRM114-Status: GOOD ( 14.48 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: <linux-arm-kernel.lists.infradead.org> List-Unsubscribe: <http://lists.infradead.org/mailman/options/linux-arm-kernel>, <mailto:linux-arm-kernel-request@lists.infradead.org?subject=unsubscribe> List-Archive: <http://lists.infradead.org/pipermail/linux-arm-kernel/> List-Post: <mailto:linux-arm-kernel@lists.infradead.org> List-Help: <mailto:linux-arm-kernel-request@lists.infradead.org?subject=help> List-Subscribe: <http://lists.infradead.org/mailman/listinfo/linux-arm-kernel>, <mailto:linux-arm-kernel-request@lists.infradead.org?subject=subscribe> Sender: "linux-arm-kernel" <linux-arm-kernel-bounces@lists.infradead.org> Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org |
Series |
mm: Support huge pfnmaps
|
expand
|
diff --git a/arch/x86/mm/pat/memtype.c b/arch/x86/mm/pat/memtype.c index 1fa0bf6ed295..f73b5ce270b3 100644 --- a/arch/x86/mm/pat/memtype.c +++ b/arch/x86/mm/pat/memtype.c @@ -951,23 +951,20 @@ static void free_pfn_range(u64 paddr, unsigned long size) static int follow_phys(struct vm_area_struct *vma, unsigned long *prot, resource_size_t *phys) { - pte_t *ptep, pte; - spinlock_t *ptl; + struct follow_pfnmap_args args = { .vma = vma, .address = vma->vm_start }; - if (follow_pte(vma, vma->vm_start, &ptep, &ptl)) + if (follow_pfnmap_start(&args)) return -EINVAL; - pte = ptep_get(ptep); - /* Never return PFNs of anon folios in COW mappings. */ - if (vm_normal_folio(vma, vma->vm_start, pte)) { - pte_unmap_unlock(ptep, ptl); + if (!args.special) { + follow_pfnmap_end(&args); return -EINVAL; } - *prot = pgprot_val(pte_pgprot(pte)); - *phys = (resource_size_t)pte_pfn(pte) << PAGE_SHIFT; - pte_unmap_unlock(ptep, ptl); + *prot = pgprot_val(args.pgprot); + *phys = (resource_size_t)args.pfn << PAGE_SHIFT; + follow_pfnmap_end(&args); return 0; }
Use the new API that can understand huge pfn mappings. Cc: x86@kernel.org Cc: Thomas Gleixner <tglx@linutronix.de> Cc: Ingo Molnar <mingo@redhat.com> Cc: Borislav Petkov <bp@alien8.de> Cc: Dave Hansen <dave.hansen@linux.intel.com> Signed-off-by: Peter Xu <peterx@redhat.com> --- arch/x86/mm/pat/memtype.c | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-)