All of lore.kernel.org
 help / color / mirror / Atom feed
From: Corneliu ZUZU <czuzu@bitdefender.com>
To: "Tian, Kevin" <kevin.tian@intel.com>,
	"xen-devel@lists.xen.org" <xen-devel@lists.xen.org>
Cc: Andrew Cooper <andrew.cooper3@citrix.com>,
	Jan Beulich <jbeulich@suse.com>,
	Tamas K Lengyel <tamas@tklengyel.com>,
	Razvan Cojocaru <rcojocaru@bitdefender.com>,
	"Nakajima, Jun" <jun.nakajima@intel.com>
Subject: Re: [PATCH 05/16] x86/monitor: relocate code more appropriately
Date: Fri, 15 Jul 2016 14:41:40 +0300	[thread overview]
Message-ID: <e3df1498-bd88-d446-7887-8b4d2bc1f7cf@bitdefender.com> (raw)
In-Reply-To: <00126a1b-4664-80fe-7c7e-58a539e10071@bitdefender.com>

On 7/12/2016 11:07 AM, Corneliu ZUZU wrote:
> On 7/12/2016 10:45 AM, Tian, Kevin wrote:
>>> From: Corneliu ZUZU [mailto:czuzu@bitdefender.com]
>>> Sent: Monday, July 11, 2016 2:19 PM
>>>> +static inline
>>>> +void monitor_ctrlreg_adjust_traps(struct domain *d, unsigned int 
>>>> index)
>>>> +{
>>>> +    /* For now, VMX only. */
>>>> +    ASSERT(cpu_has_vmx);
>>>> +
>>>> +    /* Other CRs than CR3 are always trapped. */
>>>> +    if ( VM_EVENT_X86_CR3 == index )
>>>> +        vmx_vm_event_update_cr3_traps(d);
>>>       [Kevin wrote]:
>>>
>>>     Please add above into a hvm function instead of directly calling
>>>     vmx in common file. (other arch can have it unimplemented).
>>>     Then you don't need change this common code again later when
>>>     other archs are added
>>>
>>> ---
>>>
>>>
>>> This is not common code, it's in arch/x86/monitor.c (?) and currently,
>>> as the above ASSERT indicates, only VMX is supported. If in the future
>>> support for SVM for example will be added, then the hvm move you 
>>> suggest
>>> must be done (Jan also suggested this).
>>> Or, I only now realize, if you guys prefer doing this now I could add a
>>> vm_event_update_cr3_traps field in hvm_function_table, but BUG() in the
>>> SVM one..
>>>
>> The latter is desired. Instead of BUG, it makes more sense to return
>> error on an arch which doesn't register the callback.
>>
>> Thanks
>> Kevin
>
> Will do.
>
> Thanks,
> Zuzu C.

I've decided to discard separating CR3 load-exiting handling (i.e. 
discard vmx_vm_event_update_cr3_traps) entirely since I find that it's 
complicated to have to handle the bit from 2 different places 
(vmx_update_guest_cr and arch_monitor_domctl_event).

Normally such a situation is resolved by counting the number of 
subscribers to the resource (in this case counting the number of 
'entities' that want to CR3 load-exiting enabled - i.e. just as we have 
a vCPU pause_count to count entities that want the vCPU to be paused), 
but it's just a single bit of a lot more and I don't think the overhead 
is worth.

Let me know if you disagree and I'm open to suggestions, if you guys 
have any.

Thanks,
Corneliu.

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

  reply	other threads:[~2016-07-15 11:41 UTC|newest]

