Received: by 2002:a4a:311b:0:0:0:0:0 with SMTP id k27-v6csp4779496ooa; Tue, 14 Aug 2018 10:25:55 -0700 (PDT) X-Google-Smtp-Source: AA+uWPzAC+6WolG+V7SVMPAk5tzRRmqnZDnEWAEUThGru94AcUBKj0/IYvemI+cfBPe6l9vVwnL7 X-Received: by 2002:a63:68c1:: with SMTP id d184-v6mr21865648pgc.239.1534267555360; Tue, 14 Aug 2018 10:25:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1534267555; cv=none; d=google.com; s=arc-20160816; b=RTMN6AHy5cA9fu9B/RkwUlzQMz6Ip5bRDtsKFLTK7Kz9yt5bJ/9wWjiUAMXznaMYiW /T7kCJAWB0kSzxgwSeiBQ5/SEZcQpaVcJg8nkvfiPleAbO4LFZfAeK7hx8nz+iOc8PJR DbIBhnRIYOKzXzHiId/6/ZTR+N3+Cz8XAUnwo9WNS/R+1f4OscK+J1F17biQ9XeIyn13 snU6QmrS86irVeiBtFtwDrqtdgoXZbmrWhgQZnCMegpbNAYj1l0Xex+OVDMGJGQw79IF 7wSiTomSXAeOLQ9KoHkkIbmAicAnpr03ZbuU9FYq61+Objb9mlkIwYGRIZZ4Vhlur8JE AfdA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :in-reply-to:message-id:date:subject:cc:to:from :arc-authentication-results; bh=WHLJXrOchJjd8gvyZ+DAfU4QnsSv2V2fjuX3MfyziIw=; b=ZsM6uFKzegY+Jzn3nF7hyqfOEWH+RDeG6Koib4lQ67BXEY+ebMF6N1g4z0eejc/qYE tmcAUucyirxRQWD0Vvc5mSkME22DmcmxcQ4/TNrMG8BvthWSjgDBhmS71wah9z2fE9nU BVRVVfdyexPH919pk9B3gCkQja6fN5uSdeTqDPSP2LZA9cOUGZUV+TodGR70Ij/8u+f7 MDkzgFy3PsRSCVT8K+nNOcHhGT8bu32XeWJH5FAWHX3GqGlE7ZfSprzBADZIWvcBu8O6 FKVdiwyu7mJJAE/BbDd6g+h3liji27Vt5ZODLi0fjLLTxLvAmIr37eJaRbg3EVpT7HB+ cPTQ== ARC-Authentication-Results: i=1; mx.google.com; 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 o123-v6si21799615pgo.190.2018.08.14.10.25.40; Tue, 14 Aug 2018 10:25:55 -0700 (PDT) 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; 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 S2387933AbeHNUMf (ORCPT + 99 others); Tue, 14 Aug 2018 16:12:35 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:51350 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2387747AbeHNUMe (ORCPT ); Tue, 14 Aug 2018 16:12:34 -0400 Received: from localhost (unknown [194.244.16.108]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id AA214CBA; Tue, 14 Aug 2018 17:24:28 +0000 (UTC) From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Dave Hansen , Thomas Gleixner , Ingo Molnar Subject: [PATCH 4.18 16/79] x86/topology: Provide topology_smt_supported() Date: Tue, 14 Aug 2018 19:16:35 +0200 Message-Id: <20180814171337.427637256@linuxfoundation.org> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20180814171336.799314117@linuxfoundation.org> References: <20180814171336.799314117@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.18-stable review patch. If anyone has any objections, please let me know. ------------------ From: Thomas Gleixner Provide information whether SMT is supoorted by the CPUs. Preparatory patch for SMT control mechanism. Suggested-by: Dave Hansen Signed-off-by: Thomas Gleixner Acked-by: Ingo Molnar Signed-off-by: Greg Kroah-Hartman --- arch/x86/include/asm/topology.h | 2 ++ arch/x86/kernel/smpboot.c | 8 ++++++++ 2 files changed, 10 insertions(+) --- a/arch/x86/include/asm/topology.h +++ b/arch/x86/include/asm/topology.h @@ -125,6 +125,7 @@ static inline int topology_max_smt_threa int topology_update_package_map(unsigned int apicid, unsigned int cpu); int topology_phys_to_logical_pkg(unsigned int pkg); bool topology_is_primary_thread(unsigned int cpu); +bool topology_smt_supported(void); #else #define topology_max_packages() (1) static inline int @@ -132,6 +133,7 @@ topology_update_package_map(unsigned int static inline int topology_phys_to_logical_pkg(unsigned int pkg) { return 0; } static inline int topology_max_smt_threads(void) { return 1; } static inline bool topology_is_primary_thread(unsigned int cpu) { return true; } +static inline bool topology_smt_supported(void) { return false; } #endif static inline void arch_fix_phys_package_id(int num, u32 slot) --- a/arch/x86/kernel/smpboot.c +++ b/arch/x86/kernel/smpboot.c @@ -280,6 +280,14 @@ bool topology_is_primary_thread(unsigned } /** + * topology_smt_supported - Check whether SMT is supported by the CPUs + */ +bool topology_smt_supported(void) +{ + return smp_num_siblings > 1; +} + +/** * topology_phys_to_logical_pkg - Map a physical package id to a logical * * Returns logical package id or -1 if not found