Return-Path: Received: from mail.linutronix.de (146.0.238.70:993) by crypto-ml.lab.linutronix.de with IMAP4-SSL for ; 22 Jan 2019 18:01:55 -0000 Received: from mga11.intel.com ([192.55.52.93]) by Galois.linutronix.de with esmtps (TLS1.2:DHE_RSA_AES_256_CBC_SHA256:256) (Exim 4.80) (envelope-from ) id 1gm0N0-00047I-K1 for speck@linutronix.de; Tue, 22 Jan 2019 19:01:55 +0100 Date: Tue, 22 Jan 2019 10:01:38 -0800 From: Andi Kleen Subject: [MODERATED] Re: [PATCH v5 12/27] MDSv5 6 Message-ID: <20190122180138.GW6118@tassilo.jf.intel.com> References: <697a8918b8203734d1e101b12db7c62f41e7b5de.1547858934.git.ak@linux.intel.com> MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit To: speck@linutronix.de List-ID: On Tue, Jan 22, 2019 at 03:01:21PM +0100, speck for Thomas Gleixner wrote: > > + if (next->mm != prev->mm || prev->mm == NULL) > > + lazy_clear_cpu(); > > This sets the bit even when switching between two kernel threads. Makes a > lot of sense ... Note the "lazy" It will only do something on the next user exit, and it would be set anyways on the context switch from kernel into that user thread. So trying to avoid it wouldn't change anything. > > + /* > > + * Also transfer the clearcpu flag from the previous task. > > + * Can be done non atomically because interrupts are off. > > + */ > > + task_thread_info(next)->status |= > > + task_thread_info(prev)->status & _TIF_CLEAR_CPU; > > + task_thread_info(prev)->status &= ~_TIF_CLEAR_CPU; > > What has thread_info->status to do with this? TIF flags are in > thread_info->flags. Brilliant stuff that. > > I assume that Linus suggested the TIF flag to avoid yet another conditional > in the syscall path, which makes sense, but the above does not make sense > at all. That needs way more thought. It makes sense to me. Please explain the problem better. -Andi