Skip to contentSkip to conversation

include: linux: Reorganize timekeeping and ktime headers

PATCH Superseded Carlos Bilbao 4 participants 11 messages Jul 15, 2021 – Jul 31, 2021 3 messages not in the archive

Subsystems (10)
x86 Sound arm64 Arm STM32 +6 more subsystems

v1 of 5 Superseded Latest is v5 →

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): 5729424.lOV4Wx5bFT@iron-maiden

A message that is not in the archive (sent off-list or not yet received): 2591466.mvXUDI8C0e@iron-maiden

A message that is not in the archive (sent off-list or not yet received): 5481808.DvuYhMxLoT@iron-maiden

#3 lore raw

PATCH 1/1 include: linux: Reorganize timekeeping and ktime headers

Reorganize and separate the headers by making ktime.h take care of the ktime_get() family of functions, and reserve timekeeping.h for the actual timekeeping. This also helps to avoid implicit function errors and strengthens the header dependencies, since timekeeping.h was using ktime_to_ns(), a static function defined in a header it does no include, ktime.h. This patch also includes the header timekeeping.h wherever it is necessary for a successful compilation after the header code reorganization.

---
 arch/x86/kernel/tsc.c       |   1 +
 include/linux/ktime.h       | 196 +++++++++++++++++++++++++++++++++++-
 include/linux/sched_clock.h |   2 +
 include/linux/timekeeping.h | 196 +-----------------------------------
 init/main.c                 |   1 +
 kernel/time/ntp.c           |   1 +
 kernel/time/time.c          |   1 +
 kernel/time/timekeeping.c   |   1 +
 8 files changed, 202 insertions(+), 197 deletions(-)
arch/x86/kernel/tsc.c +1 -0
index 2e076a459a0c..b730cb20f5fd 100644
@@ -15,6 +15,7 @@
 #include <linux/timex.h>
 #include <linux/static_key.h>
 #include <linux/static_call.h>
+#include <linux/timekeeping.h>
 
 #include <asm/hpet.h>
 #include <asm/timer.h>
include/linux/ktime.h +194 -2

200 lines not on this page · raw message

include/linux/sched_clock.h +2 -0
index 835ee87ed792..f0fa287710da 100644
@@ -5,6 +5,8 @@
 #ifndef LINUX_SCHED_CLOCK
 #define LINUX_SCHED_CLOCK
 
