Message ID | 20240809160909.1023470-15-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 0D120C3DA4A for <linux-mm@archiver.kernel.org>; Fri, 9 Aug 2024 16:10:04 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 6F94F6B00B1; Fri, 9 Aug 2024 12:09:55 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 67F5E6B00B2; Fri, 9 Aug 2024 12:09:55 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 4D23B6B00B3; Fri, 9 Aug 2024 12:09:55 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0010.hostedemail.com [216.40.44.10]) by kanga.kvack.org (Postfix) with ESMTP id 2E8B56B00B1 for <linux-mm@kvack.org>; Fri, 9 Aug 2024 12:09:55 -0400 (EDT) Received: from smtpin12.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay06.hostedemail.com (Postfix) with ESMTP id D3FFAA7F33 for <linux-mm@kvack.org>; Fri, 9 Aug 2024 16:09:54 +0000 (UTC) X-FDA: 82433193108.12.E8B2326 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by imf07.hostedemail.com (Postfix) with ESMTP id B546F40019 for <linux-mm@kvack.org>; Fri, 9 Aug 2024 16:09:50 +0000 (UTC) Authentication-Results: imf07.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=NOHMZTEY; spf=pass (imf07.hostedemail.com: domain of peterx@redhat.com designates 170.10.133.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=1723219726; 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=d0kI5he4gLOJUpsF87CpEeiS1FOCa69CaYI81su9df0=; b=mRlMp2y5lYtn3ub3vg8QUhgEGz7Brudpt5T5RLPXKO++AqX5+zJhBOZ5iey1Rl8Qjp3Iyp PH1Sje42QCFSLXnKUuMmJ7KzB784lAHUgMEKjRh7FbGP7b6cQWruMZUVlgf5SecSo1Xlje ONPgbiRQmEwGynwxC+zZCUxZT5fuC+U= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1723219726; a=rsa-sha256; cv=none; b=VTxm7dlCNIqggil4s7C7fGJkQjGE3Vb960bub9uZ2XdGvwEZUsPgizX548aZ+nA2Sjyy9A XTVBVD3tnxafh9l4y2SOjdXJLnb0KhEDtY3whzapHWh1UwxCuHd7yxRNk5Mq6dgtymxbIK LPYpOl9tiN51poTH6lDonCFJPTHsPLI= ARC-Authentication-Results: i=1; imf07.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=NOHMZTEY; spf=pass (imf07.hostedemail.com: domain of peterx@redhat.com designates 170.10.133.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=1723219789; 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=d0kI5he4gLOJUpsF87CpEeiS1FOCa69CaYI81su9df0=; b=NOHMZTEYQRZqXwCjooRaZ4IBrccp5xFAecuBdzIBmUzItE2s8qswsmxXAd7sJkMm95Z2Rj wo/el++TUrw6Et7EjRKczGEgM0Isme3b3qR7okM/lMbz0qjKQmNofY+SE1lLrlqh1NDQDv jvN0gr9oP/r839zRpBkg5ZkldV5i3Yg= Received: from mail-qt1-f200.google.com (mail-qt1-f200.google.com [209.85.160.200]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-330-KzGBYIAYNNGhMlD_CdVPsg-1; Fri, 09 Aug 2024 12:09:48 -0400 X-MC-Unique: KzGBYIAYNNGhMlD_CdVPsg-1 Received: by mail-qt1-f200.google.com with SMTP id d75a77b69052e-44fe28cd027so3758511cf.0 for <linux-mm@kvack.org>; Fri, 09 Aug 2024 09:09:48 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1723219787; x=1723824587; 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=d0kI5he4gLOJUpsF87CpEeiS1FOCa69CaYI81su9df0=; b=oGHMPAUrkYid0Pgs5cwSTgM1zIIyAoG+q31yWIPKVdiu1ZsIypE/bxlnziHPUiEqDL zQJf2l0L8ZBb5LgKubmyJOq0h6uOCBy6yDeXWCParDuTy1CdwNujirUdxbG6fd3A0TBE NjVur4hn9Zrzega8oFiFQm1Z97a8zoGUj3cNcsWkuFC35757L+g+lUYoX7Np021b8rAf 6z8FLisjM0wXeo9RBxAJbcJSTMGHRDE7Fu6LdiVBGgIorwA4bmzA3r7A7qyUxqgUDsra q5Gkr2WSUMhyR305a3WMreK2KlcGz6HfnmUSaPetYE5l0guFsrCrP2U8p9gcm4ejwp7S l1AQ== X-Gm-Message-State: AOJu0YyYlYBXxTFjMWlsfb+wdVnB+2yltkQd4Wg5eKKO2pAMU1f1eigB TzbScHCAdcEb/Ul6qcut2uJhKNnMTzpybJRs8y6YWUm6zfV/BeJkufcq3gw51hi3ccom2xXsMAJ qiqogGtGcmlOYrQQ7kv5QC6noIuGU/wEnxeK10F5WQYaOSELVBu1Uts0aFQixxG7wt9fxDXcR+L Fq/6qhGg/KRat/AuU5F6cx/yWlRMeyRVjH X-Received: by 2002:ac8:5acc:0:b0:450:26ca:9170 with SMTP id d75a77b69052e-4531255b48dmr13596881cf.5.1723219787344; Fri, 09 Aug 2024 09:09:47 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGxpG5xPFbbw3Y9PVyV1kJ47S21qHA1+Fquj+FmgsVP6Zo0aX1jKS3YWr/9l77XMEl3bpPFxw== X-Received: by 2002:ac8:5acc:0:b0:450:26ca:9170 with SMTP id d75a77b69052e-4531255b48dmr13596351cf.5.1723219786668; Fri, 09 Aug 2024 09:09:46 -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.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 09 Aug 2024 09:09:45 -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 14/19] acrn: Use the new follow_pfnmap API Date: Fri, 9 Aug 2024 12:09:04 -0400 Message-ID: <20240809160909.1023470-15-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: B546F40019 X-Stat-Signature: nctzdc6satapes4q5ki9abjn4aidz9bb X-HE-Tag: 1723219790-201884 X-HE-Meta: U2FsdGVkX1+tkXw6AWolG8GNSeoJGAHfl6dP7ZshSm480an2wYzEhvYxpTawEq9M91r2ANBaREPwMaYLrEe1mzYIn8eAe8kQA/CGqi7+yk5kR0F0mWYmvL2xcHuTFGiQK2ITfO7qtiKZavZu1l32Ed1IIcQKEJVVCwVyxQjq1RCKR7Kbw8VHb7DUWlqwWokKKd/9mBcddRsqrH2/Sjgbe57Z5D4oIz/rHlzUNLJJgxAY60If6dloEgZwgy7lgiy16UtUbAKqzOiD+I1Eyny6TnUX5U0fRn5XLSGC1BUbkSdlAJ/OOGRLWmqqtCHnfYDwLyDcxzHjV2DT/BaPSGcODaNY1GYs6+IvjLiB9nX12kNi/qCL/0buEqsgKBngAYPy0M01Kh6BlxC7EOEMgTu0/BObvd6ABFYirvMvO4zOtnouORD7ltrzxKhpD0El0ZKfeqfkK7YmH9SZiOYq1kyKJOlLDcLT7JGonyOwPKj0Ey6EL9mRK47XdlWJ7PQMT3/LtLfbMws1EhZHNuSr9qu96MO9m46kUUVe+lr5QsS22lbuPnDYNhaCt5o7x/idc5Ah8CvzIGQN2hD47C1w4ILIuuYIR0ohE5j2eM6CeH8QY9OXbrHhnX+ngOwvR/Ir0Co8oa4ESV6XWTNJT+LmMhc6/XbGWGknQPJ7yY/usvxyPyyq6mzcjxpteEPGgbfmCdpmkkr8wwml6UiN27sZMYqEURWJ88Smn011Gl0Hpjr0lTykIg4WHrh29ODuWEV3QHUPF3NYe3h1+Bo9Atep0jOuWX6OICDfCl8GlXMBRplswMNirkAjYvWG/3J9FHOcLCiUORa9ksPxO5sGEK9CvwtRCXM3GeUk9iAr1+2DP2tYiEraV3IXnoVLUbI/MP17CUfffWAWpagxcWWQSmgN2pfej8c/sCzz/06h7+4f7CU1n2ftqVgphzHefw1Z+EBIidTB6UslMkwdL9HT7QRMoZy B4XwekZv /Hkd09SAxWvDo8QuO2o3OizGs92LjmV0tRmzi9RhOD2PeYk44PH5mSQSmkvWWIWSdEvdytzeOlQ3SUTFxLfn8AQY2rtOXk3hNTIuIXB3v1yUL9JIiY43NCoo5UXoC3HQpC0YoyEIwmVKl7KdXBF1m7PJ/nt6znboDZFscSFpRhK14cTGtoOuASRnU32y+wyIR0qckz6ms1iCMl5pheWnEEB0+/30GUqbco/OJUeYYaCeX7cnU4G7/b5syJm+2WyaqZXuE18qzsOcZlSJNcQqAJQn/97yqd70qGR3S1c3dFd+ozbgb4684pkuat9gvkB3vaEUJb6pudDV2kh2qosyDmhbzfjmlkL9jnQrfSOKWQmOy1ORB2Ia9sUWzf5VR9tKAYeVfqhK+huH9e+5rFtz17hwdkiEeAO/gJif5o2WEUw+FOLQjeutQj4J6YDbHovUjM0oO4hrzhhbt+VijApnCwcCyxS9Q/QFo6qOtFXCoI0vB35NZd1NcG6BP3aBOtRVVluN8 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/drivers/virt/acrn/mm.c b/drivers/virt/acrn/mm.c index db8ff1d0ac23..4c2f28715b70 100644 --- a/drivers/virt/acrn/mm.c +++ b/drivers/virt/acrn/mm.c @@ -177,9 +177,7 @@ int acrn_vm_ram_map(struct acrn_vm *vm, struct acrn_vm_memmap *memmap) vma = vma_lookup(current->mm, memmap->vma_base); if (vma && ((vma->vm_flags & VM_PFNMAP) != 0)) { unsigned long start_pfn, cur_pfn; - spinlock_t *ptl; bool writable; - pte_t *ptep; if ((memmap->vma_base + memmap->len) > vma->vm_end) { mmap_read_unlock(current->mm); @@ -187,16 +185,20 @@ int acrn_vm_ram_map(struct acrn_vm *vm, struct acrn_vm_memmap *memmap) } for (i = 0; i < nr_pages; i++) { - ret = follow_pte(vma, memmap->vma_base + i * PAGE_SIZE, - &ptep, &ptl); + struct follow_pfnmap_args args = { + .vma = vma, + .address = memmap->vma_base + i * PAGE_SIZE, + }; + + ret = follow_pfnmap_start(&args); if (ret) break; - cur_pfn = pte_pfn(ptep_get(ptep)); + cur_pfn = args.pfn; if (i == 0) start_pfn = cur_pfn; - writable = !!pte_write(ptep_get(ptep)); - pte_unmap_unlock(ptep, ptl); + writable = args.writable; + follow_pfnmap_end(&args); /* Disallow write access if the PTE is not writable. */ if (!writable &&
Use the new API that can understand huge pfn mappings. Signed-off-by: Peter Xu <peterx@redhat.com> --- drivers/virt/acrn/mm.c | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-)