mm/page_idle.c: skip offline pages
Subsystems (48)
A message that is not in the archive (sent off-list or not yet received): [email protected]
Andrew Morton
maintainerPATCH 1/54 mm/page_idle.c: skip offline pages
From: SeongJae Park <[email protected]>
Subject: mm/page_idle.c: skip offline pages
'Idle page tracking' users can pass random pfn that might be mapped to an offline page. To avoid accessing such pages, this commit modifies the 'page_idle_get_page()' to use 'pfn_to_online_page()' instead of 'pfn_valid()' and 'pfn_to_page()' combination, so that the pfn mapped to an offline page can be skipped.
---
mm/page_idle.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-)
mm/page_idle.c renamed from mm/page_idle.c~mm-page_idlec-skip-offline-pages +2 -3
@@ -4,6 +4,7 @@#include <linux/fs.h> #include <linux/sysfs.h> #include <linux/kobject.h> +#include <linux/memory_hotplug.h> #include <linux/mm.h> #include <linux/mmzone.h> #include <linux/pagemap.h>
@@ -30,13 +31,9 @@*/ static struct page *page_idle_get_page (unsigned long pfn) { -struct page *page; +struct page *page =pfn_to_online_page (pfn);pg_data_t *pgdat; -if (!pfn_valid (pfn)) -return NULL ;
Andrew Morton
maintainerPATCH 2/54 ipc/msg: add missing annotation for freeque()
In reply to a message not in the archiveFrom: Jules Irenge <[email protected]>
Subject: ipc/msg: add missing annotation for freeque()
Sparse reports a warning at freeque()
warning: context imbalance in freeque() - unexpected unlock
The root cause is the missing annotation at freeque()
Add the missing __releases(RCU) annotation Add the missing __releases(&msq->q_perm) annotation
---
ipc/msg.c | 2 ++ 1 file changed, 2 insertions(+)
ipc/msg.c renamed from ipc/msg.c~ipc-msg-add-missing-annotation-for-freeque +2 -0
@@ -268,6 +268,8 @@ static void expunge_all(struct msg_queue* before freeque() is called. msg_ids.rwsem remains locked on exit. */ static void freeque (struct ipc_namespace *ns,struct kern_ipc_perm *ipcp) +__releases (RCU ) + __releases(&msq->q_perm) {struct msg_msg *msg, *t; struct msg_queue *msq = container_of(ipcp, struct msg_queue, q_perm);
_
Andrew Morton
maintainerPATCH 3/54 ipc/namespace.c: use a work queue to free_ipc
In reply to a message not in the archiveFrom: Giuseppe Scrivano <[email protected]>
Subject: ipc/namespace.c: use a work queue to free_ipc
the reason is to avoid a delay caused by the synchronize_rcu() call in kern_umount() when the mqueue mount is freed.
the code:
\#define _GNU_SOURCE
\#include <sched.h>
\#include <error.h>
\#include <errno.h>
\#include <stdlib.h>
int main()
{
int i;
for (i = 0; i < 1000; i++)
if (unshare (CLONE_NEWIPC) < 0)
error (EXIT_FAILURE, errno, "unshare");
}
gets from
Command being timed: "./ipc-namespace" User time (seconds): 0.00 System time (seconds): 0.06 Percent of CPU this job got: 0% Elapsed (wall clock) time (h:mm:ss or m:ss): 0:08.05
to
Command being timed: "./ipc-namespace" User time (seconds): 0.00 System time (seconds): 0.02 Percent of CPU this job got: 96% Elapsed (wall clock) time (h:mm:ss or m:ss): 0:00.03
---
include/linux/ipc_namespace.h | 2 ++ ipc/namespace.c | 24 ++++++++++++++++++++++-- 2 files changed, 24 insertions(+), 2 deletions(-)
include/linux/ipc_namespace.h renamed from include/linux/ipc_namespace.h~ipc-use-a-work-queue-to-free_ipc +2 -0
@@ -68,6 +68,8 @@ struct ipc_namespace {struct user_namespace *user_ns;struct ucounts *ucounts; +struct llist_node mnt_llist; +struct ns_common ns; } __randomize_layout;
ipc/namespace.c renamed from ipc/namespace.c~ipc-use-a-work-queue-to-free_ipc +22 -2
@@ -117,6 +117,10 @@ void free_ipcs(struct ipc_namespace *ns,static void free_ipc_ns (struct ipc_namespace *ns) { +/* mq_put_mnt() waits for a grace period as kern_unmount() +* uses synchronize_rcu(). +*/ +mq_put_mnt (ns);sem_exit_ns (ns);msg_exit_ns (ns);shm_exit_ns (ns);
@@ -127,6 +131,21 @@ static void free_ipc_ns(struct ipc_nameskfree (ns); } +static LLIST_HEAD (free_ipc_list); +static void free_ipc (struct work_struct *unused) +{ +struct llist_node *node =llist_del_all (&free_ipc_list); +struct ipc_namespace *n, *t; + +llist_for_each_entry_safe (n, t, node, mnt_llist) +free_ipc_ns (n); +} + +/* +* The work queue is used to avoid the cost of synchronize_rcu in kern_unmount. +*/ +static DECLARE_WORK(free_ipc_work, free_ipc); +/* * put_ipc_ns - drop a reference to an ipc namespace. * @ns: the namespace to put
@@ -148,8 +167,9 @@ void put_ipc_ns(struct ipc_namespace *nsif (refcount_dec_and_lock (&ns->count, &mq_lock)) {mq_clear_sbinfo (ns);spin_unlock (&mq_lock); -mq_put_mnt (ns); -free_ipc_ns (ns); + +if (llist_add (&ns->mnt_llist, &free_ipc_list)) +schedule_work (&free_ipc_work); } }
_
Andrew Morton
maintainerPATCH 4/54 dynamic_debug: add an option to enable dynamic debug for modules only
In reply to a message not in the archiveFrom: Orson Zhai <[email protected]>
Subject: dynamic_debug: add an option to enable dynamic debug for modules only
Instead of enabling dynamic debug globally with CONFIG_DYNAMIC_DEBUG, CONFIG_DYNAMIC_DEBUG_CORE will only enable core function of dynamic debug. With the DYNAMIC_DEBUG_MODULE defined for any modules, dynamic debug will be tied to them.
This is useful for people who only want to enable dynamic debug for kernel modules without worrying about kernel image size and memory consumption is increasing too much.
---
Documentation/admin-guide/dynamic-debug-howto.rst | 5 +++++ include/linux/dev_printk.h | 6 ++++-- include/linux/dynamic_debug.h | 2 +- include/linux/net.h | 3 ++- include/linux/netdevice.h | 6 ++++-- include/linux/printk.h | 9 ++++++--- include/rdma/ib_verbs.h | 6 ++++-- lib/Kconfig.debug | 12 ++++++++++++ lib/Makefile | 2 +- lib/dynamic_debug.c | 9 +++++++-- 10 files changed, 46 insertions(+), 14 deletions(-)
Documentation/admin-guide/dynamic-debug-howto.rst renamed from Documentation/admin-guide/dynamic-debug-howto.rst~dynamic_debug-add-an-option-to-enable-dynamic-debug-for-modules-only +5 -0
@@ -13,6 +13,11 @@ kernel code to obtain additional kernel ``print_hex_dump_debug()``/``print_hex_dump_bytes()`` calls can be dynamically enabled per-callsite. +If you do not want to enable dynamic debug globally (i.e. in some embedded +system), you may set ``CONFIG_DYNAMIC_DEBUG_CORE`` as basic support of dynamic +debug and add ``ccflags := -DDYNAMIC_DEBUG_MODULE`` into the Makefile of any +modules which you'd like to dynamically debug later. + If ``CONFIG_DYNAMIC_DEBUG`` is not set, ``print_hex_dump_debug()`` is just shortcut for ``print_hex_dump(KERN_DEBUG)``.
include/linux/dev_printk.h renamed from include/linux/dev_printk.h~dynamic_debug-add-an-option-to-enable-dynamic-debug-for-modules-only +4 -2
@@ -109,7 +109,8 @@ void _dev_info(const struct device *dev,#define dev_info (dev, fmt, ...) \ _dev_info(dev, dev_fmt(fmt), ##__VA_ARGS__) -#if defined(CONFIG_DYNAMIC_DEBUG ) +#if defined(CONFIG_DYNAMIC_DEBUG ) || \ + (defined(CONFIG_DYNAMIC_DEBUG_CORE ) && defined(DYNAMIC_DEBUG_MODULE ))#define dev_dbg (dev, fmt, ...) \ dynamic_dev_dbg(dev, dev_fmt(fmt), ##__VA_ARGS__)#elif defined(DEBUG )
@@ -181,7 +182,8 @@ do { \ dev_level_ratelimited(dev_notice, dev, fmt, ##__VA_ARGS__)#define dev_info_ratelimited (dev, fmt, ...) \ dev_level_ratelimited(dev_info, dev, fmt, ##__VA_ARGS__) -#if defined(CONFIG_DYNAMIC_DEBUG ) +#if defined(CONFIG_DYNAMIC_DEBUG ) || \ + (defined(CONFIG_DYNAMIC_DEBUG_CORE ) && defined(DYNAMIC_DEBUG_MODULE ))/* descriptor check is first to prevent flooding with "callbacks suppressed" */ #define dev_dbg_ratelimited (dev, fmt, ...) \ do { \
include/linux/dynamic_debug.h renamed from include/linux/dynamic_debug.h~dynamic_debug-add-an-option-to-enable-dynamic-debug-for-modules-only +1 -1
@@ -48,7 +48,7 @@ struct _ddebug { -#if defined(CONFIG_DYNAMIC_DEBUG ) +#if defined(CONFIG_DYNAMIC_DEBUG_CORE )int ddebug_add_module (struct _ddebug *tab,unsigned int n,const char *modname);extern int ddebug_remove_module (const char *mod_name);
include/linux/netdevice.h renamed from include/linux/netdevice.h~dynamic_debug-add-an-option-to-enable-dynamic-debug-for-modules-only +4 -2
@@ -4942,7 +4942,8 @@ do { \#define MODULE_ALIAS_NETDEV (device) \ MODULE_ALIAS("netdev-" device) -#if defined(CONFIG_DYNAMIC_DEBUG ) +#if defined(CONFIG_DYNAMIC_DEBUG ) || \ + (defined(CONFIG_DYNAMIC_DEBUG_CORE ) && defined(DYNAMIC_DEBUG_MODULE )) #define netdev_dbg(__dev, format, args...) \ do { \ dynamic_netdev_dbg(__dev, format, ##args); \
@@ -5012,7 +5013,8 @@ do { \ #define netif_info(priv, type, dev, fmt, args...) \ netif_level(info, priv, type, dev, fmt, ##args) -#if defined(CONFIG_DYNAMIC_DEBUG ) +#if defined(CONFIG_DYNAMIC_DEBUG ) || \ + (defined(CONFIG_DYNAMIC_DEBUG_CORE ) && defined(DYNAMIC_DEBUG_MODULE )) #define netif_dbg(priv, type, netdev, format, args...) \ do { \ if (netif_msg_##type(priv)) \
include/linux/net.h renamed from include/linux/net.h~dynamic_debug-add-an-option-to-enable-dynamic-debug-for-modules-only +2 -1
@@ -264,7 +264,8 @@ do { \ net_ratelimited_function(pr_warn, fmt, ##__VA_ARGS__)#define net_info_ratelimited (fmt, ...) \ net_ratelimited_function(pr_info, fmt, ##__VA_ARGS__) -#if defined(CONFIG_DYNAMIC_DEBUG ) +#if defined(CONFIG_DYNAMIC_DEBUG ) || \ + (defined(CONFIG_DYNAMIC_DEBUG_CORE ) && defined(DYNAMIC_DEBUG_MODULE ))#define net_dbg_ratelimited (fmt, ...) \ do { \ DEFINE_DYNAMIC_DEBUG_METADATA(descriptor, fmt); \
include/linux/printk.h renamed from include/linux/printk.h~dynamic_debug-add-an-option-to-enable-dynamic-debug-for-modules-only +6 -3
@@ -399,7 +399,8 @@ extern int kptr_restrict;/* If you are writing a driver, please use dev_dbg instead */ -#if defined(CONFIG_DYNAMIC_DEBUG ) +#if defined(CONFIG_DYNAMIC_DEBUG ) || \ + (defined(CONFIG_DYNAMIC_DEBUG_CORE ) && defined(DYNAMIC_DEBUG_MODULE ))#include <linux/dynamic_debug.h> /**
@@ -535,7 +536,8 @@ extern int kptr_restrict;#endif /* If you are writing a driver, please use dev_dbg instead */ -#if defined(CONFIG_DYNAMIC_DEBUG ) +#if defined(CONFIG_DYNAMIC_DEBUG ) || \ + (defined(CONFIG_DYNAMIC_DEBUG_CORE ) && defined(DYNAMIC_DEBUG_MODULE ))/* descriptor check is first to prevent flooding with "callbacks suppressed" */ #define pr_debug_ratelimited (fmt, ...) \ do { \
@@ -582,7 +584,8 @@ static inline void print_hex_dump_bytes(#endif -#if defined(CONFIG_DYNAMIC_DEBUG ) +#if defined(CONFIG_DYNAMIC_DEBUG ) || \ + (defined(CONFIG_DYNAMIC_DEBUG_CORE ) && defined(DYNAMIC_DEBUG_MODULE ))#define print_hex_dump_debug (prefix_str, prefix_type, rowsize, \ groupsize, buf, len, ascii) \ dynamic_hex_dump(prefix_str, prefix_type, rowsize, \
include/rdma/ib_verbs.h renamed from include/rdma/ib_verbs.h~dynamic_debug-add-an-option-to-enable-dynamic-debug-for-modules-only +4 -2
@@ -100,7 +100,8 @@ void ibdev_notice(const struct ib_device __printf(2, 3) __coldvoid ibdev_info (const struct ib_device *ibdev,const char *format, ...); -#if defined(CONFIG_DYNAMIC_DEBUG ) +#if defined(CONFIG_DYNAMIC_DEBUG ) || \ + (defined(CONFIG_DYNAMIC_DEBUG_CORE ) && defined(DYNAMIC_DEBUG_MODULE )) #define ibdev_dbg(__dev, format, args...) \ dynamic_ibdev_dbg(__dev, format, ##args)#else
@@ -133,7 +134,8 @@ do {#define ibdev_info_ratelimited (ibdev, fmt, ...) \ ibdev_level_ratelimited(ibdev_info, ibdev, fmt, ##__VA_ARGS__) -#if defined(CONFIG_DYNAMIC_DEBUG ) +#if defined(CONFIG_DYNAMIC_DEBUG ) || \ + (defined(CONFIG_DYNAMIC_DEBUG_CORE ) && defined(DYNAMIC_DEBUG_MODULE ))/* descriptor check is first to prevent flooding with "callbacks suppressed" */ #define ibdev_dbg_ratelimited (ibdev, fmt, ...) \ do { \
lib/dynamic_debug.c renamed from lib/dynamic_debug.c~dynamic_debug-add-an-option-to-enable-dynamic-debug-for-modules-only +7 -2
@@ -1032,8 +1032,13 @@ static int __init dynamic_debug_init(voiint verbose_bytes =0 ;if (&__start___verbose == &__stop___verbose) { -pr_warn ("_ddebug table is empty in a CONFIG_DYNAMIC_DEBUG build\n" ); -return 1 ; +if (IS_ENABLED (CONFIG_DYNAMIC_DEBUG )) { +pr_warn ("_ddebug table is empty in a CONFIG_DYNAMIC_DEBUG build\n" ); +return 1 ; + } +pr_info ("Ignore empty _ddebug table in a CONFIG_DYNAMIC_DEBUG_CORE build\n" ); + ddebug_init_success =1 ; +return 0 ; } iter = __start___verbose; modname = iter->modname;
lib/Kconfig.debug renamed from lib/Kconfig.debug~dynamic_debug-add-an-option-to-enable-dynamic-debug-for-modules-only +12 -0
@@ -99,6 +99,7 @@ config DYNAMIC_DEBUG default n depends on PRINTK depends on (DEBUG_FS || PROC_FS) + select DYNAMIC_DEBUG_CORE help Compiles debug level messages into the kernel, which would not
@@ -165,6 +166,17 @@ config DYNAMIC_DEBUG See Documentation/admin-guide/dynamic-debug-howto.rst for additional information. +config DYNAMIC_DEBUG_CORE + bool "Enable core function of dynamic debug support" + depends on PRINTK + depends on (DEBUG_FS || PROC_FS) + help + Enable core functional support of dynamic debug. It is useful + when you want to tie dynamic debug to your kernel modules with + DYNAMIC_DEBUG_MODULE defined for each of them, especially for + the case of embedded system where the kernel image size is + sensitive for people. + config SYMBOLIC_ERRNAME bool "Support symbolic error names in printf" default y if PRINTK
lib/Makefile renamed from lib/Makefile~dynamic_debug-add-an-option-to-enable-dynamic-debug-for-modules-only +1 -1
@@ -190,7 +190,7 @@ lib-$(CONFIG_GENERIC_BUG) += bug.o obj-$(CONFIG_HAVE_ARCH_TRACEHOOK) += syscall.o -obj-$(CONFIG_DYNAMIC_DEBUG) += dynamic_debug.o +obj-$(CONFIG_DYNAMIC_DEBUG_CORE) += dynamic_debug.o obj-$(CONFIG_SYMBOLIC_ERRNAME) += errname.o obj-$(CONFIG_NLATTR) += nlattr.o
_
答复: [patch 04/54] dynamic_debug: add an option to enable dynamic debug for modules only
Hi Andrew and Linus,
Could you please also add "Acked-by: Petr Mladek <[email protected]>" into this patch according to his mailing list replies at [1].
Thanks,
Orson
[1] https://lore.kernel.org/lkml/20200518095026.GL7340@linux-b0ei/
________________________________________
发件人: Andrew Morton <[email protected]>
发送时间: 2020年6月8日 12:40
收件人: [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; 翟京 (Orson Zhai); [email protected]; [email protected]; [email protected]; [email protected]; [email protected] 主题: [patch 04/54] dynamic_debug: add an option to enable dynamic debug for modules only
From: Orson Zhai <[email protected]>
Subject: dynamic_debug: add an option to enable dynamic debug for modules only
Instead of enabling dynamic debug globally with CONFIG_DYNAMIC_DEBUG, CONFIG_DYNAMIC_DEBUG_CORE will only enable core function of dynamic debug. With the DYNAMIC_DEBUG_MODULE defined for any modules, dynamic debug will be tied to them.
This is useful for people who only want to enable dynamic debug for kernel modules without worrying about kernel image size and memory consumption is increasing too much.
---
Documentation/admin-guide/dynamic-debug-howto.rst | 5 +++++ include/linux/dev_printk.h | 6 ++++-- include/linux/dynamic_debug.h | 2 +- include/linux/net.h | 3 ++- include/linux/netdevice.h | 6 ++++-- include/linux/printk.h | 9 ++++++--- include/rdma/ib_verbs.h | 6 ++++-- lib/Kconfig.debug | 12 ++++++++++++ lib/Makefile | 2 +- lib/dynamic_debug.c | 9 +++++++-- 10 files changed, 46 insertions(+), 14 deletions(-)
Documentation/admin-guide/dynamic-debug-howto.rst renamed from Documentation/admin-guide/dynamic-debug-howto.rst~dynamic_debug-add-an-option-to-enable-dynamic-debug-for-modules-only +5 -0
@@ -13,6 +13,11 @@ kernel code to obtain additional kernel ``print_hex_dump_debug()``/``print_hex_dump_bytes()`` calls can be dynamically enabled per-callsite. +If you do not want to enable dynamic debug globally (i.e. in some embedded +system), you may set ``CONFIG_DYNAMIC_DEBUG_CORE`` as basic support of dynamic +debug and add ``ccflags := -DDYNAMIC_DEBUG_MODULE`` into the Makefile of any +modules which you'd like to dynamically debug later. + If ``CONFIG_DYNAMIC_DEBUG`` is not set, ``print_hex_dump_debug()`` is just shortcut for ``print_hex_dump(KERN_DEBUG)``.
include/linux/dev_printk.h renamed from include/linux/dev_printk.h~dynamic_debug-add-an-option-to-enable-dynamic-debug-for-modules-only +4 -2
@@ -109,7 +109,8 @@ void _dev_info(const struct device *dev,#define dev_info (dev, fmt, ...) \ _dev_info(dev, dev_fmt(fmt), ##__VA_ARGS__) -#if defined(CONFIG_DYNAMIC_DEBUG ) +#if defined(CONFIG_DYNAMIC_DEBUG ) || \ + (defined(CONFIG_DYNAMIC_DEBUG_CORE ) && defined(DYNAMIC_DEBUG_MODULE ))#define dev_dbg (dev, fmt, ...) \ dynamic_dev_dbg(dev, dev_fmt(fmt), ##__VA_ARGS__)#elif defined(DEBUG )
@@ -181,7 +182,8 @@ do { \ dev_level_ratelimited(dev_notice, dev, fmt, ##__VA_ARGS__)#define dev_info_ratelimited (dev, fmt, ...) \ dev_level_ratelimited(dev_info, dev, fmt, ##__VA_ARGS__) -#if defined(CONFIG_DYNAMIC_DEBUG ) +#if defined(CONFIG_DYNAMIC_DEBUG ) || \ + (defined(CONFIG_DYNAMIC_DEBUG_CORE ) && defined(DYNAMIC_DEBUG_MODULE ))/* descriptor check is first to prevent flooding with "callbacks suppressed" */ #define dev_dbg_ratelimited (dev, fmt, ...) \ do { \
include/linux/dynamic_debug.h renamed from include/linux/dynamic_debug.h~dynamic_debug-add-an-option-to-enable-dynamic-debug-for-modules-only +1 -1
@@ -48,7 +48,7 @@ struct _ddebug { -#if defined(CONFIG_DYNAMIC_DEBUG ) +#if defined(CONFIG_DYNAMIC_DEBUG_CORE )int ddebug_add_module (struct _ddebug *tab,unsigned int n,const char *modname);extern int ddebug_remove_module (const char *mod_name);
include/linux/netdevice.h renamed from include/linux/netdevice.h~dynamic_debug-add-an-option-to-enable-dynamic-debug-for-modules-only +4 -2
@@ -4942,7 +4942,8 @@ do { \#define MODULE_ALIAS_NETDEV (device) \ MODULE_ALIAS("netdev-" device) -#if defined(CONFIG_DYNAMIC_DEBUG ) +#if defined(CONFIG_DYNAMIC_DEBUG ) || \ + (defined(CONFIG_DYNAMIC_DEBUG_CORE ) && defined(DYNAMIC_DEBUG_MODULE )) #define netdev_dbg(__dev, format, args...) \ do { \ dynamic_netdev_dbg(__dev, format, ##args); \
@@ -5012,7 +5013,8 @@ do { \ #define netif_info(priv, type, dev, fmt, args...) \ netif_level(info, priv, type, dev, fmt, ##args) -#if defined(CONFIG_DYNAMIC_DEBUG ) +#if defined(CONFIG_DYNAMIC_DEBUG ) || \ + (defined(CONFIG_DYNAMIC_DEBUG_CORE ) && defined(DYNAMIC_DEBUG_MODULE )) #define netif_dbg(priv, type, netdev, format, args...) \ do { \ if (netif_msg_##type(priv)) \
include/linux/net.h renamed from include/linux/net.h~dynamic_debug-add-an-option-to-enable-dynamic-debug-for-modules-only +2 -1
@@ -264,7 +264,8 @@ do { \ net_ratelimited_function(pr_warn, fmt, ##__VA_ARGS__)#define net_info_ratelimited (fmt, ...) \ net_ratelimited_function(pr_info, fmt, ##__VA_ARGS__) -#if defined(CONFIG_DYNAMIC_DEBUG ) +#if defined(CONFIG_DYNAMIC_DEBUG ) || \ + (defined(CONFIG_DYNAMIC_DEBUG_CORE ) && defined(DYNAMIC_DEBUG_MODULE ))#define net_dbg_ratelimited (fmt, ...) \ do { \ DEFINE_DYNAMIC_DEBUG_METADATA(descriptor, fmt); \
include/linux/printk.h renamed from include/linux/printk.h~dynamic_debug-add-an-option-to-enable-dynamic-debug-for-modules-only +6 -3
@@ -399,7 +399,8 @@ extern int kptr_restrict;/* If you are writing a driver, please use dev_dbg instead */ -#if defined(CONFIG_DYNAMIC_DEBUG ) +#if defined(CONFIG_DYNAMIC_DEBUG ) || \ + (defined(CONFIG_DYNAMIC_DEBUG_CORE ) && defined(DYNAMIC_DEBUG_MODULE ))#include <linux/dynamic_debug.h> /**
@@ -535,7 +536,8 @@ extern int kptr_restrict;#endif /* If you are writing a driver, please use dev_dbg instead */ -#if defined(CONFIG_DYNAMIC_DEBUG ) +#if defined(CONFIG_DYNAMIC_DEBUG ) || \ + (defined(CONFIG_DYNAMIC_DEBUG_CORE ) && defined(DYNAMIC_DEBUG_MODULE ))/* descriptor check is first to prevent flooding with "callbacks suppressed" */ #define pr_debug_ratelimited (fmt, ...) \ do { \
@@ -582,7 +584,8 @@ static inline void print_hex_dump_bytes(#endif -#if defined(CONFIG_DYNAMIC_DEBUG ) +#if defined(CONFIG_DYNAMIC_DEBUG ) || \ + (defined(CONFIG_DYNAMIC_DEBUG_CORE ) && defined(DYNAMIC_DEBUG_MODULE ))#define print_hex_dump_debug (prefix_str, prefix_type, rowsize, \ groupsize, buf, len, ascii) \ dynamic_hex_dump(prefix_str, prefix_type, rowsize, \
include/rdma/ib_verbs.h renamed from include/rdma/ib_verbs.h~dynamic_debug-add-an-option-to-enable-dynamic-debug-for-modules-only +4 -2
@@ -100,7 +100,8 @@ void ibdev_notice(const struct ib_device __printf(2, 3) __coldvoid ibdev_info (const struct ib_device *ibdev,const char *format, ...); -#if defined(CONFIG_DYNAMIC_DEBUG ) +#if defined(CONFIG_DYNAMIC_DEBUG ) || \ + (defined(CONFIG_DYNAMIC_DEBUG_CORE ) && defined(DYNAMIC_DEBUG_MODULE )) #define ibdev_dbg(__dev, format, args...) \ dynamic_ibdev_dbg(__dev, format, ##args)#else
@@ -133,7 +134,8 @@ do {#define ibdev_info_ratelimited (ibdev, fmt, ...) \ ibdev_level_ratelimited(ibdev_info, ibdev, fmt, ##__VA_ARGS__) -#if defined(CONFIG_DYNAMIC_DEBUG ) +#if defined(CONFIG_DYNAMIC_DEBUG ) || \ + (defined(CONFIG_DYNAMIC_DEBUG_CORE ) && defined(DYNAMIC_DEBUG_MODULE ))/* descriptor check is first to prevent flooding with "callbacks suppressed" */ #define ibdev_dbg_ratelimited (ibdev, fmt, ...) \ do { \
lib/dynamic_debug.c renamed from lib/dynamic_debug.c~dynamic_debug-add-an-option-to-enable-dynamic-debug-for-modules-only +7 -2
@@ -1032,8 +1032,13 @@ static int __init dynamic_debug_init(voiint verbose_bytes =0 ;if (&__start___verbose == &__stop___verbose) { -pr_warn ("_ddebug table is empty in a CONFIG_DYNAMIC_DEBUG build\n" ); -return 1 ; +if (IS_ENABLED (CONFIG_DYNAMIC_DEBUG )) { +pr_warn ("_ddebug table is empty in a CONFIG_DYNAMIC_DEBUG build\n" ); +return 1 ; + } +pr_info ("Ignore empty _ddebug table in a CONFIG_DYNAMIC_DEBUG_CORE build\n" ); + ddebug_init_success =1 ; +return 0 ; } iter = __start___verbose; modname = iter->modname;
lib/Kconfig.debug renamed from lib/Kconfig.debug~dynamic_debug-add-an-option-to-enable-dynamic-debug-for-modules-only +12 -0
@@ -99,6 +99,7 @@ config DYNAMIC_DEBUG default n depends on PRINTK depends on (DEBUG_FS || PROC_FS) + select DYNAMIC_DEBUG_CORE help Compiles debug level messages into the kernel, which would not
@@ -165,6 +166,17 @@ config DYNAMIC_DEBUG See Documentation/admin-guide/dynamic-debug-howto.rst for additional information. +config DYNAMIC_DEBUG_CORE + bool "Enable core function of dynamic debug support" + depends on PRINTK + depends on (DEBUG_FS || PROC_FS) + help + Enable core functional support of dynamic debug. It is useful + when you want to tie dynamic debug to your kernel modules with + DYNAMIC_DEBUG_MODULE defined for each of them, especially for + the case of embedded system where the kernel image size is + sensitive for people. + config SYMBOLIC_ERRNAME bool "Support symbolic error names in printf" default y if PRINTK
lib/Makefile renamed from lib/Makefile~dynamic_debug-add-an-option-to-enable-dynamic-debug-for-modules-only +1 -1
@@ -190,7 +190,7 @@ lib-$(CONFIG_GENERIC_BUG) += bug.o obj-$(CONFIG_HAVE_ARCH_TRACEHOOK) += syscall.o -obj-$(CONFIG_DYNAMIC_DEBUG) += dynamic_debug.o +obj-$(CONFIG_DYNAMIC_DEBUG_CORE) += dynamic_debug.o obj-$(CONFIG_SYMBOLIC_ERRNAME) += errname.o obj-$(CONFIG_NLATTR) += nlattr.o
_
________________________________
This email (including its attachments) is intended only for the person or entity to which it is addressed and may contain information that is privileged, confidential or otherwise protected from disclosure. Unauthorized use, dissemination, distribution or copying of this email or the information herein or taking any action in reliance on the contents of this email or the information herein, by anyone other than the intended recipient, or an employee or agent responsible for delivering the message to the intended recipient, is strictly prohibited. If you are not the intended recipient, please do not read, copy, use or disclose any part of this e-mail to others. Please notify the sender immediately and permanently delete this e-mail and any attachments if you received it in error. Internet communications cannot be guaranteed to be timely, secure, error-free or virus-free. The sender does not accept liability for any errors or omissions.
本邮件及其附件具有保密性质,受法律保护不得泄露,仅发送给本邮件所指特定收件人。严禁非经授权使用、宣传、发布或复制本邮件或其内容。若非该特定收件人,请勿阅读、复制、 使用或披露本邮件的任何内容。若误收本邮件,请从系统中永久性删除本邮件及所有附件,并以回复邮件的方式即刻告知发件人。无法保证互联网通信及时、安全、无误或防毒。发件人对任何错漏均不承担责任。
Andrew Morton
maintainerPATCH 5/54 kernel: add panic_on_taint
In reply to a message not in the archiveFrom: Rafael Aquini <[email protected]>
Subject: kernel: add panic_on_taint
Analogously to the introduction of panic_on_warn, this patch introduces a kernel option named panic_on_taint in order to provide a simple and generic way to stop execution and catch a coredump when the kernel gets tainted by any given flag.
This is useful for debugging sessions as it avoids having to rebuild the kernel to explicitly add calls to panic() into the code sites that introduce the taint flags of interest. For instance, if one is interested in proceeding with a post-mortem analysis at the point a given code path is hitting a bad page (i.e. unaccount_page_cache_page(), or slab_bug()), a coredump can be collected by rebooting the kernel with 'panic_on_taint=0x20' amended to the command line.
Another, perhaps less frequent, use for this option would be as a means for assuring a security policy case where only a subset of taints, or no single taint (in paranoid mode), is allowed for the running system. The optional switch 'nousertaint' is handy in this particular scenario, as it will avoid userspace induced crashes by writes to sysctl interface /proc/sys/kernel/tainted causing false positive hits for such policies.
---
Documentation/admin-guide/kdump/kdump.rst | 8 +++ Documentation/admin-guide/kernel-parameters.txt | 13 +++++ Documentation/admin-guide/sysctl/kernel.rst | 7 ++ include/linux/kernel.h | 3 + kernel/panic.c | 34 ++++++++++++++ kernel/sysctl.c | 11 ++++ 6 files changed, 75 insertions(+), 1 deletion(-)
Documentation/admin-guide/kdump/kdump.rst renamed from Documentation/admin-guide/kdump/kdump.rst~kernel-add-panic_on_taint +8 -0
@@ -521,6 +521,14 @@ will cause a kdump to occur at the panic to specify this during runtime, /proc/sys/kernel/panic_on_warn can be set to 1 to achieve the same behaviour. +Trigger Kdump on add_taint() +============================ + +The kernel parameter panic_on_taint facilitates a conditional call to panic() +from within add_taint() whenever the value set in this bitmask matches with the +bit flag being set by add_taint(). +This will cause a kdump to occur at the add_taint()->panic() call. + Contact =======
Documentation/admin-guide/kernel-parameters.txt renamed from Documentation/admin-guide/kernel-parameters.txt~kernel-add-panic_on_taint +13 -0
@@ -3447,6 +3447,19 @@ bit 4: print ftrace buffer bit 5: print all printk messages in buffer + panic_on_taint= Bitmask for conditionally calling panic() in add_taint() + Format: <hex>[,nousertaint] + Hexadecimal bitmask representing the set of TAINT flags + that will cause the kernel to panic when add_taint() is + called with any of the flags in this set. + The optional switch "nousertaint" can be utilized to + prevent userspace forced crashes by writing to sysctl + /proc/sys/kernel/tainted any flagset matching with the + bitmask set on panic_on_taint. + See Documentation/admin-guide/tainted-kernels.rst for + extra details on the taint flags that users can pick + to compose the bitmask to assign to panic_on_taint. + panic_on_warn panic() instead of WARN(). Useful to cause kdump on a WARN().
Documentation/admin-guide/sysctl/kernel.rst renamed from Documentation/admin-guide/sysctl/kernel.rst~kernel-add-panic_on_taint +7 -0
@@ -1239,6 +1239,13 @@ ORed together. The letters are seen in " See :doc:`/admin-guide/tainted-kernels` for more information. +Note: + writes to this sysctl interface will fail with ``EINVAL`` if the kernel is + booted with the command line option ``panic_on_taint=<bitmask>,nousertaint`` + and any of the ORed together values being written to ``tainted`` match with + the bitmask declared on panic_on_taint. + See :doc:`/admin-guide/kernel-parameters` for more details on that particular + kernel command line option and its optional ``nousertaint`` switch. threads-max ===========
include/linux/kernel.h renamed from include/linux/kernel.h~kernel-add-panic_on_taint +3 -0
@@ -528,6 +528,8 @@ extern int panic_on_oops;extern int panic_on_unrecovered_nmi;extern int panic_on_io_nmi;extern int panic_on_warn; +extern unsigned long panic_on_taint; +extern bool panic_on_taint_nousertaint;extern int sysctl_panic_on_rcu_stall;extern int sysctl_panic_on_stackoverflow;
@@ -596,6 +598,7 @@ extern enum system_states {#define TAINT_AUX 16#define TAINT_RANDSTRUCT 17#define TAINT_FLAGS_COUNT 18 +#define TAINT_FLAGS_MAX ((1UL << TAINT_FLAGS_COUNT) - 1)struct taint_flag {char c_true;/* character printed when tainted */
kernel/panic.c renamed from kernel/panic.c~kernel-add-panic_on_taint +34 -0
@@ -44,6 +44,8 @@ static int pause_on_oops_flag;static DEFINE_SPINLOCK (pause_on_oops_lock);bool crash_kexec_post_notifiers;int panic_on_warn__read_mostly ; +unsigned long panic_on_taint; +bool panic_on_taint_nousertaint = false;int panic_timeout =CONFIG_PANIC_TIMEOUT ;EXPORT_SYMBOL_GPL (panic_timeout);
@@ -434,6 +436,11 @@ void add_taint(unsigned flag, enum lockdpr_warn ("Disabling lock debugging due to kernel taint\n" );set_bit (flag, &tainted_mask); + +if (tainted_mask & panic_on_taint) { + panic_on_taint =0 ; +panic ("panic_on_taint set ..." ); + } }EXPORT_SYMBOL (add_taint);
@@ -686,3 +693,30 @@ static int __init oops_setup(char *s)return 0 ; }early_param ("oops" , oops_setup); + +static int __init panic_on_taint_setup (char *s) +{ +char *taint_str; + +if (!s) +return -EINVAL ; + + taint_str =strsep (&s,"," ); +if (kstrtoul (taint_str,16 , &panic_on_taint)) +return -EINVAL ; + +/* make sure panic_on_taint doesn't hold out-of-range TAINT flags */ + panic_on_taint &=TAINT_FLAGS_MAX ; + +if (!panic_on_taint) +return -EINVAL ; + +if (s && !strcmp (s,"nousertaint" )) + panic_on_taint_nousertaint = true; + +pr_info ("panic_on_taint: bitmask=0x%lx nousertaint_mode=%sabled\n" , + panic_on_taint, panic_on_taint_nousertaint ?"en" :"dis" ); + +return 0 ; +} +early_param ("panic_on_taint" , panic_on_taint_setup);
kernel/sysctl.c renamed from kernel/sysctl.c~kernel-add-panic_on_taint +10 -1
@@ -866,11 +866,20 @@ static int proc_taint(struct ctl_table *return err;if (write) { +int i; + +/* +* If we are relying on panic_on_taint not producing +* false positives due to userspace input, bail out +* before setting the requested taint flags. +*/ +if (panic_on_taint_nousertaint && (tmptaint & panic_on_taint)) +return -EINVAL ; +/* * Poor man's atomic or. Not worth adding a primitive * to everyone's atomic.h for this */ -int i;for (i =0 ; i <BITS_PER_LONG && tmptaint >> i; i++) {if ((tmptaint >> i) &1 )add_taint (i,LOCKDEP_STILL_OK );
_
Andrew Morton
maintainerPATCH 6/54 xarray.h: correct return code documentation for xa_store_{bh,irq}()
In reply to a message not in the archiveFrom: Manfred Spraul <[email protected]>
Subject: xarray.h: correct return code documentation for xa_store_{bh,irq}()
__xa_store() and xa_store() document that the functions can fail, and that the return code can be an xa_err() encoded error code.
xa_store_bh() and xa_store_irq() do not document that the functions can fail and that they can also return xa_err() encoded error codes.
Thus: Update the documentation.
---
include/linux/xarray.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
include/linux/xarray.h renamed from include/linux/xarray.h~xarrayh-correct-return-code-for-xa_store_bhirq +2 -2
@@ -576,7 +576,7 @@ void __xa_clear_mark(struct xarray *, un* * Context: Any context. Takes and releases the xa_lock while * disabling softirqs. -* Return: The entry which used to be at this index. +* Return: The old entry at this index or xa_err() if an error happened. */ static inline void *xa_store_bh (struct xarray *xa,unsigned long index,void *entry,gfp_t gfp)
@@ -602,7 +602,7 @@ static inline void *xa_store_bh(struct x* * Context: Process context. Takes and releases the xa_lock while * disabling interrupts. -* Return: The entry which used to be at this index. +* Return: The old entry at this index or xa_err() if an error happened. */ static inline void *xa_store_irq (struct xarray *xa,unsigned long index,void *entry,gfp_t gfp)
_
Andrew Morton
maintainerPATCH 7/54 kernel/sysctl: support setting sysctl parameters from kernel command line
In reply to a message not in the archiveFrom: Vlastimil Babka <[email protected]>
Subject: kernel/sysctl: support setting sysctl parameters from kernel command line
Patch series "support setting sysctl parameters from kernel command line", v3.
This series adds support for something that seems like many people always wanted but nobody added it yet, so here's the ability to set sysctl parameters via kernel command line options in the form of sysctl.vm.something=1
The important part is Patch 1. The second, not so important part is an attempt to clean up legacy one-off parameters that do the same thing as a sysctl. I don't want to remove them completely for compatibility reasons, but with generic sysctl support the idea is to remove the one-off param handlers and treat the parameters as aliases for the sysctl variants.
I have identified several parameters that mention sysctl counterparts in Documentation/admin-guide/kernel-parameters.txt but there might be more. The conversion also has varying level of success:
- numa_zonelist_order is converted in Patch 2 together with adding the necessary infrastructure. It's easy as it doesn't really do anything but warn on deprecated value these days.
- hung_task_panic is converted in Patch 3, but there's a downside that now it only accepts 0 and 1, while previously it was any integer value
- nmi_watchdog maps to two sysctls nmi_watchdog and hardlockup_panic, so there's no straighforward conversion possible
- traceoff_on_warning is a flag without value and it would be required to handle that somehow in the conversion infractructure, which seems pointless for a single flag
This patch (of 5):
A recently proposed patch to add vm_swappiness command line parameter in addition to existing sysctl [1] made me wonder why we don't have a general support for passing sysctl parameters via command line. Googling found only somebody else wondering the same [2], but I haven't found any prior discussion with reasons why not to do this.
Settings the vm_swappiness issue aside (the underlying issue might be solved in a different way), quick search of kernel-parameters.txt shows there are already some that exist as both sysctl and kernel parameter - hung_task_panic, nmi_watchdog, numa_zonelist_order, traceoff_on_warning. A general mechanism would remove the need to add more of those one-offs and might be handy in situations where configuration by e.g. /etc/sysctl.d/ is impractical.
Hence, this patch adds a new parse_args() pass that looks for parameters prefixed by 'sysctl.' and tries to interpret them as writes to the corresponding sys/ files using an temporary in-kernel procfs mount. This mechanism was suggested by Eric W. Biederman [3], as it handles all dynamically registered sysctl tables, even though we don't handle modular sysctls. Errors due to e.g. invalid parameter name or value are reported in the kernel log.
The processing is hooked right before the init process is loaded, as some handlers might be more complicated than simple setters and might need some subsystems to be initialized. At the moment the init process can be started and eventually execute a process writing to /proc/sys/ then it should be also fine to do that from the kernel.
Sysctls registered later on module load time are not set by this mechanism
- it's expected that in such scenarios, setting sysctl values from userspace is practical enough.
[1] https://lore.kernel.org/r/BL0PR02MB560167492CA4094C91589930E9FC0@BL0PR02MB5601.namprd02.prod.outlook.com/
[2] https://unix.stackexchange.com/questions/558802/how-to-set-sysctl-using-kernel-command-line-parameter
[3] https://lore.kernel.org/r/[email protected]/
---
Documentation/admin-guide/kernel-parameters.txt | 9 + fs/proc/proc_sysctl.c | 107 ++++++++++++++ include/linux/sysctl.h | 4 init/main.c | 2 4 files changed, 122 insertions(+)
Documentation/admin-guide/kernel-parameters.txt renamed from Documentation/admin-guide/kernel-parameters.txt~kernel-sysctl-support-setting-sysctl-parameters-from-kernel-command-line +9 -0
@@ -4969,6 +4969,15 @@ switches= [HW,M68k] + sysctl.*= [KNL] + Set a sysctl parameter, right before loading the init + process, as if the value was written to the respective + /proc/sys/... file. Both '.' and '/' are recognized as + separators. Unrecognized parameters and invalid values + are reported in the kernel log. Sysctls registered + later by a loaded module cannot be set this way. + Example: sysctl.vm.swappiness=40 + sysfs.deprecated=0|1 [KNL] Enable/disable old style sysfs layout for old udev on older distributions. When this option is enabled
fs/proc/proc_sysctl.c renamed from fs/proc/proc_sysctl.c~kernel-sysctl-support-setting-sysctl-parameters-from-kernel-command-line +107 -0
116 lines not on this page · raw message
include/linux/sysctl.h renamed from include/linux/sysctl.h~kernel-sysctl-support-setting-sysctl-parameters-from-kernel-command-line +4 -0
@@ -197,6 +197,7 @@ struct ctl_table_header *register_sysctlvoid unregister_sysctl_table (struct ctl_table_header * table);extern int sysctl_init (void ); +void do_sysctl_args (void );extern int pwrsw_enabled;extern int unaligned_enabled;
@@ -235,6 +236,9 @@ static inline void setup_sysctl_set(stru { } +static inline void do_sysctl_args (void ) +{ +}#endif /* CONFIG_SYSCTL */ int sysctl_max_threads(struct ctl_table *table, int write, void *buffer,
init/main.c renamed from init/main.c~kernel-sysctl-support-setting-sysctl-parameters-from-kernel-command-line +2 -0
@@ -1412,6 +1412,8 @@ static int __ref kernel_init(void *unusercu_end_inkernel_boot (); +do_sysctl_args (); +if (ramdisk_execute_command) { ret =run_init_process (ramdisk_execute_command);if (!ret)
_
Andrew Morton
maintainerPATCH 8/54 kernel/sysctl: support handling command line aliases
In reply to a message not in the archiveFrom: Vlastimil Babka <[email protected]>
Subject: kernel/sysctl: support handling command line aliases
We can now handle sysctl parameters on kernel command line, but historically some parameters introduced their own command line equivalent, which we don't want to remove for compatibility reasons. We can however convert them to the generic infrastructure with a table translating the legacy command line parameters to their sysctl names, and removing the one-off param handlers.
This patch adds the support and makes the first conversion to demonstrate it, on the (deprecated) numa_zonelist_order parameter.
---
fs/proc/proc_sysctl.c | 48 ++++++++++++++++++++++++++++++++++------ mm/page_alloc.c | 9 ------- 2 files changed, 41 insertions(+), 16 deletions(-)
fs/proc/proc_sysctl.c renamed from fs/proc/proc_sysctl.c~kernel-sysctl-support-handling-command-line-aliases +41 -7
@@ -1705,6 +1705,37 @@ int __init proc_sys_init(void)return sysctl_init (); } +struct sysctl_alias { +const char *kernel_param; +const char *sysctl_param; +}; + +/* +* Historically some settings had both sysctl and a command line parameter. +* With the generic sysctl. parameter support, we can handle them at a single +* place and only keep the historical name for compatibility. This is not meant +* to add brand new aliases. When adding existing aliases, consider whether +* the possibly different moment of changing the value (e.g. from early_param +* to the moment do_sysctl_args() is called) is an issue for the specific +* parameter. +*/ +static const struct sysctl_alias sysctl_aliases[] = { + {"numa_zonelist_order" ,"vm.numa_zonelist_order" }, + { } +}; + +static const char *sysctl_find_alias (char *param) +{ +const struct sysctl_alias *alias; + +for (alias = &sysctl_aliases[0 ]; alias->kernel_param !=NULL ; alias++) { +if (strcmp (alias->kernel_param, param) ==0 ) +return alias->sysctl_param; + } + +return NULL ; +} +/* Set sysctl value passed on kernel command line. */ static int process_sysctl_arg (char *param,char *val,const char *unused,void *arg)
@@ -1718,15 +1749,18 @@ static int process_sysctl_arg(char *paraloff_t pos =0 ;ssize_t wret; -if (strncmp (param,"sysctl" ,sizeof ("sysctl" ) -1 )) -return 0 ; - - param +=sizeof ("sysctl" ) -1 ; +if (strncmp (param,"sysctl" ,sizeof ("sysctl" ) -1 ) ==0 ) { + param +=sizeof ("sysctl" ) -1 ; -if (param[0 ] !='/' && param[0 ] !='.' ) -return 0 ; +if (param[0 ] !='/' && param[0 ] !='.' ) +return 0 ; - param++; + param++; + }else { + param = (char *)sysctl_find_alias (param); +if (!param) +return 0 ; + }/* * To set sysctl options, we use a temporary mount of proc, look up the
mm/page_alloc.c renamed from mm/page_alloc.c~kernel-sysctl-support-handling-command-line-aliases +0 -8
@@ -5575,15 +5575,6 @@ static int __parse_numa_zonelist_order(creturn 0 ; } -static __init int setup_numa_zonelist_order (char *s) -{ -if (!s) -return 0 ; - -return __parse_numa_zonelist_order (s); -} -early_param ("numa_zonelist_order" , setup_numa_zonelist_order);
Andrew Morton
maintainerPATCH 9/54 kernel/hung_task convert hung_task_panic boot parameter to sysctl
In reply to a message not in the archiveFrom: Vlastimil Babka <[email protected]>
Subject: kernel/hung_task convert hung_task_panic boot parameter to sysctl
We can now handle sysctl parameters on kernel command line and have infrastructure to convert legacy command line options that duplicate sysctl to become a sysctl alias.
This patch converts the hung_task_panic parameter. Note that the sysctl handler is more strict and allows only 0 and 1, while the legacy parameter allowed any non-zero value. But there is little reason anyone would not be using 1.
---
Documentation/admin-guide/kernel-parameters.txt | 2 +- fs/proc/proc_sysctl.c | 1 + kernel/hung_task.c | 10 ---------- 3 files changed, 2 insertions(+), 11 deletions(-)
Documentation/admin-guide/kernel-parameters.txt renamed from Documentation/admin-guide/kernel-parameters.txt~kernel-hung_task-convert-hung_task_panic-boot-parameter-to-sysctl +1 -1
@@ -1515,7 +1515,7 @@ [KNL] Should the hung task detector generate panics. Format: <integer> - A nonzero value instructs the kernel to panic when a + A value of 1 instructs the kernel to panic when a hung task is detected. The default value is controlled by the CONFIG_BOOTPARAM_HUNG_TASK_PANIC build-time option. The value selected by this boot parameter can
fs/proc/proc_sysctl.c renamed from fs/proc/proc_sysctl.c~kernel-hung_task-convert-hung_task_panic-boot-parameter-to-sysctl +1 -0
@@ -1721,6 +1721,7 @@ struct sysctl_alias {*/ static const struct sysctl_alias sysctl_aliases[] = { {"numa_zonelist_order" ,"vm.numa_zonelist_order" }, + {"hung_task_panic" ,"kernel.hung_task_panic" }, { } };
kernel/hung_task.c renamed from kernel/hung_task.c~kernel-hung_task-convert-hung_task_panic-boot-parameter-to-sysctl +0 -9
@@ -63,16 +63,6 @@ static struct task_struct *watchdog_taskunsigned int __read_mostly sysctl_hung_task_panic =CONFIG_BOOTPARAM_HUNG_TASK_PANIC_VALUE ; -static int __init hung_task_panic_setup (char *str) -{ -int rc =kstrtouint (str,0 , &sysctl_hung_task_panic); - -if (rc) -return rc; -return 1 ; -} -__setup ("hung_task_panic=" , hung_task_panic_setup);
Andrew Morton
maintainerPATCH 10/54 tools/testing/selftests/sysctl/sysctl.sh: support CONFIG_TEST_SYSCTL=y
In reply to a message not in the archiveFrom: Vlastimil Babka <[email protected]>
Subject: tools/testing/selftests/sysctl/sysctl.sh: support CONFIG_TEST_SYSCTL=y
The testing script recommends CONFIG_TEST_SYSCTL=y, but actually only works with CONFIG_TEST_SYSCTL=m. Testing of sysctl setting via boot param however requires the test to be built-in, so make sure the test script supports it.
---
tools/testing/selftests/sysctl/sysctl.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
tools/testing/selftests/sysctl/sysctl.sh renamed from tools/testing/selftests/sysctl/sysctl.sh~tools-testing-selftests-sysctl-sysctlsh-support-config_test_sysctl=y +1 -1
@@ -122,7 +122,7 @@ test_reqs() function load_req_mod() { - if [ ! -d $DIR ]; then + if [ ! -d $SYSCTL ]; then if ! modprobe -q -n $TEST_DRIVER; then echo "$0: module $TEST_DRIVER not found [SKIP]" exit $ksft_skip
_
Andrew Morton
maintainerPATCH 11/54 lib/test_sysctl: support testing of sysctl. boot parameter
In reply to a message not in the archiveFrom: Vlastimil Babka <[email protected]>
Subject: lib/test_sysctl: support testing of sysctl. boot parameter
Testing is done by a new parameter debug.test_sysctl.boot_int which defaults to 0 and it's expected that the tester passes a boot parameter that sets it to 1. The test checks if it's set to 1. To distinguish true failure from parameter not being set, the test checks /proc/cmdline for the expected parameter, and whether test_sysctl is built-in and not a module.
---
lib/test_sysctl.c | 13 ++++++ tools/testing/selftests/sysctl/sysctl.sh | 42 +++++++++++++++++++++ 2 files changed, 55 insertions(+)
lib/test_sysctl.c renamed from lib/test_sysctl.c~lib-test_sysctl-support-testing-of-sysctl-boot-parameter +13 -0
@@ -44,6 +44,8 @@ struct test_sysctl_data {int int_0002;int int_0003[4 ]; +int boot_int; +unsigned int uint_0001;char string_0001[65 ];
@@ -61,6 +63,8 @@ static struct test_sysctl_data test_data .int_0003[2] = 2, .int_0003[3] = 3, + .boot_int = 0, + .uint_0001 = 314, .string_0001 = "(none)",
@@ -92,6 +96,15 @@ static struct ctl_table test_table[] = { .proc_handler = proc_dointvec, }, { + .procname = "boot_int", + .data = &test_data.boot_int, + .maxlen = sizeof(test_data.boot_int), + .mode = 0644, + .proc_handler = proc_dointvec, + .extra1 = SYSCTL_ZERO, + .extra2 = SYSCTL_ONE, + }, + { .procname = "uint_0001", .data = &test_data.uint_0001, .maxlen = sizeof(unsigned int),
tools/testing/selftests/sysctl/sysctl.sh renamed from tools/testing/selftests/sysctl/sysctl.sh~lib-test_sysctl-support-testing-of-sysctl-boot-parameter +42 -0
60 lines not on this page · raw message
_
Andrew Morton
maintainerPATCH 12/54 kernel/watchdog.c: convert {soft/hard}lockup boot parameters to sysctl aliases
In reply to a message not in the archiveFrom: "Guilherme G. Piccoli" <[email protected]>
Subject: kernel/watchdog.c: convert {soft/hard}lockup boot parameters to sysctl aliases
After a recent change introduced by Vlastimil's series [0], kernel is able now to handle sysctl parameters on kernel command line; also, the series introduced a simple infrastructure to convert legacy boot parameters (that duplicate sysctls) into sysctl aliases.
This patch converts the watchdog parameters softlockup_panic and {hard,soft}lockup_all_cpu_backtrace to use the new alias infrastructure. It fixes the documentation too, since the alias only accepts values 0 or 1, not the full range of integers. We also took the opportunity here to improve the documentation of the previously converted hung_task_panic (see the patch series [0]) and put the alias table in alphabetical order.
[0] http://lkml.kernel.org/r/[email protected]
---
Documentation/admin-guide/kernel-parameters.txt | 10 +-- fs/proc/proc_sysctl.c | 7 +- kernel/watchdog.c | 37 +++----------- 3 files changed, 19 insertions(+), 35 deletions(-)
Documentation/admin-guide/kernel-parameters.txt renamed from Documentation/admin-guide/kernel-parameters.txt~kernel-watchdogc-convert-soft-hardlockup-boot-parameters-to-sysctl-aliases +5 -5
@@ -1445,7 +1445,7 @@ hardlockup_all_cpu_backtrace= [KNL] Should the hard-lockup detector generate backtraces on all cpus. - Format: <integer> + Format: 0 | 1 hashdist= [KNL,NUMA] Large hashes allocated during boot are distributed across NUMA nodes. Defaults on
@@ -1513,7 +1513,7 @@ hung_task_panic= [KNL] Should the hung task detector generate panics. - Format: <integer> + Format: 0 | 1 A value of 1 instructs the kernel to panic when a hung task is detected. The default value is controlled
@@ -4665,9 +4665,9 @@ softlockup_panic= [KNL] Should the soft-lockup detector generate panics. - Format: <integer> + Format: 0 | 1 - A nonzero value instructs the soft-lockup detector + A value of 1 instructs the soft-lockup detector to panic the machine when a soft-lockup occurs. It is also controlled by the kernel.softlockup_panic sysctl and CONFIG_BOOTPARAM_SOFTLOCKUP_PANIC, which is the
@@ -4676,7 +4676,7 @@ softlockup_all_cpu_backtrace= [KNL] Should the soft-lockup detector generate backtraces on all cpus. - Format: <integer> + Format: 0 | 1 sonypi.*= [HW] Sony Programmable I/O Control Device driver See Documentation/admin-guide/laptops/sonypi.rst
fs/proc/proc_sysctl.c renamed from fs/proc/proc_sysctl.c~kernel-watchdogc-convert-soft-hardlockup-boot-parameters-to-sysctl-aliases +5 -2
@@ -1720,8 +1720,11 @@ struct sysctl_alias {* parameter. */ static const struct sysctl_alias sysctl_aliases[] = { - {"numa_zonelist_order" ,"vm.numa_zonelist_order" }, - {"hung_task_panic" ,"kernel.hung_task_panic" }, + {"hardlockup_all_cpu_backtrace" ,"kernel.hardlockup_all_cpu_backtrace" }, + {"hung_task_panic" ,"kernel.hung_task_panic" }, + {"numa_zonelist_order" ,"vm.numa_zonelist_order" }, + {"softlockup_all_cpu_backtrace" ,"kernel.softlockup_all_cpu_backtrace" }, + {"softlockup_panic" ,"kernel.softlockup_panic" }, { } };
kernel/watchdog.c renamed from kernel/watchdog.c~kernel-watchdogc-convert-soft-hardlockup-boot-parameters-to-sysctl-aliases +9 -27
@@ -50,6 +50,11 @@ struct cpumask watchdog_cpumask __read_munsigned long *watchdog_cpumask_bits =cpumask_bits (&watchdog_cpumask);#ifdef CONFIG_HARDLOCKUP_DETECTOR + +# ifdef CONFIG_SMP +int __read_mostly sysctl_hardlockup_all_cpu_backtrace; +# endif /* CONFIG_SMP */ +/* * Should we panic when a soft-lockup or hard-lockup occurs: */
@@ -82,16 +87,6 @@ static int __init hardlockup_panic_setup }__setup ("nmi_watchdog=" , hardlockup_panic_setup); -# ifdef CONFIG_SMP -int __read_mostly sysctl_hardlockup_all_cpu_backtrace; - -static int __init hardlockup_all_cpu_backtrace_setup (char *str) -{ - sysctl_hardlockup_all_cpu_backtrace = !!simple_strtol (str,NULL ,0 ); -return 1 ; -} -__setup ("hardlockup_all_cpu_backtrace=" , hardlockup_all_cpu_backtrace_setup); -# endif /* CONFIG_SMP */ #endif /* CONFIG_HARDLOCKUP_DETECTOR */ /*
@@ -163,6 +158,10 @@ static void lockup_detector_update_enabl#define SOFTLOCKUP_RESET ULONG_MAX +#ifdef CONFIG_SMP +int __read_mostly sysctl_softlockup_all_cpu_backtrace; +#endif +/* Global variables, exported for sysctl */ unsigned int __read_mostly softlockup_panic =CONFIG_BOOTPARAM_SOFTLOCKUP_PANIC_VALUE ;
@@ -178,13 +177,6 @@ static DEFINE_PER_CPU(unsigned long, hrt static DEFINE_PER_CPU(unsigned long, hrtimer_interrupts_saved);static unsigned long soft_lockup_nmi_warn; -static int __init softlockup_panic_setup (char *str) -{ - softlockup_panic =simple_strtoul (str,NULL ,0 ); -return 1 ; -} -__setup ("softlockup_panic=" , softlockup_panic_setup); -static int __init nowatchdog_setup (char *str) { watchdog_user_enabled =0 ;
@@ -206,17 +198,6 @@ static int __init watchdog_thresh_setup( }__setup ("watchdog_thresh=" , watchdog_thresh_setup); -#ifdef CONFIG_SMP -int __read_mostly sysctl_softlockup_all_cpu_backtrace; - -static int __init softlockup_all_cpu_backtrace_setup (char *str) -{ - sysctl_softlockup_all_cpu_backtrace = !!simple_strtol (str,NULL ,0 ); -return 1 ; -} -__setup ("softlockup_all_cpu_backtrace=" , softlockup_all_cpu_backtrace_setup); -#endif
Andrew Morton
maintainerPATCH 13/54 kernel/hung_task.c: introduce sysctl to print all traces when a hung task is detected
In reply to a message not in the archiveFrom: "Guilherme G. Piccoli" <[email protected]>
Subject: kernel/hung_task.c: introduce sysctl to print all traces when a hung task is detected
Commit 401c636a0eeb ("kernel/hung_task.c: show all hung tasks before panic") introduced a change in that we started to show all CPUs backtraces when a hung task is detected _and_ the sysctl/kernel parameter "hung_task_panic" is set. The idea is good, because usually when observing deadlocks (that may lead to hung tasks), the culprit is another task holding a lock and not necessarily the task detected as hung.
The problem with this approach is that dumping backtraces is a slightly expensive task, specially printing that on console (and specially in many CPU machines, as servers commonly found nowadays). So, users that plan to collect a kdump to investigate the hung tasks and narrow down the deadlock definitely don't need the CPUs backtrace on dmesg/console, which will delay the panic and pollute the log (crash tool would easily grab all CPUs traces with 'bt -a' command).
Also, there's the reciprocal scenario: some users may be interested in seeing the CPUs backtraces but not have the system panic when a hung task is detected. The current approach hence is almost as embedding a policy in the kernel, by forcing the CPUs backtraces' dump (only) on hung_task_panic.
This patch decouples the panic event on hung task from the CPUs backtraces dump, by creating (and documenting) a new sysctl called "hung_task_all_cpu_backtrace", analog to the approach taken on soft/hard lockups, that have both a panic and an "all_cpu_backtrace" sysctl to allow individual control. The new mechanism for dumping the CPUs backtraces on hung task detection respects "hung_task_warnings" by not dumping the traces in case there's no warnings left.
---
Documentation/admin-guide/sysctl/kernel.rst | 14 ++++++++++++ include/linux/sched/sysctl.h | 7 ++++++ kernel/hung_task.c | 20 ++++++++++++++++-- kernel/sysctl.c | 11 +++++++++ 4 files changed, 50 insertions(+), 2 deletions(-)
Documentation/admin-guide/sysctl/kernel.rst renamed from Documentation/admin-guide/sysctl/kernel.rst~kernel-hung_taskc-introduce-sysctl-to-print-all-traces-when-a-hung-task-is-detected +14 -0
@@ -335,6 +335,20 @@ Path for the hotplug policy agent. Default value is "``/sbin/hotplug``". +hung_task_all_cpu_backtrace: +================ + +If this option is set, the kernel will send an NMI to all CPUs to dump +their backtraces when a hung task is detected. This file shows up if +CONFIG_DETECT_HUNG_TASK and CONFIG_SMP are enabled. + +0: Won't show all CPUs backtraces when a hung task is detected. +This is the default behavior. + +1: Will non-maskably interrupt all CPUs and dump their backtraces when +a hung task is detected. + + hung_task_panic ===============
include/linux/sched/sysctl.h renamed from include/linux/sched/sysctl.h~kernel-hung_taskc-introduce-sysctl-to-print-all-traces-when-a-hung-task-is-detected +7 -0
@@ -7,6 +7,13 @@struct ctl_table ;#ifdef CONFIG_DETECT_HUNG_TASK + +#ifdef CONFIG_SMP +extern unsigned int sysctl_hung_task_all_cpu_backtrace; +#else +#define sysctl_hung_task_all_cpu_backtrace 0 +#endif /* CONFIG_SMP */ +extern int sysctl_hung_task_check_count;extern unsigned int sysctl_hung_task_panic;extern unsigned long sysctl_hung_task_timeout_secs;
kernel/hung_task.c renamed from kernel/hung_task.c~kernel-hung_taskc-introduce-sysctl-to-print-all-traces-when-a-hung-task-is-detected +18 -2
@@ -53,9 +53,18 @@ int __read_mostly sysctl_hung_task_warnistatic int __read_mostly did_panic;static bool hung_task_show_lock;static bool hung_task_call_panic; +static bool hung_task_show_all_bt;static struct task_struct *watchdog_task; +#ifdef CONFIG_SMP +/* +* Should we dump all CPUs backtraces in a hung task event? +* Defaults to 0, can be changed via sysctl. +*/ +unsigned int __read_mostly sysctl_hung_task_all_cpu_backtrace; +#endif /* CONFIG_SMP */ +/* * Should we panic (and reboot, if panic_timeout= is set) when a * hung task is detected:
@@ -127,6 +136,9 @@ static void check_hung_task(struct task_ " disables this message.\n");sched_show_task (t); hung_task_show_lock = true; + +if (sysctl_hung_task_all_cpu_backtrace) + hung_task_show_all_bt = true; }touch_nmi_watchdog ();
@@ -191,10 +203,14 @@ static void check_hung_uninterruptible_trcu_read_unlock ();if (hung_task_show_lock)debug_show_all_locks (); -if (hung_task_call_panic) { + +if (hung_task_show_all_bt) { + hung_task_show_all_bt = false;trigger_all_cpu_backtrace (); -panic ("hung_task: blocked tasks" ); } + +if (hung_task_call_panic) +panic ("hung_task: blocked tasks" ); } static long hung_timeout_jiffies(unsigned long last_checked,
kernel/sysctl.c renamed from kernel/sysctl.c~kernel-hung_taskc-introduce-sysctl-to-print-all-traces-when-a-hung-task-is-detected +11 -0
@@ -2437,6 +2437,17 @@ static struct ctl_table kern_table[] = { },#endif #ifdef CONFIG_DETECT_HUNG_TASK +#ifdef CONFIG_SMP + { + .procname = "hung_task_all_cpu_backtrace", + .data = &sysctl_hung_task_all_cpu_backtrace, + .maxlen = sizeof(int), + .mode = 0644, + .proc_handler = proc_dointvec_minmax, + .extra1 = SYSCTL_ZERO, + .extra2 = SYSCTL_ONE, + }, +#endif /* CONFIG_SMP */ { .procname = "hung_task_panic", .data = &sysctl_hung_task_panic,
_
Andrew Morton
maintainerPATCH 14/54 panic: add sysctl to dump all CPUs backtraces on oops event
In reply to a message not in the archiveFrom: "Guilherme G. Piccoli" <[email protected]>
Subject: panic: add sysctl to dump all CPUs backtraces on oops event
Usually when the kernel reaches an oops condition, it's a point of no return; in case not enough debug information is available in the kernel splat, one of the last resorts would be to collect a kernel crash dump and analyze it. The problem with this approach is that in order to collect the dump, a panic is required (to kexec-load the crash kernel). When in an environment of multiple virtual machines, users may prefer to try living with the oops, at least until being able to properly shutdown their VMs / finish their important tasks.
This patch implements a way to collect a bit more debug details when an oops event is reached, by printing all the CPUs backtraces through the usage of NMIs (on architectures that support that). The sysctl added (and documented) here was called "oops_all_cpu_backtrace", and when set will (as the name suggests) dump all CPUs backtraces.
Far from ideal, this may be the last option though for users that for some reason cannot panic on oops. Most of times oopses are clear enough to indicate the kernel portion that must be investigated, but in virtual environments it's possible to observe hypervisor/KVM issues that could lead to oopses shown in other guests CPUs (like virtual APIC crashes). This patch hence aims to help debug such complex issues without resorting to kdump.
---
Documentation/admin-guide/sysctl/kernel.rst | 16 ++++++++++++++++ include/linux/kernel.h | 6 ++++++ kernel/panic.c | 11 +++++++++++ kernel/sysctl.c | 11 +++++++++++ 4 files changed, 44 insertions(+)
Documentation/admin-guide/sysctl/kernel.rst renamed from Documentation/admin-guide/sysctl/kernel.rst~panic-add-sysctl-to-dump-all-cpus-backtraces-on-oops-event +16 -0
@@ -646,6 +646,22 @@ rate for each task. scanned for a given scan. +oops_all_cpu_backtrace: +================ + +If this option is set, the kernel will send an NMI to all CPUs to dump +their backtraces when an oops event occurs. It should be used as a last +resort in case a panic cannot be triggered (to protect VMs running, for +example) or kdump can't be collected. This file shows up if CONFIG_SMP +is enabled. + +0: Won't show all CPUs backtraces when an oops is detected. +This is the default behavior. + +1: Will non-maskably interrupt all CPUs and dump their backtraces when +an oops event is detected. + + osrelease, ostype & version ===========================
include/linux/kernel.h renamed from include/linux/kernel.h~panic-add-sysctl-to-dump-all-cpus-backtraces-on-oops-event +6 -0
@@ -520,6 +520,12 @@ static inline u32 int_sqrt64(u64 x) }#endif +#ifdef CONFIG_SMP +extern unsigned int sysctl_oops_all_cpu_backtrace; +#else +#define sysctl_oops_all_cpu_backtrace 0 +#endif /* CONFIG_SMP */ +extern void bust_spinlocks (int yes);extern int oops_in_progress;/* If set, an oops, panic(), BUG() or die() is in progress */ extern int panic_timeout;
kernel/panic.c renamed from kernel/panic.c~panic-add-sysctl-to-dump-all-cpus-backtraces-on-oops-event +11 -0
@@ -36,6 +36,14 @@#define PANIC_TIMER_STEP 100#define PANIC_BLINK_SPD 18 +#ifdef CONFIG_SMP +/* +* Should we dump all CPUs backtraces in an oops event? +* Defaults to 0, can be changed via sysctl. +*/ +unsigned int __read_mostly sysctl_oops_all_cpu_backtrace; +#endif /* CONFIG_SMP */ +int panic_on_oops =CONFIG_PANIC_ON_OOPS_VALUE ;static unsigned long tainted_mask =IS_ENABLED (CONFIG_GCC_PLUGIN_RANDSTRUCT ) ? (1 <<TAINT_RANDSTRUCT ) :0 ;
@@ -522,6 +530,9 @@ void oops_enter(void)/* can't trust the integrity of the kernel anymore: */ debug_locks_off ();do_oops_enter_exit (); + +if (sysctl_oops_all_cpu_backtrace) +trigger_all_cpu_backtrace (); }/*
kernel/sysctl.c renamed from kernel/sysctl.c~panic-add-sysctl-to-dump-all-cpus-backtraces-on-oops-event +11 -0
@@ -2150,6 +2150,17 @@ static struct ctl_table kern_table[] = { .proc_handler = proc_dointvec, },#endif +#ifdef CONFIG_SMP + { + .procname = "oops_all_cpu_backtrace", + .data = &sysctl_oops_all_cpu_backtrace, + .maxlen = sizeof(int), + .mode = 0644, + .proc_handler = proc_dointvec_minmax, + .extra1 = SYSCTL_ZERO, + .extra2 = SYSCTL_ONE, + }, +#endif /* CONFIG_SMP */ { .procname = "pid_max", .data = &pid_max,
_
Andrew Morton
maintainerPATCH 15/54 kernel/sysctl.c: ignore out-of-range taint bits introduced via kernel.tainted
In reply to a message not in the archiveFrom: Rafael Aquini <[email protected]>
Subject: kernel/sysctl.c: ignore out-of-range taint bits introduced via kernel.tainted
Users with SYS_ADMIN capability can add arbitrary taint flags to the running kernel by writing to /proc/sys/kernel/tainted or issuing the command 'sysctl -w kernel.tainted=...'. This interface, however, is open for any integer value and this might cause an invalid set of flags being committed to the tainted_mask bitset.
This patch introduces a simple way for proc_taint() to ignore any eventual invalid bit coming from the user input before committing those bits to the kernel tainted_mask.
---
kernel/sysctl.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-)
kernel/sysctl.c renamed from kernel/sysctl.c~kernel-sysctl-ignore-out-of-range-taint-bits-introduced-via-kerneltainted +2 -3
@@ -880,10 +880,9 @@ static int proc_taint(struct ctl_table ** Poor man's atomic or. Not worth adding a primitive * to everyone's atomic.h for this */ -for (i =0 ; i <BITS_PER_LONG && tmptaint >> i; i++) { -if ((tmptaint >> i) &1 ) +for (i =0 ; i <TAINT_FLAGS_COUNT ; i++) +if ((1UL << i) & tmptaint)add_taint (i,LOCKDEP_STILL_OK ); - } }return err;
_
Andrew Morton
maintainerPATCH 16/54 mm/gup.c: convert to use get_user_{page|pages}_fast_only()
In reply to a message not in the archiveFrom: Souptick Joarder <[email protected]>
Subject: mm/gup.c: convert to use get_user_{page|pages}_fast_only()
API __get_user_pages_fast() renamed to get_user_pages_fast_only() to align with pin_user_pages_fast_only().
As part of this we will get rid of write parameter. Instead caller will pass FOLL_WRITE to get_user_pages_fast_only(). This will not change any existing functionality of the API.
All the callers are changed to pass FOLL_WRITE.
Also introduce get_user_page_fast_only(), and use it in a few places that hard-code nr_pages to 1.
Updated the documentation of the API.
---
arch/powerpc/kvm/book3s_64_mmu_hv.c | 2 - arch/powerpc/kvm/book3s_64_mmu_radix.c | 2 - arch/powerpc/perf/callchain_64.c | 4 --- include/linux/mm.h | 10 ++++++- kernel/events/core.c | 4 +-- mm/gup.c | 29 ++++++++++++----------- virt/kvm/kvm_main.c | 8 ++---- 7 files changed, 32 insertions(+), 27 deletions(-)
arch/powerpc/kvm/book3s_64_mmu_hv.c renamed from arch/powerpc/kvm/book3s_64_mmu_hv.c~mm-gupc-convert-to-use-get_user_pagepages_fast_only +1 -1
@@ -581,7 +581,7 @@ int kvmppc_book3s_hv_page_fault(struct k* We always ask for write permission since the common case * is that the page is writable. */ -if (__get_user_pages_fast (hva,1 ,1 , &page) ==1 ) { +if (get_user_page_fast_only (hva,FOLL_WRITE , &page)) { write_ok = true; }else {/* Call KVM generic code to do the slow-path check */
arch/powerpc/kvm/book3s_64_mmu_radix.c renamed from arch/powerpc/kvm/book3s_64_mmu_radix.c~mm-gupc-convert-to-use-get_user_pagepages_fast_only +1 -1
@@ -795,7 +795,7 @@ int kvmppc_book3s_instantiate_page(struc* is that the page is writable. */ hva =gfn_to_hva_memslot (memslot, gfn); -if (!kvm_ro &&__get_user_pages_fast (hva,1 ,1 , &page) ==1 ) { +if (!kvm_ro &&get_user_page_fast_only (hva,FOLL_WRITE , &page)) { upgrade_write = true; }else {unsigned long pfn;
arch/powerpc/perf/callchain_64.c renamed from arch/powerpc/perf/callchain_64.c~mm-gupc-convert-to-use-get_user_pagepages_fast_only +1 -3
@@ -30,11 +30,9 @@ int read_user_stack_slow(void __user *ptunsigned long addr = (unsigned long ) ptr;unsigned long offset;struct page *page; -int nrpages;void *kaddr; - nrpages =__get_user_pages_fast (addr,1 ,1 , &page); -if (nrpages ==1 ) { +if (get_user_page_fast_only (addr,FOLL_WRITE , &page)) { kaddr =page_address (page);/* align address to page boundary */
include/linux/mm.h renamed from include/linux/mm.h~mm-gupc-convert-to-use-get_user_pagepages_fast_only +8 -2
@@ -1824,10 +1824,16 @@ extern int mprotect_fixup(struct vm_area/* * doesn't attempt to fault and will return short. */ -int __get_user_pages_fast (unsigned long start,int nr_pages,int write, -struct page **pages); +int get_user_pages_fast_only (unsigned long start,int nr_pages, +unsigned int gup_flags,struct page **pages);int pin_user_pages_fast_only (unsigned long start,int nr_pages,unsigned int gup_flags,struct page **pages); + +static inline bool get_user_page_fast_only (unsigned long addr, +unsigned int gup_flags,struct page **pagep) +{ +return get_user_pages_fast_only (addr,1 , gup_flags, pagep) ==1 ; +}/* * per-process(per-mm_struct) statistics. */
kernel/events/core.c renamed from kernel/events/core.c~mm-gupc-convert-to-use-get_user_pagepages_fast_only +2 -2
@@ -6934,12 +6934,12 @@ static u64 perf_virt_to_phys(u64 virt)* Walking the pages tables for user address. * Interrupts are disabled, so it prevents any tear down * of the page tables. -* Try IRQ-safe __get_user_pages_fast first. +* Try IRQ-safe get_user_page_fast_only first. * If failed, leave phys_addr as 0. */ if (current->mm !=NULL ) {pagefault_disable (); -if (__get_user_pages_fast (virt,1 ,0 , &p) ==1 ) +if (get_user_page_fast_only (virt,0 , &p)) phys_addr =page_to_phys (p) + virt %PAGE_SIZE ;pagefault_enable (); }
mm/gup.c renamed from mm/gup.c~mm-gupc-convert-to-use-get_user_pagepages_fast_only +16 -13
@@ -2294,7 +2294,7 @@ pte_unmap:* to be special. * * For a futex to be placed on a THP tail page, get_futex_key requires a -* __get_user_pages_fast implementation that can pin pages. Thus it's still +* get_user_pages_fast_only implementation that can pin pages. Thus it's still * useful to have gup_huge_pmd even if we can't operate on ptes. */ static int gup_pte_range(pmd_t pmd, unsigned long addr, unsigned long end,
@@ -2699,7 +2699,7 @@ static inline void gup_pgd_range(unsigne#ifndef gup_fast_permitted/* -* Check if it's allowed to use __get_user_pages_fast() for the range, or +* Check if it's allowed to use get_user_pages_fast_only() for the range, or * we need to fall back to the slow version: */ static bool gup_fast_permitted (unsigned long start,unsigned long end)
@@ -2811,8 +2811,14 @@ static int internal_get_user_pages_fast(return ret; } - -/* +/** +* get_user_pages_fast_only() - pin user pages in memory +* @start: starting user address +* @nr_pages: number of pages from start to pin +* @gup_flags: flags modifying pin behaviour +* @pages: array that receives pointers to the pages pinned. +* Should be at least nr_pages long. +* * Like get_user_pages_fast() except it's IRQ-safe in that it won't fall back to * the regular GUP. * Note a difference with get_user_pages_fast: this always returns the
@@ -2825,8 +2831,8 @@ static int internal_get_user_pages_fast(* access can get ambiguous page results. If you call this function without * 'write' set, you'd better be sure that you're ok with that ambiguity. */ -int __get_user_pages_fast (unsigned long start,int nr_pages,int write, -struct page **pages) +int get_user_pages_fast_only (unsigned long start,int nr_pages, +unsigned int gup_flags,struct page **pages) {int nr_pinned;/*
@@ -2836,10 +2842,7 @@ int __get_user_pages_fast(unsigned long* FOLL_FAST_ONLY is required in order to match the API description of * this routine: no fall back to regular ("slow") GUP. */ -unsigned int gup_flags =FOLL_GET |FOLL_FAST_ONLY ; - -if (write) - gup_flags |=FOLL_WRITE ; + gup_flags |=FOLL_GET |FOLL_FAST_ONLY ; nr_pinned =internal_get_user_pages_fast (start, nr_pages, gup_flags, pages);
@@ -2855,7 +2858,7 @@ int __get_user_pages_fast(unsigned longreturn nr_pinned; } -EXPORT_SYMBOL_GPL (__get_user_pages_fast); +EXPORT_SYMBOL_GPL (get_user_pages_fast_only);/** * get_user_pages_fast() - pin user pages in memory
@@ -2926,8 +2929,8 @@ int pin_user_pages_fast(unsigned long stEXPORT_SYMBOL_GPL (pin_user_pages_fast);/* -* This is the FOLL_PIN equivalent of __get_user_pages_fast(). Behavior is the -* same, except that this one sets FOLL_PIN instead of FOLL_GET. +* This is the FOLL_PIN equivalent of get_user_pages_fast_only(). Behavior +* is the same, except that this one sets FOLL_PIN instead of FOLL_GET. * * The API rules are the same, too: no negative values may be returned. */
virt/kvm/kvm_main.c renamed from virt/kvm/kvm_main.c~mm-gupc-convert-to-use-get_user_pagepages_fast_only +3 -5
@@ -1740,7 +1740,6 @@ static bool hva_to_pfn_fast(unsigned lon bool *writable, kvm_pfn_t *pfn) { struct page *page[1]; -int npages;/* * Fast pin a writable pfn only if it is a write fault request
@@ -1750,8 +1749,7 @@ static bool hva_to_pfn_fast(unsigned lonif (!(write_fault || writable))return false; - npages =__get_user_pages_fast (addr,1 ,1 , page); -if (npages ==1 ) { +if (get_user_page_fast_only (addr,FOLL_WRITE , page)) { *pfn =page_to_pfn (page[0 ]);if (writable)
@@ -1791,7 +1789,7 @@ static int hva_to_pfn_slow(unsigned longif (unlikely (!write_fault) && writable) {struct page *wpage; -if (__get_user_pages_fast (addr,1 ,1 , &wpage) ==1 ) { +if (get_user_page_fast_only (addr,FOLL_WRITE , &wpage)) { *writable = true;put_page (page); page = wpage;
@@ -2003,7 +2001,7 @@ int gfn_to_page_many_atomic(struct kvm_mif (entry < nr_pages)return 0 ; -return __get_user_pages_fast (addr, nr_pages,1 , pages); +return get_user_pages_fast_only (addr, nr_pages,FOLL_WRITE , pages); }EXPORT_SYMBOL_GPL (gfn_to_page_many_atomic);
_
Andrew Morton
maintainerPATCH 17/54 mm/gup: update pin_user_pages.rst for "case 3" (mmu notifiers)
In reply to a message not in the archiveFrom: John Hubbard <[email protected]>
Subject: mm/gup: update pin_user_pages.rst for "case 3" (mmu notifiers)
Update case 3 so that it covers the use of mmu notifiers, for hardware that does, or does not have replayable page faults.
Also, elaborate case 4 slightly, as it was quite cryptic.
---
Documentation/core-api/pin_user_pages.rst | 29 +++++++++++--------- 1 file changed, 17 insertions(+), 12 deletions(-)
Documentation/core-api/pin_user_pages.rst renamed from Documentation/core-api/pin_user_pages.rst~mm-gup-update-pin_user_pagesrst-for-case-3-mmu-notifiers +17 -12
@@ -148,23 +148,28 @@ NOTE: Some pages, such as DAX pages, can because DAX pages do not have a separate page cache, and so "pinning" implies locking down file system blocks, which is not (yet) supported in that way. -CASE 3: Hardware with page faulting support -------------------------------------------- -Here, a well-written driver doesn't normally need to pin pages at all. However, -if the driver does choose to do so, it can register MMU notifiers for the range, -and will be called back upon invalidation. Either way (avoiding page pinning, or -using MMU notifiers to unpin upon request), there is proper synchronization with -both filesystem and mm (page_mkclean(), munmap(), etc). +CASE 3: MMU notifier registration, with or without page faulting hardware +------------------------------------------------------------------------- +Device drivers can pin pages via get_user_pages*(), and register for mmu +notifier callbacks for the memory range. Then, upon receiving a notifier +"invalidate range" callback , stop the device from using the range, and unpin +the pages. There may be other possible schemes, such as for example explicitly +synchronizing against pending IO, that accomplish approximately the same thing. -Therefore, neither flag needs to be set. +Or, if the hardware supports replayable page faults, then the device driver can +avoid pinning entirely (this is ideal), as follows: register for mmu notifier +callbacks as above, but instead of stopping the device and unpinning in the +callback, simply remove the range from the device's page tables. -In this case, ideally, neither get_user_pages() nor pin_user_pages() should be -called. Instead, the software should be written so that it does not pin pages. -This allows mm and filesystems to operate more efficiently and reliably. +Either way, as long as the driver unpins the pages upon mmu notifier callback, +then there is proper synchronization with both filesystem and mm +(page_mkclean(), munmap(), etc). Therefore, neither flag needs to be set. CASE 4: Pinning for struct page manipulation only ------------------------------------------------- -Here, normal GUP calls are sufficient, so neither flag needs to be set. +If only struct page data (as opposed to the actual memory contents that a page +is tracking) is affected, then normal GUP calls are sufficient, and neither flag +needs to be set. page_maybe_dma_pinned(): the whole point of pinning ===================================================
_
Andrew Morton
maintainerPATCH 18/54 mm/gup: introduce pin_user_pages_locked()
In reply to a message not in the archiveFrom: John Hubbard <[email protected]>
Subject: mm/gup: introduce pin_user_pages_locked()
Patch series "mm/gup: introduce pin_user_pages_locked(), use it in frame_vector.c", v2.
This adds yet one more pin_user_pages*() variant, and uses that to convert mm/frame_vector.c.
With this, along with maybe 20 or 30 other recent patches in various trees, we are close to having the relevant gup call sites converted--with the notable exception of the bio/block layer.
This patch (of 2):
Introduce pin_user_pages_locked(), which is nearly identical to get_user_pages_locked() except that it sets FOLL_PIN and rejects FOLL_GET.
As with other pairs of get_user_pages*() and pin_user_pages() API calls, it's prudent to assert that FOLL_PIN is *not* set in the get_user_pages*() call, so add that as part of this.
---
include/linux/mm.h | 2 ++ mm/gup.c | 36 ++++++++++++++++++++++++++++++++++++ 2 files changed, 38 insertions(+)
include/linux/mm.h renamed from include/linux/mm.h~mm-gup-introduce-pin_user_pages_locked +2 -0
@@ -1706,6 +1706,8 @@ long pin_user_pages(unsigned long start, struct vm_area_struct **vmas);long get_user_pages_locked (unsigned long start,unsigned long nr_pages,unsigned int gup_flags,struct page **pages,int *locked); +long pin_user_pages_locked (unsigned long start,unsigned long nr_pages, +unsigned int gup_flags,struct page **pages,int *locked);long get_user_pages_unlocked (unsigned long start,unsigned long nr_pages,struct page **pages,unsigned int gup_flags); long pin_user_pages_unlocked(unsigned long start, unsigned long nr_pages,
mm/gup.c renamed from mm/gup.c~mm-gup-introduce-pin_user_pages_locked +36 -0
@@ -2035,6 +2035,12 @@ long get_user_pages_locked(unsigned long*/ if (WARN_ON_ONCE (gup_flags &FOLL_LONGTERM ))return -EINVAL ; +/* +* FOLL_PIN must only be set internally by the pin_user_pages*() APIs, +* never directly by the caller, so enforce that: +*/ +if (WARN_ON_ONCE (gup_flags &FOLL_PIN )) +return -EINVAL ; return __get_user_pages_locked(current, current->mm, start, nr_pages, pages, NULL, locked,
@@ -3058,3 +3064,33 @@ long pin_user_pages_unlocked(unsigned loreturn get_user_pages_unlocked (start, nr_pages, pages, gup_flags); }EXPORT_SYMBOL (pin_user_pages_unlocked); + +/* +* pin_user_pages_locked() is the FOLL_PIN variant of get_user_pages_locked(). +* Behavior is the same, except that this one sets FOLL_PIN and rejects +* FOLL_GET. +*/ +long pin_user_pages_locked (unsigned long start,unsigned long nr_pages, +unsigned int gup_flags,struct page **pages, +int *locked) +{ +/* +* FIXME: Current FOLL_LONGTERM behavior is incompatible with +* FAULT_FLAG_ALLOW_RETRY because of the FS DAX check requirement on +* vmas. As there are no users of this flag in this call we simply +* disallow this option for now. +*/ +if (WARN_ON_ONCE (gup_flags &FOLL_LONGTERM )) +return -EINVAL ; + +/* FOLL_GET and FOLL_PIN are mutually exclusive. */ +if (WARN_ON_ONCE (gup_flags &FOLL_GET )) +return -EINVAL ; + + gup_flags |=FOLL_PIN ; +return __get_user_pages_locked (current, current->mm, start, nr_pages, + pages,NULL , locked, + gup_flags |FOLL_TOUCH ); +} +EXPORT_SYMBOL (pin_user_pages_locked); +
_
Andrew Morton
maintainerPATCH 19/54 mm/gup: frame_vector: convert get_user_pages() --> pin_user_pages()
In reply to a message not in the archiveFrom: John Hubbard <[email protected]>
Subject: mm/gup: frame_vector: convert get_user_pages() --> pin_user_pages()
This code was using get_user_pages*(), and all of the callers so far were in a "Case 2" scenario (DMA/RDMA), using the categorization from [1]. That means that it's time to convert the get_user_pages*() + put_page() calls to pin_user_pages*() + unpin_user_pages() calls.
There is some helpful background in [2]: basically, this is a small part of fixing a long-standing disconnect between pinning pages, and file systems' use of those pages.
[1] Documentation/core-api/pin_user_pages.rst
[2] "Explicit pinning of user-space pages":
https://lwn.net/Articles/807108/
---
mm/frame_vector.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-)
mm/frame_vector.c renamed from mm/frame_vector.c~mm-gup-frame_vector-convert-get_user_pages-pin_user_pages +3 -4
@@ -72,7 +72,7 @@ int get_vaddr_frames(unsigned long startif (!(vma->vm_flags & (VM_IO |VM_PFNMAP ))) { vec->got_ref = true; vec->is_pfns = false; - ret =get_user_pages_locked (start, nr_frames, + ret =pin_user_pages_locked (start, nr_frames, gup_flags, (struct page **)(vec->ptrs), &locked); goto out; }
@@ -122,7 +122,6 @@ EXPORT_SYMBOL(get_vaddr_frames);*/ void put_vaddr_frames (struct frame_vector *vec) { -int i;struct page **pages;if (!vec->got_ref)
@@ -135,8 +134,8 @@ void put_vaddr_frames(struct frame_vecto*/ if (WARN_ON (IS_ERR (pages))) goto out; -for (i =0 ; i < vec->nr_frames; i++) -put_page (pages[i]); + +unpin_user_pages (pages, vec->nr_frames); vec->got_ref = false; out: vec->nr_frames =0 ;
_
Andrew Morton
maintainerPATCH 20/54 mm/gup: documentation fix for pin_user_pages*() APIs
In reply to a message not in the archiveFrom: John Hubbard <[email protected]>
Subject: mm/gup: documentation fix for pin_user_pages*() APIs
All of the pin_user_pages*() API calls will cause pages to be dma-pinned. As such, they are all suitable for either DMA, RDMA, and/or Direct IO. The documentation should say so, but it was instead saying that three of the API calls were only suitable for Direct IO. This was discovered when a reviewer wondered why an API call that specifically recommended against Case 2 (DMA/RDMA) was being used in a DMA situation [1].
Fix this by simply deleting those claims. The gup.c comments already refer to the more extensive Documentation/core-api/pin_user_pages.rst, which does have the correct guidance. So let's just write it once, there.
[1] https://lore.kernel.org/r/20200529074658.GM30374@kadam
---
mm/gup.c | 9 --------- 1 file changed, 9 deletions(-)
mm/gup.c renamed from mm/gup.c~mm-gup-documentation-fix-for-pin_user_pages-apis +0 -9
@@ -2918,9 +2918,6 @@ EXPORT_SYMBOL_GPL(get_user_pages_fast);* * FOLL_PIN means that the pages must be released via unpin_user_page(). Please * see Documentation/core-api/pin_user_pages.rst for further details. -* -* This is intended for Case 1 (DIO) in Documentation/core-api/pin_user_pages.rst. It -* is NOT intended for Case 2 (RDMA: long-term pins). */ int pin_user_pages_fast (unsigned long start,int nr_pages,unsigned int gup_flags,struct page **pages)
@@ -2994,9 +2991,6 @@ EXPORT_SYMBOL_GPL(pin_user_pages_fast_on* * FOLL_PIN means that the pages must be released via unpin_user_page(). Please * see Documentation/core-api/pin_user_pages.rst for details. -* -* This is intended for Case 1 (DIO) in Documentation/core-api/pin_user_pages.rst. It -* is NOT intended for Case 2 (RDMA: long-term pins). */ long pin_user_pages_remote(struct task_struct *tsk, struct mm_struct *mm, unsigned long start, unsigned long nr_pages,
@@ -3030,9 +3024,6 @@ EXPORT_SYMBOL(pin_user_pages_remote);* * FOLL_PIN means that the pages must be released via unpin_user_page(). Please * see Documentation/core-api/pin_user_pages.rst for details. -* -* This is intended for Case 1 (DIO) in Documentation/core-api/pin_user_pages.rst. It -* is NOT intended for Case 2 (RDMA: long-term pins). */ long pin_user_pages(unsigned long start, unsigned long nr_pages, unsigned int gup_flags, struct page **pages,
_
Andrew Morton
maintainerPATCH 21/54 docs: mm/gup: pin_user_pages.rst: add a "case 5"
In reply to a message not in the archiveFrom: John Hubbard <[email protected]>
Subject: docs: mm/gup: pin_user_pages.rst: add a "case 5"
Patch series "vhost, docs: convert to pin_user_pages(), new "case 5""
It recently became clear to me that there are some get_user_pages*() callers that don't fit neatly into any of the four cases that are so far listed in pin_user_pages.rst. vhost.c is one of those.
Add a Case 5 to the documentation, and refer to that when converting vhost.c.
Thanks to Jan Kara for helping me (again) in understanding the interaction between get_user_pages() and page writeback [1].
This is based on today's mmotm, which has a nearby patch to pin_user_pages.rst that rewords cases 3 and 4.
Note that I have only compile-tested the vhost.c patch, although that does also include cross-compiling for a few other arches. Any run-time testing would be greatly appreciated.
[1] https://lore.kernel.org/r/[email protected]
This patch (of 2):
There are four cases listed in pin_user_pages.rst. These are intended to help developers figure out whether to use get_user_pages*(), or pin_user_pages*(). However, the four cases do not cover all the situations. For example, drivers/vhost/vhost.c has a "pin, write to page, set page dirty, unpin" case.
Add a fifth case, to help explain that there is a general pattern that requires pin_user_pages*() API calls.
---
Documentation/core-api/pin_user_pages.rst | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+)
Documentation/core-api/pin_user_pages.rst renamed from Documentation/core-api/pin_user_pages.rst~docs-mm-gup-pin_user_pagesrst-add-a-case-5 +18 -0
@@ -171,6 +171,24 @@ If only struct page data (as opposed to is tracking) is affected, then normal GUP calls are sufficient, and neither flag needs to be set. +CASE 5: Pinning in order to write to the data within the page +------------------------------------------------------------- +Even though neither DMA nor Direct IO is involved, just a simple case of "pin, +write to a page's data, unpin" can cause a problem. Case 5 may be considered a +superset of Case 1, plus Case 2, plus anything that invokes that pattern. In +other words, if the code is neither Case 1 nor Case 2, it may still require +FOLL_PIN, for patterns like this: + +Correct (uses FOLL_PIN calls): + pin_user_pages() + write to the data within the pages + unpin_user_pages() + +INCORRECT (uses FOLL_GET calls): + get_user_pages() + write to the data within the pages + put_page() + page_maybe_dma_pinned(): the whole point of pinning ===================================================
_
Andrew Morton
maintainerPATCH 22/54 vhost: convert get_user_pages() --> pin_user_pages()
In reply to a message not in the archiveFrom: John Hubbard <[email protected]>
Subject: vhost: convert get_user_pages() --> pin_user_pages()
This code was using get_user_pages*(), in approximately a "Case 5" scenario (accessing the data within a page), using the categorization from [1]. That means that it's time to convert the get_user_pages*() + put_page() calls to pin_user_pages*() + unpin_user_pages() calls.
There is some helpful background in [2]: basically, this is a small part of fixing a long-standing disconnect between pinning pages, and file systems' use of those pages.
[1] Documentation/core-api/pin_user_pages.rst
[2] "Explicit pinning of user-space pages":
https://lwn.net/Articles/807108/
---
drivers/vhost/vhost.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-)
drivers/vhost/vhost.c renamed from drivers/vhost/vhost.c~vhost-convert-get_user_pages-pin_user_pages +2 -3
@@ -1762,15 +1762,14 @@ static int set_bit_to_user(int nr, voidint bit = nr + (log %PAGE_SIZE ) *8 ;int r; - r =get_user_pages_fast (log,1 ,FOLL_WRITE , &page); + r =pin_user_pages_fast (log,1 ,FOLL_WRITE , &page);if (r <0 )return r;BUG_ON (r !=1 ); base =kmap_atomic (page);set_bit (bit, base);kunmap_atomic (base); -set_page_dirty_lock (page); -put_page (page); +unpin_user_pages_dirty_lock (&page,1 , true);return 0 ; }
_
Andrew Morton
maintainerPATCH 23/54 mm/mmap.c: add more sanity checks to get_unmapped_area()
In reply to a message not in the archiveFrom: Alexander Gordeev <[email protected]>
Subject: mm/mmap.c: add more sanity checks to get_unmapped_area()
Generic get_unmapped_area() function does sanity checks of address and length of the area to be mapped. Yet, it lacks checking against mmap_min_addr and mmap_end limits.
At the same time the default implementation of functions arch_get_unmapped_area[_topdown]() and some architecture callbacks do mmap_min_addr and mmap_end checks on their own.
Put additional checks into the generic code and do not let architecture callbacks to get away with a possible area outside of the allowed limits.
That could also relieve arch_get_unmapped_area[_topdown]() callbacks of own address and length sanity checks.
---
mm/mmap.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
mm/mmap.c renamed from mm/mmap.c~mm-mmapc-add-more-sanity-checks-to-get_unmapped_area +3 -2
@@ -2193,12 +2193,13 @@ get_unmapped_area(struct file *file, unsunsigned long (*get_area)(struct file *,unsigned long ,unsigned long ,unsigned long ,unsigned long ); +const unsigned long mmap_end =arch_get_mmap_end (addr);unsigned long error =arch_mmap_check (addr, len, flags);if (error)return error;/* Careful about overflows.. */ -if (len >TASK_SIZE ) +if (len > mmap_end - mmap_min_addr)return -ENOMEM ; get_area = current->mm->get_unmapped_area;
@@ -2219,7 +2220,7 @@ get_unmapped_area(struct file *file, unsif (IS_ERR_VALUE (addr))return addr; -if (addr >TASK_SIZE - len) +if ((addr < mmap_min_addr) || (addr > mmap_end - len))return -ENOMEM ;if (offset_in_page (addr))return -EINVAL ;
_
Andrew Morton
maintainerPATCH 24/54 mm/mmap.c: do not allow mappings outside of allowed limits
In reply to a message not in the archiveFrom: Alexander Gordeev <[email protected]>
Subject: mm/mmap.c: do not allow mappings outside of allowed limits
One can set a lowest possible address in /proc/sys/vm/mmap_min_addr and mmap below that bound nevertheless.
It is possible to request a fixed mapping address below mmap_min_addr and succeed. This update adds early checks of mmap_min_addr and mmap_end boundaries and fixes the above issue.
Apart from it is wrong I am not aware of any existing issue.
---
mm/mmap.c | 23 ++++++++++++++--------- 1 file changed, 14 insertions(+), 9 deletions(-)
mm/mmap.c renamed from mm/mmap.c~mm-mmapc-do-not-allow-mappings-outside-of-allowed-limits +14 -8
@@ -62,6 +62,14 @@#define arch_mmap_check (addr, len, flags) (0)#endif +#ifndef arch_get_mmap_end +#define arch_get_mmap_end (addr) (TASK_SIZE) +#endif + +#ifndef arch_get_mmap_base +#define arch_get_mmap_base (addr, base) (base) +#endif +#ifdef CONFIG_HAVE_ARCH_MMAP_RND_BITS const int mmap_rnd_bits_min =CONFIG_ARCH_MMAP_RND_BITS_MIN ;const int mmap_rnd_bits_max =CONFIG_ARCH_MMAP_RND_BITS_MAX ;
@@ -1369,6 +1377,7 @@ unsigned long do_mmap(struct file *file, unsigned long pgoff, unsigned long *populate, struct list_head *uf) { + const unsigned long mmap_end = arch_get_mmap_end(addr);struct mm_struct *mm = current->mm;int pkey =0 ;
@@ -1391,8 +1400,12 @@ unsigned long do_mmap(struct file *file,if (flags &MAP_FIXED_NOREPLACE ) flags |=MAP_FIXED ; -if (!(flags &MAP_FIXED )) +if (flags &MAP_FIXED ) { +if ((addr < mmap_min_addr) || (addr > mmap_end)) +return -ENOMEM ; + }else { addr =round_hint_to_min (addr); + }/* Careful about overflows.. */ len =PAGE_ALIGN (len);
@@ -2074,14 +2087,6 @@ unsigned long vm_unmapped_area(struct vmreturn addr; } -#ifndef arch_get_mmap_end -#define arch_get_mmap_end (addr) (TASK_SIZE) -#endif - -#ifndef arch_get_mmap_base -#define arch_get_mmap_base (addr, base) (base) -#endif
Re: [patch 24/54] mm/mmap.c: do not allow mappings outside of allowed limits
Quoted 3 lines · Andrew Morton
One can set a lowest possible address in
/proc/sys/vm/mmap_min_addrand mmap below that bound nevertheless.
Well, /proc/sys/vm/mmap_min_addr actually sets "dac_mmap_min_addr" directly, and then indirectly sets mmap_min_addr with slightly different rules.
Quoted 5 lines
It is possible to request a fixed mapping address below
mmap_min_addrand succeed. This update adds early checks ofmmap_min_addrandmmap_endboundaries and fixes the above issue.Apart from it is wrong I am not aware of any existing issue.
Hmm. I think your patch is generally fine, although a few things worries me:
- the "mmap_end" check seems wrong. It should be something like
if (len > mmap_end || addr > mmap_end-len)
shouldn't it?
- the limit we _do_ test is that "dac_mmap_min_addr", and we allow
lower limits for CAP_SYS_RAWIO
- I think this will break vm86 mode on 32-bit x86. Have you tested that?
In other words, I think the reason we don't do that hard check of mmap_min_addr is exactly that vm86 issue. If we were to force a hard check, we're now making it impossible to use vm86 mode.
So I'm dropping this patch, because it is not clear that this was fully thought through.
And if it *was* intentional, and people knew about the vm86 issues, and the thing about dac_mmap_min_addr and the check in cap_mmap_addr(), then it should be mentioned in the commit message.
That said, I'd be more than willing to move the "cap_mmap_addr()" check into the mm layer and make it a whole lot more obvious.
And I'd also be more than willing to really make the difference between "dac_mmap_min_addr" and "mmap_min_addr" actually meaningful, and really enforce "mmap_min_addr", because right now it's a half-baked feature that isn't actually used for anything but hinting and the grow-down issue.
And that, in turn, is because of those vm86 issues, but also because we've historically had programs that wanted some legacy behavior and did a mmap() of a zero-page at the 0 address (because that's how some old Unix environments worked - I htink legacy parisc or similar).
Linus
Re: [patch 24/54] mm/mmap.c: do not allow mappings outside of allowed limits
Quoted 3 lines · Linus Torvalds
So I'm dropping this patch, because it is not clear that this was fully thought through.
Side note: I'm also dropping 23/54, just because they go together, and because of how mmap_min_addr really isn't a hard limit (as things stand today). The logic in 23/54 fundamentally has that "it's a hard limit" issue.
Linus
Andrew Morton
maintainerPATCH 25/54 arm: fix the flush_icache_range arguments in set_fiq_handler
In reply to a message not in the archiveFrom: Christoph Hellwig <[email protected]>
Subject: arm: fix the flush_icache_range arguments in set_fiq_handler
Patch series "sort out the flush_icache_range mess", v2.
flush_icache_range is mostly used for kernel address, except for the following cases:
- the nommu brk and mmap implementations,
- the read_code helper that is only used for binfmt_flat, binfmt_elf_fdpic, and binfmt_aout including the broken ia32 compat version
- binfmt_flat itself,
none of which really are used by a typical MMU enabled kernel, as a.out can only be build for alpha and m68k to start with.
But strangely enough commit ae92ef8a4424 ("PATCH] flush icache in correct context") added a "set_fs(KERNEL_DS)" around the flush_icache_range call in the module loader, because apparently m68k assumed user pointers.
This series first cleans up the cacheflush implementations, largely by switching as much as possible to the asm-generic version after a few preparations, then moves the misnamed current flush_icache_user_range to a new name, to finally introduce a real flush_icache_user_range to be used for the above use cases to flush the instruction cache for a userspace address range. The last patch then drops the set_fs in the module code and moves it into the m68k implementation.
This patch (of 29):
The arguments passed look bogus, try to fix them to something that seems to make sense.
---
arch/arm/kernel/fiq.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
arch/arm/kernel/fiq.c renamed from arch/arm/kernel/fiq.c~arm-fix-the-flush_icache_range-arguments-in-set_fiq_handler +2 -2
@@ -98,8 +98,8 @@ void set_fiq_handler(void *start, unsignmemcpy (base + offset, start, length);if (!cache_is_vipt_nonaliasing ()) -flush_icache_range ((unsigned long )base + offset, offset + - length); +flush_icache_range ((unsigned long )base + offset, + (unsigned long )base + offset + length);flush_icache_range (0xffff0000 + offset,0xffff0000 + offset + length); }
_
Andrew Morton
maintainerPATCH 26/54 nds32: unexport flush_icache_page
In reply to a message not in the archiveFrom: Christoph Hellwig <[email protected]>
Subject: nds32: unexport flush_icache_page
flush_icache_page is only used by mm/memory.c.
---
arch/nds32/mm/cacheflush.c | 1 - 1 file changed, 1 deletion(-)
arch/nds32/mm/cacheflush.c renamed from arch/nds32/mm/cacheflush.c~nds32-unexport-flush_icache_page +0 -1
@@ -35,7 +35,6 @@ void flush_icache_page(struct vm_area_stkunmap_atomic ((void *)kaddr);local_irq_restore (flags); } -EXPORT_SYMBOL (flush_icache_page);void flush_icache_user_range (struct vm_area_struct *vma,struct page *page,unsigned long addr,int len)
_
Andrew Morton
maintainerPATCH 27/54 powerpc: unexport flush_icache_user_range
In reply to a message not in the archiveFrom: Christoph Hellwig <[email protected]>
Subject: powerpc: unexport flush_icache_user_range
flush_icache_user_range is only used by copy_to_user_page, which is only used by core VM code.
---
arch/powerpc/mm/mem.c | 1 - 1 file changed, 1 deletion(-)
arch/powerpc/mm/mem.c renamed from arch/powerpc/mm/mem.c~powerpc-unexport-flush_icache_user_range +0 -1
@@ -586,7 +586,6 @@ void flush_icache_user_range(struct vm_aflush_icache_range (maddr, maddr + len);kunmap (page); } -EXPORT_SYMBOL (flush_icache_user_range);/* * System memory should not be in /proc/iomem but various tools expect it
_
Andrew Morton
maintainerPATCH 28/54 unicore32: remove flush_cache_user_range
In reply to a message not in the archiveFrom: Christoph Hellwig <[email protected]>
Subject: unicore32: remove flush_cache_user_range
flush_cache_user_range is an ARMism not used by any generic or unicore32 specific code.
---
arch/unicore32/include/asm/cacheflush.h | 8 -------- 1 file changed, 8 deletions(-)
arch/unicore32/include/asm/cacheflush.h renamed from arch/unicore32/include/asm/cacheflush.h~unicore32-remove-flush_cache_user_range +0 -6
@@ -133,14 +133,6 @@ extern void flush_cache_page(struct vm_a#define flush_cache_dup_mm (mm) flush_cache_mm(mm)/* -* flush_cache_user_range is used when we want to ensure that the -* Harvard caches are synchronised for the user space address range. -* This is used for the UniCore private sys_cacheflush system call. -*/ -#define flush_cache_user_range (vma, start, end) \ - __cpuc_coherent_user_range((start) & PAGE_MASK, PAGE_ALIGN(end))
Andrew Morton
maintainerPATCH 29/54 asm-generic: fix the inclusion guards for cacheflush.h
In reply to a message not in the archiveFrom: Christoph Hellwig <[email protected]>
Subject: asm-generic: fix the inclusion guards for cacheflush.h
cacheflush.h uses a somewhat to generic include guard name that clashes with various arch files. Use a more specific one.
---
include/asm-generic/cacheflush.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
include/asm-generic/cacheflush.h renamed from include/asm-generic/cacheflush.h~asm-generic-fix-the-inclusion-guards-for-cacheflushh +3 -3
@@ -1,6 +1,6 @@/* SPDX-License-Identifier: GPL-2.0 */ -#ifndef __ASM_CACHEFLUSH_H -#define __ASM_CACHEFLUSH_H +#ifndef _ASM_GENERIC_CACHEFLUSH_H +#define _ASM_GENERIC_CACHEFLUSH_H/* Keep includes the same across arches. */ #include <linux/mm.h>
@@ -109,4 +109,4 @@ static inline void flush_cache_vunmap(un memcpy(dst, src, len)#endif -#endif /* __ASM_CACHEFLUSH_H */ +#endif /* _ASM_GENERIC_CACHEFLUSH_H */
_
Andrew Morton
maintainerPATCH 30/54 asm-generic: don't include <linux/mm.h> in cacheflush.h
In reply to a message not in the archiveFrom: Christoph Hellwig <[email protected]>
Subject: asm-generic: don't include <linux/mm.h> in cacheflush.h
This seems to lead to some crazy include loops when using asm-generic/cacheflush.h on more architectures, so leave it to the arch header for now.
---
arch/um/include/asm/tlb.h | 2 ++ arch/x86/include/asm/cacheflush.h | 2 ++ drivers/media/platform/omap3isp/ispvideo.c | 2 +- drivers/nvdimm/pmem.c | 3 ++- include/asm-generic/cacheflush.h | 3 --- 5 files changed, 7 insertions(+), 5 deletions(-)
arch/um/include/asm/tlb.h renamed from arch/um/include/asm/tlb.h~asm-generic-dont-include-linux-mmh-in-cacheflushh +2 -0
@@ -2,6 +2,8 @@#ifndef __UM_TLB_H#define __UM_TLB_H +#include <linux/mm.h> +#include <asm/tlbflush.h> #include <asm-generic/cacheflush.h> #include <asm-generic/tlb.h>
arch/x86/include/asm/cacheflush.h renamed from arch/x86/include/asm/cacheflush.h~asm-generic-dont-include-linux-mmh-in-cacheflushh +2 -0
@@ -2,6 +2,8 @@#ifndef _ASM_X86_CACHEFLUSH_H#define _ASM_X86_CACHEFLUSH_H +#include <linux/mm.h> +/* Caches aren't brain-dead on the intel. */ #include <asm-generic/cacheflush.h> #include <asm/special_insns.h>
drivers/media/platform/omap3isp/ispvideo.c renamed from drivers/media/platform/omap3isp/ispvideo.c~asm-generic-dont-include-linux-mmh-in-cacheflushh +1 -1
@@ -10,7 +10,6 @@* Sakari Ailus <[email protected]> */ -#include <asm/cacheflush.h> #include <linux/clk.h> #include <linux/mm.h> #include <linux/module.h>
@@ -19,6 +18,7 @@#include <linux/sched.h> #include <linux/slab.h> #include <linux/vmalloc.h> +#include <asm/cacheflush.h> #include <media/v4l2-dev.h> #include <media/v4l2-ioctl.h>
drivers/nvdimm/pmem.c renamed from drivers/nvdimm/pmem.c~asm-generic-dont-include-linux-mmh-in-cacheflushh +2 -1
@@ -7,7 +7,6 @@* Copyright (c) 2015, Boaz Harrosh <[email protected]>. */ -#include <asm/cacheflush.h> #include <linux/blkdev.h> #include <linux/hdreg.h> #include <linux/init.h>
@@ -25,6 +24,8 @@#include <linux/dax.h> #include <linux/nd.h> #include <linux/backing-dev.h> +#include <linux/mm.h> +#include <asm/cacheflush.h> #include "pmem.h" #include "pfn.h" #include "nd.h"
include/asm-generic/cacheflush.h renamed from include/asm-generic/cacheflush.h~asm-generic-dont-include-linux-mmh-in-cacheflushh +0 -2
@@ -2,9 +2,6 @@#ifndef _ASM_GENERIC_CACHEFLUSH_H#define _ASM_GENERIC_CACHEFLUSH_H -/* Keep includes the same across arches. */ -#include <linux/mm.h>
Andrew Morton
maintainerPATCH 31/54 asm-generic: improve the flush_dcache_page stub
In reply to a message not in the archiveFrom: Christoph Hellwig <[email protected]>
Subject: asm-generic: improve the flush_dcache_page stub
There is a magic ARCH_IMPLEMENTS_FLUSH_DCACHE_PAGE cpp symbol that guards non-stub availability of flush_dcache_pagge. Use that to check if flush_dcache_pagg is implemented.
---
include/asm-generic/cacheflush.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
include/asm-generic/cacheflush.h renamed from include/asm-generic/cacheflush.h~asm-generic-improve-the-flush_dcache_page-stub +0 -1
@@ -2,8 +2,6 @@#ifndef _ASM_GENERIC_CACHEFLUSH_H#define _ASM_GENERIC_CACHEFLUSH_H -#define ARCH_IMPLEMENTS_FLUSH_DCACHE_PAGE 0
Andrew Morton
maintainerPATCH 32/54 alpha: use asm-generic/cacheflush.h
In reply to a message not in the archiveFrom: Christoph Hellwig <[email protected]>
Subject: alpha: use asm-generic/cacheflush.h
Alpha needs almost no cache flushing routines of its own. Rely on asm-generic/cacheflush.h for the defaults.
---
arch/alpha/include/asm/cacheflush.h | 28 +++++--------------------- 1 file changed, 6 insertions(+), 22 deletions(-)
arch/alpha/include/asm/cacheflush.h renamed from arch/alpha/include/asm/cacheflush.h~alpha-use-asm-generic-cacheflushh +6 -22
@@ -4,19 +4,6 @@#include <linux/mm.h> -/* Caches aren't brain-dead on the Alpha. */ -#define flush_cache_all () do { } while (0) -#define flush_cache_mm (mm) do { } while (0) -#define flush_cache_dup_mm (mm) do { } while (0) -#define flush_cache_range (vma, start, end) do { } while (0) -#define flush_cache_page (vma, vmaddr, pfn) do { } while (0) -#define ARCH_IMPLEMENTS_FLUSH_DCACHE_PAGE 0 -#define flush_dcache_page (page) do { } while (0) -#define flush_dcache_mmap_lock (mapping) do { } while (0) -#define flush_dcache_mmap_unlock (mapping) do { } while (0) -#define flush_cache_vmap (start, end) do { } while (0) -#define flush_cache_vunmap (start, end) do { } while (0) -/* Note that the following two definitions are _highly_ dependent on the contexts in which they are used in the kernel. I personally think it is criminal how loosely defined these macros are. */
@@ -59,20 +46,17 @@ flush_icache_user_range(struct vm_area_s mm->context[smp_processor_id ()] =0 ; } } -#else +#define flush_icache_user_range flush_icache_user_range +#else /* CONFIG_SMP */ extern void flush_icache_user_range (struct vm_area_struct *vma,struct page *page,unsigned long addr,int len); -#endif +#define flush_icache_user_range flush_icache_user_range +#endif /* CONFIG_SMP */ /* This is used only in __do_fault and do_swap_page. */ #define flush_icache_page (vma, page) \ - flush_icache_user_range((vma), (page), 0, 0) + flush_icache_user_range((vma), (page), 0, 0) -#define copy_to_user_page (vma, page, vaddr, dst, src, len) \ -do { memcpy(dst, src, len); \ - flush_icache_user_range(vma, page, vaddr, len); \ -} while (0) -#define copy_from_user_page (vma, page, vaddr, dst, src, len) \ - memcpy(dst, src, len) +#include <asm-generic/cacheflush.h> #endif /* _ALPHA_CACHEFLUSH_H */
_
Andrew Morton
maintainerPATCH 33/54 arm64: use asm-generic/cacheflush.h
In reply to a message not in the archiveFrom: Christoph Hellwig <[email protected]>
Subject: arm64: use asm-generic/cacheflush.h
ARM64 needs almost no cache flushing routines of its own. Rely on asm-generic/cacheflush.h for the defaults.
---
arch/arm64/include/asm/cacheflush.h | 46 ++------------------------ 1 file changed, 5 insertions(+), 41 deletions(-)
arch/arm64/include/asm/cacheflush.h renamed from arch/arm64/include/asm/cacheflush.h~arm64-use-asm-generic-cacheflushh +2 -39
@@ -94,20 +94,7 @@ static inline void flush_icache_range(unkick_all_cpus_sync (); } - -static inline void flush_cache_mm (struct mm_struct *mm) -{ -} - -static inline void flush_cache_page (struct vm_area_struct *vma, -unsigned long user_addr,unsigned long pfn) -{ -} - -static inline void flush_cache_range (struct vm_area_struct *vma, -unsigned long start,unsigned long end) -{ -} +#define flush_icache_range flush_icache_range/* * Cache maintenance functions used by the DMA API. No to be used directly.
@@ -123,12 +110,7 @@ extern void __dma_flush_area(const void*/ extern void copy_to_user_page (struct vm_area_struct *,struct page *,unsigned long ,void *,const void *,unsigned long ); -#define copy_from_user_page (vma, page, vaddr, dst, src, len) \ - do { \ - memcpy(dst, src, len); \ - } while (0) - -#define flush_cache_dup_mm (mm) flush_cache_mm(mm) +#define copy_to_user_page copy_to_user_page/* * flush_dcache_page is used when the kernel has written to the page
@@ -154,29 +136,11 @@ static __always_inline void __flush_icacdsb (ish); } -#define flush_dcache_mmap_lock (mapping) do { } while (0) -#define flush_dcache_mmap_unlock (mapping) do { } while (0) - -/* -* We don't appear to need to do anything here. In fact, if we did, we'd -* duplicate cache flushing elsewhere performed by flush_dcache_page(). -*/ -#define flush_icache_page (vma,page) do { } while (0) - -/* -* Not required on AArch64 (PIPT or VIPT non-aliasing D-cache). -*/ -static inline void flush_cache_vmap (unsigned long start,unsigned long end) -{ -} - -static inline void flush_cache_vunmap (unsigned long start,unsigned long end) -{ -}
Andrew Morton
maintainerPATCH 34/54 c6x: use asm-generic/cacheflush.h
In reply to a message not in the archiveFrom: Christoph Hellwig <[email protected]>
Subject: c6x: use asm-generic/cacheflush.h
C6x needs almost no cache flushing routines of its own. Rely on asm-generic/cacheflush.h for the defaults.
---
arch/c6x/include/asm/cacheflush.h | 19 +------------------ 1 file changed, 1 insertion(+), 18 deletions(-)
arch/c6x/include/asm/cacheflush.h renamed from arch/c6x/include/asm/cacheflush.h~c6x-use-asm-generic-cacheflushh +0 -15
@@ -17,21 +17,6 @@#include <asm/string.h> /* -* virtually-indexed cache management (our cache is physically indexed) -*/ -#define flush_cache_all () do {} while (0) -#define flush_cache_mm (mm) do {} while (0) -#define flush_cache_dup_mm (mm) do {} while (0) -#define flush_cache_range (mm, start, end) do {} while (0) -#define flush_cache_page (vma, vmaddr, pfn) do {} while (0) -#define flush_cache_vmap (start, end) do {} while (0) -#define flush_cache_vunmap (start, end) do {} while (0) -#define ARCH_IMPLEMENTS_FLUSH_DCACHE_PAGE 0 -#define flush_dcache_page (page) do {} while (0) -#define flush_dcache_mmap_lock (mapping) do {} while (0) -#define flush_dcache_mmap_unlock (mapping) do {} while (0) - -/* * physically-indexed cache management */ #define flush_icache_range (s, e) \
@@ -49,14 +34,12 @@ do { \ (unsigned long) page_address(page) + PAGE_SIZE)); \ }while (0 )
Andrew Morton
maintainerPATCH 35/54 hexagon: use asm-generic/cacheflush.h
In reply to a message not in the archiveFrom: Christoph Hellwig <[email protected]>
Subject: hexagon: use asm-generic/cacheflush.h
Hexagon needs almost no cache flushing routines of its own. Rely on asm-generic/cacheflush.h for the defaults.
---
arch/hexagon/include/asm/cacheflush.h | 19 +++++-------------- 1 file changed, 5 insertions(+), 14 deletions(-)
arch/hexagon/include/asm/cacheflush.h renamed from arch/hexagon/include/asm/cacheflush.h~hexagon-use-asm-generic-cacheflushh +5 -14
@@ -25,29 +25,17 @@#define LINESIZE 32#define LINEBITS 5 -#define flush_cache_all () do { } while (0) -#define flush_cache_mm (mm) do { } while (0) -#define flush_cache_dup_mm (mm) do { } while (0) -#define flush_cache_range (vma, start, end) do { } while (0) -#define flush_cache_page (vma, vmaddr, pfn) do { } while (0) -#define ARCH_IMPLEMENTS_FLUSH_DCACHE_PAGE 0 -#define flush_dcache_page (page) do { } while (0) -#define flush_dcache_mmap_lock (mapping) do { } while (0) -#define flush_dcache_mmap_unlock (mapping) do { } while (0) -#define flush_icache_page (vma, pg) do { } while (0) -#define flush_icache_user_range (vma, pg, adr, len) do { } while (0) -#define flush_cache_vmap (start, end) do { } while (0) -#define flush_cache_vunmap (start, end) do { } while (0) -/* * Flush Dcache range through current map. */ extern void flush_dcache_range (unsigned long start,unsigned long end); +#define flush_dcache_range flush_dcache_range/* * Flush Icache range through current map. */ extern void flush_icache_range (unsigned long start,unsigned long end); +#define flush_icache_range flush_icache_range/* * Memory-management related flushes are there to ensure in non-physically
@@ -78,6 +66,7 @@ static inline void update_mmu_cache(struvoid copy_to_user_page (struct vm_area_struct *vma,struct page *page,unsigned long vaddr,void *dst,void *src,int len); +#define copy_to_user_page copy_to_user_page#define copy_from_user_page (vma, page, vaddr, dst, src, len) \ memcpy(dst, src, len)
@@ -85,4 +74,6 @@ void copy_to_user_page(struct vm_area_stextern void hexagon_inv_dcache_range (unsigned long start,unsigned long end);extern void hexagon_clean_dcache_range (unsigned long start,unsigned long end); +#include <asm-generic/cacheflush.h> +#endif
_
Andrew Morton
maintainerPATCH 36/54 ia64: use asm-generic/cacheflush.h
In reply to a message not in the archiveFrom: Christoph Hellwig <[email protected]>
Subject: ia64: use asm-generic/cacheflush.h
IA64 needs almost no cache flushing routines of its own. Rely on asm-generic/cacheflush.h for the defaults.
---
arch/ia64/include/asm/cacheflush.h | 28 ++------------------------- 1 file changed, 3 insertions(+), 25 deletions(-)
arch/ia64/include/asm/cacheflush.h renamed from arch/ia64/include/asm/cacheflush.h~ia64-use-asm-generic-cacheflushh +2 -18
@@ -12,44 +12,22 @@#include <asm/page.h> -/* -* Cache flushing routines. This is the kind of stuff that can be very expensive, so try -* to avoid them whenever possible. -*/ - -#define flush_cache_all () do { } while (0) -#define flush_cache_mm (mm) do { } while (0) -#define flush_cache_dup_mm (mm) do { } while (0) -#define flush_cache_range (vma, start, end) do { } while (0) -#define flush_cache_page (vma, vmaddr, pfn) do { } while (0) -#define flush_icache_page (vma,page) do { } while (0) -#define flush_cache_vmap (start, end) do { } while (0) -#define flush_cache_vunmap (start, end) do { } while (0) -#define ARCH_IMPLEMENTS_FLUSH_DCACHE_PAGE 1#define flush_dcache_page (page) \ do { \ clear_bit(PG_arch_1, &(page)->flags); \ } while (0) -#define flush_dcache_mmap_lock (mapping) do { } while (0) -#define flush_dcache_mmap_unlock (mapping) do { } while (0) - -extern void flush_icache_range (unsigned long start,unsigned long end); +extern void flush_icache_range (unsigned long start,unsigned long end); +#define flush_icache_range flush_icache_rangeextern void clflush_cache_range (void *addr,int size);
Andrew Morton
maintainerPATCH 37/54 microblaze: use asm-generic/cacheflush.h
In reply to a message not in the archiveFrom: Christoph Hellwig <[email protected]>
Subject: microblaze: use asm-generic/cacheflush.h
Microblaze needs almost no cache flushing routines of its own. Rely on asm-generic/cacheflush.h for the defaults.
---
arch/microblaze/include/asm/cacheflush.h | 29 +-------------------- 1 file changed, 2 insertions(+), 27 deletions(-)
arch/microblaze/include/asm/cacheflush.h renamed from arch/microblaze/include/asm/cacheflush.h~microblaze-use-asm-generic-cacheflushh +0 -20
@@ -57,9 +57,6 @@ void microblaze_cache_init(void);#define invalidate_icache () mbc->iin();#define invalidate_icache_range (start, end) mbc->iinr(start, end); -#define flush_icache_user_range (vma, pg, adr, len) flush_icache(); -#define flush_icache_page (vma, pg) do { } while (0) -#define enable_dcache () mbc->de();#define disable_dcache () mbc->dd();/* FIXME for LL-temac driver */
@@ -77,27 +74,9 @@ do { \flush_dcache_range ((unsigned ) (addr), (unsigned ) (addr) +PAGE_SIZE ); \ }while (0 ); -#define flush_dcache_mmap_lock (mapping) do { } while (0) -#define flush_dcache_mmap_unlock (mapping) do { } while (0) - -#define flush_cache_dup_mm (mm) do { } while (0) -#define flush_cache_vmap (start, end) do { } while (0) -#define flush_cache_vunmap (start, end) do { } while (0) -#define flush_cache_mm (mm) do { } while (0) -#define flush_cache_page (vma, vmaddr, pfn) \ flush_dcache_range(pfn << PAGE_SHIFT, (pfn << PAGE_SHIFT) + PAGE_SIZE); -/* MS: kgdb code use this macro, wrong len with FLASH */ -#if 0 -#define flush_cache_range (vma, start, len) { \ - flush_icache_range((unsigned) (start), (unsigned) (start) + (len)); \ - flush_dcache_range((unsigned) (start), (unsigned) (start) + (len)); \ -} -#endif - -#define flush_cache_range (vma, start, len) do { } while (0)
Andrew Morton
maintainerPATCH 38/54 m68knommu: use asm-generic/cacheflush.h
In reply to a message not in the archiveFrom: Christoph Hellwig <[email protected]>
Subject: m68knommu: use asm-generic/cacheflush.h
m68knommu needs almost no cache flushing routines of its own. Rely on asm-generic/cacheflush.h for the defaults.
---
arch/m68k/include/asm/cacheflush_no.h | 19 ++----------------- 1 file changed, 2 insertions(+), 17 deletions(-)
arch/m68k/include/asm/cacheflush_no.h renamed from arch/m68k/include/asm/cacheflush_no.h~m68knommu-use-asm-generic-cacheflushh +0 -12
@@ -9,25 +9,8 @@#include <asm/mcfsim.h> #define flush_cache_all () __flush_cache_all() -#define flush_cache_mm (mm) do { } while (0) -#define flush_cache_dup_mm (mm) do { } while (0) -#define flush_cache_range (vma, start, end) do { } while (0) -#define flush_cache_page (vma, vmaddr) do { } while (0)#define flush_dcache_range (start, len) __flush_dcache_all() -#define ARCH_IMPLEMENTS_FLUSH_DCACHE_PAGE 0 -#define flush_dcache_page (page) do { } while (0) -#define flush_dcache_mmap_lock (mapping) do { } while (0) -#define flush_dcache_mmap_unlock (mapping) do { } while (0)#define flush_icache_range (start, len) __flush_icache_all() -#define flush_icache_page (vma,pg) do { } while (0) -#define flush_icache_user_range (vma,pg,adr,len) do { } while (0) -#define flush_cache_vmap (start, end) do { } while (0) -#define flush_cache_vunmap (start, end) do { } while (0)
Andrew Morton
maintainerPATCH 39/54 openrisc: use asm-generic/cacheflush.h
In reply to a message not in the archiveFrom: Christoph Hellwig <[email protected]>
Subject: openrisc: use asm-generic/cacheflush.h
OpenRISC needs almost no cache flushing routines of its own. Rely on asm-generic/cacheflush.h for the defaults.
---
arch/openrisc/include/asm/cacheflush.h | 31 ++++------------------- 1 file changed, 6 insertions(+), 25 deletions(-)
arch/openrisc/include/asm/cacheflush.h renamed from arch/openrisc/include/asm/cacheflush.h~openrisc-use-asm-generic-cacheflushh +5 -22
@@ -62,31 +62,12 @@ static inline void flush_dcache_page(strclear_bit (PG_dc_clean, &page->flags); } -/* -* Other interfaces are not required since we do not have virtually -* indexed or tagged caches. So we can use the default here. -*/ -#define flush_cache_all () do { } while (0) -#define flush_cache_mm (mm) do { } while (0) -#define flush_cache_dup_mm (mm) do { } while (0) -#define flush_cache_range (vma, start, end) do { } while (0) -#define flush_cache_page (vma, vmaddr, pfn) do { } while (0) -#define flush_dcache_mmap_lock (mapping) do { } while (0) -#define flush_dcache_mmap_unlock (mapping) do { } while (0) -#define flush_icache_range (start, end) do { } while (0) -#define flush_icache_page (vma, pg) do { } while (0) -#define flush_icache_user_range (vma, pg, adr, len) do { } while (0) -#define flush_cache_vmap (start, end) do { } while (0) -#define flush_cache_vunmap (start, end) do { } while (0) +#define flush_icache_user_range (vma, page, addr, len) \ +do { \ + if (vma->vm_flags & VM_EXEC) \ + sync_icache_dcache(page); \ +} while (0) -#define copy_to_user_page (vma, page, vaddr, dst, src, len) \ - do { \ - memcpy(dst, src, len); \ - if (vma->vm_flags & VM_EXEC) \ - sync_icache_dcache(page); \ - } while (0)
Andrew Morton
maintainerPATCH 40/54 powerpc: use asm-generic/cacheflush.h
In reply to a message not in the archiveFrom: Christoph Hellwig <[email protected]>
Subject: powerpc: use asm-generic/cacheflush.h
Power needs almost no cache flushing routines of its own. Rely on asm-generic/cacheflush.h for the defaults.
Also remove the pointless __KERNEL__ ifdef while we're at it.
---
arch/powerpc/include/asm/cacheflush.h | 42 +++++------------------- 1 file changed, 10 insertions(+), 32 deletions(-)
arch/powerpc/include/asm/cacheflush.h renamed from arch/powerpc/include/asm/cacheflush.h~powerpc-use-asm-generic-cacheflushh +9 -30
@@ -4,23 +4,9 @@#ifndef _ASM_POWERPC_CACHEFLUSH_H#define _ASM_POWERPC_CACHEFLUSH_H -#ifdef __KERNEL__ -#include <linux/mm.h> #include <asm/cputable.h> -/* -* No cache flushing is required when address mappings are changed, -* because the caches on PowerPCs are physically addressed. -*/ -#define flush_cache_all () do { } while (0) -#define flush_cache_mm (mm) do { } while (0) -#define flush_cache_dup_mm (mm) do { } while (0) -#define flush_cache_range (vma, start, end) do { } while (0) -#define flush_cache_page (vma, vmaddr, pfn) do { } while (0) -#define flush_icache_page (vma, page) do { } while (0) -#define flush_cache_vunmap (start, end) do { } while (0) -#ifdef CONFIG_PPC_BOOK3S_64 /* * Book3s has no ptesync after setting a pte, so without this ptesync it's
@@ -33,20 +19,20 @@ static inline void flush_cache_vmap(unsi { asmvolatile ("ptesync" :::"memory" ); } -#else -static inline void flush_cache_vmap (unsigned long start,unsigned long end) { } -#endif +#define flush_cache_vmap flush_cache_vmap +#endif /* CONFIG_PPC_BOOK3S_64 */ #define ARCH_IMPLEMENTS_FLUSH_DCACHE_PAGE 1extern void flush_dcache_page (struct page *page); -#define flush_dcache_mmap_lock (mapping) do { } while (0) -#define flush_dcache_mmap_unlock (mapping) do { } while (0)void flush_icache_range (unsigned long start,unsigned long stop); -extern void flush_icache_user_range (struct vm_area_struct *vma, -struct page *page,unsigned long addr, -int len); -extern void flush_dcache_icache_page (struct page *page); +#define flush_icache_range flush_icache_range + +void flush_icache_user_range (struct vm_area_struct *vma,struct page *page, +unsigned long addr,int len); +#define flush_icache_user_range flush_icache_user_range + +void flush_dcache_icache_page (struct page *page);void __flush_dcache_icache (void *page);/**
@@ -111,14 +97,6 @@ static inline void invalidate_dcache_ranmb ();/* sync */ } -#define copy_to_user_page (vma, page, vaddr, dst, src, len) \ - do { \ - memcpy(dst, src, len); \ - flush_icache_user_range(vma, page, vaddr, len); \ - } while (0) -#define copy_from_user_page (vma, page, vaddr, dst, src, len) \ - memcpy(dst, src, len)
Andrew Morton
maintainerPATCH 41/54 riscv: use asm-generic/cacheflush.h
In reply to a message not in the archiveFrom: Christoph Hellwig <[email protected]>
Subject: riscv: use asm-generic/cacheflush.h
RISC-V needs almost no cache flushing routines of its own. Rely on asm-generic/cacheflush.h for the defaults.
Also remove the pointless __KERNEL__ ifdef while we're at it.
---
arch/riscv/include/asm/cacheflush.h | 62 +------------------------- 1 file changed, 3 insertions(+), 59 deletions(-)
arch/riscv/include/asm/cacheflush.h renamed from arch/riscv/include/asm/cacheflush.h~riscv-use-asm-generic-cacheflushh +0 -58
@@ -8,65 +8,6 @@#include <linux/mm.h> -#define ARCH_IMPLEMENTS_FLUSH_DCACHE_PAGE 0 - -/* -* The cache doesn't need to be flushed when TLB entries change when -* the cache is mapped to physical memory, not virtual memory -*/ -static inline void flush_cache_all (void ) -{ -} - -static inline void flush_cache_mm (struct mm_struct *mm) -{ -} - -static inline void flush_cache_dup_mm (struct mm_struct *mm) -{ -} - -static inline void flush_cache_range (struct vm_area_struct *vma, -unsigned long start, -unsigned long end) -{ -} - -static inline void flush_cache_page (struct vm_area_struct *vma, -unsigned long vmaddr, -unsigned long pfn) -{ -} - -static inline void flush_dcache_mmap_lock (struct address_space *mapping) -{ -} - -static inline void flush_dcache_mmap_unlock (struct address_space *mapping) -{ -} - -static inline void flush_icache_page (struct vm_area_struct *vma, -struct page *page) -{ -} - -static inline void flush_cache_vmap (unsigned long start,unsigned long end) -{ -} - -static inline void flush_cache_vunmap (unsigned long start,unsigned long end) -{ -} - -#define copy_to_user_page (vma, page, vaddr, dst, src, len) \ - do { \ - memcpy(dst, src, len); \ - flush_icache_user_range(vma, page, vaddr, len); \ - } while (0) -#define copy_from_user_page (vma, page, vaddr, dst, src, len) \ - memcpy(dst, src, len)
Andrew Morton
maintainerPATCH 42/54 arm,sparc,unicore32: remove flush_icache_user_range
In reply to a message not in the archiveFrom: Christoph Hellwig <[email protected]>
Subject: arm,sparc,unicore32: remove flush_icache_user_range
flush_icache_user_range is only used by <asm-generic/cacheflush.h>, so remove it from the architectures that implement it, but don't use <asm-generic/cacheflush.h>.
---
arch/arm/include/asm/cacheflush.h | 3 --- arch/sparc/include/asm/cacheflush_32.h | 2 -- arch/sparc/include/asm/cacheflush_64.h | 1 - arch/unicore32/include/asm/cacheflush.h | 3 --- 4 files changed, 9 deletions(-)
arch/arm/include/asm/cacheflush.h renamed from arch/arm/include/asm/cacheflush.h~armsparcunicore32-remove-flush_icache_user_range +0 -3
@@ -318,9 +318,6 @@ extern void flush_kernel_dcache_page(str#define flush_dcache_mmap_lock (mapping) xa_lock_irq(&mapping->i_pages)#define flush_dcache_mmap_unlock (mapping) xa_unlock_irq(&mapping->i_pages) -#define flush_icache_user_range (vma,page,addr,len) \ - flush_dcache_page(page) -/* * We don't appear to need to do anything here. In fact, if we did, we'd * duplicate cache flushing elsewhere performed by flush_dcache_page().
arch/sparc/include/asm/cacheflush_32.h renamed from arch/sparc/include/asm/cacheflush_32.h~armsparcunicore32-remove-flush_icache_user_range +0 -2
@@ -17,8 +17,6 @@#define flush_icache_range (start, end) do { } while (0)#define flush_icache_page (vma, pg) do { } while (0) -#define flush_icache_user_range (vma,pg,adr,len) do { } while (0) -#define copy_to_user_page (vma, page, vaddr, dst, src, len) \ do { \ flush_cache_page(vma, vaddr, page_to_pfn(page));\
arch/sparc/include/asm/cacheflush_64.h renamed from arch/sparc/include/asm/cacheflush_64.h~armsparcunicore32-remove-flush_icache_user_range +0 -1
@@ -49,7 +49,6 @@ void __flush_dcache_range(unsigned longvoid flush_dcache_page (struct page *page);#define flush_icache_page (vma, pg) do { } while(0) -#define flush_icache_user_range (vma,pg,adr,len) do { } while (0) void flush_ptrace_access(struct vm_area_struct *, struct page *, unsigned long uaddr, void *kaddr,
arch/unicore32/include/asm/cacheflush.h renamed from arch/unicore32/include/asm/cacheflush.h~armsparcunicore32-remove-flush_icache_user_range +0 -2
@@ -162,9 +162,6 @@ extern void flush_dcache_page(struct pag#define flush_dcache_mmap_lock (mapping) do { } while (0)#define flush_dcache_mmap_unlock (mapping) do { } while (0) -#define flush_icache_user_range (vma, page, addr, len) \ - flush_dcache_page(page)
Andrew Morton
maintainerPATCH 43/54 mm: rename flush_icache_user_range to flush_icache_user_page
In reply to a message not in the archiveFrom: Christoph Hellwig <[email protected]>
Subject: mm: rename flush_icache_user_range to flush_icache_user_page
The function currently known as flush_icache_user_range only operates on a single page. Rename it to flush_icache_user_page as we'll need the name flush_icache_user_range for something else soon.
---
arch/alpha/include/asm/cacheflush.h | 10 +++++----- arch/alpha/kernel/smp.c | 2 +- arch/ia64/include/asm/cacheflush.h | 2 +- arch/m68k/include/asm/cacheflush_mm.h | 4 ++-- arch/m68k/mm/cache.c | 2 +- arch/nds32/include/asm/cacheflush.h | 4 ++-- arch/nds32/mm/cacheflush.c | 2 +- arch/openrisc/include/asm/cacheflush.h | 2 +- arch/powerpc/include/asm/cacheflush.h | 4 ++-- arch/powerpc/mm/mem.c | 2 +- arch/riscv/include/asm/cacheflush.h | 3 ++- include/asm-generic/cacheflush.h | 6 +++--- kernel/events/uprobes.c | 2 +- 13 files changed, 23 insertions(+), 22 deletions(-)
arch/alpha/include/asm/cacheflush.h renamed from arch/alpha/include/asm/cacheflush.h~mm-rename-flush_icache_user_range-to-flush_icache_user_page +5 -5
@@ -35,7 +35,7 @@ extern void smp_imb(void);extern void __load_new_mm_context (struct mm_struct *);static inline void -flush_icache_user_range (struct vm_area_struct *vma,struct page *page, +flush_icache_user_page (struct vm_area_struct *vma,struct page *page,unsigned long addr,int len) {if (vma->vm_flags &VM_EXEC ) {
@@ -46,16 +46,16 @@ flush_icache_user_range(struct vm_area_s mm->context[smp_processor_id()] = 0; } } -#define flush_icache_user_range flush_icache_user_range +#define flush_icache_user_page flush_icache_user_page#else /* CONFIG_SMP */ -extern void flush_icache_user_range (struct vm_area_struct *vma, +extern void flush_icache_user_page (struct vm_area_struct *vma,struct page *page,unsigned long addr,int len); -#define flush_icache_user_range flush_icache_user_range +#define flush_icache_user_page flush_icache_user_page#endif /* CONFIG_SMP */ /* This is used only in __do_fault and do_swap_page. */ #define flush_icache_page (vma, page) \ - flush_icache_user_range((vma), (page), 0, 0) + flush_icache_user_page((vma), (page), 0, 0)#include <asm-generic/cacheflush.h>
arch/alpha/kernel/smp.c renamed from arch/alpha/kernel/smp.c~mm-rename-flush_icache_user_range-to-flush_icache_user_page +1 -1
@@ -740,7 +740,7 @@ ipi_flush_icache_page(void *x) }void -flush_icache_user_range (struct vm_area_struct *vma,struct page *page, +flush_icache_user_page (struct vm_area_struct *vma,struct page *page,unsigned long addr,int len) {struct mm_struct *mm = vma->vm_mm;
arch/ia64/include/asm/cacheflush.h renamed from arch/ia64/include/asm/cacheflush.h~mm-rename-flush_icache_user_range-to-flush_icache_user_page +1 -1
@@ -22,7 +22,7 @@ extern void flush_icache_range(unsigned#define flush_icache_range flush_icache_rangeextern void clflush_cache_range (void *addr,int size); -#define flush_icache_user_range (vma, page, user_addr, len) \ +#define flush_icache_user_page (vma, page, user_addr, len) \ do { \ unsigned long _addr = (unsigned long) page_address(page) + ((user_addr) & ~PAGE_MASK); \ flush_icache_range(_addr, _addr + (len)); \
arch/m68k/include/asm/cacheflush_mm.h renamed from arch/m68k/include/asm/cacheflush_mm.h~mm-rename-flush_icache_user_range-to-flush_icache_user_page +2 -2
@@ -254,7 +254,7 @@ static inline void __flush_page_to_ram(v#define flush_dcache_mmap_unlock (mapping) do { } while (0)#define flush_icache_page (vma, page) __flush_page_to_ram(page_address(page)) -extern void flush_icache_user_range (struct vm_area_struct *vma,struct page *page, +extern void flush_icache_user_page (struct vm_area_struct *vma,struct page *page,unsigned long addr,int len);extern void flush_icache_range (unsigned long address,unsigned long endaddr);
@@ -264,7 +264,7 @@ static inline void copy_to_user_page(str {flush_cache_page (vma, vaddr,page_to_pfn (page));memcpy (dst, src, len); -flush_icache_user_range (vma, page, vaddr, len); +flush_icache_user_page (vma, page, vaddr, len); } static inline void copy_from_user_page(struct vm_area_struct *vma, struct page *page, unsigned long vaddr,
arch/m68k/mm/cache.c renamed from arch/m68k/mm/cache.c~mm-rename-flush_icache_user_range-to-flush_icache_user_page +1 -1
@@ -106,7 +106,7 @@ void flush_icache_range(unsigned long ad }EXPORT_SYMBOL (flush_icache_range); -void flush_icache_user_range (struct vm_area_struct *vma,struct page *page, +void flush_icache_user_page (struct vm_area_struct *vma,struct page *page,unsigned long addr,int len) {if (CPU_IS_COLDFIRE ) {
arch/nds32/include/asm/cacheflush.h renamed from arch/nds32/include/asm/cacheflush.h~mm-rename-flush_icache_user_range-to-flush_icache_user_page +2 -2
@@ -44,9 +44,9 @@ void invalidate_kernel_vmap_range(void *#define flush_dcache_mmap_unlock (mapping) xa_unlock_irq(&(mapping)->i_pages)#else -void flush_icache_user_range (struct vm_area_struct *vma,struct page *page, +void flush_icache_user_page (struct vm_area_struct *vma,struct page *page,unsigned long addr,int len); -#define flush_icache_user_range flush_icache_user_range +#define flush_icache_user_page flush_icache_user_page#include <asm-generic/cacheflush.h> #endif
arch/nds32/mm/cacheflush.c renamed from arch/nds32/mm/cacheflush.c~mm-rename-flush_icache_user_range-to-flush_icache_user_page +1 -1
@@ -36,7 +36,7 @@ void flush_icache_page(struct vm_area_stlocal_irq_restore (flags); } -void flush_icache_user_range (struct vm_area_struct *vma,struct page *page, +void flush_icache_user_page (struct vm_area_struct *vma,struct page *page,unsigned long addr,int len) {unsigned long kaddr;
arch/openrisc/include/asm/cacheflush.h renamed from arch/openrisc/include/asm/cacheflush.h~mm-rename-flush_icache_user_range-to-flush_icache_user_page +1 -1
@@ -62,7 +62,7 @@ static inline void flush_dcache_page(strclear_bit (PG_dc_clean, &page->flags); } -#define flush_icache_user_range (vma, page, addr, len) \ +#define flush_icache_user_page (vma, page, addr, len) \ do { \ if (vma->vm_flags & VM_EXEC) \ sync_icache_dcache(page); \
arch/powerpc/include/asm/cacheflush.h renamed from arch/powerpc/include/asm/cacheflush.h~mm-rename-flush_icache_user_range-to-flush_icache_user_page +2 -2
@@ -28,9 +28,9 @@ extern void flush_dcache_page(struct pagvoid flush_icache_range (unsigned long start,unsigned long stop);#define flush_icache_range flush_icache_range -void flush_icache_user_range (struct vm_area_struct *vma,struct page *page, +void flush_icache_user_page (struct vm_area_struct *vma,struct page *page,unsigned long addr,int len); -#define flush_icache_user_range flush_icache_user_range +#define flush_icache_user_page flush_icache_user_pagevoid flush_dcache_icache_page (struct page *page);void __flush_dcache_icache (void *page);
arch/powerpc/mm/mem.c renamed from arch/powerpc/mm/mem.c~mm-rename-flush_icache_user_range-to-flush_icache_user_page +1 -1
@@ -577,7 +577,7 @@ void copy_user_page(void *vto, void *vfrflush_dcache_page (pg); } -void flush_icache_user_range (struct vm_area_struct *vma,struct page *page, +void flush_icache_user_page (struct vm_area_struct *vma,struct page *page,unsigned long addr,int len) {unsigned long maddr;
arch/riscv/include/asm/cacheflush.h renamed from arch/riscv/include/asm/cacheflush.h~mm-rename-flush_icache_user_range-to-flush_icache_user_page +2 -1
@@ -27,7 +27,8 @@ static inline void flush_dcache_page(str* so instead we just flush the whole thing. */ #define flush_icache_range (start, end) flush_icache_all() -#define flush_icache_user_range (vma, pg, addr, len) flush_icache_mm(vma->vm_mm, 0) +#define flush_icache_user_page (vma, pg, addr, len) \ + flush_icache_mm(vma->vm_mm, 0)#ifndef CONFIG_SMP
include/asm-generic/cacheflush.h renamed from include/asm-generic/cacheflush.h~mm-rename-flush_icache_user_range-to-flush_icache_user_page +3 -3
@@ -73,8 +73,8 @@ static inline void flush_icache_page(str }#endif -#ifndef flush_icache_user_range -static inline void flush_icache_user_range (struct vm_area_struct *vma, +#ifndef flush_icache_user_page +static inline void flush_icache_user_page (struct vm_area_struct *vma,struct page *page,unsigned long addr,int len) {
@@ -97,7 +97,7 @@ static inline void flush_cache_vunmap(un#define copy_to_user_page (vma, page, vaddr, dst, src, len) \ do { \ memcpy(dst, src, len); \ - flush_icache_user_range(vma, page, vaddr, len); \ + flush_icache_user_page(vma, page, vaddr, len); \ } while (0)#endif
kernel/events/uprobes.c renamed from kernel/events/uprobes.c~mm-rename-flush_icache_user_range-to-flush_icache_user_page +1 -1
@@ -1668,7 +1668,7 @@ void __weak arch_uprobe_copy_ixol(structcopy_to_page (page, vaddr, src, len);/* -* We probably need flush_icache_user_range() but it needs vma. +* We probably need flush_icache_user_page() but it needs vma. * This should work on most of architectures by default. If * architecture needs to do something different it can define * its own version of the function.
_
Andrew Morton
maintainerPATCH 44/54 asm-generic: add a flush_icache_user_range stub
In reply to a message not in the archiveFrom: Christoph Hellwig <[email protected]>
Subject: asm-generic: add a flush_icache_user_range stub
Define flush_icache_user_range to flush_icache_range unless the architecture provides its own implementation.
---
include/asm-generic/cacheflush.h | 4 ++++ 1 file changed, 4 insertions(+)
include/asm-generic/cacheflush.h renamed from include/asm-generic/cacheflush.h~asm-generic-add-a-flush_icache_user_range-stub +4 -0
@@ -66,6 +66,10 @@ static inline void flush_icache_range(un }#endif +#ifndef flush_icache_user_range +#define flush_icache_user_range flush_icache_range +#endif +#ifndef flush_icache_pagestatic inline void flush_icache_page (struct vm_area_struct *vma,struct page *page)
_
Andrew Morton
maintainerPATCH 45/54 sh: implement flush_icache_user_range
In reply to a message not in the archiveFrom: Christoph Hellwig <[email protected]>
Subject: sh: implement flush_icache_user_range
The SuperH implementation of flush_icache_range seems to be able to cope with user addresses. Just define flush_icache_user_range to flush_icache_range.
---
arch/sh/include/asm/cacheflush.h | 1 + 1 file changed, 1 insertion(+)
arch/sh/include/asm/cacheflush.h renamed from arch/sh/include/asm/cacheflush.h~sh-implement-flush_icache_user_range +1 -0
@@ -46,6 +46,7 @@ extern void flush_cache_range(struct vm_#define ARCH_IMPLEMENTS_FLUSH_DCACHE_PAGE 1extern void flush_dcache_page (struct page *page);extern void flush_icache_range (unsigned long start,unsigned long end); +#define flush_icache_user_range flush_icache_rangeextern void flush_icache_page (struct vm_area_struct *vma,struct page *page);extern void flush_cache_sigtramp (unsigned long address);
_
Andrew Morton
maintainerPATCH 46/54 xtensa: implement flush_icache_user_range
In reply to a message not in the archiveFrom: Christoph Hellwig <[email protected]>
Subject: xtensa: implement flush_icache_user_range
The Xtensa implementation of flush_icache_range seems to be able to cope with user addresses. Just define flush_icache_user_range to flush_icache_range.
---
arch/xtensa/include/asm/cacheflush.h | 2 ++ 1 file changed, 2 insertions(+)
arch/xtensa/include/asm/cacheflush.h renamed from arch/xtensa/include/asm/cacheflush.h~xtensa-implement-flush_icache_user_range +2 -0
@@ -145,6 +145,8 @@ void local_flush_cache_page(struct vm_ar#endif +#define flush_icache_user_range flush_icache_range +/* Ensure consistency between data and instruction cache. */ #define local_flush_icache_range (start, end) \ do { \
_
Andrew Morton
maintainerPATCH 47/54 arm: rename flush_cache_user_range to flush_icache_user_range
In reply to a message not in the archiveFrom: Christoph Hellwig <[email protected]>
Subject: arm: rename flush_cache_user_range to flush_icache_user_range
flush_icache_user_range will be the name for a generic primitive. Move the arm name so that arm already has an implementation.
---
arch/arm/include/asm/cacheflush.h | 4 ++-- arch/arm/kernel/traps.c | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-)
arch/arm/include/asm/cacheflush.h renamed from arch/arm/include/asm/cacheflush.h~arm-rename-flush_cache_user_range-to-flush_icache_user_range +2 -2
@@ -258,11 +258,11 @@ extern void flush_cache_page(struct vm_a#define flush_cache_dup_mm (mm) flush_cache_mm(mm)/* -* flush_cache_user_range is used when we want to ensure that the +* flush_icache_user_range is used when we want to ensure that the * Harvard caches are synchronised for the user space address range. * This is used for the ARM private sys_cacheflush system call. */ -#define flush_cache_user_range (s,e) __cpuc_coherent_user_range(s,e) +#define flush_icache_user_range (s,e) __cpuc_coherent_user_range(s,e)/* * Perform necessary cache operations to ensure that data previously
arch/arm/kernel/traps.c renamed from arch/arm/kernel/traps.c~arm-rename-flush_cache_user_range-to-flush_icache_user_range +1 -1
@@ -566,7 +566,7 @@ __do_cache_op(unsigned long start, unsigif (fatal_signal_pending (current))return 0 ; - ret =flush_cache_user_range (start, start + chunk); + ret =flush_icache_user_range (start, start + chunk);if (ret)return ret;
_
Andrew Morton
maintainerPATCH 48/54 m68k: implement flush_icache_user_range
In reply to a message not in the archiveFrom: Christoph Hellwig <[email protected]>
Subject: m68k: implement flush_icache_user_range
Rename the current flush_icache_range to flush_icache_user_range as per commit ae92ef8a4424 ("PATCH] flush icache in correct context") there seems to be an assumption that it operates on user addresses. Add a flush_icache_range around it that for now is a no-op.
---
arch/m68k/include/asm/cacheflush_mm.h | 2 ++ arch/m68k/mm/cache.c | 7 ++++++- 2 files changed, 8 insertions(+), 1 deletion(-)
arch/m68k/include/asm/cacheflush_mm.h renamed from arch/m68k/include/asm/cacheflush_mm.h~m68k-implement-flush_icache_user_range +2 -0
@@ -257,6 +257,8 @@ static inline void __flush_page_to_ram(vextern void flush_icache_user_page (struct vm_area_struct *vma,struct page *page,unsigned long addr,int len);extern void flush_icache_range (unsigned long address,unsigned long endaddr); +extern void flush_icache_user_range (unsigned long address, +unsigned long endaddr); static inline void copy_to_user_page(struct vm_area_struct *vma, struct page *page, unsigned long vaddr,
arch/m68k/mm/cache.c renamed from arch/m68k/mm/cache.c~m68k-implement-flush_icache_user_range +6 -1
@@ -73,7 +73,7 @@ static unsigned long virt_to_phys_slow(u/* Push n pages at kernel virtual address and clear the icache */ /* RZ: use cpush %bc instead of cpush %dc, cinv %ic */ -void flush_icache_range (unsigned long address,unsigned long endaddr) +void flush_icache_user_range (unsigned long address,unsigned long endaddr) {if (CPU_IS_COLDFIRE ) {unsigned long start, end;
@@ -104,6 +104,11 @@ void flush_icache_range(unsigned long ad : "di" (FLUSH_I)); } } + +void flush_icache_range (unsigned long address,unsigned long endaddr) +{ +flush_icache_user_range (address, endaddr); +}EXPORT_SYMBOL (flush_icache_range); void flush_icache_user_page(struct vm_area_struct *vma, struct page *page,
_
Andrew Morton
maintainerPATCH 49/54 exec: only build read_code when needed
In reply to a message not in the archiveFrom: Christoph Hellwig <[email protected]>
Subject: exec: only build read_code when needed
Only build read_code when binary formats that use it are built into the kernel.
---
fs/exec.c | 3 +++ 1 file changed, 3 insertions(+)
fs/exec.c renamed from fs/exec.c~exec-only-build-read_code-when-needed +3 -0
@@ -1053,6 +1053,8 @@ out: }EXPORT_SYMBOL_GPL (kernel_read_file_from_fd); +#if defined(CONFIG_HAVE_AOUT ) || defined(CONFIG_BINFMT_FLAT ) || \ + defined(CONFIG_BINFMT_ELF_FDPIC )ssize_t read_code (struct file *file,unsigned long addr,loff_t pos,size_t len) {ssize_t res =vfs_read (file, (void __user *)addr, len, &pos);
@@ -1061,6 +1063,7 @@ ssize_t read_code(struct file *file, uns return res; }EXPORT_SYMBOL (read_code); +#endif /* * Maps the mm_struct mm into the current task struct.
_
Andrew Morton
maintainerPATCH 50/54 exec: use flush_icache_user_range in read_code
In reply to a message not in the archiveFrom: Christoph Hellwig <[email protected]>
Subject: exec: use flush_icache_user_range in read_code
read_code operates on user addresses.
---
fs/exec.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
fs/exec.c renamed from fs/exec.c~exec-use-flush_icache_user_range-in-read_code +1 -1
@@ -1059,7 +1059,7 @@ ssize_t read_code(struct file *file, uns {ssize_t res =vfs_read (file, (void __user *)addr, len, &pos);if (res >0 ) -flush_icache_range (addr, addr + len); +flush_icache_user_range (addr, addr + len);return res; }EXPORT_SYMBOL (read_code);
_
Andrew Morton
maintainerPATCH 51/54 binfmt_flat: use flush_icache_user_range
In reply to a message not in the archiveFrom: Christoph Hellwig <[email protected]>
Subject: binfmt_flat: use flush_icache_user_range
load_flat_file works on user addresses.
---
fs/binfmt_flat.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
fs/binfmt_flat.c renamed from fs/binfmt_flat.c~binfmt_flat-use-flush_icache_user_range +1 -1
@@ -854,7 +854,7 @@ static int load_flat_file(struct linux_b#endif /* CONFIG_BINFMT_FLAT_OLD */ } -flush_icache_range (start_code, end_code); +flush_icache_user_range (start_code, end_code);/* zero the BSS, BRK and stack areas */ if (clear_user((void __user *)(datapos + data_len), bss_len +
_
Andrew Morton
maintainerPATCH 52/54 nommu: use flush_icache_user_range in brk and mmap
In reply to a message not in the archiveFrom: Christoph Hellwig <[email protected]>
Subject: nommu: use flush_icache_user_range in brk and mmap
These obviously operate on user addresses.
---
mm/nommu.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
mm/nommu.c renamed from mm/nommu.c~nommu-use-flush_icache_user_range-in-brk-and-mmap +2 -2
@@ -433,7 +433,7 @@ SYSCALL_DEFINE1(brk, unsigned long, brk)/* * Ok, looks good - let it rip. */ -flush_icache_range (mm->brk, brk); +flush_icache_user_range (mm->brk, brk);return mm->brk = brk; }
@@ -1277,7 +1277,7 @@ share:/* we flush the region from the icache only when the first executable * mapping of it is made */ if (vma->vm_flags &VM_EXEC && !region->vm_icache_flushed) { -flush_icache_range (region->vm_start, region->vm_end); +flush_icache_user_range (region->vm_start, region->vm_end); region->vm_icache_flushed = true; }
_
Andrew Morton
maintainerPATCH 53/54 module: move the set_fs hack for flush_icache_range to m68k
In reply to a message not in the archiveFrom: Christoph Hellwig <[email protected]>
Subject: module: move the set_fs hack for flush_icache_range to m68k
flush_icache_range generally operates on kernel addresses, but for some reason m68k needed a set_fs override. Move that into the m68k code insted of keeping it in the module loader.
---
arch/m68k/mm/cache.c | 4 ++++ kernel/module.c | 8 -------- 2 files changed, 4 insertions(+), 8 deletions(-)
arch/m68k/mm/cache.c renamed from arch/m68k/mm/cache.c~module-move-the-set_fs-hack-for-flush_icache_range-to-m68k +4 -0
@@ -107,7 +107,11 @@ void flush_icache_user_range(unsigned lovoid flush_icache_range (unsigned long address,unsigned long endaddr) { +mm_segment_t old_fs =get_fs (); + +set_fs (KERNEL_DS );flush_icache_user_range (address, endaddr); +set_fs (old_fs); }EXPORT_SYMBOL (flush_icache_range);
kernel/module.c renamed from kernel/module.c~module-move-the-set_fs-hack-for-flush_icache_range-to-m68k +0 -6
@@ -3344,12 +3344,6 @@ static int check_module_license_and_versstatic void flush_module_icache (const struct module *mod) { -mm_segment_t old_fs; - -/* flush the icache in correct context */ - old_fs =get_fs (); -set_fs (KERNEL_DS ); -/* * Flush the instruction cache, since we've played with text. * Do it before processing of module parameters, so the module
@@ -3361,8 +3355,6 @@ static void flush_module_icache(const st + mod->init_layout.size);flush_icache_range ((unsigned long )mod->core_layout.base, (unsigned long )mod->core_layout.base + mod->core_layout.size);
Andrew Morton
maintainerPATCH 54/54 doc: cgroup: update note about conditions when oom killer is invoked
In reply to a message not in the archiveFrom: Konstantin Khlebnikov <[email protected]>
Subject: doc: cgroup: update note about conditions when oom killer is invoked
Starting from v4.19 commit 29ef680ae7c2 ("memcg, oom: move out_of_memory back to the charge path") cgroup oom killer is no longer invoked only from page faults. Now it implements the same semantics as global OOM killer:
allocation context invokes OOM killer and keeps retrying until success.
---
Documentation/admin-guide/cgroup-v2.rst | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-)
Documentation/admin-guide/cgroup-v2.rst renamed from Documentation/admin-guide/cgroup-v2.rst~doc-cgroup-update-note-about-conditions-when-oom-killer-is-invoked +7 -7
@@ -1170,6 +1170,13 @@ PAGE_SIZE multiple when read back. Under certain circumstances, the usage may go over the limit temporarily. + In default configuration regular 0-order allocations always + succeed unless OOM killer chooses current task as a victim. + + Some kinds of allocations don't invoke the OOM killer. + Caller could retry them differently, return into userspace + as -ENOMEM or silently ignore in cases like disk readahead. + This is the ultimate protection mechanism. As long as the high limit is used and monitored properly, this limit's utility is limited to providing the final safety net.
@@ -1226,17 +1233,9 @@ PAGE_SIZE multiple when read back. The number of time the cgroup's memory usage was reached the limit and allocation was about to fail. - Depending on context result could be invocation of OOM - killer and retrying allocation or failing allocation. - - Failed allocation in its turn could be returned into - userspace as -ENOMEM or silently ignored in cases like - disk readahead. For now OOM in memory cgroup kills - tasks iff shortage has happened inside page fault.
[obsolete] linux-next-rejects.patch removed from -mm tree
In reply to a message not in the archiveThe patch titled Subject: linux-next-rejects has been removed from the -mm tree. Its filename was linux-next-rejects.patch
The patch titled
Subject: linux-next-rejects
has been removed from the -mm tree. Its filename was
linux-next-rejects.patch
This patch was dropped because it is obsolete
------------------------------------------------------
From: Andrew Morton <[email protected]>
Subject: linux-next-rejects
---
drivers/pci/quirks.c | 12 ------------ 1 file changed, 12 deletions(-)
drivers/pci/quirks.c renamed from drivers/pci/quirks.c~linux-next-rejects +0 -12
@@ -5615,15 +5615,3 @@ static void apex_pci_fixup_class(structDECLARE_PCI_FIXUP_CLASS_HEADER (0x1ac1 ,0x089a ,PCI_CLASS_NOT_DEFINED ,8 , apex_pci_fixup_class); -/* -* Device [12d8:0x400e] and [12d8:0x400f] -* These devices advertise PME# support in all power states but don't -* reliably assert it. -*/ -static void pci_fixup_no_pme (struct pci_dev *dev) -{ -pci_info (dev,"PME# is unreliable, disabling it\n" ); - dev->pme_support =0 ; -} -DECLARE_PCI_FIXUP_FINAL (PCI_VENDOR_ID_PERICOM ,0x400e , pci_fixup_no_pme); -DECLARE_PCI_FIXUP_FINAL (PCI_VENDOR_ID_PERICOM ,0x400f , pci_fixup_no_pme);
_
Patches currently in -mm which might be from [email protected] are
drivers-tty-serial-sh-scic-suppress-uninitialized-var-warning.patch mm.patch
lib-test-get_count_order-long-in-test_bitopsc-fix.patch ipc-convert-ipcs_idr-to-xarray-update-fix.patch linux-next-git-rejects.patch mm-consolidate-pgd_index-and-pgd_offset_k-definitions-fix.patch mmap-locking-api-convert-mmap_sem-call-sites-missed-by-coccinelle-fix.patch mmap-locking-api-convert-mmap_sem-call-sites-missed-by-coccinelle-fix-fix.patch mmap-locking-api-convert-mmap_sem-call-sites-missed-by-coccinelle-fix-fix-fix.patch mmap-locking-api-rename-mmap_sem-to-mmap_lock-fix.patch mmap-locking-api-convert-mmap_sem-comments-fix.patch mmap-locking-api-convert-mmap_sem-comments-fix-fix.patch mmap-locking-api-convert-mmap_sem-comments-fix-fix-fix.patch mm-pass-task-and-mm-to-do_madvise.patch mm-introduce-external-memory-hinting-api-fix-2-fix.patch mm-support-vector-address-ranges-for-process_madvise-fix-fix-fix-fix-fix.patch maccess-unify-the-probe-kernel-arch-hooks-fix.patch bpf-bpf_seq_printf-handle-potentially-unsafe-format-string-better.patch maccess-always-use-strict-semantics-for-probe_kernel_read-fix.patch x86-use-non-set_fs-based-maccess-routines-checkpatch-fixes.patch kernel-forkc-export-kernel_thread-to-modules.patch
+ lib-test-get_count_order-long-in-test_bitopsc-fix-fix.patch added to -mm tree
In reply to a message not in the archiveThe patch titled Subject: lib-test-get_count_order-long-in-test_bitopsc-fix-fix has been added to the -mm tree. Its filename is lib-test-get_count_order-long-in-test_bitopsc-fix-fix.patch
The patch titled
Subject: lib-test-get_count_order-long-in-test_bitopsc-fix-fix
has been added to the -mm tree. Its filename is
lib-test-get_count_order-long-in-test_bitopsc-fix-fix.patch
This patch should soon appear at
http://ozlabs.org/~akpm/mmots/broken-out/lib-test-get_count_order-long-in-test_bitopsc-fix-fix.patch
and later at
http://ozlabs.org/~akpm/mmotm/broken-out/lib-test-get_count_order-long-in-test_bitopsc-fix-fix.patch
Before you just go and hit "reply", please:
a) Consider who else should be cc'ed
b) Prefer to cc a suitable mailing list as well
c) Ideally: find the original patch on the mailing list and do a reply-to-all to that, adding suitable additional cc's
*** Remember to use Documentation/process/submit-checklist.rst when testing your code ***
The -mm tree is included into linux-next and is updated there every 3-4 working days
------------------------------------------------------
From: Andrew Morton <[email protected]>
Subject: lib-test-get_count_order-long-in-test_bitopsc-fix-fix
fix loop bound, per Wei Yang
---
lib/test_bitops.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
lib/test_bitops.c renamed from lib/test_bitops.c~lib-test-get_count_order-long-in-test_bitopsc-fix-fix +1 -1
@@ -74,7 +74,7 @@ static int __init test_bitops_startup(vo }#ifdef CONFIG_64BIT -for (i =0 ; i <ARRAY_SIZE (order_comb); i++) { +for (i =0 ; i <ARRAY_SIZE (order_comb_long); i++) {if (order_comb_long[i][1 ] !=get_count_order_long (order_comb_long[i][0 ])) pr_warn("get_count_order_long wrong for %lx\n",
_
Patches currently in -mm which might be from [email protected] are
drivers-tty-serial-sh-scic-suppress-uninitialized-var-warning.patch mm.patch
lib-test-get_count_order-long-in-test_bitopsc-fix.patch lib-test-get_count_order-long-in-test_bitopsc-fix-fix.patch ipc-convert-ipcs_idr-to-xarray-update-fix.patch linux-next-git-rejects.patch mm-consolidate-pgd_index-and-pgd_offset_k-definitions-fix.patch mmap-locking-api-convert-mmap_sem-call-sites-missed-by-coccinelle-fix.patch mmap-locking-api-convert-mmap_sem-call-sites-missed-by-coccinelle-fix-fix.patch mmap-locking-api-convert-mmap_sem-call-sites-missed-by-coccinelle-fix-fix-fix.patch mmap-locking-api-rename-mmap_sem-to-mmap_lock-fix.patch mmap-locking-api-convert-mmap_sem-comments-fix.patch mmap-locking-api-convert-mmap_sem-comments-fix-fix.patch mmap-locking-api-convert-mmap_sem-comments-fix-fix-fix.patch mm-pass-task-and-mm-to-do_madvise.patch mm-introduce-external-memory-hinting-api-fix-2-fix.patch mm-support-vector-address-ranges-for-process_madvise-fix-fix-fix-fix-fix.patch maccess-unify-the-probe-kernel-arch-hooks-fix.patch bpf-bpf_seq_printf-handle-potentially-unsafe-format-string-better.patch maccess-always-use-strict-semantics-for-probe_kernel_read-fix.patch x86-use-non-set_fs-based-maccess-routines-checkpatch-fixes.patch kernel-forkc-export-kernel_thread-to-modules.patch
+ checkpatch-correct-check-for-kernel-parameters-doc.patch added to -mm tree
In reply to a message not in the archiveThe patch titled Subject: checkpatch: correct check for kernel parameters doc has been added to the -mm tree. Its filename is checkpatch-correct-check-for-kernel-parameters-doc.patch
The patch titled
Subject: checkpatch: correct check for kernel parameters doc
has been added to the -mm tree. Its filename is
checkpatch-correct-check-for-kernel-parameters-doc.patch
This patch should soon appear at
http://ozlabs.org/~akpm/mmots/broken-out/checkpatch-correct-check-for-kernel-parameters-doc.patch
and later at
http://ozlabs.org/~akpm/mmotm/broken-out/checkpatch-correct-check-for-kernel-parameters-doc.patch
Before you just go and hit "reply", please:
a) Consider who else should be cc'ed
b) Prefer to cc a suitable mailing list as well
c) Ideally: find the original patch on the mailing list and do a reply-to-all to that, adding suitable additional cc's
*** Remember to use Documentation/process/submit-checklist.rst when testing your code ***
The -mm tree is included into linux-next and is updated there every 3-4 working days
------------------------------------------------------
From: Tim Froidcoeur <[email protected]>
Subject: checkpatch: correct check for kernel parameters doc
Adding a new kernel parameter with documentation makes checkpatch complain "__setup appears un-documented -- check Documentation/admin-guide/kernel-parameters.rst". The list of kernel parameters has moved to a separate txt file, but checkpatch has not been updated for this.
Make checkpatch.pl look for the documentation for new kernel parameters in kernel-parameters.txt instead of kernel-parameters.rst.
---
scripts/checkpatch.pl | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
scripts/checkpatch.pl renamed from scripts/checkpatch.pl~checkpatch-correct-check-for-kernel-parameters-doc +2 -2
@@ -2409,7 +2409,7 @@ sub process { if ($rawline=~/^\+\+\+\s+(\S+)/) { $setup_docs = 0; - if ($1 =~ m@Documentation/admin-guide/kernel-parameters.rst$@) { + if ($1 =~ m@Documentation/admin-guide/kernel-parameters.txt$@) { $setup_docs = 1; } #next;
@@ -6390,7 +6390,7 @@ sub process { if (!grep(/$name/, @setup_docs)) { CHK("UNDOCUMENTED_SETUP", - "__setup appears un-documented -- check Documentation/admin-guide/kernel-parameters.rst\n" . $herecurr); + "__setup appears un-documented -- check Documentation/admin-guide/kernel-parameters.txt\n" . $herecurr); } }
_
Patches currently in -mm which might be from [email protected] are
checkpatch-correct-check-for-kernel-parameters-doc.patch
+ lib-fix-bitmap_parse-on-64-bit-big-endian-archs.patch added to -mm tree
In reply to a message not in the archiveThe patch titled Subject: lib: fix bitmap_parse() on 64-bit big endian archs has been added to the -mm tree. Its filename is lib-fix-bitmap_parse-on-64-bit-big-endian-archs.patch
The patch titled
Subject: lib: fix bitmap_parse() on 64-bit big endian archs
has been added to the -mm tree. Its filename is
lib-fix-bitmap_parse-on-64-bit-big-endian-archs.patch
This patch should soon appear at
http://ozlabs.org/~akpm/mmots/broken-out/lib-fix-bitmap_parse-on-64-bit-big-endian-archs.patch
and later at
http://ozlabs.org/~akpm/mmotm/broken-out/lib-fix-bitmap_parse-on-64-bit-big-endian-archs.patch
Before you just go and hit "reply", please:
a) Consider who else should be cc'ed
b) Prefer to cc a suitable mailing list as well
c) Ideally: find the original patch on the mailing list and do a reply-to-all to that, adding suitable additional cc's
*** Remember to use Documentation/process/submit-checklist.rst when testing your code ***
The -mm tree is included into linux-next and is updated there every 3-4 working days
------------------------------------------------------
From: Alexander Gordeev <[email protected]>
Subject: lib: fix bitmap_parse() on 64-bit big endian archs
Commit 2d6261583be0 ("lib: rework bitmap_parse()") does not take into account order of halfwords on 64-bit big endian architectures. As result (at least) Receive Packet Steering, IRQ affinity masks and runtime kernel test "test_bitmap" get broken on s390.
---
lib/bitmap.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-)
lib/bitmap.c renamed from lib/bitmap.c~lib-fix-bitmap_parse-on-64-bit-big-endian-archs +7 -1
@@ -740,6 +740,7 @@ int bitmap_parse(const char *start, unsiconst char *end =strnchrnul (start, buflen,'\n' ) -1 ;int chunks =BITS_TO_U32 (nmaskbits);u32 *bitmap = (u32 *)maskp; +int chunk =0 ;int unset_bit;while (1 ) {
@@ -750,9 +751,14 @@ int bitmap_parse(const char *start, unsiif (!chunks--)return -EOVERFLOW ; - end =bitmap_get_x32_reverse (start, end, bitmap++); +#if defined(CONFIG_64BIT ) && defined(__BIG_ENDIAN) + end =bitmap_get_x32_reverse (start, end, &bitmap[chunk ^1 ]); +#else + end =bitmap_get_x32_reverse (start, end, &bitmap[chunk]); +#endif if (IS_ERR (end))return PTR_ERR (end); + chunk++; } unset_bit = (BITS_TO_U32 (nmaskbits) - chunks) *32 ;
_
Patches currently in -mm which might be from [email protected] are
lib-fix-bitmap_parse-on-64-bit-big-endian-archs.patch
+ mm-debug_vm_pgtable-fix-kernel-crash-by-checking-for-thp-support.patch added to -mm tree
In reply to a message not in the archiveThe patch titled Subject: mm/debug_vm_pgtable: fix kernel crash by checking for THP support has been added to the -mm tree. Its filename is…
The patch titled
Subject: mm/debug_vm_pgtable: fix kernel crash by checking for THP support
has been added to the -mm tree. Its filename is
mm-debug_vm_pgtable-fix-kernel-crash-by-checking-for-thp-support.patch
This patch should soon appear at
http://ozlabs.org/~akpm/mmots/broken-out/mm-debug_vm_pgtable-fix-kernel-crash-by-checking-for-thp-support.patch
and later at
http://ozlabs.org/~akpm/mmotm/broken-out/mm-debug_vm_pgtable-fix-kernel-crash-by-checking-for-thp-support.patch
Before you just go and hit "reply", please:
a) Consider who else should be cc'ed
b) Prefer to cc a suitable mailing list as well
c) Ideally: find the original patch on the mailing list and do a reply-to-all to that, adding suitable additional cc's
*** Remember to use Documentation/process/submit-checklist.rst when testing your code ***
The -mm tree is included into linux-next and is updated there every 3-4 working days
------------------------------------------------------
From: "Aneesh Kumar K.V" <[email protected]>
Subject: mm/debug_vm_pgtable: fix kernel crash by checking for THP support
Architectures can have CONFIG_TRANSPARENT_HUGEPAGE enabled but no THP support enabled based on platforms. For ex: with 4K PAGE_SIZE ppc64 supports THP only with radix translation.
This results in below crash when running with hash translation and 4K PAGE_SIZE.
kernel BUG at arch/powerpc/include/asm/book3s/64/hash-4k.h:140! cpu 0x61: Vector: 700 (Program Check) at [c000000ff948f860]
pc: c0000000018810f8: debug_vm_pgtable+0x480/0x8b0
lr: c0000000018810ec: debug_vm_pgtable+0x474/0x8b0...
[c000000ff948faf0] c000000001880fec debug_vm_pgtable+0x374/0x8b0 (unreliable) [c000000ff948fbf0] c000000000011648 do_one_initcall+0x98/0x4f0 [c000000ff948fcd0] c000000001843928 kernel_init_freeable+0x330/0x3fc [c000000ff948fdb0] c0000000000122ac kernel_init+0x24/0x148 [c000000ff948fe20] c00000000000cc44 ret_from_kernel_thread+0x5c/0x78
Check for THP support correctly
---
mm/debug_vm_pgtable.c | 6 ++++++ 1 file changed, 6 insertions(+)
mm/debug_vm_pgtable.c renamed from mm/debug_vm_pgtable.c~mm-debug_vm_pgtable-fix-kernel-crash-by-checking-for-thp-support +6 -0
@@ -61,6 +61,9 @@ static void __init pmd_basic_tests(unsig {pmd_t pmd =pfn_pmd (pfn, prot); +if (!has_transparent_hugepage ()) +return ; +WARN_ON (!pmd_same (pmd, pmd));WARN_ON (!pmd_young (pmd_mkyoung (pmd_mkold (pmd))));WARN_ON (!pmd_dirty (pmd_mkdirty (pmd_mkclean (pmd))));
@@ -80,6 +83,9 @@ static void __init pud_basic_tests(unsig {pud_t pud =pfn_pud (pfn, prot); +if (!has_transparent_hugepage ()) +return ; +WARN_ON (!pud_same (pud, pud));WARN_ON (!pud_young (pud_mkyoung (pud_mkold (pud))));WARN_ON (!pud_write (pud_mkwrite (pud_wrprotect (pud))));
_
Patches currently in -mm which might be from [email protected] are
mm-debug_vm_pgtable-fix-kernel-crash-by-checking-for-thp-support.patch
+ mm-memory-failure-prioritize-prctlpr_mce_kill-over-vmmemory_failure_early_kill.patch added to -mm tree
In reply to a message not in the archiveThe patch titled Subject: mm/memory-failure: prioritize prctl(PR_MCE_KILL) over vm.memory_failure_early_kill has been added to the -mm tree. Its filename is…
The patch titled
Subject: mm/memory-failure: prioritize prctl(PR_MCE_KILL) over vm.memory_failure_early_kill
has been added to the -mm tree. Its filename is
mm-memory-failure-prioritize-prctlpr_mce_kill-over-vmmemory_failure_early_kill.patch
This patch should soon appear at
http://ozlabs.org/~akpm/mmots/broken-out/mm-memory-failure-prioritize-prctlpr_mce_kill-over-vmmemory_failure_early_kill.patch
and later at
http://ozlabs.org/~akpm/mmotm/broken-out/mm-memory-failure-prioritize-prctlpr_mce_kill-over-vmmemory_failure_early_kill.patch
Before you just go and hit "reply", please:
a) Consider who else should be cc'ed
b) Prefer to cc a suitable mailing list as well
c) Ideally: find the original patch on the mailing list and do a reply-to-all to that, adding suitable additional cc's
*** Remember to use Documentation/process/submit-checklist.rst when testing your code ***
The -mm tree is included into linux-next and is updated there every 3-4 working days
------------------------------------------------------
From: Naoya Horiguchi <[email protected]>
Subject: mm/memory-failure: prioritize prctl(PR_MCE_KILL) over vm.memory_failure_early_kill
Patch series "hwpoison: fixes signaling on memory error"
This is a small patchset to solve issues in memory error handler to send SIGBUS to proper process/thread as expected in configuration. Please see descriptions in individual patches for more details.
This patch (of 2):
Early-kill policy is controlled from two types of settings, one is per-process setting prctl(PR_MCE_KILL) and the other is system-wide setting vm.memory_failure_early_kill. Users expect per-process setting to override system-wide setting as many other settings do, but early-kill setting doesn't work as such. For example, if a system configures vm.memory_failure_early_kill to 1 (enabled), a process receives SIGBUS even if it's configured to explicitly disable PF_MCE_KILL by prctl(). That's not desirable for applications with their own policies.
This patch is suggesting to change the priority of these two types of settings, by checking sysctl_memory_failure_early_kill only when a given process has the default kill policy.
Note that this patch is solving a thread choice issue too. Originally, collect_procs() always chooses the main thread when vm.memory_failure_early_kill is 1, even if the process has a dedicated thread for memory error handling. SIGBUS should be sent to the dedicated thread if early-kill is enabled via vm.memory_failure_early_kill as we are doing for PR_MCE_KILL_EARLY processes.
---
mm/memory-failure.c | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-)
mm/memory-failure.c renamed from mm/memory-failure.c~mm-memory-failure-prioritize-prctlpr_mce_kill-over-vmmemory_failure_early_kill +10 -10
@@ -402,9 +402,15 @@ static struct task_struct *find_early_ki {struct task_struct *t; -for_each_thread (tsk, t) -if ((t->flags &PF_MCE_PROCESS ) && (t->flags &PF_MCE_EARLY )) -return t; +for_each_thread (tsk, t) { +if (t->flags &PF_MCE_PROCESS ) { +if (t->flags &PF_MCE_EARLY ) +return t; + }else { +if (sysctl_memory_failure_early_kill) +return t; + } + }return NULL ; }
@@ -417,17 +423,11 @@ static struct task_struct *find_early_kistatic struct task_struct *task_early_kill (struct task_struct *tsk,int force_early) { -struct task_struct *t;if (!tsk->mm)return NULL ;if (force_early)return tsk; - t =find_early_kill_thread (tsk); -if (t) -return t; -if (sysctl_memory_failure_early_kill) -return tsk; -return NULL ; +return find_early_kill_thread (tsk); }/*
_
Patches currently in -mm which might be from [email protected] are
mm-memory-failure-prioritize-prctlpr_mce_kill-over-vmmemory_failure_early_kill.patch mm-memory-failure-send-sigbusbus_mceerr_ar-only-to-current-thread.patch
+ mm-memory-failure-send-sigbusbus_mceerr_ar-only-to-current-thread.patch added to -mm tree
In reply to a message not in the archiveThe patch titled Subject: mm/memory-failure: send SIGBUS(BUS_MCEERR_AR) only to current thread has been added to the -mm tree. Its filename is…
The patch titled
Subject: mm/memory-failure: send SIGBUS(BUS_MCEERR_AR) only to current thread
has been added to the -mm tree. Its filename is
mm-memory-failure-send-sigbusbus_mceerr_ar-only-to-current-thread.patch
This patch should soon appear at
http://ozlabs.org/~akpm/mmots/broken-out/mm-memory-failure-send-sigbusbus_mceerr_ar-only-to-current-thread.patch
and later at
http://ozlabs.org/~akpm/mmotm/broken-out/mm-memory-failure-send-sigbusbus_mceerr_ar-only-to-current-thread.patch
Before you just go and hit "reply", please:
a) Consider who else should be cc'ed
b) Prefer to cc a suitable mailing list as well
c) Ideally: find the original patch on the mailing list and do a reply-to-all to that, adding suitable additional cc's
*** Remember to use Documentation/process/submit-checklist.rst when testing your code ***
The -mm tree is included into linux-next and is updated there every 3-4 working days
------------------------------------------------------
From: Naoya Horiguchi <[email protected]>
Subject: mm/memory-failure: send SIGBUS(BUS_MCEERR_AR) only to current thread
Action Required memory error should happen only when a processor is about to access to a corrupted memory, so it's synchronous and only affects current process/thread. Recently commit 872e9a205c84 ("mm,memory_failure: don't send BUS_MCEERR_AO for action required error") fixed the issue that Action Required memory could unnecessarily send SIGBUS to the processes which share the error memory. But we still have another issue that we could send SIGBUS to a wrong thread.
This is because collect_procs() and task_early_kill() fails to add the current process to "to-kill" list. So this patch is suggesting to fix it. With this fix, SIGBUS(BUS_MCEERR_AR) is never sent to non-current process/thread.
---
mm/memory-failure.c | 23 ++++++++++++++++------- 1 file changed, 16 insertions(+), 7 deletions(-)
mm/memory-failure.c renamed from mm/memory-failure.c~mm-memory-failure-send-sigbusbus_mceerr_ar-only-to-current-thread +16 -7
@@ -212,15 +212,13 @@ static int kill_proc(struct to_kill *tk,short addr_lsb = tk->size_shift;int ret =0 ; -if ((t->mm == current->mm) || !(flags &MF_ACTION_REQUIRED )) -pr_err ("Memory failure: %#lx: Sending SIGBUS to %s:%d due to hardware memory corruption\n" , +pr_err ("Memory failure: %#lx: Sending SIGBUS to %s:%d due to hardware memory corruption\n" , pfn, t->comm, t->pid);if (flags &MF_ACTION_REQUIRED ) { -if (t->mm == current->mm) - ret =force_sig_mceerr (BUS_MCEERR_AR , +WARN_ON_ONCE (t != current); + ret =force_sig_mceerr (BUS_MCEERR_AR , (void __user *)tk->addr, addr_lsb); -/* send no signal to non-current processes */ }else {/* * Don't use force here, it's convenient if the signal
@@ -419,14 +417,25 @@ static struct task_struct *find_early_ki* to be signaled when some page under the process is hwpoisoned. * Return task_struct of the dedicated thread (main thread unless explicitly * specified) if the process is "early kill," and otherwise returns NULL. +* +* Note that the above is true for Action Optional case, but not for Action +* Required case where SIGBUS should sent only to the current thread. */ static struct task_struct *task_early_kill (struct task_struct *tsk,int force_early) {if (!tsk->mm)return NULL ; -if (force_early) -return tsk; +if (force_early) { +/* +* Comparing ->mm here because current task might represent +* a subthread, while tsk always points to the main thread. +*/ +if (tsk->mm == current->mm) +return current; +else +return NULL ; + }return find_early_kill_thread (tsk); }
_
Patches currently in -mm which might be from [email protected] are
mm-memory-failure-prioritize-prctlpr_mce_kill-over-vmmemory_failure_early_kill.patch mm-memory-failure-send-sigbusbus_mceerr_ar-only-to-current-thread.patch
+ fs-ocfs2-fix-spelling-mistake-and-grammar.patch added to -mm tree
In reply to a message not in the archiveThe patch titled Subject: ocfs2: fix spelling mistake and grammar has been added to the -mm tree. Its filename is fs-ocfs2-fix-spelling-mistake-and-grammar.patch
The patch titled
Subject: ocfs2: fix spelling mistake and grammar
has been added to the -mm tree. Its filename is
fs-ocfs2-fix-spelling-mistake-and-grammar.patch
This patch should soon appear at
http://ozlabs.org/~akpm/mmots/broken-out/fs-ocfs2-fix-spelling-mistake-and-grammar.patch
and later at
http://ozlabs.org/~akpm/mmotm/broken-out/fs-ocfs2-fix-spelling-mistake-and-grammar.patch
Before you just go and hit "reply", please:
a) Consider who else should be cc'ed
b) Prefer to cc a suitable mailing list as well
c) Ideally: find the original patch on the mailing list and do a reply-to-all to that, adding suitable additional cc's
*** Remember to use Documentation/process/submit-checklist.rst when testing your code ***
The -mm tree is included into linux-next and is updated there every 3-4 working days
------------------------------------------------------
From: Keyur Patel <[email protected]>
Subject: ocfs2: fix spelling mistake and grammar
./ocfs2/mmap.c:65: bebongs ==> belonging
---
fs/ocfs2/mmap.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
fs/ocfs2/mmap.c renamed from fs/ocfs2/mmap.c~fs-ocfs2-fix-spelling-mistake-and-grammar +1 -1
@@ -62,7 +62,7 @@ static vm_fault_t __ocfs2_page_mkwrite(s last_index = (size -1 ) >>PAGE_SHIFT ;/* -* There are cases that lead to the page no longer bebongs to the +* There are cases that lead to the page no longer belonging to the * mapping. * 1) pagecache truncates locally due to memory pressure. * 2) pagecache truncates when another is taking EX lock against
_
Patches currently in -mm which might be from [email protected] are
fs-ocfs2-fix-spelling-mistake-and-grammar.patch
+ fix-build-failure-of-ocfs2-when-tcp-ip-is-disabled.patch added to -mm tree
In reply to a message not in the archiveThe patch titled Subject: ocfs2: fix build failure when TCP/IP is disabled has been added to the -mm tree. Its filename is fix-build-failure-of-ocfs2-when-tcp-ip-is-disabled.patch
The patch titled
Subject: ocfs2: fix build failure when TCP/IP is disabled
has been added to the -mm tree. Its filename is
fix-build-failure-of-ocfs2-when-tcp-ip-is-disabled.patch
This patch should soon appear at
http://ozlabs.org/~akpm/mmots/broken-out/fix-build-failure-of-ocfs2-when-tcp-ip-is-disabled.patch
and later at
http://ozlabs.org/~akpm/mmotm/broken-out/fix-build-failure-of-ocfs2-when-tcp-ip-is-disabled.patch
Before you just go and hit "reply", please:
a) Consider who else should be cc'ed
b) Prefer to cc a suitable mailing list as well
c) Ideally: find the original patch on the mailing list and do a reply-to-all to that, adding suitable additional cc's
*** Remember to use Documentation/process/submit-checklist.rst when testing your code ***
The -mm tree is included into linux-next and is updated there every 3-4 working days
------------------------------------------------------
From: Tom Seewald <[email protected]>
Subject: ocfs2: fix build failure when TCP/IP is disabled
After commit 12abc5ee7873 ("tcp: add tcp_sock_set_nodelay") and commit c488aeadcbd0 ("tcp: add tcp_sock_set_user_timeout"), building the kernel with OCFS2_FS=y but without INET=y causes it to fail with:
ld: fs/ocfs2/cluster/tcp.o: in function `o2net_accept_many':
tcp.c:(.text+0x21b1): undefined reference to `tcp_sock_set_nodelay'
ld: tcp.c:(.text+0x21c1): undefined reference to `tcp_sock_set_user_timeout '
ld: fs/ocfs2/cluster/tcp.o: in function `o2net_start_connect':
tcp.c:(.text+0x2633): undefined reference to `tcp_sock_set_nodelay'
ld: tcp.c:(.text+0x2643): undefined reference to `tcp_sock_set_user_timeout '
This is due to tcp_sock_set_nodelay() and tcp_sock_set_user_timeout() being declared in linux/tcp.h and defined in net/ipv4/tcp.c, which depend on TCP/IP being enabled.
To fix this, make OCFS2_FS depend on INET=y which already requires NET=y.
12abc5ee7873 ("tcp: add tcp_sock_set_nodelay") and commit
---
fs/ocfs2/Kconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
fs/ocfs2/Kconfig renamed from fs/ocfs2/Kconfig~fix-build-failure-of-ocfs2-when-tcp-ip-is-disabled +1 -1
@@ -1,7 +1,7 @@ # SPDX-License-Identifier: GPL-2.0-only config OCFS2_FS tristate "OCFS2 file system support" - depends on NET && SYSFS && CONFIGFS_FS + depends on INET && SYSFS && CONFIGFS_FS select JBD2 select CRC32 select QUOTA
_
Patches currently in -mm which might be from [email protected] are
fix-build-failure-of-ocfs2-when-tcp-ip-is-disabled.patch
+ mm-pgtable-add-shortcuts-for-accessing-kernel-pmd-and-pte-fix-3.patch added to -mm tree
In reply to a message not in the archiveThe patch titled Subject: mm-pgtable-add-shortcuts-for-accessing-kernel-pmd-and-pte-fix-3 has been added to the -mm tree. Its filename is…
The patch titled
Subject: mm-pgtable-add-shortcuts-for-accessing-kernel-pmd-and-pte-fix-3
has been added to the -mm tree. Its filename is
mm-pgtable-add-shortcuts-for-accessing-kernel-pmd-and-pte-fix-3.patch
This patch should soon appear at
http://ozlabs.org/~akpm/mmots/broken-out/mm-pgtable-add-shortcuts-for-accessing-kernel-pmd-and-pte-fix-3.patch
and later at
http://ozlabs.org/~akpm/mmotm/broken-out/mm-pgtable-add-shortcuts-for-accessing-kernel-pmd-and-pte-fix-3.patch
Before you just go and hit "reply", please:
a) Consider who else should be cc'ed
b) Prefer to cc a suitable mailing list as well
c) Ideally: find the original patch on the mailing list and do a reply-to-all to that, adding suitable additional cc's
*** Remember to use Documentation/process/submit-checklist.rst when testing your code ***
The -mm tree is included into linux-next and is updated there every 3-4 working days
------------------------------------------------------
From: Andrew Morton <[email protected]>
Subject: mm-pgtable-add-shortcuts-for-accessing-kernel-pmd-and-pte-fix-3
s/pmd_ptr_k/pmd_off_k/ in various places
---
arch/powerpc/mm/kasan/8xx.c | 4 ++-- arch/powerpc/mm/kasan/book3s_32.c | 2 +- arch/powerpc/mm/nohash/8xx.c | 2 +- arch/powerpc/mm/pgtable_32.c | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-)
arch/powerpc/mm/nohash/8xx.c renamed from arch/powerpc/mm/nohash/8xx.c~mm-pgtable-add-shortcuts-for-accessing-kernel-pmd-and-pte-fix-3 +1 -1
@@ -74,7 +74,7 @@ static pte_t __init *early_hugepd_alloc_static int __ref __early_map_kernel_hugepage (unsigned long va,phys_addr_t pa,pgprot_t prot,int psize,bool new) { -pmd_t *pmdp =pmd_ptr_k (va); +pmd_t *pmdp =pmd_off_k (va);pte_t *ptep;if (WARN_ON (psize !=MMU_PAGE_512K && psize !=MMU_PAGE_8M ))
arch/powerpc/mm/pgtable_32.c renamed from arch/powerpc/mm/pgtable_32.c~mm-pgtable-add-shortcuts-for-accessing-kernel-pmd-and-pte-fix-3 +1 -1
@@ -40,7 +40,7 @@ notrace void __init early_ioremap_init(v {unsigned long addr =ALIGN_DOWN (FIXADDR_START ,PGDIR_SIZE );pte_t *ptep = (pte_t *)early_fixmap_pagetable; -pmd_t *pmdp =pmd_ptr_k (addr); +pmd_t *pmdp =pmd_off_k (addr);for (; (s32)(FIXADDR_TOP - addr) >0 ; addr +=PGDIR_SIZE , ptep +=PTRS_PER_PTE , pmdp++)
arch/powerpc/mm/kasan/8xx.c renamed from arch/powerpc/mm/kasan/8xx.c~mm-pgtable-add-shortcuts-for-accessing-kernel-pmd-and-pte-fix-3 +2 -2
@@ -10,7 +10,7 @@static int __init kasan_init_shadow_8M (unsigned long k_start,unsigned long k_end,void *block) { -pmd_t *pmd =pmd_ptr_k (k_start); +pmd_t *pmd =pmd_off_k (k_start);unsigned long k_cur, k_next;for (k_cur = k_start; k_cur != k_end; k_cur = k_next, pmd +=2 , block +=SZ_8M ) {
@@ -59,7 +59,7 @@ int __init kasan_init_region(void *startreturn ret;for (; k_cur < k_end; k_cur +=PAGE_SIZE ) { -pmd_t *pmd =pmd_ptr_k (k_cur); +pmd_t *pmd =pmd_off_k (k_cur);void *va = block + k_cur - k_start;pte_t pte =pfn_pte (PHYS_PFN (__pa (va)),PAGE_KERNEL );
arch/powerpc/mm/kasan/book3s_32.c renamed from arch/powerpc/mm/kasan/book3s_32.c~mm-pgtable-add-shortcuts-for-accessing-kernel-pmd-and-pte-fix-3 +1 -1
@@ -46,7 +46,7 @@ int __init kasan_init_region(void *startkasan_update_early_region (k_start, k_cur,__pte (0 ));for (; k_cur < k_end; k_cur +=PAGE_SIZE ) { -pmd_t *pmd =pmd_ptr_k (k_cur); +pmd_t *pmd =pmd_off_k (k_cur);void *va = block + k_cur - k_start;pte_t pte =pfn_pte (PHYS_PFN (__pa (va)),PAGE_KERNEL );
_
Patches currently in -mm which might be from [email protected] are
mm-pgtable-add-shortcuts-for-accessing-kernel-pmd-and-pte-fix-3.patch mm-consolidate-pgd_index-and-pgd_offset_k-definitions-fix.patch mmap-locking-api-convert-mmap_sem-call-sites-missed-by-coccinelle-fix.patch mmap-locking-api-convert-mmap_sem-call-sites-missed-by-coccinelle-fix-fix.patch mmap-locking-api-convert-mmap_sem-call-sites-missed-by-coccinelle-fix-fix-fix.patch mmap-locking-api-rename-mmap_sem-to-mmap_lock-fix.patch mmap-locking-api-convert-mmap_sem-comments-fix.patch mmap-locking-api-convert-mmap_sem-comments-fix-fix.patch mmap-locking-api-convert-mmap_sem-comments-fix-fix-fix.patch maccess-unify-the-probe-kernel-arch-hooks-fix.patch bpf-bpf_seq_printf-handle-potentially-unsafe-format-string-better.patch maccess-always-use-strict-semantics-for-probe_kernel_read-fix.patch x86-use-non-set_fs-based-maccess-routines-checkpatch-fixes.patch drivers-tty-serial-sh-scic-suppress-uninitialized-var-warning.patch mm.patch
lib-test-get_count_order-long-in-test_bitopsc-fix.patch lib-test-get_count_order-long-in-test_bitopsc-fix-fix.patch ipc-convert-ipcs_idr-to-xarray-update-fix.patch linux-next-git-rejects.patch
mm-pass-task-and-mm-to-do_madvise.patch mm-introduce-external-memory-hinting-api-fix-2-fix.patch mm-support-vector-address-ranges-for-process_madvise-fix-fix-fix-fix-fix.patch kernel-forkc-export-kernel_thread-to-modules.patch