All of lore.kernel.org
 help / color / mirror / Atom feed
From: Julien Grall <julien.grall@arm.com>
To: Tamas K Lengyel <tamas@tklengyel.com>
Cc: Stefano Stabellini <sstabellini@kernel.org>,
	Keir Fraser <keir@xen.org>,
	Razvan Cojocaru <rcojocaru@bitdefender.com>,
	Stefano Stabellini <stefano.stabellini@eu.citrix.com>,
	Andrew Cooper <andrew.cooper3@citrix.com>,
	Ian Jackson <ian.jackson@eu.citrix.com>,
	Jan Beulich <jbeulich@suse.com>,
	Xen-devel <xen-devel@lists.xenproject.org>,
	wei.liu2@citrix.com
Subject: Re: [PATCH v2 2/5] vm_event: Implement ARM SMC events
Date: Wed, 4 May 2016 14:26:10 +0100	[thread overview]
Message-ID: <5729F872.8000809@arm.com> (raw)
In-Reply-To: <CABfawhmYE16Fm-r1j0fFL8D2iH_3GNthEbV4JUd-jiSC+tHd9A@mail.gmail.com>

Hi Tamas,

I have just noticed that you use an old email address for Stefano. 
Please check MAINTAINERS file for any update on email address, new 
maintainers.

On 04/05/2016 13:42, Tamas K Lengyel wrote:
>
>  > On 03/05/2016 19:48, Tamas K Lengyel wrote:
>  >>
>  >>
>  >>
>  >> On Tue, May 3, 2016 at 5:31 AM, Julien Grall <julien.grall@arm.com
> <mailto:julien.grall@arm.com>
>  >> <mailto:julien.grall@arm.com <mailto:julien.grall@arm.com>>> wrote:
>  >>     On 29/04/16 19:07, Tamas K Lengyel wrote:
>  >>
>  >>         The ARM SMC instructions are already configured to trap to Xen
>  >>         by default. In
>  >>         this patch we allow a user-space process in a privileged domain
>  >>         to receive
>  >>         notification of when such event happens through the vm_event
>  >>         subsystem by
>  >>         introducing the PRIVILEGED_CALL type.
>  >>
>  >>         Signed-off-by: Tamas K Lengyel <tamas@tklengyel.com
> <mailto:tamas@tklengyel.com>
>  >>         <mailto:tamas@tklengyel.com <mailto:tamas@tklengyel.com>>>
>  >>
>  >>         ---
>  >>         Cc: Razvan Cojocaru <rcojocaru@bitdefender.com
> <mailto:rcojocaru@bitdefender.com>
>  >>         <mailto:rcojocaru@bitdefender.com
> <mailto:rcojocaru@bitdefender.com>>>
>  >>         Cc: Ian Jackson <ian.jackson@eu.citrix.com
> <mailto:ian.jackson@eu.citrix.com>
>  >>         <mailto:ian.jackson@eu.citrix.com
> <mailto:ian.jackson@eu.citrix.com>>>
>  >>         Cc: Stefano Stabellini <stefano.stabellini@eu.citrix.com
> <mailto:stefano.stabellini@eu.citrix.com>
>  >>         <mailto:stefano.stabellini@eu.citrix.com
> <mailto:stefano.stabellini@eu.citrix.com>>>
>  >>         Cc: Wei Liu <wei.liu2@citrix.com
> <mailto:wei.liu2@citrix.com> <mailto:wei.liu2@citrix.com
> <mailto:wei.liu2@citrix.com>>>
>  >>         Cc: Julien Grall <julien.grall@arm.com
> <mailto:julien.grall@arm.com>
>  >>         <mailto:julien.grall@arm.com <mailto:julien.grall@arm.com>>>
>  >>         Cc: Keir Fraser <keir@xen.org <mailto:keir@xen.org>
> <mailto:keir@xen.org <mailto:keir@xen.org>>>
>  >>         Cc: Jan Beulich <jbeulich@suse.com
> <mailto:jbeulich@suse.com> <mailto:jbeulich@suse.com
> <mailto:jbeulich@suse.com>>>
>  >>         Cc: Andrew Cooper <andrew.cooper3@citrix.com
> <mailto:andrew.cooper3@citrix.com>
>  >>         <mailto:andrew.cooper3@citrix.com
> <mailto:andrew.cooper3@citrix.com>>>
>  >>
>  >>
>  >>         v2: introduce VM_EVENT_REASON_PRIVELEGED_CALL
>  >>               aarch64 support
>  >>         ---
>  >>            MAINTAINERS                         |   6 +-
>  >>            tools/libxc/include/xenctrl.h       |   2 +
>  >>            tools/libxc/xc_monitor.c            |  26 +++++++-
>  >>            tools/tests/xen-access/xen-access.c |  31 ++++++++-
>  >>            xen/arch/arm/Makefile               |   2 +
>  >>            xen/arch/arm/monitor.c              |  80
> +++++++++++++++++++++++
>  >>            xen/arch/arm/traps.c                |  20 +++++-
>  >>            xen/arch/arm/vm_event.c             | 127
>  >>         ++++++++++++++++++++++++++++++++++++
>  >>            xen/arch/x86/hvm/event.c            |   2 +
>  >>            xen/common/vm_event.c               |   1 -
>  >>            xen/include/asm-arm/domain.h        |   5 ++
>  >>            xen/include/asm-arm/monitor.h       |  20 ++----
>  >>            xen/include/asm-arm/vm_event.h      |  16 ++---
>  >>            xen/include/public/domctl.h         |   1 +
>  >>            xen/include/public/vm_event.h       |  27 ++++++++
>  >>            15 files changed, 333 insertions(+), 33 deletions(-)
>  >>            create mode 100644 xen/arch/arm/monitor.c
>  >>            create mode 100644 xen/arch/arm/vm_event.c
>  >>
>  >>
>  >>     This patch is doing lots of things:
>  >>              - Add support for monitoring
>  >>              - Add support for vm_event
>  >>              - Monitor SMC
>  >>              - Move common code to arch specific code
>  >>
>  >>     As far as I can tell, all are distinct from each other. Can you
>  >>     please split this patch in smaller ones?
>  >>
>  >>
>  >> While I can split off some parts into separate patches, like
>  >> getting/setting ARM registers through VM events and the tools patches,
>  >> the other components are pretty tightly coupled and don't actually make
>  >> sense to split them. For example, enabling a monitor domctl for an event
>  >> without the VM event components doesn't make much sense. Vice verse for
>  >> the vm_event parts without being able to enable them.
>  >
>  >
>  > Well, the commit message does not mention half of the changes of this
> patch. Some changes like moving common code to arch specific code
> clearly needs explanation. It is the same for the fact that you only
> present a reduce set of registers to vm event for AArch64.
>
> This IMHO is not outstanding, it's the same on x86.

It documents the code and will help future reader to understand why we 
choose to only expose a smaller set of registers.

Note that the x86 structure is documented with: "Using a custom struct 
(no hvm_hw_cpu) so as to not fill the vm_event ring buffer too quickly". 
This is not the case for the ARM structure today.

>  >
>  > [...]
>  >
>  >
>  >>         +    if (
> current->domain->arch.monitor.privileged_call_enabled )
>  >>         +    {
>  >>         +        rc = monitor_smc(regs);
>  >>         +    }
>  >>
>  >>
>  >>     The bracket are not necessary.
>  >>
>  >>
>  >> Ack.
>  >>
>  >>
>  >>         +
>  >>         +    if ( rc != 1 )
>  >>
>  >>
>  >>     I think the code would be clearer if you introduce a define for "1".
>  >>
>  >>
>  >> Maybe not a define but calling the variable "handled" as we do on x86
>  >> would be more descriptive.
>  >
>  >
>  > IHMO, "handled" infers that the variable is boolean. This is not the
> case here as you could have negative value.
>
> It may be but thats the convention we have for this on x86 so symmetry
> is better then introducing a new define just for the ARM case.

Whilst I agree that we should use the same convention across all the 
architectures, nothing prevents you to update the x86 code and use the 
new define.

It does not make much sense to introduce code on ARM that may not be 
clearer just because x86 did it.

Anyway, Stefano may have a different view on this.

[...]

