From: Russell King <rmk+kernel@armlinux.org.uk>
To: Tony Lindgren <tony@atomide.com>, linux-arm-kernel@lists.infradead.org
Cc: Rajendra Nayak <rnayak@codeaurora.org>,
Paul Walmsley <paul@pwsan.com>,
linux-omap@vger.kernel.org, Will Deacon <will.deacon@arm.com>
Subject: [PATCH] ARM: avoid Cortex-A9 livelock on tight dmb loops
Date: Tue, 10 Apr 2018 11:41:49 +0100 [thread overview]
Message-ID: <E1f5qij-00033R-Sl@rmk-PC.armlinux.org.uk> (raw)
Executing loops such as:
while (1)
cpu_relax();
with interrupts disabled results in a livelock of the entire system,
as other CPUs are prevented making progress. This is most noticable
as a failure of crashdump kexec, which stops just after issuing:
Loading crashdump kernel...
to the system console. Two other locations of these loops within the
ARM code have been identified and fixed up.
Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk>
---
arch/arm/kernel/machine_kexec.c | 3 ++-
arch/arm/kernel/smp.c | 2 +-
arch/arm/mach-omap2/prm_common.c | 2 +-
3 files changed, 4 insertions(+), 3 deletions(-)
diff --git a/arch/arm/kernel/machine_kexec.c b/arch/arm/kernel/machine_kexec.c
index 6b38d7a634c1..75d4f5ce6cfd 100644
--- a/arch/arm/kernel/machine_kexec.c
+++ b/arch/arm/kernel/machine_kexec.c
@@ -91,8 +91,9 @@ void machine_crash_nonpanic_core(void *unused)
set_cpu_online(smp_processor_id(), false);
atomic_dec(&waiting_for_crash_ipi);
+
while (1)
- cpu_relax();
+ cpu_do_idle();
}
static void machine_kexec_mask_interrupts(void)
diff --git a/arch/arm/kernel/smp.c b/arch/arm/kernel/smp.c
index 5c7ec00a500e..cbaba4a15a3a 100644
--- a/arch/arm/kernel/smp.c
+++ b/arch/arm/kernel/smp.c
@@ -568,7 +568,7 @@ static void ipi_cpu_stop(unsigned int cpu)
local_irq_disable();
while (1)
- cpu_relax();
+ cpu_do_idle();
}
static DEFINE_PER_CPU(struct completion *, cpu_completion);
diff --git a/arch/arm/mach-omap2/prm_common.c b/arch/arm/mach-omap2/prm_common.c
index 021b5a8b9c0a..d4ddc78b2a0b 100644
--- a/arch/arm/mach-omap2/prm_common.c
+++ b/arch/arm/mach-omap2/prm_common.c
@@ -523,7 +523,7 @@ void omap_prm_reset_system(void)
prm_ll_data->reset_system();
while (1)
- cpu_relax();
+ cpu_do_idle();
}
/**
--
2.7.4
WARNING: multiple messages have this Message-ID (diff)
From: rmk+kernel@armlinux.org.uk (Russell King)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH] ARM: avoid Cortex-A9 livelock on tight dmb loops
Date: Tue, 10 Apr 2018 11:41:49 +0100 [thread overview]
Message-ID: <E1f5qij-00033R-Sl@rmk-PC.armlinux.org.uk> (raw)
Executing loops such as:
while (1)
cpu_relax();
with interrupts disabled results in a livelock of the entire system,
as other CPUs are prevented making progress. This is most noticable
as a failure of crashdump kexec, which stops just after issuing:
Loading crashdump kernel...
to the system console. Two other locations of these loops within the
ARM code have been identified and fixed up.
Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk>
---
arch/arm/kernel/machine_kexec.c | 3 ++-
arch/arm/kernel/smp.c | 2 +-
arch/arm/mach-omap2/prm_common.c | 2 +-
3 files changed, 4 insertions(+), 3 deletions(-)
diff --git a/arch/arm/kernel/machine_kexec.c b/arch/arm/kernel/machine_kexec.c
index 6b38d7a634c1..75d4f5ce6cfd 100644
--- a/arch/arm/kernel/machine_kexec.c
+++ b/arch/arm/kernel/machine_kexec.c
@@ -91,8 +91,9 @@ void machine_crash_nonpanic_core(void *unused)
set_cpu_online(smp_processor_id(), false);
atomic_dec(&waiting_for_crash_ipi);
+
while (1)
- cpu_relax();
+ cpu_do_idle();
}
static void machine_kexec_mask_interrupts(void)
diff --git a/arch/arm/kernel/smp.c b/arch/arm/kernel/smp.c
index 5c7ec00a500e..cbaba4a15a3a 100644
--- a/arch/arm/kernel/smp.c
+++ b/arch/arm/kernel/smp.c
@@ -568,7 +568,7 @@ static void ipi_cpu_stop(unsigned int cpu)
local_irq_disable();
while (1)
- cpu_relax();
+ cpu_do_idle();
}
static DEFINE_PER_CPU(struct completion *, cpu_completion);
diff --git a/arch/arm/mach-omap2/prm_common.c b/arch/arm/mach-omap2/prm_common.c
index 021b5a8b9c0a..d4ddc78b2a0b 100644
--- a/arch/arm/mach-omap2/prm_common.c
+++ b/arch/arm/mach-omap2/prm_common.c
@@ -523,7 +523,7 @@ void omap_prm_reset_system(void)
prm_ll_data->reset_system();
while (1)
- cpu_relax();
+ cpu_do_idle();
}
/**
--
2.7.4
next reply other threads:[~2018-04-10 10:41 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-04-10 10:41 Russell King [this message]
2018-04-10 10:41 ` [PATCH] ARM: avoid Cortex-A9 livelock on tight dmb loops Russell King
2018-04-10 13:41 ` Tony Lindgren
2018-04-10 13:41 ` Tony Lindgren
2018-04-10 14:12 ` Tero Kristo
2018-04-10 14:12 ` Tero Kristo
2018-04-10 15:28 ` Will Deacon
2018-04-10 15:28 ` Will Deacon
2018-04-11 12:52 ` Russell King - ARM Linux
2018-04-11 12:52 ` Russell King - ARM Linux
2018-04-11 12:57 ` Tero Kristo
2018-04-11 12:57 ` Tero Kristo
2018-04-11 12:59 ` Keerthy
2018-04-11 12:59 ` Keerthy
2018-04-11 13:10 ` Russell King - ARM Linux
2018-04-11 13:10 ` Russell King - ARM Linux
2018-04-11 14:11 ` Tony Lindgren
2018-04-11 14:11 ` Tony Lindgren
2018-04-15 14:08 ` Russell King - ARM Linux
2018-04-15 14:08 ` Russell King - ARM Linux
2018-04-15 15:50 ` Russell King - ARM Linux
2018-04-15 15:50 ` Russell King - ARM Linux
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=E1f5qij-00033R-Sl@rmk-PC.armlinux.org.uk \
--to=rmk+kernel@armlinux.org.uk \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-omap@vger.kernel.org \
--cc=paul@pwsan.com \
--cc=rnayak@codeaurora.org \
--cc=tony@atomide.com \
--cc=will.deacon@arm.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.