linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v3 0/3] powerpc/pseries: fix issues in suspend/resume code
@ 2014-01-31 23:58 Tyrel Datwyler
  2014-01-31 23:58 ` [PATCH v3 1/3] powerpc/pseries: Device tree should only be updated once after suspend/migrate Tyrel Datwyler
                   ` (3 more replies)
  0 siblings, 4 replies; 10+ messages in thread
From: Tyrel Datwyler @ 2014-01-31 23:58 UTC (permalink / raw)
  To: linuxppc-dev; +Cc: nfont, Tyrel Datwyler

This patchset fixes a couple of issues encountered in the suspend/resume code
base. First when using the kernel device tree update code update-nodes is
unnecessarily called more than once. Second the cpu cache lists are not
updated after a suspend/resume which under certain conditions may cause a
panic. Finally, since the cache list fix utilzes in kernel device tree update
code a means for telling drmgr not to perform a device tree update from
userspace is required.

Changes from v2:
- Moved dynamic configuration update code into pseries specific routine
  per Nathan's suggestion.

Changes from v1:
- Fixed several commit message typos
- Fixed authorship of first two patches

Haren Myneni (2):
  powerpc/pseries: Device tree should only be updated once after
    suspend/migrate
  powerpc/pseries: Update dynamic cache nodes for suspend/resume
    operation

Tyrel Datwyler (1):
  powerpc/pseries: Report in kernel device tree update to drmgr

 arch/powerpc/include/asm/rtas.h           |  1 +
 arch/powerpc/platforms/pseries/mobility.c | 26 +++++++-----------
 arch/powerpc/platforms/pseries/suspend.c  | 44 ++++++++++++++++++++++++++++++-
 3 files changed, 54 insertions(+), 17 deletions(-)

-- 
1.7.12.2

^ permalink raw reply	[flat|nested] 10+ messages in thread

* [PATCH v3 1/3] powerpc/pseries: Device tree should only be updated once after suspend/migrate
  2014-01-31 23:58 [PATCH v3 0/3] powerpc/pseries: fix issues in suspend/resume code Tyrel Datwyler
@ 2014-01-31 23:58 ` Tyrel Datwyler
  2014-01-31 23:58 ` [PATCH v3 2/3] powerpc/pseries: Update dynamic cache nodes for suspend/resume operation Tyrel Datwyler
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 10+ messages in thread
From: Tyrel Datwyler @ 2014-01-31 23:58 UTC (permalink / raw)
  To: linuxppc-dev; +Cc: nfont, Tyrel Datwyler

From: Haren Myneni <hbabu@us.ibm.com>

The current code makes rtas calls for update-nodes, activate-firmware and then
update-nodes again. The FW provides the same data for both update-nodes calls.
As a result a proc entry exists error is reported for the second update while
adding device nodes.

This patch makes a single rtas call for update-nodes after activating the FW.
It also add rtas_busy delay for the activate-firmware rtas call.

Signed-off-by: Haren Myneni <hbabu@us.ibm.com>
Signed-off-by: Tyrel Datwyler <tyreld@linux.vnet.ibm.com>
---
 arch/powerpc/platforms/pseries/mobility.c | 26 ++++++++++----------------
 1 file changed, 10 insertions(+), 16 deletions(-)

diff --git a/arch/powerpc/platforms/pseries/mobility.c b/arch/powerpc/platforms/pseries/mobility.c
index cde4e0a..bde7eba 100644
--- a/arch/powerpc/platforms/pseries/mobility.c
+++ b/arch/powerpc/platforms/pseries/mobility.c
@@ -290,13 +290,6 @@ void post_mobility_fixup(void)
 	int rc;
 	int activate_fw_token;
 
