Skip to contentSkip to conversation

PATCH New Daniel Lezcano 3 participants 12 messages Aug 11, 2017 – Aug 13, 2017

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

Bcc:
Subject: [GIT PULL] clockevents: fixes for 4.13-rc4 Reply-To:

Hi Ingo, Thomas,

The pull request contains the following fixes for 4.13-rc4

- Fix error check against IS_ERR() instead of NULL for the timer-of code (Dan Carpenter)

- Fix infinite recusion with ftrace for the ARM architected timer (Ding Tianhong)

- Fix the error code return in the em_sti's probe function (Gustavo A. R. Silva)

- Fix Kconfig dependency for the pistachio driver (Matt Redfearn).

- Fix mem frame loop initialization for the ARM architected timer (Matthias Kaehlcke)

Thanks!

-- Daniel

The following changes since commit 34f41c0316ed52b0b44542491d89278efdaa70e4:

timers: Fix overflow in get_next_timer_interrupt (2017-08-01 14:20:53 +0200)

are available in the git repository at:

http://[email protected]/people/daniel.lezcano/linux.git clockevents/4.13-fixes

for you to fetch changes up to adb4f11e0a8f4e29900adb2b7af28b6bbd5c1fa4:

clocksource/drivers/arm_arch_timer: Avoid infinite recursion when ftrace is enabled (2017-08-11 16:01:43 +0200)

----------------------------------------------------------------
Dan Carpenter (1):
clocksource/drivers/timer-of: Checking for IS_ERR() instead of NULL

Ding Tianhong (1):
clocksource/drivers/arm_arch_timer: Avoid infinite recursion when ftrace is enabled

Gustavo A. R. Silva (1):
clocksource/drivers/em_sti: Fix error return codes in em_sti_probe()

Matt Redfearn (1):
clocksource/drivers/Kconfig: Fix CLKSRC_PISTACHIO dependencies

Matthias Kaehlcke (1):
clocksource/drivers/arm_arch_timer: Fix mem frame loop initialization

 arch/arm64/include/asm/arch_timer.h  |  4 ++--
 drivers/clocksource/Kconfig          |  2 +-
 drivers/clocksource/arm_arch_timer.c |  2 +-
 drivers/clocksource/em_sti.c         | 11 ++++++-----
 drivers/clocksource/timer-of.c       |  4 ++--
 5 files changed, 12 insertions(+), 11 deletions(-)
Signature · 5 lines
 <http://www.linaro.org/> Linaro.org │ Open source software for ARM SoCs

Follow Linaro:  <http://www.facebook.com/pages/Linaro> Facebook |
<http://twitter.com/#!/linaroorg> Twitter |
<http://www.linaro.org/linaro-blog/> Blog
#1 lore raw

Re: [GIT PULL] clockevents: fixes for 4.13-rc4

Quoted 2 lines · Daniel Lezcano

Bcc:
Subject: [GIT PULL] clockevents: fixes for 4.13-rc4

Sorry subject went wrong.

Quoted 64 lines

Reply-To:

Hi Ingo, Thomas,

The pull request contains the following fixes for 4.13-rc4

- Fix error check against IS_ERR() instead of NULL for the timer-of code (Dan Carpenter)

- Fix infinite recusion with ftrace for the ARM architected timer (Ding Tianhong)

- Fix the error code return in the em_sti's probe function (Gustavo A. R. Silva)

- Fix Kconfig dependency for the pistachio driver (Matt Redfearn).

- Fix mem frame loop initialization for the ARM architected timer (Matthias Kaehlcke)

Thanks!

-- Daniel

The following changes since commit 34f41c0316ed52b0b44542491d89278efdaa70e4:

timers: Fix overflow in get_next_timer_interrupt (2017-08-01 14:20:53 +0200)

are available in the git repository at:

http://[email protected]/people/daniel.lezcano/linux.git clockevents/4.13-fixes

for you to fetch changes up to adb4f11e0a8f4e29900adb2b7af28b6bbd5c1fa4:

clocksource/drivers/arm_arch_timer: Avoid infinite recursion when ftrace is enabled (2017-08-11 16:01:43 +0200)

----------------------------------------------------------------
Dan Carpenter (1):
clocksource/drivers/timer-of: Checking for IS_ERR() instead of NULL

