Received: by 2002:a05:6358:51dd:b0:131:369:b2a3 with SMTP id 29csp180069rwl; Wed, 9 Aug 2023 12:54:00 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHlm/qElXAhTJ5NuqlVhKBlIi+R+QwGp4VNV1Tl2EvpTtiLR90yfkm0DlnxNQeoqQQSjNZ6 X-Received: by 2002:aa7:d9d4:0:b0:522:3ea4:81a9 with SMTP id v20-20020aa7d9d4000000b005223ea481a9mr135087eds.34.1691610839868; Wed, 09 Aug 2023 12:53:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1691610839; cv=none; d=google.com; s=arc-20160816; b=uswBUee0EEYFyODRH6zFSzwvyJ1z4LUYUuyTogBtkZVG9watrRpz52fCFIjahskxa7 SC1vZTYkCk8oncJdPjHRqpIodwuWcABgkZuaP9BhrpEPiP07CYoOHetR0DZuQCnXc4CU quQOPUQv+/Q+CqDLXzEg/rrx+0I/TESU71whA3KFe2jTHH5Xk1PqOJ75h/GUh/u6GRGh qubh2QIGhz9CwWoZMDAtdvGMluy1drr8A9v3P8nBfsLFjNYOZ78ncOU21wFsNDNxpHR7 hFszEL7zlSn/6Wwv3yIvxJVdwwAMHKUyLoIsCcVZpRVp04k+kh8DkYrLP9JRDacTrsjH ttBg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:message-id:date:references :in-reply-to:subject:cc:to:dkim-signature:dkim-signature:from; bh=/G5x28dNg7GMIHWjkdXyKIsCbog68qMAXixeAIS5e5I=; fh=zQFgBNR8ewSuEKioy7wxf0+YLJQhd+5p9Zem5Ld2mes=; b=gTODkqFbNucESRznfKFfnByTiZyKwvJf3s/v7KQI0NCUmQYJTxHYkZyv1nTXJuzkjK ULZw+qIAqHR5gLV1GPikkqJQCF6mYwT5OBpwlRLQt3eLuoVCrarSmxU6E2vSNahOBrUK sgG2QcQES6VXou6H79QQ+k1n8oI8yHQ2u4kA1O6DLPuTjhzxv73zVGrgWu6Qbw4rm932 EqTvaxXY/4zfeDET9AcIa3PA3dhNOjJIQE9asTlbEIoyU8u5jMN2LtlepjbHWMXj9Dwl aZwmXQ1JBa7CFRce2l4lSAD/7fHkJnKXSSabGj90m7jYp7yx2oM6DyMOLlMOgxhXsnCK j7ww== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=ErFAYrLu; 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id u19-20020aa7d993000000b0052333df2015si5785610eds.627.2023.08.09.12.53.34; Wed, 09 Aug 2023 12:53:59 -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=ErFAYrLu; 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 S232504AbjHISm2 (ORCPT + 99 others); Wed, 9 Aug 2023 14:42:28 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37008 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229663AbjHISm1 (ORCPT ); Wed, 9 Aug 2023 14:42:27 -0400 Received: from galois.linutronix.de (Galois.linutronix.de [IPv6:2a0a:51c0:0:12e:550::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 54010DC for ; Wed, 9 Aug 2023 11:42:26 -0700 (PDT) From: Thomas Gleixner DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1691606543; 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: in-reply-to:in-reply-to:references:references; bh=/G5x28dNg7GMIHWjkdXyKIsCbog68qMAXixeAIS5e5I=; b=ErFAYrLuPJhgtLnt1PQeV97MDT3vjpbXf1UOE0eX1GaspvJ6pL1vMRx23OROk8UED5qgZn 9n1XUA5ttSBH2ncpZOZOyb8xo9yws1b/8VjvlrHC/9qltDdFyM3tR36trCjFW/od+O21In YIqK9t+QtiFJgpQ2qVOVVLRm4ODwND6ulnTNhtumddEitgni5ozQ0WubOXRtzFFcIDh59C MoOydyjWgWWc1VNWd4Fw45BVwTuKie0WVcX//Hb+N38hp2MdolKvzArseNRmv5/b8ey3hx cYNoObm0X2uSvrdtmbEWeyXFPpKJYPh1zNeUgeJzhdvyU1GjBy/JGBfz6dMk1g== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1691606543; 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: in-reply-to:in-reply-to:references:references; bh=/G5x28dNg7GMIHWjkdXyKIsCbog68qMAXixeAIS5e5I=; b=k7yvAzKW45jGN7rQ+a6M/RLd0fBGbTQ47fufJjg6WQqIB44q0ioP8xHftnPXQtmY4Hgzc9 zQHZYOYmeldZKZBQ== To: Vasant Hegde , linux-kernel@vger.kernel.org Cc: x86@kernel.org, dave.hansen@linux.intel.com, bp@alien8.de, mingo@redhat.com, Vasant Hegde , Dheeraj Kumar Srivastava Subject: Re: [PATCH] x86/smp: Validate APIC ID before parking CPU in INIT In-Reply-To: <20230719051302.15801-1-vasant.hegde@amd.com> References: <20230719051302.15801-1-vasant.hegde@amd.com> Date: Wed, 09 Aug 2023 20:42:23 +0200 Message-ID: <87fs4sjbw0.ffs@tglx> MIME-Version: 1.0 Content-Type: text/plain X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_BLOCKED, SPF_HELO_NONE,SPF_PASS,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: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Jul 19 2023 at 05:13, Vasant Hegde wrote: > Below commit is causing kexec to hang in certain scenarios with >255 CPUs. > > Reproduce steps: > - We are using 2 socket system with 384 CPUs > - Booting first kernel with kernel command line intremap=off > This disabled x2apic in kernel and booted with apic mode > - During kexec it tries to send INIT to all CPUs except boot CPU > If APIC ID is 0x100 (like in our case) then it will send CPU0 > to INIT mode and system hangs (in APIC mode DEST field is 8bit) It took me a while to decode the above. > Fix this issue by adding apic->apic_id_valid() check before sending > INIT sequence. Sigh, yes. > Fixes: 45e34c8af58f ("x86/smp: Put CPUs into INIT on shutdown if possible") > Reported-by: Dheeraj Kumar Srivastava > Tested-by: Dheeraj Kumar Srivastava > Signed-off-by: Vasant Hegde > --- > arch/x86/kernel/smpboot.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/arch/x86/kernel/smpboot.c b/arch/x86/kernel/smpboot.c > index e1aa2cd7734b..e5ca0689c4dd 100644 > --- a/arch/x86/kernel/smpboot.c > +++ b/arch/x86/kernel/smpboot.c > @@ -1360,7 +1360,7 @@ bool smp_park_other_cpus_in_init(void) > if (cpu == this_cpu) > continue; > apicid = apic->cpu_present_to_apicid(cpu); > - if (apicid == BAD_APICID) > + if (apicid == BAD_APICID || !apic->apic_id_valid(apicid)) > continue; > send_init_sequence(apicid); > }