linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2 1/4] ARM: exynos: Remove outdated maintainer information
@ 2018-07-24 16:49 Krzysztof Kozlowski
  2018-07-24 16:49 ` [PATCH v2 2/4] ARM: exynos: Store Exynos5420 register state in one variable Krzysztof Kozlowski
                   ` (2 more replies)
  0 siblings, 3 replies; 7+ messages in thread
From: Krzysztof Kozlowski @ 2018-07-24 16:49 UTC (permalink / raw)
  To: Kukjin Kim, Krzysztof Kozlowski, Russell King, Alim Akhtar,
	Marek Szyprowski, Pankaj Dubey, linux-arm-kernel,
	linux-samsung-soc, linux-doc, linux-kernel

The current maintainers are specified in MAINTAINERS file, so remove
in-sources information with outdated e-mail address (Thomas Abraham's
email does not work, Kukjin Kim uses @kernel.org).

Signed-off-by: Krzysztof Kozlowski <krzk@kernel.org>

---

Changes since v1:
New patch.
---
 arch/arm/mach-exynos/exynos.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/arch/arm/mach-exynos/exynos.c b/arch/arm/mach-exynos/exynos.c
index f4b6c93a7fd0..865dcc4c3181 100644
--- a/arch/arm/mach-exynos/exynos.c
+++ b/arch/arm/mach-exynos/exynos.c
@@ -190,8 +190,6 @@ static void __init exynos_dt_fixup(void)
 }
 
 DT_MACHINE_START(EXYNOS_DT, "SAMSUNG EXYNOS (Flattened Device Tree)")
-	/* Maintainer: Thomas Abraham <thomas.abraham@linaro.org> */
-	/* Maintainer: Kukjin Kim <kgene.kim@samsung.com> */
 	.l2c_aux_val	= 0x3c400001,
 	.l2c_aux_mask	= 0xc20fffff,
 	.smp		= smp_ops(exynos_smp_ops),
-- 
2.14.1


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH v2 2/4] ARM: exynos: Store Exynos5420 register state in one variable
  2018-07-24 16:49 [PATCH v2 1/4] ARM: exynos: Remove outdated maintainer information Krzysztof Kozlowski
@ 2018-07-24 16:49 ` Krzysztof Kozlowski
  2018-07-24 16:49 ` [PATCH v2 3/4] ARM: exynos: Clear global variable on init error path Krzysztof Kozlowski
  2018-07-24 16:49 ` [PATCH v2 4/4] ARM: exynos: Fix imprecise abort during Exynos5422 suspend to RAM Krzysztof Kozlowski
  2 siblings, 0 replies; 7+ messages in thread
From: Krzysztof Kozlowski @ 2018-07-24 16:49 UTC (permalink / raw)
  To: Kukjin Kim, Krzysztof Kozlowski, Russell King, Alim Akhtar,
	Marek Szyprowski, Pankaj Dubey, linux-arm-kernel,
	linux-samsung-soc, linux-doc, linux-kernel

Instead of keeping two static variables put them into one struct which
later can grow.  This will reduce number of file-scope symbols.

Signed-off-by: Krzysztof Kozlowski <krzk@kernel.org>

---

Changes since v1:
New patch.
---
 arch/arm/mach-exynos/suspend.c | 20 ++++++++++++--------
 1 file changed, 12 insertions(+), 8 deletions(-)

diff --git a/arch/arm/mach-exynos/suspend.c b/arch/arm/mach-exynos/suspend.c
index d3db306a5a70..5d4822e5d0ba 100644
--- a/arch/arm/mach-exynos/suspend.c
+++ b/arch/arm/mach-exynos/suspend.c
@@ -59,10 +59,14 @@ struct exynos_pm_data {
 	int (*cpu_suspend)(unsigned long);
 };
 
-static const struct exynos_pm_data *pm_data __ro_after_init;
+/* Used only on Exynos542x/5800 */
+struct exynos_pm_state {
+	int cpu_state;
+	unsigned int pmu_spare3;
+};
 
-static int exynos5420_cpu_state;
-static unsigned int exynos_pmu_spare3;
+static const struct exynos_pm_data *pm_data __ro_after_init;
+static struct exynos_pm_state pm_state;
 
 /*
  * GIC wake-up support
@@ -320,7 +324,7 @@ static void exynos5420_pm_prepare(void)
 	/* Set wake-up mask registers */
 	exynos_pm_set_wakeup_mask();
 
-	exynos_pmu_spare3 = pmu_raw_readl(S5P_PMU_SPARE3);
+	pm_state.pmu_spare3 = pmu_raw_readl(S5P_PMU_SPARE3);
 	/*
 	 * The cpu state needs to be saved and restored so that the
 	 * secondary CPUs will enter low power start. Though the U-Boot
@@ -328,8 +332,8 @@ static void exynos5420_pm_prepare(void)
 	 * needs to restore it back in case, the primary cpu fails to
 	 * suspend for any reason.
 	 */
-	exynos5420_cpu_state = readl_relaxed(sysram_base_addr +
-					     EXYNOS5420_CPU_STATE);
+	pm_state.cpu_state = readl_relaxed(sysram_base_addr +
+					   EXYNOS5420_CPU_STATE);
 
 	exynos_pm_enter_sleep_mode();
 
@@ -447,7 +451,7 @@ static void exynos5420_pm_resume(void)
 		       EXYNOS5_ARM_CORE0_SYS_PWR_REG);
 
 	/* Restore the sysram cpu state register */
-	writel_relaxed(exynos5420_cpu_state,
+	writel_relaxed(pm_state.cpu_state,
 		       sysram_base_addr + EXYNOS5420_CPU_STATE);
 
 	pmu_raw_writel(EXYNOS5420_USE_STANDBY_WFI_ALL,
@@ -456,7 +460,7 @@ static void exynos5420_pm_resume(void)
 	if (exynos_pm_central_resume())
 		goto early_wakeup;
 
-	pmu_raw_writel(exynos_pmu_spare3, S5P_PMU_SPARE3);
+	pmu_raw_writel(pm_state.pmu_spare3, S5P_PMU_SPARE3);
 
 early_wakeup:
 
-- 
2.14.1


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH v2 3/4] ARM: exynos: Clear global variable on init error path
  2018-07-24 16:49 [PATCH v2 1/4] ARM: exynos: Remove outdated maintainer information Krzysztof Kozlowski
  2018-07-24 16:49 ` [PATCH v2 2/4] ARM: exynos: Store Exynos5420 register state in one variable Krzysztof Kozlowski
