Received: by 2002:a05:6358:11c7:b0:104:8066:f915 with SMTP id i7csp712730rwl; Sat, 25 Mar 2023 09:33:51 -0700 (PDT) X-Google-Smtp-Source: AKy350aVRUvEyD8Nt3mGxhiMV9sl15OP7nzCufjeGyMYdDrsTemfhUtxYrtvFDr/XY+866VZYuyy X-Received: by 2002:a17:903:27cf:b0:1a1:bccc:74b6 with SMTP id km15-20020a17090327cf00b001a1bccc74b6mr5414017plb.14.1679762031621; Sat, 25 Mar 2023 09:33:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1679762031; cv=none; d=google.com; s=arc-20160816; b=qBLqOJZ9CaNE7lHTYtFGRCTGFJdMQuyFeFXrnA+VYKjUOzMf+E7eqL503W3kCG1Pbw eNHDtc38+c9iWCa9Xon7Ut+TXXjwmffuOIJ7u32hpai3vfvzdJSIZrmBTbB9TQtrzfsV 9js941WBCeQUc3/E14Wqv/i8qH+raKHzD7A8qhzLHkNqA+xKoqdze5dwS5yur5bshKxE DrXVxDUKIm7D5bc5enC3uXelJmWg/OHkFkjGMnfxMjBe64iJY2AlX6L/wfCBSCiNpRAv JDhm2NeHfMG9HeOnLT3veaPT1jxsctvZoqDvn4jYhkrgPo8zWVa0ydBQMraBqKVmK/Zg GzAg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id:dkim-signature; bh=e2PYHBCb6I2GSqWHMCTk8Mgf8RPUy6lMeL1a+QvBPn4=; b=HgcX59Rag+SYXxTrFLExaIYjYrXf6VZU4/jzjoXFyp8xJQYsOhzmcMu9BGxmz3mJsW XK3eNEf2KSp5NztDsC6MMkAXty3IXHSw9B5SWLKEhS7TNR1NeV+Ir8bgKpCShpuXJXxe 4XiYxf6lfhOqphZtQ34LJCRR8cTZQGUEDixFxOg7x63ofXsn75ArSPqjYOSBPXh4d4Kj TICFAlIwG0D35d8HVOsrsIxcHW60Jq8vFY2IIRWUWMdpM8xJ/ysxD0UT4anR8yzVkcLI 9kyZiciY1Xh07l3bCp5lClQgsn5hnZalzF1PX1UumBMwAD2a4kfn2uqPZ4UskKbaYz7G L3Tg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=jwca3rED; 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=NONE dis=NONE) header.from=intel.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id lc11-20020a170902fa8b00b0019cda8d3ae0si22034350plb.457.2023.03.25.09.33.34; Sat, 25 Mar 2023 09:33:51 -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=@intel.com header.s=Intel header.b=jwca3rED; 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=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229926AbjCYQZk (ORCPT + 99 others); Sat, 25 Mar 2023 12:25:40 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42690 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229446AbjCYQZi (ORCPT ); Sat, 25 Mar 2023 12:25:38 -0400 Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 19D641114D for ; Sat, 25 Mar 2023 09:25:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1679761538; x=1711297538; h=message-id:date:mime-version:subject:to:cc:references: from:in-reply-to:content-transfer-encoding; bh=jwQo2o3j71BDLtr4OFKx+Otx015kQ5o0XvirVcMommY=; b=jwca3rED7VEUibfZs9SH19atUQqTo/o17Rxw0Tvp98QJganlPWcOiCRA lh/AzlYRMLLExf5hCYFEYWdxNpvb/Q3zMSL+ITfeyE+hSmU3R+rthEGbY JPq12IX5/frqLCi8FVaUht3rWxrzqQ4/vhezmmkZCcSxdFuQTnP+R1m11 7kvPeg4mK4R9Aw2c2yNdOfTG+NwIzeVsUr7PcG41l3+mA5cPHF7XTxIKH AD6ql9ZDmpdZhtMjbBEs+IdYfjQ2lDQHi1mUZxV3zo4wPwU0cINcGPtAD cew2v3mm1yMDdkWGDyAYLY2p94jMyzyzGOCViptJUQxiUWzuqCK5ralsW Q==; X-IronPort-AV: E=McAfee;i="6600,9927,10660"; a="367725484" X-IronPort-AV: E=Sophos;i="5.98,290,1673942400"; d="scan'208";a="367725484" Received: from orsmga006.jf.intel.com ([10.7.209.51]) by fmsmga101.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 25 Mar 2023 09:25:37 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10660"; a="660402602" X-IronPort-AV: E=Sophos;i="5.98,290,1673942400"; d="scan'208";a="660402602" Received: from jsgross-mobl2.amr.corp.intel.com (HELO [10.209.122.137]) ([10.209.122.137]) by orsmga006-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 25 Mar 2023 09:25:37 -0700 Message-ID: Date: Sat, 25 Mar 2023 09:25:36 -0700 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.7.1 Subject: Re: [PATCH] x86: Disable kexec for TDX guests Content-Language: en-US To: "Kirill A. Shutemov" , Dave Hansen , Borislav Petkov Cc: Thomas Gleixner , Ingo Molnar , x86@kernel.org, Eric Biederman , kexec@lists.infradead.org, linux-kernel@vger.kernel.org References: <20230325160128.21857-1-kirill.shutemov@linux.intel.com> From: Dave Hansen In-Reply-To: <20230325160128.21857-1-kirill.shutemov@linux.intel.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-2.5 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,NICE_REPLY_A,RCVD_IN_DNSWL_MED, RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,SPF_NONE autolearn=unavailable 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 3/25/23 09:01, Kirill A. Shutemov wrote: > The last item is tricky. TDX guests use ACPI MADT MPWK to bring up > secondary CPUs. The mechanism doesn't allow to put a CPU back offline if > it has woken up. ... > +int arch_kexec_load(void) > +{ > + if (cpu_feature_enabled(X86_FEATURE_TDX_GUEST)) { > + pr_warn_once("Disable kexec: not yet supported in TDX guest\n"); > + return -EOPNOTSUPP; > + } > + > + return 0; > +} So, let's put all this together: 1. TDX implementations use MADT for wakeup exclusively right now (but are not necessarily _required_ to do so forever) 2. MADT doesn't support CPU offlining 3. kexec() requires offlining Thus, current TDX implementations can't support TDX guests. This *doesn't* say that TDX will always use the MADT for wakeups. Yet, the check you have here is for TDX and *not* for the MADT. That seems wrong. Let's say SEV or arm64 comes along and uses the MADT for their guests. They'll add another arch_kexec_load(), with a check for *their* feature. This all seems like you should be disabling kexec() the moment the MADT CPU wakeup is used instead of making it based on TDX.