[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH v2 3/8] x86/emul: Add pending_dbg field to x86_event
- To: Jinoh Kang <jinoh.kang.kr@xxxxxxxxx>, Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
- From: Jan Beulich <jbeulich@xxxxxxxx>
- Date: Wed, 30 Aug 2023 15:39:26 +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=UxmbDvjP2IqKzShEYTaU6xJ4vnqR7msYrcR7iePKWlE=; b=HF6P/+KdZ6JMb6JePlFZwFWkpUb66BoNiKMOxDVuTVIlBTYq8toPO7rahW3MY7KDPqAgvsnVrOXm1ycBu9PzwWKfjMrs4mDGQo/RVp+2ZNhhiByLo0lFSJOV2gAVr0dxFYy4o6c7bpBrX0mKjZwvM/hPHELgwCsWC0SgQFmCUsDReT8mBvFsBv6DZHVi21aEOVgcrMneB8BQ0/+r+9EpzId1ZjxFElwOz+eU1CL7NdmK3AaqH1RGlkeRtKlkPKY+Rt9JADLvDuHUt3RXj9jsNLz5h7RvUrXMk1GUyrSHmumZpt9I2ebu8WFZo8T91ByTgo1LK2VBPjPf2R0QbUJb3Q==
- Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=WBoFZQLMeX9YNHBF9QS8k+qdMSzvU1wYl8lk5hq6g7vKiTYz+prQyIoL+2dAJFTRW09imi+y/sw/DAG3v5poc1jKIBWauWTstJw9aeUootAiZahEE25jFg/X+8rcEEePTQ5G1arp90/jcsPdhu3HrU6DuXDqLyq+IhvrPmrFdA5UK4TdOGx1gVsqI8O69SMTYD0GeahxM6Le5y6QR5rkuaK6Ux/pykf48+OydIE5s6Af3ypjShCG5GTtvfy0tm2YE0lFTGauANvuBYP7h3/TePc+OY/B1FkKUACtNaACql4/tlaj2VUDjVrzqys3z9/KQAzWgwPXBIHPTvBWtX9Vug==
- Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=suse.com;
- Cc: Wei Liu <wl@xxxxxxx>, Roger Pau Monné <roger.pau@xxxxxxxxxx>, Jun Nakajima <jun.nakajima@xxxxxxxxx>, Kevin Tian <kevin.tian@xxxxxxxxx>, Tim Deegan <tim@xxxxxxx>, Tamas K Lengyel <tamas@xxxxxxxxxxxxx>, Alexandru Isaila <aisaila@xxxxxxxxxxxxxxx>, Petre Pircalabu <ppircalabu@xxxxxxxxxxxxxxx>, xen-devel@xxxxxxxxxxxxxxxxxxxx
- Delivery-date: Wed, 30 Aug 2023 13:39:38 +0000
- List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
On 24.08.2023 17:26, Jinoh Kang wrote:
> @@ -62,9 +63,16 @@ void pv_inject_event(const struct x86_event *event)
> error_code |= PFEC_user_mode;
>
> trace_pv_page_fault(event->cr2, error_code);
> - }
> - else
> + break;
> +
> + case X86_EXC_DB:
> + curr->arch.dr6 |= event->pending_dbg;
> + /* Fallthrough */
I guess I have another question here, perhaps more to Andrew: How come
this is just an OR? Not only with some of the bits having inverted sense
and earlier logic being ...
> --- a/xen/arch/x86/traps.c
> +++ b/xen/arch/x86/traps.c
> @@ -1989,17 +1989,17 @@ void do_debug(struct cpu_user_regs *regs)
> return;
> }
>
> - /* Save debug status register where guest OS can peek at it */
> - v->arch.dr6 |= (dr6 & ~X86_DR6_DEFAULT);
> - v->arch.dr6 &= (dr6 | ~X86_DR6_DEFAULT);
... an OR and an AND, but also with ...
> --- a/xen/arch/x86/x86_emulate/x86_emulate.h
> +++ b/xen/arch/x86/x86_emulate/x86_emulate.h
> @@ -78,7 +78,10 @@ struct x86_event {
> uint8_t type; /* X86_EVENTTYPE_* */
> uint8_t insn_len; /* Instruction length */
> int32_t error_code; /* X86_EVENT_NO_EC if n/a */
> - unsigned long cr2; /* Only for X86_EXC_PF h/w exception */
> + union {
> + unsigned long cr2; /* #PF */
> + unsigned long pending_dbg; /* #DB (new DR6 bits, positive polarity)
> */
... the comment here saying "positive polarity", which I understand
to mean that inverted bits need inverting by the consumer of this
field. If this is solely because none of the inverted bits are
supported for PV, then I guess this wants a comment at the use site
(not the least because it would need adjusting as soon as one such
would become supported).
Jan
|