#include "mmu.h"
 #include "debugfs.h"
 
-#define MMU_UPDATE_HISTO       30
-
 /*
  * Protects atomic reservation decrease/increase against concurrent increases.
  * Also protects non-atomic updates of current_pages and balloon lists.
  */
 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
  * large enough to allocate page table pages to allocate the rest.
        mcs = xen_mc_extend_args(__HYPERVISOR_mmu_update, sizeof(*u));
 
        if (mcs.mc != NULL) {
-               ADD_STATS(mmu_update_extended, 1);
-               ADD_STATS(mmu_update_histo[mcs.mc->args[1]], -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 {
-               ADD_STATS(mmu_update, 1);
                mcs = __xen_mc_entry(sizeof(*u));
                MULTI_mmu_update(mcs.mc, mcs.args, 1, NULL, DOMID_SELF);
-               ADD_STATS(mmu_update_histo[1], 1);
        }
 
        u = mcs.args;
        u.val = pmd_val_ma(val);
        xen_extend_mmu_update(&u);
 
-       ADD_STATS(pmd_update_batched, paravirt_get_lazy_mode() == PARAVIRT_LAZY_MMU);
-
        xen_mc_issue(PARAVIRT_LAZY_MMU);
 
        preempt_enable();
 
 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
           directly */
        if (!xen_page_pinned(ptr)) {
                return;
        }
 
-       ADD_STATS(pmd_update_pinned, 1);
-
        xen_set_pmd_hyper(ptr, val);
 }
 
 
 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))
                native_set_pte(ptep, pteval);
 }
        u.val = pte_val_ma(pte);
        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);
 }
 
        u.val = pud_val_ma(val);
        xen_extend_mmu_update(&u);
 
-       ADD_STATS(pud_update_batched, paravirt_get_lazy_mode() == PARAVIRT_LAZY_MMU);
-
        xen_mc_issue(PARAVIRT_LAZY_MMU);
 
        preempt_enable();
 
 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
           directly */
        if (!xen_page_pinned(ptr)) {
                return;
        }
 
-       ADD_STATS(pud_update_pinned, 1);
-
        xen_set_pud_hyper(ptr, val);
 }
 
 {
        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
           directly */
        if (!xen_page_pinned(ptr)) {
                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
           user updates together. */
        xen_mc_batch();
 }
 EXPORT_SYMBOL_GPL(xen_remap_domain_mfn_range);
 
-#ifdef CONFIG_XEN_DEBUG_FS
-
 static int p2m_dump_open(struct inode *inode, struct file *filp)
 {
        return single_open(filp, p2m_dump_show, NULL);
        .llseek         = seq_lseek,
        .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 */