From mboxrd@z Thu Jan 1 00:00:00 1970 From: Andre Przywara Subject: tainted Linux kernel in default SMP QEMU/KVM guests Date: Fri, 19 Mar 2010 13:16:06 +0100 Message-ID: <4BA36B06.5060002@amd.com> Mime-Version: 1.0 Content-Type: text/plain; charset="ISO-8859-1"; format=flowed Content-Transfer-Encoding: 7bit To: QEMU devel , KVM list Return-path: Received: from va3ehsobe003.messaging.microsoft.com ([216.32.180.13]:29190 "EHLO VA3EHSOBE003.bigfish.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751099Ab0CSMQr (ORCPT ); Fri, 19 Mar 2010 08:16:47 -0400 Sender: kvm-owner@vger.kernel.org List-ID: Hi, since the default CPU model for QEMU (qemu64) is an AMD K7, the Linux kernel complains and taints the kernel when it detects multiple processors. The reason for this is a check for SMP safe CPUs in arch/x86/kernel/cpu/amd.c:amd_k7_smp_check(). In recent kernels (since about 2.6.29) this in only executed in 32bit kernels, since the check has been #ifdef'ed CONFIG_X86_32. The failing check triggers a nasty dump along with a call trace and taints the kernel, this confuses users, so I want to get rid of it. One can work around it (using -cpu kvm64 or -cpu host), but I want to avoid it in the default case, too. I see these possible solutions: 1) Change the default CPUID bits from 6/2/3 to 6/6/1, this passes the Linux kernel check. But I am not sure if that would introduce regressions, since some OSes apply quirks if they detect certain models (like we had with the sysenter issue in the past) 2) Only change the CPUID bits to 6/6/1 if we use SMP. Still has the above drawback, but would be limited to SMP guests only. 3) Set kvm64/kvm32 as the default CPU model if KVM is enabled. This would limit the report and taint to TCG, where SMP is rarely used. Additionally less people (if any) use it for production systems. 4) Make the Linux' kernel quirk dependent on the missing hypervisor bit. I don't think this will be accepted easily upstream (and I don't want to support Ingo's recent ideas ;-), also this would not fix older kernels. I can easily provide patches for all solutions, but I'd like to get advice from people on which one to pursue. Regards, Andre. -- Andre Przywara AMD-Operating System Research Center (OSRC), Dresden, Germany Tel: +49 351 448-3567-12 From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1Nsb8D-0006q6-BQ for qemu-devel@nongnu.org; Fri, 19 Mar 2010 08:16:49 -0400 Received: from [199.232.76.173] (port=55794 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Nsb8C-0006pa-Hp for qemu-devel@nongnu.org; Fri, 19 Mar 2010 08:16:48 -0400 Received: from Debian-exim by monty-python.gnu.org with spam-scanned (Exim 4.60) (envelope-from ) id 1Nsb8A-0005mA-LY for qemu-devel@nongnu.org; Fri, 19 Mar 2010 08:16:48 -0400 Received: from va3ehsobe003.messaging.microsoft.com ([216.32.180.13]:29187 helo=VA3EHSOBE003.bigfish.com) by monty-python.gnu.org with esmtps (TLS-1.0:RSA_ARCFOUR_MD5:16) (Exim 4.60) (envelope-from ) id 1Nsb8A-0005m4-Cv for qemu-devel@nongnu.org; Fri, 19 Mar 2010 08:16:46 -0400 Message-ID: <4BA36B06.5060002@amd.com> Date: Fri, 19 Mar 2010 13:16:06 +0100 From: Andre Przywara MIME-Version: 1.0 Content-Type: text/plain; charset="ISO-8859-1"; format=flowed Content-Transfer-Encoding: 7bit Subject: [Qemu-devel] tainted Linux kernel in default SMP QEMU/KVM guests List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: QEMU devel , KVM list Hi, since the default CPU model for QEMU (qemu64) is an AMD K7, the Linux kernel complains and taints the kernel when it detects multiple processors. The reason for this is a check for SMP safe CPUs in arch/x86/kernel/cpu/amd.c:amd_k7_smp_check(). In recent kernels (since about 2.6.29) this in only executed in 32bit kernels, since the check has been #ifdef'ed CONFIG_X86_32. The failing check triggers a nasty dump along with a call trace and taints the kernel, this confuses users, so I want to get rid of it. One can work around it (using -cpu kvm64 or -cpu host), but I want to avoid it in the default case, too. I see these possible solutions: 1) Change the default CPUID bits from 6/2/3 to 6/6/1, this passes the Linux kernel check. But I am not sure if that would introduce regressions, since some OSes apply quirks if they detect certain models (like we had with the sysenter issue in the past) 2) Only change the CPUID bits to 6/6/1 if we use SMP. Still has the above drawback, but would be limited to SMP guests only. 3) Set kvm64/kvm32 as the default CPU model if KVM is enabled. This would limit the report and taint to TCG, where SMP is rarely used. Additionally less people (if any) use it for production systems. 4) Make the Linux' kernel quirk dependent on the missing hypervisor bit. I don't think this will be accepted easily upstream (and I don't want to support Ingo's recent ideas ;-), also this would not fix older kernels. I can easily provide patches for all solutions, but I'd like to get advice from people on which one to pursue. Regards, Andre. -- Andre Przywara AMD-Operating System Research Center (OSRC), Dresden, Germany Tel: +49 351 448-3567-12