All of lore.kernel.org
 help / color / mirror / Atom feed
From: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
To: Linus Walleij <linus.walleij@linaro.org>
Cc: ext Tony Lindgren <tony@atomide.com>,
	viresh kumar <viresh.kumar@linaro.org>,
	David Brown <david.brown@linaro.org>,
	Xu Wei <xuwei5@hisilicon.com>,
	Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>,
	linux-samsung-soc <linux-samsung-soc@vger.kernel.org>,
	Viresh Kumar <vireshk@kernel.org>,
	Russell King <linux@armlinux.org.uk>,
	Krzysztof Kozlowski <krzk@kernel.org>,
	Maxime Ripard <maxime.ripard@bootlin.com>,
	Chen-Yu Tsai <wens@csie.org>, Kukjin Kim <kgene@kernel.org>,
	Andy Gross <andy.gross@linaro.org>, Arnd Bergmann <arnd@arndb.de>,
	linux-arm-msm@vger.kernel.org,
	Thomas Gleixner <tglx@linutronix.de>,
	Linux-OMAP <linux-omap@vger.kernel.org>,
	Linux ARM <linux-arm-kernel@lists.infradead.org>,
	Barry Song <baohua@kernel.org>,
	Frank Rowand <frank.rowand@am.sony.com>,
	Patrice CHOTARD <patrice.chotard@st.com>,
	shiraz hashim <shiraz.linux.kernel@gmail.com>,
	Andreas
Subject: [PATCH 1/3 v2] arm: versatile: Convert boot_lock to raw
Date: Tue, 11 Dec 2018 22:23:22 +0100	[thread overview]
Message-ID: <20181211212322.co4ljpolo4bvgxe3@linutronix.de> (raw)
In-Reply-To: <CACRpkdby=Xreh0VPpHBPLhvupgQyEqDiae+e0u=-n3o2SWVMTw@mail.gmail.com>

The arm boot_lock is used by the secondary processor startup code.  The locking
task is the idle thread, which has idle->sched_class == &idle_sched_class.
idle_sched_class->enqueue_task == NULL, so if the idle task blocks on the
lock, the attempt to wake it when the lock becomes available will fail:

try_to_wake_up()
   ...
      activate_task()
         enqueue_task()
            p->sched_class->enqueue_task(rq, p, flags)

Fix by converting boot_lock to a raw spin lock.

Cc: Russell King <linux@armlinux.org.uk>
Cc: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Frank Rowand <frank.rowand@am.sony.com>
Link: http://lkml.kernel.org/r/4E77B952.3010606@am.sony.com
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
---
 arch/arm/plat-versatile/platsmp.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/arch/arm/plat-versatile/platsmp.c b/arch/arm/plat-versatile/platsmp.c
index c2366510187a8..6b60f582b738c 100644
--- a/arch/arm/plat-versatile/platsmp.c
+++ b/arch/arm/plat-versatile/platsmp.c
@@ -32,7 +32,7 @@ static void write_pen_release(int val)
 	sync_cache_w(&pen_release);
 }
 
-static DEFINE_SPINLOCK(boot_lock);
+static DEFINE_RAW_SPINLOCK(boot_lock);
 
 void versatile_secondary_init(unsigned int cpu)
 {
@@ -45,8 +45,8 @@ void versatile_secondary_init(unsigned int cpu)
 	/*
 	 * Synchronise with the boot thread.
 	 */
-	spin_lock(&boot_lock);
-	spin_unlock(&boot_lock);
+	raw_spin_lock(&boot_lock);
+	raw_spin_unlock(&boot_lock);
 }
 
 int versatile_boot_secondary(unsigned int cpu, struct task_struct *idle)
@@ -57,7 +57,7 @@ int versatile_boot_secondary(unsigned int cpu, struct task_struct *idle)
 	 * Set synchronisation state between this boot processor
 	 * and the secondary one
 	 */
-	spin_lock(&boot_lock);
+	raw_spin_lock(&boot_lock);
 
 	/*
 	 * This is really belt and braces; we hold unintended secondary
@@ -87,7 +87,7 @@ int versatile_boot_secondary(unsigned int cpu, struct task_struct *idle)
 	 * now the secondary core is starting up let it run its
 	 * calibrations, then wait for it to finish
 	 */
