linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
From: Anshuman Khandual <khandual@linux.vnet.ibm.com>
To: linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org
Cc: mikey@neuling.org, shuahkh@osg.samsung.com, anton@samba.org
Subject: [PATCH V2 04/12] powerpc, dscr: Added some in-code documentation
Date: Tue, 13 Jan 2015 15:52:32 +0530	[thread overview]
Message-ID: <1421144560-15901-5-git-send-email-khandual@linux.vnet.ibm.com> (raw)
In-Reply-To: <1421144560-15901-1-git-send-email-khandual@linux.vnet.ibm.com>

This patch adds some in-code documentation to the DSCR related
code to make it more readable without having any functional
change to it.

Signed-off-by: Anshuman Khandual <khandual@linux.vnet.ibm.com>
---
 arch/powerpc/include/asm/processor.h |  9 +++++++++
 arch/powerpc/kernel/sysfs.c          | 38 ++++++++++++++++++++++++++++++++++++
 2 files changed, 47 insertions(+)

diff --git a/arch/powerpc/include/asm/processor.h b/arch/powerpc/include/asm/processor.h
index bf117d8..28ded5d 100644
--- a/arch/powerpc/include/asm/processor.h
+++ b/arch/powerpc/include/asm/processor.h
@@ -295,6 +295,15 @@ struct thread_struct {
 #endif
 #ifdef CONFIG_PPC64
 	unsigned long	dscr;
+	/*
+	 * This member element dscr_inherit indicates that the process
+	 * has explicitly attempted and changed the DSCR register value
+	 * for itself. Hence kernel wont use the default CPU DSCR value
+	 * contained in the PACA structure anymore during process context
+	 * switch. Once this variable is set, this behaviour will also be
+	 * inherited to all the children of this process from that point
+	 * onwards.
+	 */
 	int		dscr_inherit;
 	unsigned long	ppr;	/* used to save/restore SMT priority */
 #endif
diff --git a/arch/powerpc/kernel/sysfs.c b/arch/powerpc/kernel/sysfs.c
index fa1fd8a..692873b 100644
--- a/arch/powerpc/kernel/sysfs.c
+++ b/arch/powerpc/kernel/sysfs.c
@@ -496,13 +496,34 @@ static DEVICE_ATTR(spurr, 0400, show_spurr, NULL);
 static DEVICE_ATTR(purr, 0400, show_purr, store_purr);
 static DEVICE_ATTR(pir, 0400, show_pir, NULL);
 
+/*
+ * This is the system wide DSCR register default value. Any
+ * change to this default value through the sysfs interface
+ * will update all per cpu DSCR default values across the
+ * system stored in their respective PACA structures.
+ */
 static unsigned long dscr_default;
 
+/**
+ * read_dscr() - Fetch the cpu specific DSCR default
+ * @val:	Returned cpu specific DSCR default value
+ *
+ * This function returns the per cpu DSCR default value
+ * for any cpu which is contained in it's PACA structure.
+ */
 static void read_dscr(void *val)
 {
 	*(unsigned long *)val = get_paca()->dscr_default;
 }
 
+
+/**
+ * write_dscr() - Update the cpu specific DSCR default
+ * @val:	New cpu specific DSCR default value to update
+ *
+ * This function updates the per cpu DSCR default value
+ * for any cpu which is contained in it's PACA structure.
+ */
 static void write_dscr(void *val)
 {
 	get_paca()->dscr_default = *(unsigned long *)val;
@@ -520,12 +541,29 @@ static void add_write_permission_dev_attr(struct device_attribute *attr)
 	attr->attr.mode |= 0200;
 }
 
+/**
+ * show_dscr_default() - Fetch the system wide DSCR default
+ * @dev:	Device structure
+ * @attr:	Device attribute structure
+ * @buf:	Interface buffer
+ *
+ * This function returns the system wide DSCR default value.
+ */
 static ssize_t show_dscr_default(struct device *dev,
 		struct device_attribute *attr, char *buf)
 {
 	return sprintf(buf, "%lx\n", dscr_default);
 }
 
+/**
+ * store_dscr_default() - Update the system wide DSCR default
+ * @dev:	Device structure
+ * @attr:	Device attribute structure
+ * @buf:	Interface buffer
+ * @count:	Size of the update
+ *
+ * This function updates the system wide DSCR default value.
+ */
 static ssize_t __used store_dscr_default(struct device *dev,
 		struct device_attribute *attr, const char *buf,
 		size_t count)
-- 
1.9.3

  parent reply	other threads:[~2015-01-13 10:23 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-01-13 10:22 [PATCH V2 00/12] POWER DSCR fixes, improvements, docs and tests Anshuman Khandual
2015-01-13 10:22 ` [PATCH V2 01/12] powerpc: Fix handling of DSCR related facility unavailable exception Anshuman Khandual
2015-01-13 10:22 ` [PATCH V2 02/12] powerpc, process: Remove the unused extern dscr_default Anshuman Khandual
2015-01-13 10:22 ` [PATCH V2 03/12] powerpc, offset: Change PACA_DSCR to PACA_DSCR_DEFAULT Anshuman Khandual
2015-01-13 10:22 ` Anshuman Khandual [this message]
2015-01-13 10:22 ` [PATCH V2 05/12] documentation, powerpc: Add documentation for DSCR support Anshuman Khandual
2015-01-13 10:22 ` [PATCH V2 06/12] selftests, powerpc: Add test for system wide DSCR default Anshuman Khandual
2015-01-13 15:22   ` Shuah Khan
2015-01-13 23:44     ` Michael Ellerman
2015-01-20 21:40       ` Dave Jones
2015-01-21  6:51         ` Michael Ellerman
2015-03-27 12:01   ` [V2, " Michael Ellerman
2015-04-09 10:31     ` Anshuman Khandual
2015-04-09 12:38       ` Anshuman Khandual
2015-01-13 10:22 ` [PATCH V2 07/12] selftests, powerpc: Add test for explicitly changing DSCR value Anshuman Khandual
2015-01-13 15:23   ` Shuah Khan
2015-01-13 10:22 ` [PATCH V2 08/12] selftests, powerpc: Add test for DSCR SPR numbers Anshuman Khandual
2015-01-13 15:23   ` Shuah Khan
2015-01-13 10:22 ` [PATCH V2 09/12] selftests, powerpc: Add test for DSCR value inheritence across fork Anshuman Khandual
2015-01-13 15:24   ` Shuah Khan
2015-01-13 10:22 ` [PATCH V2 10/12] selftests, powerpc: Add test for DSCR inheritence across fork & exec Anshuman Khandual
2015-01-13 15:24   ` Shuah Khan
2015-01-13 10:22 ` [PATCH V2 11/12] selftests, powerpc: Add test for all DSCR sysfs interfaces Anshuman Khandual
2015-01-13 15:24   ` Shuah Khan
2015-01-13 10:22 ` [PATCH V2 12/12] selftests, powerpc: Add thread based stress test for " Anshuman Khandual
2015-01-13 15:24   ` Shuah Khan
2015-02-04  8:21 ` [PATCH V2 00/12] POWER DSCR fixes, improvements, docs and tests Anshuman Khandual
2015-02-04  8:36   ` Anshuman Khandual

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1421144560-15901-5-git-send-email-khandual@linux.vnet.ibm.com \
    --to=khandual@linux.vnet.ibm.com \
    --cc=anton@samba.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linuxppc-dev@lists.ozlabs.org \
    --cc=mikey@neuling.org \
    --cc=shuahkh@osg.samsung.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).