mirror of
https://git.FreeBSD.org/src.git
synced 2024-12-23 11:18:54 +00:00
Make the ddb command "show tlb" SMP friendly.
It now accepts an argument to dump out the tlb of a particular cpu.
This commit is contained in:
parent
55c4e01602
commit
2200b28e5f
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=205064
@ -577,6 +577,8 @@
|
||||
|
||||
#define MIPS_CONFIG1_TLBSZ_MASK 0x7E000000 /* bits 30..25 # tlb entries minus one */
|
||||
#define MIPS_CONFIG1_TLBSZ_SHIFT 25
|
||||
#define MIPS_MAX_TLB_ENTRIES 64
|
||||
|
||||
#define MIPS_CONFIG1_IS_MASK 0x01C00000 /* bits 24..22 icache sets per way */
|
||||
#define MIPS_CONFIG1_IS_SHIFT 22
|
||||
#define MIPS_CONFIG1_IL_MASK 0x00380000 /* bits 21..19 icache line size */
|
||||
|
@ -219,6 +219,11 @@ pmap_map_fpage(vm_paddr_t pa, struct fpage *fp,
|
||||
boolean_t check_unmaped);
|
||||
void pmap_unmap_fpage(vm_paddr_t pa, struct fpage *fp);
|
||||
|
||||
/*
|
||||
* Function to save TLB contents so that they may be inspected in the debugger.
|
||||
*/
|
||||
extern void pmap_save_tlb(void);
|
||||
|
||||
#endif /* _KERNEL */
|
||||
|
||||
#endif /* !LOCORE */
|
||||
|
@ -128,6 +128,7 @@ mips_ipi_handler(void *arg)
|
||||
CTR0(KTR_SMP, "IPI_STOP or IPI_STOP_HARD");
|
||||
|
||||
savectx(&stoppcbs[cpu]);
|
||||
pmap_save_tlb();
|
||||
|
||||
/* Indicate we are stopped */
|
||||
atomic_set_int(&stopped_cpus, cpumask);
|
||||
|
@ -76,6 +76,7 @@ __FBSDID("$FreeBSD$");
|
||||
#include <sys/msgbuf.h>
|
||||
#include <sys/vmmeter.h>
|
||||
#include <sys/mman.h>
|
||||
#include <sys/smp.h>
|
||||
|
||||
#include <vm/vm.h>
|
||||
#include <vm/vm_param.h>
|
||||
@ -149,6 +150,8 @@ unsigned pmap_max_asid; /* max ASID supported by the system */
|
||||
|
||||
vm_offset_t kernel_vm_end;
|
||||
|
||||
static struct tlb tlbstash[MAXCPU][MIPS_MAX_TLB_ENTRIES];
|
||||
|
||||
static void pmap_asid_alloc(pmap_t pmap);
|
||||
|
||||
/*
|
||||
@ -3284,17 +3287,6 @@ db_dump_tlb(int first, int last)
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef DDB
|
||||
#include <sys/kernel.h>
|
||||
#include <ddb/ddb.h>
|
||||
|
||||
DB_SHOW_COMMAND(tlb, ddb_dump_tlb)
|
||||
{
|
||||
db_dump_tlb(0, num_tlbentries - 1);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Routine: pmap_kextract
|
||||
* Function:
|
||||
@ -3377,3 +3369,61 @@ pmap_flush_pvcache(vm_page_t m)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
pmap_save_tlb(void)
|
||||
{
|
||||
int tlbno, cpu;
|
||||
|
||||
cpu = PCPU_GET(cpuid);
|
||||
|
||||
for (tlbno = 0; tlbno < num_tlbentries; ++tlbno)
|
||||
MachTLBRead(tlbno, &tlbstash[cpu][tlbno]);
|
||||
}
|
||||
|
||||
#ifdef DDB
|
||||
#include <ddb/ddb.h>
|
||||
|
||||
DB_SHOW_COMMAND(tlb, ddb_dump_tlb)
|
||||
{
|
||||
int cpu, tlbno;
|
||||
struct tlb *tlb;
|
||||
|
||||
if (have_addr)
|
||||
cpu = ((addr >> 4) % 16) * 10 + (addr % 16);
|
||||
else
|
||||
cpu = PCPU_GET(cpuid);
|
||||
|
||||
if (cpu < 0 || cpu >= mp_ncpus) {
|
||||
db_printf("Invalid CPU %d\n", cpu);
|
||||
return;
|
||||
} else
|
||||
db_printf("CPU %d:\n", cpu);
|
||||
|
||||
if (cpu == PCPU_GET(cpuid))
|
||||
pmap_save_tlb();
|
||||
|
||||
for (tlbno = 0; tlbno < num_tlbentries; ++tlbno) {
|
||||
tlb = &tlbstash[cpu][tlbno];
|
||||
if (tlb->tlb_lo0 & PTE_V || tlb->tlb_lo1 & PTE_V) {
|
||||
printf("TLB %2d vad 0x%0lx ",
|
||||
tlbno, (long)(tlb->tlb_hi & 0xffffff00));
|
||||
} else {
|
||||
printf("TLB*%2d vad 0x%0lx ",
|
||||
tlbno, (long)(tlb->tlb_hi & 0xffffff00));
|
||||
}
|
||||
printf("0=0x%0lx ", pfn_to_vad((long)tlb->tlb_lo0));
|
||||
printf("%c", tlb->tlb_lo0 & PTE_V ? 'V' : '-');
|
||||
printf("%c", tlb->tlb_lo0 & PTE_M ? 'M' : '-');
|
||||
printf("%c", tlb->tlb_lo0 & PTE_G ? 'G' : '-');
|
||||
printf(" atr %x ", (tlb->tlb_lo0 >> 3) & 7);
|
||||
printf("1=0x%0lx ", pfn_to_vad((long)tlb->tlb_lo1));
|
||||
printf("%c", tlb->tlb_lo1 & PTE_V ? 'V' : '-');
|
||||
printf("%c", tlb->tlb_lo1 & PTE_M ? 'M' : '-');
|
||||
printf("%c", tlb->tlb_lo1 & PTE_G ? 'G' : '-');
|
||||
printf(" atr %x ", (tlb->tlb_lo1 >> 3) & 7);
|
||||
printf(" sz=%x pid=%x\n", tlb->tlb_mask,
|
||||
(tlb->tlb_hi & 0x000000ff));
|
||||
}
|
||||
}
|
||||
#endif /* DDB */
|
||||
|
Loading…
Reference in New Issue
Block a user