+#include <linux/timekeeping.h>
+
 #ifdef CONFIG_GENERIC_SCHED_CLOCK
 /**
  * struct clock_read_data - data required to read from sched_clock()
include/linux/timekeeping.h +1 -195

205 lines not on this page · raw message

init/main.c +1 -0
index af521b30a3b8..81fbdfd2c724 100644
@@ -99,6 +99,7 @@
 #include <linux/kcsan.h>
 #include <linux/init_syscalls.h>
 #include <linux/stackdepot.h>
+#include <linux/timekeeping.h>
 
 #include <asm/io.h>
 #include <asm/bugs.h>
kernel/time/ntp.c +1 -0
index 406dccb79c2b..804f06801737 100644
@@ -18,6 +18,7 @@
 #include <linux/module.h>
 #include <linux/rtc.h>
 #include <linux/audit.h>
+#include <linux/timekeeping.h>
 
 #include "ntp_internal.h"
 #include "timekeeping_internal.h"
kernel/time/time.c +1 -0
index 29923b20e0e4..7292ed074742 100644
@@ -29,6 +29,7 @@
 #include <linux/timex.h>
 #include <linux/capability.h>
 #include <linux/timekeeper_internal.h>
+#include <linux/timekeeping.h>
 #include <linux/errno.h>
 #include <linux/syscalls.h>
 #include <linux/security.h>
kernel/time/timekeeping.c +1 -0
index 8a364aa9881a..4dfee925adc8 100644
@@ -22,6 +22,7 @@
 #include <linux/pvclock_gtod.h>
 #include <linux/compiler.h>
 #include <linux/audit.h>
+#include <linux/timekeeping.h>
 
 #include "tick-internal.h"
 #include "ntp_internal.h"
Signature · 1 line
2.25.1
#4 lore raw
Quoted 10 lines · Carlos Bilbao

Reorganize and separate the headers by making ktime.h take care of the ktime_get() family of functions, and reserve timekeeping.h for the actual timekeeping. This also helps to avoid implicit function errors and strengthens the header dependencies, since timekeeping.h was using ktime_to_ns(), a static function defined in a header it does no include, ktime.h. This patch also includes the header timekeeping.h wherever it is necessary for a successful compilation after the header code reorganization.

Quoted 10 lines
---
 arch/x86/kernel/tsc.c       |   1 +
 include/linux/ktime.h       | 196 +++++++++++++++++++++++++++++++++++-
 include/linux/sched_clock.h |   2 +
 include/linux/timekeeping.h | 196 +-----------------------------------
 init/main.c                 |   1 +
 kernel/time/ntp.c           |   1 +
 kernel/time/time.c          |   1 +
 kernel/time/timekeeping.c   |   1 +
 8 files changed, 202 insertions(+), 197 deletions(-)

This looks reasonable overall. I'm not sure if Thomas has other plans for this header, as he created the timekeeping.h one originally. There is also the potential for build regressions when additional files depend on timekeeping.h but don't include it directly. Hopefully the kbuild bot will warn us about any of those.

Arnd

#5 lore raw
Quoted 7 lines · EDT Arnd Bergmann

This looks reasonable overall. I'm not sure if Thomas has other plans for this header, as he created the timekeeping.h one originally. There is also the potential for build regressions when additional files depend on timekeeping.h but don't include it directly. Hopefully the kbuild bot will warn us about any of those.

Arnd

Your intuition was right Arnd. Playing with heavier configurations I have found three more files that also needed an update on the header. I am going to send the patch again (v2) including those. Please let me know if I should add your Reviewed-by or if you want me to do any further checking.

Thanks!

Carlos.

#6 lore raw

PATCH v2 1/1 include: linux: Reorganize timekeeping and ktime headers

Reorganize and separate the headers by making ktime.h take care of the ktime_get() family of functions, and reserve timekeeping.h for the actual timekeeping. This also helps to avoid implicit function errors and strengthens the header dependencies, since timekeeping.h was using ktime_to_ns(), a static function defined in a header it does no include, ktime.h. This patch also includes the header timekeeping.h wherever it is necessary for a successful compilation after the header code reorganization.

---
Changelog:
- v2: Add three more files that also needed a header update: pps_kernel.h, posix-timers.c and hda_controller.c

---
 arch/x86/kernel/tsc.c          |   1 +
 include/linux/ktime.h          | 196 ++++++++++++++++++++++++++++++++-
 include/linux/pps_kernel.h     |   1 +
 include/linux/sched_clock.h    |   2 +
 include/linux/timekeeping.h    | 196 +--------------------------------
 init/main.c                    |   1 +
 kernel/time/ntp.c              |   1 +
 kernel/time/posix-timers.c     |   1 +
 kernel/time/time.c             |   1 +
 kernel/time/timekeeping.c      |   1 +
 sound/pci/hda/hda_controller.c |   1 +
 11 files changed, 205 insertions(+), 197 deletions(-)
arch/x86/kernel/tsc.c +1 -0
index 2e076a459a0c..b730cb20f5fd 100644
@@ -15,6 +15,7 @@
 #include <linux/timex.h>
 #include <linux/static_key.h>
 #include <linux/static_call.h>
+#include <linux/timekeeping.h>
 
 #include <asm/hpet.h>
 #include <asm/timer.h>
include/linux/ktime.h +194 -2

200 lines not on this page · raw message

include/linux/pps_kernel.h +1 -0
index 78c8ac4951b5..24970c202ac6 100644
@@ -12,6 +12,7 @@
 #include <linux/cdev.h>
 #include <linux/device.h>
 #include <linux/time.h>
+#include <linux/timekeeping.h>
 
 /*
  * Global defines
include/linux/sched_clock.h +2 -0
index 835ee87ed792..f0fa287710da 100644
@@ -5,6 +5,8 @@
 #ifndef LINUX_SCHED_CLOCK
 #define LINUX_SCHED_CLOCK
 
+#include <linux/timekeeping.h>
+
 #ifdef CONFIG_GENERIC_SCHED_CLOCK
 /**
  * struct clock_read_data - data required to read from sched_clock()
include/linux/timekeeping.h +1 -195

205 lines not on this page · raw message

init/main.c +1 -0
index af521b30a3b8..81fbdfd2c724 100644
@@ -99,6 +99,7 @@
 #include <linux/kcsan.h>
 #include <linux/init_syscalls.h>
 #include <linux/stackdepot.h>
+#include <linux/timekeeping.h>
 
 #include <asm/io.h>
 #include <asm/bugs.h>
kernel/time/ntp.c +1 -0
index 406dccb79c2b..804f06801737 100644
@@ -18,6 +18,7 @@
 #include <linux/module.h>
 #include <linux/rtc.h>
 #include <linux/audit.h>
+#include <linux/timekeeping.h>
 
 #include "ntp_internal.h"
 #include "timekeeping_internal.h"
kernel/time/posix-timers.c +1 -0
index dd5697d7347b..14f82cd95d10 100644
@@ -13,6 +13,7 @@
 #include <linux/interrupt.h>
 #include <linux/slab.h>
 #include <linux/time.h>
+#include <linux/timekeeping.h>
 #include <linux/mutex.h>
 #include <linux/sched/task.h>
 
kernel/time/time.c +1 -0
index 29923b20e0e4..7292ed074742 100644
@@ -29,6 +29,7 @@
 #include <linux/timex.h>
 #include <linux/capability.h>
 #include <linux/timekeeper_internal.h>
+#include <linux/timekeeping.h>
 #include <linux/errno.h>
 #include <linux/syscalls.h>
 #include <linux/security.h>
kernel/time/timekeeping.c +1 -0
index 8a364aa9881a..4dfee925adc8 100644
@@ -22,6 +22,7 @@
 #include <linux/pvclock_gtod.h>
 #include <linux/compiler.h>
 #include <linux/audit.h>
+#include <linux/timekeeping.h>
 
 #include "tick-internal.h"
 #include "ntp_internal.h"
sound/pci/hda/hda_controller.c +1 -0
index ca2f2ecd1488..efbbe624d81d 100644
@@ -16,6 +16,7 @@
 #include <linux/module.h>
 #include <linux/pm_runtime.h>
 #include <linux/slab.h>
+#include <linux/timekeeping.h>
 
 #ifdef CONFIG_X86
 /* for art-tsc conversion */
