Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1216976
| Path | csiph.com!goblin3!goblin2!goblin.stu.neva.ru!gothmog.csi.it!bofh.it!news.nic.it!robomod |
|---|---|
| From | Paolo Bonzini <pbonzini@redhat.com> |
| Newsgroups | linux.kernel |
| Subject | Re: [GIT PULL] Early batch of KVM changes for 4.3 merge window |
| Date | Tue, 01 Sep 2015 19:10:02 +0200 |
| Message-ID | <q3Xei-4mR-13@gated-at.bofh.it> (permalink) |
| References | <pXx3c-rb-5@gated-at.bofh.it> <q3HVU-7oG-9@gated-at.bofh.it> |
| X-Original-To | Linus Torvalds <torvalds@linux-foundation.org>, Xiao Guangrong <guangrong.xiao@linux.intel.com> |
| Dkim-Signature | v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:subject:to:references:cc:from:message-id:date:user-agent :mime-version:in-reply-to:content-type:content-transfer-encoding; bh=CDkIzN7KeXfOr+BrexPWJaIzfmatWwHSAWMiJsCfzfM=; b=fz9ZTvUj4BgXsCCX6kDi39rCK7ULn/ly2/9q7GXnABmCYzJo/oxykJ+M2HXDenq+GH p+3oTe1AJkC8+qmN1ZrBRCWPolTaNWaPVJt7+OSxNhBfmdOjn1we+fYLpsyKaafj4pP4 RLg6mOB2KLEUdS8aSKvSOd6hD8WaPrOPwTyem5BoDbFCQ5SnBmrKm0zLeFZoV89UYPdx 64njJNTMK/Wx03xf/s3MEw46xHj8CD70cgiCFpUV5KUCM9DFtaE8SQCGQe58ZjjT+lZP e5+G1paRU/8mRg7w2oAKg5zKuExhjkUG6SE9AzDbWSVbX/M7axPrBhLlBn7ZzyqNaaTG qOpA== |
| X-Received | by 10.180.83.40 with SMTP id n8mr4670296wiy.14.1441127035090; Tue, 01 Sep 2015 10:03:55 -0700 (PDT) |
| X-Enigmail-Draft-Status | N1110 |
| User-Agent | Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.1.0 |
| MIME-Version | 1.0 |
| Content-Type | text/plain; charset=utf-8 |
| Content-Transfer-Encoding | 8bit |
| Sender | robomod@news.nic.it |
| List-ID | <linux-kernel.vger.kernel.org> |
| X-Mailing-List | linux-kernel@vger.kernel.org |
| Approved | robomod@news.nic.it |
| Lines | 75 |
| Organization | linux.* mail to news gateway |
| X-Original-Cc | Linux Kernel Mailing List <linux-kernel@vger.kernel.org>, Gleb Natapov <gleb@kernel.org>, KVM list <kvm@vger.kernel.org> |
| X-Original-Date | Tue, 1 Sep 2015 19:03:56 +0200 |
| X-Original-Message-ID | <55E5DA7C.60605@redhat.com> |
| X-Original-References | <1439596650-7237-1-git-send-email-pbonzini@redhat.com> <CA+55aFwddHp40vMAeLgXZsKLyxexnzD67dRAW7GtQTOVRvYKug@mail.gmail.com> |
| X-Original-Sender | linux-kernel-owner@vger.kernel.org |
| Xref | csiph.com linux.kernel:1216976 |
Show key headers only | View raw
On 01/09/2015 02:47, Linus Torvalds wrote:
> Hmm:
>
> On Fri, Aug 14, 2015 at 4:57 PM, Paolo Bonzini <pbonzini@redhat.com> wrote:
>>
>> Xiao Guangrong (9):
>> KVM: MMU: fully check zero bits for sptes
>
> The above commit causes an annoying new compiler warning.
>
> The warning is bogus ("variable 'leaf' possibly uninitialized"),
> because the use of the variable is protected by the 'bool reserved'
> flag, but gcc is apparently not smart enough to understand that.
Unfortunately it doesn't reproduce on all compiler versions.
Something like this should do it:
diff --git a/arch/x86/kvm/mmu.c b/arch/x86/kvm/mmu.c
index fb16a8ea3dee..3c745f3abde8 100644
--- a/arch/x86/kvm/mmu.c
+++ b/arch/x86/kvm/mmu.c
@@ -3309,13 +3309,13 @@ walk_shadow_page_get_mmio_spte(struct kvm_vcpu *vcpu, u64 addr, u64 *sptep)
walk_shadow_page_lockless_begin(vcpu);
- for (shadow_walk_init(&iterator, vcpu, addr), root = iterator.level;
+ for (shadow_walk_init(&iterator, vcpu, addr),
+ leaf = root = iterator.level;
shadow_walk_okay(&iterator);
__shadow_walk_next(&iterator, spte)) {
- leaf = iterator.level;
spte = mmu_spte_get_lockless(iterator.sptep);
- sptes[leaf - 1] = spte;
+ sptes[--leaf] = spte;
if (!is_shadow_present_pte(spte))
break;
@@ -3329,7 +3329,7 @@ walk_shadow_page_get_mmio_spte(struct kvm_vcpu *vcpu, u64 addr, u64 *sptep)
if (reserved) {
pr_err("%s: detect reserved bits on spte, addr 0x%llx, dump hierarchy:\n",
__func__, addr);
- while (root >= leaf) {
+ while (root > leaf) {
pr_err("------ spte 0x%llx level %d.\n",
sptes[root - 1], root);
root--;
But honestly I haven't even compiled it yet. Xiao, what do you think?
Paolo
> Since bogus warnings cause people to possibly ignore the *real*
> warnings, this should be fixed. Maybe the code should get rid of that
> 'reserved' flag, and instead initialize "leaf" to zero, and use that
> as the flag instead (since zero isn't a valid level)? That would
> actually avoid an extra variable, and would get rid of the warning.
>
> Hmm?
>
> Linus
> --
> To unsubscribe from this list: send the line "unsubscribe kvm" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
>
--
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/
Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Re: [GIT PULL] Early batch of KVM changes for 4.3 merge window Linus Torvalds <torvalds@linux-foundation.org> - 2015-09-01 02:50 +0200
Re: [GIT PULL] Early batch of KVM changes for 4.3 merge window Xiao Guangrong <guangrong.xiao@linux.intel.com> - 2015-09-01 08:00 +0200
Re: [GIT PULL] Early batch of KVM changes for 4.3 merge window Paolo Bonzini <pbonzini@redhat.com> - 2015-09-01 19:10 +0200
Re: [GIT PULL] Early batch of KVM changes for 4.3 merge window Paolo Bonzini <pbonzini@redhat.com> - 2015-09-01 19:10 +0200
Re: [GIT PULL] Early batch of KVM changes for 4.3 merge window Xiao Guangrong <guangrong.xiao@linux.intel.com> - 2015-09-02 00:50 +0200
csiph-web