-	spin_unlock(&boot_lock);
+	raw_spin_unlock(&boot_lock);
 
 	return pen_release != -1 ? -ENOSYS : 0;
 }
-- 
2.20.0

WARNING: multiple messages have this Message-ID (diff)
From: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
To: Linus Walleij <linus.walleij@linaro.org>
Cc: "ext Tony Lindgren" <tony@atomide.com>,
	"viresh kumar" <viresh.kumar@linaro.org>,
	"David Brown" <david.brown@linaro.org>,
	"Xu Wei" <xuwei5@hisilicon.com>,
	"Manivannan Sadhasivam" <manivannan.sadhasivam@linaro.org>,
	linux-samsung-soc <linux-samsung-soc@vger.kernel.org>,
	"Viresh Kumar" <vireshk@kernel.org>,
	"Russell King" <linux@armlinux.org.uk>,
	"Krzysztof Kozlowski" <krzk@kernel.org>,
	"Maxime Ripard" <maxime.ripard@bootlin.com>,
	"Chen-Yu Tsai" <wens@csie.org>, "Kukjin Kim" <kgene@kernel.org>,
	"Andy Gross" <andy.gross@linaro.org>,
	"Arnd Bergmann" <arnd@arndb.de>,
	linux-arm-msm@vger.kernel.org,
	"Thomas Gleixner" <tglx@linutronix.de>,
	Linux-OMAP <linux-omap@vger.kernel.org>,
	"Linux ARM" <linux-arm-kernel@lists.infradead.org>,
	"Barry Song" <baohua@kernel.org>,
	"Frank Rowand" <frank.rowand@am.sony.com>,
	"Patrice CHOTARD" <patrice.chotard@st.com>,
	"shiraz hashim" <shiraz.linux.kernel@gmail.com>,
	"Andreas Färber" <afaerber@suse.de>
Subject: [PATCH 1/3 v2] arm: versatile: Convert boot_lock to raw
Date: Tue, 11 Dec 2018 22:23:22 +0100	[thread overview]
Message-ID: <20181211212322.co4ljpolo4bvgxe3@linutronix.de> (raw)
In-Reply-To: <CACRpkdby=Xreh0VPpHBPLhvupgQyEqDiae+e0u=-n3o2SWVMTw@mail.gmail.com>

The arm boot_lock is used by the secondary processor startup code.  The locking
task is the idle thread, which has idle->sched_class == &idle_sched_class.
idle_sched_class->enqueue_task == NULL, so if the idle task blocks on the
lock, the attempt to wake it when the lock becomes available will fail:

try_to_wake_up()
   ...
      activate_task()
         enqueue_task()
            p->sched_class->enqueue_task(rq, p, flags)

Fix by converting boot_lock to a raw spin lock.

Cc: Russell King <linux@armlinux.org.uk>
Cc: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Frank Rowand <frank.rowand@am.sony.com>
Link: http://lkml.kernel.org/r/4E77B952.3010606@am.sony.com
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
---
 arch/arm/plat-versatile/platsmp.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/arch/arm/plat-versatile/platsmp.c b/arch/arm/plat-versatile/platsmp.c
index c2366510187a8..6b60f582b738c 100644
--- a/arch/arm/plat-versatile/platsmp.c
+++ b/arch/arm/plat-versatile/platsmp.c
@@ -32,7 +32,7 @@ static void write_pen_release(int val)
 	sync_cache_w(&pen_release);
 }
 
-static DEFINE_SPINLOCK(boot_lock);
+static DEFINE_RAW_SPINLOCK(boot_lock);
 
 void versatile_secondary_init(unsigned int cpu)
 {
@@ -45,8 +45,8 @@ void versatile_secondary_init(unsigned int cpu)
 	/*
 	 * Synchronise with the boot thread.
 	 */
-	spin_lock(&boot_lock);
-	spin_unlock(&boot_lock);
+	raw_spin_lock(&boot_lock);
+	raw_spin_unlock(&boot_lock);
 }
 
 int versatile_boot_secondary(unsigned int cpu, struct task_struct *idle)
@@ -57,7 +57,7 @@ int versatile_boot_secondary(unsigned int cpu, struct task_struct *idle)
 	 * Set synchronisation state between this boot processor
 	 * and the secondary one
 	 */
