xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
From: Alexandru Stefan ISAILA <aisaila@bitdefender.com>
To: "wei.liu2@citrix.com" <wei.liu2@citrix.com>
Cc: "tim@xen.org" <tim@xen.org>,
	"sstabellini@kernel.org" <sstabellini@kernel.org>,
	"rcojocaru@bitdefender.com" <rcojocaru@bitdefender.com>,
	"George.Dunlap@eu.citrix.com" <George.Dunlap@eu.citrix.com>,
	"andrew.cooper3@citrix.com" <andrew.cooper3@citrix.com>,
	"ian.jackson@eu.citrix.com" <ian.jackson@eu.citrix.com>,
	"xen-devel@lists.xen.org" <xen-devel@lists.xen.org>,
	"tamas@tklengyel.com" <tamas@tklengyel.com>,
	"jbeulich@suse.com" <jbeulich@suse.com>
Subject: Re: [PATCH v5] x86/hvm: Allow guest_request vm_events coming from userspace
Date: Tue, 8 Aug 2017 11:36:23 +0000	[thread overview]
Message-ID: <1502192182.4329.10.camel@bitdefender.com> (raw)
In-Reply-To: <20170808112708.gz2fcijoril7edyy@citrix.com>

On Ma, 2017-08-08 at 12:27 +0100, Wei Liu wrote:
> On Tue, Aug 08, 2017 at 11:27:35AM +0300, Alexandru Isaila wrote:
> > 
> > In some introspection usecases, an in-guest agent needs to
> > communicate
> > with the external introspection agent.  An existing mechanism is
> > HVMOP_guest_request_vm_event, but this is restricted to kernel
> > usecases
> > like all other hypercalls.
> > 
> > Introduce a mechanism whereby the introspection agent can whitelist
> > the
> > use of HVMOP_guest_request_vm_event directly from userspace.
> > 
> > Signed-off-by: Alexandru Isaila <aisaila@bitdefender.com>
> > 
> > ---
> > Changes since V4:
> > 	- Changed function mane from xc_allow_guest_userspace_event
> > 	  to xc_monitor_guest_userspace_event
> > 	- Fixed guest_request_enabled check
> > 	- Delete the guest_request_sync
> > 	- Changed guest_request_userspace_event to
> > 	  guest_request_userspace_enabled
> > 	- Moved guest_request_userspace_enabled flag from sched.h to
> > 	  domain.h
> > ---
> >  tools/libxc/include/xenctrl.h |  1 +
> >  tools/libxc/xc_monitor.c      | 14 ++++++++++++++
> >  xen/arch/x86/hvm/hypercall.c  |  5 +++++
> >  xen/common/monitor.c          | 13 +++++++++++++
> >  xen/include/asm-x86/domain.h  | 19 ++++++++++---------
> >  xen/include/public/domctl.h   | 21 +++++++++++----------
> >  6 files changed, 54 insertions(+), 19 deletions(-)
> > 
> > diff --git a/tools/libxc/include/xenctrl.h
> > b/tools/libxc/include/xenctrl.h
> > index bde8313..c72e12d 100644
> > --- a/tools/libxc/include/xenctrl.h
> > +++ b/tools/libxc/include/xenctrl.h
> > @@ -2022,6 +2022,7 @@ int xc_monitor_descriptor_access(xc_interface
> > *xch, domid_t domain_id,
> >                                   bool enable);
> >  int xc_monitor_guest_request(xc_interface *xch, domid_t domain_id,
> >                               bool enable, bool sync);
> > +int xc_monitor_guest_userspace_event(xc_interface *xch, domid_t
> > domain_id, bool enable);
> >  int xc_monitor_debug_exceptions(xc_interface *xch, domid_t
> > domain_id,
> >                                  bool enable, bool sync);
> >  int xc_monitor_cpuid(xc_interface *xch, domid_t domain_id, bool
> > enable);
> > diff --git a/tools/libxc/xc_monitor.c b/tools/libxc/xc_monitor.c
> > index b44ce93..bd8cbcf 100644
> > --- a/tools/libxc/xc_monitor.c
> > +++ b/tools/libxc/xc_monitor.c
> > @@ -161,6 +161,20 @@ int xc_monitor_guest_request(xc_interface
> > *xch, domid_t domain_id, bool enable,
> >      return do_domctl(xch, &domctl);
> >  }
> >  
> > +int xc_monitor_guest_userspace_event(xc_interface *xch, domid_t
> > domain_id, bool enable)
> > +{
> > +    DECLARE_DOMCTL;
> > +
> > +    domctl.cmd = XEN_DOMCTL_monitor_op;
> > +    domctl.domain = domain_id;
> > +    domctl.u.monitor_op.op = enable ? XEN_DOMCTL_MONITOR_OP_ENABLE
> > +                                    :
> > XEN_DOMCTL_MONITOR_OP_DISABLE;
> > +    domctl.u.monitor_op.event =
> > XEN_DOMCTL_MONITOR_EVENT_GUEST_USERSPACE_EVENT;
> > +
> > +    return do_domctl(xch, &domctl);
> > +}
> > +
> > +
> For this bit:
> 
> Acked-by: Wei Liu <wei.liu2@citrix.com>
> 
> Some nits below.
> 
> > 
> > diff --git a/xen/include/asm-x86/domain.h b/xen/include/asm-
> > x86/domain.h
> > index c10522b..de02507 100644
> > --- a/xen/include/asm-x86/domain.h
> > +++ b/xen/include/asm-x86/domain.h
> > @@ -396,15 +396,16 @@ struct arch_domain
> >  
> >      /* Arch-specific monitor options */
> >      struct {
> > -        unsigned int write_ctrlreg_enabled       : 4;
> > -        unsigned int write_ctrlreg_sync          : 4;
> > -        unsigned int write_ctrlreg_onchangeonly  : 4;
> > -        unsigned int singlestep_enabled          : 1;
> > -        unsigned int software_breakpoint_enabled : 1;
> > -        unsigned int debug_exception_enabled     : 1;
> > -        unsigned int debug_exception_sync        : 1;
> > -        unsigned int cpuid_enabled               : 1;
> > -        unsigned int descriptor_access_enabled   : 1;
> > +        unsigned int
> > write_ctrlreg_enabled                                 : 4;
> > +        unsigned int
> > write_ctrlreg_sync                                    : 4;
> > +        unsigned int
> > write_ctrlreg_onchangeonly                            : 4;
> > +        unsigned int
> > singlestep_enabled                                    : 1;
> > +        unsigned int
> > software_breakpoint_enabled                           : 1;
> > +        unsigned int
> > debug_exception_enabled                               : 1;
> > +        unsigned int
> > debug_exception_sync                                  : 1;
> > +        unsigned int
> > cpuid_enabled                                         : 1;
> > +        unsigned int
> > descriptor_access_enabled                             : 1;
> > +        unsigned int
> > guest_request_userspace_enabled                       : 1;
> Indentation here and below seems rather excessive.
This indentation was a suggestion made by Jan Beulich on Patch V3.
> 
> ________________________
> This email was scanned by Bitdefender
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel

  reply	other threads:[~2017-08-08 11:36 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-08-08  8:27 [PATCH v5] x86/hvm: Allow guest_request vm_events coming from userspace Alexandru Isaila
2017-08-08 11:27 ` Wei Liu
2017-08-08 11:36   ` Alexandru Stefan ISAILA [this message]
2017-08-14 15:53 ` Tamas K Lengyel
2017-08-15  8:06   ` Jan Beulich
2017-08-15 23:16     ` Tamas K Lengyel
2017-08-16  6:07       ` Razvan Cojocaru
     [not found]         ` <CABfawhkQ-2CbifdRqD=BOPc69Vp7Kvc4z0ZRZR9mFpxQ_LNBng@mail.gmail.com>
     [not found]           ` <9f32042d-b0cd-5a54-948d-24825416ce02@bitdefender.com>
2017-08-16 13:19             ` Tamas K Lengyel

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=1502192182.4329.10.camel@bitdefender.com \
    --to=aisaila@bitdefender.com \
    --cc=George.Dunlap@eu.citrix.com \
    --cc=andrew.cooper3@citrix.com \
    --cc=ian.jackson@eu.citrix.com \
    --cc=jbeulich@suse.com \
    --cc=rcojocaru@bitdefender.com \
    --cc=sstabellini@kernel.org \
    --cc=tamas@tklengyel.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).