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

Re: [PATCH v3 4/4] xen/x86: switch x86 to use generic implemetation of bug.h


  • To: Oleksii <oleksii.kurochko@xxxxxxxxx>
  • From: Jan Beulich <jbeulich@xxxxxxxx>
  • Date: Tue, 28 Feb 2023 17:36:08 +0100
  • 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=ufMg31m+Q+V40XItPgiZFw9nmEaMZayuZQeNAbRETwg=; b=dpf2EB1k8HCyl62+66Ekr95Fhr9k4m/H3hQzgkcPVfMN5e7p3ee+Fuku1nZ+HOWuuv4RN1Gafikidh4YCPZkQfys7MD59Cwn+jNx1s0/6RLIGBrYOQIDaqJ98COgGJaJHRmn98BbxhC4bZWA6eDalysRhpybJKMunHVI/zdOJOFJZqE5jv7jLeaQHKKBmYUZ3HyaOrMFC86Vc10DJ5ixGL2LmmgkQw0BYVySwT3yJSn4Jw6+6JTzkHpkQ/XThfYnyd12sA8RS5pph0h9VyTbb05e8XHnsUzS1daNgiiRK2CctUY5Dsl6sxXys4XoAIn264zR8164t7qu55wbYBjgUA==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=grPMp6iRcIq4HvQkE+U20njA/7t5MokBG8v0YlcDBmhnkJX0hFJwjQkRdd/Pezmso77xQUVG9aLMaORrJ66/nN+xyivN1+YHLKMADHx46WTX04F05SZSpfmWxu+DfW48dtZxv8Cghn4EJ/iwgqi+Nn6u9+GJsuexmPgSftmiJuqjGB3YR+Jz3FL6Bsx/zFTdOF4g+LvNq7O8Of8m0WUd7aJ6eToIsXSZGpz7go5xbKS9sG3AYFLx1FWmqfwsUCEyXUIzJtozRLCDzb3G5VJFZVha9RUfnZWP9J6E+ZCZK0qhz2qiYEgOHwcXpFM3Z+9r5TUWoP4qRUX+DEgRHCrA9w==
  • Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=suse.com;
  • Cc: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, Stefano Stabellini <sstabellini@xxxxxxxxxx>, Gianluca Guida <gianluca@xxxxxxxxxxxx>, Roger Pau Monné <roger.pau@xxxxxxxxxx>, Wei Liu <wl@xxxxxxx>, xen-devel@xxxxxxxxxxxxxxxxxxxx
  • Delivery-date: Tue, 28 Feb 2023 16:36:23 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On 28.02.2023 17:28, Oleksii wrote:
> On Mon, 2023-02-27 at 15:46 +0100, Jan Beulich wrote:
>> On 24.02.2023 12:31, Oleksii Kurochko wrote:
>>> --- a/xen/arch/x86/include/asm/debugger.h
>>> +++ b/xen/arch/x86/include/asm/debugger.h
>>> @@ -14,9 +14,9 @@
>>>  
>>>  /* Returns true if GDB handled the trap, or it is surviveable. */
>>>  static inline bool debugger_trap_fatal(
>>> -    unsigned int vector, struct cpu_user_regs *regs)
>>> +    unsigned int vector, const struct cpu_user_regs *regs)
>>>  {
>>> -    int rc = __trap_to_gdb(regs, vector);
>>> +    int rc = __trap_to_gdb((struct cpu_user_regs *)regs, vector);
>>
>> I view casts in general as risky and hence preferable to avoid.
>> Casting
>> away const-ness is particularly problematic. I guess the least bad
>> option is to drop const from the do_bug_frame()'s parameter again in
>> patch 1. However, for a fatal trap (assuming that really _is_ fatal,
>> i.e. execution cannot continue), not allowing register state to be
>> altered makes kind of sense. So I wonder whether we couldn't push the
>> casting into the gdbstub functions. But quite likely that's going to
>> be too intrusive for re-work like you do here.
> I am not sure that casting inside the gdbstub functions will help as
> do_bug_frame() calls debugger_trap_fatal() which has define regs 
> without const. So it will still be compile issue as in do_bug_frame()
> regs are declared as const.

Well, the idea was of course to propagate const further down, to cast
it away only in restricted cases. But ...

> So it looks like the best one issue now will be drop const from the
> do_bug_frame()...

... looks like we're in agreement then about this being the better
route for the time being.

Jan



 


Rackspace

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