From: Wanpeng Li <kernellwp@gmail.com>
To: Paolo Bonzini <pbonzini@redhat.com>,
Wanpeng Li <wanpeng.li@linux.intel.com>,
Andres Lagar-Cavilla <andreslc@google.com>
Cc: Gleb Natapov <gleb@kernel.org>, Radim Krcmar <rkrcmar@redhat.com>,
Rik van Riel <riel@redhat.com>,
Andrew Morton <akpm@linux-foundation.org>,
Andrea Arcangeli <aarcange@redhat.com>,
Peter Feiner <pfeiner@google.com>,
kvm@vger.kernel.org, linux-kernel@vger.kernel.org,
linux-mm@kvack.org
Subject: Re: [PATCH v4] kvm: Fix page ageing bugs
Date: Wed, 24 Sep 2014 15:20:26 +0800 [thread overview]
Message-ID: <542270BA.4090708@gmail.com> (raw)
In-Reply-To: <54226CEB.9080504@redhat.com>
Hi Paolo,
ao? 9/24/14, 3:04 PM, Paolo Bonzini a??e??:
> Il 24/09/2014 04:27, Wanpeng Li ha scritto:
>> Hi Andres,
>> On Mon, Sep 22, 2014 at 02:54:42PM -0700, Andres Lagar-Cavilla wrote:
>>> 1. We were calling clear_flush_young_notify in unmap_one, but we are
>>> within an mmu notifier invalidate range scope. The spte exists no more
>>> (due to range_start) and the accessed bit info has already been
>>> propagated (due to kvm_pfn_set_accessed). Simply call
>>> clear_flush_young.
>>>
>>> 2. We clear_flush_young on a primary MMU PMD, but this may be mapped
>>> as a collection of PTEs by the secondary MMU (e.g. during log-dirty).
>>> This required expanding the interface of the clear_flush_young mmu
>>> notifier, so a lot of code has been trivially touched.
>>>
>>> 3. In the absence of shadow_accessed_mask (e.g. EPT A bit), we emulate
>>> the access bit by blowing the spte. This requires proper synchronizing
>>> with MMU notifier consumers, like every other removal of spte's does.
>>>
>> [...]
>>> ---
>>> + BUG_ON(!shadow_accessed_mask);
>>>
>>> for (sptep = rmap_get_first(*rmapp, &iter); sptep;
>>> sptep = rmap_get_next(&iter)) {
>>> + struct kvm_mmu_page *sp;
>>> + gfn_t gfn;
>>> BUG_ON(!is_shadow_present_pte(*sptep));
>>> + /* From spte to gfn. */
>>> + sp = page_header(__pa(sptep));
>>> + gfn = kvm_mmu_page_get_gfn(sp, sptep - sp->spt);
>>>
>>> if (*sptep & shadow_accessed_mask) {
>>> young = 1;
>>> clear_bit((ffs(shadow_accessed_mask) - 1),
>>> (unsigned long *)sptep);
>>> }
>>> + trace_kvm_age_page(gfn, slot, young);
>> IIUC, all the rmapps in this for loop are against the same gfn which
>> results in the above trace point dump the message duplicated.
> You're right; Andres's patch "[PATCH] kvm/x86/mmu: Pass gfn and level to
> rmapp callback" helps avoiding that.
From Andres's patch "[PATCH] kvm/x86/mmu: Pass gfn and level to rmapp
callback"
@@ -1410,25 +1421,20 @@ static int kvm_age_rmapp(struct kvm *kvm,
unsigned long *rmapp,
for (sptep = rmap_get_first(*rmapp, &iter); sptep;
sptep = rmap_get_next(&iter)) {
- struct kvm_mmu_page *sp;
- gfn_t gfn;
BUG_ON(!is_shadow_present_pte(*sptep));
- /* From spte to gfn. */
- sp = page_header(__pa(sptep));
- gfn = kvm_mmu_page_get_gfn(sp, sptep - sp->spt);
-
if (*sptep & shadow_accessed_mask) {
young = 1;
clear_bit((ffs(shadow_accessed_mask) - 1),
(unsigned long *)sptep);
}
- trace_kvm_age_page(gfn, slot, young);
+ trace_kvm_age_page(gfn, level, slot, young);
}
return young;
}
This trace point still dup duplicated message for the same gfn in the
for loop.
Regards,
Wanpeng Li
>
> 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/
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
next prev parent reply other threads:[~2014-09-24 7:20 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-09-22 18:34 [PATCH] kvm: Fix page ageing bugs Andres Lagar-Cavilla
2014-09-22 20:00 ` [PATCH v2] " Andres Lagar-Cavilla
2014-09-22 20:26 ` [PATCH v3] " Andres Lagar-Cavilla
2014-09-22 21:48 ` Paolo Bonzini
2014-09-22 21:54 ` Andres Lagar-Cavilla
2014-09-22 21:54 ` [PATCH v4] " Andres Lagar-Cavilla
2014-09-23 7:49 ` Paolo Bonzini
2014-09-23 17:04 ` Andres Lagar-Cavilla
2014-09-23 17:05 ` Paolo Bonzini
2014-09-24 2:27 ` Wanpeng Li
2014-09-24 7:04 ` Paolo Bonzini
2014-09-24 7:20 ` Wanpeng Li [this message]
2014-09-24 8:27 ` Paolo Bonzini
2014-09-24 17:17 ` Andres Lagar-Cavilla
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=542270BA.4090708@gmail.com \
--to=kernellwp@gmail.com \
--cc=aarcange@redhat.com \
--cc=akpm@linux-foundation.org \
--cc=andreslc@google.com \
--cc=gleb@kernel.org \
--cc=kvm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=pbonzini@redhat.com \
--cc=pfeiner@google.com \
--cc=riel@redhat.com \
--cc=rkrcmar@redhat.com \
--cc=wanpeng.li@linux.intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).