Signature · 1 line
2.25.1
#7 lore raw

Carlos,

Quoted 5 lines · Carlos Bilbao

Reorganize and separate the headers by making ktime.h take care of the ktime_get() family of functions, and reserve timekeeping.h for the actual timekeeping. This also helps to avoid implicit function errors and strengthens the header dependencies, since timekeeping.h was using ktime_to_ns(), a static function defined in a header it does no include, ktime.h.

I have no objections against this change per se, but I'm missing the actual problem it is trying to solve. What's the fail it fixes or is it just a general consolidation? The above is blury in that regard.

Quoted 3 lines

This patch also includes the header timekeeping.h wherever it is necessary for a successful compilation after the header code reorganization.

Please do:

git grep 'This patch' Documentation/process/

and follow the instructions there.

Aside of that I assume that you only covered x86 in build testing which is not cutting it as this is generic infrastructure affecting _all_ architectures.

Thanks,

tglx

#8 lore raw
Quoted 5 lines · EDT Thomas Gleixner

I have no objections against this change per se, but I'm missing the actual problem it is trying to solve. What's the fail it fixes or is it just a general consolidation? The above is blury in that regard.

Well, at first I just wanted to fix the header dependencies, since timekeeping.h is using ktime_to_ns(), a static function defined ktime.h, but it does not include the header. Then Arnd rightly pointed out this was an opportunity to perform a bit more housekeeping and consolidation, yes.

Quoted 9 lines
Quoted 3 lines

This patch also includes the header timekeeping.h wherever it is necessary for a successful compilation after the header code reorganization.

Please do:

git grep 'This patch' Documentation/process/

and follow the instructions there.

All right, I understand I should be following the imperative mood there.

Quoted 8 lines

Aside of that I assume that you only covered x86 in build testing which is not cutting it as this is generic infrastructure affecting _all_ architectures.

Thanks,

tglx

Thanks for the feedback Thomas, I will cross compile with the other archs to make sure we are not leaving anyone behind and send updated version (v3).

Carlos-

#9 lore raw

PATCH v3 1/1 include: linux: Reorganize timekeeping and ktime headers

Reorganize and separate the headers by making ktime.h take care of the ktime_get() family of functions, and reserve timekeeping.h for the actual timekeeping. This also helps to avoid implicit function errors and strengthens the header dependencies, since timekeeping.h was using ktime_to_ns(), a static function defined in a header it does no include, ktime.h. Include the header timekeeping.h wherever it is necessary for a successful compilation after the header code reorganization.

---
Changelog:
- v2: Add three more files that also needed a header update for x86:
pps_kernel.h, posix-timers.c and hda_controller.c
- v3: Cover build tests for other architectures than x86. To compile arm64, update arch/arm64/kvm/hypercalls.c, include/linux/stmmac.h, and drivers/rtc/class.c. No other arch/ seems to need fixes but to be on the safe side compiled arm, mips, powerpc, sparc, s390, riscv and i386.

---
 arch/arm64/kvm/hypercalls.c    |   1 +
 arch/x86/kernel/tsc.c          |   1 +
 drivers/rtc/class.c            |   1 +
 include/linux/ktime.h          | 196 +++++++++++++++++++++++++++++++-
 include/linux/pps_kernel.h     |   1 +
 include/linux/sched_clock.h    |   2 +
 include/linux/stmmac.h         |   1 +
 include/linux/timekeeping.h    | 197 +--------------------------------
 init/main.c                    |   1 +
 kernel/time/ntp.c              |   1 +
 kernel/time/posix-timers.c     |   1 +
 kernel/time/time.c             |   1 +
 kernel/time/timekeeping.c      |   1 +
 sound/pci/hda/hda_controller.c |   1 +
 14 files changed, 208 insertions(+), 198 deletions(-)
