Received: by 2002:a05:7412:b130:b0:e2:908c:2ebd with SMTP id az48csp485221rdb; Fri, 17 Nov 2023 04:48:04 -0800 (PST) X-Google-Smtp-Source: AGHT+IGHAkZ03tBxtlsxWXJ8ocHV7Eb1PlQTMPHF+1s54o5VQHNFSH4kAjpToIB5ip0Hcxq42whv X-Received: by 2002:a05:6e02:1e0a:b0:359:6dce:67bb with SMTP id g10-20020a056e021e0a00b003596dce67bbmr25738858ila.23.1700225283959; Fri, 17 Nov 2023 04:48:03 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1700225283; cv=none; d=google.com; s=arc-20160816; b=CAjhhYGhjz1nDE/SPo2rK1UjQo5mDFedEMt9l1Fy9MT2MkinE1krKwM8al0yRwqi8k BQI+VNKOUa/o50uRYmBAjSlTQYkD2CbG70ADbRvq5vp5GDJPBrCZCneSMzOlhGG9L2oJ cpmNDj5l7tLGaWfShNS0FNBZFnS5vwJyXOt11NpgcGyQCxAg7YsktazhfpRItG+JYUDh 3onKFi6ipIOe9ZMcT1DeZCUHcKuLT7bOOQoX3w86sYpjE3fzVnr9NPtqiiua8S3oIhn7 jD13ugwifPst872/hj0IN+b+wu/kvEolTgf5mMKDxrnF/5ftnzGb2C0sC0VG79zvykLA gXxA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=HkCs+QXo5+TKdGbCU9asTjU1bXzv18R9CKcNtfWUJ68=; fh=b1CtWOVMAK8JQs6DB+SVg+AtEQpeOtyGwB1IJYlzURY=; b=KKUIC+L7CghhBzxCmyrb+2MA2su3MQzOEkiqS5bujZJzQ/K6Viz9RYPgZAwmoNd7/K McbCqr9Wf0erNdcorbnHZhJ7Nfz6PAQlTcwGdpgpRU92PM4p6yIZmlJ0b7PUuR9+rVsH avg+wWGaIbauUwHrmnRK6M2pbiCN6ePawK2JWWYOBpdwoV5toYNfHXhf5Sf3ViTtr6ML ez6WQ+clLPuQRxkOpjaaJcwpzVjGBGJ143NKYIIoZ+50ZJOq3djrsNOmDHTesL42fjxZ UtYOc8qom+UB84IUl02wzaBGhDpgQJK937hgWAnV7FUChUF75jVQQdkHOd77/uyXwC5C jXeQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=GaYQqc1Q; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from snail.vger.email (snail.vger.email. [2620:137:e000::3:7]) by mx.google.com with ESMTPS id u3-20020a656703000000b00584b6af3b9fsi1782176pgf.524.2023.11.17.04.48.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 17 Nov 2023 04:48:03 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) client-ip=2620:137:e000::3:7; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=GaYQqc1Q; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by snail.vger.email (Postfix) with ESMTP id 1EA0182958BF; Fri, 17 Nov 2023 04:48:02 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231311AbjKQMsB (ORCPT + 99 others); Fri, 17 Nov 2023 07:48:01 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55370 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229543AbjKQMsA (ORCPT ); Fri, 17 Nov 2023 07:48:00 -0500 Received: from mgamail.intel.com (mgamail.intel.com [192.55.52.88]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C4921D4E for ; Fri, 17 Nov 2023 04:47:56 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1700225276; x=1731761276; h=date:from:to:cc:subject:message-id:references: mime-version:in-reply-to; bh=Vrg5gUZ/jMGqMBt8YEN5qhHkBV7QEHhcKHWcin9Xb64=; b=GaYQqc1QstR9B6ou+3viCSLWwPm5b//hTWcpztporfTSLpwKYzzEhqSW Rr4J4RGzmSzJaRoxccA/mNm1mlpc7wwaO5icvtl+PINa5xt2JAcU7WcCM Tpie/pNsATVnRWKa0iLh33a/i7DScK6064JoJZiqoLg7gOcP5+1c55MaO tvbCCwe04jJtnDhV220eEtVKlzZ7/hZBbLtLm54T9gcF5c/2LvujPEQYw IwjCtd1UjDomwVdDBAyASVwyXPBrxN1lwsmYGzl8NNyc70clSGiTW9CJw VWgoatMvzEVpkjHYsNN4LhEZCgftfa4dBTNaciXkgVb/RVOcAIFnMil1A A==; X-IronPort-AV: E=McAfee;i="6600,9927,10896"; a="422388078" X-IronPort-AV: E=Sophos;i="6.04,206,1695711600"; d="scan'208";a="422388078" Received: from orsmga008.jf.intel.com ([10.7.209.65]) by fmsmga101.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 17 Nov 2023 04:47:56 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10896"; a="794827071" X-IronPort-AV: E=Sophos;i="6.04,206,1695711600"; d="scan'208";a="794827071" Received: from fsforza-mobl1.ger.corp.intel.com (HELO box.shutemov.name) ([10.249.44.215]) by orsmga008-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 17 Nov 2023 04:47:51 -0800 Received: by box.shutemov.name (Postfix, from userid 1000) id 8D3D310A32D; Fri, 17 Nov 2023 15:47:48 +0300 (+03) Date: Fri, 17 Nov 2023 15:47:48 +0300 From: "Kirill A. Shutemov" To: Baoquan He Cc: Thomas Gleixner , Ingo Molnar , Borislav Petkov , Dave Hansen , x86@kernel.org, "Rafael J. Wysocki" , Peter Zijlstra , Adrian Hunter , Kuppuswamy Sathyanarayanan , Elena Reshetova , Jun Nakajima , Rick Edgecombe , Tom Lendacky , "Kalra, Ashish" , Sean Christopherson , "Huang, Kai" , kexec@lists.infradead.org, linux-coco@lists.linux.dev, linux-kernel@vger.kernel.org Subject: Re: [PATCHv3 00/14] x86/tdx: Add kexec support Message-ID: <20231117124748.umfuc3no2qvh4shj@box.shutemov.name> References: <20231115120044.8034-1-kirill.shutemov@linux.intel.com> <20231116125612.daxettqcapled7ac@box.shutemov.name> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_EF,RCVD_IN_DNSWL_BLOCKED, RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,SPF_NONE, 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 X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (snail.vger.email [0.0.0.0]); Fri, 17 Nov 2023 04:48:02 -0800 (PST) On Thu, Nov 16, 2023 at 10:45:23PM +0800, Baoquan He wrote: > On 11/16/23 at 10:17pm, Baoquan He wrote: > > On 11/16/23 at 03:56pm, Kirill A. Shutemov wrote: > > > On Thu, Nov 16, 2023 at 08:10:47PM +0800, Baoquan He wrote: > > > > On 11/15/23 at 03:00pm, Kirill A. Shutemov wrote: > > > > > The patchset adds bits and pieces to get kexec (and crashkernel) work on > > > > > TDX guest. > > > > > > > > I finally got a machine of intel-eaglestream-spr as host and built a > > > > tdx guest to give it a shot, the kexec reboot is working very well, > > > > while kdump kernel always failed to boot up. I only built kernel and > > > > installed it on tdx guest. > > > > ------------------------------------------ > > > > [ 1.422500] Run /init as init process > > > > [ 1.423073] Failed to execute /init (error -2) > > > > [ 1.423759] Run /sbin/init as init process > > > > [ 1.424370] Run /etc/init as init process > > > > [ 1.424969] Run /bin/init as init process > > > > [ 1.425588] Run /bin/sh as init process > > > > [ 1.426150] Kernel panic - not syncing: No working init found. Try passing init= option to kernel. See Linux Documentation/admin-guide/init.rst for guidance. > > > > [ 1.428122] CPU: 0 PID: 1 Comm: swapper/0 Not tainted 6.7.0-rc1-00014-gbdba31ba3cec #3 > > > > [ 1.429232] Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS unknown 2/2/2022 > > > > [ 1.430328] Call Trace: > > > > [ 1.430717] > > > > [ 1.431041] dump_stack_lvl+0x33/0x50 > > > > [ 1.431581] panic+0x324/0x340 > > > > [ 1.432037] ? __pfx_kernel_init+0x10/0x10 > > > > [ 1.432629] kernel_init+0x174/0x1c0 > > > > [ 1.433149] ret_from_fork+0x2d/0x50 > > > > [ 1.433690] ? __pfx_kernel_init+0x10/0x10 > > > > [ 1.434277] ret_from_fork_asm+0x1b/0x30 > > > > [ 1.434850] > > > > [ 1.435345] Kernel Offset: disabled > > > > [ 1.439216] Rebooting in 10 seconds.. > > > > qemu-kvm: cpus are not resettable, terminating > > > > > > Could you shared your kernel config and details about your setup (qemu > > > command, kernel command line, ...)? > > > > We followed tdx-tools README to setup the environment and built host and > > guest kernel, qemu command is as below. I copied the > > tdx-tools/build/rhel-9/intel-mvp-tdx-kernel/tdx-base.config to the > > latest upstream linxu kernel then execute 'make olddefconfig'. Because > > your patchset can't be applied to the stable kernel with the 731 > > patches. > > > > cd /home/root/tdx-tools > > ./start-qemu.sh -i /home/root/guest_tdx.qcow2 -b grub > > This is the qemu command when execute above line of command, just for > your reference if you happen to not take this way. Still failed to reproduce :/ Blind shot: could you check if the patch below makes any difference. diff --git a/arch/x86/coco/tdx/tdx.c b/arch/x86/coco/tdx/tdx.c index 20e946c9a39d..8bb231e8ef9d 100644 --- a/arch/x86/coco/tdx/tdx.c +++ b/arch/x86/coco/tdx/tdx.c @@ -875,6 +875,8 @@ static void tdx_kexec_unshare_mem(bool crash) /* Stop new private<->shared conversions */ conversion_allowed = false; + if (crash) + return; /* * Crash kernel reaches here with interrupts disabled: can't wait for * conversions to finish. -- Kiryl Shutsemau / Kirill A. Shutemov