Message ID | 20240809160909.1023470-13-peterx@redhat.com (mailing list archive) |
---|---|
State | New |
Headers | show
Return-Path: <owner-linux-mm@kvack.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 kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2E53BC3DA4A for <linux-mm@archiver.kernel.org>; Fri, 9 Aug 2024 16:09:54 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 7E26A6B0085; Fri, 9 Aug 2024 12:09:48 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 792866B008A; Fri, 9 Aug 2024 12:09:48 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 5BE496B008C; Fri, 9 Aug 2024 12:09:48 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0013.hostedemail.com [216.40.44.13]) by kanga.kvack.org (Postfix) with ESMTP id 368E16B0085 for <linux-mm@kvack.org>; Fri, 9 Aug 2024 12:09:48 -0400 (EDT) Received: from smtpin13.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay06.hostedemail.com (Postfix) with ESMTP id ED7B3A7B10 for <linux-mm@kvack.org>; Fri, 9 Aug 2024 16:09:47 +0000 (UTC) X-FDA: 82433192814.13.970C691 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by imf17.hostedemail.com (Postfix) with ESMTP id E97C340034 for <linux-mm@kvack.org>; Fri, 9 Aug 2024 16:09:45 +0000 (UTC) Authentication-Results: imf17.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=M4WnckVP; spf=pass (imf17.hostedemail.com: domain of peterx@redhat.com designates 170.10.129.124 as permitted sender) smtp.mailfrom=peterx@redhat.com; dmarc=pass (policy=none) header.from=redhat.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1723219719; 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-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=dHUdq0ZI2fvSzmSbu56kn/TFI4mY4GVPslnR6ZzQETQ=; b=0XsdGpyJefWZlPDE/A8xVxHge7ecHZzj9oF68WkWbknNOmO0wOqrdtb4B2F6T8UuX4QjjJ 6do1yVJlMdKi8zZufINnDQUOc4PR7ybz+kSpNl+tCn0qF23L4AGqJYJd683zycBpn9ZYJS k2JSICHq0BCRIiryfxwlwprOv1pTxSk= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1723219719; a=rsa-sha256; cv=none; b=5/QZDtFxF0zOMGDPZd8GmLNlHToM7kVt0GO3fOnOYE9nayHCLryI21hdb8bue2QIkvd5pN Kn87+esDXQE+psEFKdjgEeMY887yxs/GVcaUsJmFqVB8coVO6/ZCqth71oj/BDefWzdziH UGIaSdKSV9mRSwIRPXp98QzZ52cin9g= ARC-Authentication-Results: i=1; imf17.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=M4WnckVP; spf=pass (imf17.hostedemail.com: domain of peterx@redhat.com designates 170.10.129.124 as permitted sender) smtp.mailfrom=peterx@redhat.com; dmarc=pass (policy=none) header.from=redhat.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1723219785; 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=dHUdq0ZI2fvSzmSbu56kn/TFI4mY4GVPslnR6ZzQETQ=; b=M4WnckVPRZ/ed4FeZ2sm8w1yEUZCH8/WLlOIC647Sjaa+FfBBX72x2WRm1DZJHZnFUDpi6 4LJVRasHq7NwEzmVNMcZxO0Vlcvq0hAeX7ECIt2TkX8wrbuFQZkKZrCLxS5W+KD5goc/sC DZnt1GzIxUpWV29dpgcS2s2mk0vDDgI= Received: from mail-qv1-f70.google.com (mail-qv1-f70.google.com [209.85.219.70]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-137-GzvSfFNLMHGBRB4U3x0ypA-1; Fri, 09 Aug 2024 12:09:44 -0400 X-MC-Unique: GzvSfFNLMHGBRB4U3x0ypA-1 Received: by mail-qv1-f70.google.com with SMTP id 6a1803df08f44-6b79c5c972eso2605496d6.1 for <linux-mm@kvack.org>; Fri, 09 Aug 2024 09:09:44 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1723219783; x=1723824583; 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=dHUdq0ZI2fvSzmSbu56kn/TFI4mY4GVPslnR6ZzQETQ=; b=PITtNq4dGvISeRKQulLxAk3vPduiBzhdxAiud4awygS+IR6plFJdii9EFC5HopHpNf xwas6TvWehoIkf/2Ah2bousHvmUyVCjAzvnPqmmiTfwhdqggau07QJTSYBVLIdvyGnbe whFDSPeEo9fxHaxyyIsYU4t0+s/HpjbHV47H24Sgtr1XRYSCyDkXF4+bBT1oqM3iBLNR zw1/RR5EF4CzglATukvccEE1f7381GP+kN4TQq9FENL7eN67lIdD2ia9x7ydi0YeWUFk QYMJ/ZYd5lGL2vKA/IFrwh9Deg8vuuW5sUf+xZ12L5wPhM4YlsHIMhU7bca8rmOUpPe8 6wag== X-Gm-Message-State: AOJu0Ywq5QjX1+J7AIQf8qA3Tv9VuXwWMnsF21yZVQnaD5D0TO+taHVF j512Yary/tbb6bHGzwJU38svS+ezn5+oeoKWsUFu1iVPBscm5KvgXRNlmT3Tdn1Pmg6z6xjw12w PwDIvOhfUgPWlYorF1kxlVo5G5etZY/pAHmJT8d6xwa9Jd46OQ4oSw0g7HLXalEVjlWT6J0YUMW Nu6baO9ilJbjwNBV4xWm2dfR+XBBPo2t8r X-Received: by 2002:a05:620a:460d:b0:7a3:5e3f:cbf4 with SMTP id af79cd13be357-7a4c18467b6mr127416985a.8.1723219782888; Fri, 09 Aug 2024 09:09:42 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFqMMArTR19FgmAq+7tz35tycS6tSaD4MMjthIpuW8WNcff+L3Yj5M2c5Huoz5dZxDipeszqw== X-Received: by 2002:a05:620a:460d:b0:7a3:5e3f:cbf4 with SMTP id af79cd13be357-7a4c18467b6mr127412385a.8.1723219782335; Fri, 09 Aug 2024 09:09:42 -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 d75a77b69052e-451c870016csm22526741cf.19.2024.08.09.09.09.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 09 Aug 2024 09:09:41 -0700 (PDT) From: Peter Xu <peterx@redhat.com> To: linux-mm@kvack.org, linux-kernel@vger.kernel.org Cc: Sean Christopherson <seanjc@google.com>, Oscar Salvador <osalvador@suse.de>, Jason Gunthorpe <jgg@nvidia.com>, Axel Rasmussen <axelrasmussen@google.com>, linux-arm-kernel@lists.infradead.org, x86@kernel.org, peterx@redhat.com, Will Deacon <will@kernel.org>, Gavin Shan <gshan@redhat.com>, Paolo Bonzini <pbonzini@redhat.com>, Zi Yan <ziy@nvidia.com>, Andrew Morton <akpm@linux-foundation.org>, Catalin Marinas <catalin.marinas@arm.com>, Ingo Molnar <mingo@redhat.com>, Alistair Popple <apopple@nvidia.com>, Borislav Petkov <bp@alien8.de>, David Hildenbrand <david@redhat.com>, Thomas Gleixner <tglx@linutronix.de>, kvm@vger.kernel.org, Dave Hansen <dave.hansen@linux.intel.com>, Alex Williamson <alex.williamson@redhat.com>, Yan Zhao <yan.y.zhao@intel.com> Subject: [PATCH 12/19] mm/x86/pat: Use the new follow_pfnmap API Date: Fri, 9 Aug 2024 12:09:02 -0400 Message-ID: <20240809160909.1023470-13-peterx@redhat.com> X-Mailer: git-send-email 2.45.0 In-Reply-To: <20240809160909.1023470-1-peterx@redhat.com> References: <20240809160909.1023470-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-Rspam-User: X-Rspamd-Server: rspam04 X-Rspamd-Queue-Id: E97C340034 X-Stat-Signature: uy8s16aehcncw3ufk66xn89eog7x5dbx X-HE-Tag: 1723219785-236205 X-HE-Meta: U2FsdGVkX184VJbSR5HOJDytVQ/hmCfHB+WvBI7HuCWlWMQEGO1bWL4iBGNGkcY3J23oBo8RF1GQfI3Xo6fReYaws5Jv5FxqMFAeghd0ClUJb7khfXwvhsVo8qxOoqxnhROW/Gw7622AsaHG5Q5UrKfyRBx9/krdmS3ZQ7fqeY3bPbZf/8pJn+Z9Wd/NFNUJL8sgCTSRz/dP17fuhfS+wjC699KdnUlru0/srxMdcZzUDMyoGJf2+d2b7WSqxi7Hn2W8opCyFqVPgEWVDpEqaoGqjlMD6To8ehSMW8e6zpPmRYrXeqlYkokBDJ+IT+s8ahTq5m7XB/b0+EKteREEvlLsYHMbhVid3PM8MSxj5yp6de6ST3TlT1oD4kgRMoavcV32uJUWh0sY2pOqIbZIx5CQdK/zI5SAEjH3w7/PKZ76fX/9TgxQOE/OQTLu1YymbuG4s8k4qIYsA2jF/oNLOcrWTWp/BW9gDY8slerYHpY9gktX/qGR9bXbv4dio6bRu2YfSn88oGoJnkwgcm9iNIlskkytP925swqB/Z9r4bmMyz/I+7DhpNBO67FgodROidxQsUA/HgKNQowkrz0719/s2pTft7JO4e1BsjD61W6iniUY8yW5MxMYUwnNKUrMnpxUdS9AwYLXGYKGCW2Y2RO/0Ck/nFJf3sj1rhepYncdWBEsw4t1brL+tioJGFUhHgZMGPZBolDlMu+sVtQVGv/xvmWkS0ItJ9QnA/RcBn1OLnejHyJ08SuFpFLXpwAFVYHGc8maUv2TUyo4rh8a29yftFcDgwveh6rtt1YfqRX2N+pyFA6FDuhgeaEy3WoogvkQc6fGlOK1Eq1nsR7L8QEnlMl0enuHAXnYV+ZYVZGOasQPNgLIanFH1UgseGivOe3ywZRbE7JL5GUwimCz95VfQJ16CdK3Mg4WHG87AGMYsRKxi9nTurshuJIpWGpM9yn89angYL1SrJTNKgh 4Ifjl92o 65oMhPZP4jUDpCJpHVIrDBbxFf6GztWQ5agPCj502jCAJjh4aRtMSDvG0PdySkDxGVMbKOntIslk1BzbKMJwccK6Rr1Nr8jLB+di8bsZUmRxWP6eHb7jDNxKu77PxAxUb4B9h6CpPgl76qpKU/mcUbrfMxlurHkyPg4jjuJfS4tue0LmoyHJk1IU3p72LeRHJE72gBtUlzIQdVSeWDI1yIfXJyAe5C+WNY5Oc2UHeGkY6mEFvMUn1OXAmydEw6n/0snFjaTgQsB1tiZTjThRnwebWrCCKjAUdpJ0ihZU1fzfxXma2kFoSqMq2SlbcyQzo4N7I7itROwpcCTZZvK9yHydRsxy24r+PwsAq08lA+Z8ynGQpz/mREqBv+LX4TsK5MEqPfRSxQyuk3pE0gqx9ec726qNFfP5mznlrDh9nWSmKaMc= 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: <linux-mm.kvack.org> List-Subscribe: <mailto:majordomo@kvack.org> List-Unsubscribe: <mailto:majordomo@kvack.org> |
Series |
mm: Support huge pfnmaps
|
expand
|
diff --git a/arch/x86/mm/pat/memtype.c b/arch/x86/mm/pat/memtype.c index bdc2a240c2aa..fd210b362a04 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(-)