arch/arm64/kvm/hypercalls.c +1 -0
index 30da78f72b3b..41499c1d7379 100644
@@ -3,6 +3,7 @@
 
 #include <linux/arm-smccc.h>
 #include <linux/kvm_host.h>
+#include <linux/timekeeping.h>
 
 #include <asm/kvm_emulate.h>
 
arch/x86/kernel/tsc.c +1 -0
index 57ec01192180..86f663d0d6ac 100644
@@ -15,6 +15,7 @@
 #include <linux/timex.h>
 #include <linux/static_key.h>
 #include <linux/static_call.h>
+#include <linux/timekeeping.h>
 
 #include <asm/hpet.h>
 #include <asm/timer.h>
drivers/rtc/class.c +1 -0
index f77bc089eb6b..1bdf1f790beb 100644
@@ -16,6 +16,7 @@
 #include <linux/kdev_t.h>
 #include <linux/idr.h>
 #include <linux/slab.h>
+#include <linux/timekeeping.h>
 #include <linux/workqueue.h>
 
 #include "rtc-core.h"
include/linux/ktime.h +194 -2

200 lines not on this page · raw message

include/linux/pps_kernel.h +1 -0
index 78c8ac4951b5..24970c202ac6 100644
@@ -12,6 +12,7 @@
 #include <linux/cdev.h>
 #include <linux/device.h>
 #include <linux/time.h>
+#include <linux/timekeeping.h>
 
 /*
  * Global defines
include/linux/sched_clock.h +2 -0
index 528718e4ed52..3a1aa2fdd9b2 100644
@@ -5,6 +5,8 @@
 #ifndef LINUX_SCHED_CLOCK
 #define LINUX_SCHED_CLOCK
 
+#include <linux/timekeeping.h>
+
 #ifdef CONFIG_GENERIC_SCHED_CLOCK
 /**
  * struct clock_read_data - data required to read from sched_clock()
include/linux/stmmac.h +1 -0
index 0db36360ef21..bd9b4205b070 100644
@@ -14,6 +14,7 @@
 
 #include <linux/platform_device.h>
 #include <linux/phy.h>
+#include <linux/timekeeping.h>
 
 #define MTL_MAX_RX_QUEUES	8
 #define MTL_MAX_TX_QUEUES	8
include/linux/timekeeping.h +1 -196

206 lines not on this page · raw message

init/main.c +1 -0
index eb01e121d2f1..8c1b2410e74b 100644
@@ -98,6 +98,7 @@
 #include <linux/kcsan.h>
 #include <linux/init_syscalls.h>
 #include <linux/stackdepot.h>
+#include <linux/timekeeping.h>
 
 #include <asm/io.h>
 #include <asm/bugs.h>
kernel/time/ntp.c +1 -0
index 406dccb79c2b..804f06801737 100644
@@ -18,6 +18,7 @@
 #include <linux/module.h>
 #include <linux/rtc.h>
 #include <linux/audit.h>
+#include <linux/timekeeping.h>
 
 #include "ntp_internal.h"
 #include "timekeeping_internal.h"
kernel/time/posix-timers.c +1 -0
index dd5697d7347b..14f82cd95d10 100644
@@ -13,6 +13,7 @@
 #include <linux/interrupt.h>
 #include <linux/slab.h>
 #include <linux/time.h>
+#include <linux/timekeeping.h>
 #include <linux/mutex.h>
 #include <linux/sched/task.h>
 
kernel/time/time.c +1 -0
index 29923b20e0e4..7292ed074742 100644
@@ -29,6 +29,7 @@
 #include <linux/timex.h>
 #include <linux/capability.h>
 #include <linux/timekeeper_internal.h>
+#include <linux/timekeeping.h>
 #include <linux/errno.h>
 #include <linux/syscalls.h>
 #include <linux/security.h>
kernel/time/timekeeping.c +1 -0
index 8a364aa9881a..4dfee925adc8 100644
@@ -22,6 +22,7 @@
 #include <linux/pvclock_gtod.h>
 #include <linux/compiler.h>
 #include <linux/audit.h>
+#include <linux/timekeeping.h>
 
 #include "tick-internal.h"
 #include "ntp_internal.h"
sound/pci/hda/hda_controller.c +1 -0
index ca2f2ecd1488..efbbe624d81d 100644
@@ -16,6 +16,7 @@
 #include <linux/module.h>
 #include <linux/pm_runtime.h>
 #include <linux/slab.h>
+#include <linux/timekeeping.h>
 
 #ifdef CONFIG_X86
 /* for art-tsc conversion */
