Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp28762622rwd; Wed, 5 Jul 2023 02:15:37 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ7LAOa79EYUP24xG/Hih1rGXgd4Sg2uOvzXVYjXc7xkIkEgPBBWTpmIhCcz/wnz3VFe78QB X-Received: by 2002:a05:6a20:1013:b0:128:ffb7:dcff with SMTP id gs19-20020a056a20101300b00128ffb7dcffmr13137892pzc.11.1688548537184; Wed, 05 Jul 2023 02:15:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1688548537; cv=none; d=google.com; s=arc-20160816; b=RgbUthTN9ugBHXBCywqmb8gWD1xN8cg9IKGTyrK2iMNAVqWNdyMK+GuDsBDZs2gMhf +8Iu6D6GTPXo6rbIUGP5Zl0MPiQoDWHpdkP4w8FmqzuR/GZNGSLELfNZdSrbMmtmFO4i 9zNg14MMtFk9ooKx/Q3WGrSnk7WnFRZodeD7sVgAMdPdLxzlgXfVf1pq4QBgCe04gMbs 1kjbeLJ15VMP0bY/WmwEwCujJzmjbGU/j1slJzxDAMSFb1J2EfUk2peO5el7uHnBmjMF 5F+D/NIhcevzXZQ/eA3kBIJtn7kzCb6dL6iULNt6lryeO/ji0A6nFE1Z8WJxevHnhxOO NHvA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:references:in-reply-to:subject:cc:to:dkim-signature :dkim-signature:from; bh=hf4glG5RrjzsZDHEwCTkoyrZ5ilmAB1pGZBJhpzC2Ts=; fh=F5SXCgUCSSS9yjYiXj20/K3gdGGHLAxZjE+pFRI2A7w=; b=wEvFGFO9hdh0yIPM1yeyRL0VBF2HHDjhAZZKXqD8Mb/LyWbgYa2HBdPB+x81Zs/2xG HaFAefgfT5YCer0GDIEUgxczblCacmgITvsmuN5M2DfSoGih/x2YLIddyElW230tn4aL AhZJy9/VhHZ7Q8J3ky4Hx7O9G/jvYIowxHkaXa5rBvpHsvWYWDN2e8Gzw2tI4OkD3eZm lXQR+DQ5AY5+SgCvKQjqd2dAKGXC2cgagoWpYxCJgYgbI88l7MuenKy3XWy6J+NY+A0r ll1BY4FFde/m0ECqrqW4p9Mmo8db2C2n+PYR8tbdxp3W8wSbdCbim9Myt2sTGnYjWFuF sU8Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=E2tkiAQP; dkim=neutral (no key) header.i=@linutronix.de header.b=WXuFSKXO; 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 p4-20020a1709026b8400b001b82bc35cf1si14840291plk.120.2023.07.05.02.15.20; Wed, 05 Jul 2023 02:15:37 -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=E2tkiAQP; dkim=neutral (no key) header.i=@linutronix.de header.b=WXuFSKXO; 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 S232081AbjGEI7a (ORCPT + 99 others); Wed, 5 Jul 2023 04:59:30 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38206 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232007AbjGEI72 (ORCPT ); Wed, 5 Jul 2023 04:59:28 -0400 Received: from galois.linutronix.de (Galois.linutronix.de [193.142.43.55]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3808F10E3 for ; Wed, 5 Jul 2023 01:59:26 -0700 (PDT) From: Thomas Gleixner DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1688547563; 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: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=hf4glG5RrjzsZDHEwCTkoyrZ5ilmAB1pGZBJhpzC2Ts=; b=E2tkiAQP8nJBMn1PkgdEZ69sQ2IlnvWWTH85RSq6aBRgUxQ8D7EPMNlv1NPOaOK8tPq9uM Vb7PNvXF/RH+Cne8w8ZXUUdEr4mvq/AtNGXWSclItV1Q67rt3N67l9a9h4B5BQc/sCplKI Ti4fkDAb9sWazTqTsoA1f8k7TjuY5y24Tb9eDS2Y58xE/nlSnssvI3XxGfw8KbnAlfhXU0 Oi5daN0zBbBTb45zKy9c/nURvGDq5WQGrkRfKT7YCdVG+0+C5NCFjRimZG4xXw1N71lfaS k5gNIpjqhlrwjM0SIdFRtUUKWtR/7E2aaM8p/h2T3gHx8BUvoChj90oihUtkVg== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1688547563; 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: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=hf4glG5RrjzsZDHEwCTkoyrZ5ilmAB1pGZBJhpzC2Ts=; b=WXuFSKXOCh1bWDYSwOVlOTwwgaxNSLNZrIvGR6iUs0KHjqUewYG+1ALcpaqMWc2qLLu8J1 r2WKhuAza3mrCBDw== To: Baokun Li Cc: arjan@linux.intel.com, ashok.raj@intel.com, ashok.raj@linux.intel.com, ebiederm@xmission.com, linux-kernel@vger.kernel.org, mario.limonciello@amd.com, thomas.lendacky@amd.com, tony.luck@intel.com, tonyb@cybernetics.com, x86@kernel.org, yangerkun , Baoquan He , kexec@lists.infradead.org Subject: Re: [BUG REPORT] Triggering a panic in an x86 virtual machine does not wait In-Reply-To: <71578392-63ed-02a9-24da-2adf8cce38c7@huawei.com> References: <20230615193330.608657211@linutronix.de> <71578392-63ed-02a9-24da-2adf8cce38c7@huawei.com> Date: Wed, 05 Jul 2023 10:59:23 +0200 Message-ID: <87ttui91jo.ffs@tglx> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable 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: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Jul 03 2023 at 11:44, Baokun Li wrote: > When I manually trigger panic in a qume x86 VM with > > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 `echo c > /proc/sysrq-trigger`, > > =C2=A0I find that the VM will probably reboot directly, but the=20 > PANIC_TIMEOUT is 0. > This prevents us from exporting the vmcore via panic, and even if we succ= eed > in panic exporting the vmcore, the processes in the vmcore are mostly > stop_this_cpu(). By dichotomizing we found the patch that introduced the > behavior change > > =C2=A0=C2=A0 45e34c8af58f ("x86/smp: Put CPUs into INIT on shutdown if p= ossible"), Bah, I missed that this is used by crash too. So if this happens to be invoked on an AP, i.e. not on CPU 0, then the INIT will reset the machine. Fix below. Thanks, tglx --- diff --git a/arch/x86/kernel/smpboot.c b/arch/x86/kernel/smpboot.c index ed2d51960a7d..e1aa2cd7734b 100644 --- a/arch/x86/kernel/smpboot.c +++ b/arch/x86/kernel/smpboot.c @@ -1348,6 +1348,14 @@ bool smp_park_other_cpus_in_init(void) if (apic->wakeup_secondary_cpu_64 || apic->wakeup_secondary_cpu) return false; =20 + /* + * If this is a crash stop which does not execute on the boot CPU, + * then this cannot use the INIT mechanism because INIT to the boot + * CPU will reset the machine. + */ + if (this_cpu) + return false; + for_each_present_cpu(cpu) { if (cpu =3D=3D this_cpu) continue;