-	rc = pseries_devicetree_update(MIGRATION_SCOPE);
-	if (rc) {
-		printk(KERN_ERR "Initial post-mobility device tree update "
-		       "failed: %d\n", rc);
-		return;
-	}
-
 	activate_fw_token = rtas_token("ibm,activate-firmware");
 	if (activate_fw_token == RTAS_UNKNOWN_SERVICE) {
 		printk(KERN_ERR "Could not make post-mobility "
@@ -304,16 +297,17 @@ void post_mobility_fixup(void)
 		return;
 	}
 
-	rc = rtas_call(activate_fw_token, 0, 1, NULL);
-	if (!rc) {
-		rc = pseries_devicetree_update(MIGRATION_SCOPE);
-		if (rc)
-			printk(KERN_ERR "Secondary post-mobility device tree "
-			       "update failed: %d\n", rc);
-	} else {
+	do {
+		rc = rtas_call(activate_fw_token, 0, 1, NULL);
+	} while (rtas_busy_delay(rc));
+
+	if (rc)
 		printk(KERN_ERR "Post-mobility activate-fw failed: %d\n", rc);
-		return;
-	}
+
+	rc = pseries_devicetree_update(MIGRATION_SCOPE);
+	if (rc)
+		printk(KERN_ERR "Post-mobility device tree update "
+			"failed: %d\n", rc);
 
 	return;
 }
-- 
1.7.12.2

^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [PATCH v3 2/3] powerpc/pseries: Update dynamic cache nodes for suspend/resume operation
  2014-01-31 23:58 [PATCH v3 0/3] powerpc/pseries: fix issues in suspend/resume code Tyrel Datwyler
  2014-01-31 23:58 ` [PATCH v3 1/3] powerpc/pseries: Device tree should only be updated once after suspend/migrate Tyrel Datwyler
@ 2014-01-31 23:58 ` Tyrel Datwyler
  2014-01-31 23:58 ` [PATCH v3 3/3] powerpc/pseries: Report in kernel device tree update to drmgr Tyrel Datwyler
  2014-02-12 21:43 ` [PATCH v3 0/3] powerpc/pseries: fix issues in suspend/resume code Tyrel Datwyler
  3 siblings, 0 replies; 10+ messages in thread
From: Tyrel Datwyler @ 2014-01-31 23:58 UTC (permalink / raw)
  To: linuxppc-dev; +Cc: nfont, Tyrel Datwyler

From: Haren Myneni <hbabu@us.ibm.com>

pHyp can change cache nodes for suspend/resume operation. The current code
updates the device tree after all non boot CPUs are enabled. Hence, we do not
modify the cache list based on the latest cache nodes. Also we do not remove
cache entries for the primary CPU.

This patch removes the cache list for the boot CPU, updates the device tree
before enabling nonboot CPUs and adds cache list for the boot cpu.

Signed-off-by: Haren Myneni <hbabu@us.ibm.com>
Signed-off-by: Tyrel Datwyler <tyreld@linux.vnet.ibm.com>
---
 arch/powerpc/include/asm/rtas.h          |  1 +
 arch/powerpc/platforms/pseries/suspend.c | 19 +++++++++++++++++++
 2 files changed, 20 insertions(+)

diff --git a/arch/powerpc/include/asm/rtas.h b/arch/powerpc/include/asm/rtas.h
index 9bd52c6..a0e1add 100644
--- a/arch/powerpc/include/asm/rtas.h
+++ b/arch/powerpc/include/asm/rtas.h
@@ -283,6 +283,7 @@ extern void pSeries_log_error(char *buf, unsigned int err_type, int fatal);
 
 #ifdef CONFIG_PPC_PSERIES
 extern int pseries_devicetree_update(s32 scope);
+extern void post_mobility_fixup(void);
 #endif
 
 #ifdef CONFIG_PPC_RTAS_DAEMON
diff --git a/arch/powerpc/platforms/pseries/suspend.c b/arch/powerpc/platforms/pseries/suspend.c
index 16a2552..1d9c580 100644
--- a/arch/powerpc/platforms/pseries/suspend.c
+++ b/arch/powerpc/platforms/pseries/suspend.c
@@ -26,6 +26,7 @@
 #include <asm/mmu.h>
 #include <asm/rtas.h>
 #include <asm/topology.h>
+#include "../../kernel/cacheinfo.h"
 
 static u64 stream_id;
 static struct device suspend_dev;
