public inbox for linux-coco@lists.linux.dev
 help / color / mirror / Atom feed
From: "Edgecombe, Rick P" <rick.p.edgecombe@intel.com>
To: "pbonzini@redhat.com" <pbonzini@redhat.com>,
	"Hansen, Dave" <dave.hansen@intel.com>,
	"seanjc@google.com" <seanjc@google.com>,
	"bp@alien8.de" <bp@alien8.de>, "kas@kernel.org" <kas@kernel.org>,
	"ackerleytng@google.com" <ackerleytng@google.com>,
	"hpa@zytor.com" <hpa@zytor.com>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"mingo@redhat.com" <mingo@redhat.com>,
	"Huang, Kai" <kai.huang@intel.com>,
	"tglx@kernel.org" <tglx@kernel.org>,
	"kvm@vger.kernel.org" <kvm@vger.kernel.org>,
	"linux-coco@lists.linux.dev" <linux-coco@lists.linux.dev>,
	"x86@kernel.org" <x86@kernel.org>,
	"Gao, Chao" <chao.gao@intel.com>
Cc: "Verma, Vishal L" <vishal.l.verma@intel.com>
Subject: Re: [PATCH 2/4] x86/virt/tdx: Pull kexec cache flush logic into arch/x86
Date: Mon, 9 Mar 2026 16:23:37 +0000	[thread overview]
Message-ID: <966ca112d6619039f18c441d84657f23694dd4bc.camel@intel.com> (raw)
In-Reply-To: <d16e808b16d9c23f7db34e576c4dd82eb9772831.camel@intel.com>

On Mon, 2026-03-09 at 00:23 +0000, Huang, Kai wrote:
> Feel free to add:
> 
> Acked-by: Kai Huang <kai.huang@intel.com>
> 
> Btw, there's a functional change here, and perhaps we should call out
> in changelog:

Yea that makes sense.

> 
> - Currently tdx_cpu_flush_cache_for_kexec() is done in
> kvm_disable_virtualization_cpu(), which is also called by KVM's CPUHP
> offline() callback.  So tdx_cpu_flush_cache_for_kexec() is explicitly
> done in TDX code in CPU offline.
> 
> - With this change, tdx_cpu_flush_cache_for_kexec() is not explicitly
> done in TDX code in CPU offline.
> 
> But AFAICT this is fine, since IIUC the WBINVD is always done when
> kernel offlines one CPU (see [*]), i.e., the current
> tdx_cpu_flush_cache_for_kexec() done in KVM's CPUHP is actually
> superfluous.
> 
> [*] See:
> 
> 	native_play_dead() ->
> 		cpuidle_play_dead();                                
>                      
>         	hlt_play_dead();
> 
> cpuidle_play_dead() can invoke different enter_dead() callbacks
> depending on what idle driver is being used, but AFAICT eventually it
> ends up calling either acpi_idle_play_dead() or mwait_play_dead(),
> both of which does WBINVD before going to idle.
> 
> If cpuidle_play_dead() doesn't idle successfully, the hlt_play_dead()
> will then WBINVD and hlt.
> 
> Actually, after looking at multiple commits around here, e.g.,
> 
>   ea53069231f93 ("x86, hotplug: Use mwait to offline a processor, fix
> the legacy case")
>   dfbba2518aac4 ("Revert "ACPI: processor: idle: Only flush cache on
> entering C3")
> 
> ... I believe it's a kernel policy to make sure cache is flushed when
> it offlines a CPU (which makes sense anyway of course), I just
> couldn't find the exact commit saying this (or I am not sure whether
> there's such commit).
> 
> 
Thanks for the analysis.

> Btw2, kinda related to this, could you help review:
> 
> https://lore.kernel.org/lkml/20260302102226.7459-1-kai.huang@intel.com/

Well I think I wrote the log for it. But I yea I'll add a tag.

  reply	other threads:[~2026-03-09 16:23 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-03-07  1:03 [PATCH 0/4] Fuller TDX kexec support Rick Edgecombe
2026-03-07  1:03 ` [PATCH 1/4] x86/tdx: Move all TDX error defines into <asm/shared/tdx_errno.h> Rick Edgecombe
2026-03-08 23:47   ` Huang, Kai
2026-03-09 16:20     ` Edgecombe, Rick P
2026-03-07  1:03 ` [PATCH 2/4] x86/virt/tdx: Pull kexec cache flush logic into arch/x86 Rick Edgecombe
2026-03-09  0:23   ` Huang, Kai
2026-03-09 16:23     ` Edgecombe, Rick P [this message]
2026-03-07  1:03 ` [PATCH 3/4] x86/virt/tdx: Add SEAMCALL wrapper for TDH.SYS.DISABLE Rick Edgecombe
2026-03-16 11:51   ` Kiryl Shutsemau
2026-03-16 21:15     ` Edgecombe, Rick P
2026-03-17  9:47       ` Kiryl Shutsemau
2026-03-17 21:55         ` Edgecombe, Rick P
2026-03-07  1:03 ` [PATCH 4/4] KVM: x86: Disable the TDX module during kexec and kdump Rick Edgecombe
2026-03-09  8:15   ` Chao Gao
2026-03-09 16:24     ` Edgecombe, Rick P

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=966ca112d6619039f18c441d84657f23694dd4bc.camel@intel.com \
    --to=rick.p.edgecombe@intel.com \
    --cc=ackerleytng@google.com \
    --cc=bp@alien8.de \
    --cc=chao.gao@intel.com \
    --cc=dave.hansen@intel.com \
    --cc=hpa@zytor.com \
    --cc=kai.huang@intel.com \
    --cc=kas@kernel.org \
    --cc=kvm@vger.kernel.org \
    --cc=linux-coco@lists.linux.dev \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=seanjc@google.com \
    --cc=tglx@kernel.org \
    --cc=vishal.l.verma@intel.com \
    --cc=x86@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox