From mboxrd@z Thu Jan 1 00:00:00 1970 From: Andrew Cooper Subject: Re: [PATCH] x86/HVM: replace open-coded non-local cache flushing Date: Fri, 25 Apr 2014 11:55:31 +0100 Message-ID: <535A3F23.6050802@citrix.com> References: <535A5A5C020000780000C400@nat28.tlf.novell.com> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="===============0346867134740535537==" Return-path: Received: from mail6.bemta14.messagelabs.com ([193.109.254.103]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1Wddn6-0003gl-Sd for xen-devel@lists.xenproject.org; Fri, 25 Apr 2014 10:55:37 +0000 In-Reply-To: <535A5A5C020000780000C400@nat28.tlf.novell.com> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: Jan Beulich Cc: Kevin Tian , Keir Fraser , suravee.suthikulpanit@amd.com, Eddie Dong , Jun Nakajima , xen-devel , Boris Ostrovsky List-Id: xen-devel@lists.xenproject.org --===============0346867134740535537== Content-Type: multipart/alternative; boundary="------------010705000709050201040008" --------------010705000709050201040008 Content-Type: text/plain; charset="ISO-8859-1" Content-Transfer-Encoding: 7bit On 25/04/14 11:51, Jan Beulich wrote: > We accumulated quite a number of these, despite having a pre-canned > interface for it. > > Signed-off-by: Jan Beulich Reviewed-by: Andrew Cooper > > --- a/xen/arch/x86/hvm/hvm.c > +++ b/xen/arch/x86/hvm/hvm.c > @@ -1823,11 +1823,6 @@ static bool_t domain_exit_uc_mode(struct > return 1; > } > > -static void local_flush_cache(void *info) > -{ > - wbinvd(); > -} > - > static void hvm_set_uc_mode(struct vcpu *v, bool_t is_in_uc_mode) > { > v->domain->arch.hvm_domain.is_in_uc_mode = is_in_uc_mode; > @@ -1927,7 +1922,7 @@ void hvm_shadow_handle_cd(struct vcpu *v > domain_pause_nosync(v->domain); > > /* Flush physical caches. */ > - on_each_cpu(local_flush_cache, NULL, 1); > + flush_all(FLUSH_CACHE); > hvm_set_uc_mode(v, 1); > > domain_unpause(v->domain); > --- a/xen/arch/x86/hvm/svm/svm.c > +++ b/xen/arch/x86/hvm/svm/svm.c > @@ -2106,15 +2106,10 @@ static void svm_vmexit_mce_intercept( > } > } > > -static void wbinvd_ipi(void *info) > -{ > - wbinvd(); > -} > - > static void svm_wbinvd_intercept(void) > { > if ( cache_flush_permitted(current->domain) ) > - on_each_cpu(wbinvd_ipi, NULL, 1); > + flush_all(FLUSH_CACHE); > } > > static void svm_vmexit_do_invalidate_cache(struct cpu_user_regs *regs) > --- a/xen/arch/x86/hvm/vmx/vmcs.c > +++ b/xen/arch/x86/hvm/vmx/vmcs.c > @@ -1301,11 +1301,6 @@ void vm_resume_fail(void) > domain_crash_synchronous(); > } > > -static void wbinvd_ipi(void *info) > -{ > - wbinvd(); > -} > - > void vmx_do_resume(struct vcpu *v) > { > bool_t debug_state; > @@ -1332,7 +1327,7 @@ void vmx_do_resume(struct vcpu *v) > { > int cpu = v->arch.hvm_vmx.active_cpu; > if ( cpu != -1 ) > - on_selected_cpus(cpumask_of(cpu), wbinvd_ipi, NULL, 1); > + flush_mask(cpumask_of(cpu), FLUSH_CACHE); > } > > vmx_clear_vmcs(v); > --- a/xen/arch/x86/hvm/vmx/vmx.c > +++ b/xen/arch/x86/hvm/vmx/vmx.c > @@ -2307,18 +2307,13 @@ static void vmx_do_extint(struct cpu_use > do_IRQ(regs); > } > > -static void wbinvd_ipi(void *info) > -{ > - wbinvd(); > -} > - > static void vmx_wbinvd_intercept(void) > { > if ( !cache_flush_permitted(current->domain) || iommu_snoop ) > return; > > if ( cpu_has_wbinvd_exiting ) > - on_each_cpu(wbinvd_ipi, NULL, 1); > + flush_all(FLUSH_CACHE); > else > wbinvd(); > } > > > > > > _______________________________________________ > Xen-devel mailing list > Xen-devel@lists.xen.org > http://lists.xen.org/xen-devel --------------010705000709050201040008 Content-Type: text/html; charset="ISO-8859-1" Content-Transfer-Encoding: 7bit
On 25/04/14 11:51, Jan Beulich wrote:
We accumulated quite a number of these, despite having a pre-canned
interface for it.

Signed-off-by: Jan Beulich <jbeulich@suse.com>

Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>


--- a/xen/arch/x86/hvm/hvm.c
+++ b/xen/arch/x86/hvm/hvm.c
@@ -1823,11 +1823,6 @@ static bool_t domain_exit_uc_mode(struct
     return 1;
 }
 
-static void local_flush_cache(void *info)
-{
-    wbinvd();
-}
-
 static void hvm_set_uc_mode(struct vcpu *v, bool_t is_in_uc_mode)
 {
     v->domain->arch.hvm_domain.is_in_uc_mode = is_in_uc_mode;
@@ -1927,7 +1922,7 @@ void hvm_shadow_handle_cd(struct vcpu *v
             domain_pause_nosync(v->domain);
 
             /* Flush physical caches. */
-            on_each_cpu(local_flush_cache, NULL, 1);
+            flush_all(FLUSH_CACHE);
             hvm_set_uc_mode(v, 1);
 
             domain_unpause(v->domain);
--- a/xen/arch/x86/hvm/svm/svm.c
+++ b/xen/arch/x86/hvm/svm/svm.c
@@ -2106,15 +2106,10 @@ static void svm_vmexit_mce_intercept(
     }
 }
 
-static void wbinvd_ipi(void *info)
-{
-    wbinvd();
-}
-
 static void svm_wbinvd_intercept(void)
 {
     if ( cache_flush_permitted(current->domain) )
-        on_each_cpu(wbinvd_ipi, NULL, 1);
+        flush_all(FLUSH_CACHE);
 }
 
 static void svm_vmexit_do_invalidate_cache(struct cpu_user_regs *regs)
--- a/xen/arch/x86/hvm/vmx/vmcs.c
+++ b/xen/arch/x86/hvm/vmx/vmcs.c
@@ -1301,11 +1301,6 @@ void vm_resume_fail(void)
     domain_crash_synchronous();
 }
 
-static void wbinvd_ipi(void *info)
-{
-    wbinvd();
-}
-
 void vmx_do_resume(struct vcpu *v)
 {
     bool_t debug_state;
@@ -1332,7 +1327,7 @@ void vmx_do_resume(struct vcpu *v)
         {
             int cpu = v->arch.hvm_vmx.active_cpu;
             if ( cpu != -1 )
-                on_selected_cpus(cpumask_of(cpu), wbinvd_ipi, NULL, 1);
+                flush_mask(cpumask_of(cpu), FLUSH_CACHE);
         }
 
         vmx_clear_vmcs(v);
--- a/xen/arch/x86/hvm/vmx/vmx.c
+++ b/xen/arch/x86/hvm/vmx/vmx.c
@@ -2307,18 +2307,13 @@ static void vmx_do_extint(struct cpu_use
     do_IRQ(regs);
 }
 
-static void wbinvd_ipi(void *info)
-{
-    wbinvd();
-}
-
 static void vmx_wbinvd_intercept(void)
 {
     if ( !cache_flush_permitted(current->domain) || iommu_snoop )
         return;
 
     if ( cpu_has_wbinvd_exiting )
-        on_each_cpu(wbinvd_ipi, NULL, 1);
+        flush_all(FLUSH_CACHE);
     else
         wbinvd();
 }





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

--------------010705000709050201040008-- --===============0346867134740535537== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ Xen-devel mailing list Xen-devel@lists.xen.org http://lists.xen.org/xen-devel --===============0346867134740535537==--