@ 2018-07-24 16:49 ` Krzysztof Kozlowski
  2018-07-24 16:49 ` [PATCH v2 4/4] ARM: exynos: Fix imprecise abort during Exynos5422 suspend to RAM Krzysztof Kozlowski
  2 siblings, 0 replies; 7+ messages in thread
From: Krzysztof Kozlowski @ 2018-07-24 16:49 UTC (permalink / raw)
  To: Kukjin Kim, Krzysztof Kozlowski, Russell King, Alim Akhtar,
	Marek Szyprowski, Pankaj Dubey, linux-arm-kernel,
	linux-samsung-soc, linux-doc, linux-kernel

For most of Exynos SoCs, Power Management Unit (PMU) address space is
mapped into global variable 'pmu_base_addr' very early when initializing
PMU interrupt controller.  A lot of other machine code depends on it so
when doing iounmap() on this address, clear the global as well to avoid
usage of invalid value (pointing to unmapped memory region).

Properly mapped PMU address space is a requirement for all other machine
code so this fix is purely theoretical.  Boot will fail immediately in
many other places after following this error path.

Signed-off-by: Krzysztof Kozlowski <krzk@kernel.org>

---

Changes since v1:
New patch.
---
 arch/arm/mach-exynos/suspend.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/arch/arm/mach-exynos/suspend.c b/arch/arm/mach-exynos/suspend.c
index 5d4822e5d0ba..d42ef1be2c70 100644
--- a/arch/arm/mach-exynos/suspend.c
+++ b/arch/arm/mach-exynos/suspend.c
@@ -207,6 +207,7 @@ static int __init exynos_pmu_irq_init(struct device_node *node,
 					  NULL);
 	if (!domain) {
 		iounmap(pmu_base_addr);
+		pmu_base_addr = NULL;
 		return -ENOMEM;
 	}
 
-- 
2.14.1


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH v2 4/4] ARM: exynos: Fix imprecise abort during Exynos5422 suspend to RAM
  2018-07-24 16:49 [PATCH v2 1/4] ARM: exynos: Remove outdated maintainer information Krzysztof Kozlowski
  2018-07-24 16:49 ` [PATCH v2 2/4] ARM: exynos: Store Exynos5420 register state in one variable Krzysztof Kozlowski
  2018-07-24 16:49 ` [PATCH v2 3/4] ARM: exynos: Clear global variable on init error path Krzysztof Kozlowski
@ 2018-07-24 16:49 ` Krzysztof Kozlowski
  2018-07-26  6:22   ` Anand Moon
  2 siblings, 1 reply; 7+ messages in thread
From: Krzysztof Kozlowski @ 2018-07-24 16:49 UTC (permalink / raw)
  To: Kukjin Kim, Krzysztof Kozlowski, Russell King, Alim Akhtar,
	Marek Szyprowski, Pankaj Dubey, linux-arm-kernel,
	linux-samsung-soc, linux-doc, linux-kernel

