From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail.linutronix.de (146.0.238.70:993) by crypto-ml.lab.linutronix.de with IMAP4-SSL for ; 24 Feb 2019 15:12:24 -0000 Received: from mga02.intel.com ([134.134.136.20]) by Galois.linutronix.de with esmtps (TLS1.2:DHE_RSA_AES_256_CBC_SHA256:256) (Exim 4.80) (envelope-from ) id 1gxvO3-0001RU-Qf for speck@linutronix.de; Sun, 24 Feb 2019 16:08:16 +0100 From: Andi Kleen Subject: [MODERATED] [PATCH v6 30/43] MDSv6 Date: Sun, 24 Feb 2019 07:07:36 -0800 Message-Id: <933005cfe327ac4e32e8a4686bcdc979f43e45f2.1551019522.git.ak@linux.intel.com> In-Reply-To: References: In-Reply-To: References: To: speck@linutronix.de Cc: Andi Kleen List-ID: From: Andi Kleen Subject: mds sweep: Clear cpu for tty input Schedule a clear cpu when input data is passed to the tty layer in a interrupt. We consider tty data sensitive. This avoids patching lots of serial drivers. Signed-off-by: Andi Kleen --- drivers/tty/tty_buffer.c | 5 ++++- include/linux/tty_flip.h | 4 ++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/drivers/tty/tty_buffer.c b/drivers/tty/tty_buffer.c index 77070c2d1240..71f6dd698968 100644 --- a/drivers/tty/tty_buffer.c +++ b/drivers/tty/tty_buffer.c @@ -17,6 +17,7 @@ #include #include #include +#include #define MIN_TTYB_SIZE 256 @@ -328,6 +329,7 @@ int tty_insert_flip_string_fixed_flag(struct tty_port *port, /* There is a small chance that we need to split the data over several buffers. If this is the case we must loop */ } while (unlikely(size > copied)); + lazy_clear_cpu_interrupt(); return copied; } EXPORT_SYMBOL(tty_insert_flip_string_fixed_flag); @@ -363,6 +365,7 @@ int tty_insert_flip_string_flags(struct tty_port *port, /* There is a small chance that we need to split the data over several buffers. If this is the case we must loop */ } while (unlikely(size > copied)); + lazy_clear_cpu_interrupt(); return copied; } EXPORT_SYMBOL(tty_insert_flip_string_flags); @@ -388,7 +391,7 @@ int __tty_insert_flip_char(struct tty_port *port, unsigned char ch, char flag) if (~tb->flags & TTYB_NORMAL) *flag_buf_ptr(tb, tb->used) = flag; *char_buf_ptr(tb, tb->used++) = ch; - + lazy_clear_cpu_interrupt(); return 1; } EXPORT_SYMBOL(__tty_insert_flip_char); diff --git a/include/linux/tty_flip.h b/include/linux/tty_flip.h index 767f62086bd9..41ae39e339b9 100644 --- a/include/linux/tty_flip.h +++ b/include/linux/tty_flip.h @@ -2,6 +2,8 @@ #ifndef _LINUX_TTY_FLIP_H #define _LINUX_TTY_FLIP_H +#include + extern int tty_buffer_set_limit(struct tty_port *port, int limit); extern int tty_buffer_space_avail(struct tty_port *port); extern int tty_buffer_request_room(struct tty_port *port, size_t size); @@ -21,6 +23,8 @@ static inline int tty_insert_flip_char(struct tty_port *port, struct tty_buffer *tb = port->buf.tail; int change; + lazy_clear_cpu_interrupt(); + change = (tb->flags & TTYB_NORMAL) && (flag != TTY_NORMAL); if (!change && tb->used < tb->size) { if (~tb->flags & TTYB_NORMAL) -- 2.17.2