]> www.infradead.org Git - users/jedix/linux-maple.git/commitdiff
proc: sparc64 Export ADI-enabled memory
authorEric Snowberg <eric.snowberg@oracle.com>
Mon, 19 Jun 2017 20:44:52 +0000 (14:44 -0600)
committerAllen Pais <allen.pais@oracle.com>
Tue, 18 Jul 2017 12:25:00 +0000 (17:55 +0530)
Add a maps entry to /proc/pid/adi to show memory map information about
SPARC ADI enabled memory.

Orabug: 26052545

Signed-off-by: Eric Snowberg <eric.snowberg@oracle.com>
Signed-off-by: Allen Pais <allen.pais@oracle.com>
Reviewed-by: chris hyser <chris.hyser@oracle.com>
fs/proc/adi.c
fs/proc/internal.h
fs/proc/task_mmu.c

index 023edc2e7bd266349e4238699a97771374b8e00c..ca14a8e1dd1418a1814efd21282633728a4f3afd 100644 (file)
@@ -222,6 +222,7 @@ static const struct file_operations proc_tag_operations = {
 
 static const struct pid_entry adi_dir_stuff[] = {
        REG("tags",     S_IRUSR | S_IWUSR, proc_tag_operations),
+       REG("maps",     S_IRUGO, proc_adi_maps_operations),
 };
 
 static int proc_adi_readdir(struct file *file, struct dir_context *ctx)
index 77010bda9dc24b1b756091e90e0651518d4519df..65660d2a7e216e4be5c5a7f05744a84f759c6751 100644 (file)
@@ -334,6 +334,7 @@ extern const struct file_operations proc_pid_smaps_operations;
 extern const struct file_operations proc_tid_smaps_operations;
 extern const struct file_operations proc_clear_refs_operations;
 extern const struct file_operations proc_pagemap_operations;
+extern const struct file_operations proc_adi_maps_operations;
 
 extern unsigned long task_vsize(struct mm_struct *);
 extern unsigned long task_statm(struct mm_struct *,
index d0930d112b25ebf7102740545e298fa70a05060d..7b22fa650450c0a747a8144fa047f21fe5feda27 100644 (file)
@@ -1620,4 +1620,39 @@ const struct file_operations proc_tid_numa_maps_operations = {
        .llseek         = seq_lseek,
        .release        = proc_map_release,
 };
+
+#ifdef CONFIG_SPARC64
+static int show_adi_map(struct seq_file *m, struct vm_area_struct *vma)
+{
+       if (vma->vm_flags & VM_SPARC_ADI)
+               return show_map(m, vma, 1);
+
+       return 0;
+}
+
+static int show_pid_adi_map(struct seq_file *m, void *v)
+{
+       return show_adi_map(m, v);
+}
+
+static const struct seq_operations proc_pid_adi_maps_op = {
+       .start          = m_start,
+       .next           = m_next,
+       .stop           = m_stop,
+       .show           = show_pid_adi_map,
+};
+
+static int pid_adi_maps_open(struct inode *inode, struct file *file)
+{
+       return do_maps_open(inode, file, &proc_pid_adi_maps_op);
+}
+
+const struct file_operations proc_adi_maps_operations = {
+       .open           = pid_adi_maps_open,
+       .read           = seq_read,
+       .llseek         = seq_lseek,
+       .release        = proc_map_release,
+};
+
+#endif
 #endif /* CONFIG_NUMA */