From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail.linutronix.de (193.142.43.55:993) by crypto-ml.lab.linutronix.de with IMAP4-SSL for ; 01 Nov 2019 16:32:00 -0000 Received: from us-smtp-1.mimecast.com ([207.211.31.81] helo=us-smtp-delivery-1.mimecast.com) by Galois.linutronix.de with esmtps (TLS1.2:DHE_RSA_AES_256_CBC_SHA256:256) (Exim 4.80) (envelope-from ) id 1iQZqB-0002m8-Go for speck@linutronix.de; Fri, 01 Nov 2019 17:32:00 +0100 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id D1F811005500 for ; Fri, 1 Nov 2019 16:31:53 +0000 (UTC) Received: from treble (ovpn-122-227.rdu2.redhat.com [10.10.122.227]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 354DC600D1 for ; Fri, 1 Nov 2019 16:31:53 +0000 (UTC) Date: Fri, 1 Nov 2019 11:31:50 -0500 From: Josh Poimboeuf Subject: [MODERATED] Re: [PATCH] NX build fixup Message-ID: <20191101163150.z7qlfwp6vai3ttp5@treble> References: <20191101145835.GA9011@elm> <20191101154157.GA24333@sec> MIME-Version: 1.0 In-Reply-To: <20191101154157.GA24333@sec> Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit To: speck@linutronix.de List-ID: On Fri, Nov 01, 2019 at 03:43:31PM +0000, speck for Tyler Hicks wrote: > From: Tyler Hicks > Subject: [PATCH] cpu/speculation: Uninline and export CPU mitigations helpers > > A kernel module may need to check the value of the "mitigations=" kernel > command line parameter as part of its setup when the module needs > to perform software mitigations for a CPU flaw. Uninline and export the > helper functions surrounding the cpu_mitigations enum to allow for their > usage from a module. > > Signed-off-by: Tyler Hicks > --- > > Only compile tested, with both CONFIG_KVM=y and CONFIG_KVM=m. Paolo, if > this looks good to you and Pawan, please include it in NX v9. > > include/linux/cpu.h | 13 ++----------- > kernel/cpu.c | 14 ++++++++++++++ > 2 files changed, 16 insertions(+), 11 deletions(-) > > diff --git a/include/linux/cpu.h b/include/linux/cpu.h > index 2a093434e975..f1965255526a 100644 > --- a/include/linux/cpu.h > +++ b/include/linux/cpu.h > @@ -230,16 +230,7 @@ enum cpu_mitigations { > > extern enum cpu_mitigations cpu_mitigations; > > -/* mitigations=off */ > -static inline bool cpu_mitigations_off(void) > -{ > - return cpu_mitigations == CPU_MITIGATIONS_OFF; > -} > - > -/* mitigations=auto,nosmt */ > -static inline bool cpu_mitigations_auto_nosmt(void) > -{ > - return cpu_mitigations == CPU_MITIGATIONS_AUTO_NOSMT; > -} > +extern bool cpu_mitigations_off(void); > +extern bool cpu_mitigations_auto_nosmt(void); You could probably also remove the "extern enum cpu_mitigations cpu_mitigations" and just make it a static variable in kernel/cpu.c. Same with the enum itself, it could be made private. Or, as a completely different approach, cpu_mitigations could be exported. Then it's just a one-liner patch. Either way works for me... -- Josh