Ding Tianhong (1):
clocksource/drivers/arm_arch_timer: Avoid infinite recursion when ftrace is enabled

Gustavo A. R. Silva (1):
clocksource/drivers/em_sti: Fix error return codes in em_sti_probe()

Matt Redfearn (1):
clocksource/drivers/Kconfig: Fix CLKSRC_PISTACHIO dependencies

Matthias Kaehlcke (1):
clocksource/drivers/arm_arch_timer: Fix mem frame loop initialization

 arch/arm64/include/asm/arch_timer.h  |  4 ++--
 drivers/clocksource/Kconfig          |  2 +-
 drivers/clocksource/arm_arch_timer.c |  2 +-
 drivers/clocksource/em_sti.c         | 11 ++++++-----
 drivers/clocksource/timer-of.c       |  4 ++--
 5 files changed, 12 insertions(+), 11 deletions(-)
Signature · 5 lines
 <http://www.linaro.org/> Linaro.org │ Open source software for ARM SoCs

Follow Linaro:  <http://www.facebook.com/pages/Linaro> Facebook |
<http://twitter.com/#!/linaroorg> Twitter |
<http://www.linaro.org/linaro-blog/> Blog
#2 lore raw

Re: [GIT PULL] clockevents: fixes for 4.13-rc4

Quoted 2 lines · Daniel Lezcano

The pull request contains the following fixes for 4.13-rc4

Usually these things go through Thomas, and you did say "Hi Ingo, Thomas", so I'm ignoring this pull request.

But you *did* cc me, and it's possible that you did so on purpose, expecting me to pull because everybody in Europe is on vacation.

So if you actually expect me to pull directly, please re-send and explicitly say so, ok?

Linus

#3 lore raw

Re: [GIT PULL] clockevents: fixes for 4.13-rc4

Quoted 5 lines · Linus Torvalds
Quoted 2 lines · Daniel Lezcano

The pull request contains the following fixes for 4.13-rc4

Quoted 8 lines

Usually these things go through Thomas, and you did say "Hi Ingo, Thomas", so I'm ignoring this pull request.

But you *did* cc me, and it's possible that you did so on purpose, expecting me to pull because everybody in Europe is on vacation.

So if you actually expect me to pull directly, please re-send and explicitly say so, ok?

You are perfectly right, I was assuming everybody in Europe may be in vacation, so I let you know the pull request. However, Thomas will be back August, 14th, so I think you can ignore the pull request.

Thanks.

-- Daniel

Signature · 5 lines
 <http://www.linaro.org/> Linaro.org │ Open source software for ARM SoCs

Follow Linaro:  <http://www.facebook.com/pages/Linaro> Facebook |
<http://twitter.com/#!/linaroorg> Twitter |
<http://www.linaro.org/linaro-blog/> Blog
#4 lore raw

Re: [GIT PULL] clockevents: fixes for 4.13-rc4

Quoted 4 lines · Daniel Lezcano

You are perfectly right, I was assuming everybody in Europe may be in vacation, so I let you know the pull request. However, Thomas will be back August, 14th, so I think you can ignore the pull request.

Ok, if the situation changes, re-send it to me and I'll do it directly,

Linus

#5 lore raw

Re: [GIT PULL] clockevents: fixes for 4.13-rc4

In reply to Daniel Lezcano
Quoted 12 lines · Daniel Lezcano
Quoted 11 lines · Linus Torvalds
Quoted 2 lines · Daniel Lezcano

The pull request contains the following fixes for 4.13-rc4

Usually these things go through Thomas, and you did say "Hi Ingo, Thomas", so I'm ignoring this pull request.

But you *did* cc me, and it's possible that you did so on purpose, expecting me to pull because everybody in Europe is on vacation.

Quoted 6 lines
Quoted 2 lines

So if you actually expect me to pull directly, please re-send and explicitly say so, ok?

You are perfectly right, I was assuming everybody in Europe may be in vacation, so I let you know the pull request. However, Thomas will be back August, 14th, so I think you can ignore the pull request.

I'm back and my plan is to take a look and pull it tomorrow.

Thanks,

Ingo

#6 lore raw

PATCH 1/5 clocksource/drivers/arm_arch_timer: Fix mem frame loop initialization

In reply to Daniel Lezcano