Suspend to RAM on Odroid XU3/XU4/HC1 family (Exynos5422) causes
imprecise abort:

	PM: Syncing filesystems ... done.
	Freezing user space processes ... (elapsed 0.003 seconds) done.
	OOM killer disabled.
	Freezing remaining freezable tasks ... (elapsed 0.003 seconds) done.
	wake enabled for irq 139
	Disabling non-boot CPUs ...
	IRQ51 no longer affine to CPU1
	IRQ52 no longer affine to CPU2
	IRQ53 no longer affine to CPU3
	IRQ54 no longer affine to CPU4
	IRQ55 no longer affine to CPU5
	IRQ56 no longer affine to CPU6
	cpu cpu4: Dropping the link to regulator.40
	IRQ57 no longer affine to CPU7
	Unhandled fault: external abort on non-linefetch (0x1008) at 0xf081a028
	Internal error: : 1008 [#1] PREEMPT SMP ARM

with last call trace in exynos_suspend_enter().

The abort is caused by writing to register in secure part of sysram.
Boards booted under secure firmware (e.g. Hardkernel Odroid boards)
should access non-secure sysram.

Signed-off-by: Krzysztof Kozlowski <krzk@kernel.org>

---

Changes since v1:
1. Use non-secure sysram only if secure-firmware node is present in DT
   (pointed by Marek).
---
 Documentation/arm/Samsung/Bootloader-interface.txt |  1 +
 arch/arm/mach-exynos/common.h                      |  1 +
 arch/arm/mach-exynos/firmware.c                    | 14 +++++++++++---
 arch/arm/mach-exynos/suspend.c                     | 16 +++++++++++++---
 4 files changed, 26 insertions(+), 6 deletions(-)

diff --git a/Documentation/arm/Samsung/Bootloader-interface.txt b/Documentation/arm/Samsung/Bootloader-interface.txt
index ed494ac0beb2..d17ed518a7ea 100644
--- a/Documentation/arm/Samsung/Bootloader-interface.txt
+++ b/Documentation/arm/Samsung/Bootloader-interface.txt
@@ -26,6 +26,7 @@ Offset        Value                                        Purpose
 0x20          0xfcba0d10 (Magic cookie)                    AFTR
 0x24          exynos_cpu_resume_ns                         AFTR
 0x28 + 4*cpu  0x8 (Magic cookie, Exynos3250)               AFTR
+0x28          0x0 or last value during resume (Exynos542x) System suspend
 
 
 2. Secure mode
diff --git a/arch/arm/mach-exynos/common.h b/arch/arm/mach-exynos/common.h
index dcd21bb95e3b..f96730cce6e8 100644
--- a/arch/arm/mach-exynos/common.h
+++ b/arch/arm/mach-exynos/common.h
@@ -110,6 +110,7 @@ void exynos_firmware_init(void);
 #define EXYNOS_SLEEP_MAGIC	0x00000bad
 #define EXYNOS_AFTR_MAGIC	0xfcba0d10
 
+bool __init exynos_secure_firmware_available(void);
 void exynos_set_boot_flag(unsigned int cpu, unsigned int mode);
 void exynos_clear_boot_flag(unsigned int cpu, unsigned int mode);
 
diff --git a/arch/arm/mach-exynos/firmware.c b/arch/arm/mach-exynos/firmware.c
index be1f20fe28f4..d602e3bf3f96 100644
--- a/arch/arm/mach-exynos/firmware.c
+++ b/arch/arm/mach-exynos/firmware.c
@@ -185,7 +185,7 @@ static void exynos_l2_configure(const struct l2x0_regs *regs)
 	exynos_smc(SMC_CMD_L2X0SETUP2, regs->pwr_ctrl, regs->aux_ctrl, 0);
 }
 
