Skip to contentSkip to conversation

time: export nsec_to_clock_t

PATCH In review Arnd Bergmann 4 participants 4 messages Mar 28, 2018 – Apr 2, 2018 Timekeeping, clocksource core, NTP, alarmtimer

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 time: export nsec_to_clock_t

nsec_to_clock_t was traditionally used only in the core kernel, now we have a sysfs file that needs it from a loadable module, causing a link-time error:

ERROR: "nsec_to_clock_t" [drivers/thermal/thermal_sys.ko] undefined!

This exports the function the same way that we do for related interfaces.

Fixes 96cea33badc5 ("thermal: Add cooling device's statistics in sysfs")
---
 kernel/time/time.c | 1 +
 1 file changed, 1 insertion(+)
kernel/time/time.c +1 -0
index 6fa99213fc72..97a262531f68 100644
@@ -768,6 +768,7 @@ u64 nsec_to_clock_t(u64 x)
 	return div_u64(x * 9, (9ull * NSEC_PER_SEC + (USER_HZ / 2)) / USER_HZ);
 #endif
 }
+EXPORT_SYMBOL(nsec_to_clock_t);
 
 u64 jiffies64_to_nsecs(u64 j)
 {
Signature · 1 line
2.9.0
#1 lore raw
Quoted 5 lines · Arnd Bergmann

nsec_to_clock_t was traditionally used only in the core kernel, now we
have a sysfs file that needs it from a loadable module, causing a link-time error:

Quoted 8 lines

ERROR: "nsec_to_clock_t" [drivers/thermal/thermal_sys.ko] undefined!

This exports the function the same way that we do for related interfaces.

Fixes 96cea33badc5 ("thermal: Add cooling device's statistics in

sysfs")

Thanks for the fix.
can I take this patch through thermal tree?

thanks,
rui

Quoted 17 lines

---
 kernel/time/time.c | 1 +

 1 file changed, 1 insertion(+)
kernel/time/time.c +1 -0
index 6fa99213fc72..97a262531f68 100644
@@ -768,6 +768,7 @@ u64 nsec_to_clock_t(u64 x)
  	return div_u64(x * 9, (9ull * NSEC_PER_SEC + (USER_HZ / 2))
 / USER_HZ);
  #endif
  }
+EXPORT_SYMBOL(nsec_to_clock_t);


 u64 jiffies64_to_nsecs(u64 j)
 {

#2 lore raw
Quoted 11 lines · Zhang Rui
Quoted 10 lines · Arnd Bergmann

nsec_to_clock_t was traditionally used only in the core kernel, now we
have a sysfs file that needs it from a loadable module, causing a link-time error:

ERROR: "nsec_to_clock_t" [drivers/thermal/thermal_sys.ko] undefined!

This exports the function the same way that we do for related interfaces.

Quoted 6 lines
Quoted 3 lines
Fixes 96cea33badc5 ("thermal: Add cooling device's statistics in

sysfs")

Thanks for the fix.
can I take this patch through thermal tree?

Well, the question is what's the point of that?

Why does a new interface expose time in state in clock_t instead in normal time units, e.g. nsec/usec/msec ?

That makes no sense whatsoever.

Thanks,

tglx

#3 lore raw
Quoted 16 lines · Thomas Gleixner
Quoted 15 lines · Zhang Rui
Quoted 13 lines · Arnd Bergmann

nsec_to_clock_t was traditionally used only in the core kernel, now we
have a sysfs file that needs it from a loadable module, causing a link-time error:

ERROR: "nsec_to_clock_t" [drivers/thermal/thermal_sys.ko] undefined!

This exports the function the same way that we do for related interfaces.

Fixes 96cea33badc5 ("thermal: Add cooling device's statistics in

sysfs")

Quoted 7 lines
Quoted 2 lines

Thanks for the fix.
can I take this patch through thermal tree?

Well, the question is what's the point of that?

Why does a new interface expose time in state in clock_t instead in normal time units, e.g. nsec/usec/msec ?

The initial patch was displaying the values in msec, but eduardo asked the units to be consistent with how cpufreq shows it, i.e. clock_t.

https://lkml.kernel.org/r/[email protected]

Anyway I will resend the patch and move back to msec. Thanks.

Signature · 1 line
viresh