@@ -79,6 +80,23 @@ static int pseries_suspend_cpu(void)
 }
 
 /**
+ * pseries_suspend_enable_irqs
+ *
+ * Post suspend configuration updates
+ *
+ **/
+static void pseries_suspend_enable_irqs(void)
+{
+	/*
+	 * Update configuration which can be modified based on device tree
+	 * changes during resume.
+	 */
+	cacheinfo_cpu_offline(smp_processor_id());
+	post_mobility_fixup();
+	cacheinfo_cpu_online(smp_processor_id());
+}
+
+/**
  * pseries_suspend_enter - Final phase of hibernation
  *
  * Return value:
@@ -235,6 +253,7 @@ static int __init pseries_suspend_init(void)
 		return rc;
 
 	ppc_md.suspend_disable_cpu = pseries_suspend_cpu;
+	ppc_md.suspend_enable_irqs = pseries_suspend_enable_irqs;
 	suspend_set_ops(&pseries_suspend_ops);
 	return 0;
 }
-- 
1.7.12.2

^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [PATCH v3 3/3] powerpc/pseries: Report in kernel device tree update to drmgr
  2014-01-31 23:58 [PATCH v3 0/3] powerpc/pseries: fix issues in suspend/resume code Tyrel Datwyler
  2014-01-31 23:58 ` [PATCH v3 1/3] powerpc/pseries: Device tree should only be updated once after suspend/migrate Tyrel Datwyler
  2014-01-31 23:58 ` [PATCH v3 2/3] powerpc/pseries: Update dynamic cache nodes for suspend/resume operation Tyrel Datwyler
@ 2014-01-31 23:58 ` Tyrel Datwyler
  2014-02-17  0:22   ` Benjamin Herrenschmidt
  2014-02-12 21:43 ` [PATCH v3 0/3] powerpc/pseries: fix issues in suspend/resume code Tyrel Datwyler
  3 siblings, 1 reply; 10+ messages in thread
From: Tyrel Datwyler @ 2014-01-31 23:58 UTC (permalink / raw)
  To: linuxppc-dev; +Cc: nfont, Tyrel Datwyler

Traditionally it has been drmgr's responsibilty to update the device tree
through the /proc/ppc64/ofdt interface after a suspend/resume operation.
This patchset however has modified suspend/resume ops to preform that update
entirely in the kernel during the resume. Therefore, a mechanism is required
for drmgr to determine who is responsible for the update. This patch adds a
show function to the "hibernate" attribute that returns 1 if the kernel
updates the device tree after the resume and 0 if drmgr is responsible.

Signed-off-by: Tyrel Datwyler <tyreld@linux.vnet.ibm.com>
---
 arch/powerpc/platforms/pseries/suspend.c | 25 ++++++++++++++++++++++++-
 1 file changed, 24 insertions(+), 1 deletion(-)

diff --git a/arch/powerpc/platforms/pseries/suspend.c b/arch/powerpc/platforms/pseries/suspend.c
index 1d9c580..b87b978 100644
--- a/arch/powerpc/platforms/pseries/suspend.c
+++ b/arch/powerpc/platforms/pseries/suspend.c
@@ -192,7 +192,30 @@ out:
 	return rc;
 }
 
-static DEVICE_ATTR(hibernate, S_IWUSR, NULL, store_hibernate);
+#define USER_DT_UPDATE	0
+#define KERN_DT_UPDATE	1
+
+/**
+ * show_hibernate - Report device tree update responsibilty
+ * @dev:		subsys root device
+ * @attr:		device attribute struct
+ * @buf:		buffer
+ *
+ * Report whether a device tree update is performed by the kernel after a
+ * resume, or if drmgr must coordinate the update from user space.
+ *
+ * Return value:
+ *	0 if drmgr is to initiate update, and 1 otherwise
+ **/
+static ssize_t show_hibernate(struct device *dev,
+			      struct device_attribute *attr,
+			      char *buf)
+{
+	return sprintf(buf, "%d\n", KERN_DT_UPDATE);
+}
+
+static DEVICE_ATTR(hibernate, S_IWUSR | S_IRUGO,
+		   show_hibernate, store_hibernate);
 
 static struct bus_type suspend_subsys = {
 	.name = "power",
-- 
1.7.12.2

^ permalink raw reply related	[flat|nested] 10+ messages in thread

* Re: [PATCH v3 0/3] powerpc/pseries: fix issues in suspend/resume code
  2014-01-31 23:58 [PATCH v3 0/3] powerpc/pseries: fix issues in suspend/resume code Tyrel Datwyler
                   ` (2 preceding siblings ...)
  2014-01-31 23:58 ` [PATCH v3 3/3] powerpc/pseries: Report in kernel device tree update to drmgr Tyrel Datwyler
@ 2014-02-12 21:43 ` Tyrel Datwyler
  3 siblings, 0 replies; 10+ messages in thread
From: Tyrel Datwyler @ 2014-02-12 21:43 UTC (permalink / raw)
  To: linuxppc-dev; +Cc: nfont, Tyrel Datwyler

On 01/31/2014 03:58 PM, Tyrel Datwyler wrote:
> This patchset fixes a couple of issues encountered in the suspend/resume code
> base. First when using the kernel device tree update code update-nodes is
> unnecessarily called more than once. Second the cpu cache lists are not
> updated after a suspend/resume which under certain conditions may cause a
> panic. Finally, since the cache list fix utilzes in kernel device tree update
> code a means for telling drmgr not to perform a device tree update from
> userspace is required.
> 
> Changes from v2:
> - Moved dynamic configuration update code into pseries specific routine
>   per Nathan's suggestion.
> 
> Changes from v1:
> - Fixed several commit message typos
> - Fixed authorship of first two patches
> 
> Haren Myneni (2):
>   powerpc/pseries: Device tree should only be updated once after
>     suspend/migrate
>   powerpc/pseries: Update dynamic cache nodes for suspend/resume
>     operation
> 
> Tyrel Datwyler (1):
>   powerpc/pseries: Report in kernel device tree update to drmgr
> 
>  arch/powerpc/include/asm/rtas.h           |  1 +
>  arch/powerpc/platforms/pseries/mobility.c | 26 +++++++-----------
>  arch/powerpc/platforms/pseries/suspend.c  | 44 ++++++++++++++++++++++++++++++-
>  3 files changed, 54 insertions(+), 17 deletions(-)
> 

Ping?

Nathan, can I at least get your ack on this v3 patchset. We really need
to get these upstream.

-Tyrel

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH v3 3/3] powerpc/pseries: Report in kernel device tree update to drmgr
  2014-01-31 23:58 ` [PATCH v3 3/3] powerpc/pseries: Report in kernel device tree update to drmgr Tyrel Datwyler
@ 2014-02-17  0:22   ` Benjamin Herrenschmidt
  2014-02-18 23:28     ` Tyrel Datwyler
  0 siblings, 1 reply; 10+ messages in thread
From: Benjamin Herrenschmidt @ 2014-02-17  0:22 UTC (permalink / raw)
  To: Tyrel Datwyler; +Cc: nfont, linuxppc-dev

On Fri, 2014-01-31 at 15:58 -0800, Tyrel Datwyler wrote:
> Traditionally it has been drmgr's responsibilty to update the device tree
> through the /proc/ppc64/ofdt interface after a suspend/resume operation.
> This patchset however has modified suspend/resume ops to preform that update
> entirely in the kernel during the resume. Therefore, a mechanism is required
> for drmgr to determine who is responsible for the update. This patch adds a
> show function to the "hibernate" attribute that returns 1 if the kernel
> updates the device tree after the resume and 0 if drmgr is responsible.

This is not right.

We cannot change the kernel behaviour in a way that is incompatible with
existing userspace, and unless you can explain me why that is not the
case, it feels like this patch set does just that ....

What happens if you have an older drmgr which still does the update
itself ?

You can't just change user visible behaviours and interface without at
least explaining why it's ok to do so at the very least (and ensuring
that of course) without breaking existing userspace.

