diff options
Diffstat (limited to 'kernel')
-rw-r--r-- | kernel/auditfilter.c | 4 | ||||
-rw-r--r-- | kernel/exit.c | 1 | ||||
-rw-r--r-- | kernel/printk/printk.c | 157 | ||||
-rw-r--r-- | kernel/smp.c | 2 | ||||
-rw-r--r-- | kernel/sysctl.c | 9 | ||||
-rw-r--r-- | kernel/watchdog.c | 10 |
6 files changed, 114 insertions, 69 deletions
diff --git a/kernel/auditfilter.c b/kernel/auditfilter.c index 8e9bc9c3dbb7..c447cd9848d1 100644 --- a/kernel/auditfilter.c +++ b/kernel/auditfilter.c | |||
@@ -106,7 +106,7 @@ static inline struct audit_entry *audit_init_entry(u32 field_count) | |||
106 | if (unlikely(!entry)) | 106 | if (unlikely(!entry)) |
107 | return NULL; | 107 | return NULL; |
108 | 108 | ||
109 | fields = kzalloc(sizeof(*fields) * field_count, GFP_KERNEL); | 109 | fields = kcalloc(field_count, sizeof(*fields), GFP_KERNEL); |
110 | if (unlikely(!fields)) { | 110 | if (unlikely(!fields)) { |
111 | kfree(entry); | 111 | kfree(entry); |
112 | return NULL; | 112 | return NULL; |
@@ -160,7 +160,7 @@ static __u32 *classes[AUDIT_SYSCALL_CLASSES]; | |||
160 | 160 | ||
161 | int __init audit_register_class(int class, unsigned *list) | 161 | int __init audit_register_class(int class, unsigned *list) |
162 | { | 162 | { |
163 | __u32 *p = kzalloc(AUDIT_BITMASK_SIZE * sizeof(__u32), GFP_KERNEL); | 163 | __u32 *p = kcalloc(AUDIT_BITMASK_SIZE, sizeof(__u32), GFP_KERNEL); |
164 | if (!p) | 164 | if (!p) |
165 | return -ENOMEM; | 165 | return -ENOMEM; |
166 | while (*list != ~0U) { | 166 | while (*list != ~0U) { |
diff --git a/kernel/exit.c b/kernel/exit.c index e5c4668f1799..88c6b3e42583 100644 --- a/kernel/exit.c +++ b/kernel/exit.c | |||
@@ -455,6 +455,7 @@ static void exit_mm(struct task_struct * tsk) | |||
455 | task_unlock(tsk); | 455 | task_unlock(tsk); |
456 | mm_update_next_owner(mm); | 456 | mm_update_next_owner(mm); |
457 | mmput(mm); | 457 | mmput(mm); |
458 | clear_thread_flag(TIF_MEMDIE); | ||
458 | } | 459 | } |
459 | 460 | ||
460 | /* | 461 | /* |
diff --git a/kernel/printk/printk.c b/kernel/printk/printk.c index 13e839dbca07..de1a6bb6861d 100644 --- a/kernel/printk/printk.c +++ b/kernel/printk/printk.c | |||
@@ -45,6 +45,7 @@ | |||
45 | #include <linux/poll.h> | 45 | #include <linux/poll.h> |
46 | #include <linux/irq_work.h> | 46 | #include <linux/irq_work.h> |
47 | #include <linux/utsname.h> | 47 | #include <linux/utsname.h> |
48 | #include <linux/ctype.h> | ||
48 | 49 | ||
49 | #include <asm/uaccess.h> | 50 | #include <asm/uaccess.h> |
50 | 51 | ||
@@ -56,7 +57,7 @@ | |||
56 | 57 | ||
57 | int console_printk[4] = { | 58 | int console_printk[4] = { |
58 | CONSOLE_LOGLEVEL_DEFAULT, /* console_loglevel */ | 59 | CONSOLE_LOGLEVEL_DEFAULT, /* console_loglevel */ |
59 | DEFAULT_MESSAGE_LOGLEVEL, /* default_message_loglevel */ | 60 | MESSAGE_LOGLEVEL_DEFAULT, /* default_message_loglevel */ |
60 | CONSOLE_LOGLEVEL_MIN, /* minimum_console_loglevel */ | 61 | CONSOLE_LOGLEVEL_MIN, /* minimum_console_loglevel */ |
61 | CONSOLE_LOGLEVEL_DEFAULT, /* default_console_loglevel */ | 62 | CONSOLE_LOGLEVEL_DEFAULT, /* default_console_loglevel */ |
62 | }; | 63 | }; |
@@ -113,9 +114,9 @@ static int __down_trylock_console_sem(unsigned long ip) | |||
113 | * This is used for debugging the mess that is the VT code by | 114 | * This is used for debugging the mess that is the VT code by |
114 | * keeping track if we have the console semaphore held. It's | 115 | * keeping track if we have the console semaphore held. It's |
115 | * definitely not the perfect debug tool (we don't know if _WE_ | 116 | * definitely not the perfect debug tool (we don't know if _WE_ |
116 | * hold it are racing, but it helps tracking those weird code | 117 | * hold it and are racing, but it helps tracking those weird code |
117 | * path in the console code where we end up in places I want | 118 | * paths in the console code where we end up in places I want |
118 | * locked without the console sempahore held | 119 | * locked without the console sempahore held). |
119 | */ | 120 | */ |
120 | static int console_locked, console_suspended; | 121 | static int console_locked, console_suspended; |
121 | 122 | ||
@@ -146,8 +147,8 @@ static int console_may_schedule; | |||
146 | * the overall length of the record. | 147 | * the overall length of the record. |
147 | * | 148 | * |
148 | * The heads to the first and last entry in the buffer, as well as the | 149 | * The heads to the first and last entry in the buffer, as well as the |
149 | * sequence numbers of these both entries are maintained when messages | 150 | * sequence numbers of these entries are maintained when messages are |
150 | * are stored.. | 151 | * stored. |
151 | * | 152 | * |
152 | * If the heads indicate available messages, the length in the header | 153 | * If the heads indicate available messages, the length in the header |
153 | * tells the start next message. A length == 0 for the next message | 154 | * tells the start next message. A length == 0 for the next message |
@@ -257,7 +258,7 @@ static u64 clear_seq; | |||
257 | static u32 clear_idx; | 258 | static u32 clear_idx; |
258 | 259 | ||
259 | #define PREFIX_MAX 32 | 260 | #define PREFIX_MAX 32 |
260 | #define LOG_LINE_MAX 1024 - PREFIX_MAX | 261 | #define LOG_LINE_MAX (1024 - PREFIX_MAX) |
261 | 262 | ||
262 | /* record buffer */ | 263 | /* record buffer */ |
263 | #if defined(CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS) | 264 | #if defined(CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS) |
@@ -266,6 +267,7 @@ static u32 clear_idx; | |||
266 | #define LOG_ALIGN __alignof__(struct printk_log) | 267 | #define LOG_ALIGN __alignof__(struct printk_log) |
267 | #endif | 268 | #endif |
268 | #define __LOG_BUF_LEN (1 << CONFIG_LOG_BUF_SHIFT) | 269 | #define __LOG_BUF_LEN (1 << CONFIG_LOG_BUF_SHIFT) |
270 | #define __LOG_CPU_MAX_BUF_LEN (1 << CONFIG_LOG_CPU_MAX_BUF_SHIFT) | ||
269 | static char __log_buf[__LOG_BUF_LEN] __aligned(LOG_ALIGN); | 271 | static char __log_buf[__LOG_BUF_LEN] __aligned(LOG_ALIGN); |
270 | static char *log_buf = __log_buf; | 272 | static char *log_buf = __log_buf; |
271 | static u32 log_buf_len = __LOG_BUF_LEN; | 273 | static u32 log_buf_len = __LOG_BUF_LEN; |
@@ -344,7 +346,7 @@ static int log_make_free_space(u32 msg_size) | |||
344 | while (log_first_seq < log_next_seq) { | 346 | while (log_first_seq < log_next_seq) { |
345 | if (logbuf_has_space(msg_size, false)) | 347 | if (logbuf_has_space(msg_size, false)) |
346 | return 0; | 348 | return 0; |
347 | /* drop old messages until we have enough continuous space */ | 349 | /* drop old messages until we have enough contiguous space */ |
348 | log_first_idx = log_next(log_first_idx); | 350 | log_first_idx = log_next(log_first_idx); |
349 | log_first_seq++; | 351 | log_first_seq++; |
350 | } | 352 | } |
@@ -453,11 +455,7 @@ static int log_store(int facility, int level, | |||
453 | return msg->text_len; | 455 | return msg->text_len; |
454 | } | 456 | } |
455 | 457 | ||
456 | #ifdef CONFIG_SECURITY_DMESG_RESTRICT | 458 | int dmesg_restrict = IS_ENABLED(CONFIG_SECURITY_DMESG_RESTRICT); |
457 | int dmesg_restrict = 1; | ||
458 | #else | ||
459 | int dmesg_restrict; | ||
460 | #endif | ||
461 | 459 | ||
462 | static int syslog_action_restricted(int type) | 460 | static int syslog_action_restricted(int type) |
463 | { | 461 | { |
@@ -828,34 +826,74 @@ void log_buf_kexec_setup(void) | |||
828 | /* requested log_buf_len from kernel cmdline */ | 826 | /* requested log_buf_len from kernel cmdline */ |
829 | static unsigned long __initdata new_log_buf_len; | 827 | static unsigned long __initdata new_log_buf_len; |
830 | 828 | ||
831 | /* save requested log_buf_len since it's too early to process it */ | 829 | /* we practice scaling the ring buffer by powers of 2 */ |
832 | static int __init log_buf_len_setup(char *str) | 830 | static void __init log_buf_len_update(unsigned size) |
833 | { | 831 | { |
834 | unsigned size = memparse(str, &str); | ||
835 | |||
836 | if (size) | 832 | if (size) |
837 | size = roundup_pow_of_two(size); | 833 | size = roundup_pow_of_two(size); |
838 | if (size > log_buf_len) | 834 | if (size > log_buf_len) |
839 | new_log_buf_len = size; | 835 | new_log_buf_len = size; |
836 | } | ||
837 | |||
838 | /* save requested log_buf_len since it's too early to process it */ | ||
839 | static int __init log_buf_len_setup(char *str) | ||
840 | { | ||
841 | unsigned size = memparse(str, &str); | ||
842 | |||
843 | log_buf_len_update(size); | ||
840 | 844 | ||
841 | return 0; | 845 | return 0; |
842 | } | 846 | } |
843 | early_param("log_buf_len", log_buf_len_setup); | 847 | early_param("log_buf_len", log_buf_len_setup); |
844 | 848 | ||
849 | static void __init log_buf_add_cpu(void) | ||
850 | { | ||
851 | unsigned int cpu_extra; | ||
852 | |||
853 | /* | ||
854 | * archs should set up cpu_possible_bits properly with | ||
855 | * set_cpu_possible() after setup_arch() but just in | ||
856 | * case lets ensure this is valid. | ||
857 | */ | ||
858 | if (num_possible_cpus() == 1) | ||
859 | return; | ||
860 | |||
861 | cpu_extra = (num_possible_cpus() - 1) * __LOG_CPU_MAX_BUF_LEN; | ||
862 | |||
863 | /* by default this will only continue through for large > 64 CPUs */ | ||
864 | if (cpu_extra <= __LOG_BUF_LEN / 2) | ||
865 | return; | ||
866 | |||
867 | pr_info("log_buf_len individual max cpu contribution: %d bytes\n", | ||
868 | __LOG_CPU_MAX_BUF_LEN); | ||
869 | pr_info("log_buf_len total cpu_extra contributions: %d bytes\n", | ||
870 | cpu_extra); | ||
871 | pr_info("log_buf_len min size: %d bytes\n", __LOG_BUF_LEN); | ||
872 | |||
873 | log_buf_len_update(cpu_extra + __LOG_BUF_LEN); | ||
874 | } | ||
875 | |||
845 | void __init setup_log_buf(int early) | 876 | void __init setup_log_buf(int early) |
846 | { | 877 | { |
847 | unsigned long flags; | 878 | unsigned long flags; |
848 | char *new_log_buf; | 879 | char *new_log_buf; |
849 | int free; | 880 | int free; |
850 | 881 | ||
882 | if (log_buf != __log_buf) | ||
883 | return; | ||
884 | |||
885 | if (!early && !new_log_buf_len) | ||
886 | log_buf_add_cpu(); | ||
887 | |||
851 | if (!new_log_buf_len) | 888 | if (!new_log_buf_len) |
852 | return; | 889 | return; |
853 | 890 | ||
854 | if (early) { | 891 | if (early) { |
855 | new_log_buf = | 892 | new_log_buf = |
856 | memblock_virt_alloc(new_log_buf_len, PAGE_SIZE); | 893 | memblock_virt_alloc(new_log_buf_len, LOG_ALIGN); |
857 | } else { | 894 | } else { |
858 | new_log_buf = memblock_virt_alloc_nopanic(new_log_buf_len, 0); | 895 | new_log_buf = memblock_virt_alloc_nopanic(new_log_buf_len, |
896 | LOG_ALIGN); | ||
859 | } | 897 | } |
860 | 898 | ||
861 | if (unlikely(!new_log_buf)) { | 899 | if (unlikely(!new_log_buf)) { |
@@ -872,7 +910,7 @@ void __init setup_log_buf(int early) | |||
872 | memcpy(log_buf, __log_buf, __LOG_BUF_LEN); | 910 | memcpy(log_buf, __log_buf, __LOG_BUF_LEN); |
873 | raw_spin_unlock_irqrestore(&logbuf_lock, flags); | 911 | raw_spin_unlock_irqrestore(&logbuf_lock, flags); |
874 | 912 | ||
875 | pr_info("log_buf_len: %d\n", log_buf_len); | 913 | pr_info("log_buf_len: %d bytes\n", log_buf_len); |
876 | pr_info("early log buf free: %d(%d%%)\n", | 914 | pr_info("early log buf free: %d(%d%%)\n", |
877 | free, (free * 100) / __LOG_BUF_LEN); | 915 | free, (free * 100) / __LOG_BUF_LEN); |
878 | } | 916 | } |
@@ -881,7 +919,7 @@ static bool __read_mostly ignore_loglevel; | |||
881 | 919 | ||
882 | static int __init ignore_loglevel_setup(char *str) | 920 | static int __init ignore_loglevel_setup(char *str) |
883 | { | 921 | { |
884 | ignore_loglevel = 1; | 922 | ignore_loglevel = true; |
885 | pr_info("debug: ignoring loglevel setting.\n"); | 923 | pr_info("debug: ignoring loglevel setting.\n"); |
886 | 924 | ||
887 | return 0; | 925 | return 0; |
@@ -947,11 +985,7 @@ static inline void boot_delay_msec(int level) | |||
947 | } | 985 | } |
948 | #endif | 986 | #endif |
949 | 987 | ||
950 | #if defined(CONFIG_PRINTK_TIME) | 988 | static bool printk_time = IS_ENABLED(CONFIG_PRINTK_TIME); |
951 | static bool printk_time = 1; | ||
952 | #else | ||
953 | static bool printk_time; | ||
954 | #endif | ||
955 | module_param_named(time, printk_time, bool, S_IRUGO | S_IWUSR); | 989 | module_param_named(time, printk_time, bool, S_IRUGO | S_IWUSR); |
956 | 990 | ||
957 | static size_t print_time(u64 ts, char *buf) | 991 | static size_t print_time(u64 ts, char *buf) |
@@ -1310,7 +1344,7 @@ int do_syslog(int type, char __user *buf, int len, bool from_file) | |||
1310 | * for pending data, not the size; return the count of | 1344 | * for pending data, not the size; return the count of |
1311 | * records, not the length. | 1345 | * records, not the length. |
1312 | */ | 1346 | */ |
1313 | error = log_next_idx - syslog_idx; | 1347 | error = log_next_seq - syslog_seq; |
1314 | } else { | 1348 | } else { |
1315 | u64 seq = syslog_seq; | 1349 | u64 seq = syslog_seq; |
1316 | u32 idx = syslog_idx; | 1350 | u32 idx = syslog_idx; |
@@ -1416,10 +1450,9 @@ static int have_callable_console(void) | |||
1416 | /* | 1450 | /* |
1417 | * Can we actually use the console at this time on this cpu? | 1451 | * Can we actually use the console at this time on this cpu? |
1418 | * | 1452 | * |
1419 | * Console drivers may assume that per-cpu resources have | 1453 | * Console drivers may assume that per-cpu resources have been allocated. So |
1420 | * been allocated. So unless they're explicitly marked as | 1454 | * unless they're explicitly marked as being able to cope (CON_ANYTIME) don't |
1421 | * being able to cope (CON_ANYTIME) don't call them until | 1455 | * call them until this CPU is officially up. |
1422 | * this CPU is officially up. | ||
1423 | */ | 1456 | */ |
1424 | static inline int can_use_console(unsigned int cpu) | 1457 | static inline int can_use_console(unsigned int cpu) |
1425 | { | 1458 | { |
@@ -1432,8 +1465,10 @@ static inline int can_use_console(unsigned int cpu) | |||
1432 | * console_lock held, and 'console_locked' set) if it | 1465 | * console_lock held, and 'console_locked' set) if it |
1433 | * is successful, false otherwise. | 1466 | * is successful, false otherwise. |
1434 | */ | 1467 | */ |
1435 | static int console_trylock_for_printk(unsigned int cpu) | 1468 | static int console_trylock_for_printk(void) |
1436 | { | 1469 | { |
1470 | unsigned int cpu = smp_processor_id(); | ||
1471 | |||
1437 | if (!console_trylock()) | 1472 | if (!console_trylock()) |
1438 | return 0; | 1473 | return 0; |
1439 | /* | 1474 | /* |
@@ -1476,7 +1511,7 @@ static struct cont { | |||
1476 | struct task_struct *owner; /* task of first print*/ | 1511 | struct task_struct *owner; /* task of first print*/ |
1477 | u64 ts_nsec; /* time of first print */ | 1512 | u64 ts_nsec; /* time of first print */ |
1478 | u8 level; /* log level of first message */ | 1513 | u8 level; /* log level of first message */ |
1479 | u8 facility; /* log level of first message */ | 1514 | u8 facility; /* log facility of first message */ |
1480 | enum log_flags flags; /* prefix, newline flags */ | 1515 | enum log_flags flags; /* prefix, newline flags */ |
1481 | bool flushed:1; /* buffer sealed and committed */ | 1516 | bool flushed:1; /* buffer sealed and committed */ |
1482 | } cont; | 1517 | } cont; |
@@ -1608,7 +1643,8 @@ asmlinkage int vprintk_emit(int facility, int level, | |||
1608 | */ | 1643 | */ |
1609 | if (!oops_in_progress && !lockdep_recursing(current)) { | 1644 | if (!oops_in_progress && !lockdep_recursing(current)) { |
1610 | recursion_bug = 1; | 1645 | recursion_bug = 1; |
1611 | goto out_restore_irqs; | 1646 | local_irq_restore(flags); |
1647 | return 0; | ||
1612 | } | 1648 | } |
1613 | zap_locks(); | 1649 | zap_locks(); |
1614 | } | 1650 | } |
@@ -1716,21 +1752,30 @@ asmlinkage int vprintk_emit(int facility, int level, | |||
1716 | 1752 | ||
1717 | logbuf_cpu = UINT_MAX; | 1753 | logbuf_cpu = UINT_MAX; |
1718 | raw_spin_unlock(&logbuf_lock); | 1754 | raw_spin_unlock(&logbuf_lock); |
1755 | lockdep_on(); | ||
1756 | local_irq_restore(flags); | ||
1719 | 1757 | ||
1720 | /* If called from the scheduler, we can not call up(). */ | 1758 | /* If called from the scheduler, we can not call up(). */ |
1721 | if (!in_sched) { | 1759 | if (!in_sched) { |
1760 | lockdep_off(); | ||
1761 | /* | ||
1762 | * Disable preemption to avoid being preempted while holding | ||
1763 | * console_sem which would prevent anyone from printing to | ||
1764 | * console | ||
1765 | */ | ||
1766 | preempt_disable(); | ||
1767 | |||
1722 | /* | 1768 | /* |
1723 | * Try to acquire and then immediately release the console | 1769 | * Try to acquire and then immediately release the console |
1724 | * semaphore. The release will print out buffers and wake up | 1770 | * semaphore. The release will print out buffers and wake up |
1725 | * /dev/kmsg and syslog() users. | 1771 | * /dev/kmsg and syslog() users. |
1726 | */ | 1772 | */ |
1727 | if (console_trylock_for_printk(this_cpu)) | 1773 | if (console_trylock_for_printk()) |
1728 | console_unlock(); | 1774 | console_unlock(); |
1775 | preempt_enable(); | ||
1776 | lockdep_on(); | ||
1729 | } | 1777 | } |
1730 | 1778 | ||
1731 | lockdep_on(); | ||
1732 | out_restore_irqs: | ||
1733 | local_irq_restore(flags); | ||
1734 | return printed_len; | 1779 | return printed_len; |
1735 | } | 1780 | } |
1736 | EXPORT_SYMBOL(vprintk_emit); | 1781 | EXPORT_SYMBOL(vprintk_emit); |
@@ -1802,7 +1847,7 @@ EXPORT_SYMBOL(printk); | |||
1802 | 1847 | ||
1803 | #define LOG_LINE_MAX 0 | 1848 | #define LOG_LINE_MAX 0 |
1804 | #define PREFIX_MAX 0 | 1849 | #define PREFIX_MAX 0 |
1805 | #define LOG_LINE_MAX 0 | 1850 | |
1806 | static u64 syslog_seq; | 1851 | static u64 syslog_seq; |
1807 | static u32 syslog_idx; | 1852 | static u32 syslog_idx; |
1808 | static u64 console_seq; | 1853 | static u64 console_seq; |
@@ -1881,11 +1926,12 @@ static int __add_preferred_console(char *name, int idx, char *options, | |||
1881 | return 0; | 1926 | return 0; |
1882 | } | 1927 | } |
1883 | /* | 1928 | /* |
1884 | * Set up a list of consoles. Called from init/main.c | 1929 | * Set up a console. Called via do_early_param() in init/main.c |
1930 | * for each "console=" parameter in the boot command line. | ||
1885 | */ | 1931 | */ |
1886 | static int __init console_setup(char *str) | 1932 | static int __init console_setup(char *str) |
1887 | { | 1933 | { |
1888 | char buf[sizeof(console_cmdline[0].name) + 4]; /* 4 for index */ | 1934 | char buf[sizeof(console_cmdline[0].name) + 4]; /* 4 for "ttyS" */ |
1889 | char *s, *options, *brl_options = NULL; | 1935 | char *s, *options, *brl_options = NULL; |
1890 | int idx; | 1936 | int idx; |
1891 | 1937 | ||
@@ -1902,7 +1948,8 @@ static int __init console_setup(char *str) | |||
1902 | strncpy(buf, str, sizeof(buf) - 1); | 1948 | strncpy(buf, str, sizeof(buf) - 1); |
1903 | } | 1949 | } |
1904 | buf[sizeof(buf) - 1] = 0; | 1950 | buf[sizeof(buf) - 1] = 0; |
1905 | if ((options = strchr(str, ',')) != NULL) | 1951 | options = strchr(str, ','); |
1952 | if (options) | ||
1906 | *(options++) = 0; | 1953 | *(options++) = 0; |
1907 | #ifdef __sparc__ | 1954 | #ifdef __sparc__ |
1908 | if (!strcmp(str, "ttya")) | 1955 | if (!strcmp(str, "ttya")) |
@@ -1911,7 +1958,7 @@ static int __init console_setup(char *str) | |||
1911 | strcpy(buf, "ttyS1"); | 1958 | strcpy(buf, "ttyS1"); |
1912 | #endif | 1959 | #endif |
1913 | for (s = buf; *s; s++) | 1960 | for (s = buf; *s; s++) |
1914 | if ((*s >= '0' && *s <= '9') || *s == ',') | 1961 | if (isdigit(*s) || *s == ',') |
1915 | break; | 1962 | break; |
1916 | idx = simple_strtoul(s, NULL, 10); | 1963 | idx = simple_strtoul(s, NULL, 10); |
1917 | *s = 0; | 1964 | *s = 0; |
@@ -1950,7 +1997,6 @@ int update_console_cmdline(char *name, int idx, char *name_new, int idx_new, cha | |||
1950 | i++, c++) | 1997 | i++, c++) |
1951 | if (strcmp(c->name, name) == 0 && c->index == idx) { | 1998 | if (strcmp(c->name, name) == 0 && c->index == idx) { |
1952 | strlcpy(c->name, name_new, sizeof(c->name)); | 1999 | strlcpy(c->name, name_new, sizeof(c->name)); |
1953 | c->name[sizeof(c->name) - 1] = 0; | ||
1954 | c->options = options; | 2000 | c->options = options; |
1955 | c->index = idx_new; | 2001 | c->index = idx_new; |
1956 | return i; | 2002 | return i; |
@@ -1959,12 +2005,12 @@ int update_console_cmdline(char *name, int idx, char *name_new, int idx_new, cha | |||
1959 | return -1; | 2005 | return -1; |
1960 | } | 2006 | } |
1961 | 2007 | ||
1962 | bool console_suspend_enabled = 1; | 2008 | bool console_suspend_enabled = true; |
1963 | EXPORT_SYMBOL(console_suspend_enabled); | 2009 | EXPORT_SYMBOL(console_suspend_enabled); |
1964 | 2010 | ||
1965 | static int __init console_suspend_disable(char *str) | 2011 | static int __init console_suspend_disable(char *str) |
1966 | { | 2012 | { |
1967 | console_suspend_enabled = 0; | 2013 | console_suspend_enabled = false; |
1968 | return 1; | 2014 | return 1; |
1969 | } | 2015 | } |
1970 | __setup("no_console_suspend", console_suspend_disable); | 2016 | __setup("no_console_suspend", console_suspend_disable); |
@@ -2045,8 +2091,8 @@ EXPORT_SYMBOL(console_lock); | |||
2045 | /** | 2091 | /** |
2046 | * console_trylock - try to lock the console system for exclusive use. | 2092 | * console_trylock - try to lock the console system for exclusive use. |
2047 | * | 2093 | * |
2048 | * Tried to acquire a lock which guarantees that the caller has | 2094 | * Try to acquire a lock which guarantees that the caller has exclusive |
2049 | * exclusive access to the console system and the console_drivers list. | 2095 | * access to the console system and the console_drivers list. |
2050 | * | 2096 | * |
2051 | * returns 1 on success, and 0 on failure to acquire the lock. | 2097 | * returns 1 on success, and 0 on failure to acquire the lock. |
2052 | */ | 2098 | */ |
@@ -2618,14 +2664,13 @@ EXPORT_SYMBOL(__printk_ratelimit); | |||
2618 | bool printk_timed_ratelimit(unsigned long *caller_jiffies, | 2664 | bool printk_timed_ratelimit(unsigned long *caller_jiffies, |
2619 | unsigned int interval_msecs) | 2665 | unsigned int interval_msecs) |
2620 | { | 2666 | { |
2621 | if (*caller_jiffies == 0 | 2667 | unsigned long elapsed = jiffies - *caller_jiffies; |
2622 | || !time_in_range(jiffies, *caller_jiffies, | 2668 | |
2623 | *caller_jiffies | 2669 | if (*caller_jiffies && elapsed <= msecs_to_jiffies(interval_msecs)) |
2624 | + msecs_to_jiffies(interval_msecs))) { | 2670 | return false; |
2625 | *caller_jiffies = jiffies; | 2671 | |
2626 | return true; | 2672 | *caller_jiffies = jiffies; |
2627 | } | 2673 | return true; |
2628 | return false; | ||
2629 | } | 2674 | } |
2630 | EXPORT_SYMBOL(printk_timed_ratelimit); | 2675 | EXPORT_SYMBOL(printk_timed_ratelimit); |
2631 | 2676 | ||
diff --git a/kernel/smp.c b/kernel/smp.c index 487653b5844f..aff8aa14f547 100644 --- a/kernel/smp.c +++ b/kernel/smp.c | |||
@@ -670,7 +670,7 @@ void on_each_cpu_cond(bool (*cond_func)(int cpu, void *info), | |||
670 | if (cond_func(cpu, info)) { | 670 | if (cond_func(cpu, info)) { |
671 | ret = smp_call_function_single(cpu, func, | 671 | ret = smp_call_function_single(cpu, func, |
672 | info, wait); | 672 | info, wait); |
673 | WARN_ON_ONCE(!ret); | 673 | WARN_ON_ONCE(ret); |
674 | } | 674 | } |
675 | preempt_enable(); | 675 | preempt_enable(); |
676 | } | 676 | } |
diff --git a/kernel/sysctl.c b/kernel/sysctl.c index 75b22e22a72c..75875a741b5e 100644 --- a/kernel/sysctl.c +++ b/kernel/sysctl.c | |||
@@ -1240,8 +1240,7 @@ static struct ctl_table vm_table[] = { | |||
1240 | .maxlen = sizeof(unsigned long), | 1240 | .maxlen = sizeof(unsigned long), |
1241 | .mode = 0644, | 1241 | .mode = 0644, |
1242 | .proc_handler = hugetlb_sysctl_handler, | 1242 | .proc_handler = hugetlb_sysctl_handler, |
1243 | .extra1 = (void *)&hugetlb_zero, | 1243 | .extra1 = &zero, |
1244 | .extra2 = (void *)&hugetlb_infinity, | ||
1245 | }, | 1244 | }, |
1246 | #ifdef CONFIG_NUMA | 1245 | #ifdef CONFIG_NUMA |
1247 | { | 1246 | { |
@@ -1250,8 +1249,7 @@ static struct ctl_table vm_table[] = { | |||
1250 | .maxlen = sizeof(unsigned long), | 1249 | .maxlen = sizeof(unsigned long), |
1251 | .mode = 0644, | 1250 | .mode = 0644, |
1252 | .proc_handler = &hugetlb_mempolicy_sysctl_handler, | 1251 | .proc_handler = &hugetlb_mempolicy_sysctl_handler, |
1253 | .extra1 = (void *)&hugetlb_zero, | 1252 | .extra1 = &zero, |
1254 | .extra2 = (void *)&hugetlb_infinity, | ||
1255 | }, | 1253 | }, |
1256 | #endif | 1254 | #endif |
1257 | { | 1255 | { |
@@ -1274,8 +1272,7 @@ static struct ctl_table vm_table[] = { | |||
1274 | .maxlen = sizeof(unsigned long), | 1272 | .maxlen = sizeof(unsigned long), |
1275 | .mode = 0644, | 1273 | .mode = 0644, |
1276 | .proc_handler = hugetlb_overcommit_handler, | 1274 | .proc_handler = hugetlb_overcommit_handler, |
1277 | .extra1 = (void *)&hugetlb_zero, | 1275 | .extra1 = &zero, |
1278 | .extra2 = (void *)&hugetlb_infinity, | ||
1279 | }, | 1276 | }, |
1280 | #endif | 1277 | #endif |
1281 | { | 1278 | { |
diff --git a/kernel/watchdog.c b/kernel/watchdog.c index c3319bd1b040..51b29e9d2ba6 100644 --- a/kernel/watchdog.c +++ b/kernel/watchdog.c | |||
@@ -260,9 +260,11 @@ static void watchdog_overflow_callback(struct perf_event *event, | |||
260 | return; | 260 | return; |
261 | 261 | ||
262 | if (hardlockup_panic) | 262 | if (hardlockup_panic) |
263 | panic("Watchdog detected hard LOCKUP on cpu %d", this_cpu); | 263 | panic("Watchdog detected hard LOCKUP on cpu %d", |
264 | this_cpu); | ||
264 | else | 265 | else |
265 | WARN(1, "Watchdog detected hard LOCKUP on cpu %d", this_cpu); | 266 | WARN(1, "Watchdog detected hard LOCKUP on cpu %d", |
267 | this_cpu); | ||
266 | 268 | ||
267 | __this_cpu_write(hard_watchdog_warn, true); | 269 | __this_cpu_write(hard_watchdog_warn, true); |
268 | return; | 270 | return; |
@@ -345,7 +347,7 @@ static enum hrtimer_restart watchdog_timer_fn(struct hrtimer *hrtimer) | |||
345 | } | 347 | } |
346 | } | 348 | } |
347 | 349 | ||
348 | printk(KERN_EMERG "BUG: soft lockup - CPU#%d stuck for %us! [%s:%d]\n", | 350 | pr_emerg("BUG: soft lockup - CPU#%d stuck for %us! [%s:%d]\n", |
349 | smp_processor_id(), duration, | 351 | smp_processor_id(), duration, |
350 | current->comm, task_pid_nr(current)); | 352 | current->comm, task_pid_nr(current)); |
351 | print_modules(); | 353 | print_modules(); |
@@ -484,7 +486,7 @@ static int watchdog_nmi_enable(unsigned int cpu) | |||
484 | if (PTR_ERR(event) == -EOPNOTSUPP) | 486 | if (PTR_ERR(event) == -EOPNOTSUPP) |
485 | pr_info("disabled (cpu%i): not supported (no LAPIC?)\n", cpu); | 487 | pr_info("disabled (cpu%i): not supported (no LAPIC?)\n", cpu); |
486 | else if (PTR_ERR(event) == -ENOENT) | 488 | else if (PTR_ERR(event) == -ENOENT) |
487 | pr_warning("disabled (cpu%i): hardware events not enabled\n", | 489 | pr_warn("disabled (cpu%i): hardware events not enabled\n", |
488 | cpu); | 490 | cpu); |
489 | else | 491 | else |
490 | pr_err("disabled (cpu%i): unable to create perf event: %ld\n", | 492 | pr_err("disabled (cpu%i): unable to create perf event: %ld\n", |