Received: by 2002:a05:6358:51dd:b0:131:369:b2a3 with SMTP id 29csp164800rwl; Wed, 9 Aug 2023 12:36:12 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGhICQnqb2R0XW6fh3c41sIFFoVRPbIKdo/0mNZClPFeoQBpmhA7jb++Es/6iPU6VuCWr/o X-Received: by 2002:a05:6402:4305:b0:522:aad4:aae0 with SMTP id m5-20020a056402430500b00522aad4aae0mr725214edc.3.1691609771958; Wed, 09 Aug 2023 12:36:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1691609771; cv=none; d=google.com; s=arc-20160816; b=y+Xqm6U+t3VE+MbZhu7ovyUfNJB1NeBPKmnOdspG7Y/7795J5h+1pxYzH23o7HumB1 sd0Ug1MRl+ETHacd6DwyAMB8Q56GdufUONl+m+n/g//ryCEoYSWvJlkuFczuuCXbi+FP 89EzbW19N4hEhnv2GNbNjhPbcMpQh7AbEK9bxCBYaYAZXrj57rbzvsetvvAhrER1B8fv co8PtlWQo1CG4qTA9YJGEYBjNxjJMf1wYS/0nTne0FACOUqYqE4wqTpjbhAHLyBV+Sou 4LDCegemH3PdWNeN0GxS3/s5DnIoCRpAif4y2RhPAqogbFfTC8XsmlaKPq2wvKNWTedd Qfgw== 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=vVAZNBEf9TZB47u+PP18kH0WXGdLWzh3aUx3yXvqMOA=; fh=zQFgBNR8ewSuEKioy7wxf0+YLJQhd+5p9Zem5Ld2mes=; b=ixluGcX3pGhcwuD9c85KQ6mZxDFrNWwVQrN9SihRwp6NAXyc1t7l06JnC/YkB9Jiw2 QmRahTesCtfXH+7vf8OGZcc8ajb46fmY7zZC5gcW3JnaQ1+m7906Q7DgjHMEbrHDp713 6V7diiZxSubHxKhVVQ86Xjc518r7yVbVYsgeH/looZV99CnPzCsgzdY9DK69lq2711da kQXEIuXgJpnAf/NT+L2kjqBYQgx/+2g4EpnxYBu5bmQeyNgWw9eRV+wTkpWA36fvc42k F9hMfNTrqRjhY/ggsI66CQp9IvUkWFhsMq79akTxiIbLMuurPS8IzVz3O6VIZLQ/r3zO vsnA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b="Y/6nHyzH"; 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 n3-20020a056402514300b00523364b34d8si5621908edd.501.2023.08.09.12.35.47; Wed, 09 Aug 2023 12:36:11 -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="Y/6nHyzH"; 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 S233196AbjHISwX (ORCPT + 99 others); Wed, 9 Aug 2023 14:52:23 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57588 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232506AbjHISwW (ORCPT ); Wed, 9 Aug 2023 14:52:22 -0400 Received: from galois.linutronix.de (Galois.linutronix.de [193.142.43.55]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 45E92E64 for ; Wed, 9 Aug 2023 11:52:22 -0700 (PDT) From: Thomas Gleixner DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1691607140; 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=vVAZNBEf9TZB47u+PP18kH0WXGdLWzh3aUx3yXvqMOA=; b=Y/6nHyzHTQ7H1P2QNteCJHnHVsYaUeFbLHjl/gfzAF3q2OvfQ+8Ejl5EDrpEGRcJnyqTSs 4DCe6d5QqKY7Z+20pz+/EHZ65eRftvaw59br/FfHjwCpg9bevBWuVFX8A4SJfm5xPfZTg3 AWtcF2W7G+uV/BuXMMBdUbELF6G9RV1MJOntTUKw7M1kFx2dQbkYlw8k3FAWlKfnsfySv3 cRnO/6oTFqo03/S79tEYRZQ/uI4663WuLOB9HqrtD9RAYwe3vNFMQEGW4VouE2gA1u5khT a0Xc7iRaVrgf8wijmmoX5otxsIMrMQ2D/tCx9LWO5OpmNd7l7+UNhYXDvrnFWA== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1691607140; 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=vVAZNBEf9TZB47u+PP18kH0WXGdLWzh3aUx3yXvqMOA=; b=2Lst8U+dzkiLqSqIybdDkNYox+XXZcV24STjUE1iw2Qtu9xXh4UZYdENNN2Ug5ROv08bnH v3sHLgm4MtskHcAw== 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: <87fs4sjbw0.ffs@tglx> References: <20230719051302.15801-1-vasant.hegde@amd.com> <87fs4sjbw0.ffs@tglx> Date: Wed, 09 Aug 2023 20:52:20 +0200 Message-ID: <87cyzwjbff.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, Aug 09 2023 at 20:42, Thomas Gleixner wrote: > On Wed, Jul 19 2023 at 05:13, Vasant Hegde wrote: >> 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); >> } I think this papers over the underlying problem that this sends INIT to an APIC which was never booted. The below is curing the root cause. Thanks, tglx --- --- a/arch/x86/kernel/smpboot.c +++ b/arch/x86/kernel/smpboot.c @@ -1356,7 +1356,7 @@ bool smp_park_other_cpus_in_init(void) if (this_cpu) return false; - for_each_present_cpu(cpu) { + for_each_cpu_and(cpu, &cpus_booted_once_mask, cpu_present_mask) { if (cpu == this_cpu) continue; apicid = apic->cpu_present_to_apicid(cpu);