All of lore.kernel.org
 help / color / mirror / Atom feed
From: Razvan Cojocaru <rcojocaru@bitdefender.com>
To: xen-devel@lists.xen.org
Cc: kevin.tian@intel.com, keir@xen.org, jbeulich@suse.com,
	stefano.stabellini@eu.citrix.com, andrew.cooper3@citrix.com,
	suravee.suthikulpanit@amd.com, eddie.dong@intel.com, tim@xen.org,
	Aravind.Gopalakrishnan@amd.com, jun.nakajima@intel.com,
	wei.liu2@citrix.com, boris.ostrovsky@oracle.com,
	ian.jackson@eu.citrix.com, ian.campbell@citrix.com
Subject: Re: [PATCH V2 2/3] xen/vm_event: Support for guest-requested events
Date: Wed, 24 Jun 2015 17:56:33 +0300	[thread overview]
Message-ID: <558AC521.8090606@bitdefender.com> (raw)
In-Reply-To: <1434359007-9302-3-git-send-email-rcojocaru@bitdefender.com>

On 06/15/2015 12:03 PM, Razvan Cojocaru wrote:
> Added support for a new class of vm_events: VM_EVENT_REASON_REQUEST,
> sent via HVMOP_request_vm_event. The guest can request that a
> generic vm_event (containing only the vm_event-filled guest registers
> as information) be sent to userspace by setting up the correct
> registers and doing a VMCALL. For example, for a 64-bit guest, this
> means: EAX = 34 (hvmop), EBX = 24 (HVMOP_request_vm_event).
> 
> Signed-off-by: Razvan Cojocaru <rcojocaru@bitdefender.com>
> 
> ---
> Changes since V1:
>  - Using "curr" consistently in hvm_event_requested().
>  - Renamed VM_EVENT_REASON_REQUEST to VM_EVENT_REASON_GUEST_REQUEST.

In the meantime, my colleague Corneliu Zuzu working on an ARM-related
project with Xen has tested my patch and discovered that some registers
get clobbered when Xen is compiled in debug mode and a GUEST_REQUEST
event is being sent out.

Here's the ARM part, in do_trap_hypercall(), xen/arch/arm/traps.c:

1399 #ifndef NDEBUG
1400     /*
1401      * Clobber argument registers only if pc is unchanged, otherwise
1402      * this is a hypercall continuation.
1403      */
1404     if ( orig_pc == regs->pc )
1405     {
1406         switch ( arm_hypercall_table[*nr].nr_args ) {
1407         case 5: HYPERCALL_ARG5(regs) = 0xDEADBEEF;
1408         case 4: HYPERCALL_ARG4(regs) = 0xDEADBEEF;
1409         case 3: HYPERCALL_ARG3(regs) = 0xDEADBEEF;
1410         case 2: HYPERCALL_ARG2(regs) = 0xDEADBEEF;
1411         case 1: /* Don't clobber x0/r0 -- it's the return value */
1412             break;
1413         default: BUG();
1414         }
1415         *nr = 0xDEADBEEF;
1416     }
1417 #endif

Would it be fair to say that HVMOP_request_vm_event should be an
exception to this rule (i.e. something along the lines of "if (
unlikely(r12 == HVMOP_request_vm_event) && orig_pc == regs->pc )",
etc.)? Even in debug mode, a GUEST_REQUEST vm_event should keep the
state of the guest intact.


Thanks,
Razvan

  reply	other threads:[~2015-06-24 14:56 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-06-15  9:03 Vm_event memory introspection helpers Razvan Cojocaru
2015-06-15  9:03 ` [PATCH V2 1/3] xen/vm_access: Support for memory-content hiding Razvan Cojocaru
2015-06-25 15:57   ` Jan Beulich
2015-06-26  8:22     ` Razvan Cojocaru
2015-06-26  8:44       ` Jan Beulich
2015-06-26  9:49         ` Razvan Cojocaru
2015-06-26  9:59           ` Jan Beulich
2015-06-15  9:03 ` [PATCH V2 2/3] xen/vm_event: Support for guest-requested events Razvan Cojocaru
2015-06-24 14:56   ` Razvan Cojocaru [this message]
2015-06-24 15:03     ` Jan Beulich
2015-06-25  7:55       ` Razvan Cojocaru
2015-06-25  8:37         ` Jan Beulich
2015-06-25  9:09           ` Razvan Cojocaru
2015-06-26  7:02   ` Jan Beulich
2015-06-26  7:17     ` Razvan Cojocaru
2015-06-26  8:45       ` Jan Beulich
2015-06-30 14:48       ` Lengyel, Tamas
2015-06-30 15:22         ` Razvan Cojocaru
2015-07-01  8:24         ` Razvan Cojocaru
2015-07-06 10:26         ` Jan Beulich
2015-07-06 13:46           ` Lengyel, Tamas
2015-06-30 14:23     ` Razvan Cojocaru
2015-07-06 10:27       ` Jan Beulich
2015-07-06 14:35         ` Razvan Cojocaru
2015-06-15  9:03 ` [PATCH V2 3/3] xen/vm_event: Deny register writes if refused by vm_event reply Razvan Cojocaru
2015-06-26  8:28   ` Jan Beulich
2015-06-26  9:17     ` Razvan Cojocaru
2015-06-26  9:39       ` Jan Beulich
2015-06-26 10:33         ` Razvan Cojocaru
2015-07-01 15:21     ` Razvan Cojocaru

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=558AC521.8090606@bitdefender.com \
    --to=rcojocaru@bitdefender.com \
    --cc=Aravind.Gopalakrishnan@amd.com \
    --cc=andrew.cooper3@citrix.com \
    --cc=boris.ostrovsky@oracle.com \
    --cc=eddie.dong@intel.com \
    --cc=ian.campbell@citrix.com \
    --cc=ian.jackson@eu.citrix.com \
    --cc=jbeulich@suse.com \
    --cc=jun.nakajima@intel.com \
    --cc=keir@xen.org \
    --cc=kevin.tian@intel.com \
    --cc=stefano.stabellini@eu.citrix.com \
    --cc=suravee.suthikulpanit@amd.com \
    --cc=tim@xen.org \
    --cc=wei.liu2@citrix.com \
    --cc=xen-devel@lists.xen.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.