From patchwork Fri Feb 16 15:17:01 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: 202188 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:c619:b0:108:e6aa:91d0 with SMTP id hn25csp588889dyb; Fri, 16 Feb 2024 07:27:02 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCVJ04bUr/Z4/gBoM7izlXPVuj6KhqsUK7o83GDOGPKXD3RRbSzRgXrHXgV12MFxain3CNPk7D49rtuHcbE89TS4Y+jVxA== X-Google-Smtp-Source: AGHT+IGgRvXlUYyY9GZJ5i1qraOBpyXVzsFQRp1Qh0YMz+iprSEWXxpxy9wEOLCzvXg70ftXu0Tz X-Received: by 2002:a17:90a:12cb:b0:296:67b:1894 with SMTP id b11-20020a17090a12cb00b00296067b1894mr7051068pjg.0.1708097222717; Fri, 16 Feb 2024 07:27:02 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708097222; cv=pass; d=google.com; s=arc-20160816; b=xv75YoJHxSOn+C45NhyJnuB16OMi7yYWqZa6vxQu8uIbo3EZvQcpEi7K4VoiWqzqcB bdCOR7bwuFiR2GWFIHyDCXBL4gSpBF0SRLk2KuBhU/hfGN1bdZ1PMlzj7drKnu5Iorf4 XTHRlQVsqkfGS2SNz1vwYQr+YD+z7QOCKqBZSl93TiYJCKDzmGib1eQfhYsgxAwk7Zt4 QnVOljQfyMBV34Vdb/WvwjqMhQjgQEwnUi0GWJayimeIdrK/xcCWUX0PPmfjP6VHdgLn pXsm+kIuIpr89U3CLuH/j8QjynXDNX5BkZurpWjZXzH4JRJMjub3XLz8otuoD7rn9QII Ym6w== 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=kPjihb+DTzL+jkBdhj9A0lxeAb+aMfJaCci4rNsJ+cU=; fh=HfXWoIhgCc+vt39DMIJv/Ec0aAKnw0eFA8QxuIQTUoQ=; b=B0A8g4OMSkjI5KAx3JttrYQhEModmOEfsW5IL9k6lUn4JcCELOplg3SgS51BdDOdxj 5iIiYzG0oxIuwE5iIAOe4f/N3BrbNp5yogJur6isZD5YweUuXXUmbatXmMyZWgORJW2j rR5HrqSS4Hh0sBbDqVn2Jh5CDtmvDHXhTrVkvuZ/yoAl60Wf4zlEcgFRMRhXPFNhzSgQ 8HVfIBKVj7OqRd+b6v0K0FyK9YNz/4ba61CYztO/ZkT8SBDQtRg1jrlKEmQJnCPXTWA8 Fghg89BZ2T31Mk8NqNbyk94rGsYw+zpwR5tmhr6VI2SuEdy7LGhUoLG0ZvBLHHXFoJ3A xVTQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=0hZgJf5U; 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-68810-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-68810-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [147.75.48.161]) by mx.google.com with ESMTPS id p21-20020a17090ad31500b0029641c715ffsi104551pju.90.2024.02.16.07.27.02 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 16 Feb 2024 07:27:02 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-68810-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) client-ip=147.75.48.161; Authentication-Results: mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=0hZgJf5U; 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-68810-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-68810-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 sy.mirrors.kernel.org (Postfix) with ESMTPS id 73FFFB24938 for ; Fri, 16 Feb 2024 15:21:23 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 24FF713665E; Fri, 16 Feb 2024 15:17:09 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="0hZgJf5U"; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="hifQFBHT" 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 793031350C0; Fri, 16 Feb 2024 15:17:04 +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=1708096626; cv=none; b=Q/xp1pWWEfwP0lbB1F3GkKhY3BGUiZKgm/nDtfZlPERyo26F0oyqckUKvkEMHuv+VPmdQNJHXVuCjXt1V9/FdeZKCWEZz4x1sqE7rDLVeIgcmft22rjyvt+ktx0QwFTL25AsuVE3jhOkFCHYzAgDn03YJBEMytcNRaqEk7Y3lGw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708096626; c=relaxed/simple; bh=8OXqzqDqiAgXRX98bDsNqwUJ49zoas/C+H4VBVzBs9E=; h=Date:From:To:Subject:Cc:In-Reply-To:References:MIME-Version: Message-ID:Content-Type; b=XbC+uUqaaJKTE5nWZH3eTJ8rsHd1Zzsi/0dTirzmRFbk5zoR7qBCZIb3ed++UxBneI85b83cYqpjF3bs/v+AqjZvMVgrbEd+3TuW/pZLDqT2kK1XcPBQOKV2ZASBq4CTYmgD8zwS2dN3ZFIWLq6+L60duxwVmZu8hUau22sj7kA= 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=0hZgJf5U; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=hifQFBHT; 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:17:01 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1708096622; 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=kPjihb+DTzL+jkBdhj9A0lxeAb+aMfJaCci4rNsJ+cU=; b=0hZgJf5U0+ryVPVBK+3rP2gOH4/zt7IpKhjl3PvqHl1pgcXZLytoaB6dFo14eAQFR3E8JN ezUeIIh/1YAi0VOS614mjAafhwo0LvW+kV6Vi+5Yeq8ER8+0vYww9+rVCEtvIPJI0OUMoV PcmVYtcKjjeDvRRrm4PGgRe1fc/Dt3PehQ6vOvNjh0UdD2TA3wzJKOcvHePwynBwDuELtB xLgMvFWnhL7n1Kqc2cKjG+uYqJ3Pn7m0rioupZlQoL4u/l6y+qttLw+h4jHYhZTHj24WAu 5Qir3r5uVqL1NrfDCQCQQIlbacf6Wjpnj4+H9xYe8072B1BuDwFdRngWEk5GRA== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1708096622; 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=kPjihb+DTzL+jkBdhj9A0lxeAb+aMfJaCci4rNsJ+cU=; b=hifQFBHTgVNosPSDIXA+BOrpXWW/rfZ4C4siquudH7O1yyAaHBeQuYNrTu5zVLd+2DJOpu mfjQ/cCIlDXV2WBw== 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 APIC registration Cc: Thomas Gleixner , Michael Kelley , Sohil Mehta , x86@kernel.org, linux-kernel@vger.kernel.org In-Reply-To: <20240213210252.050264369@linutronix.de> References: <20240213210252.050264369@linutronix.de> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-ID: <170809662197.398.5373559794664776495.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: 1790820006031630890 X-GMAIL-MSGID: 1791069753653709038 The following commit has been merged into the x86/apic branch of tip: Commit-ID: 4c4c6f38704ab0e3f85f660b7479de7aa559d79a Gitweb: https://git.kernel.org/tip/4c4c6f38704ab0e3f85f660b7479de7aa559d79a Author: Thomas Gleixner AuthorDate: Tue, 13 Feb 2024 22:05:47 +01:00 Committer: Thomas Gleixner CommitterDate: Thu, 15 Feb 2024 22:07:43 +01:00 x86/cpu/topology: Simplify APIC registration Having the same check whether the number of assigned CPUs has reached the nr_cpu_ids limit twice in the same code path is pointless. Repeating the information that CPUs are ignored over and over is also pointless noise. Remove the redundant check and reduce the noise by using a pr_warn_once(). Signed-off-by: Thomas Gleixner Tested-by: Michael Kelley Tested-by: Sohil Mehta Link: https://lore.kernel.org/r/20240213210252.050264369@linutronix.de --- arch/x86/kernel/cpu/topology.c | 23 +++-------------------- 1 file changed, 3 insertions(+), 20 deletions(-) diff --git a/arch/x86/kernel/cpu/topology.c b/arch/x86/kernel/cpu/topology.c index a6c9314..8b42918 100644 --- a/arch/x86/kernel/cpu/topology.c +++ b/arch/x86/kernel/cpu/topology.c @@ -107,14 +107,6 @@ static int allocate_logical_cpuid(u32 apic_id) if (cpu >= 0) return cpu; - /* Allocate a new cpuid. */ - if (nr_logical_cpuids >= nr_cpu_ids) { - WARN_ONCE(1, "APIC: NR_CPUS/possible_cpus limit of %u reached. " - "Processor %d/0x%x and the rest are ignored.\n", - nr_cpu_ids, nr_logical_cpuids, apic_id); - return -EINVAL; - } - cpuid_to_apicid[nr_logical_cpuids] = apic_id; return nr_logical_cpuids++; } @@ -135,7 +127,7 @@ static void cpu_update_apic(int cpu, u32 apicid) static int generic_processor_info(int apicid) { - int cpu, max = nr_cpu_ids; + int cpu; /* The boot CPU must be set before MADT/MPTABLE parsing happens */ if (cpuid_to_apicid[0] == BAD_APICID) @@ -155,21 +147,12 @@ static int generic_processor_info(int apicid) } if (num_processors >= nr_cpu_ids) { - int thiscpu = max + disabled_cpus; - - pr_warn("APIC: NR_CPUS/possible_cpus limit of %i reached. " - "Processor %d/0x%x ignored.\n", max, thiscpu, apicid); - + pr_warn_once("APIC: CPU limit of %d reached. Ignoring further CPUs\n", nr_cpu_ids); disabled_cpus++; - return -EINVAL; + return -ENOSPC; } cpu = allocate_logical_cpuid(apicid); - if (cpu < 0) { - disabled_cpus++; - return -EINVAL; - } - cpu_update_apic(cpu, apicid); return cpu; }