-	spin_lock(&boot_lock);
+	raw_spin_lock(&boot_lock);
 
 	/*
 	 * This is really belt and braces; we hold unintended secondary
@@ -87,7 +87,7 @@ int versatile_boot_secondary(unsigned int cpu, struct task_struct *idle)
 	 * now the secondary core is starting up let it run its
 	 * calibrations, then wait for it to finish
 	 */
-	spin_unlock(&boot_lock);
+	raw_spin_unlock(&boot_lock);
 
 	return pen_release != -1 ? -ENOSYS : 0;
 }
-- 
2.20.0


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

  reply	other threads:[~2018-12-11 21:23 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-12-07 10:27 [PATCH 0/3 REPOST] arm: covert a few spinlock_t locks to raw_spinlock_t Sebastian Andrzej Siewior
2018-12-07 10:27 ` [PATCH 1/3] arm: Convert arm boot_lock to raw Sebastian Andrzej Siewior
2018-12-07 12:49   ` Linus Walleij
2018-12-07 12:49     ` Linus Walleij
2018-12-07 13:00   ` Russell King - ARM Linux
2018-12-07 13:00     ` Russell King - ARM Linux
2018-12-08 23:15     ` Linus Walleij
2018-12-08 23:15       ` Linus Walleij
2018-12-09  0:41       ` Russell King - ARM Linux
2018-12-09  0:41         ` Russell King - ARM Linux
2018-12-10 14:37         ` Sebastian Andrzej Siewior
2018-12-10 14:37           ` Sebastian Andrzej Siewior
2018-12-11 18:19           ` Linus Walleij
2018-12-11 18:19             ` Linus Walleij
2018-12-11 21:23             ` Sebastian Andrzej Siewior [this message]
2018-12-11 21:23               ` [PATCH 1/3 v2] arm: versatile: Convert " Sebastian Andrzej Siewior
2018-12-11 21:29             ` [PATCH 1/3] arm: Convert arm " Sebastian Andrzej Siewior
2018-12-11 21:29               ` Sebastian Andrzej Siewior
2018-12-13 11:48               ` Russell King - ARM Linux
2018-12-13 11:48                 ` Russell King - ARM Linux
2018-12-13 12:42                 ` Sebastian Andrzej Siewior
2018-12-13 12:42                   ` Sebastian Andrzej Siewior
2018-12-12 11:15             ` Russell King - ARM Linux
2018-12-12 11:15               ` Russell King - ARM Linux
2018-12-07 10:27 ` [PATCH 2/3] arm: kprobe: make patch_lock a raw_spinlock_t Sebastian Andrzej Siewior
2019-02-13  8:46   ` Sebastian Andrzej Siewior
2018-12-07 10:27 ` [PATCH 3/3] arm: use a raw_spinlock_t in unwind Sebastian Andrzej Siewior
2019-02-13  8:46   ` Sebastian Andrzej Siewior
2019-02-13 15:14     ` Arnd Bergmann
2019-02-13 15:57       ` Sebastian Andrzej Siewior

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=20181211212322.co4ljpolo4bvgxe3@linutronix.de \
    --to=bigeasy@linutronix.de \
    --cc=andy.gross@linaro.org \
    --cc=arnd@arndb.de \
    --cc=baohua@kernel.org \
    --cc=david.brown@linaro.org \
    --cc=frank.rowand@am.sony.com \
    --cc=kgene@kernel.org \
    --cc=krzk@kernel.org \
    --cc=linus.walleij@linaro.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-arm-msm@vger.kernel.org \
    --cc=linux-omap@vger.kernel.org \
    --cc=linux-samsung-soc@vger.kernel.org \
    --cc=linux@armlinux.org.uk \
    --cc=manivannan.sadhasivam@linaro.org \
    --cc=maxime.ripard@bootlin.com \
    --cc=patrice.chotard@st.com \
    --cc=shiraz.linux.kernel@gmail.com \
    --cc=tglx@linutronix.de \
    --cc=tony@atomide.com \
    --cc=viresh.kumar@linaro.org \
    --cc=vireshk@kernel.org \
    --cc=wens@csie.org \
    --cc=xuwei5@hisilicon.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.