[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [RFC v1 2/7] x86/hvm: Introduce hvm_emulate_one_ctxt


  • To: Jan Beulich <jbeulich@xxxxxxxx>
  • From: Ross Lagerwall <ross.lagerwall@xxxxxxxxxx>
  • Date: Thu, 21 May 2026 10:42:22 +0100
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=citrix.com; dmarc=pass action=none header.from=citrix.com; dkim=pass header.d=citrix.com; arc=none
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=Vpn+kqmEH1yUZEUMkrsclFPYiKTScFH2Nq9PqcskGhU=; b=gJtZsAa+/7JO89mecVqf2uE/YbDiPiBM/93zS7Ni/0klg68p6aa26lP4VoYTkVR0z50hELA0nu4AJdZHkb6JKnqT5UXc92ay060aAeLT6uTf5atwejn5lSFXRECxn72lnFDOTaTXZhiEG6KqqcY20cdhD9tLAOdoQU1Yryl7ONRtGps2KemgMj8qozBP6h9LU3ZjfJ/xqS1ks3fWOiSmrpGyMVxI2aSZeRgju6pjLoBIKMPTn3GCRC4l8eAnwAjnc/oPBsuNesZeC6XkxPlu39y7qkHLhJBTzrvanjxePeg+N/3PFjAkTEAVhs7kddi1P+Ir6dRUjgdM4RctyCQwug==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=K/MSKnz/1IeVUmrqGBrzfa5p0QgD0zcz/EVvl/PRf93jYl8CBRKt++Y1TUi8lY2HVbIkl0R0s/9xHo7/8NYTiA3PPcmaw4IF+GYD5dA4DMUKUVGbzkRLtJTnAfgwY5DbpgHZmc191LlhmNe1EJ/4cFwY8i5haSE7aEp9OrqTl2BYmTeH47pnmlLnTg2fTYzD9dxhbVVRMqMHaOUKbyZrcjXiDklLl0DOHKphHQJg0Lm9GCozNl31bRNGbc1ODUEWpDz8l7Duv3i64jSxakZ08eMlcpZpGqAja4VD3hKk//4+J6OmYUzQFliXlSn1mbj/3+Fss1ClfYVRrnQIGXGk7w==
  • Authentication-results: eu.smtp.expurgate.cloud; dkim=pass header.s=selector1 header.d=citrix.com header.i="@citrix.com" header.h="From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck"
  • Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=citrix.com;
  • Cc: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, Roger Pau Monné <roger.pau@xxxxxxxxxx>, Teddy Astie <teddy.astie@xxxxxxxxxx>, xen-devel@xxxxxxxxxxxxxxxxxxxx
  • Delivery-date: Thu, 21 May 2026 09:42:46 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On 5/19/26 10:54 AM, Jan Beulich wrote:
On 18.05.2026 15:13, Ross Lagerwall wrote:
This is like hvm_emulate_one_insn() but takes an existing
hvm_emulate_ctxt as a parameter. This will be needed to merge the
instruction emulator and VMEXIT fast paths.

I'm yet to understand why this is necessary, but I'm afraid I don't consider
the name very descriptive. Even hvm_emulate_one_insn2() or
hvm_emulate_one_insn_ex() would come closer: You don't "emulate a context".

Of those, I'd prefer hvm_emulate_one_insn_ex(), though it still doesn't
give much away as to how it differs from the proliferation of similarly
named functions (i.e. _hvm_emulate_one(), hvm_emulate_one(),
hvm_emulate_one_insn()).


--- a/xen/arch/x86/hvm/io.c
+++ b/xen/arch/x86/hvm/io.c
@@ -53,27 +53,32 @@ void send_timeoffset_req(unsigned long timeoff)
  bool hvm_emulate_one_insn(hvm_emulate_validate_t *validate, const char *descr)
  {
      struct hvm_emulate_ctxt ctxt;
-    int rc;
hvm_emulate_init_once(&ctxt, validate, descr, guest_cpu_user_regs());
+    return hvm_emulate_one_ctxt(&ctxt);
+}
- switch ( rc = hvm_emulate_one(&ctxt, VIO_no_completion) )
+bool hvm_emulate_one_ctxt(struct hvm_emulate_ctxt *ctxt)
+{
+    int rc = hvm_emulate_one(ctxt, VIO_no_completion);
+
+    switch ( rc )
      {
      case X86EMUL_UNHANDLEABLE:
-        hvm_dump_emulation_state(XENLOG_G_WARNING, ctxt.descr, &ctxt, rc);
+        hvm_dump_emulation_state(XENLOG_G_WARNING, ctxt->descr, ctxt, rc);
          return false;
case X86EMUL_UNRECOGNIZED:
-        hvm_dump_emulation_state(XENLOG_G_WARNING, ctxt.descr, &ctxt, rc);
+        hvm_dump_emulation_state(XENLOG_G_WARNING, ctxt->descr, ctxt, rc);
          hvm_inject_hw_exception(X86_EXC_UD, X86_EVENT_NO_EC);
          break;

These two lines were already touched by patch 1. Afaict leaving the change out
there will be fine, and hence will be overall less churn (plus following the
lines' histories will be one step shorter).


OK.

Thanks,
Ross



 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.