From owner-svn-src-stable@FreeBSD.ORG Fri Aug 27 18:55:24 2010 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id A925F1065695; Fri, 27 Aug 2010 18:55:24 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 9740A8FC1C; Fri, 27 Aug 2010 18:55:24 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o7RItOWA003932; Fri, 27 Aug 2010 18:55:24 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o7RItOYk003928; Fri, 27 Aug 2010 18:55:24 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <201008271855.o7RItOYk003928@svn.freebsd.org> From: John Baldwin Date: Fri, 27 Aug 2010 18:55:24 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r211891 - in stable/8/sys: amd64/amd64 i386/i386 kern X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 27 Aug 2010 18:55:24 -0000 Author: jhb Date: Fri Aug 27 18:55:24 2010 New Revision: 211891 URL: http://svn.freebsd.org/changeset/base/211891 Log: MFC 210774,210935: - Tweak the logic to disable CLFLUSH in virtual environments to work around problems with flushing the local APIC register range so that it checks vm_guest directly. - Add Xen to the list of virtual vendors. In the non PV (HVM) case this fixes the virtualization detection successfully disabling the CLFLUSH instruction. Modified: stable/8/sys/amd64/amd64/initcpu.c stable/8/sys/i386/i386/initcpu.c stable/8/sys/kern/subr_param.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) stable/8/sys/dev/xen/xenpci/ (props changed) Modified: stable/8/sys/amd64/amd64/initcpu.c ============================================================================== --- stable/8/sys/amd64/amd64/initcpu.c Fri Aug 27 18:50:32 2010 (r211890) +++ stable/8/sys/amd64/amd64/initcpu.c Fri Aug 27 18:55:24 2010 (r211891) @@ -177,17 +177,17 @@ initializecpucache() if ((cpu_feature & CPUID_CLFSH) != 0) cpu_clflush_line_size = ((cpu_procinfo >> 8) & 0xff) * 8; /* - * XXXKIB: (temporary) hack to work around traps generated when - * CLFLUSHing APIC registers window. + * XXXKIB: (temporary) hack to work around traps generated + * when CLFLUSHing APIC register window under virtualization + * environments. These environments tend to disable the + * CPUID_SS feature even though the native CPU supports it. */ TUNABLE_INT_FETCH("hw.clflush_disable", &hw_clflush_disable); - if (cpu_vendor_id == CPU_VENDOR_INTEL && !(cpu_feature & CPUID_SS) && - hw_clflush_disable == -1) + if (vm_guest != VM_GUEST_NO && hw_clflush_disable == -1) cpu_feature &= ~CPUID_CLFSH; /* * Allow to disable CLFLUSH feature manually by - * hw.clflush_disable tunable. This may help Xen guest on some AMD - * CPUs. + * hw.clflush_disable tunable. */ if (hw_clflush_disable == 1) cpu_feature &= ~CPUID_CLFSH; Modified: stable/8/sys/i386/i386/initcpu.c ============================================================================== --- stable/8/sys/i386/i386/initcpu.c Fri Aug 27 18:50:32 2010 (r211890) +++ stable/8/sys/i386/i386/initcpu.c Fri Aug 27 18:55:24 2010 (r211891) @@ -724,17 +724,17 @@ initializecpu(void) if ((cpu_feature & CPUID_CLFSH) != 0) cpu_clflush_line_size = ((cpu_procinfo >> 8) & 0xff) * 8; /* - * XXXKIB: (temporary) hack to work around traps generated when - * CLFLUSHing APIC registers window. + * XXXKIB: (temporary) hack to work around traps generated + * when CLFLUSHing APIC register window under virtualization + * environments. These environments tend to disable the + * CPUID_SS feature even though the native CPU supports it. */ TUNABLE_INT_FETCH("hw.clflush_disable", &hw_clflush_disable); - if (cpu_vendor_id == CPU_VENDOR_INTEL && !(cpu_feature & CPUID_SS) && - hw_clflush_disable == -1) + if (vm_guest != VM_GUEST_NO && hw_clflush_disable == -1) cpu_feature &= ~CPUID_CLFSH; /* * Allow to disable CLFLUSH feature manually by - * hw.clflush_disable tunable. This may help Xen guest on some AMD - * CPUs. + * hw.clflush_disable tunable. */ if (hw_clflush_disable == 1) cpu_feature &= ~CPUID_CLFSH; Modified: stable/8/sys/kern/subr_param.c ============================================================================== --- stable/8/sys/kern/subr_param.c Fri Aug 27 18:50:32 2010 (r211890) +++ stable/8/sys/kern/subr_param.c Fri Aug 27 18:55:24 2010 (r211891) @@ -149,6 +149,7 @@ static const char *const vm_bnames[] = { "QEMU", /* QEMU */ "Plex86", /* Plex86 */ "Bochs", /* Bochs */ + "Xen", /* Xen */ NULL };