-void __init exynos_firmware_init(void)
+bool __init exynos_secure_firmware_available(void)
 {
 	struct device_node *nd;
 	const __be32 *addr;
@@ -193,14 +193,22 @@ void __init exynos_firmware_init(void)
 	nd = of_find_compatible_node(NULL, NULL,
 					"samsung,secure-firmware");
 	if (!nd)
-		return;
+		return false;
 
 	addr = of_get_address(nd, 0, NULL, NULL);
 	if (!addr) {
 		pr_err("%s: No address specified.\n", __func__);
-		return;
+		return false;
 	}
 
+	return true;
+}
+
+void __init exynos_firmware_init(void)
+{
+	if (!exynos_secure_firmware_available())
+		return;
+
 	pr_info("Running under secure firmware.\n");
 
 	register_firmware_ops(&exynos_firmware_ops);
diff --git a/arch/arm/mach-exynos/suspend.c b/arch/arm/mach-exynos/suspend.c
index d42ef1be2c70..ed0248b25060 100644
--- a/arch/arm/mach-exynos/suspend.c
+++ b/arch/arm/mach-exynos/suspend.c
@@ -63,6 +63,7 @@ struct exynos_pm_data {
 struct exynos_pm_state {
 	int cpu_state;
 	unsigned int pmu_spare3;
+	void __iomem *sysram_base;
 };
 
 static const struct exynos_pm_data *pm_data __ro_after_init;
@@ -261,7 +262,7 @@ static int exynos5420_cpu_suspend(unsigned long arg)
 	unsigned int cluster = MPIDR_AFFINITY_LEVEL(mpidr, 1);
 	unsigned int cpu = MPIDR_AFFINITY_LEVEL(mpidr, 0);
 
-	writel_relaxed(0x0, sysram_base_addr + EXYNOS5420_CPU_STATE);
+	writel_relaxed(0x0, pm_state.sysram_base + EXYNOS5420_CPU_STATE);
 
 	if (IS_ENABLED(CONFIG_EXYNOS5420_MCPM)) {
 		mcpm_set_entry_vector(cpu, cluster, exynos_cpu_resume);
@@ -333,7 +334,7 @@ static void exynos5420_pm_prepare(void)
 	 * needs to restore it back in case, the primary cpu fails to
 	 * suspend for any reason.
 	 */
-	pm_state.cpu_state = readl_relaxed(sysram_base_addr +
+	pm_state.cpu_state = readl_relaxed(pm_state.sysram_base +
 					   EXYNOS5420_CPU_STATE);
 
 	exynos_pm_enter_sleep_mode();
@@ -453,7 +454,7 @@ static void exynos5420_pm_resume(void)
 
 	/* Restore the sysram cpu state register */
 	writel_relaxed(pm_state.cpu_state,
-		       sysram_base_addr + EXYNOS5420_CPU_STATE);
+		       pm_state.sysram_base + EXYNOS5420_CPU_STATE);
 
 	pmu_raw_writel(EXYNOS5420_USE_STANDBY_WFI_ALL,
 			S5P_CENTRAL_SEQ_OPTION);
@@ -658,4 +659,13 @@ void __init exynos_pm_init(void)
 
 	register_syscore_ops(&exynos_pm_syscore_ops);
 	suspend_set_ops(&exynos_suspend_ops);
+
+	/*
+	 * Applicable as of now only to Exynos542x. If booted under secure
+	 * firmware, the non-secure region of sysram should be used.
+	 */
+	if (exynos_secure_firmware_available())
+		pm_state.sysram_base = sysram_ns_base_addr;
+	else
+		pm_state.sysram_base = sysram_base_addr;
 }
-- 
2.14.1


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [PATCH v2 4/4] ARM: exynos: Fix imprecise abort during Exynos5422 suspend to RAM
  2018-07-24 16:49 ` [PATCH v2 4/4] ARM: exynos: Fix imprecise abort during Exynos5422 suspend to RAM Krzysztof Kozlowski
@ 2018-07-26  6:22   ` Anand Moon
  2018-07-26  6:40     ` Krzysztof Kozlowski
  0 siblings, 1 reply; 7+ messages in thread
From: Anand Moon @ 2018-07-26  6:22 UTC (permalink / raw)
  To: Krzysztof Kozlowski
  Cc: Kukjin Kim, Russell King, Alim Akhtar, Marek Szyprowski,
	Pankaj Dubey, linux-arm-kernel, linux-samsung-soc, linux-doc,
	Linux Kernel

Hi Krzysztof,

On 24 July 2018 at 22:19, Krzysztof Kozlowski <krzk@kernel.org> wrote:
> Suspend to RAM on Odroid XU3/XU4/HC1 family (Exynos5422) causes
> imprecise abort:
>
>         PM: Syncing filesystems ... done.
>         Freezing user space processes ... (elapsed 0.003 seconds) done.
>         OOM killer disabled.
>         Freezing remaining freezable tasks ... (elapsed 0.003 seconds) done.
>         wake enabled for irq 139
>         Disabling non-boot CPUs ...
>         IRQ51 no longer affine to CPU1
>         IRQ52 no longer affine to CPU2
>         IRQ53 no longer affine to CPU3
>         IRQ54 no longer affine to CPU4
>         IRQ55 no longer affine to CPU5
>         IRQ56 no longer affine to CPU6
>         cpu cpu4: Dropping the link to regulator.40
>         IRQ57 no longer affine to CPU7
>         Unhandled fault: external abort on non-linefetch (0x1008) at 0xf081a028
>         Internal error: : 1008 [#1] PREEMPT SMP ARM
>
> with last call trace in exynos_suspend_enter().
>
> The abort is caused by writing to register in secure part of sysram.
> Boards booted under secure firmware (e.g. Hardkernel Odroid boards)
> should access non-secure sysram.
>
> Signed-off-by: Krzysztof Kozlowski <krzk@kernel.org>
>

I could not get the suspend to ram working on my Odroid-XU4.

Current default time zone: 'Asia/Kolkata'
Local time is now:      Thu Jul 26 11:34:50 IST 2018.
Universal Time is now:  Thu Jul 26 06:04:50 UTC 2018.

root@odroidxu4:~#
root@odroidxu4:~#
root@odroidxu4:~# rtcwake -d /dev/rtc0 -s 30 -m mem
rtcwake: assuming RTC uses UTC ...
rtcwake: wakeup from "mem" using /dev/rtc0 at Thu Jul 26 06:06:40 2018

System freezes with no output in console. Any other way to test this feature.
I have also tried below setting.

/* Set the wakeup alarm for 30s */
# echo +30 > /sys/class/rtc/rtc0/wakealarm
/* Suspend system to RAM */
# echo -n mem > /sys/power/state

but result is the same.

Well suspend to ram works well on Odroid-U3+
----------------------------------------------------------------------
root@odroidu3:~# rtcwake -d /dev/rtc0 -s 30 -m mem
rtcwake: assuming RTC uses UTC ...
rtcwake: wakeup from "mem" using /dev/rtc0 at Thu Jul 26 05:52:09 2018
[   58.655171] dwc2 12480000.hsotg: dwc2_hsotg_ep_disable: called for ep0
[   58.655186] dwc2 12480000.hsotg: dwc2_hsotg_ep_disable: called for ep0
root@odroidu3:~#
root@odroidu3:~#
root@odroidu3:~#
root@odroidu3:~#
root@odroidu3:~# rtcwake -d /dev/rtc0 -s 30 -m mem
rtcwake: assuming RTC uses UTC ...
rtcwake: wakeup from "mem" using /dev/rtc0 at Thu Jul 26 05:55:36 2018
[  235.633796] dwc2 12480000.hsotg: dwc2_hsotg_ep_disable: called for ep0
[  235.633811] dwc2 12480000.hsotg: dwc2_hsotg_ep_disable: called for ep0
root@odroidu3:~#
root@odroidu3:~#

But also observer following kernel crash on Odroid-U3+.

root@odroidu3:~# rtcwake -d /dev/rtc0 -s 30 -m mem
rtcwake: assuming RTC uses UTC ...
rtcwake: wakeup from "mem" using /dev/rtc0 at Thu Jul 26 06:17:20 2018
[   48.794091] smsc95xx 1-2:1.0 eth0: entering SUSPEND2 mode
[   48.823822] wake enabled for irq 119
[   48.838208] usb3503 0-0008: switched to STANDBY mode
[   48.838883] wake enabled for irq 123
[   48.844391] dwc2 12480000.hsotg: suspending usb gadget g_ether
[   48.844743] dwc2 12480000.hsotg: dwc2_hsotg_ep_disable: called for ep0
[   48.844758] dwc2 12480000.hsotg: dwc2_hsotg_ep_disable: called for ep0
[   49.030155] samsung-pinctrl 11000000.pinctrl: Setting external
wakeup interrupt wakeup mask: 0xfbfff7ff
[   49.054626] Disabling non-boot CPUs ...
[   49.172267]
[   49.172889] =============================
[   49.172895] WARNING: suspicious RCU usage
[   49.172902] 4.18.0-rc1-xu3 #1 Not tainted
[   49.172908] -----------------------------
[   49.172917] kernel/sched/fair.c:6629 suspicious
rcu_dereference_check() usage!
[   49.172922]
[   49.172922] other info that might help us debug this:
[   49.172922]
[   49.172930]
[   49.172930] RCU used illegally from offline CPU!
[   49.172930] rcu_scheduler_active = 2, debug_locks = 0
[   49.172938] 3 locks held by swapper/2/0:
[   49.172944]  #0: c108528f ((cpu_died).wait.lock){....}, at:
complete+0x14/0x48
[   49.172978]  #1: 5327b14b (&p->pi_lock){-.-.}, at: try_to_wake_up+0x38/0x620
[   49.173008]  #2: cb644f0e (rcu_read_lock){....}, at:
select_task_rq_fair+0x1b4/0x11a4
[   49.173041]
[   49.173041] stack backtrace:
[   49.173050] CPU: 2 PID: 0 Comm: swapper/2 Not tainted 4.18.0-rc1-xu3 #1
[   49.173056] Hardware name: SAMSUNG EXYNOS (Flattened Device Tree)
[   49.173070] [<c01130f0>] (unwind_backtrace) from [<c010ed7c>]
(show_stack+0x10/0x14)
[   49.173084] [<c010ed7c>] (show_stack) from [<c0a3ad64>]
(dump_stack+0x98/0xc4)
[   49.173099] [<c0a3ad64>] (dump_stack) from [<c0166a48>]
(select_task_rq_fair+0x5c8/0x11a4)
[   49.173111] [<c0166a48>] (select_task_rq_fair) from [<c015aaac>]
(try_to_wake_up+0x168/0x620)
[   49.173123] [<c015aaac>] (try_to_wake_up) from [<c0176c60>]
(__wake_up_common+0x8c/0x14c)
[   49.173135] [<c0176c60>] (__wake_up_common) from [<c0176e24>]
(__wake_up_locked+0x18/0x20)
[   49.173146] [<c0176e24>] (__wake_up_locked) from [<c0177c18>]
(complete+0x38/0x48)
[   49.173159] [<c0177c18>] (complete) from [<c0111874>]
(arch_cpu_idle_dead+0x24/0x84)
[   49.173171] [<c0111874>] (arch_cpu_idle_dead) from [<c0160e8c>]
(do_idle+0x1d0/0x2bc)
[   49.173184] [<c0160e8c>] (do_idle) from [<c0161308>]
(cpu_startup_entry+0x18/0x1c)
[   49.173195] [<c0161308>] (cpu_startup_entry) from [<4010280c>] (0x4010280c)
[   49.232931] Enabling non-boot CPUs ...
[   49.237088] CPU1 is up
[   49.238630] CPU2 is up
[   49.242535] CPU3 is up
[   49.243777] s3c-i2c 13860000.i2c: slave address 0x00
[   49.243834] s3c-i2c 13860000.i2c: bus frequency set to 390 KHz
[   49.243862] s3c-i2c 13870000.i2c: slave address 0x00
[   49.243876] s3c-i2c 13870000.i2c: bus frequency set to 97 KHz
[   49.243899] s3c-i2c 13880000.i2c: slave address 0x00
[   49.243913] s3c-i2c 13880000.i2c: bus frequency set to 97 KHz
[   49.243935] s3c-i2c 138e0000.i2c: slave address 0x00
[   49.243948] s3c-i2c 138e0000.i2c: bus frequency set to 97 KHz
[   49.255899] s3c-rtc 10070000.rtc: rtc disabled, re-enabling
[   49.256413] dwc2 12480000.hsotg: resuming usb gadget g_ether
[   49.260032] usb usb1: root hub lost power or was reset
[   49.260889] s3c2410-wdt 10060000.watchdog: watchdog disabled
[   49.261036] wake disabled for irq 123
[   49.270297] usb3503 0-0008: switched to HUB mode
[   49.359166] wake disabled for irq 119
[   49.376207]
[   49.376213] ======================================================
[   49.376218] WARNING: possible circular locking dependency detected
[   49.376221] 4.18.0-rc1-xu3 #1 Not tainted
[   49.376225] ------------------------------------------------------
[   49.376228] swapper/2/0 is trying to acquire lock:
[   49.376233] 54f93603 ((console_sem).lock){-...}, at: down_trylock+0xc/0x2c
[   49.376244]
[   49.376247] but task is already holding lock:
[   49.376250] 5327b14b (&p->pi_lock){-.-.}, at: try_to_wake_up+0x38/0x620
[   49.376261]
[   49.376264] which lock already depends on the new lock.
[   49.376266]
[   49.376268]
[   49.376272] the existing dependency chain (in reverse order) is:
[   49.376274]
[   49.376276] -> #1 (&p->pi_lock){-.-.}:
[   49.376287]        try_to_wake_up+0x38/0x620
[   49.376290]        up+0x4c/0x60
[   49.376293]        __up_console_sem+0x2c/0x58
[   49.376295]        console_unlock+0x3b4/0x644
[   49.376298]        con_set_unimap+0x140/0x22c
[   49.376301]        vt_ioctl+0x1364/0x1710
[   49.376304]        tty_ioctl+0xec/0xb54
[   49.376307]        do_vfs_ioctl+0xb0/0x9f8
[   49.376310]        ksys_ioctl+0x34/0x58
[   49.376313]        ret_fast_syscall+0x0/0x28
[   49.376315]        0xbefc02a4
[   49.376317]
[   49.376320] -> #0 ((console_sem).lock){-...}:
[   49.376331]        _raw_spin_lock_irqsave+0x44/0x58
[   49.376333]        down_trylock+0xc/0x2c
[   49.376337]        __down_trylock_console_sem+0x24/0x88
[   49.376340]        console_trylock+0x10/0x58
[   49.376343]        vprintk_emit+0x224/0x420
[   49.376346]        vprintk_default+0x20/0x28
[   49.376349]        printk+0x30/0x54
[   49.376352]        lockdep_rcu_suspicious+0x2c/0x108
[   49.376355]        select_task_rq_fair+0x5c8/0x11a4
[   49.376358]        try_to_wake_up+0x168/0x620
[   49.376361]        __wake_up_common+0x8c/0x14c
[   49.376364]        __wake_up_locked+0x18/0x20
[   49.376367]        complete+0x38/0x48
[   49.376370]        arch_cpu_idle_dead+0x24/0x84
[   49.376372]        do_idle+0x1d0/0x2bc
[   49.376375]        cpu_startup_entry+0x18/0x1c
[   49.376378]        0x4010280c
[   49.376380]
[   49.376383] other info that might help us debug this:
[   49.376385]
[   49.376388]  Possible unsafe locking scenario:
[   49.376391]
[   49.376394]        CPU0                    CPU1
[   49.376396]        ----                    ----
[   49.376399]   lock(&p->pi_lock);
[   49.376406]                                lock((console_sem).lock);
[   49.376413]                                lock(&p->pi_lock);
[   49.376419]   lock((console_sem).lock);
[   49.376425]
[   49.376428]  *** DEADLOCK ***
[   49.376430]
[   49.376434] 3 locks held by swapper/2/0:
[   49.376436]  #0: c108528f ((cpu_died).wait.lock){....}, at:
complete+0x14/0x48
[   49.376449]  #1: 5327b14b (&p->pi_lock){-.-.}, at: try_to_wake_up+0x38/0x620
[   49.376461]  #2: cb644f0e (rcu_read_lock){....}, at:
select_task_rq_fair+0x1b4/0x11a4
[   49.376473]
[   49.376476] stack backtrace:
[   49.376480] CPU: 2 PID: 0 Comm: swapper/2 Not tainted 4.18.0-rc1-xu3 #1
[   49.376483] Hardware name: SAMSUNG EXYNOS (Flattened Device Tree)
[   49.376487] [<c01130f0>] (unwind_backtrace) from [<c010ed7c>]
(show_stack+0x10/0x14)
[   49.376491] [<c010ed7c>] (show_stack) from [<c0a3ad64>]
(dump_stack+0x98/0xc4)
[   49.376495] [<c0a3ad64>] (dump_stack) from [<c0183a2c>]
(print_circular_bug.constprop.15+0x210/0x32c)
[   49.376500] [<c0183a2c>] (print_circular_bug.constprop.15) from
[<c0186eac>] (__lock_acquire+0x155c/0x1ac8)
[   49.376504] [<c0186eac>] (__lock_acquire) from [<c0187e38>]
(lock_acquire+0xe0/0x2bc)
[   49.376508] [<c0187e38>] (lock_acquire) from [<c0a58604>]
(_raw_spin_lock_irqsave+0x44/0x58)
[   49.376512] [<c0a58604>] (_raw_spin_lock_irqsave) from [<c0180390>]
(down_trylock+0xc/0x2c)
[   49.376516] [<c0180390>] (down_trylock) from [<c0192878>]
(__down_trylock_console_sem+0x24/0x88)
[   49.376521] [<c0192878>] (__down_trylock_console_sem) from
[<c01928ec>] (console_trylock+0x10/0x58)
[   49.376525] [<c01928ec>] (console_trylock) from [<c0194544>]
(vprintk_emit+0x224/0x420)
[   49.376529] [<c0194544>] (vprintk_emit) from [<c01948f0>]
(vprintk_default+0x20/0x28)
[   49.376532] [<c01948f0>] (vprintk_default) from [<c0194d54>]
(printk+0x30/0x54)
[   49.376536] [<c0194d54>] (printk) from [<c01836e8>]
(lockdep_rcu_suspicious+0x2c/0x108)
[   49.376541] [<c01836e8>] (lockdep_rcu_suspicious) from [<c0166a48>]
(select_task_rq_fair+0x5c8/0x11a4)
[   49.376545] [<c0166a48>] (select_task_rq_fair) from [<c015aaac>]
(try_to_wake_up+0x168/0x620)
[   49.376549] [<c015aaac>] (try_to_wake_up) from [<c0176c60>]
(__wake_up_common+0x8c/0x14c)
[   49.376553] [<c0176c60>] (__wake_up_common) from [<c0176e24>]
(__wake_up_locked+0x18/0x20)
[   49.376557] [<c0176e24>] (__wake_up_locked) from [<c0177c18>]
(complete+0x38/0x48)
[   49.376560] [<c0177c18>] (complete) from [<c0111874>]
(arch_cpu_idle_dead+0x24/0x84)
[   49.376565] [<c0111874>] (arch_cpu_idle_dead) from [<c0160e8c>]
(do_idle+0x1d0/0x2bc)
[   49.376569] [<c0160e8c>] (do_idle) from [<c0161308>]
(cpu_startup_entry+0x18/0x1c)
[   49.376572] [<c0161308>] (cpu_startup_entry) from [<4010280c>] (0x4010280c)
[   49.659576] usb 1-2: reset high-speed USB device number 2 using exynos-ehci
[   50.009654] usb 1-3: reset high-speed USB device number 3 using exynos-ehci
[   51.113111] OOM killer enabled.
[   51.116204] Restarting tasks ... done.
[   51.147734] PM: suspend exit
root@odroidu3:~# [   51.713940] smsc95xx 1-2:1.0 eth0: link up,
100Mbps, full-duplex, lpa 0xC5E1

Best Regards
-Anand

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH v2 4/4] ARM: exynos: Fix imprecise abort during Exynos5422 suspend to RAM
  2018-07-26  6:22   ` Anand Moon
@ 2018-07-26  6:40     ` Krzysztof Kozlowski
  2018-07-26  7:09       ` Anand Moon
  0 siblings, 1 reply; 7+ messages in thread
From: Krzysztof Kozlowski @ 2018-07-26  6:40 UTC (permalink / raw)
  To: Anand Moon
  Cc: Kukjin Kim, Russell King, Alim Akhtar, Marek Szyprowski,
	Pankaj Dubey, linux-arm-kernel, linux-samsung-soc, linux-doc,
	Linux Kernel

On 26 July 2018 at 08:22, Anand Moon <linux.amoon@gmail.com> wrote:
> Hi Krzysztof,
>
> On 24 July 2018 at 22:19, Krzysztof Kozlowski <krzk@kernel.org> wrote:
>> Suspend to RAM on Odroid XU3/XU4/HC1 family (Exynos5422) causes
>> imprecise abort:
>>
>>         PM: Syncing filesystems ... done.
>>         Freezing user space processes ... (elapsed 0.003 seconds) done.
>>         OOM killer disabled.
>>         Freezing remaining freezable tasks ... (elapsed 0.003 seconds) done.
>>         wake enabled for irq 139
>>         Disabling non-boot CPUs ...
>>         IRQ51 no longer affine to CPU1
>>         IRQ52 no longer affine to CPU2
>>         IRQ53 no longer affine to CPU3
>>         IRQ54 no longer affine to CPU4
>>         IRQ55 no longer affine to CPU5
>>         IRQ56 no longer affine to CPU6
>>         cpu cpu4: Dropping the link to regulator.40
>>         IRQ57 no longer affine to CPU7
>>         Unhandled fault: external abort on non-linefetch (0x1008) at 0xf081a028
>>         Internal error: : 1008 [#1] PREEMPT SMP ARM
>>
>> with last call trace in exynos_suspend_enter().
>>
>> The abort is caused by writing to register in secure part of sysram.
>> Boards booted under secure firmware (e.g. Hardkernel Odroid boards)
>> should access non-secure sysram.
>>
>> Signed-off-by: Krzysztof Kozlowski <krzk@kernel.org>
>>
>
> I could not get the suspend to ram working on my Odroid-XU4.

Correct, resuming from suspend to RAM does not work on Exynos5422
(yet). The patch does not add support for it. I did not write that it
works. The only thing patch does, is fixing the imprecise abort during
suspend.

Best regards,
Krzysztof

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH v2 4/4] ARM: exynos: Fix imprecise abort during Exynos5422 suspend to RAM
  2018-07-26  6:40     ` Krzysztof Kozlowski
@ 2018-07-26  7:09       ` Anand Moon
  0 siblings, 0 replies; 7+ messages in thread
From: Anand Moon @ 2018-07-26  7:09 UTC (permalink / raw)
  To: Krzysztof Kozlowski
  Cc: Kukjin Kim, Russell King, Alim Akhtar, Marek Szyprowski,
	Pankaj Dubey, linux-arm-kernel, linux-samsung-soc, linux-doc,
	Linux Kernel

Hi Krzysztof,

On 26 July 2018 at 12:10, Krzysztof Kozlowski <krzk@kernel.org> wrote:
> On 26 July 2018 at 08:22, Anand Moon <linux.amoon@gmail.com> wrote:
>> Hi Krzysztof,
>>
>> On 24 July 2018 at 22:19, Krzysztof Kozlowski <krzk@kernel.org> wrote:
>>> Suspend to RAM on Odroid XU3/XU4/HC1 family (Exynos5422) causes
>>> imprecise abort:
>>>
>>>         PM: Syncing filesystems ... done.
>>>         Freezing user space processes ... (elapsed 0.003 seconds) done.
>>>         OOM killer disabled.
>>>         Freezing remaining freezable tasks ... (elapsed 0.003 seconds) done.
>>>         wake enabled for irq 139
>>>         Disabling non-boot CPUs ...
>>>         IRQ51 no longer affine to CPU1
>>>         IRQ52 no longer affine to CPU2
>>>         IRQ53 no longer affine to CPU3
>>>         IRQ54 no longer affine to CPU4
>>>         IRQ55 no longer affine to CPU5
>>>         IRQ56 no longer affine to CPU6
>>>         cpu cpu4: Dropping the link to regulator.40
>>>         IRQ57 no longer affine to CPU7
>>>         Unhandled fault: external abort on non-linefetch (0x1008) at 0xf081a028
>>>         Internal error: : 1008 [#1] PREEMPT SMP ARM
>>>
>>> with last call trace in exynos_suspend_enter().
>>>
>>> The abort is caused by writing to register in secure part of sysram.
>>> Boards booted under secure firmware (e.g. Hardkernel Odroid boards)
>>> should access non-secure sysram.
>>>
>>> Signed-off-by: Krzysztof Kozlowski <krzk@kernel.org>
>>>
>>
>> I could not get the suspend to ram working on my Odroid-XU4.
>
> Correct, resuming from suspend to RAM does not work on Exynos5422
> (yet). The patch does not add support for it. I did not write that it
> works. The only thing patch does, is fixing the imprecise abort during
> suspend.
>
> Best regards,
> Krzysztof

Ok thanks for the input.

Best Regards
-Anand

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2018-07-26  7:10 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-07-24 16:49 [PATCH v2 1/4] ARM: exynos: Remove outdated maintainer information Krzysztof Kozlowski
2018-07-24 16:49 ` [PATCH v2 2/4] ARM: exynos: Store Exynos5420 register state in one variable Krzysztof Kozlowski
2018-07-24 16:49 ` [PATCH v2 3/4] ARM: exynos: Clear global variable on init error path Krzysztof Kozlowski
2018-07-24 16:49 ` [PATCH v2 4/4] ARM: exynos: Fix imprecise abort during Exynos5422 suspend to RAM Krzysztof Kozlowski
2018-07-26  6:22   ` Anand Moon
2018-07-26  6:40     ` Krzysztof Kozlowski
2018-07-26  7:09       ` Anand Moon

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).