From: Razvan Cojocaru <rcojocaru@bitdefender.com>
To: Tamas K Lengyel <tlengyel@novetta.com>, xen-devel@lists.xen.org
Cc: kevin.tian@intel.com, wei.liu2@citrix.com,
ian.campbell@citrix.com, stefano.stabellini@eu.citrix.com,
ian.jackson@eu.citrix.com, eddie.dong@intel.com,
jbeulich@suse.com, jun.nakajima@intel.com,
andrew.cooper3@citrix.com, keir@xen.org
Subject: Re: [PATCH v4 3/3] x86/monitor: don't use hvm_funcs directly
Date: Thu, 9 Jul 2015 09:15:01 +0300 [thread overview]
Message-ID: <559E1165.7080002@bitdefender.com> (raw)
In-Reply-To: <1436395978-11048-3-git-send-email-tlengyel@novetta.com>
On 07/09/2015 01:52 AM, Tamas K Lengyel wrote:
> A couple spots in x86/monitor used hvm_funcs directly. This patch adds an extra
> wrapper for enable_msr_exit_interception and changes monitor.c to use only the
> wrappers.
>
> Signed-off-by: Tamas K Lengyel <tlengyel@novetta.com>
> ---
> xen/arch/x86/monitor.c | 7 ++-----
> xen/include/asm-x86/hvm/hvm.h | 11 +++++++++++
> 2 files changed, 13 insertions(+), 5 deletions(-)
>
> diff --git a/xen/arch/x86/monitor.c b/xen/arch/x86/monitor.c
> index 590a45d..44efcd0 100644
> --- a/xen/arch/x86/monitor.c
> +++ b/xen/arch/x86/monitor.c
> @@ -130,7 +130,7 @@ int monitor_domctl(struct domain *d, struct xen_domctl_monitor_op *mop)
> if ( mop->u.mov_to_cr.index == VM_EVENT_X86_CR3 )
> /* Latches new CR3 mask through CR0 code */
> for_each_vcpu ( d, v )
> - hvm_funcs.update_guest_cr(v, 0);
> + hvm_update_guest_cr(v, 0);
>
> break;
> }
> @@ -146,11 +146,8 @@ int monitor_domctl(struct domain *d, struct xen_domctl_monitor_op *mop)
> if ( mop->op == XEN_DOMCTL_MONITOR_OP_ENABLE &&
> mop->u.mov_to_msr.extended_capture )
> {
> - if ( hvm_funcs.enable_msr_exit_interception )
> - {
> + if ( hvm_enable_msr_exit_interception(d) == 0 )
> ad->monitor.mov_to_msr_extended = 1;
> - hvm_funcs.enable_msr_exit_interception(d);
I don't feel very strongly about it, so if you really prefer you can
keep the code as it is, however this looks somewhat counterintuitive to
me, especially when you compare the new condition to the old one, because
...
> - }
> else
> return -EOPNOTSUPP;
> } else
> diff --git a/xen/include/asm-x86/hvm/hvm.h b/xen/include/asm-x86/hvm/hvm.h
> index aa8ab8d..9128dff 100644
> --- a/xen/include/asm-x86/hvm/hvm.h
> +++ b/xen/include/asm-x86/hvm/hvm.h
> @@ -514,6 +514,17 @@ static inline enum hvm_intblk nhvm_interrupt_blocked(struct vcpu *v)
> return hvm_funcs.nhvm_intr_blocked(v);
> }
>
> +static inline int hvm_enable_msr_exit_interception(struct domain *d)
> +{
> + if ( hvm_funcs.enable_msr_exit_interception )
> + {
> + hvm_funcs.enable_msr_exit_interception(d);
> + return 0;
> + }
> +
> + return -ENOSYS;
> +}
> +
... I can see no reason why this function should not return bool_t, and
return 1 where it now returns 0, and 0 where it now returns -ENOSYS. But
perhaps you're anticipating future uses I don't see now, or somebody
else has a different opinion.
Cheers,
Razvan
next prev parent reply other threads:[~2015-07-09 6:15 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-07-08 22:52 [PATCH v4 1/3] x86/monitor: add get_capabilities to monitor_op domctl Tamas K Lengyel
2015-07-08 22:52 ` [PATCH v4 2/3] x86/vm_event: toggle singlestep from vm_event response Tamas K Lengyel
2015-07-08 22:52 ` [PATCH v4 3/3] x86/monitor: don't use hvm_funcs directly Tamas K Lengyel
2015-07-09 6:15 ` Razvan Cojocaru [this message]
2015-07-09 8:15 ` Jan Beulich
2015-07-09 12:50 ` Lengyel, Tamas
2015-07-09 12:52 ` Lengyel, Tamas
2015-07-09 12:55 ` Razvan Cojocaru
2015-07-09 9:05 ` [PATCH v4 1/3] x86/monitor: add get_capabilities to monitor_op domctl Ian Campbell
2015-07-09 12:37 ` Lengyel, Tamas
2015-07-09 13:00 ` Razvan Cojocaru
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=559E1165.7080002@bitdefender.com \
--to=rcojocaru@bitdefender.com \
--cc=andrew.cooper3@citrix.com \
--cc=eddie.dong@intel.com \
--cc=ian.campbell@citrix.com \
--cc=ian.jackson@eu.citrix.com \
--cc=jbeulich@suse.com \
--cc=jun.nakajima@intel.com \
--cc=keir@xen.org \
--cc=kevin.tian@intel.com \
--cc=stefano.stabellini@eu.citrix.com \
--cc=tlengyel@novetta.com \
--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 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.