From: Dan Williams <dan.j.williams@intel.com>
To: akpm@linux-foundation.org
Cc: Jan Kara <jack@suse.cz>, Joonyoung Shim <jy0922.shim@samsung.com>,
linux-nvdimm@lists.01.org, Seung-Woo Kim <sw0312.kim@samsung.com>,
linux-kernel@vger.kernel.org, stable@vger.kernel.org,
Inki Dae <inki.dae@samsung.com>,
linux-mm@kvack.org, Kyungmin Park <kyungmin.park@samsung.com>,
Mel Gorman <mgorman@suse.de>,
Mauro Carvalho Chehab <mchehab@kernel.org>,
hch@lst.de, Vlastimil Babka <vbabka@suse.cz>,
linux-media@vger.kernel.org
Subject: [PATCH v3 2/4] mm: fail get_vaddr_frames() for filesystem-dax mappings
Date: Wed, 29 Nov 2017 10:05:40 -0800 [thread overview]
Message-ID: <151197874035.26211.4061781453123083667.stgit@dwillia2-desk3.amr.corp.intel.com> (raw)
In-Reply-To: <151197872943.26211.6551382719053304996.stgit@dwillia2-desk3.amr.corp.intel.com>
Until there is a solution to the dma-to-dax vs truncate problem it is
not safe to allow V4L2, Exynos, and other frame vector users to create
long standing / irrevocable memory registrations against filesytem-dax
vmas.
Cc: Inki Dae <inki.dae@samsung.com>
Cc: Seung-Woo Kim <sw0312.kim@samsung.com>
Cc: Joonyoung Shim <jy0922.shim@samsung.com>
Cc: Kyungmin Park <kyungmin.park@samsung.com>
Cc: Mauro Carvalho Chehab <mchehab@kernel.org>
Cc: linux-media@vger.kernel.org
Cc: Mel Gorman <mgorman@suse.de>
Cc: Vlastimil Babka <vbabka@suse.cz>
Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: <stable@vger.kernel.org>
Fixes: 3565fce3a659 ("mm, x86: get_user_pages() for dax mappings")
Reviewed-by: Jan Kara <jack@suse.cz>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
---
mm/frame_vector.c | 12 ++++++++++++
1 file changed, 12 insertions(+)
diff --git a/mm/frame_vector.c b/mm/frame_vector.c
index 2f98df0d460e..297c7238f7d4 100644
--- a/mm/frame_vector.c
+++ b/mm/frame_vector.c
@@ -53,6 +53,18 @@ int get_vaddr_frames(unsigned long start, unsigned int nr_frames,
ret = -EFAULT;
goto out;
}
+
+ /*
+ * While get_vaddr_frames() could be used for transient (kernel
+ * controlled lifetime) pinning of memory pages all current
+ * users establish long term (userspace controlled lifetime)
+ * page pinning. Treat get_vaddr_frames() like
+ * get_user_pages_longterm() and disallow it for filesystem-dax
+ * mappings.
+ */
+ if (vma_is_fsdax(vma))
+ return -EOPNOTSUPP;
+
if (!(vma->vm_flags & (VM_IO | VM_PFNMAP))) {
vec->got_ref = true;
vec->is_pfns = false;
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
next prev parent reply other threads:[~2017-11-29 18:13 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-11-29 18:05 [PATCH v3 0/4] introduce get_user_pages_longterm() Dan Williams
2017-11-29 18:05 ` [PATCH v3 1/4] mm: introduce get_user_pages_longterm Dan Williams
2017-11-30 9:53 ` Michal Hocko
2017-11-30 16:39 ` Dan Williams
2017-11-30 17:42 ` Michal Hocko
2017-11-30 18:03 ` Dan Williams
2017-11-30 18:17 ` Michal Hocko
2017-11-30 18:32 ` Dan Williams
2017-11-30 19:01 ` Jason Gunthorpe
2017-12-01 10:12 ` Michal Hocko
2017-12-01 16:02 ` Jason Gunthorpe
2017-12-01 16:29 ` Dan Williams
2017-12-01 16:31 ` Jason Gunthorpe
2017-12-04 9:31 ` Michal Hocko
2017-12-04 17:01 ` Dan Williams
2017-11-29 18:05 ` Dan Williams [this message]
2017-11-29 18:05 ` [PATCH v3 3/4] [media] v4l2: disable filesystem-dax mapping support Dan Williams
2017-11-29 18:05 ` [PATCH v3 4/4] IB/core: disable memory registration of fileystem-dax vmas Dan Williams
2017-11-29 18:36 ` Jason Gunthorpe
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=151197874035.26211.4061781453123083667.stgit@dwillia2-desk3.amr.corp.intel.com \
--to=dan.j.williams@intel.com \
--cc=akpm@linux-foundation.org \
--cc=hch@lst.de \
--cc=inki.dae@samsung.com \
--cc=jack@suse.cz \
--cc=jy0922.shim@samsung.com \
--cc=kyungmin.park@samsung.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-media@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=linux-nvdimm@lists.01.org \
--cc=mchehab@kernel.org \
--cc=mgorman@suse.de \
--cc=stable@vger.kernel.org \
--cc=sw0312.kim@samsung.com \
--cc=vbabka@suse.cz \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).