lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-Id: <20220510144219.806391-2-y.oudjana@protonmail.com>
Date:   Tue, 10 May 2022 18:42:18 +0400
From:   Yassine Oudjana <yassine.oudjana@...il.com>
To:     Andy Gross <agross@...nel.org>,
        Bjorn Andersson <bjorn.andersson@...aro.org>,
        Mathieu Poirier <mathieu.poirier@...aro.org>,
        Srinivas Kandagatla <srinivas.kandagatla@...aro.org>
Cc:     Yassine Oudjana <y.oudjana@...tonmail.com>,
        Yassine Oudjana <yassine.oudjana@...il.com>,
        linux-arm-msm@...r.kernel.org, linux-remoteproc@...r.kernel.org,
        linux-kernel@...r.kernel.org, alsa-devel@...a-project.org
Subject: [RFC PATCH 1/2] remoteproc: qcom: Report last event on SSR notifier registration

From: Yassine Oudjana <y.oudjana@...tonmail.com>

Keep track of the last SSR event of a remoteproc, then report it
to each newly registered notifier block. This prevents drivers
from waiting indefinitely for an event that has already happened
before they registered their notifier blocks.

Fixes: a899d324863a3 ("slimbus: qcom-ngd-ctrl: add Sub System Restart support")
Signed-off-by: Yassine Oudjana <y.oudjana@...tonmail.com>
---
 drivers/remoteproc/qcom_common.c | 17 +++++++++++++----
 1 file changed, 13 insertions(+), 4 deletions(-)

diff --git a/drivers/remoteproc/qcom_common.c b/drivers/remoteproc/qcom_common.c
index 4b91e3c9eafa..ff85ea564129 100644
--- a/drivers/remoteproc/qcom_common.c
+++ b/drivers/remoteproc/qcom_common.c
@@ -85,6 +85,7 @@ struct qcom_ssr_subsystem {
 	const char *name;
 	struct srcu_notifier_head notifier_list;
 	struct list_head list;
+	enum qcom_ssr_notify_type current_state;
 };
 
 static LIST_HEAD(qcom_ssr_subsystem_list);
@@ -392,6 +393,9 @@ void *qcom_register_ssr_notifier(const char *name, struct notifier_block *nb)
 
 	srcu_notifier_chain_register(&info->notifier_list, nb);
 
+	/* Notify newly registered notifier block of current remoteproc state */
+	nb->notifier_call(nb, info->current_state, NULL);
+
 	return &info->notifier_list;
 }
 EXPORT_SYMBOL_GPL(qcom_register_ssr_notifier);
@@ -420,8 +424,9 @@ static int ssr_notify_prepare(struct rproc_subdev *subdev)
 		.crashed = false,
 	};
 
+	ssr->info->current_state = QCOM_SSR_BEFORE_POWERUP;
 	srcu_notifier_call_chain(&ssr->info->notifier_list,
-				 QCOM_SSR_BEFORE_POWERUP, &data);
+				 ssr->info->current_state, &data);
 	return 0;
 }
 
@@ -433,8 +438,9 @@ static int ssr_notify_start(struct rproc_subdev *subdev)
 		.crashed = false,
 	};
 
+	ssr->info->current_state = QCOM_SSR_AFTER_POWERUP;
 	srcu_notifier_call_chain(&ssr->info->notifier_list,
-				 QCOM_SSR_AFTER_POWERUP, &data);
+				 ssr->info->current_state, &data);
 	return 0;
 }
 
@@ -446,8 +452,9 @@ static void ssr_notify_stop(struct rproc_subdev *subdev, bool crashed)
 		.crashed = crashed,
 	};
 
+	ssr->info->current_state = QCOM_SSR_BEFORE_SHUTDOWN;
 	srcu_notifier_call_chain(&ssr->info->notifier_list,
-				 QCOM_SSR_BEFORE_SHUTDOWN, &data);
+				 ssr->info->current_state, &data);
 }
 
 static void ssr_notify_unprepare(struct rproc_subdev *subdev)
@@ -458,8 +465,9 @@ static void ssr_notify_unprepare(struct rproc_subdev *subdev)
 		.crashed = false,
 	};
 
+	ssr->info->current_state = QCOM_SSR_AFTER_SHUTDOWN;
 	srcu_notifier_call_chain(&ssr->info->notifier_list,
-				 QCOM_SSR_AFTER_SHUTDOWN, &data);
+				 ssr->info->current_state, &data);
 }
 
 /**
@@ -484,6 +492,7 @@ void qcom_add_ssr_subdev(struct rproc *rproc, struct qcom_rproc_ssr *ssr,
 	}
 
 	ssr->info = info;
+	ssr->info->current_state = QCOM_SSR_BEFORE_POWERUP;
 	ssr->subdev.prepare = ssr_notify_prepare;
 	ssr->subdev.start = ssr_notify_start;
 	ssr->subdev.stop = ssr_notify_stop;
-- 
2.36.0

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