public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH v3] x86/rtc: Remove __init for runtime functions
@ 2022-11-24 16:57 Matija Glavinic Pecotic
  2022-11-24 17:06 ` Andy Shevchenko
  0 siblings, 1 reply; 2+ messages in thread
From: Matija Glavinic Pecotic @ 2022-11-24 16:57 UTC (permalink / raw)
  To: tglx, mingo, bp, dave.hansen, x86, Linux Kernel Mailing List,
	Andy Shevchenko, hpa

set_rtc_noop, get_rtc_noop are used runtime, therefore need init removed.
Crash was observed on x86 platform where cmos rtc is unused and disabled
via device tree. Function was triggered from ntp: sync_hw_clock, although
CONFIG_RTC_SYSTOHC=n, however sync_cmos_clock doesn't honour that.

  Workqueue: events_power_efficient sync_hw_clock
  RIP: 0010:set_rtc_noop
  Call Trace:
   update_persistent_clock64
   sync_hw_clock

Fix by dropping __init and making set/get_rtc_noop available runtime.

Fixes: c311ed6183f4 ("x86/init: Allow DT configured systems to disable RTC at boot time")
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Matija Glavinic Pecotic <matija.glavinic-pecotic.ext@nokia.com>
---
v3: Update commit message based on Andy's comments (further trim to backtrace, proper tag)
v2: Update commit message based on Andy's comments

 arch/x86/kernel/x86_init.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/arch/x86/kernel/x86_init.c b/arch/x86/kernel/x86_init.c
index 57353519bc11..0ab707bbefe2 100644
--- a/arch/x86/kernel/x86_init.c
+++ b/arch/x86/kernel/x86_init.c
@@ -32,8 +32,8 @@ static int __init iommu_init_noop(void) { return 0; }
 static void iommu_shutdown_noop(void) { }
 bool __init bool_x86_init_noop(void) { return false; }
 void x86_op_int_noop(int cpu) { }
-static __init int set_rtc_noop(const struct timespec64 *now) { return -EINVAL; }
-static __init void get_rtc_noop(struct timespec64 *now) { }
+static int set_rtc_noop(const struct timespec64 *now) { return -EINVAL; }
+static void get_rtc_noop(struct timespec64 *now) { }
 
 static __initconst const struct of_device_id of_cmos_match[] = {
 	{ .compatible = "motorola,mc146818" },
-- 
2.31.0

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

* Re: [PATCH v3] x86/rtc: Remove __init for runtime functions
  2022-11-24 16:57 [PATCH v3] x86/rtc: Remove __init for runtime functions Matija Glavinic Pecotic
@ 2022-11-24 17:06 ` Andy Shevchenko
  0 siblings, 0 replies; 2+ messages in thread
From: Andy Shevchenko @ 2022-11-24 17:06 UTC (permalink / raw)
  To: Matija Glavinic Pecotic
  Cc: tglx, mingo, bp, dave.hansen, x86, Linux Kernel Mailing List, hpa

On Thu, Nov 24, 2022 at 05:57:30PM +0100, Matija Glavinic Pecotic wrote:
> set_rtc_noop, get_rtc_noop are used runtime, therefore need init removed.
> Crash was observed on x86 platform where cmos rtc is unused and disabled
> via device tree. Function was triggered from ntp: sync_hw_clock, although
> CONFIG_RTC_SYSTOHC=n, however sync_cmos_clock doesn't honour that.
> 
>   Workqueue: events_power_efficient sync_hw_clock
>   RIP: 0010:set_rtc_noop
>   Call Trace:
>    update_persistent_clock64
>    sync_hw_clock
> 
> Fix by dropping __init and making set/get_rtc_noop available runtime.
> 
> Fixes: c311ed6183f4 ("x86/init: Allow DT configured systems to disable RTC at boot time")
> Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>

Side note: seems you sent this not using `git send-email ...`
(I see my @intel.com rather than @linux.intel.com in the Cc list).

But at least the Cc list looks closer to what MAINTAINERS says.

And you forgot to make it clear that a) it's a resend, by altering
--subject-prefix, and b) mentioning this in the changelog.

-- 
With Best Regards,
Andy Shevchenko



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

end of thread, other threads:[~2022-11-24 17:06 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-11-24 16:57 [PATCH v3] x86/rtc: Remove __init for runtime functions Matija Glavinic Pecotic
2022-11-24 17:06 ` Andy Shevchenko

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox