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: Wei Liu <wei.liu2@citrix.com>, 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>
Subject: Re: [PATCH v2 2/5] vm_event: Implement ARM SMC events
Date: Wed, 4 May 2016 11:31:59 +0100	[thread overview]
Message-ID: <5729CF9F.7080907@arm.com> (raw)
In-Reply-To: <CABfawhmbe_oLhUPiQ-eCoGPN6N2g56P=vfs-vULxrsXp63sBDA@mail.gmail.com>

Hi Tamas,

Can you configure your email client to quote properly? I.e using ">" 
rather than tabulation to show the quoting.

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>> 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>>
>         ---
>         Cc: Razvan Cojocaru <rcojocaru@bitdefender.com
>         <mailto:rcojocaru@bitdefender.com>>
>         Cc: Ian Jackson <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>>
>         Cc: Wei Liu <wei.liu2@citrix.com <mailto:wei.liu2@citrix.com>>
>         Cc: Julien Grall <julien.grall@arm.com
>         <mailto:julien.grall@arm.com>>
>         Cc: Keir Fraser <keir@xen.org <mailto:keir@xen.org>>
>         Cc: Jan Beulich <jbeulich@suse.com <mailto:jbeulich@suse.com>>
>         Cc: Andrew Cooper <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.

In any case, there is too many logical changes in this patch, which 
makes difficult to review it. So please split this patch in smaller chunk.

[...]

>         +    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.

>
>
>         +    {
>         +        GUEST_BUG_ON(!psr_mode_is_32bit(regs->cpsr));
>
>
>     This check cannot work for AArch64 guest.
>
>
> For HSR_EC_SMC32 there is already
> GUEST_BUG_ON(!psr_mode_is_32bit(regs->cpsr)); and for HSR_EC_SMC64 there
> is GUEST_BUG_ON(psr_mode_is_32bit(regs->cpsr)); before calling
> do_trap_smc. So are you saying that check is wrong for AArch64 as it is
> right now in unstable? Also, is there any reason those checks are
> opposite of each other?

No, I am saying that your check is wrong here. psr_mode_is_32bit returns 
true if the guest was running in 32-bit mode, else false when running in 
64-bit mode.

The check are opposites each other because the exception SMC64 can only 
be taken from an AArch64 state, and SMC32 from an AArch32 State.

[...]

>     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.

> 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).

Regards,

-- 
Julien Grall

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

  reply	other threads:[~2016-05-04 10:32 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 [this message]
     [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
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=5729CF9F.7080907@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=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.