Received: by 2002:a4a:311b:0:0:0:0:0 with SMTP id k27-v6csp4798511ooa; Tue, 14 Aug 2018 10:42:04 -0700 (PDT) X-Google-Smtp-Source: AA+uWPxZz6G4oxr8HuRT7Xl27qgJsBnk1eIfHsae65BlEpVt5PKUMsi8QCaexjL87f9VfvB5p4EE X-Received: by 2002:a62:dbc5:: with SMTP id f188-v6mr24726453pfg.182.1534268524302; Tue, 14 Aug 2018 10:42:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1534268524; cv=none; d=google.com; s=arc-20160816; b=D6L0pjEEYYvigscDmrw8dVgZEkoyt5/fM50yN0UcTiPO8byhpTtxd8k82iXyXWOYQs 8b2vA3kN5n6NX6fmRWrQ66/u9j/4QsSeXup7MjDkw2dcozA8CuHP9NIDXXu52vKcpDy8 todbg5J2oxPXX5JrDsrQthY3z93KAfJFFhxwTiqiGLcDnJt5v7SvIJC8LO1Vy8mhxkkQ zCPoBo9Qm9S/HdWn82cvrLKm1fXL6G/O0JiO00sj9JgQFGmwvAPaXHvKhZSPff9MtDBW vKCTpXrz8ACTOUo28LE7XLMme/QEO7T7UACI1z/QCOzTxRlYHaZcft+gl6s5z5le7sAY +NvQ== 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=EKVjC5pBO9H/PH8f80UN8xFK0MpcVY90LP44IlDLdNU=; b=Oeub7YEUuiUnU/EK9jVbxoTVBe8m19seObLddbxK1xZb1rqBix55zz/z6uDaTlABZz XegLxShfZKiSEscB45RRjt0shxxlte9VdEPrwZ/dIchtUErthfm7qyDOWuoHyrMCbbjB E/uAVfBp0+63K6Kq+aWswY7QoiOY/ocx3sbCd9zr5FJVfNWm5eWlzr4OsUJNx01cgFt+ Fm0ym9gy4aN3qFKd4pv84u9hEijm872kUfXnfBXvqawO0LLZ6j22cKTdtqb/g155/syO SHnmTcATTqGeOuVYH0Lpl/boGZt/Ppa3FaMrY/dvJKc4tA7r++UbLO5xiZzdBXoJiEte bdmQ== 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 u10-v6si16551134plu.506.2018.08.14.10.41.49; Tue, 14 Aug 2018 10:42:04 -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 S2389898AbeHNU3F (ORCPT + 99 others); Tue, 14 Aug 2018 16:29:05 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:58922 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732016AbeHNU3F (ORCPT ); Tue, 14 Aug 2018 16:29:05 -0400 Received: from localhost (unknown [194.244.16.108]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id EF63BD20; Tue, 14 Aug 2018 17:40:54 +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 , David Woodhouse Subject: [PATCH 4.9 038/107] x86/topology: Provide topology_smt_supported() Date: Tue, 14 Aug 2018 19:17:01 +0200 Message-Id: <20180814171523.075397492@linuxfoundation.org> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20180814171520.883143803@linuxfoundation.org> References: <20180814171520.883143803@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.9-stable review patch. If anyone has any objections, please let me know. ------------------ From: Thomas Gleixner commit f048c399e0f7490ab7296bc2c255d37eb14a9675 upstream 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: David Woodhouse 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 @@ -131,6 +131,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 @@ -138,6 +139,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 @@ -305,6 +305,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