linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
From: Juliet Kim<julietk@linux.ibm.com>
To: linuxppc-dev@lists.ozlabs.org
Cc: nathanl@linux.ibm.com, mmc@linux.ibm.com, mwb@linux.ibm.com
Subject: [PATCH]powerpc/mobility: Serialize PRRN and LPM in device tree update
Date: Fri, 26 Apr 2019 15:19:39 -0400	[thread overview]
Message-ID: <5cc359cb.vtkUQVWEs1xLqLLf%julietk@linux.ibm.com> (raw)

Fix extending start/stop topology update scope during LPM
Commit 65b9fdadfc4d ("powerpc/pseries/mobility: Extend start/stop
topology update scope") made the change to the duration that 
topology updates are suppressed during LPM to allow the complete 
device tree update which leaves the property update notifier
unregistered until device tree update completes. This prevents
topology update during LPM.  

Instead, use mutex_lock, which serializes LPM and PRRN operation 
in pseries_devicetree_update.

Signed-off-by: Juliet Kim <julietk@linux.ibm.com>

 arch/powerpc/platforms/pseries/mobility.c | 17 +++++++++++++----
 1 file changed, 13 insertions(+), 4 deletions(-)

diff --git a/arch/powerpc/platforms/pseries/mobility.c b/arch/powerpc/platforms/pseries/mobility.c
index 88925f8ca8a0..3a79ded056fd 100644
--- a/arch/powerpc/platforms/pseries/mobility.c
+++ b/arch/powerpc/platforms/pseries/mobility.c
@@ -42,6 +42,8 @@ struct update_props_workarea {
 #define MIGRATION_SCOPE	(1)
 #define PRRN_SCOPE -2
 
+static DEFINE_MUTEX(dt_affinity_mutex);
+
 static int mobility_rtas_call(int token, char *buf, s32 scope)
 {
 	int rc;
@@ -270,13 +272,19 @@ int pseries_devicetree_update(s32 scope)
 	int update_nodes_token;
 	int rc;
 
+	mutex_lock(&dt_affinity_mutex);
+
 	update_nodes_token = rtas_token("ibm,update-nodes");
-	if (update_nodes_token == RTAS_UNKNOWN_SERVICE)
+	if (update_nodes_token == RTAS_UNKNOWN_SERVICE) {
+		mutex_unlock(&dt_affinity_mutex);
 		return -EINVAL;
+	}
 
 	rtas_buf = kzalloc(RTAS_DATA_BUF_SIZE, GFP_KERNEL);
-	if (!rtas_buf)
+	if (!rtas_buf) {
+		mutex_unlock(&dt_affinity_mutex);
 		return -ENOMEM;
+	}
 
 	do {
 		rc = mobility_rtas_call(update_nodes_token, rtas_buf, scope);
@@ -316,6 +324,7 @@ int pseries_devicetree_update(s32 scope)
 	} while (rc == 1);
 
 	kfree(rtas_buf);
+	mutex_unlock(&dt_affinity_mutex);
 	return rc;
 }
 
@@ -371,10 +380,10 @@ static ssize_t migration_store(struct class *class,
 	if (rc)
 		return rc;
 
-	post_mobility_fixup();
-
 	start_topology_update();
 
+	post_mobility_fixup();
+
 	return count;
 }
 
-- 
2.12.3


             reply	other threads:[~2019-04-27  5:13 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-04-26 19:19 Juliet Kim [this message]
  -- strict thread matches above, loose matches on Subject: below --
2019-04-26 19:20 [PATCH]powerpc/mobility: Serialize PRRN and LPM in device tree update Juliet Kim
2019-05-06 17:14 ` Nathan Lynch
2019-05-07 20:47   ` Juliet Kim
2019-04-26 19:06 Juliet Kim
2019-04-26 16:08 Juilet Kim
2019-04-26  4:32 Juilet Kim

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=5cc359cb.vtkUQVWEs1xLqLLf%julietk@linux.ibm.com \
    --to=julietk@linux.ibm.com \
    --cc=linuxppc-dev@lists.ozlabs.org \
    --cc=mmc@linux.ibm.com \
    --cc=mwb@linux.ibm.com \
    --cc=nathanl@linux.ibm.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).