@@ -16,6 +16,7 @@
#include <linux/init.h>
#include <linux/smp.h>
#include <linux/of.h>
+#include <linux/delay.h>
#include <uapi/linux/psci.h>
#include <asm/psci.h>
@@ -70,22 +71,23 @@ void __ref psci_cpu_die(unsigned int cpu)
int __ref psci_cpu_kill(unsigned int cpu)
{
- int err, retries;
+ int err, retry = 0;
if (!psci_ops.affinity_info)
return 1;
/*
* cpu_kill could race with cpu_die and we can
* potentially end up declaring this cpu undead
- * while it is dying. So retry a couple of times.
+ * while it is dying. So, try once more if it fails.
*/
-retry:
+retry_once:
err = psci_ops.affinity_info(cpu_logical_map(cpu), 0);
if (err != PSCI_AFFINITY_INFO_RET_OFF) {
- if (++retries < 3) {
- pr_info("Retrying check for CPU kill: %d\n", retries);
- goto retry;
+ if (!retry++) {
+ msleep(100);
+ pr_info("Retrying once more to check for CPU kill\n");
+ goto retry_once;
}
pr_err("psci: Cannot kill CPU:%d, psci ret val: %d\n",
cpu, err);