Signature · 1 line
2.25.1
#10 lore raw
Thank you for the patch! Perhaps something to improve:

Hi Carlos,

Thank you for the patch! Perhaps something to improve:

[auto build test WARNING on tip/timers/core]
[also build test WARNING on kvmarm/next abelloni/rtc-next sound/for-next soc/for-next linus/master tip/x86/core v5.14-rc2 next-20210722] [If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]

url:    https://github.com/0day-ci/linux/commits/Carlos-Bilbao/include-linux-Reorganize-timekeeping-and-ktime-headers/20210722-233301
base:   https://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git 2d0a9eb23ccfdf11308bec6db0bc007585d919d2
config: x86_64-randconfig-a003-20210722 (attached as .config)
compiler: gcc-10 (Ubuntu 10.3.0-1ubuntu1~20.04) 10.3.0
reproduce (this is a W=1 build):
        # https://github.com/0day-ci/linux/commit/e35011219261f218feeaea55c97d4d583d9747a9
        git remote add linux-review https://github.com/0day-ci/linux
        git fetch --no-tags linux-review Carlos-Bilbao/include-linux-Reorganize-timekeeping-and-ktime-headers/20210722-233301
        git checkout e35011219261f218feeaea55c97d4d583d9747a9
        # save the attached .config to linux build tree
        make W=1 ARCH=x86_64 

If you fix the issue, kindly add following tag as appropriate

All warnings (new ones prefixed by >>):

>> arch/x86/kernel/rtc.c:148:5: warning: no previous prototype for 'update_persistent_clock64' [-Wmissing-prototypes]
     148 | int update_persistent_clock64(struct timespec64 now)
         |     ^~~~~~~~~~~~~~~~~~~~~~~~~
>> arch/x86/kernel/rtc.c:154:6: warning: no previous prototype for 'read_persistent_clock64' [-Wmissing-prototypes]

154 | void read_persistent_clock64(struct timespec64 *ts)
| ^~~~~~~~~~~~~~~~~~~~~~~

vim +/update_persistent_clock64 +148 arch/x86/kernel/rtc.c

fe599f9fbc5d470 Thomas Gleixner 2008-01-30 147

e27c49291a7fe9d Arnd Bergmann   2018-04-27 @148  int update_persistent_clock64(struct timespec64 now)
fe599f9fbc5d470 Thomas Gleixner 2008-01-30  149  {
3565184ed0c1ea4 David Vrabel    2013-05-13  150  	return x86_platform.set_wallclock(&now);
fe599f9fbc5d470 Thomas Gleixner 2008-01-30  151  }
fe599f9fbc5d470 Thomas Gleixner 2008-01-30  152  
fe599f9fbc5d470 Thomas Gleixner 2008-01-30  153  /* not static: needed by APM */
e27c49291a7fe9d Arnd Bergmann   2018-04-27 @154  void read_persistent_clock64(struct timespec64 *ts)
fe599f9fbc5d470 Thomas Gleixner 2008-01-30  155  {
3565184ed0c1ea4 David Vrabel    2013-05-13  156  	x86_platform.get_wallclock(ts);
fe599f9fbc5d470 Thomas Gleixner 2008-01-30  157  }

fe599f9fbc5d470 Thomas Gleixner 2008-01-30 158

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org

#11 lore raw
In reply to Carlos Bilbao
Thank you for the patch! Perhaps something to improve:

Hi Carlos,

Thank you for the patch! Perhaps something to improve:

[auto build test WARNING on tip/timers/core]
[also build test WARNING on kvmarm/next abelloni/rtc-next sound/for-next soc/for-next linus/master tip/x86/core v5.14-rc2 next-20210722] [If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]

