Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp1379441rwd; Wed, 7 Jun 2023 15:33:36 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ5EqogfpC0ZIMyeumjVFWWQJxU6vZ/Fcq2odRjOaTYekvAtm+DLDcikyf/VD59A43qvta5u X-Received: by 2002:a05:6a20:7484:b0:10d:f812:e4b5 with SMTP id p4-20020a056a20748400b0010df812e4b5mr3807020pzd.35.1686177215900; Wed, 07 Jun 2023 15:33:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1686177215; cv=none; d=google.com; s=arc-20160816; b=JqoZI+zLwH/xzRdHMrynH0MXqbDYJlo1fBAiWmN8ZbJ9S6wumTA49Vl/Vfxix4oYxj Wgqq7Yw5bzblSqR7TOAeWEob1KMJFqhQ4NkW12IAJlv0Q/9cr/YRwOLV4w16mgA1xGVo xiHEV9cg7O8rdFxlxAZNr16u7EUU8LrC7iAo7chCmVx5e055f6o5TozRekSqF30Y+naX yvivD166XP+zzIJCjRnQzL/VsNyPvV6MKTYLP8QLnF9lk3BWcCKTjKetOhIv29hNMpiM hDjcI0EQ5wXNPUks84CaJR6v4SX0vebggDXXhqG2uZYbu5fg1NMkOQAGxfJcumXGSlg3 mnVw== 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=M7ykieylX7knhg/bO2KoGEQrYdsKZRD4NWtl9CI9DRU=; b=z4m3YdfD2Mb+Zij+kfo8Uer+OdLb/BZKmksQdXoogyza7wq4D2Y6AfT1ZjGHzYPK3E YhcaCtS2Ks8DZfOYgo28TImKvy+6njl//98AILOH5QHgtKUeCrBnDPo2DRSIThccBzkE ssHx4WZ++REhG+CdtDiiepEi6o8wByCOdJIdi6EeFTiVClUq37HWWFeXS4n8glaC6J1c bflAeMqOfEaFn8m/RH3pQD4979TRhEVQNytZghll1INeladgSeaTqS/28OVzLHhGjo3a To4EYg4PTWpNw4XJZGVcB3GAFEVybTim4pGmUbs46qFe7LYSBonBDIF56/J2gxPs+dnc EiBQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=kffq3Hu9; 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 j189-20020a636ec6000000b00534dbd0d219si9459637pgc.301.2023.06.07.15.33.24; Wed, 07 Jun 2023 15:33:35 -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=kffq3Hu9; 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 S232798AbjFGWZl (ORCPT + 99 others); Wed, 7 Jun 2023 18:25:41 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40590 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231259AbjFGWZh (ORCPT ); Wed, 7 Jun 2023 18:25:37 -0400 Received: from mga04.intel.com (mga04.intel.com [192.55.52.120]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9664E2689 for ; Wed, 7 Jun 2023 15:24:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1686176697; x=1717712697; h=date:from:to:cc:subject:message-id:references: mime-version:in-reply-to; bh=DWrcl5RLtV27uRfGpUsqXK1OJLGa0Ts8dBhu0iCMJjQ=; b=kffq3Hu9c6tpIVmktmCW3xaOJ3ORCwz1gmOMjvG7xFecIiPFg+lH/AF+ B4eBW3rfgzsXSqrqW00lEDK1Uns6QCNyKba70JtfDfC9htJuHSPMzBLNX sTPddlD44lOLI/NfsysiERpDVv/E4jm940B45tN/uHBbmI4l63MD+Up/d UMdKA+c5oSj4PohHFuRGzkyy4m3ugZNBQ56DPkPnEAE3zm9+wEdJOqOs2 s0JTGP3qeyzEZwh6nqpnRdN2EH0fT+lUWaQ5cVJWKd8qe6a32uVOgbzmk mDJCSJFOfmvsqGSLivd2XSPvYxRNQjgMxXcA+JDiJk88BbF2aNqU7MNho Q==; X-IronPort-AV: E=McAfee;i="6600,9927,10734"; a="355982217" X-IronPort-AV: E=Sophos;i="6.00,225,1681196400"; d="scan'208";a="355982217" Received: from orsmga007.jf.intel.com ([10.7.209.58]) by fmsmga104.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 07 Jun 2023 15:20:47 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10734"; a="703839900" X-IronPort-AV: E=Sophos;i="6.00,225,1681196400"; d="scan'208";a="703839900" Received: from araj-dh-work.jf.intel.com (HELO araj-dh-work) ([10.165.157.158]) by orsmga007-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 07 Jun 2023 15:20:47 -0700 Date: Wed, 7 Jun 2023 15:19:16 -0700 From: Ashok Raj To: Sean Christopherson Cc: Thomas Gleixner , LKML , x86@kernel.org, Ashok Raj , Dave Hansen , Tony Luck , Arjan van de Veen , Peter Zijlstra , Eric Biederman , Ashok Raj Subject: Re: [patch 0/6] Cure kexec() vs. mwait_play_dead() troubles Message-ID: References: <20230603193439.502645149@linutronix.de> <87pm694jmg.ffs@tglx> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Spam-Status: No, score=-4.3 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,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 On Wed, Jun 07, 2023 at 10:33:35AM -0700, Sean Christopherson wrote: > On Wed, Jun 07, 2023, Ashok Raj wrote: > > On Tue, Jun 06, 2023 at 12:41:43AM +0200, Thomas Gleixner wrote: > > > On Mon, Jun 05 2023 at 10:41, Sean Christopherson wrote: > > > > On Sat, Jun 03, 2023, Thomas Gleixner wrote: > > > >> This is only half safe because HLT can resume execution due to NMI, SMI and > > > >> MCE. Unfortunately there is no real safe mechanism to "park" a CPU reliably, > > > > > > > > On Intel. On AMD, enabling EFER.SVME and doing CLGI will block everything except > > > > single-step #DB (lol) and RESET. #MC handling is implementation-dependent and > > > > *might* cause shutdown, but at least there's a chance it will work. And presumably > > > > modern CPUs do pend the #MC until GIF=1. > > > > > > Abusing SVME for that is definitely in the realm of creative bonus > > > points, but not necessarily a general purpose solution. > > > > > > >> So parking them via INIT is not completely solving the problem, but it > > > >> takes at least NMI and SMI out of the picture. > > > > > > > > Don't most SMM handlers rendezvous all CPUs? I.e. won't blocking SMIs indefinitely > > > > potentially cause problems too? > > > > > > Not that I'm aware of. If so then this would be a hideous firmware bug > > > as firmware must be aware of CPUs which hang around in INIT independent > > > of this. > > > > SMM does do the rendezvous of all CPUs, but also has a way to detect the > > blocked ones, in WFS via some package scoped ubox register. So it knows to > > skip those. I can find this in internal sources, but they aren't available > > in the edk2 open reference code. They happen to be documented only in the > > BWG, which isn't available freely. > > Ah, so putting CPUs into WFS shouldn't result in odd delays. At least not on > bare metal. Hmm, and AFAIK the primary use case for SMM in VMs is for secure Never knew SMM had any role in VM's.. I thought SMM was always native. Who owns this SMM for VM's.. from the VirtualBIOS? > boot, so taking SMIs after booting and putting CPUs back into WFS should be ok-ish. > > Finding a victim to test this in a QEMU VM w/ Secure Boot would be nice to have. I always seem to turn off secureboot installing Ubuntu :-).. I'll try to find someone who might know especially doing SMM In VM. Can you tell what needs to be validated in the guest? Would doing kexec inside the guest with the new patch set be sufficient? Or you mean in guest, do a kexec and launch secure boot of new kernel? If there is a specific test you want done, let me know.