asids-debugfs.c 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. /*
  2. * debugfs ops for process ASIDs
  3. *
  4. * Copyright (C) 2000, 2001 Paolo Alberelli
  5. * Copyright (C) 2003 - 2008 Paul Mundt
  6. * Copyright (C) 2003, 2004 Richard Curnow
  7. *
  8. * Provides a debugfs file that lists out the ASIDs currently associated
  9. * with the processes.
  10. *
  11. * In the SH-5 case, if the DM.PC register is examined through the debug
  12. * link, this shows ASID + PC. To make use of this, the PID->ASID
  13. * relationship needs to be known. This is primarily for debugging.
  14. *
  15. * This file is subject to the terms and conditions of the GNU General Public
  16. * License. See the file "COPYING" in the main directory of this archive
  17. * for more details.
  18. */
  19. #include <linux/init.h>
  20. #include <linux/debugfs.h>
  21. #include <linux/seq_file.h>
  22. #include <linux/spinlock.h>
  23. #include <linux/sched/signal.h>
  24. #include <linux/sched/task.h>
  25. #include <asm/processor.h>
  26. #include <asm/mmu_context.h>
  27. static int asids_debugfs_show(struct seq_file *file, void *iter)
  28. {
  29. struct task_struct *p;
  30. read_lock(&tasklist_lock);
  31. for_each_process(p) {
  32. int pid = p->pid;
  33. if (unlikely(!pid))
  34. continue;
  35. if (p->mm)
  36. seq_printf(file, "%5d : %04lx\n", pid,
  37. cpu_asid(smp_processor_id(), p->mm));
  38. }
  39. read_unlock(&tasklist_lock);
  40. return 0;
  41. }
  42. DEFINE_SHOW_ATTRIBUTE(asids_debugfs);
  43. static int __init asids_debugfs_init(void)
  44. {
  45. debugfs_create_file("asids", S_IRUSR, arch_debugfs_dir, NULL,
  46. &asids_debugfs_fops);
  47. return 0;
  48. }
  49. device_initcall(asids_debugfs_init);