Thread overview: 54+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-07-09  4:11 [PATCH 00/16] x86/vm-event: numerous adjustments & fixes Corneliu ZUZU
2016-07-09  4:12 ` [PATCH 01/16] x86/vmx_update_guest_cr: minor optimization Corneliu ZUZU
2016-07-11  6:24   ` Corneliu ZUZU
2016-07-09  4:12 ` [PATCH 02/16] x86: fix: make atomic_read() param const Corneliu ZUZU
2016-07-11 15:18   ` Andrew Cooper
2016-07-12  5:11     ` Corneliu ZUZU
2016-07-12  9:42       ` Andrew Cooper
2016-07-12 10:11         ` Corneliu ZUZU
2016-07-12 10:22           ` Andrew Cooper
2016-07-12 10:35             ` Corneliu ZUZU
2016-07-12 10:38             ` Corneliu ZUZU
2016-07-12 12:49               ` Andrew Cooper
2016-07-12 13:45                 ` Corneliu ZUZU
2016-07-09  4:13 ` [PATCH 03/16] x86/monitor: mechanical renames Corneliu ZUZU
2016-07-09 18:10   ` Tamas K Lengyel
2016-07-09 18:46     ` Corneliu ZUZU
2016-07-11 16:43       ` Tamas K Lengyel
2016-07-12  6:10         ` Corneliu ZUZU
2016-07-15  7:18           ` Corneliu ZUZU
2016-07-18 18:07             ` Andrew Cooper
2016-07-19  9:36               ` Corneliu ZUZU
2016-07-09  4:14 ` [PATCH 04/16] x86/monitor: relocate vm_event_register_write_resume() function to monitor code Corneliu ZUZU
2016-07-09 18:14   ` Tamas K Lengyel
2016-07-09 18:47     ` Corneliu ZUZU
2016-07-09  4:15 ` [PATCH 05/16] x86/monitor: relocate code more appropriately Corneliu ZUZU
2016-07-11  6:19   ` Corneliu ZUZU
2016-07-12  7:45     ` Tian, Kevin
2016-07-12  8:07       ` Corneliu ZUZU
2016-07-15 11:41         ` Corneliu ZUZU [this message]
2016-07-09  4:15 ` [PATCH 06/16] x86/monitor: fix: set msr_bitmap to NULL after xfree Corneliu ZUZU
2016-07-09  4:16 ` [PATCH 07/16] x86/vm-event: fix: call cleanup when init fails, to free partial allocs Corneliu ZUZU
2016-07-09  4:17 ` [PATCH 08/16] x86/vm-event: call monitor init & cleanup funcs from respective vm_event funcs Corneliu ZUZU
2016-07-09  4:18 ` [PATCH 09/16] arm/monitor: move d->monitor cleanup to monitor_cleanup_domain() Corneliu ZUZU
2016-07-09  4:19 ` [PATCH 10/16] x86/vm-event: centralize vcpu-destroy cleanup in vm-events code Corneliu ZUZU
2016-07-09  4:20 ` [PATCH 11/16] x86/monitor: fix: treat -monitor- properly, as a subsys of the vm-event subsys Corneliu ZUZU
2016-07-09 17:34   ` Tamas K Lengyel
2016-07-09 17:46     ` Corneliu ZUZU
2016-07-11 16:38       ` Tamas K Lengyel
2016-07-11 20:20         ` Corneliu ZUZU
2016-07-11 21:27           ` Tamas K Lengyel
2016-07-11 21:47             ` Corneliu ZUZU
2016-07-09  4:20 ` [PATCH 12/16] x86/vm-event: fix: move cleanup of mem_access_emulate_each_rep to monitor stub Corneliu ZUZU
2016-07-09  4:21 ` [PATCH 13/16] x86/monitor: introduce writes_pending field in monitor_write_data Corneliu ZUZU
2016-07-09  4:22 ` [PATCH 14/16] x86/monitor: clarify separation between monitor subsys and vm-event as a whole Corneliu ZUZU
2016-07-09 18:26   ` Tamas K Lengyel
2016-07-09 18:57     ` Corneliu ZUZU
2016-07-13  4:26       ` Corneliu ZUZU
2016-07-13 18:56         ` Tamas K Lengyel
2016-07-09  4:23 ` [PATCH 15/16] x86/monitor: fix: don't compromise a monitor_write_data with pending CR writes Corneliu ZUZU
2016-07-09  4:23 ` [PATCH 16/16] x86/monitor: fix: xc_monitor _write_ctrlreg w/o previous _enable must fail Corneliu ZUZU
2016-07-09  4:34   ` Corneliu ZUZU
2016-07-11  2:54 ` [PATCH 00/16] x86/vm-event: numerous adjustments & fixes Tian, Kevin
2016-07-11  5:32   ` Corneliu ZUZU
2016-07-12  7:42     ` Tian, Kevin

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=e3df1498-bd88-d446-7887-8b4d2bc1f7cf@bitdefender.com \
    --to=czuzu@bitdefender.com \
    --cc=andrew.cooper3@citrix.com \
    --cc=jbeulich@suse.com \
    --cc=jun.nakajima@intel.com \
    --cc=kevin.tian@intel.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.