Received: by 2002:a05:7412:d1aa:b0:fc:a2b0:25d7 with SMTP id ba42csp1972282rdb; Wed, 31 Jan 2024 15:21:51 -0800 (PST) X-Google-Smtp-Source: AGHT+IF+3dtnmt4kNIlZyVm9P81+4gjTWvsLNU2E8itshXbBfQlkhe6hWBY7+ci62hKwjv9i539l X-Received: by 2002:a17:907:1709:b0:a35:d73f:7a88 with SMTP id le9-20020a170907170900b00a35d73f7a88mr2199898ejc.25.1706743311127; Wed, 31 Jan 2024 15:21:51 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1706743311; cv=pass; d=google.com; s=arc-20160816; b=Ehqe5hy6r5CtpecJuiyGIWEfvppIc6yVWpSVHcqRQ14RWhUltfPHixZAjCg9wyZ9No pwwVB7y8y7IX2EtuCmzYYyA1T2ke0GcP615v9OBJXJEhCydhwhjDidsZoV+i6oJi8wE4 2o6dJayZHpc6ZLBhmRhNTx6H+kYtVMysBcmVS6vP6REo+YNOdE5MWaC1Xu8NvfWu0Oej 4mv8yLKW7N2rHXvDyr7lhfQhOEgFKyMqBY27BSW3sX1gmR1TXiUtrXcG85gZoy2FJCAk Y+szSHqIkD6IfsthLOy9qPu7rXa6iJk4x5PsY+geuwJNA7DVqVzBTuhjr2ZLLp0IY3pe QzjQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-disposition:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:message-id:subject:cc :to:from:date:dkim-signature; bh=8dYibM2Qhw6qlt80DbDfA77ROcU78x6I3eRIX3hxBwo=; fh=PyUAEISex45FxohtPrVgC57DDbgROuuRWAOIzSZhDsc=; b=0Jxs2q9Lxs8/eLLoCDXbZz6s9bXvxwupKjFGr8Upxt/mbZonof7BEZ5/ii9EIzq0Dp wT9Y0NTZmhR4wy1UZTQA9paNO4RnbeiAgjR2NAR3LY/0q5me8xew4uzFVC34wARwyoty 8mpBJThcP0UReXiPj6oq11AxUwAHz667rTQJFcpEYR6fbl+otrofThhBkTVR1RRq+SQU aEMnSXyEgArMULWIzKd1Vd400GNFJVaPEDOT0ziFZmmUDYkdTPVVpwxHK8i6O/5lWBqL tY3x6F5UdINh5s3DqWy9gEvc3WzvDmX+1Vur+n4vSqHBW5vauCglr9n4q50RrnMbvgLk gP7Q==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=DD3qzf4i; arc=pass (i=1 dkim=pass dkdomain=intel.com dmarc=pass fromdomain=linux.intel.com); spf=pass (google.com: domain of linux-kernel+bounces-47224-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-47224-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com X-Forwarded-Encrypted: i=1; AJvYcCWBpQdVegWi0J5bklHDZRhCcticDmDfz87noSVsZoVRmkCHLfxFFifkpOZJT/7gncfBnjJGoeY8US2woCRjBNlyRfIiobKy7bZok8JC8g== Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id k23-20020a170906a39700b00a33b60763e0si5756235ejz.982.2024.01.31.15.21.51 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 31 Jan 2024 15:21:51 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-47224-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=DD3qzf4i; arc=pass (i=1 dkim=pass dkdomain=intel.com dmarc=pass fromdomain=linux.intel.com); spf=pass (google.com: domain of linux-kernel+bounces-47224-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-47224-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id 679F21F294D5 for ; Wed, 31 Jan 2024 22:04:15 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id BA00639AF0; Wed, 31 Jan 2024 22:04:07 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="DD3qzf4i" Received: from mgamail.intel.com (mgamail.intel.com [134.134.136.31]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 45777374F1 for ; Wed, 31 Jan 2024 22:04:05 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=134.134.136.31 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706738646; cv=none; b=EfmK4yG7OOD9B5NkaxZGiX09TEv7cu682dp0fP+eWWkDXgBzWX9dnb5CPCkc/i3t62rH+ZmeVBSjc1rNjYXcnK2fTJPjdAoJTpIxkLpRxDQh5rRWCqxt7k3R5x0kOw5N7FOqyo8wedgqVlynJvZ2eW8hPkYjR17AKWKcjRnHysA= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706738646; c=relaxed/simple; bh=QsbMchd88EV33UXYPAzC4sXUtwgesAtaPWm/veSFP/8=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=SvN/NnUi5Xcwh3cYKqA5jITGlD+4APqDI5T0REjkN6Etp15knpswQhZr6pwtB42+njx9q/h5z3DllieU/lMTbhCYqTFIIeB3u51GyoMAnCb+wKD4n/iT4eV11mysMBY9JaUbQFXXKfAd/bfI0c4Ma5VWWT01tebi8Il4uN1vTWg= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com; spf=none smtp.mailfrom=linux.intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=DD3qzf4i; arc=none smtp.client-ip=134.134.136.31 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=linux.intel.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1706738645; x=1738274645; h=date:from:to:cc:subject:message-id:references: mime-version:in-reply-to; bh=QsbMchd88EV33UXYPAzC4sXUtwgesAtaPWm/veSFP/8=; b=DD3qzf4iDE7R33VCeXAHGfMiNpzSDHinRJrwqrLXGd7R4pmCJo969Ebq JDuo7TuY6mWnVD61UFZRrouuXDWo2WmYD6GhXhCnxugYop6Uu7eKry/DV TAqt+DEs5lM3Io7DucPLDLmsGjjhhmw5YAQfFSZU3mg6bPMntAWIiR77u xIPybTUpCf7JmX2RZ3ofamj9r1bknR7yvnsEWa84E4B6Cx72EzlslrpSq 8HLk231dWjRGN5jzgzHtBAt8Y3wTWu9h8dIsmK3BQKbWHDzttlC9fqJ5q QDKTQRmjHLOAVGgAWrIsLvp3bSPEVpiEqP9Pq+/4B8wmt4cVEziSC/xVQ w==; X-IronPort-AV: E=McAfee;i="6600,9927,10969"; a="467973417" X-IronPort-AV: E=Sophos;i="6.05,233,1701158400"; d="scan'208";a="467973417" Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by orsmga104.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 31 Jan 2024 14:04:04 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10969"; a="908034612" X-IronPort-AV: E=Sophos;i="6.05,233,1701158400"; d="scan'208";a="908034612" Received: from black.fi.intel.com ([10.237.72.28]) by fmsmga002.fm.intel.com with ESMTP; 31 Jan 2024 14:04:00 -0800 Received: by black.fi.intel.com (Postfix, from userid 1000) id 3445739B; Thu, 1 Feb 2024 00:03:59 +0200 (EET) Date: Thu, 1 Feb 2024 00:03:59 +0200 From: "Kirill A. Shutemov" To: Dave Hansen Cc: "Huang, Kai" , linux-kernel@vger.kernel.org, x86@kernel.org, tglx@linutronix.de, bp@alien8.de, mingo@redhat.com, hpa@zytor.com, luto@kernel.org, peterz@infradead.org, thomas.lendacky@amd.com, chao.gao@intel.com, bhe@redhat.com, nik.borisov@suse.com, pbonzini@redhat.com Subject: Re: [PATCH 3/4] x86/kexec(): Reset TDX private memory on platforms with TDX erratum Message-ID: References: <12a927df-e437-40ff-ba4d-ceca5446c5b1@intel.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <12a927df-e437-40ff-ba4d-ceca5446c5b1@intel.com> On Wed, Jan 31, 2024 at 01:21:39PM -0800, Dave Hansen wrote: > > #ifdef CONFIG_KEXEC_JUMP > > if (image->preserve_context) > > save_processor_state(); > > + else > > + tdx_reset_memory(); > > +#else > > + tdx_reset_memory(); > > #endif > > Wow, that's awfully hard to read. I really wish folks' gag reflex would > kick in when they see stuff like this to get them to spend an additional > 15 seconds to turn this into: > > if (IS_ENABLED(CONFIG_KEXEC_JUMP) && image->preserve_context) > save_processor_state(); > else > tdx_reset_memory(); save_processor_state() is declared under CONFIG_PM_SLEEP, so I guess your variant might break build in some cases without updated suspend.h. -- Kiryl Shutsemau / Kirill A. Shutemov