Message ID | 20240826204353.2228736-14-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 E1E95C5472C for <linux-mm@archiver.kernel.org>; Mon, 26 Aug 2024 20:44:39 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id C7D596B00A4; Mon, 26 Aug 2024 16:44:27 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id BB1946B00A5; Mon, 26 Aug 2024 16:44:27 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 9B94F6B00A6; Mon, 26 Aug 2024 16:44:27 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0014.hostedemail.com [216.40.44.14]) by kanga.kvack.org (Postfix) with ESMTP id 797A56B00A4 for <linux-mm@kvack.org>; Mon, 26 Aug 2024 16:44:27 -0400 (EDT) Received: from smtpin28.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay07.hostedemail.com (Postfix) with ESMTP id 31C06161384 for <linux-mm@kvack.org>; Mon, 26 Aug 2024 20:44:27 +0000 (UTC) X-FDA: 82495574574.28.86C0DFA Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by imf11.hostedemail.com (Postfix) with ESMTP id 266964002A for <linux-mm@kvack.org>; Mon, 26 Aug 2024 20:44:25 +0000 (UTC) Authentication-Results: imf11.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=hDMkfdUF; dmarc=pass (policy=none) header.from=redhat.com; spf=pass (imf11.hostedemail.com: domain of peterx@redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=peterx@redhat.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1724704969; 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=HLBqit68L/U2mdwYaFkydFK3txHa+LkmL8n2YTQXnnw=; b=AZc14GZICIprQ36xb936tsYZT1EiNO2Jaz/VCEQvp3A+qFG1FWd6K9J2CqgCD8h2YCYnVx vS2E18qR4GCndWW9rKYShUwWhV+w2CK7/fYc7W2nB5shtzLC2WTle+9Ue6Ah+e96CFsKmb duQP+m8yVdqKxpk9C+zMZA/azrANwdk= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1724704969; a=rsa-sha256; cv=none; b=kKyP1q+eESIR88EOKXuCm56BObAKws8d20oBTBkyTHR6HiDS0Iiuq08xDC5tRCwl+osZqh 7ydx10mIwagZqrv3xoYQzsx7czFXrQblA/wehf5HnC1wMG/lW6L4ZtfBmm5zTohTC47b4K r+KUJQpnUdN6L5cQ8xF5D/QY8l0/u0k= ARC-Authentication-Results: i=1; imf11.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=hDMkfdUF; dmarc=pass (policy=none) header.from=redhat.com; spf=pass (imf11.hostedemail.com: domain of peterx@redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=peterx@redhat.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1724705064; 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=HLBqit68L/U2mdwYaFkydFK3txHa+LkmL8n2YTQXnnw=; b=hDMkfdUFa2+crLVYgkKa35feEWHHtuXyYrUwt5xQQkbcedtdoZAfa642vdy0qaR4daPto0 M0tgUiRz1zwJyv4J56pMuE9Qgm+nzRxRLpk1t6GkiHWk7iJBMmWPEpgcXfEbk3SB0N1oXP J/oTRCYdXknDa+beaM2vnXsntJBiWW8= Received: from mail-yw1-f197.google.com (mail-yw1-f197.google.com [209.85.128.197]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-374-QJ2XF0_JNIWBv40XbTA59g-1; Mon, 26 Aug 2024 16:44:23 -0400 X-MC-Unique: QJ2XF0_JNIWBv40XbTA59g-1 Received: by mail-yw1-f197.google.com with SMTP id 00721157ae682-6b43e6b9c82so112909007b3.0 for <linux-mm@kvack.org>; Mon, 26 Aug 2024 13:44:23 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1724705062; x=1725309862; 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=HLBqit68L/U2mdwYaFkydFK3txHa+LkmL8n2YTQXnnw=; b=gOVJovX+mZY7ofjecCDHh27t4SO2Dy7Sq5IZ+CZIIY36xYGCbkPhLCR88I1dEdoDxl L5Tq9/5SZ0JRGY2dzcL5Z+6gOt2Dh9u7zFltrD8FX+n/DdNVJpeHxinw1o2xXjXSmBza yAOwLvGGJdpioEI0gUfxf8crRQsJ+csdbAtfVhMW5FmJhKvN+GExFpdm0A73f6ook4oY 6fzfmhTihR1dOLotFTRAAqV1uCaA1jbpNxoiryNmDAocYCtYbfdU1P7XMqDnz7fCs5Ui znXB2RJCxEhOCaMCHGUBRPBDRhm+8QAUjVwRJCpm+oqibbgOGhQ1kG4M6ueQ/ap3ZZhS PJ7A== X-Forwarded-Encrypted: i=1; AJvYcCUPqal5Tsg9WHHYoRMi+ufYNU7adk4yGPMCq2Elym0Bh3kKyuujZU987ZIIMhpV69tzG5eZv7hMew==@kvack.org X-Gm-Message-State: AOJu0Yyccir0ImNSajWG4BofKas8MgLCYgw1doyCy0H24KI3ax709axA v0WC3OJrU7b9hydinpQLVIEt3XX+fp6KREoZWaqFq19IeJNF1vFZIJvhSIIFCAwBa/MbB3/+SM2 jplfnv0+e3z9sl7F6I4k4X8P45eyQ20rbKOjRFBRv0eOydIsc X-Received: by 2002:a05:690c:39b:b0:62f:aaaa:187a with SMTP id 00721157ae682-6c625a4cc55mr151107077b3.14.1724705062748; Mon, 26 Aug 2024 13:44:22 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGeaoJv/EbB8r7mSzacjacGidgTJuNMUQKi5I30qkj93MEO5BseX564RMMiUfXmELj5ALvNSw== X-Received: by 2002:a05:690c:39b:b0:62f:aaaa:187a with SMTP id 00721157ae682-6c625a4cc55mr151106717b3.14.1724705062426; Mon, 26 Aug 2024 13:44:22 -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.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 26 Aug 2024 13:44:21 -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 13/19] vfio: Use the new follow_pfnmap API Date: Mon, 26 Aug 2024 16:43:47 -0400 Message-ID: <20240826204353.2228736-14-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-Rspamd-Server: rspam07 X-Rspamd-Queue-Id: 266964002A X-Stat-Signature: zu5jgo34mwy5ig7kogo8aey66b3ztgdo X-Rspam-User: X-HE-Tag: 1724705064-51033 X-HE-Meta: U2FsdGVkX18UMbQO5ATNSPNh1LwLn/YiZoM10Wzg7kz4oovztj34MnV7c/+O+WrT9R3wMJ1CSeohCWlvrdYTIb2xoxTxkY/5QGzcE+4bdzd8BUvIPEZ7ww8XdtKaByGCK1l1Mq8wMoq5w7Tpy7Hke+qr3eVCZNJ66dOyBA1E0havZ9apwoVHosSVE4dZc5eeBT/ptgREkNpvl0P4eepiS8dkVC8uUGEY1lab/l5GUasCryBCYuy2UheIKWhlO+w3+C+m29BQIPyMnbYVwWh/rGGnK0ZUsOdHz4XyDkZeG19gmMkGZp8Gs01e02LJY/bHL3UymYpVVOsksLf9S4mPq0O+x6Nwk9HYG+JKT5xORMdErhQUr0LZCBJ6uNfs2P4AWdfZM4Zp+UR+vfPXh/2A+4gVPm4rVnsokgq2sbMn9sI6TqfByOD38ECkjSxyGCkLL843KyKhbma3pbLIymh/s69QPyQzYOlEUsz0W/5qDnPKWg6HJvNI/nbkfK49QepBRm/SnTcpSGXaPgz8sw6XK+Kyrx7QynHzWP30rQPLWW8X02oFKvnc2s1zGtdX/2Q7AskNpOuGMIDkKXzx4OOeRXEgyKO1vTnxYRjbXn22fLtgx4FCxKc1qw6jIJdkELEYpWXBdA589MC17Udh06/6uXfyw8zWOsMUy02+jBhA7+9RUnhUyTCijiaVkkRNGvHmAZAz9sz0NxNCZMCHmM/ea5wMWRyb9nrO5n/5wn8gszndZpnfC+1Nytdp6f3jsZ5X1StZ1fdNz2URfukDgwsSQL34R25eLEMmNX9W7HX1R+jaYS4/CCED4nCRvK8su+H1m+O7jECjpBhufX3K96nJN54XK7JCmjGYRjsQnGISbd6oYS4dZCnD4PsAmJTjmE41X1Q8LFVN1a08oY53Nb+DGhsIFYKKxbzgdmluhlhM/OVfyRdoATpDY1AERqlnNA/W1ArbIAs1NC/eLwqdWFF V0/Wie0K v4xfgnxI5TLtODWGIprsmNRb76JF+D9G3q8PaQdFS5aXvFva9pVfSjL2rM+r+2/Pxpppa3qffYXUk69pfJVOC37kLD6zXzVm5nBoRq7AZReW16qhQ6iRVy8xF/WLro2sKPpBRtcIBDNiDt2wNA2PeuTgrQ2/oYfaGeN78LwlcCg9dS/Lnc1XiNB5DpGz8kjSqWjLzvaeakv52DkFJjQDZMy7Kfw+wAVv48PcV1htAJPd9FOgYqcs701sgLsWPoHyFY4gMLPA2uHymrddAl6PjJOdlnTgksCSNYvKSsU6ZKCKVNKbFMVaBj0IIOjW9O3flthrG6VJoHPRNS8aOnrVWE4HjH+EZYBp+HQqDmvRJRNR3Y6qj19Ein1IX6Dozs2SR+/0i92c3ArRTfGTWNhfBnDz9rouP3U2/I26i 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/vfio/vfio_iommu_type1.c b/drivers/vfio/vfio_iommu_type1.c index 0960699e7554..bf391b40e576 100644 --- a/drivers/vfio/vfio_iommu_type1.c +++ b/drivers/vfio/vfio_iommu_type1.c @@ -513,12 +513,10 @@ static int follow_fault_pfn(struct vm_area_struct *vma, struct mm_struct *mm, unsigned long vaddr, unsigned long *pfn, bool write_fault) { - pte_t *ptep; - pte_t pte; - spinlock_t *ptl; + struct follow_pfnmap_args args = { .vma = vma, .address = vaddr }; int ret; - ret = follow_pte(vma, vaddr, &ptep, &ptl); + ret = follow_pfnmap_start(&args); if (ret) { bool unlocked = false; @@ -532,19 +530,17 @@ static int follow_fault_pfn(struct vm_area_struct *vma, struct mm_struct *mm, if (ret) return ret; - ret = follow_pte(vma, vaddr, &ptep, &ptl); + ret = follow_pfnmap_start(&args); if (ret) return ret; } - pte = ptep_get(ptep); - - if (write_fault && !pte_write(pte)) + if (write_fault && !args.writable) ret = -EFAULT; else - *pfn = pte_pfn(pte); + *pfn = args.pfn; - pte_unmap_unlock(ptep, ptl); + follow_pfnmap_end(&args); return ret; }
Use the new API that can understand huge pfn mappings. Cc: Alex Williamson <alex.williamson@redhat.com> Cc: Jason Gunthorpe <jgg@nvidia.com> Signed-off-by: Peter Xu <peterx@redhat.com> --- drivers/vfio/vfio_iommu_type1.c | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-)