Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp8098689imu; Tue, 4 Dec 2018 02:59:58 -0800 (PST) X-Google-Smtp-Source: AFSGD/W8tK8Ph06Cc/48Q6cupvOY+ZDkMSf3OI62EmYQcBAgzqYE/GF/ZvYQoZvuNqexg87szIS5 X-Received: by 2002:a63:d301:: with SMTP id b1mr16527697pgg.61.1543921198215; Tue, 04 Dec 2018 02:59:58 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1543921198; cv=none; d=google.com; s=arc-20160816; b=rY3Su5JfmbhV28/9YPknLEP7Bm3+Vat1YMU4uBud1kXN3vRL7Ur5ccx98LE1wwrxps y9kgsRdviwKRzDY2S7drkV08llsMohf9Xa3VTjsjikIsqVOqfXjPt9kQT3VvKevqDF+t 8Jgf4Yhes5oDFYlmY/2augA7fYVrprEf3wJ9T5Fpeb4TQGzXkVODBGtlFA9/p4dsrN13 9QjvknSKrWTlfViiuUaYdibTDVJgDRLYP2ja2RaeVa9tTThgzdHEROEguPm7xc29Yi7A LCAnKFI6Bl7clmoQcn671f/VKqV+BzlIMDKoKk992Kiya0f6u+LjlMsSchGhJQEgPgk0 UOPg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=n5tJWJuupQKlJSKEUsX6OKReCMlVBLs0MEB7XWDdBhw=; b=fzMuDiIQTLXORedx30keRc8Plwgw3acpXuEMEJ9ipS2h/x7QDcWpEek6+Z27l9rUQK PSOh2o/4QPzWUFz5GXgpPJz8pZ6eu4ZtUz1YJoa0FFjkJ9ME1Mt14Coqybwwu7AT5h4a gWljQNSowdKe3cUS3YdDWdHaY8h89I3JHSKM0quiDLonshVVNbjc22Romr+O71QvggRa 8EX1DXG/1DLhEbf2nMwzKnLVIL6trSyiJrfpRrZITiR3PuRtVIRD0DbdNkDavL6eLecl FRnO9gODSYwygCj24iKTbWeclBqDsDmy98MXAhzRvPQGHby/xcnUEl9Y2Ffp8FOdi7Lj ST6A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=EtQvJ0LF; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id x74si18110724pfe.23.2018.12.04.02.59.43; Tue, 04 Dec 2018 02:59:58 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=EtQvJ0LF; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726901AbeLDK6N (ORCPT + 99 others); Tue, 4 Dec 2018 05:58:13 -0500 Received: from mail.kernel.org ([198.145.29.99]:42374 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726881AbeLDK6K (ORCPT ); Tue, 4 Dec 2018 05:58:10 -0500 Received: from localhost (5356596B.cm-6-7b.dynamic.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 7C6022146D; Tue, 4 Dec 2018 10:58:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1543921090; bh=hBpKJb8G9eFot7Af/cyDWxswkIfd2WCq060JV0Wr4SA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=EtQvJ0LFqg+41ZTM8d6gboXCrULeAV7b/W4yl04C7IODsMsJln4qYXTXHwrJY0aZA xrlRmQnyiSnk3hfdKE0mB+zXGtUcSMfvgLBrFJZbrcvrYPh6ZNb4ZaD/NUJfXOe3mc klCkIlj4QgpEKYHm8wOEUv8Id4RCdgS2YI4E6eJQ= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Thomas Gleixner , Ingo Molnar , Peter Zijlstra , Andy Lutomirski , Linus Torvalds , Jiri Kosina , Tom Lendacky , Josh Poimboeuf , Andrea Arcangeli , David Woodhouse , Tim Chen , Andi Kleen , Dave Hansen , Casey Schaufler , Asit Mallick , Arjan van de Ven , Jon Masters , Waiman Long , Dave Stewart , Kees Cook Subject: [PATCH 4.19 042/139] sched/smt: Expose sched_smt_present static key Date: Tue, 4 Dec 2018 11:48:43 +0100 Message-Id: <20181204103651.711282955@linuxfoundation.org> X-Mailer: git-send-email 2.19.2 In-Reply-To: <20181204103649.950154335@linuxfoundation.org> References: <20181204103649.950154335@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review X-Patchwork-Hint: ignore MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.19-stable review patch. If anyone has any objections, please let me know. ------------------ From: Thomas Gleixner tglx@linutronix.de commit 321a874a7ef85655e93b3206d0f36b4a6097f948 upstream Make the scheduler's 'sched_smt_present' static key globaly available, so it can be used in the x86 speculation control code. Provide a query function and a stub for the CONFIG_SMP=n case. Signed-off-by: Thomas Gleixner Reviewed-by: Ingo Molnar Cc: Peter Zijlstra Cc: Andy Lutomirski Cc: Linus Torvalds Cc: Jiri Kosina Cc: Tom Lendacky Cc: Josh Poimboeuf Cc: Andrea Arcangeli Cc: David Woodhouse Cc: Tim Chen Cc: Andi Kleen Cc: Dave Hansen Cc: Casey Schaufler Cc: Asit Mallick Cc: Arjan van de Ven Cc: Jon Masters Cc: Waiman Long Cc: Greg KH Cc: Dave Stewart Cc: Kees Cook Cc: stable@vger.kernel.org Link: https://lkml.kernel.org/r/20181125185004.430168326@linutronix.de Signed-off-by: Greg Kroah-Hartman --- include/linux/sched/smt.h | 18 ++++++++++++++++++ kernel/sched/sched.h | 4 +--- 2 files changed, 19 insertions(+), 3 deletions(-) --- /dev/null +++ b/include/linux/sched/smt.h @@ -0,0 +1,18 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +#ifndef _LINUX_SCHED_SMT_H +#define _LINUX_SCHED_SMT_H + +#include + +#ifdef CONFIG_SCHED_SMT +extern struct static_key_false sched_smt_present; + +static __always_inline bool sched_smt_active(void) +{ + return static_branch_likely(&sched_smt_present); +} +#else +static inline bool sched_smt_active(void) { return false; } +#endif + +#endif --- a/kernel/sched/sched.h +++ b/kernel/sched/sched.h @@ -23,6 +23,7 @@ #include #include #include +#include #include #include #include @@ -930,9 +931,6 @@ static inline int cpu_of(struct rq *rq) #ifdef CONFIG_SCHED_SMT - -extern struct static_key_false sched_smt_present; - extern void __update_idle_core(struct rq *rq); static inline void update_idle_core(struct rq *rq)