url:    https://github.com/0day-ci/linux/commits/Carlos-Bilbao/include-linux-Reorganize-timekeeping-and-ktime-headers/20210722-233301
base:   https://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git 2d0a9eb23ccfdf11308bec6db0bc007585d919d2
config: x86_64-randconfig-a011-20210722 (attached as .config)
compiler: clang version 13.0.0 (https://github.com/llvm/llvm-project 9625ca5b602616b2f5584e8a49ba93c52c141e40)

reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross
# install x86_64 cross compiling tool for clang build
# apt-get install binutils-x86-64-linux-gnu
# https://github.com/0day-ci/linux/commit/e35011219261f218feeaea55c97d4d583d9747a9
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review Carlos-Bilbao/include-linux-Reorganize-timekeeping-and-ktime-headers/20210722-233301 git checkout e35011219261f218feeaea55c97d4d583d9747a9
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=x86_64

If you fix the issue, kindly add following tag as appropriate

All warnings (new ones prefixed by >>):

>> arch/x86/kernel/rtc.c:148:5: warning: no previous prototype for function 'update_persistent_clock64' [-Wmissing-prototypes]
   int update_persistent_clock64(struct timespec64 now)
       ^
   arch/x86/kernel/rtc.c:148:1: note: declare 'static' if the function is not intended to be used outside of this translation unit
   int update_persistent_clock64(struct timespec64 now)
   ^
   static 
>> arch/x86/kernel/rtc.c:154:6: warning: no previous prototype for function 'read_persistent_clock64' [-Wmissing-prototypes]
   void read_persistent_clock64(struct timespec64 *ts)
        ^

arch/x86/kernel/rtc.c:154:1: note: declare 'static' if the function is not intended to be used outside of this translation unit void read_persistent_clock64(struct timespec64 *ts)
^
static
2 warnings generated.

vim +/update_persistent_clock64 +148 arch/x86/kernel/rtc.c

fe599f9fbc5d47 Thomas Gleixner 2008-01-30 147

e27c49291a7fe9 Arnd Bergmann   2018-04-27 @148  int update_persistent_clock64(struct timespec64 now)
fe599f9fbc5d47 Thomas Gleixner 2008-01-30  149  {
3565184ed0c1ea David Vrabel    2013-05-13  150  	return x86_platform.set_wallclock(&now);
fe599f9fbc5d47 Thomas Gleixner 2008-01-30  151  }
fe599f9fbc5d47 Thomas Gleixner 2008-01-30  152  
fe599f9fbc5d47 Thomas Gleixner 2008-01-30  153  /* not static: needed by APM */
e27c49291a7fe9 Arnd Bergmann   2018-04-27 @154  void read_persistent_clock64(struct timespec64 *ts)
fe599f9fbc5d47 Thomas Gleixner 2008-01-30  155  {
3565184ed0c1ea David Vrabel    2013-05-13  156  	x86_platform.get_wallclock(ts);
fe599f9fbc5d47 Thomas Gleixner 2008-01-30  157  }

fe599f9fbc5d47 Thomas Gleixner 2008-01-30 158

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org

#12 lore raw
In reply to Carlos Bilbao
Thank you for the patch! Perhaps something to improve:

Hi Carlos,

Thank you for the patch! Perhaps something to improve:

[auto build test WARNING on tip/timers/core]
[also build test WARNING on kvmarm/next abelloni/rtc-next sound/for-next soc/for-next linus/master tip/x86/core v5.14-rc2 next-20210722] [If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]

url:    https://github.com/0day-ci/linux/commits/Carlos-Bilbao/include-linux-Reorganize-timekeeping-and-ktime-headers/20210722-233301
base:   https://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git 2d0a9eb23ccfdf11308bec6db0bc007585d919d2
config: ia64-buildonly-randconfig-r004-20210722 (attached as .config)
compiler: ia64-linux-gcc (GCC) 10.3.0

reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross
# https://github.com/0day-ci/linux/commit/e35011219261f218feeaea55c97d4d583d9747a9
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review Carlos-Bilbao/include-linux-Reorganize-timekeeping-and-ktime-headers/20210722-233301 git checkout e35011219261f218feeaea55c97d4d583d9747a9
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-10.3.0 make.cross ARCH=ia64

If you fix the issue, kindly add following tag as appropriate

All warnings (new ones prefixed by >>):

arch/ia64/kernel/time.c: In function 'timer_interrupt':
arch/ia64/kernel/time.c:190:3: error: implicit declaration of function 'legacy_timer_tick' [-Werror=implicit-function-declaration]

     190 |   legacy_timer_tick(smp_processor_id() == time_keeper_id);
         |   ^~~~~~~~~~~~~~~~~
   arch/ia64/kernel/time.c: At top level:
   arch/ia64/kernel/time.c:259:6: warning: no previous prototype for 'ia64_init_itm' [-Wmissing-prototypes]
     259 | void ia64_init_itm(void)
         |      ^~~~~~~~~~~~~
>> arch/ia64/kernel/time.c:390:6: warning: no previous prototype for 'read_persistent_clock64' [-Wmissing-prototypes]
     390 | void read_persistent_clock64(struct timespec64 *ts)
         |      ^~~~~~~~~~~~~~~~~~~~~~~
   arch/ia64/kernel/time.c:396:1: warning: no previous prototype for 'time_init' [-Wmissing-prototypes]
     396 | time_init (void)
         | ^~~~~~~~~
   cc1: some warnings being treated as errors
--
>> kernel/time/tick-legacy.c:25:6: warning: no previous prototype for 'legacy_timer_tick' [-Wmissing-prototypes]

25 | void legacy_timer_tick(unsigned long ticks)
| ^~~~~~~~~~~~~~~~~

vim +/legacy_timer_tick +25 kernel/time/tick-legacy.c

b3550164a19d62 Arnd Bergmann 2020-09-24  12  
56cc7b8acfb7c7 Arnd Bergmann 2020-09-24  13  /**
56cc7b8acfb7c7 Arnd Bergmann 2020-09-24  14   * legacy_timer_tick() - advances the timekeeping infrastructure
56cc7b8acfb7c7 Arnd Bergmann 2020-09-24  15   * @ticks:	number of ticks, that have elapsed since the last call.
56cc7b8acfb7c7 Arnd Bergmann 2020-09-24  16   *
56cc7b8acfb7c7 Arnd Bergmann 2020-09-24  17   * This is used by platforms that have not been converted to
56cc7b8acfb7c7 Arnd Bergmann 2020-09-24  18   * generic clockevents.
56cc7b8acfb7c7 Arnd Bergmann 2020-09-24  19   *
56cc7b8acfb7c7 Arnd Bergmann 2020-09-24  20   * If 'ticks' is zero, the CPU is not handling timekeeping, so
56cc7b8acfb7c7 Arnd Bergmann 2020-09-24  21   * only perform process accounting and profiling.
56cc7b8acfb7c7 Arnd Bergmann 2020-09-24  22   *
56cc7b8acfb7c7 Arnd Bergmann 2020-09-24  23   * Must be called with interrupts disabled.
56cc7b8acfb7c7 Arnd Bergmann 2020-09-24  24   */

b3550164a19d62 Arnd Bergmann 2020-09-24 @25 void legacy_timer_tick(unsigned long ticks)

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org

#13 lore raw

PATCH v4 1/1 include: linux: Reorganize timekeeping and ktime headers

Reorganize and separate the headers by making ktime.h take care of the ktime_get() family of functions, and reserve timekeeping.h for the actual timekeeping. This also helps to avoid implicit function errors and strengthens the header dependencies, since timekeeping.h was using ktime_to_ns(), a static function defined in a header it does no include, ktime.h. Include the header timekeeping.h wherever it is necessary for a successful compilation after the header code reorganization.

---
Changelog:
- v2: Add three more files that also needed a header update for x86:
pps_kernel.h, posix-timers.c and hda_controller.c
- v3: Cover build tests for other architectures than x86. To compile arm64, update arch/arm64/kvm/hypercalls.c, include/linux/stmmac.h, and drivers/rtc/class.c. No other arch/ seems to need fixes but to be on the safe side compiled arm, mips, powerpc, sparc, s390, riscv and i386.
- v4: Fix warnings pointed out by the kernel test robot.

---
 arch/arm64/kvm/hypercalls.c    |   1 +
 arch/ia64/kernel/time.c        |   1 +
 arch/x86/kernel/rtc.c          |   1 +
 arch/x86/kernel/tsc.c          |   1 +
 drivers/rtc/class.c            |   1 +
 include/linux/ktime.h          | 196 +++++++++++++++++++++++++++++++-
 include/linux/pps_kernel.h     |   1 +
 include/linux/sched_clock.h    |   2 +
 include/linux/stmmac.h         |   1 +
 include/linux/timekeeping.h    | 197 +--------------------------------
 init/main.c                    |   1 +
 kernel/time/ntp.c              |   1 +
 kernel/time/posix-timers.c     |   1 +
 kernel/time/tick-legacy.c      |   1 +
 kernel/time/time.c             |   1 +
 kernel/time/timekeeping.c      |   1 +
 sound/pci/hda/hda_controller.c |   1 +
 17 files changed, 211 insertions(+), 198 deletions(-)
arch/arm64/kvm/hypercalls.c +1 -0
index 30da78f72b3b..41499c1d7379 100644
@@ -3,6 +3,7 @@
 
 #include <linux/arm-smccc.h>
 #include <linux/kvm_host.h>
+#include <linux/timekeeping.h>
 
 #include <asm/kvm_emulate.h>
 
arch/ia64/kernel/time.c +1 -0
index fa9c0ab8c6fc..85e79ff3c98e 100644
@@ -22,6 +22,7 @@
 #include <linux/efi.h>
 #include <linux/timex.h>
 #include <linux/timekeeper_internal.h>
+#include <linux/timekeeping.h>
 #include <linux/platform_device.h>
 #include <linux/sched/cputime.h>
 
arch/x86/kernel/rtc.c +1 -0
index 586f718b8e95..98ea05cc6aeb 100644
@@ -9,6 +9,7 @@
 #include <linux/export.h>
 #include <linux/pnp.h>
 #include <linux/of.h>
+#include <linux/timekeeping.h>
 
 #include <asm/vsyscall.h>
 #include <asm/x86_init.h>
arch/x86/kernel/tsc.c +1 -0
index 2e076a459a0c..b730cb20f5fd 100644
@@ -15,6 +15,7 @@
 #include <linux/timex.h>
 #include <linux/static_key.h>
 #include <linux/static_call.h>
+#include <linux/timekeeping.h>
 
 #include <asm/hpet.h>
 #include <asm/timer.h>
drivers/rtc/class.c +1 -0
index f77bc089eb6b..1bdf1f790beb 100644
@@ -16,6 +16,7 @@
 #include <linux/kdev_t.h>
 #include <linux/idr.h>
 #include <linux/slab.h>
+#include <linux/timekeeping.h>
 #include <linux/workqueue.h>
 
 #include "rtc-core.h"
include/linux/ktime.h +194 -2

200 lines not on this page · raw message

include/linux/pps_kernel.h +1 -0
index 78c8ac4951b5..24970c202ac6 100644
@@ -12,6 +12,7 @@
 #include <linux/cdev.h>
 #include <linux/device.h>
 #include <linux/time.h>
+#include <linux/timekeeping.h>
 
 /*
  * Global defines
include/linux/sched_clock.h +2 -0
index 528718e4ed52..3a1aa2fdd9b2 100644
@@ -5,6 +5,8 @@
 #ifndef LINUX_SCHED_CLOCK
 #define LINUX_SCHED_CLOCK
 
+#include <linux/timekeeping.h>
+
 #ifdef CONFIG_GENERIC_SCHED_CLOCK
 /**
  * struct clock_read_data - data required to read from sched_clock()
include/linux/stmmac.h +1 -0
index 0db36360ef21..bd9b4205b070 100644
@@ -14,6 +14,7 @@
 
 #include <linux/platform_device.h>
 #include <linux/phy.h>
+#include <linux/timekeeping.h>
 
 #define MTL_MAX_RX_QUEUES	8
 #define MTL_MAX_TX_QUEUES	8
include/linux/timekeeping.h +1 -196

206 lines not on this page · raw message

init/main.c +1 -0
index eb01e121d2f1..8c1b2410e74b 100644
@@ -98,6 +98,7 @@
 #include <linux/kcsan.h>
 #include <linux/init_syscalls.h>
 #include <linux/stackdepot.h>
+#include <linux/timekeeping.h>
 
 #include <asm/io.h>
 #include <asm/bugs.h>
kernel/time/ntp.c +1 -0
index 406dccb79c2b..804f06801737 100644
@@ -18,6 +18,7 @@
 #include <linux/module.h>
 #include <linux/rtc.h>
 #include <linux/audit.h>
+#include <linux/timekeeping.h>
 
 #include "ntp_internal.h"
 #include "timekeeping_internal.h"
kernel/time/posix-timers.c +1 -0
index dd5697d7347b..14f82cd95d10 100644
@@ -13,6 +13,7 @@
 #include <linux/interrupt.h>
 #include <linux/slab.h>
 #include <linux/time.h>
+#include <linux/timekeeping.h>
 #include <linux/mutex.h>
 #include <linux/sched/task.h>
 
kernel/time/tick-legacy.c +1 -0
index af225b32f5b3..9a534f716462 100644
@@ -7,6 +7,7 @@
 #include <linux/irq.h>
 #include <linux/profile.h>
 #include <linux/timekeeper_internal.h>
+#include <linux/timekeeping.h>
 
 #include "tick-internal.h"
 
kernel/time/time.c +1 -0
index 29923b20e0e4..7292ed074742 100644
@@ -29,6 +29,7 @@
 #include <linux/timex.h>
 #include <linux/capability.h>
 #include <linux/timekeeper_internal.h>
+#include <linux/timekeeping.h>
 #include <linux/errno.h>
 #include <linux/syscalls.h>
 #include <linux/security.h>
kernel/time/timekeeping.c +1 -0
index 8a364aa9881a..4dfee925adc8 100644
@@ -22,6 +22,7 @@
 #include <linux/pvclock_gtod.h>
 #include <linux/compiler.h>
 #include <linux/audit.h>
+#include <linux/timekeeping.h>
 
 #include "tick-internal.h"
 #include "ntp_internal.h"
sound/pci/hda/hda_controller.c +1 -0
index ca2f2ecd1488..efbbe624d81d 100644
@@ -16,6 +16,7 @@
 #include <linux/module.h>
 #include <linux/pm_runtime.h>
 #include <linux/slab.h>
+#include <linux/timekeeping.h>
 
 #ifdef CONFIG_X86
 /* for art-tsc conversion */
Signature · 1 line
2.25.1