[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [XEN PATCH] x86/monitor: Add new monitor event to catch I/O instructions
- To: Jan Beulich <jbeulich@xxxxxxxx>, Tamas K Lengyel <tamas@xxxxxxxxxxxxx>
- From: Дмитрий Исайкин <isaikin-dmitry@xxxxxxxxx>
- Date: Tue, 14 Mar 2023 17:04:36 +0300
- Authentication-results: vla1-4c5ff3d0aef5.qloud-c.yandex.net; dkim=pass header.i=@yandex.ru
- Cc: "xen-devel@xxxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxxx>, Wei Liu <wl@xxxxxxx>, Anthony PERARD <anthony.perard@xxxxxxxxxx>, Juergen Gross <jgross@xxxxxxxx>, Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, George Dunlap <george.dunlap@xxxxxxxxxx>, Julien Grall <julien@xxxxxxx>, Stefano Stabellini <sstabellini@xxxxxxxxxx>, Roger Pau Monné <roger.pau@xxxxxxxxxx>, Alexandru Isaila <aisaila@xxxxxxxxxxxxxxx>, Petre Pircalabu <ppircalabu@xxxxxxxxxxxxxxx>, Jun Nakajima <jun.nakajima@xxxxxxxxx>, Kevin Tian <kevin.tian@xxxxxxxxx>, Anton Belousov <abelousov@xxxxxxxxxxxxxx>
- Delivery-date: Tue, 14 Mar 2023 14:04:51 +0000
- List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
13.03.2023, 19:15, "Jan Beulich" <jbeulich@xxxxxxxx>: On 11.03.2023 15:50, Tamas K Lengyel wrote: On Fri, Mar 10, 2023 at 10:57 PM Dmitry Isaykin <isaikin-dmitry@xxxxxxxxx> --- a/xen/arch/x86/hvm/vmx/vmx.c +++ b/xen/arch/x86/hvm/vmx/vmx.c @@ -4579,6 +4579,8 @@ void vmx_vmexit_handler(struct cpu_user_regs *regs) uint16_t port = (exit_qualification >> 16) & 0xFFFF; int bytes = (exit_qualification & 0x07) + 1; int dir = (exit_qualification & 0x08) ? IOREQ_READ : IOREQ_WRITE; + int str_ins = (exit_qualification & 0x10) ? 1 : 0; You are already in a branch here where str_ins is checked and known to be 1. 0 that is, i.e. only non-string insns would presently be reported.
Dmitry, you also want to make this variable and the corresponding function parameters "bool". Unless of course they need changing anyway to e.g. communicate the address of the data (as also indicated by Andrew).
OK. + hvm_io_instruction_intercept(port, dir, bytes, str_ins); IMHO you should have this intercept be called outside the if-else. The function already kind-of indicates str_ins is an input yet right now only called when it's 1.
I agree. Question is, as above, what further data may need supplying to the monitor agent to make the intercept useful. Merely %rsi / %rdi as Andrew suggested may not suffice, as especially outside of 64-bit mode the involved segment base may be non-zero.
I think that in synchronous mode all necessary register information is already available. Jan
|