All of lore.kernel.org
 help / color / mirror / Atom feed
From: Corneliu ZUZU <czuzu@bitdefender.com>
To: Jan Beulich <JBeulich@suse.com>
Cc: Tamas K Lengyel <tamas@tklengyel.com>, Keir Fraser <keir@xen.org>,
	Ian Campbell <ian.campbell@citrix.com>,
	Razvan Cojocaru <rcojocaru@bitdefender.com>,
	Andrew Cooper <andrew.cooper3@citrix.com>,
	xen-devel@lists.xen.org,
	Stefano Stabellini <stefano.stabellini@citrix.com>
Subject: Re: [PATCH] arm/monitor vm-events: Implement guest-request support
Date: Fri, 19 Feb 2016 20:01:41 +0200	[thread overview]
Message-ID: <56C75885.2010509@bitdefender.com> (raw)
In-Reply-To: <56C75BB402000078000D444F@prv-mh.provo.novell.com>

On 2/19/2016 7:15 PM, Jan Beulich wrote:
>>>> On 19.02.16 at 17:25, <czuzu@bitdefender.com> wrote:
>> On 2/19/2016 4:26 PM, Jan Beulich wrote:
>>>>>> On 18.02.16 at 20:35, <czuzu@bitdefender.com> wrote:
>>>> ---
>>>>    MAINTAINERS                     |   1 +
>>>>    xen/arch/arm/hvm.c              |   8 +++
>>>>    xen/arch/x86/hvm/event.c        | 116 ++++++----------------------------------
>>>>    xen/arch/x86/hvm/hvm.c          |   1 +
>>>>    xen/arch/x86/monitor.c          |  14 -----
>>>>    xen/arch/x86/vm_event.c         |   1 +
>>>>    xen/common/Makefile             |   2 +-
>>>>    xen/common/hvm/Makefile         |   3 +-
>>>>    xen/common/hvm/event.c          |  96 +++++++++++++++++++++++++++++++++
>>> So here you _again_ try to introduce something HVM-ish for ARM.
>>> Why? Why can't this code live in common/vm_event.c?
>> Are you referring to "xen/arch/arm/hvm.c"? If so, I did not introduce
>> that file, it was already there, all I did is add handling of
>> HVMOP_guest_request_vm_event to ARM-side's already existing do_hvm_op :).
> No, I'm referring to your initial attempt to create arch/arm/hvm/...

I don't understand. Have I done that again with this patch?

>
>> On the "HVM-ish" note, is there some incompatibility between ARM and the
>> concept of HVM?
> ARM guests are neither PV nor HVM right now, but somewhere in
> the middle (PVHv2 may come closest).

I did not know that, but the fact that there is already "hvm-like" code 
written for ARM didn't hint me towards that fact either :)
I'm aware that I'm far from familiar with the codebase right now, I'm 
browsing more of the code these days and taking notes to try and 
understand in depth at least the parts I'm sending contributions for.
I've already got some questions I want to post to the mailing list soon, 
*including* exactly how the distinction between the guest-types comes 
into play w/ the vm-events code.
Specifically, I'm talking for example about the following piece of code 
from the X86 arch_monitor_get_capabilities:

     /*
      * At the moment only Intel HVM domains are supported. However, event
      * delivery could be extended to AMD and PV domains.
      */
     if ( !is_hvm_domain(d) || !cpu_has_vmx )
         return capabilities;

== "However, event delivery could be extended to AMD and PV domains".
This comment begs for questions like:
* what would be necessary to extend support to PV domains?
* can we really do this operation without hardware assisted 
virtualization whatsoever? If not, how much can we do without that?
* what about pvh?

Since I have other questions like the above and I'll probably have more 
while I'm trying to get a better picture of the code, would it be ok if 
we defer addressing these issues to then?

