diff options
author | Kay Sievers <kay@vrfy.org> | 2012-07-13 14:56:39 +0200 |
---|---|---|
committer | Kay Sievers <kay@vrfy.org> | 2012-07-13 14:56:39 +0200 |
commit | e505b93cbe85e3419dfb0cbf56ba197bba00f135 (patch) | |
tree | 0b6d800578b16fad52bd6d5805bddfde471fa6ec | |
parent | 14c26e940c99c79209219fe0b08535f493020b93 (diff) | |
download | patches-e505b93cbe85e3419dfb0cbf56ba197bba00f135.tar.gz |
re-order and merge cont-flush patches
-rw-r--r-- | kmsg-config-no-printk.patch | 2 | ||||
-rw-r--r-- | kmsg-console-cont-flush-merge.patch | 155 | ||||
-rw-r--r-- | kmsg-cont-order.patch | 148 | ||||
-rw-r--r-- | series | 3 |
4 files changed, 147 insertions, 161 deletions
diff --git a/kmsg-config-no-printk.patch b/kmsg-config-no-printk.patch index 9f01101..54b49a9 100644 --- a/kmsg-config-no-printk.patch +++ b/kmsg-config-no-printk.patch @@ -25,7 +25,7 @@ Signed-off-by: Kay Sievers <kay@vrfy.org> static u32 log_next_idx; /* the next printk record to read after the last 'clear' command */ -@@ -1649,10 +1649,17 @@ asmlinkage int printk(const char *fmt, . +@@ -1635,10 +1635,17 @@ asmlinkage int printk(const char *fmt, . } EXPORT_SYMBOL(printk); diff --git a/kmsg-console-cont-flush-merge.patch b/kmsg-console-cont-flush-merge.patch deleted file mode 100644 index 2fd0f5d..0000000 --- a/kmsg-console-cont-flush-merge.patch +++ /dev/null @@ -1,155 +0,0 @@ ---- - kernel/printk.c | 65 +++++++++++++++++++++++++++++++++++++------------------- - 1 file changed, 44 insertions(+), 21 deletions(-) - ---- a/kernel/printk.c -+++ b/kernel/printk.c -@@ -231,6 +231,11 @@ static u32 log_first_idx; - static u64 log_next_seq; - static u32 log_next_idx; - -+/* the next printk record to write to the console */ -+static u64 console_seq; -+static u32 console_idx; -+static enum log_flags console_prev; -+ - /* the next printk record to read after the last 'clear' command */ - static u64 clear_seq; - static u32 clear_idx; -@@ -1386,6 +1391,7 @@ static struct cont { - u64 ts_nsec; /* time of first print */ - u8 level; /* log level of first message */ - u8 facility; /* log level of first message */ -+ enum log_flags flags; /* prefix, newline flags */ - bool flushed:1; /* buffer sealed and committed */ - } cont; - -@@ -1404,6 +1410,7 @@ static void cont_flush(enum log_flags fl - */ - log_store(cont.facility, cont.level, flags | LOG_NOCONS, - cont.ts_nsec, NULL, 0, cont.buf, cont.len); -+ cont.flags = flags; - cont.flushed = true; - } else { - /* -@@ -1432,6 +1439,7 @@ static bool cont_add(int facility, int l - cont.level = level; - cont.owner = current; - cont.ts_nsec = local_clock(); -+ cont.flags = 0; - cont.cons = 0; - cont.flushed = false; - } -@@ -1446,7 +1454,7 @@ static size_t cont_print_text(char *text - size_t textlen = 0; - size_t len; - -- if (cont.cons == 0) { -+ if (cont.cons == 0 && (console_prev & LOG_NEWLINE)) { - textlen += print_time(cont.ts_nsec, text); - size -= textlen; - } -@@ -1461,7 +1469,8 @@ static size_t cont_print_text(char *text - } - - if (cont.flushed) { -- text[textlen++] = '\n'; -+ if (cont.flags & LOG_NEWLINE) -+ text[textlen++] = '\n'; - /* got everything, release buffer */ - cont.len = 0; - } -@@ -1559,7 +1568,7 @@ asmlinkage int vprintk_emit(int facility - * or another task also prints continuation lines. - */ - if (cont.len && (lflags & LOG_PREFIX || cont.owner != current)) -- cont_flush(0); -+ cont_flush(LOG_NEWLINE); - - /* buffer line if possible, otherwise store it right away */ - if (!cont_add(facility, level, text, text_len)) -@@ -1577,7 +1586,7 @@ asmlinkage int vprintk_emit(int facility - if (cont.len && cont.owner == current) { - if (!(lflags & LOG_PREFIX)) - stored = cont_add(facility, level, text, text_len); -- cont_flush(0); -+ cont_flush(LOG_NEWLINE); - } - - if (!stored) -@@ -1679,6 +1688,7 @@ static enum log_flags syslog_prev; - static u64 log_first_seq; - static u32 log_first_idx; - static u64 log_next_seq; -+static enum log_flags console_prev; - static struct cont { - size_t len; - size_t cons; -@@ -1962,10 +1972,34 @@ void wake_up_klogd(void) - this_cpu_or(printk_pending, PRINTK_PENDING_WAKEUP); - } - --/* the next printk record to write to the console */ --static u64 console_seq; --static u32 console_idx; --static enum log_flags console_prev; -+static void console_cont_flush(char *text, size_t size) -+{ -+ unsigned long flags; -+ size_t len; -+ -+ raw_spin_lock_irqsave(&logbuf_lock, flags); -+ -+ if (!cont.len) -+ goto out; -+ -+ /* -+ * We still queue earlier records, likely because the cnsole was -+ * busy. The earlier ones need to be printed before this one, we -+ * did not flush any fragment so far, so just let it queue up. -+ */ -+ if (console_seq < log_next_seq && !cont.cons) -+ goto out; -+ -+ len = cont_print_text(text, size); -+ raw_spin_unlock(&logbuf_lock); -+ stop_critical_timings(); -+ call_console_drivers(cont.level, text, len); -+ start_critical_timings(); -+ local_irq_restore(flags); -+ return; -+out: -+ raw_spin_unlock_irqrestore(&logbuf_lock, flags); -+} - - /** - * console_unlock - unlock the console system -@@ -1997,19 +2031,7 @@ void console_unlock(void) - console_may_schedule = 0; - - /* flush buffered message fragment immediately to console */ -- raw_spin_lock_irqsave(&logbuf_lock, flags); -- if (cont.len && (cont.cons < cont.len || cont.flushed)) { -- size_t len; -- -- len = cont_print_text(text, sizeof(text)); -- raw_spin_unlock(&logbuf_lock); -- stop_critical_timings(); -- call_console_drivers(cont.level, text, len); -- start_critical_timings(); -- local_irq_restore(flags); -- } else -- raw_spin_unlock_irqrestore(&logbuf_lock, flags); -- -+ console_cont_flush(text, sizeof(text)); - again: - for (;;) { - struct log *msg; -@@ -2046,6 +2068,7 @@ skip: - * will properly dump everything later. - */ - msg->flags &= ~LOG_NOCONS; -+ console_prev = msg->flags; - goto skip; - } - diff --git a/kmsg-cont-order.patch b/kmsg-cont-order.patch index 95d5a2d..8221eb1 100644 --- a/kmsg-cont-order.patch +++ b/kmsg-cont-order.patch @@ -1,10 +1,30 @@ --- - kernel/printk.c | 22 ++++++++++++++++++---- - 1 file changed, 18 insertions(+), 4 deletions(-) + kernel/printk.c | 87 +++++++++++++++++++++++++++++++++++++++----------------- + 1 file changed, 62 insertions(+), 25 deletions(-) --- a/kernel/printk.c +++ b/kernel/printk.c -@@ -1377,10 +1377,24 @@ static void cont_flush(enum log_flags fl +@@ -231,6 +231,11 @@ static u32 log_first_idx; + static u64 log_next_seq; + static u32 log_next_idx; + ++/* the next printk record to write to the console */ ++static u64 console_seq; ++static u32 console_idx; ++static enum log_flags console_prev; ++ + /* the next printk record to read after the last 'clear' command */ + static u64 clear_seq; + static u32 clear_idx; +@@ -1386,6 +1391,7 @@ static struct cont { + u64 ts_nsec; /* time of first print */ + u8 level; /* log level of first message */ + u8 facility; /* log level of first message */ ++ enum log_flags flags; /* prefix, newline flags */ + bool flushed:1; /* buffer sealed and committed */ + } cont; + +@@ -1396,10 +1402,25 @@ static void cont_flush(enum log_flags fl if (cont.len == 0) return; @@ -20,6 +40,7 @@ + */ + log_store(cont.facility, cont.level, flags | LOG_NOCONS, + cont.ts_nsec, NULL, 0, cont.buf, cont.len); ++ cont.flags = flags; + cont.flushed = true; + } else { + /* @@ -33,3 +54,124 @@ } static bool cont_add(int facility, int level, const char *text, size_t len) +@@ -1418,6 +1439,7 @@ static bool cont_add(int facility, int l + cont.level = level; + cont.owner = current; + cont.ts_nsec = local_clock(); ++ cont.flags = 0; + cont.cons = 0; + cont.flushed = false; + } +@@ -1432,7 +1454,7 @@ static size_t cont_print_text(char *text + size_t textlen = 0; + size_t len; + +- if (cont.cons == 0) { ++ if (cont.cons == 0 && (console_prev & LOG_NEWLINE)) { + textlen += print_time(cont.ts_nsec, text); + size -= textlen; + } +@@ -1447,7 +1469,8 @@ static size_t cont_print_text(char *text + } + + if (cont.flushed) { +- text[textlen++] = '\n'; ++ if (cont.flags & LOG_NEWLINE) ++ text[textlen++] = '\n'; + /* got everything, release buffer */ + cont.len = 0; + } +@@ -1545,7 +1568,7 @@ asmlinkage int vprintk_emit(int facility + * or another task also prints continuation lines. + */ + if (cont.len && (lflags & LOG_PREFIX || cont.owner != current)) +- cont_flush(0); ++ cont_flush(LOG_NEWLINE); + + /* buffer line if possible, otherwise store it right away */ + if (!cont_add(facility, level, text, text_len)) +@@ -1563,7 +1586,7 @@ asmlinkage int vprintk_emit(int facility + if (cont.len && cont.owner == current) { + if (!(lflags & LOG_PREFIX)) + stored = cont_add(facility, level, text, text_len); +- cont_flush(0); ++ cont_flush(LOG_NEWLINE); + } + + if (!stored) +@@ -1665,6 +1688,7 @@ static enum log_flags syslog_prev; + static u64 log_first_seq; + static u32 log_first_idx; + static u64 log_next_seq; ++static enum log_flags console_prev; + static struct cont { + size_t len; + size_t cons; +@@ -1948,10 +1972,34 @@ void wake_up_klogd(void) + this_cpu_or(printk_pending, PRINTK_PENDING_WAKEUP); + } + +-/* the next printk record to write to the console */ +-static u64 console_seq; +-static u32 console_idx; +-static enum log_flags console_prev; ++static void console_cont_flush(char *text, size_t size) ++{ ++ unsigned long flags; ++ size_t len; ++ ++ raw_spin_lock_irqsave(&logbuf_lock, flags); ++ ++ if (!cont.len) ++ goto out; ++ ++ /* ++ * We still queue earlier records, likely because the console was ++ * busy. The earlier ones need to be printed before this one, we ++ * did not flush any fragment so far, so just let it queue up. ++ */ ++ if (console_seq < log_next_seq && !cont.cons) ++ goto out; ++ ++ len = cont_print_text(text, size); ++ raw_spin_unlock(&logbuf_lock); ++ stop_critical_timings(); ++ call_console_drivers(cont.level, text, len); ++ start_critical_timings(); ++ local_irq_restore(flags); ++ return; ++out: ++ raw_spin_unlock_irqrestore(&logbuf_lock, flags); ++} + + /** + * console_unlock - unlock the console system +@@ -1983,19 +2031,7 @@ void console_unlock(void) + console_may_schedule = 0; + + /* flush buffered message fragment immediately to console */ +- raw_spin_lock_irqsave(&logbuf_lock, flags); +- if (cont.len && (cont.cons < cont.len || cont.flushed)) { +- size_t len; +- +- len = cont_print_text(text, sizeof(text)); +- raw_spin_unlock(&logbuf_lock); +- stop_critical_timings(); +- call_console_drivers(cont.level, text, len); +- start_critical_timings(); +- local_irq_restore(flags); +- } else +- raw_spin_unlock_irqrestore(&logbuf_lock, flags); +- ++ console_cont_flush(text, sizeof(text)); + again: + for (;;) { + struct log *msg; +@@ -2032,6 +2068,7 @@ skip: + * will properly dump everything later. + */ + msg->flags &= ~LOG_NOCONS; ++ console_prev = msg->flags; + goto skip; + } + @@ -2,7 +2,6 @@ #test-console-blocked.patch #pr_cat.patch kmsg-fix-overlong-cont.patch -kmsg-cont-order.patch kmsg-config-no-printk.patch kmsg-export-flags.patch -kmsg-console-cont-flush-merge.patch +kmsg-cont-order.patch |