From: Nitesh Narayan Lal <nitesh@redhat.com>
To: kvm@vger.kernel.org, linux-kernel@vger.kernel.org,
linux-mm@kvack.org, pbonzini@redhat.com, lcapitulino@redhat.com,
pagupta@redhat.com, wei.w.wang@intel.com,
yang.zhang.wz@gmail.com, riel@surriel.com, david@redhat.com,
mst@redhat.com, dodgen@google.com, konrad.wilk@oracle.com,
dhildenb@redhat.com, aarcange@redhat.com,
alexander.duyck@gmail.com
Subject: [RFC][Patch v9 6/6] KVM: Adding tracepoints for guest free page hinting
Date: Wed, 6 Mar 2019 10:50:48 -0500 [thread overview]
Message-ID: <20190306155048.12868-7-nitesh@redhat.com> (raw)
In-Reply-To: <20190306155048.12868-1-nitesh@redhat.com>
This patch enables to track the pages freed by the guest and
the pages isolated by the page hinting code through kernel
tracepoints.
Signed-off-by: Nitesh Narayan Lal <nitesh@redhat.com>
---
include/trace/events/kmem.h | 62 +++++++++++++++++++++++++++++++++++++
virt/kvm/page_hinting.c | 12 +++++++
2 files changed, 74 insertions(+)
diff --git a/include/trace/events/kmem.h b/include/trace/events/kmem.h
index eb57e3037deb..0bef31484cf8 100644
--- a/include/trace/events/kmem.h
+++ b/include/trace/events/kmem.h
@@ -315,6 +315,68 @@ TRACE_EVENT(mm_page_alloc_extfrag,
__entry->change_ownership)
);
+TRACE_EVENT(guest_free_page,
+ TP_PROTO(unsigned long pfn, unsigned int order),
+
+ TP_ARGS(pfn, order),
+
+ TP_STRUCT__entry(
+ __field(unsigned long, pfn)
+ __field(unsigned int, order)
+ ),
+
+ TP_fast_assign(
+ __entry->pfn = pfn;
+ __entry->order = order;
+ ),
+
+ TP_printk("pfn=%lu order=%d",
+ __entry->pfn,
+ __entry->order)
+);
+
+TRACE_EVENT(guest_isolated_page,
+ TP_PROTO(unsigned long pfn, unsigned int order),
+
+ TP_ARGS(pfn, order),
+
+ TP_STRUCT__entry(
+ __field(unsigned long, pfn)
+ __field(unsigned int, order)
+ ),
+
+ TP_fast_assign(
+ __entry->pfn = pfn;
+ __entry->order = order;
+ ),
+
+ TP_printk("pfn=%lu order=%u",
+ __entry->pfn,
+ __entry->order)
+);
+
+TRACE_EVENT(guest_captured_page,
+ TP_PROTO(unsigned long pfn, unsigned int order, int idx),
+
+ TP_ARGS(pfn, order, idx),
+
+ TP_STRUCT__entry(
+ __field(unsigned long, pfn)
+ __field(unsigned int, order)
+ __field(int, idx)
+ ),
+
+ TP_fast_assign(
+ __entry->pfn = pfn;
+ __entry->order = order;
+ __entry->idx = idx;
+ ),
+
+ TP_printk("pfn=%lu order=%u array_index=%d",
+ __entry->pfn,
+ __entry->order,
+ __entry->idx)
+);
#endif /* _TRACE_KMEM_H */
/* This part must be outside protection */
diff --git a/virt/kvm/page_hinting.c b/virt/kvm/page_hinting.c
index 5980682e0b86..dc72f1947751 100644
--- a/virt/kvm/page_hinting.c
+++ b/virt/kvm/page_hinting.c
@@ -4,6 +4,7 @@
#include <linux/kvm_host.h>
#include <linux/kernel.h>
#include <linux/sort.h>
+#include <trace/events/kmem.h>
/*
* struct guest_free_pages- holds array of guest freed PFN's along with an
@@ -178,6 +179,8 @@ static void guest_free_page_hinting(void)
ret = __isolate_free_page(page, buddy_order);
if (ret) {
+ trace_guest_isolated_page(pfn,
+ buddy_order);
isolated_pages_obj[hyp_idx].pfn = pfn;
isolated_pages_obj[hyp_idx].order =
buddy_order;
@@ -198,6 +201,8 @@ static void guest_free_page_hinting(void)
unsigned long buddy_pfn =
page_to_pfn(buddy_page);
+ trace_guest_isolated_page(buddy_pfn,
+ buddy_order);
isolated_pages_obj[hyp_idx].pfn =
buddy_pfn;
isolated_pages_obj[hyp_idx].order =
@@ -255,9 +260,12 @@ void guest_free_page_enqueue(struct page *page, int order)
local_irq_save(flags);
hinting_obj = this_cpu_ptr(&free_pages_obj);
l_idx = hinting_obj->free_pages_idx;
+ trace_guest_free_page(page_to_pfn(page), order);
if (l_idx != MAX_FGPT_ENTRIES) {
if (PageBuddy(page) && page_private(page) >=
FREE_PAGE_HINTING_MIN_ORDER) {
+ trace_guest_captured_page(page_to_pfn(page), order,
+ l_idx);
hinting_obj->free_page_arr[l_idx] = page_to_pfn(page);
hinting_obj->free_pages_idx += 1;
} else {
@@ -268,7 +276,11 @@ void guest_free_page_enqueue(struct page *page, int order)
!if_exist(buddy_page)) {
unsigned long buddy_pfn =
page_to_pfn(buddy_page);
+ unsigned int buddy_order =
+ page_private(buddy_page);
+ trace_guest_captured_page(buddy_pfn,
+ buddy_order, l_idx);
hinting_obj->free_page_arr[l_idx] =
buddy_pfn;
hinting_obj->free_pages_idx += 1;
--
2.17.2
next prev parent reply other threads:[~2019-03-06 15:51 UTC|newest]
Thread overview: 77+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-03-06 15:50 [RFC][Patch v9 0/6] KVM: Guest Free Page Hinting Nitesh Narayan Lal
2019-03-06 15:50 ` [RFC][Patch v9 1/6] KVM: Guest free page hinting support Nitesh Narayan Lal
2019-03-06 23:43 ` Alexander Duyck
2019-03-07 19:32 ` Nitesh Narayan Lal
2019-03-06 15:50 ` [RFC][Patch v9 2/6] KVM: Enables the kernel to isolate guest free pages Nitesh Narayan Lal
2019-03-07 18:30 ` Alexander Duyck
2019-03-07 19:23 ` Nitesh Narayan Lal
2019-03-07 19:30 ` David Hildenbrand
2019-03-07 21:32 ` Alexander Duyck
2019-03-07 21:40 ` David Hildenbrand
2019-03-07 22:35 ` Alexander Duyck
2019-03-08 2:28 ` Michael S. Tsirkin
2019-03-08 2:32 ` Michael S. Tsirkin
2019-03-08 18:06 ` Alexander Duyck
2019-03-08 18:59 ` Michael S. Tsirkin
2019-03-08 19:10 ` Nitesh Narayan Lal
2019-03-08 19:25 ` Alexander Duyck
2019-03-08 19:38 ` Nitesh Narayan Lal
2019-03-08 21:39 ` Alexander Duyck
2019-03-12 19:46 ` Nitesh Narayan Lal
2019-03-12 21:13 ` Alexander Duyck
2019-03-12 21:53 ` David Hildenbrand
2019-03-12 22:56 ` Alexander Duyck
2019-03-13 11:54 ` Nitesh Narayan Lal
2019-03-13 12:17 ` David Hildenbrand
2019-03-13 13:08 ` Nitesh Narayan Lal
2019-03-13 16:37 ` Alexander Duyck
2019-03-13 16:39 ` David Hildenbrand
2019-03-13 22:54 ` Alexander Duyck
2019-03-13 23:18 ` David Hildenbrand
2019-03-06 15:50 ` [RFC][Patch v9 3/6] KVM: Enables the kernel to report isolated pages Nitesh Narayan Lal
2019-03-06 21:30 ` Alexander Duyck
2019-03-07 13:23 ` Nitesh Narayan Lal
2019-03-06 15:50 ` [RFC][Patch v9 4/6] KVM: Reporting page poisoning value to the host Nitesh Narayan Lal
2019-03-06 15:50 ` [RFC][Patch v9 5/6] KVM: Enabling guest free page hinting via static key Nitesh Narayan Lal
2019-03-06 15:50 ` Nitesh Narayan Lal [this message]
2019-03-06 15:52 ` [RFC][QEMU Patch] KVM: Enable QEMU to free the pages hinted by the guest Nitesh Narayan Lal
[not found] ` <20190306110501-mutt-send-email-mst@kernel.org>
2019-03-06 18:07 ` [RFC][Patch v9 0/6] KVM: Guest Free Page Hinting Nitesh Narayan Lal
[not found] ` <20190306130955-mutt-send-email-mst@kernel.org>
2019-03-06 18:30 ` Nitesh Narayan Lal
2019-03-06 18:38 ` Michael S. Tsirkin
2019-03-06 18:40 ` Nitesh Narayan Lal
2019-03-06 18:43 ` Alexander Duyck
2019-03-06 18:43 ` Michael S. Tsirkin
2019-03-06 18:59 ` David Hildenbrand
2019-03-06 19:08 ` Alexander Duyck
2019-03-06 19:18 ` David Hildenbrand
2019-03-06 19:24 ` Alexander Duyck
2019-03-06 20:31 ` Nitesh Narayan Lal
2019-03-06 20:32 ` Michael S. Tsirkin
2019-03-06 21:40 ` David Hildenbrand
2019-03-06 22:18 ` Michael S. Tsirkin
2019-03-06 23:12 ` Alexander Duyck
2019-03-14 16:42 ` Nitesh Narayan Lal
2019-03-14 16:58 ` Alexander Duyck
2019-03-18 15:57 ` Nitesh Narayan Lal
2019-03-19 13:33 ` David Hildenbrand
2019-03-19 16:04 ` Nitesh Narayan Lal
[not found] ` <CAKgT0UcBDKr0ACHQWUCvmm8atxM6wSu7aCRFJkFvfjT_W_femQ@mail.gmail.com>
2019-03-19 17:59 ` Nitesh Narayan Lal
2019-03-20 13:18 ` Nitesh Narayan Lal
2019-03-25 14:27 ` Nitesh Narayan Lal
2019-03-25 15:37 ` Michael S. Tsirkin
2019-03-25 15:42 ` Nitesh Narayan Lal
[not found] ` <CAKgT0Ud35pmmfAabYJijWo8qpucUWS8-OzBW=gsotfxZFuS9PQ@mail.gmail.com>
2019-03-06 19:07 ` Nitesh Narayan Lal
2019-03-06 22:05 ` Alexander Duyck
2019-03-07 13:09 ` Nitesh Narayan Lal
2019-03-07 18:45 ` Alexander Duyck
2019-03-07 18:53 ` Michael S. Tsirkin
2019-03-07 19:27 ` David Hildenbrand
2019-03-08 2:24 ` Michael S. Tsirkin
2019-03-08 11:53 ` David Hildenbrand
2019-03-07 21:14 ` Alexander Duyck
2019-03-07 21:28 ` David Hildenbrand
2019-03-07 22:19 ` Alexander Duyck
2019-03-07 19:45 ` Nitesh Narayan Lal
2019-03-07 19:49 ` David Hildenbrand
2019-03-07 18:46 ` Michael S. Tsirkin
2019-03-12 19:58 ` David Hildenbrand
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=20190306155048.12868-7-nitesh@redhat.com \
--to=nitesh@redhat.com \
--cc=aarcange@redhat.com \
--cc=alexander.duyck@gmail.com \
--cc=david@redhat.com \
--cc=dhildenb@redhat.com \
--cc=dodgen@google.com \
--cc=konrad.wilk@oracle.com \
--cc=kvm@vger.kernel.org \
--cc=lcapitulino@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=mst@redhat.com \
--cc=pagupta@redhat.com \
--cc=pbonzini@redhat.com \
--cc=riel@surriel.com \
--cc=wei.w.wang@intel.com \
--cc=yang.zhang.wz@gmail.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).