From: Matthias Kaehlcke <[email protected]>

The loop to find the best memory frame in arch_timer_mem_acpi_init() initializes the loop counter with itself ('i = i'), which is suspicious in the first place and pointed out by clang. The loop condition is 'i < timer_count' and a prior for loop exits when 'i' reaches 'timer_count', therefore the second loop is never executed.

Initialize the loop counter with 0 to iterate over all timers, which supposedly was the intention before the typo monster attacked.

Fixes c2743a36765d3 ("clocksource: arm_arch_timer: add GTDT support for memory-mapped timer")
---
 drivers/clocksource/arm_arch_timer.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/clocksource/arm_arch_timer.c +1 -1
index aae87c4..72bbfcc 100644
@@ -1440,7 +1440,7 @@ static int __init arch_timer_mem_acpi_init(int platform_timer_count)
 	 * While unlikely, it's theoretically possible that none of the frames
 	 * in a timer expose the combination of feature we want.
 	 */
-	for (i = i; i < timer_count; i++) {
+	for (i = 0; i < timer_count; i++) {
 		timer = &timers[i];
 
 		frame = arch_timer_mem_find_best_frame(timer);
Signature · 1 line
2.7.4
#7 lore raw

PATCH 2/5 clocksource/drivers/em_sti: Fix error return codes in em_sti_probe()

From: "Gustavo A. R. Silva" <[email protected]>

Propagate the return values of platform_get_irq and devm_request_irq on failure.

---
 drivers/clocksource/em_sti.c | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)
drivers/clocksource/em_sti.c +6 -5
index bc48cbf..269db74 100644
@@ -305,7 +305,7 @@ static int em_sti_probe(struct platform_device *pdev)
 	irq = platform_get_irq(pdev, 0);
 	if (irq < 0) {
 		dev_err(&pdev->dev, "failed to get irq\n");
-		return -EINVAL;
+		return irq;
 	}
 
 	/* map memory, let base point to the STI instance */
@@ -314,11 +314,12 @@ static int em_sti_probe(struct platform_device *pdev)
 	if (IS_ERR(p->base))
 		return PTR_ERR(p->base);
 
-	if (devm_request_irq(&pdev->dev, irq, em_sti_interrupt,
-			     IRQF_TIMER | IRQF_IRQPOLL | IRQF_NOBALANCING,
-			     dev_name(&pdev->dev), p)) {
+	ret = devm_request_irq(&pdev->dev, irq, em_sti_interrupt,
+			       IRQF_TIMER | IRQF_IRQPOLL | IRQF_NOBALANCING,
+			       dev_name(&pdev->dev), p);
+	if (ret) {
 		dev_err(&pdev->dev, "failed to request low IRQ\n");
-		return -ENOENT;
+		return ret;
 	}
 
 	/* get hold of clock */
Signature · 1 line
2.7.4
#8 lore raw

PATCH 3/5 clocksource/drivers/timer-of: Checking for IS_ERR() instead of NULL

In reply to Daniel Lezcano

From: Dan Carpenter <[email protected]>

The current code checks the return value of the of_io_request_and_map() function as it was returning a NULL pointer in case of error.

However, it returns an error code encoded in the pointer return value, not a NULL value. Fix this by checking the returned pointer against IS_ERR() and return the error with PTR_ERR().

---
 drivers/clocksource/timer-of.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/clocksource/timer-of.c +2 -2
index d509b50..4d7aef9 100644
@@ -128,9 +128,9 @@ static __init int timer_base_init(struct device_node *np,
 	const char *name = of_base->name ? of_base->name : np->full_name;
 
 	of_base->base = of_io_request_and_map(np, of_base->index, name);
-	if (!of_base->base) {
+	if (IS_ERR(of_base->base)) {
 		pr_err("Failed to iomap (%s)\n", name);
-		return -ENXIO;
+		return PTR_ERR(of_base->base);
 	}
 
 	return 0;
Signature · 1 line
2.7.4
#9 lore raw

PATCH 4/5 clocksource/drivers/Kconfig: Fix CLKSRC_PISTACHIO dependencies

In reply to Daniel Lezcano

From: Matt Redfearn <[email protected]>

In v4.13, CLKSRC_PISTACHIO can select TIMER_OF on architectures without GENERIC_CLOCKEVENTS, resulting in a struct clock_event_device missing some required features and build breakage compiling timer_of.c. One of the symbols selecting TIMER_OF is CLKSRC_PISTACHIO, so add the dependency on GENERIC_CLOCKEVENTS.

Thanks to kbuild test robot for finding this error
(https://lkml.org/lkml/2017/7/16/249)

---
 drivers/clocksource/Kconfig | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/clocksource/Kconfig +1 -1
index fcae5ca..54a67f8 100644
@@ -262,7 +262,7 @@ config CLKSRC_LPC32XX
 
 config CLKSRC_PISTACHIO
 	bool "Clocksource for Pistachio SoC" if COMPILE_TEST
-	depends on HAS_IOMEM
+	depends on GENERIC_CLOCKEVENTS && HAS_IOMEM
 	select TIMER_OF
 	help
 	  Enables the clocksource for the Pistachio SoC.
Signature · 1 line
2.7.4
#10 lore raw

PATCH 5/5 clocksource/drivers/arm_arch_timer: Avoid infinite recursion when ftrace is enabled

In reply to Daniel Lezcano

From: Ding Tianhong <[email protected]>

On platforms with an arch timer erratum workaround, it's possible for arch_timer_reg_read_stable() to recurse into itself when certain tracing options are enabled, leading to stack overflows and related problems.

For example, when PREEMPT_TRACER and FUNCTION_GRAPH_TRACER are selected, it's possible to trigger this with:

$ mount -t debugfs nodev /sys/kernel/debug/
$ echo function_graph > /sys/kernel/debug/tracing/current_tracer

The problem is that in such cases, preempt_disable() instrumentation attempts to acquire a timestamp via trace_clock(), resulting in a call back to arch_timer_reg_read_stable(), and hence recursion.

This patch changes arch_timer_reg_read_stable() to use preempt_{disable,enable}_notrace(), which avoids this.

This problem is similar to the fixed by upstream commit 96b3d28bf4 ("sched/clock: Prevent tracing recursion in sched_clock_cpu()").

Fixes 6acc71ccac71 ("arm64: arch_timer: Allows a CPU-specific erratum to only affect a subset of CPUs")
---
 arch/arm64/include/asm/arch_timer.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
arch/arm64/include/asm/arch_timer.h +2 -2
index 74d08e4..a652ce0 100644
@@ -65,13 +65,13 @@ DECLARE_PER_CPU(const struct arch_timer_erratum_workaround *,
 	u64 _val;							\
 	if (needs_unstable_timer_counter_workaround()) {		\
 		const struct arch_timer_erratum_workaround *wa;		\
-		preempt_disable();					\
+		preempt_disable_notrace();				\
 		wa = __this_cpu_read(timer_unstable_counter_workaround); \
 		if (wa && wa->read_##reg)				\
 			_val = wa->read_##reg();			\
 		else							\
 			_val = read_sysreg(reg);			\
-		preempt_enable();					\
+		preempt_enable_notrace();				\
 	} else {							\
 		_val = read_sysreg(reg);				\
 	}								\
Signature · 1 line
2.7.4
#11 lore raw

Re: [GIT PULL] clockevents: fixes for 4.13-rc4

In reply to Daniel Lezcano
Quoted 18 lines · Daniel Lezcano

Hi Ingo, Thomas,

The pull request contains the following fixes for 4.13-rc4

- Fix error check against IS_ERR() instead of NULL for the timer-of code (Dan Carpenter)

- Fix infinite recusion with ftrace for the ARM architected timer (Ding Tianhong)

- Fix the error code return in the em_sti's probe function (Gustavo A. R. Silva)

- Fix Kconfig dependency for the pistachio driver (Matt Redfearn).

- Fix mem frame loop initialization for the ARM architected timer (Matthias Kaehlcke)

Quoted 6 lines
 arch/arm64/include/asm/arch_timer.h  |  4 ++--
 drivers/clocksource/Kconfig          |  2 +-
 drivers/clocksource/arm_arch_timer.c |  2 +-
 drivers/clocksource/em_sti.c         | 11 ++++++-----
 drivers/clocksource/timer-of.c       |  4 ++--
 5 files changed, 12 insertions(+), 11 deletions(-)

Pulled into tip:timers/urgent, thanks Daniel!

Ingo