Kernel KVM virtualization development
 help / color / mirror / Atom feed
From: Chao Gao <chao.gao@intel.com>
To: Qi Ai <aiqi.i7@bytedance.com>
Cc: <seanjc@google.com>, <bp@alien8.de>, <cenjiahui@bytedance.com>,
	<dave.hansen@linux.intel.com>, <dengqiao.joey@bytedance.com>,
	<fangying.tommy@bytedance.com>, <fengzhimin@bytedance.com>,
	<hpa@zytor.com>, <kvm@vger.kernel.org>, <mingo@redhat.com>,
	<pbonzini@redhat.com>, <tglx@linutronix.de>
Subject: Re: [PATCH] kvm/x86: clear hlt for intel cpu when resetting vcpu
Date: Wed, 5 Jul 2023 16:40:08 +0800	[thread overview]
Message-ID: <ZKUsaFzoCzjiGNZ1@chao-email> (raw)
In-Reply-To: <20230704113405.3335046-1-aiqi.i7@bytedance.com>

On Tue, Jul 04, 2023 at 07:34:05PM +0800, Qi Ai wrote:
>Reproduce this problem need to use the cpu_pm=on in QEMU, so execute halt in vm doesn't
>cause a vm exit, so mp_state will never be HLT. I am confused why mp_state is considered in this case.

This is just current implementation. It is not necessary to be this way. If
userspace can manipulate vmcs.ACTIVITY_STATE indirectly via mp_state, your
issue will be fixed. But as Sean said, this solution will cause "cascading
effect to a whole pile of things"

>
>And the bsp's vmcs.ACTIVITY_STATE need to reset to ACTIVITY to solve this problem.
>We need a proper set of APIs as you say. In this case, do we only provide a reset ioctl,
>or do we need to report vmcs.ACTIVITY_STATE to the userspace?

The latter I believe. Then userspace can migrate the state. If we go with the
former, the subtle bug pointed out by Sean won't be fixed:

	if a vCPU is live migrated, I'm pretty sure vmcs.ACTIVITY_STATE
	is lost, which is wrong.

Definitely, we need Sean's confirmation here.

  reply	other threads:[~2023-07-05  8:40 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-06-30  7:26 [PATCH] kvm/x86: clear hlt for intel cpu when resetting vcpu Qi Ai
2023-06-30 10:14 ` Chao Gao
2023-06-30 22:23   ` Isaku Yamahata
2023-06-30 22:56   ` Sean Christopherson
2023-07-04 11:34     ` Qi Ai
2023-07-05  8:40       ` Chao Gao [this message]
2023-07-05  9:04     ` Chao Gao
2023-07-31 19:15       ` Sean Christopherson

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=ZKUsaFzoCzjiGNZ1@chao-email \
    --to=chao.gao@intel.com \
    --cc=aiqi.i7@bytedance.com \
    --cc=bp@alien8.de \
    --cc=cenjiahui@bytedance.com \
    --cc=dave.hansen@linux.intel.com \
    --cc=dengqiao.joey@bytedance.com \
    --cc=fangying.tommy@bytedance.com \
    --cc=fengzhimin@bytedance.com \
    --cc=hpa@zytor.com \
    --cc=kvm@vger.kernel.org \
    --cc=mingo@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=seanjc@google.com \
    --cc=tglx@linutronix.de \
    /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