提交 c86d8077 编写于 作者: J Jeremy Fitzhardinge

xen/mmu: remove all ad-hoc stats stuff

To make way for tracing.
Signed-off-by: NJeremy Fitzhardinge <jeremy.fitzhardinge@citrix.com>
上级 d5108316
...@@ -75,61 +75,12 @@ ...@@ -75,61 +75,12 @@
#include "mmu.h" #include "mmu.h"
#include "debugfs.h" #include "debugfs.h"
#define MMU_UPDATE_HISTO 30
/* /*
* Protects atomic reservation decrease/increase against concurrent increases. * Protects atomic reservation decrease/increase against concurrent increases.
* Also protects non-atomic updates of current_pages and balloon lists. * Also protects non-atomic updates of current_pages and balloon lists.
*/ */
DEFINE_SPINLOCK(xen_reservation_lock); DEFINE_SPINLOCK(xen_reservation_lock);
#ifdef CONFIG_XEN_DEBUG_FS
static struct {
u32 pgd_update;
u32 pgd_update_pinned;
u32 pgd_update_batched;
u32 pud_update;
u32 pud_update_pinned;
u32 pud_update_batched;
u32 pmd_update;
u32 pmd_update_pinned;
u32 pmd_update_batched;
u32 pte_update;
u32 pte_update_pinned;
u32 pte_update_batched;
u32 mmu_update;
u32 mmu_update_extended;
u32 mmu_update_histo[MMU_UPDATE_HISTO];
u32 prot_commit;
u32 prot_commit_batched;
} mmu_stats;
static u8 zero_stats;
static inline void check_zero(void)
{
if (unlikely(zero_stats)) {
memset(&mmu_stats, 0, sizeof(mmu_stats));
zero_stats = 0;
}
}
#define ADD_STATS(elem, val) \
do { check_zero(); mmu_stats.elem += (val); } while(0)
#else /* !CONFIG_XEN_DEBUG_FS */
#define ADD_STATS(elem, val) do { (void)(val); } while(0)
#endif /* CONFIG_XEN_DEBUG_FS */
/* /*
* Identity map, in addition to plain kernel map. This needs to be * Identity map, in addition to plain kernel map. This needs to be
* large enough to allocate page table pages to allocate the rest. * large enough to allocate page table pages to allocate the rest.
...@@ -263,20 +214,10 @@ static void xen_extend_mmu_update(const struct mmu_update *update) ...@@ -263,20 +214,10 @@ static void xen_extend_mmu_update(const struct mmu_update *update)
mcs = xen_mc_extend_args(__HYPERVISOR_mmu_update, sizeof(*u)); mcs = xen_mc_extend_args(__HYPERVISOR_mmu_update, sizeof(*u));
if (mcs.mc != NULL) { if (mcs.mc != NULL) {
ADD_STATS(mmu_update_extended, 1);
ADD_STATS(mmu_update_histo[mcs.mc->args[1]], -1);
mcs.mc->args[1]++; mcs.mc->args[1]++;
if (mcs.mc->args[1] < MMU_UPDATE_HISTO)
ADD_STATS(mmu_update_histo[mcs.mc->args[1]], 1);
else
ADD_STATS(mmu_update_histo[0], 1);
} else { } else {
ADD_STATS(mmu_update, 1);
mcs = __xen_mc_entry(sizeof(*u)); mcs = __xen_mc_entry(sizeof(*u));
MULTI_mmu_update(mcs.mc, mcs.args, 1, NULL, DOMID_SELF); MULTI_mmu_update(mcs.mc, mcs.args, 1, NULL, DOMID_SELF);
ADD_STATS(mmu_update_histo[1], 1);
} }
u = mcs.args; u = mcs.args;
...@@ -296,8 +237,6 @@ static void xen_set_pmd_hyper(pmd_t *ptr, pmd_t val) ...@@ -296,8 +237,6 @@ static void xen_set_pmd_hyper(pmd_t *ptr, pmd_t val)
u.val = pmd_val_ma(val); u.val = pmd_val_ma(val);
xen_extend_mmu_update(&u); xen_extend_mmu_update(&u);
ADD_STATS(pmd_update_batched, paravirt_get_lazy_mode() == PARAVIRT_LAZY_MMU);
xen_mc_issue(PARAVIRT_LAZY_MMU); xen_mc_issue(PARAVIRT_LAZY_MMU);
preempt_enable(); preempt_enable();
...@@ -305,8 +244,6 @@ static void xen_set_pmd_hyper(pmd_t *ptr, pmd_t val) ...@@ -305,8 +244,6 @@ static void xen_set_pmd_hyper(pmd_t *ptr, pmd_t val)
static void xen_set_pmd(pmd_t *ptr, pmd_t val) static void xen_set_pmd(pmd_t *ptr, pmd_t val)
{ {
ADD_STATS(pmd_update, 1);
/* If page is not pinned, we can just update the entry /* If page is not pinned, we can just update the entry
directly */ directly */
if (!xen_page_pinned(ptr)) { if (!xen_page_pinned(ptr)) {
...@@ -314,8 +251,6 @@ static void xen_set_pmd(pmd_t *ptr, pmd_t val) ...@@ -314,8 +251,6 @@ static void xen_set_pmd(pmd_t *ptr, pmd_t val)
return; return;
} }
ADD_STATS(pmd_update_pinned, 1);
xen_set_pmd_hyper(ptr, val); xen_set_pmd_hyper(ptr, val);
} }
...@@ -348,9 +283,6 @@ static bool xen_batched_set_pte(pte_t *ptep, pte_t pteval) ...@@ -348,9 +283,6 @@ static bool xen_batched_set_pte(pte_t *ptep, pte_t pteval)
static void xen_set_pte(pte_t *ptep, pte_t pteval) static void xen_set_pte(pte_t *ptep, pte_t pteval)
{ {
ADD_STATS(pte_update, 1);
// ADD_STATS(pte_update_pinned, xen_page_pinned(ptep));
if (!xen_batched_set_pte(ptep, pteval)) if (!xen_batched_set_pte(ptep, pteval))
native_set_pte(ptep, pteval); native_set_pte(ptep, pteval);
} }
...@@ -379,9 +311,6 @@ void xen_ptep_modify_prot_commit(struct mm_struct *mm, unsigned long addr, ...@@ -379,9 +311,6 @@ void xen_ptep_modify_prot_commit(struct mm_struct *mm, unsigned long addr,
u.val = pte_val_ma(pte); u.val = pte_val_ma(pte);
xen_extend_mmu_update(&u); xen_extend_mmu_update(&u);
ADD_STATS(prot_commit, 1);
ADD_STATS(prot_commit_batched, paravirt_get_lazy_mode() == PARAVIRT_LAZY_MMU);
xen_mc_issue(PARAVIRT_LAZY_MMU); xen_mc_issue(PARAVIRT_LAZY_MMU);
} }
...@@ -593,8 +522,6 @@ static void xen_set_pud_hyper(pud_t *ptr, pud_t val) ...@@ -593,8 +522,6 @@ static void xen_set_pud_hyper(pud_t *ptr, pud_t val)
u.val = pud_val_ma(val); u.val = pud_val_ma(val);
xen_extend_mmu_update(&u); xen_extend_mmu_update(&u);
ADD_STATS(pud_update_batched, paravirt_get_lazy_mode() == PARAVIRT_LAZY_MMU);
xen_mc_issue(PARAVIRT_LAZY_MMU); xen_mc_issue(PARAVIRT_LAZY_MMU);
preempt_enable(); preempt_enable();
...@@ -602,8 +529,6 @@ static void xen_set_pud_hyper(pud_t *ptr, pud_t val) ...@@ -602,8 +529,6 @@ static void xen_set_pud_hyper(pud_t *ptr, pud_t val)
static void xen_set_pud(pud_t *ptr, pud_t val) static void xen_set_pud(pud_t *ptr, pud_t val)
{ {
ADD_STATS(pud_update, 1);
/* If page is not pinned, we can just update the entry /* If page is not pinned, we can just update the entry
directly */ directly */
if (!xen_page_pinned(ptr)) { if (!xen_page_pinned(ptr)) {
...@@ -611,8 +536,6 @@ static void xen_set_pud(pud_t *ptr, pud_t val) ...@@ -611,8 +536,6 @@ static void xen_set_pud(pud_t *ptr, pud_t val)
return; return;
} }
ADD_STATS(pud_update_pinned, 1);
xen_set_pud_hyper(ptr, val); xen_set_pud_hyper(ptr, val);
} }
...@@ -705,8 +628,6 @@ static void xen_set_pgd(pgd_t *ptr, pgd_t val) ...@@ -705,8 +628,6 @@ static void xen_set_pgd(pgd_t *ptr, pgd_t val)
{ {
pgd_t *user_ptr = xen_get_user_pgd(ptr); pgd_t *user_ptr = xen_get_user_pgd(ptr);
ADD_STATS(pgd_update, 1);
/* If page is not pinned, we can just update the entry /* If page is not pinned, we can just update the entry
directly */ directly */
if (!xen_page_pinned(ptr)) { if (!xen_page_pinned(ptr)) {
...@@ -718,9 +639,6 @@ static void xen_set_pgd(pgd_t *ptr, pgd_t val) ...@@ -718,9 +639,6 @@ static void xen_set_pgd(pgd_t *ptr, pgd_t val)
return; return;
} }
ADD_STATS(pgd_update_pinned, 1);
ADD_STATS(pgd_update_batched, paravirt_get_lazy_mode() == PARAVIRT_LAZY_MMU);
/* If it's pinned, then we can at least batch the kernel and /* If it's pinned, then we can at least batch the kernel and
user updates together. */ user updates together. */
xen_mc_batch(); xen_mc_batch();
...@@ -2384,8 +2302,6 @@ int xen_remap_domain_mfn_range(struct vm_area_struct *vma, ...@@ -2384,8 +2302,6 @@ int xen_remap_domain_mfn_range(struct vm_area_struct *vma,
} }
EXPORT_SYMBOL_GPL(xen_remap_domain_mfn_range); EXPORT_SYMBOL_GPL(xen_remap_domain_mfn_range);
#ifdef CONFIG_XEN_DEBUG_FS
static int p2m_dump_open(struct inode *inode, struct file *filp) static int p2m_dump_open(struct inode *inode, struct file *filp)
{ {
return single_open(filp, p2m_dump_show, NULL); return single_open(filp, p2m_dump_show, NULL);
...@@ -2397,57 +2313,3 @@ static const struct file_operations p2m_dump_fops = { ...@@ -2397,57 +2313,3 @@ static const struct file_operations p2m_dump_fops = {
.llseek = seq_lseek, .llseek = seq_lseek,
.release = single_release, .release = single_release,
}; };
static struct dentry *d_mmu_debug;
static int __init xen_mmu_debugfs(void)
{
struct dentry *d_xen = xen_init_debugfs();
if (d_xen == NULL)
return -ENOMEM;
d_mmu_debug = debugfs_create_dir("mmu", d_xen);
debugfs_create_u8("zero_stats", 0644, d_mmu_debug, &zero_stats);
debugfs_create_u32("pgd_update", 0444, d_mmu_debug, &mmu_stats.pgd_update);
debugfs_create_u32("pgd_update_pinned", 0444, d_mmu_debug,
&mmu_stats.pgd_update_pinned);
debugfs_create_u32("pgd_update_batched", 0444, d_mmu_debug,
&mmu_stats.pgd_update_pinned);
debugfs_create_u32("pud_update", 0444, d_mmu_debug, &mmu_stats.pud_update);
debugfs_create_u32("pud_update_pinned", 0444, d_mmu_debug,
&mmu_stats.pud_update_pinned);
debugfs_create_u32("pud_update_batched", 0444, d_mmu_debug,
&mmu_stats.pud_update_pinned);
debugfs_create_u32("pmd_update", 0444, d_mmu_debug, &mmu_stats.pmd_update);
debugfs_create_u32("pmd_update_pinned", 0444, d_mmu_debug,
&mmu_stats.pmd_update_pinned);
debugfs_create_u32("pmd_update_batched", 0444, d_mmu_debug,
&mmu_stats.pmd_update_pinned);
debugfs_create_u32("pte_update", 0444, d_mmu_debug, &mmu_stats.pte_update);
// debugfs_create_u32("pte_update_pinned", 0444, d_mmu_debug,
// &mmu_stats.pte_update_pinned);
debugfs_create_u32("pte_update_batched", 0444, d_mmu_debug,
&mmu_stats.pte_update_pinned);
debugfs_create_u32("mmu_update", 0444, d_mmu_debug, &mmu_stats.mmu_update);
debugfs_create_u32("mmu_update_extended", 0444, d_mmu_debug,
&mmu_stats.mmu_update_extended);
xen_debugfs_create_u32_array("mmu_update_histo", 0444, d_mmu_debug,
mmu_stats.mmu_update_histo, 20);
debugfs_create_u32("prot_commit", 0444, d_mmu_debug, &mmu_stats.prot_commit);
debugfs_create_u32("prot_commit_batched", 0444, d_mmu_debug,
&mmu_stats.prot_commit_batched);
debugfs_create_file("p2m", 0600, d_mmu_debug, NULL, &p2m_dump_fops);
return 0;
}
fs_initcall(xen_mmu_debugfs);
#endif /* CONFIG_XEN_DEBUG_FS */
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册