From patchwork Tue Sep 22 17:56:47 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Borislav Petkov X-Patchwork-Id: 7242291 Return-Path: X-Original-To: patchwork-kvm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 348499F32B for ; Tue, 22 Sep 2015 17:57:00 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 197DB205FD for ; Tue, 22 Sep 2015 17:56:59 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 0F29A205BE for ; Tue, 22 Sep 2015 17:56:58 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1759121AbbIVR4x (ORCPT ); Tue, 22 Sep 2015 13:56:53 -0400 Received: from mail.skyhub.de ([78.46.96.112]:34205 "EHLO mail.skyhub.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1758565AbbIVR4u (ORCPT ); Tue, 22 Sep 2015 13:56:50 -0400 X-Virus-Scanned: Nedap ESD1 at mail.skyhub.de DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alien8.de; s=alien8; t=1442944609; bh=RvNmu/fvF+g+747N/SMRzcx15xCu2dAFJ/DNwzGmsRA=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:In-Reply-To; b=KvU4k7IBSlQMde/sBFshQlIJvLc9USREigSWUI xo8nWEahVZhFxQypcIzLbzR9IiNK5ae2sO+ZKUvw+6+PCTXyumqT/bR2Wa+UO7/p1/d P2OAzB/NbLleyhz8Q3sM1PZolSZvQwJewK9n14Rc1sxiNB77Aeu6EeT4HBB4espz38= Received: from mail.skyhub.de ([127.0.0.1]) by localhost (door.skyhub.de [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id ivM3GoX1acv2; Tue, 22 Sep 2015 19:56:48 +0200 (CEST) Received: from pd.tnic (p5DDC5D8E.dip0.t-ipconnect.de [93.220.93.142]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.skyhub.de (SuperMail on ZX Spectrum 128k) with ESMTPSA id 670D51DA282; Tue, 22 Sep 2015 19:56:48 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alien8.de; s=alien8; t=1442944608; bh=RvNmu/fvF+g+747N/SMRzcx15xCu2dAFJ/DNwzGmsRA=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:In-Reply-To; b=aLKfDxi8pkORuAJrNtkuS/nGZ67++18u9OWVAs RhQpxO2DhgZj3PX/4Q0L6/nh24rZ2B/anCZIcrRw4ZM4P3whW83pNlIQ4gicAdxxZcB 1FpPvch0opd0jTElyntmSaG9zDac4NtqdU+3EE/1Jax7hsHpxm3oNHrKb+EeIS2Mao= Received: by pd.tnic (Postfix, from userid 1000) id E26E31604F6; Tue, 22 Sep 2015 19:56:47 +0200 (CEST) Date: Tue, 22 Sep 2015 19:56:47 +0200 From: Borislav Petkov To: Paolo Bonzini Cc: linux-kernel@vger.kernel.org, kvm@vger.kernel.org Subject: Re: [PATCH] KVM: x86: fix bogus warning about reserved bits Message-ID: <20150922175647.GC3568@pd.tnic> References: <1442910329-3357-1-git-send-email-pbonzini@redhat.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <1442910329-3357-1-git-send-email-pbonzini@redhat.com> User-Agent: Mutt/1.5.23 (2014-03-12) Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org X-Spam-Status: No, score=-6.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,RP_MATCHES_RCVD,T_DKIM_INVALID,UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP On Tue, Sep 22, 2015 at 10:25:29AM +0200, Paolo Bonzini wrote: > 29ecd6601904 ("KVM: x86: avoid uninitialized variable warning", > 2015-09-06) introduced a not-so-subtle problem, which probably > escaped review because it was not part of the patch context. ... > diff --git a/arch/x86/kvm/mmu.c b/arch/x86/kvm/mmu.c > index 69088a1ba509..3ce2b74c75dc 100644 > --- a/arch/x86/kvm/mmu.c > +++ b/arch/x86/kvm/mmu.c > @@ -3322,7 +3322,7 @@ walk_shadow_page_get_mmio_spte(struct kvm_vcpu *vcpu, u64 addr, u64 *sptep) > break; > > reserved |= is_shadow_zero_bits_set(&vcpu->arch.mmu, spte, > - leaf); > + iterator.level); > } > > walk_shadow_page_lockless_end(vcpu); > -- No joy, I still see the splat at the end of this mail when starting a kvm guest. Btw, this is what I have ontop of rc2+tip: --- --- --- [ 49.456533] walk_shadow_page_get_mmio_spte: detect reserved bits on spte, addr 0xb8000, dump hierarchy: [ 49.465945] ------ spte 0x416ed9027 level 4. [ 49.470221] ------ spte 0x416888027 level 3. [ 49.474494] ------ spte 0x41694f027 level 2. [ 49.474495] ------ spte 0xffff0000000b8f67 level 1. [ 49.474496] ------------[ cut here ]------------ [ 49.474515] WARNING: CPU: 4 PID: 3540 at arch/x86/kvm/mmu.c:3385 handle_mmio_page_fault.part.57+0x1a/0x20 [kvm]() [ 49.474555] Modules linked in: tun sha256_ssse3 sha256_generic drbg binfmt_misc ipv6 vfat fat fuse dm_crypt dm_mod kvm_amd kvm crc32_pclmul aesni_intel aes_x86_64 lrw gf128mul glue_helper ablk_helper cryptd amd64_edac_mod fam15h_power k10temp edac_core amdkfd amd_iommu_v2 radeon acpi_cpufreq [ 49.474560] CPU: 4 PID: 3540 Comm: qemu-system-x86 Not tainted 4.3.0-rc2+ #2 [ 49.474562] Hardware name: To be filled by O.E.M. To be filled by O.E.M./M5A97 EVO R2.0, BIOS 1503 01/16/2013 [ 49.474569] ffffffffa032f8b2 ffff880416a73b78 ffffffff812c758a 0000000000000000 [ 49.474574] ffff880416a73bb0 ffffffff810534c1 ffff8804171b0000 000000000000000f [ 49.474578] 00000000000b8000 0000000000000000 00000000ffffffff ffff880416a73bc0 [ 49.474579] Call Trace: [ 49.474586] [] dump_stack+0x4e/0x84 [ 49.474589] [] warn_slowpath_common+0x91/0xd0 [ 49.474592] [] warn_slowpath_null+0x1a/0x20 [ 49.474603] [] handle_mmio_page_fault.part.57+0x1a/0x20 [kvm] [ 49.474615] [] tdp_page_fault+0x2a0/0x2b0 [kvm] [ 49.474620] [] ? __lock_acquire+0x57d/0x17a0 [ 49.474633] [] kvm_mmu_page_fault+0x35/0x240 [kvm] [ 49.474637] [] pf_interception+0x108/0x1d0 [kvm_amd] [ 49.474642] [] handle_exit+0x150/0xa40 [kvm_amd] [ 49.474662] [] ? kvm_arch_vcpu_ioctl_run+0x4c8/0x16f0 [kvm] [ 49.474674] [] kvm_arch_vcpu_ioctl_run+0x533/0x16f0 [kvm] [ 49.474686] [] ? kvm_arch_vcpu_ioctl_run+0x4c8/0x16f0 [kvm] [ 49.474690] [] ? mutex_lock_killable_nested+0x312/0x480 [ 49.474700] [] ? kvm_vcpu_ioctl+0x79/0x6f0 [kvm] [ 49.474705] [] ? preempt_count_sub+0xb3/0x110 [ 49.474715] [] kvm_vcpu_ioctl+0x33f/0x6f0 [kvm] [ 49.474719] [] do_vfs_ioctl+0x2d7/0x530 [ 49.474722] [] ? __fget_light+0x29/0x90 [ 49.474724] [] SyS_ioctl+0x4c/0x90 [ 49.474729] [] entry_SYSCALL_64_fastpath+0x16/0x73 [ 49.474732] ---[ end trace 0e0be3552b84977c ]--- Thanks. diff --git a/arch/x86/kvm/mmu.c b/arch/x86/kvm/mmu.c index 69088a1ba509..3ce2b74c75dc 100644 --- a/arch/x86/kvm/mmu.c +++ b/arch/x86/kvm/mmu.c @@ -3322,7 +3322,7 @@ walk_shadow_page_get_mmio_spte(struct kvm_vcpu *vcpu, u64 addr, u64 *sptep) break; reserved |= is_shadow_zero_bits_set(&vcpu->arch.mmu, spte, - leaf); + iterator.level); } walk_shadow_page_lockless_end(vcpu); diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c index c0b9ff3e1aec..a44f8fed9be1 100644 --- a/arch/x86/kvm/x86.c +++ b/arch/x86/kvm/x86.c @@ -7063,13 +7063,16 @@ struct kvm_vcpu *kvm_arch_vcpu_create(struct kvm *kvm, unsigned int id) { struct kvm_vcpu *vcpu; + int idx; if (check_tsc_unstable() && atomic_read(&kvm->online_vcpus) != 0) printk_once(KERN_WARNING "kvm: SMP vm created on host with unstable TSC; " "guest TSC will not be reliable\n"); + idx = srcu_read_lock(&kvm->srcu); vcpu = kvm_x86_ops->vcpu_create(kvm, id); + srcu_read_unlock(&kvm->srcu, idx); return vcpu; }