All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Jan Beulich" <JBeulich@suse.com>
To: Tamas K Lengyel <tamas@tklengyel.com>
Cc: Andrew Cooper <andrew.cooper3@citrix.com>,
	xen-devel@lists.xen.org,
	Razvan Cojocaru <rcojocaru@bitdefender.com>,
	Corneliu ZUZU <czuzu@bitdefender.com>
Subject: Re: [PATCH 6/7] vm-event/arm: move hvm_event_cr->common vm_event_monitor_cr
Date: Wed, 22 Jun 2016 00:33:01 -0600	[thread overview]
Message-ID: <576A4D3D02000078000F772C@prv-mh.provo.novell.com> (raw)
In-Reply-To: <CABfawh=zfour1eFdwk_q21EfBDTY3OiJT4bcbA0owcCxvtnV=Q@mail.gmail.com>

>>> On 21.06.16 at 17:22, <tamas@tklengyel.com> wrote:
> On Jun 21, 2016 01:20, "Jan Beulich" <JBeulich@suse.com> wrote:
>>
>> >>> On 21.06.16 at 09:08, <czuzu@bitdefender.com> wrote:
>> > On 6/17/2016 11:25 AM, Corneliu ZUZU wrote:
>> >> On 6/16/2016 6:16 PM, Jan Beulich wrote:
>> >>>>>> On 16.06.16 at 16:12, <czuzu@bitdefender.com> wrote:
>> >>>> Prepare for ARM implementation of control-register write vm-events
>> >>>> by moving
>> >>>> X86-specific hvm_event_cr to the common-side.
>> >>>>
>> >>>> Signed-off-by: Corneliu ZUZU <czuzu@bitdefender.com>
>> >>>> ---
>> >>>>   xen/arch/x86/hvm/event.c        | 30 ------------------------------
>> >>>>   xen/arch/x86/hvm/hvm.c          |  2 +-
>> >>>>   xen/arch/x86/monitor.c          | 37
>> >>>> -------------------------------------
>> >>>>   xen/arch/x86/vm_event.c         |  2 +-
>> >>>>   xen/common/monitor.c            | 40
>> >>>> ++++++++++++++++++++++++++++++++++++++++
>> >>>>   xen/common/vm_event.c           | 31
> +++++++++++++++++++++++++++++++
>> >>>>   xen/include/asm-x86/hvm/event.h | 13 ++++---------
>> >>>>   xen/include/asm-x86/monitor.h   |  2 --
>> >>>>   xen/include/xen/monitor.h       |  4 ++++
>> >>>>   xen/include/xen/vm_event.h      | 10 ++++++++++
>> >>>>   10 files changed, 91 insertions(+), 80 deletions(-)
>> >>> Considering that there's no ARM file getting altered here at all,
>> >>> mentioning ARM in the subject is a little odd.
>> >>
>> >> This patch and the following one should be meld together.
>> >> I only split them to ease reviewing, sorry I forgot to mention that in
>> >> the cover letter.
>> >>
>> >>>
>> >>>> --- a/xen/common/monitor.c
>> >>>> +++ b/xen/common/monitor.c
>> >>>> @@ -62,6 +62,46 @@ int monitor_domctl(struct domain *d, struct
>> >>>> xen_domctl_monitor_op *mop)
>> >>>>         switch ( mop->event )
>> >>>>       {
>> >>>> +#if CONFIG_X86
>> >>> #ifdef please.
>> >> Ack.
>> >>>> +    case XEN_DOMCTL_MONITOR_EVENT_WRITE_CTRLREG:
>> >>>> +    {
>> >>>> +        struct arch_domain *ad = &d->arch;
>> >>> Peeking into the next patch I see that this stays there. Common code,
>> >>> however, shouldn't access ->arch sub-structures - respective fields
>> >>> should be moved out.
>> >>
>> >> Then we need to find a resolution that avoids code duplication.
>> >> The code is the same, but those bits that are currently on the arch
>> >> side (arch.monitor.write_ctrlreg_*) cannot be moved to common as they
>> >> are, since their -number- might differ from arch-to-arch.
>> >> But we could:
>> >> - in public/vm_event.h, besides the VM_EVENT_X86_* and VM_EVENT_ARM_*
>> >> defines (wcr index), also have
>> >>     #define VM_EVENT_X86_CR_COUNT        4
>> >>     #define VM_EVENT_ARM_CR_COUNT      4
>> >> - move the 3 write_ctrlreg_{enabled,sync,onchangeonly} fields from
>> >> arch_domain to domain (common) and make them 8-bits wide each for now
>> >> (widened more in the future if the need arises)
>> >> - let monitor_ctrlreg_bitmask() macro to be architecture-dependent and
>> >> use the introduced VM_EVENT_<arch>_CR_COUNT
>> >>
>> >> Tamas, we also talked on this matter @ some point (when I sent the
>> >> patches that moved vm-event parts to common). What do you think of the
>> >> above?
>>
>> I don't really care about the specifics, my only request is what I
>> already voiced: Common code should not access arch-specific
>> fields. Having the field to hold the control register bits common,
>> but the definitions for the individual bits arch-specific is perfectly
>> fine for this (assuming that these per-arch definitions then again
>> don't get used in common code).
> 
> As Jan says it would be fine to have the holder field on the common struct
> but IMHO it wouldn't be easier to follow the logic that way and the only
> benefit is reducing code duplication a little bit. I think for now it is
> acceptable to just rather have some code duplication.

Code duplication isn't the main issue here. Inviting further
conceptually wrong code additions (accessing per-arch fields from
common code), by setting a(nother) bad precedent, is what I want
to avoid from the beginning.

Jan

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

  reply	other threads:[~2016-06-22  6:33 UTC|newest]

Thread overview: 73+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-06-16 14:04 [PATCH 0/7] vm-event: Implement ARM support for control-register writes Corneliu ZUZU
2016-06-16 14:06 ` [PATCH 1/7] minor (formatting) fixes Corneliu ZUZU
2016-06-16 14:24   ` Jan Beulich
2016-06-16 19:19     ` Corneliu ZUZU
2016-06-17  7:06       ` Jan Beulich
2016-06-17 10:46         ` Corneliu ZUZU
2016-06-16 16:02   ` Tamas K Lengyel
2016-06-17  8:33     ` Corneliu ZUZU
2016-06-17  8:36       ` Razvan Cojocaru
2016-06-17  9:29         ` Andrew Cooper
2016-06-17  9:35           ` Jan Beulich
2016-06-17  9:33         ` Jan Beulich
2016-06-17  9:36           ` Razvan Cojocaru
2016-06-17  9:40             ` Jan Beulich
2016-06-17  9:42               ` Razvan Cojocaru
2016-06-17 19:05           ` Tamas K Lengyel
2016-06-16 14:07 ` [PATCH 2/7] vm-event: VM_EVENT_FLAG_DENY requires VM_EVENT_FLAG_VCPU_PAUSED Corneliu ZUZU
2016-06-16 16:11   ` Tamas K Lengyel
2016-06-17  8:43     ` Corneliu ZUZU
2016-06-21 11:26     ` Corneliu ZUZU
2016-06-21 15:09       ` Tamas K Lengyel
2016-06-22  8:34         ` Corneliu ZUZU
2016-06-16 14:08 ` [PATCH 3/7] vm-event: introduce vm_event_vcpu_enter Corneliu ZUZU
2016-06-16 14:51   ` Jan Beulich
2016-06-16 20:10     ` Corneliu ZUZU
2016-06-16 20:33       ` Razvan Cojocaru
2016-06-17 10:41         ` Corneliu ZUZU
2016-06-17  7:17       ` Jan Beulich
2016-06-17 11:13         ` Corneliu ZUZU
2016-06-17 11:27           ` Jan Beulich
2016-06-17 12:13             ` Corneliu ZUZU
2016-06-16 16:17   ` Tamas K Lengyel
2016-06-17  9:19     ` Corneliu ZUZU
2016-06-17  8:55   ` Julien Grall
2016-06-17 11:40     ` Corneliu ZUZU
2016-06-17 13:22       ` Julien Grall
2016-06-16 14:09 ` [PATCH 4/7] vm-event/x86: use vm_event_vcpu_enter properly Corneliu ZUZU
2016-06-16 15:00   ` Jan Beulich
2016-06-16 20:20     ` Corneliu ZUZU
2016-06-17  7:20       ` Jan Beulich
2016-06-17 11:23         ` Corneliu ZUZU
2016-06-16 16:27   ` Tamas K Lengyel
2016-06-17  9:24     ` Corneliu ZUZU
2016-06-16 14:10 ` [PATCH 5/7] x86: replace monitor_write_data.do_write with enum Corneliu ZUZU
2016-06-16 14:12 ` [PATCH 6/7] vm-event/arm: move hvm_event_cr->common vm_event_monitor_cr Corneliu ZUZU
2016-06-16 15:16   ` Jan Beulich
2016-06-17  8:25     ` Corneliu ZUZU
2016-06-17  8:38       ` Jan Beulich
2016-06-17 11:31         ` Corneliu ZUZU
2016-06-21  7:08       ` Corneliu ZUZU
2016-06-21  7:20         ` Jan Beulich
2016-06-21 15:22           ` Tamas K Lengyel
2016-06-22  6:33             ` Jan Beulich [this message]
2016-06-16 16:55   ` Tamas K Lengyel
2016-06-17 10:37     ` Corneliu ZUZU
2016-06-16 14:13 ` [PATCH 7/7] vm-event/arm: implement support for control-register write vm-events Corneliu ZUZU
2016-06-16 14:26   ` Julien Grall
2016-06-16 19:24     ` Corneliu ZUZU
2016-06-16 21:28       ` Julien Grall
2016-06-17 11:46         ` Corneliu ZUZU
2016-06-16 16:49   ` Julien Grall
2016-06-17 10:36     ` Corneliu ZUZU
2016-06-17 13:18       ` Julien Grall
2016-06-22 16:35       ` Corneliu ZUZU
2016-06-22 17:17         ` Julien Grall
2016-06-22 18:39           ` Corneliu ZUZU
2016-06-22 19:37             ` Corneliu ZUZU
2016-06-22 19:41               ` Julien Grall
2016-06-23  5:31                 ` Corneliu ZUZU
2016-06-23  5:49                   ` Corneliu ZUZU
2016-06-23 11:11                     ` Julien Grall
2016-06-24  9:32                       ` Corneliu ZUZU
2016-06-23 11:00           ` Julien Grall

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=576A4D3D02000078000F772C@prv-mh.provo.novell.com \
    --to=jbeulich@suse.com \
    --cc=andrew.cooper3@citrix.com \
    --cc=czuzu@bitdefender.com \
    --cc=rcojocaru@bitdefender.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.