diff options
| -rw-r--r-- | .gitignore | 1 | ||||
| -rw-r--r-- | Documentation/DocBook/device-drivers.tmpl | 2 | ||||
| -rw-r--r-- | MAINTAINERS | 2 | ||||
| -rw-r--r-- | arch/x86/platform/ce4100/ce4100.c | 1 | ||||
| -rw-r--r-- | drivers/accessibility/braille/braille_console.c | 9 | ||||
| -rw-r--r-- | drivers/firmware/dmi_scan.c | 14 | ||||
| -rw-r--r-- | drivers/rapidio/rio.c | 4 | ||||
| -rw-r--r-- | drivers/rtc/rtc-twl.c | 3 | ||||
| -rw-r--r-- | fs/ocfs2/refcounttree.c | 5 | ||||
| -rw-r--r-- | include/linux/vmpressure.h | 3 | ||||
| -rw-r--r-- | kernel/Makefile | 3 | ||||
| -rw-r--r-- | kernel/printk/Makefile | 2 | ||||
| -rw-r--r-- | kernel/printk/braille.c | 48 | ||||
| -rw-r--r-- | kernel/printk/braille.h | 48 | ||||
| -rw-r--r-- | kernel/printk/console_cmdline.h | 14 | ||||
| -rw-r--r-- | kernel/printk/printk.c (renamed from kernel/printk.c) | 183 | ||||
| -rw-r--r-- | kernel/sched/fair.c | 4 | ||||
| -rw-r--r-- | mm/huge_memory.c | 4 | ||||
| -rw-r--r-- | mm/memcontrol.c | 1 | ||||
| -rw-r--r-- | mm/mempolicy.c | 6 | ||||
| -rw-r--r-- | mm/mmap.c | 2 | ||||
| -rw-r--r-- | mm/swap.c | 29 | ||||
| -rw-r--r-- | mm/vmpressure.c | 28 | ||||
| -rw-r--r-- | mm/zbud.c | 2 |
24 files changed, 271 insertions, 147 deletions
diff --git a/.gitignore b/.gitignore index 3b8b9b33be38..7e9932e55475 100644 --- a/.gitignore +++ b/.gitignore | |||
| @@ -29,6 +29,7 @@ modules.builtin | |||
| 29 | *.bz2 | 29 | *.bz2 |
| 30 | *.lzma | 30 | *.lzma |
| 31 | *.xz | 31 | *.xz |
| 32 | *.lz4 | ||
| 32 | *.lzo | 33 | *.lzo |
| 33 | *.patch | 34 | *.patch |
| 34 | *.gcno | 35 | *.gcno |
diff --git a/Documentation/DocBook/device-drivers.tmpl b/Documentation/DocBook/device-drivers.tmpl index cbfdf5486639..fe397f90a34f 100644 --- a/Documentation/DocBook/device-drivers.tmpl +++ b/Documentation/DocBook/device-drivers.tmpl | |||
| @@ -84,7 +84,7 @@ X!Iinclude/linux/kobject.h | |||
| 84 | 84 | ||
| 85 | <sect1><title>Kernel utility functions</title> | 85 | <sect1><title>Kernel utility functions</title> |
| 86 | !Iinclude/linux/kernel.h | 86 | !Iinclude/linux/kernel.h |
| 87 | !Ekernel/printk.c | 87 | !Ekernel/printk/printk.c |
| 88 | !Ekernel/panic.c | 88 | !Ekernel/panic.c |
| 89 | !Ekernel/sys.c | 89 | !Ekernel/sys.c |
| 90 | !Ekernel/rcupdate.c | 90 | !Ekernel/rcupdate.c |
diff --git a/MAINTAINERS b/MAINTAINERS index a26b10e52aea..d83f70ffdbed 100644 --- a/MAINTAINERS +++ b/MAINTAINERS | |||
| @@ -2871,7 +2871,7 @@ F: drivers/media/usb/dvb-usb-v2/dvb_usb* | |||
| 2871 | F: drivers/media/usb/dvb-usb-v2/usb_urb.c | 2871 | F: drivers/media/usb/dvb-usb-v2/usb_urb.c |
| 2872 | 2872 | ||
| 2873 | DYNAMIC DEBUG | 2873 | DYNAMIC DEBUG |
| 2874 | M: Jason Baron <jbaron@redhat.com> | 2874 | M: Jason Baron <jbaron@akamai.com> |
| 2875 | S: Maintained | 2875 | S: Maintained |
| 2876 | F: lib/dynamic_debug.c | 2876 | F: lib/dynamic_debug.c |
| 2877 | F: include/linux/dynamic_debug.h | 2877 | F: include/linux/dynamic_debug.h |
diff --git a/arch/x86/platform/ce4100/ce4100.c b/arch/x86/platform/ce4100/ce4100.c index 643b8b5eee86..8244f5ec2f4c 100644 --- a/arch/x86/platform/ce4100/ce4100.c +++ b/arch/x86/platform/ce4100/ce4100.c | |||
| @@ -12,6 +12,7 @@ | |||
| 12 | #include <linux/kernel.h> | 12 | #include <linux/kernel.h> |
| 13 | #include <linux/irq.h> | 13 | #include <linux/irq.h> |
| 14 | #include <linux/module.h> | 14 | #include <linux/module.h> |
| 15 | #include <linux/reboot.h> | ||
| 15 | #include <linux/serial_reg.h> | 16 | #include <linux/serial_reg.h> |
| 16 | #include <linux/serial_8250.h> | 17 | #include <linux/serial_8250.h> |
| 17 | #include <linux/reboot.h> | 18 | #include <linux/reboot.h> |
diff --git a/drivers/accessibility/braille/braille_console.c b/drivers/accessibility/braille/braille_console.c index d21167bfc865..dc34a5b8bcee 100644 --- a/drivers/accessibility/braille/braille_console.c +++ b/drivers/accessibility/braille/braille_console.c | |||
| @@ -359,6 +359,9 @@ int braille_register_console(struct console *console, int index, | |||
| 359 | char *console_options, char *braille_options) | 359 | char *console_options, char *braille_options) |
| 360 | { | 360 | { |
| 361 | int ret; | 361 | int ret; |
| 362 | |||
| 363 | if (!(console->flags & CON_BRL)) | ||
| 364 | return 0; | ||
| 362 | if (!console_options) | 365 | if (!console_options) |
| 363 | /* Only support VisioBraille for now */ | 366 | /* Only support VisioBraille for now */ |
| 364 | console_options = "57600o8"; | 367 | console_options = "57600o8"; |
| @@ -374,15 +377,17 @@ int braille_register_console(struct console *console, int index, | |||
| 374 | braille_co = console; | 377 | braille_co = console; |
| 375 | register_keyboard_notifier(&keyboard_notifier_block); | 378 | register_keyboard_notifier(&keyboard_notifier_block); |
| 376 | register_vt_notifier(&vt_notifier_block); | 379 | register_vt_notifier(&vt_notifier_block); |
| 377 | return 0; | 380 | return 1; |
| 378 | } | 381 | } |
| 379 | 382 | ||
| 380 | int braille_unregister_console(struct console *console) | 383 | int braille_unregister_console(struct console *console) |
| 381 | { | 384 | { |
| 382 | if (braille_co != console) | 385 | if (braille_co != console) |
| 383 | return -EINVAL; | 386 | return -EINVAL; |
| 387 | if (!(console->flags & CON_BRL)) | ||
| 388 | return 0; | ||
| 384 | unregister_keyboard_notifier(&keyboard_notifier_block); | 389 | unregister_keyboard_notifier(&keyboard_notifier_block); |
| 385 | unregister_vt_notifier(&vt_notifier_block); | 390 | unregister_vt_notifier(&vt_notifier_block); |
| 386 | braille_co = NULL; | 391 | braille_co = NULL; |
| 387 | return 0; | 392 | return 1; |
| 388 | } | 393 | } |
diff --git a/drivers/firmware/dmi_scan.c b/drivers/firmware/dmi_scan.c index eb760a218da4..232fa8fce26a 100644 --- a/drivers/firmware/dmi_scan.c +++ b/drivers/firmware/dmi_scan.c | |||
| @@ -419,6 +419,13 @@ static void __init dmi_format_ids(char *buf, size_t len) | |||
| 419 | dmi_get_system_info(DMI_BIOS_DATE)); | 419 | dmi_get_system_info(DMI_BIOS_DATE)); |
| 420 | } | 420 | } |
| 421 | 421 | ||
| 422 | /* | ||
| 423 | * Check for DMI/SMBIOS headers in the system firmware image. Any | ||
| 424 | * SMBIOS header must start 16 bytes before the DMI header, so take a | ||
| 425 | * 32 byte buffer and check for DMI at offset 16 and SMBIOS at offset | ||
| 426 | * 0. If the DMI header is present, set dmi_ver accordingly (SMBIOS | ||
| 427 | * takes precedence) and return 0. Otherwise return 1. | ||
| 428 | */ | ||
| 422 | static int __init dmi_present(const u8 *buf) | 429 | static int __init dmi_present(const u8 *buf) |
| 423 | { | 430 | { |
| 424 | int smbios_ver; | 431 | int smbios_ver; |
| @@ -506,6 +513,13 @@ void __init dmi_scan_machine(void) | |||
| 506 | if (p == NULL) | 513 | if (p == NULL) |
| 507 | goto error; | 514 | goto error; |
| 508 | 515 | ||
| 516 | /* | ||
| 517 | * Iterate over all possible DMI header addresses q. | ||
| 518 | * Maintain the 32 bytes around q in buf. On the | ||
| 519 | * first iteration, substitute zero for the | ||
| 520 | * out-of-range bytes so there is no chance of falsely | ||
| 521 | * detecting an SMBIOS header. | ||
| 522 | */ | ||
| 509 | memset(buf, 0, 16); | 523 | memset(buf, 0, 16); |
| 510 | for (q = p; q < p + 0x10000; q += 16) { | 524 | for (q = p; q < p + 0x10000; q += 16) { |
| 511 | memcpy_fromio(buf + 16, q, 16); | 525 | memcpy_fromio(buf + 16, q, 16); |
diff --git a/drivers/rapidio/rio.c b/drivers/rapidio/rio.c index f4f30af2df68..2e8a20cac588 100644 --- a/drivers/rapidio/rio.c +++ b/drivers/rapidio/rio.c | |||
| @@ -1715,11 +1715,13 @@ int rio_unregister_scan(int mport_id, struct rio_scan *scan_ops) | |||
| 1715 | (mport_id == RIO_MPORT_ANY && port->nscan == scan_ops)) | 1715 | (mport_id == RIO_MPORT_ANY && port->nscan == scan_ops)) |
| 1716 | port->nscan = NULL; | 1716 | port->nscan = NULL; |
| 1717 | 1717 | ||
| 1718 | list_for_each_entry(scan, &rio_scans, node) | 1718 | list_for_each_entry(scan, &rio_scans, node) { |
| 1719 | if (scan->mport_id == mport_id) { | 1719 | if (scan->mport_id == mport_id) { |
| 1720 | list_del(&scan->node); | 1720 | list_del(&scan->node); |
| 1721 | kfree(scan); | 1721 | kfree(scan); |
| 1722 | break; | ||
| 1722 | } | 1723 | } |
| 1724 | } | ||
| 1723 | 1725 | ||
| 1724 | mutex_unlock(&rio_mport_list_lock); | 1726 | mutex_unlock(&rio_mport_list_lock); |
| 1725 | 1727 | ||
diff --git a/drivers/rtc/rtc-twl.c b/drivers/rtc/rtc-twl.c index 02faf3c4e0d5..c2e80d7ca5e2 100644 --- a/drivers/rtc/rtc-twl.c +++ b/drivers/rtc/rtc-twl.c | |||
| @@ -524,6 +524,8 @@ static int twl_rtc_probe(struct platform_device *pdev) | |||
| 524 | if (ret < 0) | 524 | if (ret < 0) |
| 525 | goto out1; | 525 | goto out1; |
| 526 | 526 | ||
| 527 | device_init_wakeup(&pdev->dev, 1); | ||
| 528 | |||
| 527 | rtc = rtc_device_register(pdev->name, | 529 | rtc = rtc_device_register(pdev->name, |
| 528 | &pdev->dev, &twl_rtc_ops, THIS_MODULE); | 530 | &pdev->dev, &twl_rtc_ops, THIS_MODULE); |
| 529 | if (IS_ERR(rtc)) { | 531 | if (IS_ERR(rtc)) { |
| @@ -542,7 +544,6 @@ static int twl_rtc_probe(struct platform_device *pdev) | |||
| 542 | } | 544 | } |
| 543 | 545 | ||
| 544 | platform_set_drvdata(pdev, rtc); | 546 | platform_set_drvdata(pdev, rtc); |
| 545 | device_init_wakeup(&pdev->dev, 1); | ||
| 546 | return 0; | 547 | return 0; |
| 547 | 548 | ||
| 548 | out2: | 549 | out2: |
diff --git a/fs/ocfs2/refcounttree.c b/fs/ocfs2/refcounttree.c index 998b17eda09d..9f6b96a09615 100644 --- a/fs/ocfs2/refcounttree.c +++ b/fs/ocfs2/refcounttree.c | |||
| @@ -2965,6 +2965,11 @@ int ocfs2_duplicate_clusters_by_page(handle_t *handle, | |||
| 2965 | to = map_end & (PAGE_CACHE_SIZE - 1); | 2965 | to = map_end & (PAGE_CACHE_SIZE - 1); |
| 2966 | 2966 | ||
| 2967 | page = find_or_create_page(mapping, page_index, GFP_NOFS); | 2967 | page = find_or_create_page(mapping, page_index, GFP_NOFS); |
| 2968 | if (!page) { | ||
| 2969 | ret = -ENOMEM; | ||
| 2970 | mlog_errno(ret); | ||
| 2971 | break; | ||
| 2972 | } | ||
| 2968 | 2973 | ||
| 2969 | /* | 2974 | /* |
| 2970 | * In case PAGE_CACHE_SIZE <= CLUSTER_SIZE, This page | 2975 | * In case PAGE_CACHE_SIZE <= CLUSTER_SIZE, This page |
diff --git a/include/linux/vmpressure.h b/include/linux/vmpressure.h index 76be077340ea..7dc17e2456de 100644 --- a/include/linux/vmpressure.h +++ b/include/linux/vmpressure.h | |||
| @@ -12,7 +12,7 @@ struct vmpressure { | |||
| 12 | unsigned long scanned; | 12 | unsigned long scanned; |
| 13 | unsigned long reclaimed; | 13 | unsigned long reclaimed; |
| 14 | /* The lock is used to keep the scanned/reclaimed above in sync. */ | 14 | /* The lock is used to keep the scanned/reclaimed above in sync. */ |
| 15 | struct mutex sr_lock; | 15 | struct spinlock sr_lock; |
| 16 | 16 | ||
| 17 | /* The list of vmpressure_event structs. */ | 17 | /* The list of vmpressure_event structs. */ |
| 18 | struct list_head events; | 18 | struct list_head events; |
| @@ -30,6 +30,7 @@ extern void vmpressure(gfp_t gfp, struct mem_cgroup *memcg, | |||
| 30 | extern void vmpressure_prio(gfp_t gfp, struct mem_cgroup *memcg, int prio); | 30 | extern void vmpressure_prio(gfp_t gfp, struct mem_cgroup *memcg, int prio); |
| 31 | 31 | ||
| 32 | extern void vmpressure_init(struct vmpressure *vmpr); | 32 | extern void vmpressure_init(struct vmpressure *vmpr); |
| 33 | extern void vmpressure_cleanup(struct vmpressure *vmpr); | ||
| 33 | extern struct vmpressure *memcg_to_vmpressure(struct mem_cgroup *memcg); | 34 | extern struct vmpressure *memcg_to_vmpressure(struct mem_cgroup *memcg); |
| 34 | extern struct cgroup_subsys_state *vmpressure_to_css(struct vmpressure *vmpr); | 35 | extern struct cgroup_subsys_state *vmpressure_to_css(struct vmpressure *vmpr); |
| 35 | extern struct vmpressure *css_to_vmpressure(struct cgroup_subsys_state *css); | 36 | extern struct vmpressure *css_to_vmpressure(struct cgroup_subsys_state *css); |
diff --git a/kernel/Makefile b/kernel/Makefile index 470839d1a30e..35ef1185e359 100644 --- a/kernel/Makefile +++ b/kernel/Makefile | |||
| @@ -2,7 +2,7 @@ | |||
| 2 | # Makefile for the linux kernel. | 2 | # Makefile for the linux kernel. |
| 3 | # | 3 | # |
| 4 | 4 | ||
| 5 | obj-y = fork.o exec_domain.o panic.o printk.o \ | 5 | obj-y = fork.o exec_domain.o panic.o \ |
| 6 | cpu.o exit.o itimer.o time.o softirq.o resource.o \ | 6 | cpu.o exit.o itimer.o time.o softirq.o resource.o \ |
| 7 | sysctl.o sysctl_binary.o capability.o ptrace.o timer.o user.o \ | 7 | sysctl.o sysctl_binary.o capability.o ptrace.o timer.o user.o \ |
| 8 | signal.o sys.o kmod.o workqueue.o pid.o task_work.o \ | 8 | signal.o sys.o kmod.o workqueue.o pid.o task_work.o \ |
| @@ -24,6 +24,7 @@ endif | |||
| 24 | 24 | ||
| 25 | obj-y += sched/ | 25 | obj-y += sched/ |
| 26 | obj-y += power/ | 26 | obj-y += power/ |
| 27 | obj-y += printk/ | ||
| 27 | obj-y += cpu/ | 28 | obj-y += cpu/ |
| 28 | 29 | ||
| 29 | obj-$(CONFIG_CHECKPOINT_RESTORE) += kcmp.o | 30 | obj-$(CONFIG_CHECKPOINT_RESTORE) += kcmp.o |
diff --git a/kernel/printk/Makefile b/kernel/printk/Makefile new file mode 100644 index 000000000000..85405bdcf2b3 --- /dev/null +++ b/kernel/printk/Makefile | |||
| @@ -0,0 +1,2 @@ | |||
| 1 | obj-y = printk.o | ||
| 2 | obj-$(CONFIG_A11Y_BRAILLE_CONSOLE) += braille.o | ||
diff --git a/kernel/printk/braille.c b/kernel/printk/braille.c new file mode 100644 index 000000000000..b51087fb9ace --- /dev/null +++ b/kernel/printk/braille.c | |||
| @@ -0,0 +1,48 @@ | |||
| 1 | #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt | ||
| 2 | |||
| 3 | #include <linux/kernel.h> | ||
| 4 | #include <linux/console.h> | ||
| 5 | #include <linux/string.h> | ||
| 6 | |||
| 7 | #include "console_cmdline.h" | ||
| 8 | #include "braille.h" | ||
| 9 | |||
| 10 | char *_braille_console_setup(char **str, char **brl_options) | ||
| 11 | { | ||
| 12 | if (!memcmp(*str, "brl,", 4)) { | ||
| 13 | *brl_options = ""; | ||
| 14 | *str += 4; | ||
| 15 | } else if (!memcmp(str, "brl=", 4)) { | ||
| 16 | *brl_options = *str + 4; | ||
| 17 | *str = strchr(*brl_options, ','); | ||
| 18 | if (!*str) | ||
| 19 | pr_err("need port name after brl=\n"); | ||
| 20 | else | ||
| 21 | *((*str)++) = 0; | ||
| 22 | } | ||
| 23 | |||
| 24 | return *str; | ||
| 25 | } | ||
| 26 | |||
| 27 | int | ||
| 28 | _braille_register_console(struct console *console, struct console_cmdline *c) | ||
| 29 | { | ||
| 30 | int rtn = 0; | ||
| 31 | |||
| 32 | if (c->brl_options) { | ||
| 33 | console->flags |= CON_BRL; | ||
| 34 | rtn = braille_register_console(console, c->index, c->options, | ||
| 35 | c->brl_options); | ||
| 36 | } | ||
| 37 | |||
| 38 | return rtn; | ||
| 39 | } | ||
| 40 | |||
| 41 | int | ||
| 42 | _braille_unregister_console(struct console *console) | ||
| 43 | { | ||
| 44 | if (console->flags & CON_BRL) | ||
| 45 | return braille_unregister_console(console); | ||
| 46 | |||
| 47 | return 0; | ||
| 48 | } | ||
diff --git a/kernel/printk/braille.h b/kernel/printk/braille.h new file mode 100644 index 000000000000..769d771145c8 --- /dev/null +++ b/kernel/printk/braille.h | |||
| @@ -0,0 +1,48 @@ | |||
| 1 | #ifndef _PRINTK_BRAILLE_H | ||
| 2 | #define _PRINTK_BRAILLE_H | ||
| 3 | |||
| 4 | #ifdef CONFIG_A11Y_BRAILLE_CONSOLE | ||
| 5 | |||
| 6 | static inline void | ||
| 7 | braille_set_options(struct console_cmdline *c, char *brl_options) | ||
| 8 | { | ||
| 9 | c->brl_options = brl_options; | ||
| 10 | } | ||
| 11 | |||
| 12 | char * | ||
| 13 | _braille_console_setup(char **str, char **brl_options); | ||
| 14 | |||
| 15 | int | ||
| 16 | _braille_register_console(struct console *console, struct console_cmdline *c); | ||
| 17 | |||
| 18 | int | ||
| 19 | _braille_unregister_console(struct console *console); | ||
| 20 | |||
| 21 | #else | ||
| 22 | |||
| 23 | static inline void | ||
| 24 | braille_set_options(struct console_cmdline *c, char *brl_options) | ||
| 25 | { | ||
| 26 | } | ||
| 27 | |||
| 28 | static inline char * | ||
| 29 | _braille_console_setup(char **str, char **brl_options) | ||
| 30 | { | ||
| 31 | return NULL; | ||
| 32 | } | ||
| 33 | |||
| 34 | static inline int | ||
| 35 | _braille_register_console(struct console *console, struct console_cmdline *c) | ||
| 36 | { | ||
| 37 | return 0; | ||
| 38 | } | ||
| 39 | |||
| 40 | static inline int | ||
| 41 | _braille_unregister_console(struct console *console) | ||
| 42 | { | ||
| 43 | return 0; | ||
| 44 | } | ||
| 45 | |||
| 46 | #endif | ||
| 47 | |||
| 48 | #endif | ||
diff --git a/kernel/printk/console_cmdline.h b/kernel/printk/console_cmdline.h new file mode 100644 index 000000000000..cbd69d842341 --- /dev/null +++ b/kernel/printk/console_cmdline.h | |||
| @@ -0,0 +1,14 @@ | |||
| 1 | #ifndef _CONSOLE_CMDLINE_H | ||
| 2 | #define _CONSOLE_CMDLINE_H | ||
| 3 | |||
| 4 | struct console_cmdline | ||
| 5 | { | ||
| 6 | char name[8]; /* Name of the driver */ | ||
| 7 | int index; /* Minor dev. to use */ | ||
| 8 | char *options; /* Options for the driver */ | ||
| 9 | #ifdef CONFIG_A11Y_BRAILLE_CONSOLE | ||
| 10 | char *brl_options; /* Options for braille driver */ | ||
| 11 | #endif | ||
| 12 | }; | ||
| 13 | |||
| 14 | #endif | ||
diff --git a/kernel/printk.c b/kernel/printk/printk.c index 69b0890ed7e5..5b5a7080e2a5 100644 --- a/kernel/printk.c +++ b/kernel/printk/printk.c | |||
| @@ -51,6 +51,9 @@ | |||
| 51 | #define CREATE_TRACE_POINTS | 51 | #define CREATE_TRACE_POINTS |
| 52 | #include <trace/events/printk.h> | 52 | #include <trace/events/printk.h> |
| 53 | 53 | ||
| 54 | #include "console_cmdline.h" | ||
| 55 | #include "braille.h" | ||
| 56 | |||
| 54 | /* printk's without a loglevel use this.. */ | 57 | /* printk's without a loglevel use this.. */ |
| 55 | #define DEFAULT_MESSAGE_LOGLEVEL CONFIG_DEFAULT_MESSAGE_LOGLEVEL | 58 | #define DEFAULT_MESSAGE_LOGLEVEL CONFIG_DEFAULT_MESSAGE_LOGLEVEL |
| 56 | 59 | ||
| @@ -105,19 +108,11 @@ static struct console *exclusive_console; | |||
| 105 | /* | 108 | /* |
| 106 | * Array of consoles built from command line options (console=) | 109 | * Array of consoles built from command line options (console=) |
| 107 | */ | 110 | */ |
| 108 | struct console_cmdline | ||
| 109 | { | ||
| 110 | char name[8]; /* Name of the driver */ | ||
| 111 | int index; /* Minor dev. to use */ | ||
| 112 | char *options; /* Options for the driver */ | ||
| 113 | #ifdef CONFIG_A11Y_BRAILLE_CONSOLE | ||
| 114 | char *brl_options; /* Options for braille driver */ | ||
| 115 | #endif | ||
| 116 | }; | ||
| 117 | 111 | ||
| 118 | #define MAX_CMDLINECONSOLES 8 | 112 | #define MAX_CMDLINECONSOLES 8 |
| 119 | 113 | ||
| 120 | static struct console_cmdline console_cmdline[MAX_CMDLINECONSOLES]; | 114 | static struct console_cmdline console_cmdline[MAX_CMDLINECONSOLES]; |
| 115 | |||
| 121 | static int selected_console = -1; | 116 | static int selected_console = -1; |
| 122 | static int preferred_console = -1; | 117 | static int preferred_console = -1; |
| 123 | int console_set_on_cmdline; | 118 | int console_set_on_cmdline; |
| @@ -178,7 +173,7 @@ static int console_may_schedule; | |||
| 178 | * 67 "g" | 173 | * 67 "g" |
| 179 | * 0032 00 00 00 padding to next message header | 174 | * 0032 00 00 00 padding to next message header |
| 180 | * | 175 | * |
| 181 | * The 'struct log' buffer header must never be directly exported to | 176 | * The 'struct printk_log' buffer header must never be directly exported to |
| 182 | * userspace, it is a kernel-private implementation detail that might | 177 | * userspace, it is a kernel-private implementation detail that might |
| 183 | * need to be changed in the future, when the requirements change. | 178 | * need to be changed in the future, when the requirements change. |
| 184 | * | 179 | * |
| @@ -200,7 +195,7 @@ enum log_flags { | |||
| 200 | LOG_CONT = 8, /* text is a fragment of a continuation line */ | 195 | LOG_CONT = 8, /* text is a fragment of a continuation line */ |
| 201 | }; | 196 | }; |
| 202 | 197 | ||
| 203 | struct log { | 198 | struct printk_log { |
| 204 | u64 ts_nsec; /* timestamp in nanoseconds */ | 199 | u64 ts_nsec; /* timestamp in nanoseconds */ |
| 205 | u16 len; /* length of entire record */ | 200 | u16 len; /* length of entire record */ |
| 206 | u16 text_len; /* length of text buffer */ | 201 | u16 text_len; /* length of text buffer */ |
| @@ -248,7 +243,7 @@ static u32 clear_idx; | |||
| 248 | #if defined(CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS) | 243 | #if defined(CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS) |
| 249 | #define LOG_ALIGN 4 | 244 | #define LOG_ALIGN 4 |
| 250 | #else | 245 | #else |
| 251 | #define LOG_ALIGN __alignof__(struct log) | 246 | #define LOG_ALIGN __alignof__(struct printk_log) |
| 252 | #endif | 247 | #endif |
| 253 | #define __LOG_BUF_LEN (1 << CONFIG_LOG_BUF_SHIFT) | 248 | #define __LOG_BUF_LEN (1 << CONFIG_LOG_BUF_SHIFT) |
| 254 | static char __log_buf[__LOG_BUF_LEN] __aligned(LOG_ALIGN); | 249 | static char __log_buf[__LOG_BUF_LEN] __aligned(LOG_ALIGN); |
| @@ -259,35 +254,35 @@ static u32 log_buf_len = __LOG_BUF_LEN; | |||
| 259 | static volatile unsigned int logbuf_cpu = UINT_MAX; | 254 | static volatile unsigned int logbuf_cpu = UINT_MAX; |
| 260 | 255 | ||
| 261 | /* human readable text of the record */ | 256 | /* human readable text of the record */ |
| 262 | static char *log_text(const struct log *msg) | 257 | static char *log_text(const struct printk_log *msg) |
| 263 | { | 258 | { |
| 264 | return (char *)msg + sizeof(struct log); | 259 | return (char *)msg + sizeof(struct printk_log); |
| 265 | } | 260 | } |
| 266 | 261 | ||
| 267 | /* optional key/value pair dictionary attached to the record */ | 262 | /* optional key/value pair dictionary attached to the record */ |
| 268 | static char *log_dict(const struct log *msg) | 263 | static char *log_dict(const struct printk_log *msg) |
| 269 | { | 264 | { |
| 270 | return (char *)msg + sizeof(struct log) + msg->text_len; | 265 | return (char *)msg + sizeof(struct printk_log) + msg->text_len; |
| 271 | } | 266 | } |
| 272 | 267 | ||
| 273 | /* get record by index; idx must point to valid msg */ | 268 | /* get record by index; idx must point to valid msg */ |
| 274 | static struct log *log_from_idx(u32 idx) | 269 | static struct printk_log *log_from_idx(u32 idx) |
| 275 | { | 270 | { |
| 276 | struct log *msg = (struct log *)(log_buf + idx); | 271 | struct printk_log *msg = (struct printk_log *)(log_buf + idx); |
| 277 | 272 | ||
| 278 | /* | 273 | /* |
| 279 | * A length == 0 record is the end of buffer marker. Wrap around and | 274 | * A length == 0 record is the end of buffer marker. Wrap around and |
| 280 | * read the message at the start of the buffer. | 275 | * read the message at the start of the buffer. |
| 281 | */ | 276 | */ |
| 282 | if (!msg->len) | 277 | if (!msg->len) |
| 283 | return (struct log *)log_buf; | 278 | return (struct printk_log *)log_buf; |
| 284 | return msg; | 279 | return msg; |
| 285 | } | 280 | } |
| 286 | 281 | ||
| 287 | /* get next record; idx must point to valid msg */ | 282 | /* get next record; idx must point to valid msg */ |
| 288 | static u32 log_next(u32 idx) | 283 | static u32 log_next(u32 idx) |
| 289 | { | 284 | { |
| 290 | struct log *msg = (struct log *)(log_buf + idx); | 285 | struct printk_log *msg = (struct printk_log *)(log_buf + idx); |
| 291 | 286 | ||
| 292 | /* length == 0 indicates the end of the buffer; wrap */ | 287 | /* length == 0 indicates the end of the buffer; wrap */ |
| 293 | /* | 288 | /* |
| @@ -296,7 +291,7 @@ static u32 log_next(u32 idx) | |||
| 296 | * return the one after that. | 291 | * return the one after that. |
| 297 | */ | 292 | */ |
| 298 | if (!msg->len) { | 293 | if (!msg->len) { |
| 299 | msg = (struct log *)log_buf; | 294 | msg = (struct printk_log *)log_buf; |
| 300 | return msg->len; | 295 | return msg->len; |
| 301 | } | 296 | } |
| 302 | return idx + msg->len; | 297 | return idx + msg->len; |
| @@ -308,11 +303,11 @@ static void log_store(int facility, int level, | |||
| 308 | const char *dict, u16 dict_len, | 303 | const char *dict, u16 dict_len, |
| 309 | const char *text, u16 text_len) | 304 | const char *text, u16 text_len) |
| 310 | { | 305 | { |
| 311 | struct log *msg; | 306 | struct printk_log *msg; |
| 312 | u32 size, pad_len; | 307 | u32 size, pad_len; |
| 313 | 308 | ||
| 314 | /* number of '\0' padding bytes to next message */ | 309 | /* number of '\0' padding bytes to next message */ |
| 315 | size = sizeof(struct log) + text_len + dict_len; | 310 | size = sizeof(struct printk_log) + text_len + dict_len; |
| 316 | pad_len = (-size) & (LOG_ALIGN - 1); | 311 | pad_len = (-size) & (LOG_ALIGN - 1); |
| 317 | size += pad_len; | 312 | size += pad_len; |
| 318 | 313 | ||
| @@ -324,7 +319,7 @@ static void log_store(int facility, int level, | |||
| 324 | else | 319 | else |
| 325 | free = log_first_idx - log_next_idx; | 320 | free = log_first_idx - log_next_idx; |
| 326 | 321 | ||
| 327 | if (free > size + sizeof(struct log)) | 322 | if (free > size + sizeof(struct printk_log)) |
| 328 | break; | 323 | break; |
| 329 | 324 | ||
| 330 | /* drop old messages until we have enough contiuous space */ | 325 | /* drop old messages until we have enough contiuous space */ |
| @@ -332,18 +327,18 @@ static void log_store(int facility, int level, | |||
| 332 | log_first_seq++; | 327 | log_first_seq++; |
| 333 | } | 328 | } |
| 334 | 329 | ||
| 335 | if (log_next_idx + size + sizeof(struct log) >= log_buf_len) { | 330 | if (log_next_idx + size + sizeof(struct printk_log) >= log_buf_len) { |
| 336 | /* | 331 | /* |
| 337 | * This message + an additional empty header does not fit | 332 | * This message + an additional empty header does not fit |
| 338 | * at the end of the buffer. Add an empty header with len == 0 | 333 | * at the end of the buffer. Add an empty header with len == 0 |
| 339 | * to signify a wrap around. | 334 | * to signify a wrap around. |
| 340 | */ | 335 | */ |
| 341 | memset(log_buf + log_next_idx, 0, sizeof(struct log)); | 336 | memset(log_buf + log_next_idx, 0, sizeof(struct printk_log)); |
| 342 | log_next_idx = 0; | 337 | log_next_idx = 0; |
| 343 | } | 338 | } |
| 344 | 339 | ||
| 345 | /* fill message */ | 340 | /* fill message */ |
| 346 | msg = (struct log *)(log_buf + log_next_idx); | 341 | msg = (struct printk_log *)(log_buf + log_next_idx); |
| 347 | memcpy(log_text(msg), text, text_len); | 342 | memcpy(log_text(msg), text, text_len); |
| 348 | msg->text_len = text_len; | 343 | msg->text_len = text_len; |
| 349 | memcpy(log_dict(msg), dict, dict_len); | 344 | memcpy(log_dict(msg), dict, dict_len); |
| @@ -356,7 +351,7 @@ static void log_store(int facility, int level, | |||
| 356 | else | 351 | else |
| 357 | msg->ts_nsec = local_clock(); | 352 | msg->ts_nsec = local_clock(); |
| 358 | memset(log_dict(msg) + dict_len, 0, pad_len); | 353 | memset(log_dict(msg) + dict_len, 0, pad_len); |
| 359 | msg->len = sizeof(struct log) + text_len + dict_len + pad_len; | 354 | msg->len = sizeof(struct printk_log) + text_len + dict_len + pad_len; |
| 360 | 355 | ||
| 361 | /* insert message */ | 356 | /* insert message */ |
| 362 | log_next_idx += msg->len; | 357 | log_next_idx += msg->len; |
| @@ -479,7 +474,7 @@ static ssize_t devkmsg_read(struct file *file, char __user *buf, | |||
| 479 | size_t count, loff_t *ppos) | 474 | size_t count, loff_t *ppos) |
| 480 | { | 475 | { |
| 481 | struct devkmsg_user *user = file->private_data; | 476 | struct devkmsg_user *user = file->private_data; |
| 482 | struct log *msg; | 477 | struct printk_log *msg; |
| 483 | u64 ts_usec; | 478 | u64 ts_usec; |
| 484 | size_t i; | 479 | size_t i; |
| 485 | char cont = '-'; | 480 | char cont = '-'; |
| @@ -724,14 +719,14 @@ void log_buf_kexec_setup(void) | |||
| 724 | VMCOREINFO_SYMBOL(log_first_idx); | 719 | VMCOREINFO_SYMBOL(log_first_idx); |
| 725 | VMCOREINFO_SYMBOL(log_next_idx); | 720 | VMCOREINFO_SYMBOL(log_next_idx); |
| 726 | /* | 721 | /* |
| 727 | * Export struct log size and field offsets. User space tools can | 722 | * Export struct printk_log size and field offsets. User space tools can |
| 728 | * parse it and detect any changes to structure down the line. | 723 | * parse it and detect any changes to structure down the line. |
| 729 | */ | 724 | */ |
| 730 | VMCOREINFO_STRUCT_SIZE(log); | 725 | VMCOREINFO_STRUCT_SIZE(printk_log); |
| 731 | VMCOREINFO_OFFSET(log, ts_nsec); | 726 | VMCOREINFO_OFFSET(printk_log, ts_nsec); |
| 732 | VMCOREINFO_OFFSET(log, len); | 727 | VMCOREINFO_OFFSET(printk_log, len); |
| 733 | VMCOREINFO_OFFSET(log, text_len); | 728 | VMCOREINFO_OFFSET(printk_log, text_len); |
| 734 | VMCOREINFO_OFFSET(log, dict_len); | 729 | VMCOREINFO_OFFSET(printk_log, dict_len); |
| 735 | } | 730 | } |
| 736 | #endif | 731 | #endif |
| 737 | 732 | ||
| @@ -884,7 +879,7 @@ static size_t print_time(u64 ts, char *buf) | |||
| 884 | (unsigned long)ts, rem_nsec / 1000); | 879 | (unsigned long)ts, rem_nsec / 1000); |
| 885 | } | 880 | } |
| 886 | 881 | ||
| 887 | static size_t print_prefix(const struct log *msg, bool syslog, char *buf) | 882 | static size_t print_prefix(const struct printk_log *msg, bool syslog, char *buf) |
| 888 | { | 883 | { |
| 889 | size_t len = 0; | 884 | size_t len = 0; |
| 890 | unsigned int prefix = (msg->facility << 3) | msg->level; | 885 | unsigned int prefix = (msg->facility << 3) | msg->level; |
| @@ -907,7 +902,7 @@ static size_t print_prefix(const struct log *msg, bool syslog, char *buf) | |||
| 907 | return len; | 902 | return len; |
| 908 | } | 903 | } |
| 909 | 904 | ||
| 910 | static size_t msg_print_text(const struct log *msg, enum log_flags prev, | 905 | static size_t msg_print_text(const struct printk_log *msg, enum log_flags prev, |
| 911 | bool syslog, char *buf, size_t size) | 906 | bool syslog, char *buf, size_t size) |
| 912 | { | 907 | { |
| 913 | const char *text = log_text(msg); | 908 | const char *text = log_text(msg); |
| @@ -969,7 +964,7 @@ static size_t msg_print_text(const struct log *msg, enum log_flags prev, | |||
| 969 | static int syslog_print(char __user *buf, int size) | 964 | static int syslog_print(char __user *buf, int size) |
| 970 | { | 965 | { |
| 971 | char *text; | 966 | char *text; |
| 972 | struct log *msg; | 967 | struct printk_log *msg; |
| 973 | int len = 0; | 968 | int len = 0; |
| 974 | 969 | ||
| 975 | text = kmalloc(LOG_LINE_MAX + PREFIX_MAX, GFP_KERNEL); | 970 | text = kmalloc(LOG_LINE_MAX + PREFIX_MAX, GFP_KERNEL); |
| @@ -1060,7 +1055,7 @@ static int syslog_print_all(char __user *buf, int size, bool clear) | |||
| 1060 | idx = clear_idx; | 1055 | idx = clear_idx; |
| 1061 | prev = 0; | 1056 | prev = 0; |
| 1062 | while (seq < log_next_seq) { | 1057 | while (seq < log_next_seq) { |
| 1063 | struct log *msg = log_from_idx(idx); | 1058 | struct printk_log *msg = log_from_idx(idx); |
| 1064 | 1059 | ||
| 1065 | len += msg_print_text(msg, prev, true, NULL, 0); | 1060 | len += msg_print_text(msg, prev, true, NULL, 0); |
| 1066 | prev = msg->flags; | 1061 | prev = msg->flags; |
| @@ -1073,7 +1068,7 @@ static int syslog_print_all(char __user *buf, int size, bool clear) | |||
| 1073 | idx = clear_idx; | 1068 | idx = clear_idx; |
| 1074 | prev = 0; | 1069 | prev = 0; |
| 1075 | while (len > size && seq < log_next_seq) { | 1070 | while (len > size && seq < log_next_seq) { |
| 1076 | struct log *msg = log_from_idx(idx); | 1071 | struct printk_log *msg = log_from_idx(idx); |
| 1077 | 1072 | ||
| 1078 | len -= msg_print_text(msg, prev, true, NULL, 0); | 1073 | len -= msg_print_text(msg, prev, true, NULL, 0); |
| 1079 | prev = msg->flags; | 1074 | prev = msg->flags; |
| @@ -1087,7 +1082,7 @@ static int syslog_print_all(char __user *buf, int size, bool clear) | |||
| 1087 | len = 0; | 1082 | len = 0; |
| 1088 | prev = 0; | 1083 | prev = 0; |
| 1089 | while (len >= 0 && seq < next_seq) { | 1084 | while (len >= 0 && seq < next_seq) { |
| 1090 | struct log *msg = log_from_idx(idx); | 1085 | struct printk_log *msg = log_from_idx(idx); |
| 1091 | int textlen; | 1086 | int textlen; |
| 1092 | 1087 | ||
| 1093 | textlen = msg_print_text(msg, prev, true, text, | 1088 | textlen = msg_print_text(msg, prev, true, text, |
| @@ -1233,7 +1228,7 @@ int do_syslog(int type, char __user *buf, int len, bool from_file) | |||
| 1233 | 1228 | ||
| 1234 | error = 0; | 1229 | error = 0; |
| 1235 | while (seq < log_next_seq) { | 1230 | while (seq < log_next_seq) { |
| 1236 | struct log *msg = log_from_idx(idx); | 1231 | struct printk_log *msg = log_from_idx(idx); |
| 1237 | 1232 | ||
| 1238 | error += msg_print_text(msg, prev, true, NULL, 0); | 1233 | error += msg_print_text(msg, prev, true, NULL, 0); |
| 1239 | idx = log_next(idx); | 1234 | idx = log_next(idx); |
| @@ -1719,10 +1714,10 @@ static struct cont { | |||
| 1719 | u8 level; | 1714 | u8 level; |
| 1720 | bool flushed:1; | 1715 | bool flushed:1; |
| 1721 | } cont; | 1716 | } cont; |
| 1722 | static struct log *log_from_idx(u32 idx) { return NULL; } | 1717 | static struct printk_log *log_from_idx(u32 idx) { return NULL; } |
| 1723 | static u32 log_next(u32 idx) { return 0; } | 1718 | static u32 log_next(u32 idx) { return 0; } |
| 1724 | static void call_console_drivers(int level, const char *text, size_t len) {} | 1719 | static void call_console_drivers(int level, const char *text, size_t len) {} |
| 1725 | static size_t msg_print_text(const struct log *msg, enum log_flags prev, | 1720 | static size_t msg_print_text(const struct printk_log *msg, enum log_flags prev, |
| 1726 | bool syslog, char *buf, size_t size) { return 0; } | 1721 | bool syslog, char *buf, size_t size) { return 0; } |
| 1727 | static size_t cont_print_text(char *text, size_t size) { return 0; } | 1722 | static size_t cont_print_text(char *text, size_t size) { return 0; } |
| 1728 | 1723 | ||
| @@ -1761,23 +1756,23 @@ static int __add_preferred_console(char *name, int idx, char *options, | |||
| 1761 | * See if this tty is not yet registered, and | 1756 | * See if this tty is not yet registered, and |
| 1762 | * if we have a slot free. | 1757 | * if we have a slot free. |
| 1763 | */ | 1758 | */ |
| 1764 | for (i = 0; i < MAX_CMDLINECONSOLES && console_cmdline[i].name[0]; i++) | 1759 | for (i = 0, c = console_cmdline; |
| 1765 | if (strcmp(console_cmdline[i].name, name) == 0 && | 1760 | i < MAX_CMDLINECONSOLES && c->name[0]; |
| 1766 | console_cmdline[i].index == idx) { | 1761 | i++, c++) { |
| 1767 | if (!brl_options) | 1762 | if (strcmp(c->name, name) == 0 && c->index == idx) { |
| 1768 | selected_console = i; | 1763 | if (!brl_options) |
| 1769 | return 0; | 1764 | selected_console = i; |
| 1765 | return 0; | ||
| 1770 | } | 1766 | } |
| 1767 | } | ||
| 1771 | if (i == MAX_CMDLINECONSOLES) | 1768 | if (i == MAX_CMDLINECONSOLES) |
| 1772 | return -E2BIG; | 1769 | return -E2BIG; |
| 1773 | if (!brl_options) | 1770 | if (!brl_options) |
| 1774 | selected_console = i; | 1771 | selected_console = i; |
| 1775 | c = &console_cmdline[i]; | ||
| 1776 | strlcpy(c->name, name, sizeof(c->name)); | 1772 | strlcpy(c->name, name, sizeof(c->name)); |
| 1777 | c->options = options; | 1773 | c->options = options; |
| 1778 | #ifdef CONFIG_A11Y_BRAILLE_CONSOLE | 1774 | braille_set_options(c, brl_options); |
| 1779 | c->brl_options = brl_options; | 1775 | |
| 1780 | #endif | ||
| 1781 | c->index = idx; | 1776 | c->index = idx; |
| 1782 | return 0; | 1777 | return 0; |
| 1783 | } | 1778 | } |
| @@ -1790,20 +1785,8 @@ static int __init console_setup(char *str) | |||
| 1790 | char *s, *options, *brl_options = NULL; | 1785 | char *s, *options, *brl_options = NULL; |
| 1791 | int idx; | 1786 | int idx; |
| 1792 | 1787 | ||
| 1793 | #ifdef CONFIG_A11Y_BRAILLE_CONSOLE | 1788 | if (_braille_console_setup(&str, &brl_options)) |
| 1794 | if (!memcmp(str, "brl,", 4)) { | 1789 | return 1; |
| 1795 | brl_options = ""; | ||
| 1796 | str += 4; | ||
| 1797 | } else if (!memcmp(str, "brl=", 4)) { | ||
| 1798 | brl_options = str + 4; | ||
| 1799 | str = strchr(brl_options, ','); | ||
| 1800 | if (!str) { | ||
| 1801 | printk(KERN_ERR "need port name after brl=\n"); | ||
| 1802 | return 1; | ||
| 1803 | } | ||
| 1804 | *(str++) = 0; | ||
| 1805 | } | ||
| 1806 | #endif | ||
| 1807 | 1790 | ||
| 1808 | /* | 1791 | /* |
| 1809 | * Decode str into name, index, options. | 1792 | * Decode str into name, index, options. |
| @@ -1858,15 +1841,15 @@ int update_console_cmdline(char *name, int idx, char *name_new, int idx_new, cha | |||
| 1858 | struct console_cmdline *c; | 1841 | struct console_cmdline *c; |
| 1859 | int i; | 1842 | int i; |
| 1860 | 1843 | ||
| 1861 | for (i = 0; i < MAX_CMDLINECONSOLES && console_cmdline[i].name[0]; i++) | 1844 | for (i = 0, c = console_cmdline; |
| 1862 | if (strcmp(console_cmdline[i].name, name) == 0 && | 1845 | i < MAX_CMDLINECONSOLES && c->name[0]; |
| 1863 | console_cmdline[i].index == idx) { | 1846 | i++, c++) |
| 1864 | c = &console_cmdline[i]; | 1847 | if (strcmp(c->name, name) == 0 && c->index == idx) { |
| 1865 | strlcpy(c->name, name_new, sizeof(c->name)); | 1848 | strlcpy(c->name, name_new, sizeof(c->name)); |
| 1866 | c->name[sizeof(c->name) - 1] = 0; | 1849 | c->name[sizeof(c->name) - 1] = 0; |
| 1867 | c->options = options; | 1850 | c->options = options; |
| 1868 | c->index = idx_new; | 1851 | c->index = idx_new; |
| 1869 | return i; | 1852 | return i; |
| 1870 | } | 1853 | } |
| 1871 | /* not found */ | 1854 | /* not found */ |
| 1872 | return -1; | 1855 | return -1; |
| @@ -2046,7 +2029,7 @@ void console_unlock(void) | |||
| 2046 | console_cont_flush(text, sizeof(text)); | 2029 | console_cont_flush(text, sizeof(text)); |
| 2047 | again: | 2030 | again: |
| 2048 | for (;;) { | 2031 | for (;;) { |
| 2049 | struct log *msg; | 2032 | struct printk_log *msg; |
| 2050 | size_t len; | 2033 | size_t len; |
| 2051 | int level; | 2034 | int level; |
| 2052 | 2035 | ||
| @@ -2241,6 +2224,7 @@ void register_console(struct console *newcon) | |||
| 2241 | int i; | 2224 | int i; |
| 2242 | unsigned long flags; | 2225 | unsigned long flags; |
| 2243 | struct console *bcon = NULL; | 2226 | struct console *bcon = NULL; |
| 2227 | struct console_cmdline *c; | ||
| 2244 | 2228 | ||
| 2245 | /* | 2229 | /* |
| 2246 | * before we register a new CON_BOOT console, make sure we don't | 2230 | * before we register a new CON_BOOT console, make sure we don't |
| @@ -2288,30 +2272,25 @@ void register_console(struct console *newcon) | |||
| 2288 | * See if this console matches one we selected on | 2272 | * See if this console matches one we selected on |
| 2289 | * the command line. | 2273 | * the command line. |
| 2290 | */ | 2274 | */ |
| 2291 | for (i = 0; i < MAX_CMDLINECONSOLES && console_cmdline[i].name[0]; | 2275 | for (i = 0, c = console_cmdline; |
| 2292 | i++) { | 2276 | i < MAX_CMDLINECONSOLES && c->name[0]; |
| 2293 | if (strcmp(console_cmdline[i].name, newcon->name) != 0) | 2277 | i++, c++) { |
| 2278 | if (strcmp(c->name, newcon->name) != 0) | ||
| 2294 | continue; | 2279 | continue; |
| 2295 | if (newcon->index >= 0 && | 2280 | if (newcon->index >= 0 && |
| 2296 | newcon->index != console_cmdline[i].index) | 2281 | newcon->index != c->index) |
| 2297 | continue; | 2282 | continue; |
| 2298 | if (newcon->index < 0) | 2283 | if (newcon->index < 0) |
| 2299 | newcon->index = console_cmdline[i].index; | 2284 | newcon->index = c->index; |
| 2300 | #ifdef CONFIG_A11Y_BRAILLE_CONSOLE | 2285 | |
| 2301 | if (console_cmdline[i].brl_options) { | 2286 | if (_braille_register_console(newcon, c)) |
| 2302 | newcon->flags |= CON_BRL; | ||
| 2303 | braille_register_console(newcon, | ||
| 2304 | console_cmdline[i].index, | ||
| 2305 | console_cmdline[i].options, | ||
| 2306 | console_cmdline[i].brl_options); | ||
| 2307 | return; | 2287 | return; |
| 2308 | } | 2288 | |
| 2309 | #endif | ||
| 2310 | if (newcon->setup && | 2289 | if (newcon->setup && |
| 2311 | newcon->setup(newcon, console_cmdline[i].options) != 0) | 2290 | newcon->setup(newcon, console_cmdline[i].options) != 0) |
| 2312 | break; | 2291 | break; |
| 2313 | newcon->flags |= CON_ENABLED; | 2292 | newcon->flags |= CON_ENABLED; |
| 2314 | newcon->index = console_cmdline[i].index; | 2293 | newcon->index = c->index; |
| 2315 | if (i == selected_console) { | 2294 | if (i == selected_console) { |
| 2316 | newcon->flags |= CON_CONSDEV; | 2295 | newcon->flags |= CON_CONSDEV; |
| 2317 | preferred_console = selected_console; | 2296 | preferred_console = selected_console; |
| @@ -2394,13 +2373,13 @@ EXPORT_SYMBOL(register_console); | |||
| 2394 | int unregister_console(struct console *console) | 2373 | int unregister_console(struct console *console) |
| 2395 | { | 2374 | { |
| 2396 | struct console *a, *b; | 2375 | struct console *a, *b; |
| 2397 | int res = 1; | 2376 | int res; |
| 2398 | 2377 | ||
| 2399 | #ifdef CONFIG_A11Y_BRAILLE_CONSOLE | 2378 | res = _braille_unregister_console(console); |
| 2400 | if (console->flags & CON_BRL) | 2379 | if (res) |
| 2401 | return braille_unregister_console(console); | 2380 | return res; |
| 2402 | #endif | ||
| 2403 | 2381 | ||
| 2382 | res = 1; | ||
| 2404 | console_lock(); | 2383 | console_lock(); |
| 2405 | if (console_drivers == console) { | 2384 | if (console_drivers == console) { |
| 2406 | console_drivers=console->next; | 2385 | console_drivers=console->next; |
| @@ -2666,7 +2645,7 @@ void kmsg_dump(enum kmsg_dump_reason reason) | |||
| 2666 | bool kmsg_dump_get_line_nolock(struct kmsg_dumper *dumper, bool syslog, | 2645 | bool kmsg_dump_get_line_nolock(struct kmsg_dumper *dumper, bool syslog, |
| 2667 | char *line, size_t size, size_t *len) | 2646 | char *line, size_t size, size_t *len) |
| 2668 | { | 2647 | { |
| 2669 | struct log *msg; | 2648 | struct printk_log *msg; |
| 2670 | size_t l = 0; | 2649 | size_t l = 0; |
| 2671 | bool ret = false; | 2650 | bool ret = false; |
| 2672 | 2651 | ||
| @@ -2778,7 +2757,7 @@ bool kmsg_dump_get_buffer(struct kmsg_dumper *dumper, bool syslog, | |||
| 2778 | idx = dumper->cur_idx; | 2757 | idx = dumper->cur_idx; |
| 2779 | prev = 0; | 2758 | prev = 0; |
| 2780 | while (seq < dumper->next_seq) { | 2759 | while (seq < dumper->next_seq) { |
| 2781 | struct log *msg = log_from_idx(idx); | 2760 | struct printk_log *msg = log_from_idx(idx); |
| 2782 | 2761 | ||
| 2783 | l += msg_print_text(msg, prev, true, NULL, 0); | 2762 | l += msg_print_text(msg, prev, true, NULL, 0); |
| 2784 | idx = log_next(idx); | 2763 | idx = log_next(idx); |
| @@ -2791,7 +2770,7 @@ bool kmsg_dump_get_buffer(struct kmsg_dumper *dumper, bool syslog, | |||
| 2791 | idx = dumper->cur_idx; | 2770 | idx = dumper->cur_idx; |
| 2792 | prev = 0; | 2771 | prev = 0; |
| 2793 | while (l > size && seq < dumper->next_seq) { | 2772 | while (l > size && seq < dumper->next_seq) { |
| 2794 | struct log *msg = log_from_idx(idx); | 2773 | struct printk_log *msg = log_from_idx(idx); |
| 2795 | 2774 | ||
| 2796 | l -= msg_print_text(msg, prev, true, NULL, 0); | 2775 | l -= msg_print_text(msg, prev, true, NULL, 0); |
| 2797 | idx = log_next(idx); | 2776 | idx = log_next(idx); |
| @@ -2806,7 +2785,7 @@ bool kmsg_dump_get_buffer(struct kmsg_dumper *dumper, bool syslog, | |||
| 2806 | l = 0; | 2785 | l = 0; |
| 2807 | prev = 0; | 2786 | prev = 0; |
| 2808 | while (seq < dumper->next_seq) { | 2787 | while (seq < dumper->next_seq) { |
| 2809 | struct log *msg = log_from_idx(idx); | 2788 | struct printk_log *msg = log_from_idx(idx); |
| 2810 | 2789 | ||
| 2811 | l += msg_print_text(msg, prev, syslog, buf + l, size - l); | 2790 | l += msg_print_text(msg, prev, syslog, buf + l, size - l); |
| 2812 | idx = log_next(idx); | 2791 | idx = log_next(idx); |
diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c index bb456f44b7b1..9565645e3202 100644 --- a/kernel/sched/fair.c +++ b/kernel/sched/fair.c | |||
| @@ -851,7 +851,7 @@ void task_numa_fault(int node, int pages, bool migrated) | |||
| 851 | { | 851 | { |
| 852 | struct task_struct *p = current; | 852 | struct task_struct *p = current; |
| 853 | 853 | ||
| 854 | if (!sched_feat_numa(NUMA)) | 854 | if (!numabalancing_enabled) |
| 855 | return; | 855 | return; |
| 856 | 856 | ||
| 857 | /* FIXME: Allocate task-specific structure for placement policy here */ | 857 | /* FIXME: Allocate task-specific structure for placement policy here */ |
| @@ -5786,7 +5786,7 @@ static void task_tick_fair(struct rq *rq, struct task_struct *curr, int queued) | |||
| 5786 | entity_tick(cfs_rq, se, queued); | 5786 | entity_tick(cfs_rq, se, queued); |
| 5787 | } | 5787 | } |
| 5788 | 5788 | ||
| 5789 | if (sched_feat_numa(NUMA)) | 5789 | if (numabalancing_enabled) |
| 5790 | task_tick_numa(rq, curr); | 5790 | task_tick_numa(rq, curr); |
| 5791 | 5791 | ||
| 5792 | update_rq_runnable_avg(rq, 1); | 5792 | update_rq_runnable_avg(rq, 1); |
diff --git a/mm/huge_memory.c b/mm/huge_memory.c index 243e710c6039..a92012a71702 100644 --- a/mm/huge_memory.c +++ b/mm/huge_memory.c | |||
| @@ -1620,7 +1620,9 @@ static void __split_huge_page_refcount(struct page *page, | |||
| 1620 | ((1L << PG_referenced) | | 1620 | ((1L << PG_referenced) | |
| 1621 | (1L << PG_swapbacked) | | 1621 | (1L << PG_swapbacked) | |
| 1622 | (1L << PG_mlocked) | | 1622 | (1L << PG_mlocked) | |
| 1623 | (1L << PG_uptodate))); | 1623 | (1L << PG_uptodate) | |
| 1624 | (1L << PG_active) | | ||
| 1625 | (1L << PG_unevictable))); | ||
| 1624 | page_tail->flags |= (1L << PG_dirty); | 1626 | page_tail->flags |= (1L << PG_dirty); |
| 1625 | 1627 | ||
| 1626 | /* clear PageTail before overwriting first_page */ | 1628 | /* clear PageTail before overwriting first_page */ |
diff --git a/mm/memcontrol.c b/mm/memcontrol.c index 00a7a664b9c1..c290a1cf3862 100644 --- a/mm/memcontrol.c +++ b/mm/memcontrol.c | |||
| @@ -6335,6 +6335,7 @@ static void mem_cgroup_css_offline(struct cgroup *cont) | |||
| 6335 | mem_cgroup_invalidate_reclaim_iterators(memcg); | 6335 | mem_cgroup_invalidate_reclaim_iterators(memcg); |
| 6336 | mem_cgroup_reparent_charges(memcg); | 6336 | mem_cgroup_reparent_charges(memcg); |
| 6337 | mem_cgroup_destroy_all_caches(memcg); | 6337 | mem_cgroup_destroy_all_caches(memcg); |
| 6338 | vmpressure_cleanup(&memcg->vmpressure); | ||
| 6338 | } | 6339 | } |
| 6339 | 6340 | ||
| 6340 | static void mem_cgroup_css_free(struct cgroup *cont) | 6341 | static void mem_cgroup_css_free(struct cgroup *cont) |
diff --git a/mm/mempolicy.c b/mm/mempolicy.c index 74310017296e..4baf12e534d1 100644 --- a/mm/mempolicy.c +++ b/mm/mempolicy.c | |||
| @@ -732,7 +732,10 @@ static int mbind_range(struct mm_struct *mm, unsigned long start, | |||
| 732 | if (prev) { | 732 | if (prev) { |
| 733 | vma = prev; | 733 | vma = prev; |
| 734 | next = vma->vm_next; | 734 | next = vma->vm_next; |
| 735 | continue; | 735 | if (mpol_equal(vma_policy(vma), new_pol)) |
| 736 | continue; | ||
| 737 | /* vma_merge() joined vma && vma->next, case 8 */ | ||
| 738 | goto replace; | ||
| 736 | } | 739 | } |
| 737 | if (vma->vm_start != vmstart) { | 740 | if (vma->vm_start != vmstart) { |
| 738 | err = split_vma(vma->vm_mm, vma, vmstart, 1); | 741 | err = split_vma(vma->vm_mm, vma, vmstart, 1); |
| @@ -744,6 +747,7 @@ static int mbind_range(struct mm_struct *mm, unsigned long start, | |||
| 744 | if (err) | 747 | if (err) |
| 745 | goto out; | 748 | goto out; |
| 746 | } | 749 | } |
| 750 | replace: | ||
| 747 | err = vma_replace_policy(vma, new_pol); | 751 | err = vma_replace_policy(vma, new_pol); |
| 748 | if (err) | 752 | if (err) |
| 749 | goto out; | 753 | goto out; |
| @@ -865,7 +865,7 @@ again: remove_next = 1 + (end > next->vm_end); | |||
| 865 | if (next->anon_vma) | 865 | if (next->anon_vma) |
| 866 | anon_vma_merge(vma, next); | 866 | anon_vma_merge(vma, next); |
| 867 | mm->map_count--; | 867 | mm->map_count--; |
| 868 | vma_set_policy(vma, vma_policy(next)); | 868 | mpol_put(vma_policy(next)); |
| 869 | kmem_cache_free(vm_area_cachep, next); | 869 | kmem_cache_free(vm_area_cachep, next); |
| 870 | /* | 870 | /* |
| 871 | * In mprotect's case 6 (see comments on vma_merge), | 871 | * In mprotect's case 6 (see comments on vma_merge), |
| @@ -512,12 +512,7 @@ EXPORT_SYMBOL(__lru_cache_add); | |||
| 512 | */ | 512 | */ |
| 513 | void lru_cache_add(struct page *page) | 513 | void lru_cache_add(struct page *page) |
| 514 | { | 514 | { |
| 515 | if (PageActive(page)) { | 515 | VM_BUG_ON(PageActive(page) && PageUnevictable(page)); |
| 516 | VM_BUG_ON(PageUnevictable(page)); | ||
| 517 | } else if (PageUnevictable(page)) { | ||
| 518 | VM_BUG_ON(PageActive(page)); | ||
| 519 | } | ||
| 520 | |||
| 521 | VM_BUG_ON(PageLRU(page)); | 516 | VM_BUG_ON(PageLRU(page)); |
| 522 | __lru_cache_add(page); | 517 | __lru_cache_add(page); |
| 523 | } | 518 | } |
| @@ -539,6 +534,7 @@ void add_page_to_unevictable_list(struct page *page) | |||
| 539 | 534 | ||
| 540 | spin_lock_irq(&zone->lru_lock); | 535 | spin_lock_irq(&zone->lru_lock); |
| 541 | lruvec = mem_cgroup_page_lruvec(page, zone); | 536 | lruvec = mem_cgroup_page_lruvec(page, zone); |
| 537 | ClearPageActive(page); | ||
| 542 | SetPageUnevictable(page); | 538 | SetPageUnevictable(page); |
| 543 | SetPageLRU(page); | 539 | SetPageLRU(page); |
| 544 | add_page_to_lru_list(page, lruvec, LRU_UNEVICTABLE); | 540 | add_page_to_lru_list(page, lruvec, LRU_UNEVICTABLE); |
| @@ -774,8 +770,6 @@ EXPORT_SYMBOL(__pagevec_release); | |||
| 774 | void lru_add_page_tail(struct page *page, struct page *page_tail, | 770 | void lru_add_page_tail(struct page *page, struct page *page_tail, |
| 775 | struct lruvec *lruvec, struct list_head *list) | 771 | struct lruvec *lruvec, struct list_head *list) |
| 776 | { | 772 | { |
| 777 | int uninitialized_var(active); | ||
| 778 | enum lru_list lru; | ||
| 779 | const int file = 0; | 773 | const int file = 0; |
| 780 | 774 | ||
| 781 | VM_BUG_ON(!PageHead(page)); | 775 | VM_BUG_ON(!PageHead(page)); |
| @@ -787,20 +781,6 @@ void lru_add_page_tail(struct page *page, struct page *page_tail, | |||
| 787 | if (!list) | 781 | if (!list) |
| 788 | SetPageLRU(page_tail); | 782 | SetPageLRU(page_tail); |
| 789 | 783 | ||
| 790 | if (page_evictable(page_tail)) { | ||
| 791 | if (PageActive(page)) { | ||
| 792 | SetPageActive(page_tail); | ||
| 793 | active = 1; | ||
| 794 | lru = LRU_ACTIVE_ANON; | ||
| 795 | } else { | ||
| 796 | active = 0; | ||
| 797 | lru = LRU_INACTIVE_ANON; | ||
| 798 | } | ||
| 799 | } else { | ||
| 800 | SetPageUnevictable(page_tail); | ||
| 801 | lru = LRU_UNEVICTABLE; | ||
| 802 | } | ||
| 803 | |||
| 804 | if (likely(PageLRU(page))) | 784 | if (likely(PageLRU(page))) |
| 805 | list_add_tail(&page_tail->lru, &page->lru); | 785 | list_add_tail(&page_tail->lru, &page->lru); |
| 806 | else if (list) { | 786 | else if (list) { |
| @@ -816,13 +796,13 @@ void lru_add_page_tail(struct page *page, struct page *page_tail, | |||
| 816 | * Use the standard add function to put page_tail on the list, | 796 | * Use the standard add function to put page_tail on the list, |
| 817 | * but then correct its position so they all end up in order. | 797 | * but then correct its position so they all end up in order. |
| 818 | */ | 798 | */ |
| 819 | add_page_to_lru_list(page_tail, lruvec, lru); | 799 | add_page_to_lru_list(page_tail, lruvec, page_lru(page_tail)); |
| 820 | list_head = page_tail->lru.prev; | 800 | list_head = page_tail->lru.prev; |
| 821 | list_move_tail(&page_tail->lru, list_head); | 801 | list_move_tail(&page_tail->lru, list_head); |
| 822 | } | 802 | } |
| 823 | 803 | ||
| 824 | if (!PageUnevictable(page)) | 804 | if (!PageUnevictable(page)) |
| 825 | update_page_reclaim_stat(lruvec, file, active); | 805 | update_page_reclaim_stat(lruvec, file, PageActive(page_tail)); |
| 826 | } | 806 | } |
| 827 | #endif /* CONFIG_TRANSPARENT_HUGEPAGE */ | 807 | #endif /* CONFIG_TRANSPARENT_HUGEPAGE */ |
| 828 | 808 | ||
| @@ -833,7 +813,6 @@ static void __pagevec_lru_add_fn(struct page *page, struct lruvec *lruvec, | |||
| 833 | int active = PageActive(page); | 813 | int active = PageActive(page); |
| 834 | enum lru_list lru = page_lru(page); | 814 | enum lru_list lru = page_lru(page); |
| 835 | 815 | ||
| 836 | VM_BUG_ON(PageUnevictable(page)); | ||
| 837 | VM_BUG_ON(PageLRU(page)); | 816 | VM_BUG_ON(PageLRU(page)); |
| 838 | 817 | ||
| 839 | SetPageLRU(page); | 818 | SetPageLRU(page); |
diff --git a/mm/vmpressure.c b/mm/vmpressure.c index 736a6011c2c8..0c1e37d829fa 100644 --- a/mm/vmpressure.c +++ b/mm/vmpressure.c | |||
| @@ -180,12 +180,12 @@ static void vmpressure_work_fn(struct work_struct *work) | |||
| 180 | if (!vmpr->scanned) | 180 | if (!vmpr->scanned) |
| 181 | return; | 181 | return; |
| 182 | 182 | ||
| 183 | mutex_lock(&vmpr->sr_lock); | 183 | spin_lock(&vmpr->sr_lock); |
| 184 | scanned = vmpr->scanned; | 184 | scanned = vmpr->scanned; |
| 185 | reclaimed = vmpr->reclaimed; | 185 | reclaimed = vmpr->reclaimed; |
| 186 | vmpr->scanned = 0; | 186 | vmpr->scanned = 0; |
| 187 | vmpr->reclaimed = 0; | 187 | vmpr->reclaimed = 0; |
| 188 | mutex_unlock(&vmpr->sr_lock); | 188 | spin_unlock(&vmpr->sr_lock); |
| 189 | 189 | ||
| 190 | do { | 190 | do { |
| 191 | if (vmpressure_event(vmpr, scanned, reclaimed)) | 191 | if (vmpressure_event(vmpr, scanned, reclaimed)) |
| @@ -240,13 +240,13 @@ void vmpressure(gfp_t gfp, struct mem_cgroup *memcg, | |||
| 240 | if (!scanned) | 240 | if (!scanned) |
| 241 | return; | 241 | return; |
| 242 | 242 | ||
| 243 | mutex_lock(&vmpr->sr_lock); | 243 | spin_lock(&vmpr->sr_lock); |
| 244 | vmpr->scanned += scanned; | 244 | vmpr->scanned += scanned; |
| 245 | vmpr->reclaimed += reclaimed; | 245 | vmpr->reclaimed += reclaimed; |
| 246 | scanned = vmpr->scanned; | 246 | scanned = vmpr->scanned; |
| 247 | mutex_unlock(&vmpr->sr_lock); | 247 | spin_unlock(&vmpr->sr_lock); |
| 248 | 248 | ||
| 249 | if (scanned < vmpressure_win || work_pending(&vmpr->work)) | 249 | if (scanned < vmpressure_win) |
| 250 | return; | 250 | return; |
| 251 | schedule_work(&vmpr->work); | 251 | schedule_work(&vmpr->work); |
| 252 | } | 252 | } |
| @@ -367,8 +367,24 @@ void vmpressure_unregister_event(struct cgroup *cg, struct cftype *cft, | |||
| 367 | */ | 367 | */ |
| 368 | void vmpressure_init(struct vmpressure *vmpr) | 368 | void vmpressure_init(struct vmpressure *vmpr) |
| 369 | { | 369 | { |
| 370 | mutex_init(&vmpr->sr_lock); | 370 | spin_lock_init(&vmpr->sr_lock); |
| 371 | mutex_init(&vmpr->events_lock); | 371 | mutex_init(&vmpr->events_lock); |
| 372 | INIT_LIST_HEAD(&vmpr->events); | 372 | INIT_LIST_HEAD(&vmpr->events); |
| 373 | INIT_WORK(&vmpr->work, vmpressure_work_fn); | 373 | INIT_WORK(&vmpr->work, vmpressure_work_fn); |
| 374 | } | 374 | } |
| 375 | |||
| 376 | /** | ||
| 377 | * vmpressure_cleanup() - shuts down vmpressure control structure | ||
| 378 | * @vmpr: Structure to be cleaned up | ||
| 379 | * | ||
| 380 | * This function should be called before the structure in which it is | ||
| 381 | * embedded is cleaned up. | ||
| 382 | */ | ||
| 383 | void vmpressure_cleanup(struct vmpressure *vmpr) | ||
| 384 | { | ||
| 385 | /* | ||
| 386 | * Make sure there is no pending work before eventfd infrastructure | ||
| 387 | * goes away. | ||
| 388 | */ | ||
| 389 | flush_work(&vmpr->work); | ||
| 390 | } | ||
| @@ -257,7 +257,7 @@ int zbud_alloc(struct zbud_pool *pool, int size, gfp_t gfp, | |||
| 257 | 257 | ||
| 258 | if (size <= 0 || gfp & __GFP_HIGHMEM) | 258 | if (size <= 0 || gfp & __GFP_HIGHMEM) |
| 259 | return -EINVAL; | 259 | return -EINVAL; |
| 260 | if (size > PAGE_SIZE - ZHDR_SIZE_ALIGNED) | 260 | if (size > PAGE_SIZE - ZHDR_SIZE_ALIGNED - CHUNK_SIZE) |
| 261 | return -ENOSPC; | 261 | return -ENOSPC; |
| 262 | chunks = size_to_chunks(size); | 262 | chunks = size_to_chunks(size); |
| 263 | spin_lock(&pool->lock); | 263 | spin_lock(&pool->lock); |
