Received: by 2002:a05:6359:6284:b0:131:369:b2a3 with SMTP id se4csp3053429rwb; Mon, 7 Aug 2023 07:36:10 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHg5iczANDAgbkURxt/c/KH8L191AI6N9geYnnaoIRHlrL7LIHoWBc7Juc9xy2HnBa5Cb6a X-Received: by 2002:a05:6a00:1583:b0:686:dd81:394c with SMTP id u3-20020a056a00158300b00686dd81394cmr9603629pfk.15.1691418970420; Mon, 07 Aug 2023 07:36:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1691418970; cv=none; d=google.com; s=arc-20160816; b=eYmZIP9WucfaQ4XkFPXwjQxY0u3ZnJkcybgK6vb6X43urMICOji89aa54+EHby8WAL JP5FinhKIJNP0uSSvX303EjUIQt5Uqrt4eRlSIIk33buS0w7tLU15iacdBK5apPms5KC v/l2qexqQA7nc4+st4AOswlL1pQnnzRflWLjtUBWmRRRSrooKVev7Ng0/pOY3Onm70Y7 Od8mFmr0Gh5yypsprRvveG4gxCICPryJi+FaXXHydhz06fa+4etYKn6MD8iCxxB3w80x JMjyUcUxw2SJYoeBje6boJQBAk8SD6/aEHg3axnqcfq/36Ignmm8/tD5SZpdezSCxn6t DGDQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:date:mime-version:references:subject:cc:to:from :dkim-signature:dkim-signature:message-id; bh=O0KDW/sYTBHvu9oVtl0ZsFwyd9vxUlUG4W0MOjFJymI=; fh=/92WVKYrcN3rA268QXyKzVtm/UtxHeI2lnbU295XDiQ=; b=bV4pc0lM2MjMQY8tX/22aUOm+28iRauwK1bKgge5zlrdp2PbGTQajH8JYTNC5/8YWp tWWsZTOW/l53ZM2f/v/d4JBOh1hBzneyAkr0cY7viKjNhizL8PTiQQVgsdnMHI8kQqA6 rP4iE3+8Z0rhGgXJezISY+EmbiDlyWTOcl9QkwqP2LGG/ot5vBic1Jlk0Pm5xKaLHkJC UGvuNeiuIeqmwO85NcNW6cahFTG6DfHUlsHIoqUyToNXFZaBlb9gQcn386TIJ1o5PUNW QDNO9WQRNlxkQCOvmlVYjpNaHGrBbrxCsQRdJeyyz1gtwBZF/+iFdaYM1XX0zjGh0gv7 WpCQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=t3Hs084e; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id v135-20020a63618d000000b0055bf0f7837bsi5745983pgb.278.2023.08.07.07.35.55; Mon, 07 Aug 2023 07:36:10 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=t3Hs084e; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234605AbjHGNyl (ORCPT + 99 others); Mon, 7 Aug 2023 09:54:41 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41372 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234537AbjHGNxc (ORCPT ); Mon, 7 Aug 2023 09:53:32 -0400 Received: from galois.linutronix.de (Galois.linutronix.de [IPv6:2a0a:51c0:0:12e:550::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 83EC710DB for ; Mon, 7 Aug 2023 06:53:25 -0700 (PDT) Message-ID: <20230807135028.108994145@linutronix.de> DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1691416404; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: references:references; bh=O0KDW/sYTBHvu9oVtl0ZsFwyd9vxUlUG4W0MOjFJymI=; b=t3Hs084e3DoW05cKYoExyL5JqxGOQGeY6g/3Npa24OxX90/jIAWvoJp2VZtl/PzH60CFM4 AWoC3TVzfhyTs/Zl1hICLPVl4bwsA3H5hSed5QJUj3vioP5D3t3yaUfCwgOe306cCLDIX2 lwUy7n+PMbEIRaugop6WVeJyUN5CADV7tSscsT/eT5dMnVkt0iFJIq4qh0o7GG8YsjFv+q WYOPA+5tp5qsIwDJLc+SZMDSPGYLnXDWvgLZ/rWNbwFXnAcFkn1elRVd2MYvmIxXYHagfP OEc+/6TetFXtuGlhnMsIwQt3p5cCK+zxUiKKqMNpVqu9r/nD1UeZukD+9klNMA== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1691416404; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: references:references; bh=O0KDW/sYTBHvu9oVtl0ZsFwyd9vxUlUG4W0MOjFJymI=; b=Kea/zMbKfuGzr86Q6qS2z1eetowyMK2zJNpkKtEP9NI/IRd7eQqlClwf5OTXTDdRM1Op7L 8tpp/zPts7qcGDCQ== From: Thomas Gleixner To: LKML Cc: x86@kernel.org, Tom Lendacky , Andrew Cooper , Arjan van de Ven , Huang Rui , Juergen Gross , Dimitri Sivanich , Michael Kelley , Sohil Mehta , K Prateek Nayak , Kan Liang , Zhang Rui , "Paul E. McKenney" , Feng Tang , Andy Shevchenko Subject: [patch 32/53] x86/cpu/topology: Simplify APIC registration References: <20230807130108.853357011@linutronix.de> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Date: Mon, 7 Aug 2023 15:53:23 +0200 (CEST) X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE, SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 --- arch/x86/kernel/cpu/topology.c | 23 +++-------------------- 1 file changed, 3 insertions(+), 20 deletions(-) --- a/arch/x86/kernel/cpu/topology.c +++ b/arch/x86/kernel/cpu/topology.c @@ -102,14 +102,6 @@ static int allocate_logical_cpuid(u32 ap 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++; } @@ -130,7 +122,7 @@ static void cpu_update_apic(int cpu, u32 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) @@ -150,21 +142,12 @@ static int generic_processor_info(int ap } 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; }