* [PATCH 4.4] mm/gup: add compat macro for get_user_pages
@ 2019-01-31 11:22 Konstantin Khlebnikov
2019-01-31 12:26 ` Greg Kroah-Hartman
0 siblings, 1 reply; 2+ messages in thread
From: Konstantin Khlebnikov @ 2019-01-31 11:22 UTC (permalink / raw)
To: Greg Kroah-Hartman, Ben Hutchings, Lorenzo Stoakes, stable
This fixes API breakage introduced in v4.4.168 commit 8e50b8b07f46
("mm: replace get_user_pages() write/force parameters with gup_flags").
For example odious nvidia out-of-tree modules does not compile.
After that commit prototype of get_user_pages() looks like:
long get_user_pages(task, mm, start, nr_pages, gup_flags, pages, vmas)
that's incompatible neither with v4.4 and before:
long get_user_pages(task, mm, start, nr_pages, write, force, pages, vmas)
nor with v4.6 and later:
long get_user_pages(start, nr_pages, gup_flags, pages, vmas)
This patch uses the same va-args macro magic as commit cde70140fed8
("mm/gup: Overload get_user_pages() functions").
The alternative is upgrading GUP API to modern state.
Signed-off-by: Konstantin Khlebnikov <khlebnikov@yandex-team.ru>
---
include/linux/mm.h | 23 +++++++++++++++++++++++
1 file changed, 23 insertions(+)
diff --git a/include/linux/mm.h b/include/linux/mm.h
index 77066c96f5e9..5337d4b59052 100644
--- a/include/linux/mm.h
+++ b/include/linux/mm.h
@@ -2334,5 +2334,28 @@ void __init setup_nr_node_ids(void);
static inline void setup_nr_node_ids(void) {}
#endif
+#ifdef MODULE
+
+/* Compat API for external modules */
+
+static inline __deprecated
+long get_user_pages8(struct task_struct *tsk, struct mm_struct *mm,
+ unsigned long start, unsigned long nr_pages,
+ int write, int force, struct page **pages,
+ struct vm_area_struct **vmas)
+{
+ return get_user_pages(tsk, mm, start, nr_pages,
+ (write ? FOLL_WRITE : 0) |
+ (force ? FOLL_FORCE : 0),
+ pages, vmas);
+}
+
+#define GUP_MACRO(_1, _2, _3, _4, _5, _6, _7, _8, gup, ...) gup
+
+#define get_user_pages(...) GUP_MACRO(__VA_ARGS__, \
+ get_user_pages8, get_user_pages, x, x, x, x, x, x)(__VA_ARGS__)
+
+#endif /* MODULE */
+
#endif /* __KERNEL__ */
#endif /* _LINUX_MM_H */
^ permalink raw reply related [flat|nested] 2+ messages in thread* Re: [PATCH 4.4] mm/gup: add compat macro for get_user_pages
2019-01-31 11:22 [PATCH 4.4] mm/gup: add compat macro for get_user_pages Konstantin Khlebnikov
@ 2019-01-31 12:26 ` Greg Kroah-Hartman
0 siblings, 0 replies; 2+ messages in thread
From: Greg Kroah-Hartman @ 2019-01-31 12:26 UTC (permalink / raw)
To: Konstantin Khlebnikov; +Cc: Ben Hutchings, Lorenzo Stoakes, stable
On Thu, Jan 31, 2019 at 02:22:01PM +0300, Konstantin Khlebnikov wrote:
> This fixes API breakage introduced in v4.4.168 commit 8e50b8b07f46
> ("mm: replace get_user_pages() write/force parameters with gup_flags").
> For example odious nvidia out-of-tree modules does not compile.
There is no guarantee of in-kernel api "stability" in any kernel tree,
sorry.
As all of the in-kernel users are working just fine, there is no need
for this type of crazy patch to be accepted.
thanks,
greg k-h
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2019-01-31 12:26 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-01-31 11:22 [PATCH 4.4] mm/gup: add compat macro for get_user_pages Konstantin Khlebnikov
2019-01-31 12:26 ` Greg Kroah-Hartman
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).