Skip to contentSkip to conversation

linux-next: build failure after merge of the y2038 tree

PATCH Applied Stephen Rothwell 3 participants 3 messages Dec 17, 2018

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

Hi Arnd,

After merging the y2038 tree, today's linux-next build (x86_64 allmodconfig) failed like this:

fs/cifs/dfs_cache.c: In function 'cache_entry_expired':
fs/cifs/dfs_cache.c:106:7: error: implicit declaration of function 'current_kernel_time64'; did you mean 'core_kernel_text'? [-Werror=implicit-function-declaration]

  ts = current_kernel_time64();
       ^~~~~~~~~~~~~~~~~~~~~
       core_kernel_text
fs/cifs/dfs_cache.c:106:5: error: incompatible types when assigning to type 'struct timespec64' from type 'int'
  ts = current_kernel_time64();
     ^
fs/cifs/dfs_cache.c: In function 'get_expire_time':
fs/cifs/dfs_cache.c:342:24: error: incompatible type for argument 1 of 'timespec64_add'
  return timespec64_add(current_kernel_time64(), ts);
                        ^~~~~~~~~~~~~~~~~~~~~~~
In file included from include/linux/restart_block.h:10,
                 from include/linux/thread_info.h:13,
                 from arch/x86/include/asm/preempt.h:7,
                 from include/linux/preempt.h:78,
                 from include/linux/rcupdate.h:40,
                 from fs/cifs/dfs_cache.c:8:
include/linux/time64.h:66:66: note: expected 'struct timespec64' but argument is of type 'int'
 static inline struct timespec64 timespec64_add(struct timespec64 lhs,
                                                ~~~~~~~~~~~~~~~~~~^~~

fs/cifs/dfs_cache.c:343:1: warning: control reaches end of non-void function [-Wreturn-type]
}
^

Caused by commit

ccea641b6742 ("timekeeping: remove obsolete time accessors")

interacting with commit

34a44fb160f9 ("cifs: Add DFS cache routines")

from the cifs tree.

I have applied the following merge fix patch (better versions welcome):

From: Stephen Rothwell <[email protected]>
Date: Mon, 17 Dec 2018 20:03:28 +1100
Subject: [PATCH] cifs: update for current_kernel_time64() removal

---
 fs/cifs/dfs_cache.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
fs/cifs/dfs_cache.c +4 -2
index 70f9c9e2175c..d20cc94d7abd 100644
@@ -103,7 +103,7 @@ static inline bool cache_entry_expired(const struct dfs_cache_entry *ce)
 {
 	struct timespec64 ts;
 
-	ts = current_kernel_time64();
+	ktime_get_coarse_real_ts64(&ts);
 	return timespec64_compare(&ts, &ce->ce_etime) >= 0;
 }
 
@@ -338,8 +338,10 @@ static inline struct timespec64 get_expire_time(int ttl)
 		.tv_sec = ttl,
 		.tv_nsec = 0,
 	};
+	struct timespec64 now;
 
-	return timespec64_add(current_kernel_time64(), ts);
+	ktime_get_coarse_real_ts64(&now);
+	return timespec64_add(now, ts);
 }
 
 /* Allocate a new DFS target */
Signature · 5 lines
2.19.1

-- 
Cheers,
Stephen Rothwell
Acked-by
#1 lore raw
Quoted 8 lines · Stephen Rothwell

I have applied the following merge fix patch (better versions welcome):

From: Stephen Rothwell <[email protected]>
Date: Mon, 17 Dec 2018 20:03:28 +1100
Subject: [PATCH] cifs: update for current_kernel_time64() removal

---

Your patch looks correct, and the conflict should be easy to resolve by Steve merging this into his tree, as ktime_get_coarse_real_ts64() is readily available in mainline kernels.

Quoted 17 lines
 fs/cifs/dfs_cache.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
fs/cifs/dfs_cache.c +1 -1
index 70f9c9e2175c..d20cc94d7abd 100644
@@ -103,7 +103,7 @@ static inline bool cache_entry_expired(const struct dfs_cache_entry *ce)
 {
        struct timespec64 ts;
 
-       ts = current_kernel_time64();
+       ktime_get_coarse_real_ts64(&ts);
        return timespec64_compare(&ts, &ce->ce_etime) >= 0;
 }
 

fs/cifs/dfs_cache.c static inline struct timespec64 get_expire_time(int ttl) · line 345

Quoted 9 lines
fs/cifs/dfs_cache.c +3 -1
@@ -338,8 +338,10 @@ static inline struct timespec64 get_expire_time(int ttl)
                .tv_sec = ttl,
                .tv_nsec = 0,
        };
+       struct timespec64 now;
 
-       return timespec64_add(current_kernel_time64(), ts);
+       ktime_get_coarse_real_ts64(&now);
+       return timespec64_add(now, ts);
 }

In case efficiency is a concern: using ktime_t with ktime_get_coarse_real() may be much faster if we decide to abandon the coarse-grained timespec64 accessors in the future.

Also, I wonder if the expiration here has to use CLOCK_REALTIME, since that is affected by leap second adjustment and clock_settime().

In other modules, we usually concluded that it should be either CLOCK_MONOTONIC or CLOCK_BOOTTIME, depending on whether you want the expiration timer to keep ticking during suspend.

Arnd

Applied
#2 lore raw

Pushed to cifs-2.6.git for-next (after minor commit description text cleanup and adding acked-by and reviewed-by)

Paulo/Aurelien,
Let me know your thoughts about Arnd's additional comments which were interesting.

Quoted 59 lines · Arnd Bergmann
Quoted 8 lines · Stephen Rothwell

I have applied the following merge fix patch (better versions welcome):

From: Stephen Rothwell <[email protected]>
Date: Mon, 17 Dec 2018 20:03:28 +1100
Subject: [PATCH] cifs: update for current_kernel_time64() removal

---

Your patch looks correct, and the conflict should be easy to resolve by Steve merging this into his tree, as ktime_get_coarse_real_ts64() is readily available in mainline kernels.

Quoted 17 lines
 fs/cifs/dfs_cache.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
fs/cifs/dfs_cache.c +1 -1
index 70f9c9e2175c..d20cc94d7abd 100644
@@ -103,7 +103,7 @@ static inline bool cache_entry_expired(const struct dfs_cache_entry *ce)
 {
        struct timespec64 ts;
 
-       ts = current_kernel_time64();
+       ktime_get_coarse_real_ts64(&ts);
        return timespec64_compare(&ts, &ce->ce_etime) >= 0;
 }
 

fs/cifs/dfs_cache.c static inline struct timespec64 get_expire_time(int ttl) · line 345

Quoted 9 lines
fs/cifs/dfs_cache.c +3 -1
@@ -338,8 +338,10 @@ static inline struct timespec64 get_expire_time(int ttl)
                .tv_sec = ttl,
                .tv_nsec = 0,
        };
+       struct timespec64 now;
 
-       return timespec64_add(current_kernel_time64(), ts);
+       ktime_get_coarse_real_ts64(&now);
+       return timespec64_add(now, ts);
 }

In case efficiency is a concern: using ktime_t with ktime_get_coarse_real() may be much faster if we decide to abandon the coarse-grained timespec64 accessors in the future.

Also, I wonder if the expiration here has to use CLOCK_REALTIME, since that is affected by leap second adjustment and clock_settime().

In other modules, we usually concluded that it should be either CLOCK_MONOTONIC or CLOCK_BOOTTIME, depending on whether you want the expiration timer to keep ticking during suspend.

Arnd

Signature · 3 lines
Thanks,

Steve