From nobody Sat Apr 20 01:56:26 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=fail(p=none dis=none) header.from=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1592363229; cv=none; d=zohomail.com; s=zohoarc; b=A5IvbF6NEo/kWUQdtecIe8IpHKJ1yGZrLpDJS02A+HNZjPX9WsvyzuoQrHE0y0+cmjt+xylC2oYddck8A3v7QixusFLItIZenq1Ck6xdVtqVGfee7pSw6tDR7Z02VaZFMTPM8PkRd0IqUkL7vuHDLH+yujqkGyvriQ24UmIfWJY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1592363229; h=Cc:Date:From:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:Message-ID:Sender:Subject:To; bh=dq2SjmoQupE4U9LhXdo/f9IZ6YV5RooIfJwqe+qSBlg=; b=Pv6cTtsstuiUljVQH0LfR3/kOiP3gstAghrccXVO4ld6JpfT8G2G2dCcplDxTigb1/T1hkh5jj1LtQFueyqbSNoMX3b9Eh0hD+eXzThn7v5/AWlkI44dawxFIymHI4jGb94QJS1smdfgzhMUrZRcw8j7X57PPPWWr/YgmQ3HMTo= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1592363229432500.4467719807353; Tue, 16 Jun 2020 20:07:09 -0700 (PDT) Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1jlOPd-0007MX-7f; Wed, 17 Jun 2020 03:06:53 +0000 Received: from us1-rack-iad1.inumbo.com ([172.99.69.81]) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1jlOPb-0007MR-Tc for xen-devel@lists.xenproject.org; Wed, 17 Jun 2020 03:06:51 +0000 Received: from mail-pf1-x443.google.com (unknown [2607:f8b0:4864:20::443]) by us1-rack-iad1.inumbo.com (Halon) with ESMTPS id 96fd4fe2-b047-11ea-bca7-bc764e2007e4; Wed, 17 Jun 2020 03:06:51 +0000 (UTC) Received: by mail-pf1-x443.google.com with SMTP id 23so415292pfw.10 for ; Tue, 16 Jun 2020 20:06:51 -0700 (PDT) Received: from jordon-HP-15-Notebook-PC.domain.name ([122.171.213.184]) by smtp.gmail.com with ESMTPSA id g19sm18210446pfo.209.2020.06.16.20.06.47 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Tue, 16 Jun 2020 20:06:49 -0700 (PDT) X-Inumbo-ID: 96fd4fe2-b047-11ea-bca7-bc764e2007e4 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id; bh=dq2SjmoQupE4U9LhXdo/f9IZ6YV5RooIfJwqe+qSBlg=; b=cRtzcfZIAK/fnCW3uavu1pTWu4tlI6Gez8w4jjX7ksTVmViB2GmyPtbfv4pHB2N0B7 52+2ATk8e+AdXsI+gEvmXN+4fq+8vjqv5o1Q0+Vd0gW34QPnbxztqI7LwNR9biWgAZ+K iouMSgsyC99J7dM0nr1U+0TzVOj6EhcTo2mWN62PK3JzQGIoX4VIrHq49FgsD5+CV6F5 qU4zo67ue4q3ETFJqak0LoXVYaD8bpLC4qjg64CJULa32Hlk6S/kdBQ2e+0k+xTrp5Ap r2l0ZLwk0wBa1V5SVadZXT7AZlW/xY4KUHIACaXXJvCEgsyULxXV6Kpj0/Uv1SEvLz6T rMxw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=dq2SjmoQupE4U9LhXdo/f9IZ6YV5RooIfJwqe+qSBlg=; b=hORn5p17sHhQpeBUECYZqH+SbV/gvZteRVgMX5dIg7ZmA6ZS0arz1AbZKgGkjTIA2U JqBmK9eqngpxXZRNW+8z7tTGp8onjoVNWRuf/CWZqTirJ+qtY+AUbNzjtypkYLTyoPNx GbIx2s3LfSPGoWNvuFGGoE0m/JFux75/g4n8gLu6lS05xpiVE3dwMNkV2uvanHra9FmK gB+JCcvsTqsMLEfbqFyB0UfVa9y7kMC8P5prvy9+EeU6qouzGwoN+0WujfymYqRPYvgp leiMvD4QnMVrH/OLdvhLdcfVxSIuS/CFoysZ8IvE+rabMCPtOCR//8SVz5QuHs69q2l7 aEjQ== X-Gm-Message-State: AOAM531mQFmIi9AI9nm5uccO+UNgbmtVwrD231Zs53YAmNei/KTJu8NA 2xpUQM8ut4viA0P4E9FRJ2Y= X-Google-Smtp-Source: ABdhPJw//k0NXcYX0XzZ+Ih/gjrZwd7t+FwVka95iS2KhwMy/vQRUu8NT/fZjBz2+jqHCu7RJ8h7ag== X-Received: by 2002:a63:4822:: with SMTP id v34mr3878745pga.81.1592363210656; Tue, 16 Jun 2020 20:06:50 -0700 (PDT) From: Souptick Joarder To: boris.ostrovsky@oracle.com, jgross@suse.com, sstabellini@kernel.org Subject: [RFC PATCH] xen/privcmd: Convert get_user_pages*() to pin_user_pages*() Date: Wed, 17 Jun 2020 08:44:58 +0530 Message-Id: <1592363698-4266-1-git-send-email-jrdr.linux@gmail.com> X-Mailer: git-send-email 1.9.1 X-BeenThere: xen-devel@lists.xenproject.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Cc: xen-devel@lists.xenproject.org, linux-kernel@vger.kernel.org, John Hubbard , Souptick Joarder Errors-To: xen-devel-bounces@lists.xenproject.org Sender: "Xen-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" In 2019, we introduced pin_user_pages*() and now we are converting get_user_pages*() to the new API as appropriate. [1] & [2] could be referred for more information. [1] Documentation/core-api/pin_user_pages.rst [2] "Explicit pinning of user-space pages": https://lwn.net/Articles/807108/ Signed-off-by: Souptick Joarder Cc: John Hubbard --- Hi, I have compile tested this patch but unable to run-time test, so any testing help is much appriciated. Also have a question, why the existing code is not marking the pages dirty (since it did FOLL_WRITE) ? drivers/xen/privcmd.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/drivers/xen/privcmd.c b/drivers/xen/privcmd.c index a250d11..543739e 100644 --- a/drivers/xen/privcmd.c +++ b/drivers/xen/privcmd.c @@ -594,7 +594,7 @@ static int lock_pages( if (requested > nr_pages) return -ENOSPC; =20 - pinned =3D get_user_pages_fast( + pinned =3D pin_user_pages_fast( (unsigned long) kbufs[i].uptr, requested, FOLL_WRITE, pages); if (pinned < 0) @@ -614,10 +614,7 @@ static void unlock_pages(struct page *pages[], unsigne= d int nr_pages) if (!pages) return; =20 - for (i =3D 0; i < nr_pages; i++) { - if (pages[i]) - put_page(pages[i]); - } + unpin_user_pages(pages, nr_pages); } =20 static long privcmd_ioctl_dm_op(struct file *file, void __user *udata) --=20 1.9.1