Message ID | 168485843734.404.16847199234383553669.tip-bot2@tip-bot2 |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp2265242vqo; Tue, 23 May 2023 09:23:50 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ57qCGpZg4uIaLYi8Iv7D3juEnYq4ZZeejQDP8LqRf587v/0AjsoeD4nzdsLEMD2CFETnoe X-Received: by 2002:a05:6a21:1584:b0:10c:c163:c106 with SMTP id nr4-20020a056a21158400b0010cc163c106mr1016206pzb.24.1684859030374; Tue, 23 May 2023 09:23:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1684859030; cv=none; d=google.com; s=arc-20160816; b=Q6S2w2pWeS7D6UC+HqbfAeVeclFwR413S6aVT9Ui5KdCT7AyalGJGzbeOheTugQzya xC2FTq0geJyVxtwA1KpkbX9KX9P39EvEnuNPHh+vXr79NQvwQU2Fs3xtPAB3eBqltWIQ Odtc9DTLxnpLUq3kF/h03eHSviiwxTfkQnsWdjiSz09+nyA1kc0Hgleih7FA6DJVh+lG iMZdd80pcsxMtHOPXNALCNtZzsHsZXyxgRII7e5ymg0XaG+Atv+tCA5UtIenglxjPNLH cdUMpLfBA2X0aqA3GNNJ2BzdqJpzNWrZf/kh5MZ1icouFwol+N0iFMZg4/Eh+kFTrxgF aaWw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:robot-unsubscribe :robot-id:message-id:mime-version:references:in-reply-to:cc:subject :to:reply-to:sender:from:dkim-signature:dkim-signature:date; bh=1o3nB3jocoaLuOI5Obrg0Pu8tnjT0B5WS7aKcG30c3Y=; b=GGehjHJIabhrZBXleuHFAdITF6sJpuKCiGAX7+5hBJHKKeIuYXrXAqZH+jA75r2Cj/ peT1RuOSx3UVfTsT0bACzGESXOuOJERV79tx+3vJZS6v2a1MbsVlGDJ0RWVC/L8Y7GTP yXBtcWYNSelz5MD0aiLdvij0CnTQCYrKhMyfXJZ1q8EXoJ9RHtQAYCnKrn7qdlZ8HtuY wzGPqjZKUDlV/TruaZBoQbcITtjYmHc78kUbtcvRKU9nUx2vRKDPUCKkSu01bP02AHa3 7/A+rbcbSuDQnUN8CA/13YD+SQJ36nwhZDEXM3DcB9uEl7fSIyrcI1A9RcREhE+HAseb 3BHA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=Q4wL1SOb; dkim=neutral (no key) header.i=@linutronix.de; 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: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id b6-20020a637146000000b0053ef3c50929si1160202pgn.508.2023.05.23.09.23.33; Tue, 23 May 2023 09:23:50 -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=Q4wL1SOb; dkim=neutral (no key) header.i=@linutronix.de; 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 S237024AbjEWQOE (ORCPT <rfc822;ahmedalshaiji.dev@gmail.com> + 99 others); Tue, 23 May 2023 12:14:04 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35088 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236276AbjEWQOC (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Tue, 23 May 2023 12:14:02 -0400 Received: from galois.linutronix.de (Galois.linutronix.de [IPv6:2a0a:51c0:0:12e:550::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 119B8C2; Tue, 23 May 2023 09:14:00 -0700 (PDT) Date: Tue, 23 May 2023 16:13:57 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1684858438; 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=1o3nB3jocoaLuOI5Obrg0Pu8tnjT0B5WS7aKcG30c3Y=; b=Q4wL1SOb9nb9hZJ1ZPygVvgEoQvInC21KXzRQtsc/lO3otIZhyvgiBCTSA1UYwMD16KNrF zrV8is0x6hkvRMom/DUqX56fqXhwg6iBByudcInyhv5xMTOvmRIjq8Y5ry1Di2UuM/Tb47 hM7fWJtDadpsE/FKSCkk4gVJJ7m5ifLyiRnXH7anDyoYRM+xa2i4Tp7TMXibLGmLaVDwsH hEqLP82Rewf2Y6G8wGcqCvnvYokBJR+fPYF1Vg3Ltp6vARkxW90dQzC62i/XioLPljtCgT 9Pz8vWVB4IxhhRSvNE8EYDzlWKBlGngsRkDvTHKQNb+8DW1UJ0cpNZ37lmQbRw== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1684858438; 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=1o3nB3jocoaLuOI5Obrg0Pu8tnjT0B5WS7aKcG30c3Y=; b=Vmkwzh/2Q4t7kGk6VPI59MRREU6bQWu0aOWjFj/YXYkWApAM2zdfCBYGJvBhBkryOcKayc 2ZenPJQsd0wG1AAw== From: "tip-bot2 for Thomas Gleixner" <tip-bot2@linutronix.de> Sender: tip-bot2@linutronix.de Reply-to: linux-kernel@vger.kernel.org To: linux-tip-commits@vger.kernel.org Subject: [tip: smp/core] cpu/hotplug: Fix off by one in cpuhp_bringup_mask() Cc: Mark Brown <broonie@kernel.org>, Thomas Gleixner <tglx@linutronix.de>, x86@kernel.org, linux-kernel@vger.kernel.org In-Reply-To: <87wn10ufj9.ffs@tglx> References: <87wn10ufj9.ffs@tglx> MIME-Version: 1.0 Message-ID: <168485843734.404.16847199234383553669.tip-bot2@tip-bot2> Robot-ID: <tip-bot2@linutronix.de> Robot-Unsubscribe: Contact <mailto:tglx@linutronix.de> to get blacklisted from these emails Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit 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,T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED 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: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1766702742443265017?= X-GMAIL-MSGID: =?utf-8?q?1766702742443265017?= |
Series |
[tip:,smp/core] cpu/hotplug: Fix off by one in cpuhp_bringup_mask()
|
|
Commit Message
tip-bot2 for Thomas Gleixner
May 23, 2023, 4:13 p.m. UTC
The following commit has been merged into the smp/core branch of tip: Commit-ID: 06c6796e0304234da65e70577f354cb194086521 Gitweb: https://git.kernel.org/tip/06c6796e0304234da65e70577f354cb194086521 Author: Thomas Gleixner <tglx@linutronix.de> AuthorDate: Tue, 23 May 2023 01:12:26 +02:00 Committer: Thomas Gleixner <tglx@linutronix.de> CommitterDate: Tue, 23 May 2023 18:06:40 +02:00 cpu/hotplug: Fix off by one in cpuhp_bringup_mask() cpuhp_bringup_mask() iterates over a cpumask and starts all present CPUs up to a caller provided upper limit. The limit variable is decremented and checked for 0 before invoking cpu_up(), which is obviously off by one and prevents the bringup of the last CPU when the limit is equal to the number of present CPUs. Move the decrement and check after the cpu_up() invocation. Fixes: 18415f33e2ac ("cpu/hotplug: Allow "parallel" bringup up to CPUHP_BP_KICK_AP_STATE") Reported-by: Mark Brown <broonie@kernel.org> Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Tested-by: Mark Brown <broonie@kernel.org> Link: https://lore.kernel.org/r/87wn10ufj9.ffs@tglx --- kernel/cpu.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/kernel/cpu.c b/kernel/cpu.c index 005f863..88a7ede 100644 --- a/kernel/cpu.c +++ b/kernel/cpu.c @@ -1770,9 +1770,6 @@ static void __init cpuhp_bringup_mask(const struct cpumask *mask, unsigned int n for_each_cpu(cpu, mask) { struct cpuhp_cpu_state *st = per_cpu_ptr(&cpuhp_state, cpu); - if (!--ncpus) - break; - if (cpu_up(cpu, target) && can_rollback_cpu(st)) { /* * If this failed then cpu_up() might have only @@ -1781,6 +1778,9 @@ static void __init cpuhp_bringup_mask(const struct cpumask *mask, unsigned int n */ WARN_ON(cpuhp_invoke_callback_range(false, cpu, st, CPUHP_OFFLINE)); } + + if (!--ncpus) + break; } }