[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <Y6TQaZaB+PKObfNs@x1n>
Date: Thu, 22 Dec 2022 16:47:21 -0500
From: Peter Xu <peterx@...hat.com>
To: James Houghton <jthoughton@...gle.com>
Cc: Mike Kravetz <mike.kravetz@...cle.com>,
Muchun Song <songmuchun@...edance.com>,
David Hildenbrand <david@...hat.com>,
David Rientjes <rientjes@...gle.com>,
Axel Rasmussen <axelrasmussen@...gle.com>,
Mina Almasry <almasrymina@...gle.com>,
Zach O'Keefe <zokeefe@...gle.com>,
Manish Mishra <manish.mishra@...anix.com>,
Naoya Horiguchi <naoya.horiguchi@....com>,
"Dr . David Alan Gilbert" <dgilbert@...hat.com>,
"Matthew Wilcox (Oracle)" <willy@...radead.org>,
Vlastimil Babka <vbabka@...e.cz>,
Baolin Wang <baolin.wang@...ux.alibaba.com>,
Miaohe Lin <linmiaohe@...wei.com>,
Yang Shi <shy828301@...il.com>,
Andrew Morton <akpm@...ux-foundation.org>, linux-mm@...ck.org,
linux-kernel@...r.kernel.org
Subject: Re: [RFC PATCH v2 35/47] userfaultfd: require
UFFD_FEATURE_EXACT_ADDRESS when using HugeTLB HGM
On Fri, Oct 21, 2022 at 04:36:51PM +0000, James Houghton wrote:
> @@ -1990,6 +1990,17 @@ static int userfaultfd_api(struct userfaultfd_ctx *ctx,
> ~(UFFD_FEATURE_MINOR_HUGETLBFS | UFFD_FEATURE_MINOR_SHMEM);
> #ifndef CONFIG_HUGETLB_HIGH_GRANULARITY_MAPPING
> uffdio_api.features &= ~UFFD_FEATURE_MINOR_HUGETLBFS_HGM;
> +#else
> +
> + ret = -EINVAL;
> + if ((uffdio_api.features & UFFD_FEATURE_MINOR_HUGETLBFS_HGM) &&
> + !(uffdio_api.features & UFFD_FEATURE_EXACT_ADDRESS))
This check needs to be done upon "features" or "ctx_features", rather than
"uffdio_api.features". The latter is the one we'll report to the user only.
> + /*
> + * UFFD_FEATURE_MINOR_HUGETLBFS_HGM is mostly
> + * useless without UFFD_FEATURE_EXACT_ADDRESS,
> + * so require userspace to provide both.
> + */
> + goto err_out;
> #endif /* CONFIG_HUGETLB_HIGH_GRANULARITY_MAPPING */
> #endif /* CONFIG_HAVE_ARCH_USERFAULTFD_MINOR */
>
> --
> 2.38.0.135.g90850a2211-goog
>
>
--
Peter Xu
Powered by blists - more mailing lists