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

Re: [PATCH 2/7] x86/emul: Fix and extend #DB trap handling


  • To: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
  • From: Jan Beulich <jbeulich@xxxxxxxx>
  • Date: Mon, 18 Sep 2023 13:30:24 +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=6JDSYxVnSlz5lwFX4hWkdv2lsNrn9IqMBRfjug9tiJs=; b=ONnF8sjcOVxdHOPNGb3pgO8/plEKvWj84/84FootQUl36kgBmVfubEN0A3BrLsuI/vEK1W00TaBqalJ+dL9p72ImKiSmShXtmHwh4tsCj2qGF+2swDXBFrlx4fMMkstLn7R/YunclAWMA+6v0beWUAQprFKIgD0wJRLQoe9M+J3rTuxPG2STMtXHSUK91zxrXyZhWnEzdlT7Lpv8xCQdGh1xW7mZaeSNXDqyTkROmWt4foCXJMp+Wxyf8nN70153HQwIhuzmw8Q29Ju1Jxb6cYg2UV7eJWXMbhzD9pRQciz92wEO3EZBk0bghQ/4Zrx6dMxm4G/+EviiUBgOKBp7Mg==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=FbMztNhPewpouHWzdLqzLOIG0jAsDXutlgP9LN0XXpHP/3uHVoPjLHuzRkb3hlnmsfNntlerzap6MG0GdG/Iu/nkpNaFCY23sxx6c1sbf4xOgLSk+GTnMkiyqsmaDaYWfvmQDSwK1ZQ50fj9p+RNi9FP29LjpQ+6cBJWci5jUGE9ifsjOi9cRxsTVlNmoFos2c9AkzGnf9yoHkszJYBlrQXTlre8eOV7g9XHysnYqIE7TsbGwmFgdPjRAiX85VB0Zt2/yqSkgjMKkEncaBfNfgPjTofZvhUsJSH2ymTTzR7oAObfL+yYcJE6hJ9ZTmE4NThztDUX0j8BDeTPXPusPg==
  • 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: Mon, 18 Sep 2023 11:30:32 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On 18.09.2023 11:24, Andrew Cooper wrote:
> On 15/09/2023 9:36 pm, Andrew Cooper wrote:
>> --- a/xen/arch/x86/x86_emulate/x86_emulate.c
>> +++ b/xen/arch/x86/x86_emulate/x86_emulate.c
>> @@ -8379,13 +8379,6 @@ x86_emulate(
>>      if ( !mode_64bit() )
>>          _regs.r(ip) = (uint32_t)_regs.r(ip);
>>  
>> -    /* Should a singlestep #DB be raised? */
>> -    if ( rc == X86EMUL_OKAY && singlestep && !ctxt->retire.mov_ss )
>> -    {
>> -        ctxt->retire.singlestep = true;
>> -        ctxt->retire.sti = false;
>> -    }
>> -
>>      if ( rc != X86EMUL_DONE )
>>          *ctxt->regs = _regs;
>>      else
>> @@ -8394,6 +8387,19 @@ x86_emulate(
>>          rc = X86EMUL_OKAY;
>>      }
>>  
>> +    /* Should a singlestep #DB be raised? */
>> +    if ( rc == X86EMUL_OKAY && singlestep )
>> +    {
>> +        ctxt->retire.pending_dbg |= X86_DR6_BS;
>> +
>> +        /* BROKEN - TODO, merge into pending_dbg. */
>> +        if ( !ctxt->retire.mov_ss )
>> +        {
>> +            ctxt->retire.singlestep = true;
>> +            ctxt->retire.sti = false;
>> +        }
> 
> I occurs to me that setting X86_DR6_BS outside of the !mov_ss case will
> break HVM (when HVM swaps from singlestep to pending_dbg) until one of
> the further TODOs is addressed.
> 
> This will need bringing back within the conditional to avoid regressions
> in the short term.

I'm afraid I don't understand this: Isn't the purpose to latch state no
matter whether it'll be consumed right away, or only on the next insn?

Jan



 


Rackspace

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