>
>>>> --- a/xen/include/asm-x86/domain.h
>>>> +++ b/xen/include/asm-x86/domain.h
>>>> @@ -376,17 +376,15 @@ struct arch_domain
>>>>        unsigned long *pirq_eoi_map;
>>>>        unsigned long pirq_eoi_map_mfn;
>>>>    
>>>> -    /* Monitor options */
>>>> +    /* 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 mov_to_msr_enabled          : 1;
>>>> -        unsigned int mov_to_msr_extended         : 1;
>>>> -        unsigned int singlestep_enabled          : 1;
>>>> -        unsigned int software_breakpoint_enabled : 1;
>>>> -        unsigned int guest_request_enabled       : 1;
>>>> -        unsigned int guest_request_sync          : 1;
>>>> +        uint16_t write_ctrlreg_enabled       : 4;
>>>> +        uint16_t write_ctrlreg_sync          : 4;
>>>> +        uint16_t write_ctrlreg_onchangeonly  : 4;
>>>> +        uint16_t mov_to_msr_enabled          : 1;
>>>> +        uint16_t mov_to_msr_extended         : 1;
>>>> +        uint16_t singlestep_enabled          : 1;
>>>> +        uint16_t software_breakpoint_enabled : 1;
>>>>        } monitor;
>>> What is this type change supposed to achieve in general, and in
>>> particular in the context of this patch?
>> Some time before this patch there was a discussion I had w/ ARM
>> maintainer Ian Campbell who made the suggestion to try and move parts of
>> the monitor vm-events code to the common-side.
>> (you can find that discussion here:
>> https://www.mail-archive.com/xen-devel@lists.xen.org/msg54139.html).
>> In short, the reason for his suggestion was that that previous attempt
>> of mine to add guest-request support for ARM highlighted code
>> duplication between X86 and ARM if I were to leave the monitor vm-events
>> code as it was (that is, completely arch-specific). In an effort to
>> avoid that, I first submitted a 7 patch-series which tried to move as
>> much as possible to the common-side.
>> "As much as possible" meant guest-request, ctrl-reg write, single-step
>> and software breakpoints, all moved to the common-side. That also meant
>> introducing some Kconfigs to selectively activate some parts of that
>> now-common code, since not all of it was used on ARM at that moment.
>> Although conceptually that code could have remained on the common-side,
>> Tamas pointed out that we could get rid of the Kconfigs (which in his
>> opinion bloated the code) by only moving at the moment what is
>> implemented on both X86 and ARM. As for the rest, he noted that when I
>> add implementations for the other monitor vm-events on ARM as well, I
>> could move that to common as well. The above is a result of that -
>> guest-request is implemented on both X86 and ARM with this patch, hence
>> I also moved it to common.
> I agree there are two fields being removed. But the question was
> why you also change the type of the other fields.

It made sense because:
* we don't need 32-bits to store that data anymore
* as implementations are laid out for ARM also, more of those bits will 
get moved to common, so even less bits will be needed

>>>> --- a/xen/include/asm-x86/hvm/event.h
>>>> +++ b/xen/include/asm-x86/hvm/event.h
>>>> @@ -1,5 +1,9 @@
>>>>    /*
>>>> - * event.h: Hardware virtual machine assist events.
>>>> + * include/asm-x86/hvm/event.h
>>>> + *
>>>> + * Arch-specific hardware virtual machine event abstractions.
>>>> + *
>>>> + * Copyright (c) 2016, Bitdefender S.R.L.
>>> Is this true? Namely, was _all_ of the code here written by people
>>> on your company, including what may have got moved here from
>>> elsewhere?
>> My bad. Removing that line would be satisfactory, yes?
> To me, yes.
>
> Jan
>

Noted.

Corneliu.

  reply	other threads:[~2016-02-19 18:01 UTC|newest]

Thread overview: 34+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-02-18 19:35 [PATCH] arm/monitor vm-events: Implement guest-request support Corneliu ZUZU
2016-02-18 20:08 ` Razvan Cojocaru
2016-02-18 21:25   ` Tamas K Lengyel
2016-02-19  5:44     ` Corneliu ZUZU
2016-02-19 13:49 ` Stefano Stabellini
2016-02-19 13:56   ` Razvan Cojocaru
2016-02-19 15:56   ` Corneliu ZUZU
2016-02-19 16:00     ` Stefano Stabellini
2016-02-19 16:05       ` Andrew Cooper
2016-02-19 16:10         ` Corneliu ZUZU
2016-02-19 17:47           ` Stefano Stabellini
2016-02-19 17:54             ` Tamas K Lengyel
2016-02-19 18:11               ` Corneliu ZUZU
2016-02-19 18:27                 ` Tamas K Lengyel
2016-02-19 18:33                   ` Corneliu ZUZU
2016-02-19 18:42                     ` Tamas K Lengyel
2016-02-19 20:46                       ` Corneliu ZUZU
2016-02-19 14:26 ` Jan Beulich
2016-02-19 16:02   ` Tamas K Lengyel
2016-02-19 16:35     ` Corneliu ZUZU
2016-02-19 16:25   ` Corneliu ZUZU
2016-02-19 17:15     ` Jan Beulich
2016-02-19 18:01       ` Corneliu ZUZU [this message]
2016-02-22 10:14         ` Jan Beulich
2016-02-22 11:26           ` Corneliu ZUZU
2016-02-22 11:38             ` Jan Beulich
2016-02-22 11:40               ` Razvan Cojocaru
2016-02-23  9:09 ` Corneliu ZUZU
2016-02-23 10:54   ` Razvan Cojocaru
2016-02-23 11:00     ` Corneliu ZUZU
2016-02-23 11:06       ` Razvan Cojocaru
2016-02-23 14:28         ` Tamas K Lengyel
2016-02-23 14:30   ` Tamas K Lengyel
2016-02-23 14:57     ` Corneliu ZUZU

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=56C75885.2010509@bitdefender.com \
    --to=czuzu@bitdefender.com \
    --cc=JBeulich@suse.com \
    --cc=andrew.cooper3@citrix.com \
    --cc=ian.campbell@citrix.com \
    --cc=keir@xen.org \
    --cc=rcojocaru@bitdefender.com \
    --cc=stefano.stabellini@citrix.com \
    --cc=tamas@tklengyel.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.