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

Re: [PATCH 3/5] x86/emul: Add a pending_dbg field to x86_emulate_ctxt.retire


  • To: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
  • From: Jan Beulich <jbeulich@xxxxxxxx>
  • Date: Thu, 14 Sep 2023 17:04:43 +0200
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=suse.com; dmarc=pass action=none header.from=suse.com; dkim=pass header.d=suse.com; arc=none
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; 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=pzS8i1c2PHkHzQGnN0faVQ8EXIBq/oQYBS2vj1yzVJE=; b=LmLBsc+QXmmzPYK7oK2huMkrqyZIyFHbufbjN7gIXFsYGgbLBhPmuI3tDc73/3hWLt8FkLA4iZz8ZlBxQgufMt+Uu2ThkJXpprqD+IcgCY8vv5fnmhUlDUhww4hw4Y32V9z5D0rkUN/TjX3YLeBRDYutym0LOU16HRHD/aASMcJkq9ylomibDqgnYyAwgGz4/bPLAJvjcNkZPVER5SakKv6j8pcwpqKKCx1AJxCgv9wIFHVegySCU3c5XilcnrNcxqdsOInrHI2Q6S8FClu/4ZPxzzdyb3676IZH4Loll8IKVRyOSPvo9/ILxDvr5RcPX3VRMKENLSZW5iGA4jau5g==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=j21l50denBlfnEaNhh1uouCHRpSsHg66IIvXRFL8ggIpZsBMnGedsr4htbaLbVurmbZmu/BCD+yzjQTJpeIhRsVbgGMxehM86r7kBP1jvsjUoKijcpF8azOi0eOaaIR9F7zxvqOH5dF5IJuUIEaL/A+enmZkCujnL4pVeuBRxHcJ1CRVt5l2SMMJrQm5stOAMeJKnJlTAm8CPwgxZZvQdaxMDhIJ2Ce7MVAP1hqguUmu09VmcFVVMJmN0mVcNs2wWlWR99XQgZyB6MfnKUPim4+dlXB2FqV0XxTpg2bEPv6hobEPGy0UE8HblNGXtTF6jH3jFj80Hcpk+VT3PmKT9A==
  • Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=suse.com;
  • Cc: Roger Pau Monné <roger.pau@xxxxxxxxxx>, Wei Liu <wl@xxxxxxx>, Jinoh Kang <jinoh.kang.kr@xxxxxxxxx>, Xen-devel <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • Delivery-date: Thu, 14 Sep 2023 15:05:00 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On 13.09.2023 01:21, Andrew Cooper wrote:
> --- a/xen/arch/x86/x86_emulate/x86_emulate.c
> +++ b/xen/arch/x86/x86_emulate/x86_emulate.c
> @@ -8379,7 +8379,10 @@ x86_emulate(
>      if ( !mode_64bit() )
>          _regs.r(ip) = (uint32_t)_regs.r(ip);
>  
> -    /* Should a singlestep #DB be raised? */
> +    if ( singlestep )
> +        ctxt->retire.pending_dbg |= X86_DR6_BS;

We set "singlestep" about first thing in the function. Is it really correct
to latch that into pending_dbg without regard to rc? (Perhaps yes, seeing
the comment next to the field declaration.)

> --- a/xen/arch/x86/x86_emulate/x86_emulate.h
> +++ b/xen/arch/x86/x86_emulate/x86_emulate.h
> @@ -588,15 +588,26 @@ struct x86_emulate_ctxt
>      /* Canonical opcode (see below) (valid only on X86EMUL_OKAY). */
>      unsigned int opcode;
>  
> -    /* Retirement state, set by the emulator (valid only on X86EMUL_OKAY). */
> +    /*
> +     * Retirement state, set by the emulator (valid only on 
> X86EMUL_OKAY/DONE).
> +     *
> +     * TODO: all this state should be input/output from the VMCS PENDING_DBG,
> +     * INTERRUPTIBILITY and ACTIVITIY fields.
> +     */
>      union {
> -        uint8_t raw;
> +        unsigned long raw;
>          struct {
> +            /*
> +             * Accumulated %dr6 trap bits, positive polarity.  Should only be
> +             * interpreted in the case of X86EMUL_OKAY/DONE.
> +             */
> +            unsigned int pending_dbg;
> +
>              bool hlt:1;          /* Instruction HLTed. */
>              bool mov_ss:1;       /* Instruction sets MOV-SS irq shadow. */
>              bool sti:1;          /* Instruction sets STI irq shadow. */
>              bool unblock_nmi:1;  /* Instruction clears NMI blocking. */
> -            bool singlestep:1;   /* Singlestepping was active. */
> +            bool singlestep:1;   /* Singlestepping was active. (TODO, merge 
> into pending_dbg) */
>          };
>      } retire;
>  

DONE has wrongly made it into here, as pointed out for patch 1.

Jan



 


Rackspace

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