Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753439AbbGIMu4 (ORCPT ); Thu, 9 Jul 2015 08:50:56 -0400 Received: from mx1.redhat.com ([209.132.183.28]:39380 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751976AbbGIMus (ORCPT ); Thu, 9 Jul 2015 08:50:48 -0400 Subject: Re: [PATCH] kvm: x86: fix load xsave feature warning To: Wanpeng Li References: Cc: kvm@vger.kernel.org, linux-kernel@vger.kernel.org From: Paolo Bonzini Message-ID: <559E6E23.4050309@redhat.com> Date: Thu, 9 Jul 2015 14:50:43 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.0.1 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 3706 Lines: 66 On 09/07/2015 09:44, Wanpeng Li wrote: > [ 68.196974] WARNING: CPU: 1 PID: 2140 at arch/x86/kvm/x86.c:3161 kvm_arch_vcpu_ioctl+0xe88/0x1340 [kvm]() > [ 68.196975] Modules linked in: snd_hda_codec_hdmi i915 rfcomm bnep bluetooth i2c_algo_bit rfkill nfsd drm_kms_helper nfs_acl nfs drm lockd grace sunrpc fscache snd_hda_codec_realtek snd_hda_codec_generic snd_hda_intel snd_hda_codec snd_hda_core snd_hwdep snd_pcm snd_seq_dummy snd_seq_oss x86_pkg_temp_thermal snd_seq_midi kvm_intel snd_seq_midi_event snd_rawmidi kvm snd_seq ghash_clmulni_intel fuse snd_timer aesni_intel parport_pc ablk_helper snd_seq_device cryptd ppdev snd lp parport lrw dcdbas gf128mul i2c_core glue_helper lpc_ich video shpchp mfd_core soundcore serio_raw acpi_cpufreq ext4 mbcache jbd2 sd_mod crc32c_intel ahci libahci libata e1000e ptp pps_core > [ 68.197005] CPU: 1 PID: 2140 Comm: qemu-system-x86 Not tainted 4.2.0-rc1+ #2 > [ 68.197006] Hardware name: Dell Inc. OptiPlex 7020/0F5C5X, BIOS A03 01/08/2015 > [ 68.197007] ffffffffa03b0657 ffff8800d984bca8 ffffffff815915a2 0000000000000000 > [ 68.197009] 0000000000000000 ffff8800d984bce8 ffffffff81057c0a 00007ff6d0001000 > [ 68.197010] 0000000000000002 ffff880211c1a000 0000000000000004 ffff8800ce0288c0 > [ 68.197012] Call Trace: > [ 68.197017] [] dump_stack+0x45/0x57 > [ 68.197020] [] warn_slowpath_common+0x8a/0xc0 > [ 68.197022] [] warn_slowpath_null+0x1a/0x20 > [ 68.197029] [] kvm_arch_vcpu_ioctl+0xe88/0x1340 [kvm] > [ 68.197035] [] ? kvm_arch_vcpu_load+0x4e/0x1c0 [kvm] > [ 68.197040] [] kvm_vcpu_ioctl+0xc6/0x5c0 [kvm] > [ 68.197043] [] ? perf_pmu_enable+0x22/0x30 > [ 68.197044] [] ? perf_event_context_sched_in+0x7e/0xb0 > [ 68.197048] [] do_vfs_ioctl+0x2c2/0x4a0 > [ 68.197050] [] ? finish_task_switch+0x173/0x220 > [ 68.197053] [] ? selinux_file_ioctl+0x4f/0xd0 > [ 68.197055] [] ? security_file_ioctl+0x43/0x60 > [ 68.197057] [] SyS_ioctl+0x79/0x90 > [ 68.197060] [] entry_SYSCALL_64_fastpath+0x12/0x6a > [ 68.197061] ---[ end trace 558a5ebf9445fc80 ]--- > > After commit (0c4109bec0 'x86/fpu/xstate: Fix up bad get_xsave_addr() > assumptions'), there is no assumption an xsave bit is present in the > hardware (pcntxt_mask) that it is always present in a given xsave buffer. > An enabled state to be present on 'pcntxt_mask', but *not* in 'xstate_bv' > could happen when the last 'xsave' did not request that this feature be > saved (unlikely) or because the "init optimization" caused it to not be > saved. This patch kill the assumption. > > Signed-off-by: Wanpeng Li > --- > Note: This patch against latest linus tree. > > arch/x86/kvm/x86.c | 3 +-- > 1 file changed, 1 insertion(+), 2 deletions(-) > > diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c > index bbaf44e..7125cefe 100644 > --- a/arch/x86/kvm/x86.c > +++ b/arch/x86/kvm/x86.c > @@ -3157,8 +3157,7 @@ static void load_xsave(struct kvm_vcpu *vcpu, u8 *src) > cpuid_count(XSTATE_CPUID, index, > &size, &offset, &ecx, &edx); > memcpy(dest, src + offset, size); > - } else > - WARN_ON_ONCE(1); > + } > > valid -= feature; > } > I'll apply this tomorrow, thanks. Paolo -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/