Now it's possible that the double update caused by this series is
harmless, in which case please explain it in the changeset, I certainly
can't assume it and if it's not, you'll need some other way for drmgr to
signal the kernel to indicate it supports the new behaviour before you
enable it.

Ben.

> Signed-off-by: Tyrel Datwyler <tyreld@linux.vnet.ibm.com>
> ---
>  arch/powerpc/platforms/pseries/suspend.c | 25 ++++++++++++++++++++++++-
>  1 file changed, 24 insertions(+), 1 deletion(-)
> 
> diff --git a/arch/powerpc/platforms/pseries/suspend.c b/arch/powerpc/platforms/pseries/suspend.c
> index 1d9c580..b87b978 100644
> --- a/arch/powerpc/platforms/pseries/suspend.c
> +++ b/arch/powerpc/platforms/pseries/suspend.c
> @@ -192,7 +192,30 @@ out:
>  	return rc;
>  }
>  
> -static DEVICE_ATTR(hibernate, S_IWUSR, NULL, store_hibernate);
> +#define USER_DT_UPDATE	0
> +#define KERN_DT_UPDATE	1
> +
> +/**
> + * show_hibernate - Report device tree update responsibilty
> + * @dev:		subsys root device
> + * @attr:		device attribute struct
> + * @buf:		buffer
> + *
> + * Report whether a device tree update is performed by the kernel after a
> + * resume, or if drmgr must coordinate the update from user space.
> + *
> + * Return value:
> + *	0 if drmgr is to initiate update, and 1 otherwise
> + **/
> +static ssize_t show_hibernate(struct device *dev,
> +			      struct device_attribute *attr,
> +			      char *buf)
> +{
> +	return sprintf(buf, "%d\n", KERN_DT_UPDATE);
> +}
> +
> +static DEVICE_ATTR(hibernate, S_IWUSR | S_IRUGO,
> +		   show_hibernate, store_hibernate);
>  
>  static struct bus_type suspend_subsys = {
>  	.name = "power",

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH v3 3/3] powerpc/pseries: Report in kernel device tree update to drmgr
  2014-02-17  0:22   ` Benjamin Herrenschmidt
@ 2014-02-18 23:28     ` Tyrel Datwyler
  2014-02-18 23:47       ` Benjamin Herrenschmidt
  0 siblings, 1 reply; 10+ messages in thread
From: Tyrel Datwyler @ 2014-02-18 23:28 UTC (permalink / raw)
  To: Benjamin Herrenschmidt, Tyrel Datwyler; +Cc: nfont, linuxppc-dev

On 02/16/2014 04:22 PM, Benjamin Herrenschmidt wrote:
> On Fri, 2014-01-31 at 15:58 -0800, Tyrel Datwyler wrote:
>> Traditionally it has been drmgr's responsibilty to update the device tree
>> through the /proc/ppc64/ofdt interface after a suspend/resume operation.
>> This patchset however has modified suspend/resume ops to preform that update
>> entirely in the kernel during the resume. Therefore, a mechanism is required
>> for drmgr to determine who is responsible for the update. This patch adds a
>> show function to the "hibernate" attribute that returns 1 if the kernel
>> updates the device tree after the resume and 0 if drmgr is responsible.
> 
> This is not right.
> 
> We cannot change the kernel behaviour in a way that is incompatible with
> existing userspace, and unless you can explain me why that is not the
> case, it feels like this patch set does just that ....
> 
> What happens if you have an older drmgr which still does the update
> itself ?
> 

In this case we get a double update which I clearly neglected to mention
in the patch. The first patch in this series actually removes an
unnecessary double update from the existing kernel implementation. The
same information is returned by the update-nodes/properties call the
second time around and aside from being a waste of a few cycles is harmless.

Tyrel

> You can't just change user visible behaviours and interface without at
> least explaining why it's ok to do so at the very least (and ensuring
> that of course) without breaking existing userspace.
> 
> Now it's possible that the double update caused by this series is
> harmless, in which case please explain it in the changeset, I certainly
> can't assume it and if it's not, you'll need some other way for drmgr to
> signal the kernel to indicate it supports the new behaviour before you
> enable it.
> 
> Ben.
> 
>> Signed-off-by: Tyrel Datwyler <tyreld@linux.vnet.ibm.com>
>> ---
>>  arch/powerpc/platforms/pseries/suspend.c | 25 ++++++++++++++++++++++++-
>>  1 file changed, 24 insertions(+), 1 deletion(-)
>>
>> diff --git a/arch/powerpc/platforms/pseries/suspend.c b/arch/powerpc/platforms/pseries/suspend.c
>> index 1d9c580..b87b978 100644
>> --- a/arch/powerpc/platforms/pseries/suspend.c
>> +++ b/arch/powerpc/platforms/pseries/suspend.c
>> @@ -192,7 +192,30 @@ out:
>>  	return rc;
>>  }
>>  
>> -static DEVICE_ATTR(hibernate, S_IWUSR, NULL, store_hibernate);
>> +#define USER_DT_UPDATE	0
>> +#define KERN_DT_UPDATE	1
>> +
>> +/**
>> + * show_hibernate - Report device tree update responsibilty
>> + * @dev:		subsys root device
>> + * @attr:		device attribute struct
>> + * @buf:		buffer
>> + *
>> + * Report whether a device tree update is performed by the kernel after a
>> + * resume, or if drmgr must coordinate the update from user space.
>> + *
>> + * Return value:
>> + *	0 if drmgr is to initiate update, and 1 otherwise
>> + **/
>> +static ssize_t show_hibernate(struct device *dev,
>> +			      struct device_attribute *attr,
>> +			      char *buf)
>> +{
>> +	return sprintf(buf, "%d\n", KERN_DT_UPDATE);
>> +}
>> +
>> +static DEVICE_ATTR(hibernate, S_IWUSR | S_IRUGO,
>> +		   show_hibernate, store_hibernate);
>>  
>>  static struct bus_type suspend_subsys = {
>>  	.name = "power",
> 
> 
> _______________________________________________
> Linuxppc-dev mailing list
> Linuxppc-dev@lists.ozlabs.org
> https://lists.ozlabs.org/listinfo/linuxppc-dev
> 

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH v3 3/3] powerpc/pseries: Report in kernel device tree update to drmgr
  2014-02-18 23:28     ` Tyrel Datwyler
