From: "Jan Beulich" Subject: Re: [PATCH RFC 3/9] xen: Force-enable relevant MSR events; optimize the number of sent MSR events Date: Wed, 23 Jul 2014 08:56:22 +0100 Message-ID: <53CF86C60200007800024F7D@mail.emea.novell.com> References: <1404308041-15461-1-git-send-email-rcojocaru@bitdefender.com> <1404308041-15461-3-git-send-email-rcojocaru@bitdefender.com> <53B426CE.6070400@citrix.com> <53B444CF020000780001FB22@mail.emea.novell.com> <53BCF6F9.7090405@bitdefender.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <53BCF6F9.7090405@bitdefender.com> Content-Disposition: inline List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: Razvan Cojocaru Cc: Andrew Cooper , tim@xen.org, xen-devel@lists.xen.org List-Id: xen-devel@lists.xenproject.org >>> On 09.07.14 at 10:02, wrote: > On 07/02/2014 06:43 PM, Jan Beulich wrote: >>>>> On 02.07.14 at 17:35, wrote: >>> On 02/07/14 14:33, Razvan Cojocaru wrote: >>>> @@ -700,6 +700,25 @@ void vmx_disable_intercept_for_msr(struct vcpu *v, u32 > msr, int type) >>>> if ( msr_bitmap == NULL ) >>>> return; >>>> >>>> + /* Filter out MSR-s needed by the memory introspection engine */ >>>> + switch ( msr ) >>>> + { >>>> + case MSR_IA32_SYSENTER_EIP: >>>> + case MSR_IA32_SYSENTER_ESP: >>>> + case MSR_IA32_SYSENTER_CS: >>>> + case MSR_IA32_MC0_CTL: >>>> + case MSR_STAR: >>>> + case MSR_LSTAR: >>>> + >>> >>> Given the performance implications of forcing interception of these >>> MSRs, it would be gated on mem_access being active for the domain. >> >> Absolutely. > > Unfortunately the call to vmx_disable_intercept_for_msr() happens _very_ > early, and by the time our application gets to enable mem_access on the > domain, the interception for these MSRs has already been disabled, with > unacceptable consequences. > > I've tested this with an "if ( > mem_event_check_ring(&d->mem_event->access) )" test. > > Also, ideally we'd like to be able to start monitoring an already > started domain, and in that case the mem_access test would be useless > even considering a workaround for the case above. All understood, but not penalizing non-monitored VMs has certainly higher priority. Jan