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 ; 21 Jan 2019 22:42:00 -0000 Received: from mx1.redhat.com ([209.132.183.28]) by Galois.linutronix.de with esmtps (TLS1.2:DHE_RSA_AES_256_CBC_SHA256:256) (Exim 4.80) (envelope-from ) id 1gliGU-0007xl-Ou for speck@linutronix.de; Mon, 21 Jan 2019 23:41:59 +0100 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 9384D58E4B for ; Mon, 21 Jan 2019 22:41:52 +0000 (UTC) Received: from treble (ovpn-122-251.rdu2.redhat.com [10.10.122.251]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 3917368882 for ; Mon, 21 Jan 2019 22:41:52 +0000 (UTC) Date: Mon, 21 Jan 2019 16:41:50 -0600 From: Josh Poimboeuf Subject: [MODERATED] Re: [PATCH v5 06/27] MDSv5 18 Message-ID: <20190121224150.dhy6hagloqgsxajv@treble> References: 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 Fri, Jan 18, 2019 at 04:50:21PM -0800, speck for Andi Kleen wrote: > --- a/arch/x86/include/asm/clearcpu.h > +++ b/arch/x86/include/asm/clearcpu.h > @@ -20,6 +20,26 @@ static inline void clear_cpu(void) > [kernelds] "m" (kernel_ds)); > } > > +/* > + * Clear CPU buffers before going idle, so that no state is leaked to SMT > + * siblings taking over thread resources. > + * Out of line to avoid include hell. > + * > + * Assumes that interrupts are disabled and only get reenabled > + * before idle, otherwise the data from a racing interrupt might not > + * get cleared. There are some callers who violate this, > + * but they are only used in unattackable cases, like CPU > + * offlining. > + */ > + > +static inline void clear_cpu_idle(void) > +{ > + if (sched_smt_active()) { > + clear_thread_flag(TIF_CLEAR_CPU); > + clear_cpu(); > + } > +} > + > DECLARE_STATIC_KEY_FALSE(force_cpu_clear); This causes an error with CONFIG_ACPI_PROCESSOR_AGGREGATOR: ERROR: "sched_smt_present" [drivers/acpi/acpi_pad.ko] undefined! because sched_smt_present isn't exported. > diff --git a/drivers/acpi/processor_idle.c b/drivers/acpi/processor_idle.c > index b2131c4ea124..b4406ca1dfd7 100644 > --- a/drivers/acpi/processor_idle.c > +++ b/drivers/acpi/processor_idle.c > @@ -33,6 +33,7 @@ > #include > #include > #include > +#include This should be s/asm/linux/ because this code can be used by non-x86 arches. -- Josh