]> www.infradead.org Git - users/jedix/linux-maple.git/commitdiff
sparc64: Add sensible read values for /proc/<pid>/sparc_adi
authorKhalid Aziz <khalid.aziz@oracle.com>
Fri, 2 Dec 2016 19:45:37 +0000 (12:45 -0700)
committerChuck Anderson <chuck.anderson@oracle.com>
Thu, 9 Mar 2017 03:30:17 +0000 (19:30 -0800)
This patch makes value read from /proc/<pid>/sparc_adi consistent
across platforms that support ADi and ones that do not. When ADI is
not available for a process either due to process being an anonymous
process on an ADI-capable platform or the process is running on a
non-ADI platform, a read from /proc/<pid>/sparc_adi always reads a
value of -1. This patch updates the documentation file as well with
the values for sparc_adi proc file.

Orabug: 25173120

Signed-off-by: Khalid Aziz <khalid.aziz@oracle.com>
Signed-off-by: Allen Pais <allen.pais@oracle.com>
Documentation/sparc/adi.txt
fs/proc/base.c

index 1740f8ac3f2cba5b6b6fe9687bae3d8fcdfbb3f4..2f25edcf2906c1f6357606be2cd390f842f8a93e 100644 (file)
@@ -148,6 +148,25 @@ MCD disabled
                siginfo.si_trapno = 0;
 
 
+ADI specific proc files
+-----------------------
+
+ADI feature adds two new proc files:
+
+/proc/sys/kernel/mcd_on_by_default
+       This file indicates if TTE.mcd (and hence ADI) will be enabled by
+       default for a new task. Reading from the file returns current value
+       which can be changed by writing to this file.
+
+/proc/<pid>/sparc_adi
+       This file reports the current state of ADI for the process. A
+       value of 1 means ADI si enabled currently for the process, a
+       value of 0 means ADI is not enabled currently for the process,
+       and a value of -1 means ADI is not available to the process.
+       Writing to this file, when ADI is available, changes the current
+       state of ADI for theprocess.
+
+
 Sample program to use ADI
 -------------------------
 
index 47f05bf4e7dc39b53f0cb4c09eca5a50bb7f7c41..867206e142318a669d9a050a4827478327f07ce1 100644 (file)
@@ -1309,21 +1309,22 @@ sparc_adi_show(struct seq_file *m, void *v)
        if (!task)
                return -ENOENT;
 
-       if (!adi_capable())
-               return -ENOTSUPP;
-
-       task_lock(task);
-
-       /* anonymous processes can not use ADI */
-       if (task->mm) {
-               struct pt_regs *regs;
-               regs = task_pt_regs(task);
-               seq_printf(m, "%d\n", !!(regs->tstate & TSTATE_MCDE));
-       } else
+       if (!adi_capable()) {
                seq_printf(m, "-1\n");
+       } else {
+               task_lock(task);
 
-       task_unlock(task);
-       put_task_struct(task);
+               /* anonymous processes can not use ADI */
+               if (task->mm) {
+                       struct pt_regs *regs;
+                       regs = task_pt_regs(task);
+                       seq_printf(m, "%d\n", !!(regs->tstate & TSTATE_MCDE));
+               } else
+                       seq_printf(m, "-1\n");
+
+               task_unlock(task);
+               put_task_struct(task);
+       }
        return 0;
 }