@ 2014-02-18 23:47       ` Benjamin Herrenschmidt
  0 siblings, 0 replies; 10+ messages in thread
From: Benjamin Herrenschmidt @ 2014-02-18 23:47 UTC (permalink / raw)
  To: Tyrel Datwyler; +Cc: nfont, linuxppc-dev, Tyrel Datwyler

On Tue, 2014-02-18 at 15:28 -0800, Tyrel Datwyler wrote:
> In this case we get a double update which I clearly neglected to
> mention
> in the patch. The first patch in this series actually removes an
> unnecessary double update from the existing kernel implementation. The
> same information is returned by the update-nodes/properties call the
> second time around and aside from being a waste of a few cycles is
> harmless.

Thanks. Can you resend the patches with updated descriptions ? I will
try to send them to Linus by end of week.

Cheers,
Ben.

^ permalink raw reply	[flat|nested] 10+ messages in thread

* [PATCH v3 3/3] powerpc/pseries: Report in kernel device tree update to drmgr
  2014-02-19 20:56 [PATCH v4 " Tyrel Datwyler
@ 2014-02-19 20:56 ` Tyrel Datwyler
  2014-02-19 22:07   ` Tyrel Datwyler
  0 siblings, 1 reply; 10+ messages in thread
From: Tyrel Datwyler @ 2014-02-19 20:56 UTC (permalink / raw)
  To: benh; +Cc: nfont, linuxppc-dev, Tyrel Datwyler

Traditionally it has been drmgr's responsibilty to update the device tree
through the /proc/ppc64/ofdt interface after a suspend/resume operation.
This patchset however has modified suspend/resume ops to preform that update
entirely in the kernel during the resume. Therefore, a mechanism is required
for drmgr to determine who is responsible for the update. This patch adds a
show function to the "hibernate" attribute that returns 1 if the kernel
updates the device tree after the resume and 0 if drmgr is responsible.

Signed-off-by: Tyrel Datwyler <tyreld@linux.vnet.ibm.com>
---
 arch/powerpc/platforms/pseries/suspend.c | 25 ++++++++++++++++++++++++-
 1 file changed, 24 insertions(+), 1 deletion(-)

diff --git a/arch/powerpc/platforms/pseries/suspend.c b/arch/powerpc/platforms/pseries/suspend.c
index 1d9c580..b87b978 100644
--- a/arch/powerpc/platforms/pseries/suspend.c
+++ b/arch/powerpc/platforms/pseries/suspend.c
@@ -192,7 +192,30 @@ out:
 	return rc;
 }
 
-static DEVICE_ATTR(hibernate, S_IWUSR, NULL, store_hibernate);
+#define USER_DT_UPDATE	0
+#define KERN_DT_UPDATE	1
+
+/**
+ * show_hibernate - Report device tree update responsibilty
+ * @dev:		subsys root device
+ * @attr:		device attribute struct
+ * @buf:		buffer
+ *
+ * Report whether a device tree update is performed by the kernel after a
+ * resume, or if drmgr must coordinate the update from user space.
+ *
+ * Return value:
+ *	0 if drmgr is to initiate update, and 1 otherwise
+ **/
+static ssize_t show_hibernate(struct device *dev,
+			      struct device_attribute *attr,
+			      char *buf)
+{
+	return sprintf(buf, "%d\n", KERN_DT_UPDATE);
+}
+
+static DEVICE_ATTR(hibernate, S_IWUSR | S_IRUGO,
+		   show_hibernate, store_hibernate);
 
 static struct bus_type suspend_subsys = {
 	.name = "power",
-- 
1.7.12.2

^ permalink raw reply related	[flat|nested] 10+ messages in thread

* Re: [PATCH v3 3/3] powerpc/pseries: Report in kernel device tree update to drmgr
  2014-02-19 20:56 ` [PATCH v3 3/3] powerpc/pseries: Report in kernel device tree update to drmgr Tyrel Datwyler