>  >
>  > [...]
>  >
>  >
>  >>     AArch64 provides 31 generate-purpose registers. Although, x29 and
>  >>     x30 are respectively used for fp and lr.
>  >>
>  >>
>  >> For vm_event it's not necessary to get all registers, rather it's just a
>  >> handful of selection that may be especially "useful" for introspection.
>  >
>  >
>  > How did you decide that only the first to xN registers are useful? It
> would be valid to have an SMC call using x20 for an arguments.
>  >
>  > Similarly, the hypercall convention for AArch64 makes use of x16
> which is not exposed to the vm event subsystem.
>
> Certainly, as I said, if a future application needs other registers to
> be sent here and can justify it, this can be adjusted.	
>
>  >
>  >
>  >> It's also important not to fill up the vm_event monitor ring with huge
>  >> request/response structs so even on x86 we only have a subset of the
>  >> registers. As right now there are no applications for aarch64, it's only
>  >> a guess of what registers would be "useful" and may be adjusted in
>  >> future versions as we start to have applications using this.
>  >
>  >
>  > Guessing the set of useful registers is usually not a good idea (see
> why above).
>  >
>
> Remember, the subscriber can always get/set the full set of registers
> when it needs to, so completeness here is not critical. You are missing
> the point that the space on the ring is limited and it can fill up fast
> when the full vCPU context is pushed on it for all events. Right now the
> x86 side is still larger so we have some room for additional registers
> to be sent when users of this system have a better view into what they
> find important. Which is IMHO not now.

I may misunderstand some parts of the vm event subsystem. To get/set the 
full set of registers, the user will have to use the 
DOMCTL_{set,get}vcpucontext, correct? So why does Xen expose a part of 
the vCPU context through the vm_event?

Regards,

-- 
Julien Grall

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
http://lists.xen.org/xen-devel

  reply	other threads:[~2016-05-04 13:26 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-04-29 18:07 [PATCH v2 1/5] monitor: Rename vm_event_monitor_get_capabilities Tamas K Lengyel
2016-04-29 18:07 ` [PATCH v2 2/5] vm_event: Implement ARM SMC events Tamas K Lengyel
2016-04-29 20:07   ` Razvan Cojocaru
2016-04-29 20:12     ` Tamas K Lengyel
2016-04-29 20:27       ` Tamas K Lengyel
2016-04-29 20:32         ` Razvan Cojocaru
2016-05-02 10:35   ` Wei Liu
2016-05-03 11:31   ` Julien Grall
2016-05-03 18:48     ` Tamas K Lengyel
2016-05-04 10:31       ` Julien Grall
     [not found]         ` <CABfawhmwVQyYeGYMxKTb1zMUkyOSutMwm4bkTxoeNaFTmGuyXA@mail.gmail.com>
     [not found]           ` <CABfawhmVUyqcuoxitKrXxcg93yLY4e8H7S1A_GEFbX3+Vb-hrA@mail.gmail.com>
2016-05-04 12:42             ` Tamas K Lengyel
2016-05-04 13:26               ` Julien Grall [this message]
2016-05-04 13:30                 ` Razvan Cojocaru
2016-05-04 14:03                   ` Julien Grall
2016-05-04 14:08                     ` Tamas K Lengyel
2016-04-29 18:07 ` [PATCH v2 3/5] x86/hvm: Rename hvm/event to hvm/monitor Tamas K Lengyel
2016-05-04  1:13   ` Tian, Kevin
2016-04-29 18:07 ` [PATCH v2 4/5] x86/hvm: Add debug exception vm_events Tamas K Lengyel
2016-05-02 13:12   ` Jan Beulich
2016-05-02 15:35     ` Tamas K Lengyel
2016-05-02 15:40       ` Jan Beulich
2016-05-02 15:45         ` Tamas K Lengyel
2016-04-29 18:07 ` [PATCH v2 5/5] MAINTAINERS: Update monitor/vm_event covered code Tamas K Lengyel
2016-05-02 13:00   ` Jan Beulich
2016-05-03  8:18   ` Jan Beulich
2016-05-03  8:20     ` Razvan Cojocaru
2016-05-03  8:26       ` Jan Beulich
2016-05-03  9:09     ` Wei Liu

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=5729F872.8000809@arm.com \
    --to=julien.grall@arm.com \
    --cc=andrew.cooper3@citrix.com \
    --cc=ian.jackson@eu.citrix.com \
    --cc=jbeulich@suse.com \
    --cc=keir@xen.org \
    --cc=rcojocaru@bitdefender.com \
    --cc=sstabellini@kernel.org \
    --cc=stefano.stabellini@eu.citrix.com \
    --cc=tamas@tklengyel.com \
    --cc=wei.liu2@citrix.com \
    --cc=xen-devel@lists.xenproject.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.