From patchwork Fri Feb 16 15:16:50 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: tip-bot2 for Thomas Gleixner X-Patchwork-Id: 202159 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:c619:b0:108:e6aa:91d0 with SMTP id hn25csp583476dyb; Fri, 16 Feb 2024 07:18:36 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCW7wFdjQ5Iz1W44hxOWrqpFSKa1tNOLBeHnmzXO1Jt6ZobsVpgsFUPmLWB0s6kULodhMEXluW80f529omEp3e8rkM9nGQ== X-Google-Smtp-Source: AGHT+IFWTTmajhMeY1seraFh3r0dO2Kfei37lQeN80UtFfUtsqSs/XWvX9td0gYB5Ggo4yUwoseF X-Received: by 2002:aa7:d950:0:b0:563:fc7c:9482 with SMTP id l16-20020aa7d950000000b00563fc7c9482mr1102431eds.1.1708096716257; Fri, 16 Feb 2024 07:18:36 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708096716; cv=pass; d=google.com; s=arc-20160816; b=c5Ph6j75mhcGUdeA5buAxIWZO0+DrC9nJ99MSbOBwyIFRsDwmd1HRl8yh9wZenMrm5 xWX15TxbitwZuKKJ0IYXCMeyC/VI4qdkB2ynGrJbkj9Gq3uShUtwKSCGxJt/d2t0pliX U6NTTvLA4ahIr2brNHXMaVpbxXYb1rBPxnAZYLAwTbvOfqtCk68MCyQthsKC+zLwhSGR MzeeC7gItXY45bJoeoSyFOeXlwDR3O1cV40iXhNKChcfZmzMAUJi1ilOIL+aYFU/ioe1 887UUATZ4gKkM9Z7s5qcea5zwqs6a2FPIzfiYVtXo6RuaXbADaGeXU11qYjCw3hVKnOM oOag== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:precedence:robot-unsubscribe:robot-id :message-id:mime-version:list-unsubscribe:list-subscribe:list-id :precedence:references:in-reply-to:cc:subject:to:reply-to:sender :from:dkim-signature:dkim-signature:date; bh=pvpcHu2e3O6rmpf62lLnlHs1KftwGXwpCIWQDAfShOE=; fh=HfXWoIhgCc+vt39DMIJv/Ec0aAKnw0eFA8QxuIQTUoQ=; b=FSdj1UfuoXsXDXzkMFvUnxy8keUKRhRnhsBmxkeEAyeO+BO5xORGa2KCkTfp7H8p4I mATr20bSluUV9DKRKxq7hzA5he3vhePgzNiIZCsO9b+EkUublaGXZTBc0F5pq/xv4EBr rjBoORVO1ateAjopMoFvgHx1kPy2ZJtWJtUyP2b4B23P2HXfrf9S+HuuU7JprOkeANzS EZ6M8UyW9zDuNJ/LrB48ROwVkdQYhznE/2WvrJvLmsW8AttgIHI1pRCUcJ69YjlldEWF GRFweH5tlZMSvxvmP17tRN1p+N/t0R2wH07GiGPiJlC4b/D4M8WwD+0OF5kJUK/3EHbt Dilw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b="hsJ/eEh/"; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e; arc=pass (i=1 spf=pass spfdomain=linutronix.de dkim=pass dkdomain=linutronix.de dmarc=pass fromdomain=linutronix.de); spf=pass (google.com: domain of linux-kernel+bounces-68797-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-68797-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id y5-20020aa7d505000000b0056400e62b71si51204edq.226.2024.02.16.07.18.36 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 16 Feb 2024 07:18:36 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-68797-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b="hsJ/eEh/"; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e; arc=pass (i=1 spf=pass spfdomain=linutronix.de dkim=pass dkdomain=linutronix.de dmarc=pass fromdomain=linutronix.de); spf=pass (google.com: domain of linux-kernel+bounces-68797-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-68797-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id DAFC21F21B96 for ; Fri, 16 Feb 2024 15:18:35 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id EAC91131E47; Fri, 16 Feb 2024 15:16:57 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="hsJ/eEh/"; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="sjih0QiM" Received: from galois.linutronix.de (Galois.linutronix.de [193.142.43.55]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 11AED12FB32; Fri, 16 Feb 2024 15:16:52 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=193.142.43.55 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708096614; cv=none; b=ggF5Q1Jndm24p+HXp5ne+3WWx/EnQa+uHna2f31nDlUylZTcz6jGN4b2B9hB5kLqLJ/MMKZZS4jshTHlxUKIP0nYCPwfEjjNtwXAR9eByJ97LPnEbx2PfVYaiw2v6tfPY6CDVB1iqwwDY6m8/5sDMWzA4Jn2VzwvD1p7ZJBFq+Y= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708096614; c=relaxed/simple; bh=UnQ6UWZ1b78WNk1udN307W3ub9CZWBVF30hIC4t4uj8=; h=Date:From:To:Subject:Cc:In-Reply-To:References:MIME-Version: Message-ID:Content-Type; b=BNlEIkjPxGTMZXa4lBr/6/ig6eb2VLHjrM2jjVpXU1tUr6/CPsXksPvYRJsK5WJdaIrly04ca0Ro7IXLCqkBZulnbBkhrqaLujE/VC0ioHWK7O2DYf6RciQb1ZXLdSqd9RMOfm5VdeLi2rW7pe8mn/+TkPNedGymYxPOgP/lzzU= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linutronix.de; spf=pass smtp.mailfrom=linutronix.de; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=hsJ/eEh/; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=sjih0QiM; arc=none smtp.client-ip=193.142.43.55 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linutronix.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linutronix.de Date: Fri, 16 Feb 2024 15:16:50 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1708096611; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=pvpcHu2e3O6rmpf62lLnlHs1KftwGXwpCIWQDAfShOE=; b=hsJ/eEh/1vHWuUHacMNKCfDHclqbmsPRxaRCru6mXCjKd2Ag0zOL9nCvhaFdZ3D4swXhuL c6yuAq+UrtAFF4gAbgohgXeMlQkYCSoiHWiFqexmkHcqzY6wMTPsEzCltQP+d7twujMvgr D92F9cmY6ALuP/9Swc+VV9p/hzRTaNPwW4LbX1VLRQRNYN6h+FrbCqEzS+XSqqGv5fcayW wKR9UiJpvSCpBiQ8sSJxqzuP8NGqzyRu60gLIT/LD5vs8inCq0GwJBqd5zPdCp2zYZ9SZM Kr/uZdeqbxt6G+x71teGa9UXBO8HA7+BKjrULDcoWwv+HwmuFbpWdQPmAp8Hlg== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1708096611; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=pvpcHu2e3O6rmpf62lLnlHs1KftwGXwpCIWQDAfShOE=; b=sjih0QiMYbRt07h0GG9nFDZDfDSlQ9yzHo2wNmLAE2C0PfT4s2EEvZ7nJrf9gldtfYuThc fHmkoW4o/GvnucAA== From: "tip-bot2 for Thomas Gleixner" Sender: tip-bot2@linutronix.de Reply-to: linux-kernel@vger.kernel.org To: linux-tip-commits@vger.kernel.org Subject: [tip: x86/apic] x86/cpu/topology: Simplify cpu_mark_primary_thread() Cc: Thomas Gleixner , Michael Kelley , Sohil Mehta , x86@kernel.org, linux-kernel@vger.kernel.org In-Reply-To: <20240213210252.791176581@linutronix.de> References: <20240213210252.791176581@linutronix.de> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-ID: <170809661071.398.6594587752889764685.tip-bot2@tip-bot2> Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails Precedence: bulk X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1790820241681753739 X-GMAIL-MSGID: 1791069221896136038 The following commit has been merged into the x86/apic branch of tip: Commit-ID: 5e40fb2d4a4c7503cab4f923b7d985dbcf583581 Gitweb: https://git.kernel.org/tip/5e40fb2d4a4c7503cab4f923b7d985dbcf583581 Author: Thomas Gleixner AuthorDate: Tue, 13 Feb 2024 22:06:06 +01:00 Committer: Thomas Gleixner CommitterDate: Thu, 15 Feb 2024 22:07:44 +01:00 x86/cpu/topology: Simplify cpu_mark_primary_thread() No point in creating a mask via fls(). smp_num_siblings is guaranteed to be a power of 2. So just using (smp_num_siblings - 1) has the same effect. Signed-off-by: Thomas Gleixner Tested-by: Michael Kelley Tested-by: Sohil Mehta Link: https://lore.kernel.org/r/20240213210252.791176581@linutronix.de --- arch/x86/kernel/cpu/topology.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/arch/x86/kernel/cpu/topology.c b/arch/x86/kernel/cpu/topology.c index f3397e2..aea408d 100644 --- a/arch/x86/kernel/cpu/topology.c +++ b/arch/x86/kernel/cpu/topology.c @@ -76,10 +76,7 @@ bool arch_match_cpu_phys_id(int cpu, u64 phys_id) #ifdef CONFIG_SMP static void cpu_mark_primary_thread(unsigned int cpu, unsigned int apicid) { - /* Isolate the SMT bit(s) in the APICID and check for 0 */ - u32 mask = (1U << (fls(smp_num_siblings) - 1)) - 1; - - if (smp_num_siblings == 1 || !(apicid & mask)) + if (!(apicid & (smp_num_siblings - 1))) cpumask_set_cpu(cpu, &__cpu_primary_thread_mask); } #else