@ 2014-02-19 22:07   ` Tyrel Datwyler
  0 siblings, 0 replies; 10+ messages in thread
From: Tyrel Datwyler @ 2014-02-19 22:07 UTC (permalink / raw)
  To: benh; +Cc: nfont, linuxppc-dev, Tyrel Datwyler

On 02/19/2014 12:56 PM, Tyrel Datwyler wrote:
> Traditionally it has been drmgr's responsibilty to update the device tree
> through the /proc/ppc64/ofdt interface after a suspend/resume operation.
> This patchset however has modified suspend/resume ops to preform that update
> entirely in the kernel during the resume. Therefore, a mechanism is required
> for drmgr to determine who is responsible for the update. This patch adds a
> show function to the "hibernate" attribute that returns 1 if the kernel
> updates the device tree after the resume and 0 if drmgr is responsible.

Ignore this one. Apparently, I forgot to clear it out of my patch
directory before I resent.

> 
> Signed-off-by: Tyrel Datwyler <tyreld@linux.vnet.ibm.com>
> ---
>  arch/powerpc/platforms/pseries/suspend.c | 25 ++++++++++++++++++++++++-
>  1 file changed, 24 insertions(+), 1 deletion(-)
> 
> diff --git a/arch/powerpc/platforms/pseries/suspend.c b/arch/powerpc/platforms/pseries/suspend.c
> index 1d9c580..b87b978 100644
> --- a/arch/powerpc/platforms/pseries/suspend.c
> +++ b/arch/powerpc/platforms/pseries/suspend.c
> @@ -192,7 +192,30 @@ out:
>  	return rc;
>  }
> 
> -static DEVICE_ATTR(hibernate, S_IWUSR, NULL, store_hibernate);
> +#define USER_DT_UPDATE	0
> +#define KERN_DT_UPDATE	1
> +
> +/**
> + * show_hibernate - Report device tree update responsibilty
> + * @dev:		subsys root device
> + * @attr:		device attribute struct
> + * @buf:		buffer
> + *
> + * Report whether a device tree update is performed by the kernel after a
> + * resume, or if drmgr must coordinate the update from user space.
> + *
> + * Return value:
> + *	0 if drmgr is to initiate update, and 1 otherwise
> + **/
> +static ssize_t show_hibernate(struct device *dev,
> +			      struct device_attribute *attr,
> +			      char *buf)
> +{
> +	return sprintf(buf, "%d\n", KERN_DT_UPDATE);
> +}
> +
> +static DEVICE_ATTR(hibernate, S_IWUSR | S_IRUGO,
> +		   show_hibernate, store_hibernate);
> 
>  static struct bus_type suspend_subsys = {
>  	.name = "power",
> 

^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2014-02-19 22:07 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-01-31 23:58 [PATCH v3 0/3] powerpc/pseries: fix issues in suspend/resume code Tyrel Datwyler
2014-01-31 23:58 ` [PATCH v3 1/3] powerpc/pseries: Device tree should only be updated once after suspend/migrate Tyrel Datwyler
2014-01-31 23:58 ` [PATCH v3 2/3] powerpc/pseries: Update dynamic cache nodes for suspend/resume operation Tyrel Datwyler
2014-01-31 23:58 ` [PATCH v3 3/3] powerpc/pseries: Report in kernel device tree update to drmgr Tyrel Datwyler
2014-02-17  0:22   ` Benjamin Herrenschmidt
2014-02-18 23:28     ` Tyrel Datwyler
2014-02-18 23:47       ` Benjamin Herrenschmidt
2014-02-12 21:43 ` [PATCH v3 0/3] powerpc/pseries: fix issues in suspend/resume code Tyrel Datwyler
  -- strict thread matches above, loose matches on Subject: below --
2014-02-19 20:56 [PATCH v4 " Tyrel Datwyler
2014-02-19 20:56 ` [PATCH v3 3/3] powerpc/pseries: Report in kernel device tree update to drmgr Tyrel Datwyler
2014-02-19 22:07   ` Tyrel Datwyler

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).