You have received a new fax.
You can find your fax document in the attachment.
Quality: 100 DPI
Date: Mon, 8 Feb 2016 07:59:25 +0300
File size: 215 Kb
Pages sent: 8
Filename: task-00000320199.doc
Scanned in: 53 seconds
Sender: Henry Pace
Thanks for choosing Interfax!
Introduction
This patch series is aimed at getting rid of CURRENT_TIME and CURRENT_TIME_SEC
macros.
The idea for the series evolved from my discussions with Arnd Bergmann.
This was originally part of the RFC series[2]:
https://lkml.org/lkml/2016/1/7/20 (under discussion).
Dave Chinner suggested moving bug fixes out of the feature series to keep the
original series simple.
There are 354 occurrences of the the above macros in the kernel.
The series will be divided into 4 or 5 parts to keep the parts manageable
and so that each part could be reviewed and merged independently.
This is part 1 of the series.
Motivation
The macros: CURRENT_TIME and CURRENT_TIME_SEC are primarily used for
filesystem timestamps.
But, they are not accurate as they do not perform clamping according to
filesystem timestamps ranges, nor do they truncate the nanoseconds value
to the granularity as required by the filesystem.
The series is also viewed as an ancillary to another upcoming series[2]
that attempts to transition file system timestamps to use 64 bit time to
make these y2038 safe.
There will also be another series[3] to add range checks and clamping to
filesystem time functions that are meant to substitute the above macros.
Solution
CURRENT_TIME macro has an equivalent function:
struct timespec current_fs_time(struct super_block *sb)
These will be the changes to the above function:
1. Function will return the type y2038 safe timespec64 in [2].
2. Function will use y2038 safe 64 bit functions in [2].
3. Function will be extended to perform range checks in [3].
A new function will be added to substitute for CURRENT_TIME_SEC macro
in the current series:
struct timespec current_fs_time_sec(void)
These will be the changes to the above function:
1. Function will return the type y2038 safe timespec64 in [2].
2. Function will use y2038 safe 64 bit functions in [2].
3. Function will be extended to perform range checks in [3].
Any use of these macros outside of filesystem timestamps will
be replaced by function calls to appropriate time functions.
Deepa Dinamani (10):
fs: Add current_fs_time_sec() function
vfs: Replace CURRENT_TIME by current_fs_time()
fs: cifs: Replace CURRENT_TIME with current_fs_time()
fs: cifs: Replace CURRENT_TIME with ktime_get_real_ts()
fs: cifs: Replace CURRENT_TIME by get_seconds
fs: ext4: Replace CURRENT_TIME_SEC with current_fs_time_sec()
fs: ext4: Replace CURRENT_TIME with ext4_current_time()
fs: ceph: replace CURRENT_TIME by current_fs_time()
fs: ceph: Replace CURRENT_TIME by ktime_get_real_ts()
fs: btrfs: Replace CURRENT_TIME by current_fs_time()
fs/btrfs/file.c | 4 ++--
fs/btrfs/inode.c | 25 +++++++++++++------------
fs/btrfs/ioctl.c | 8 ++++----
fs/btrfs/root-tree.c | 2 +-
fs/btrfs/transaction.c | 7 +++++--
fs/btrfs/xattr.c | 2 +-
fs/ceph/file.c | 4 ++--
fs/ceph/inode.c | 2 +-
fs/ceph/mds_client.c | 2 +-
fs/ceph/xattr.c | 4 ++--
fs/cifs/cifsencrypt.c | 4 +++-
fs/cifs/cifssmb.c | 10 +++++-----
fs/cifs/inode.c | 15 +++++++--------
fs/ext4/ext4.h | 2 +-
fs/ext4/super.c | 2 +-
fs/libfs.c | 21 +++++++++++++--------
fs/nsfs.c | 3 ++-
fs/pipe.c | 3 ++-
fs/posix_acl.c | 2 +-
include/linux/fs.h | 5 +++++
20 files changed, 72 insertions(+), 55 deletions(-)
--
1.9.1
This patch replaces timeval with timespec64 as 32 bit 'struct timeval'
will not give current time beyond 2038.
The patch changes the code to use ktime_get_real_ts64() which returns
a 'struct timespec64' instead of do_gettimeofday() which returns a
'struct timeval'
This patch also alters the format strings in sprintf() for now.tv_sec
and now.tv_nsec to incorporate 'long long' on 32 bit architectures and
leading zeroes respectively.
Signed-off-by: Amitoj Kaur Chawla <amitoj1606(a)gmail.com>
Reviewed-by: Arnd Bergmann <arnd(a)arndb.de>
---
Changes in v2:
-change format string of now.tv_sec to '%llu'
-change format string of now.tv_nsec to '%.08lu'
Changes in v3:
-Replace tv_usec with tv_nsec, error made in v2
-Build tested
drivers/misc/ibmasm/ibmasm.h | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)
diff --git a/drivers/misc/ibmasm/ibmasm.h b/drivers/misc/ibmasm/ibmasm.h
index 9b08344..82380ae 100644
--- a/drivers/misc/ibmasm/ibmasm.h
+++ b/drivers/misc/ibmasm/ibmasm.h
@@ -34,6 +34,7 @@
#include <linux/kref.h>
#include <linux/device.h>
#include <linux/input.h>
+#include <linux/time64.h>
/* Driver identification */
#define DRIVER_NAME "ibmasm"
@@ -53,9 +54,10 @@ extern int ibmasm_debug;
static inline char *get_timestamp(char *buf)
{
- struct timeval now;
- do_gettimeofday(&now);
- sprintf(buf, "%lu.%lu", now.tv_sec, now.tv_usec);
+ struct timespec64 now;
+ ktime_get_real_ts64(&now);
+ sprintf(buf, "%llu.%.08lu", (long long)now.tv_sec,
+ now.tv_nsec / NSEC_PER_USEC);
return buf;
}
--
1.9.1
A new fax document for you.
Please check your fax document in the attachment to this e-mail.
Scanned at: Thu, 28 Jan 2016 01:51:32 +0300
Pages scanned: 7
Quality: 100 DPI
File size: 216 Kb
Sender: Matthew Novak
Scan time: 6 seconds
Filename: scanned.000948965.doc
Thanks for choosing Interfax!
Based on the discussion, here is how I propose to proceed:
1. Series for timestamp range check and clamping
2. Bug fixing patches like change all CURRENT_TIME use cases to
current_fs_time()
3. Patches for vfs to use timespec64 internally (maybe a series, if
required)
4. Patches that change all fs that use vfs APIs using timestamp arguments
(not a series)
5. Change individual fs to use timespec64 (not a series)
6. Change back whatever time conversion APIs left in vfs or individual fs
(maybe a series, if required)
So, I don't see a need for submitting another series as all the changes now
are handled on a case by case basis and no longer have a generic theme.
If everyone's in sync then I can proceed with the above plan.
-Deepa
UUID calculation uses 'struct timespec' whose seconds will overflow
in year 2038 and beyond for 32-bit systems. This patch removes the
dependency on 'struct timespec' by using ktime_get_real().
While the patch does not fix a 'bug' as such, it is part of a larger
effort to remove instances of 'struct timespec' and other data-structures
suffering from y2038 problem from the kernel.
Suggested-by: Arnd Bergmann <arnd(a)arndb.de>
Signed-off-by: Tina Ruchandani <ruchandani.tina(a)gmail.com>
Signed-off-by: Arnd Bergmann <arnd(a)arndb.de>
diff --git a/fs/afs/main.c b/fs/afs/main.c
index 35de0c04729f..129ff432391c 100644
--- a/fs/afs/main.c
+++ b/fs/afs/main.c
@@ -14,6 +14,7 @@
#include <linux/init.h>
#include <linux/completion.h>
#include <linux/sched.h>
+#include <linux/ktime.h>
#include "internal.h"
MODULE_DESCRIPTION("AFS Client File System");
@@ -37,7 +38,6 @@ struct workqueue_struct *afs_wq;
*/
static int __init afs_get_client_UUID(void)
{
- struct timespec ts;
u64 uuidtime;
u16 clockseq;
int ret;
@@ -48,9 +48,7 @@ static int __init afs_get_client_UUID(void)
if (ret < 0)
return ret;
- getnstimeofday(&ts);
- uuidtime = (u64) ts.tv_sec * 1000 * 1000 * 10;
- uuidtime += ts.tv_nsec / 100;
+ uuidtime = ktime_divns(ktime_get_real(), 100);
uuidtime += AFS_UUID_TO_UNIX_TIME;
afs_uuid.time_low = uuidtime;
afs_uuid.time_mid = uuidtime >> 32;
You have received a new fax.
Please check your fax document in the attachment to this e-mail.
Quality: 400 DPI
Processed in: 33 seconds
Author: Richard Franklin
Date: Wed, 20 Jan 2016 22:49:43 +0300
Filesize: 150 Kb
Document name: task.000294396.doc
Pages number: 10
Thanks for choosing Interfax!
You have received a new fax.
Please check your fax document in the attachment to this e-mail.
File size: 163 Kb
Scan quality: 100 DPI
Fax name: scanned_0000708965.doc
Pages scanned: 6
Scanned by: Ken Gonzalez
Scanned at: Tue, 19 Jan 2016 17:05:09 +0300
Scanned in: 22 seconds
Thank you for using Interfax!
On Saturday 16 January 2016 12:14:22 Andreas Dilger wrote:
> >>
> >> Sure, and nfs is a pain because of all it's internal use of
> >> timespecs, too.
> >
> > lustre is probably the worst.
>
> Lustre currently only has one-second granularity in a 64-bit field,
> so it doesn't really care about the difference between timespec or
> timespec64 at all.
>
> The only other uses are for measuring relative times, so the 64-bitness
> shouldn't really matter.
>
> Could you please point out what issues exist so they can be fixed.
It's not really a bug that needs to be fixed, but more the general
issue of referencing inode->i_?time and attr->ia_?time and passing
them around. When we change the types in the inode and iattr from
timespec to timespec64, all assigments need to be modified, and lustre
has more of those assignments than any other file system I'm aware of.
Arnd
This is an update to Arnd Bergmann's RFC patch series:
https://lkml.org/lkml/2014/5/30/669 .
The syscalls and runtime libraries will be handled in separate patch series.
The filling of max and min timestamps for individual filesystems can be
leveraged from the patch series:
https://lkml.org/lkml/2015/11/20/413
1. Objective:
To transition all file system code to use 64 bit time.
This translates to using timespec64 across the fs code for any
timestamp representation.
2. Problem Description:
struct timespec cannot represent times after year 2038 on 32 bit
systems.
The alternative to timespec in the kernel world is timespec64 to get
around the above problem. This will be the UAPI exposed interface.
3. Design objectives:
The goal of this approach was to come up with small manageable patches
to address the above problem.
Preferably, a single patch per filesystem that can be merged independently.
Also, a more generic approach that all the individual filesystems could follow
was preferred.
4. Solution:
The solution incorporated in the patch series involves stages defined below:
4.1. CONFIG_FS_USES_64BIT_TIME
This new config is defined to #ifdef code that is required to support 64 bit
times.
4.2. struct inode times:
The struct inode saves {a,c,m}timestamps as struct timespec.
This leads to 2 problems:
a. The size of the structure depends on whether the machine is 32/ 64 bit.
b. y2038 problem described above.
struct timespec64 also has the same problem as in (a) above.
Choosing scalar types to store these timestamps(time64 and s32) solves both the
above problems.
Adding accessors to access these timestamps would hide the internal data type
so that this can be changed according to config in (4.1).
4.3. struct inode_timespec:
Use inode_timespec for all other timestamp representation throughout VFS and
individual filesystems.
inode_timespec is aliased to timespec or timespec64 based on config defined
in (4.1).
Using timespec64 in this stage would require ifdef-ing the code, which is
spread throughout the code.
4.4. Enable config in (4.1).
4.5. Convert inode_timespec to timespec64:
Drop all references to inode_timespec in (4.3).
Replace it with timespec64.
5. Alternate Solution:
Steps involved are:
5.1. Change VFS code to handle both timespec64 and timespec:
There are a few API's in the VFS that take timestamps as arguments:
generic_update_time(), inode->i_op->update_time(), lease_get_mtime(),
fstack_copy_attr_all(), setattr_copy(), generic_fillattr.
The attr and kstat properties could have accessors like inode.
But, the other functions will have to maintain copies or be updated
simultaenously along with other affecting filesystems.
5.2.struct timespec64:
Change individual fs to use timespec64.
5.3. struct inode times:
The struct inode saves {a,c,m}timestamps as struct timespec.
This leads to 2 problems:
a. The size of the structure depends on whether the machine is 32/ 64 bit.
b. y2038 problem described above.
struct timespec64 also has the same problem as in (a) above.
Choosing scalar types to store these timestamps(time64 and s32) solves both the
above problems.
Change individual filesystems to use macros to access inode times.
Inode macros can assume conversion from timespec64 always.
5.4. VFS:
Change vfs code also as above in (1) and (2).
5.5. Drop timespec
This involves dropping support for any api/ struct changes to make vfs use only
timespec64 for timestamps.
6. Rationale:
The advantage of the method described in (5) is that we do not have
inode_timespec aliases only to be dropped later.
But, the method suffers from disadvantages:
a. As mentioned in (5.1), our process is affected as all the filesystems
using each api must be changed simultaenously or VFS should have a copy.
b. While individual filesystems are being changed, VFS will have to have
2 copies of a few apis. This will mean that at this time, any new code
being added might use either. This might lead to confusion.
Misc:
7. Range check:
Patches include range check and clamping of timestamps.
This topic did not have a conclusion on the previous RFC.
7.1. Rationale
The method incorporated in the patch series is based on following principles:
a. Linux does not impose any fixed format for on-disk inodes.
LKML discussion is still ongoing concerning the best handling of file systems
used or updated after their expiration date.
b. Linux cannot surmise the side effects to a file system because of the
wrong timestamps as each fs saves timestamps differently.
c. Individual filesystems must be able to say what to do when timestamps
are clamped.
7.2. Solution
Based on the above principles, the solution is described below:
7.2.1. There are 2 instances that the solution handles differently:
a. While mounting a filesystem:
A filesystem that has already exceeded the range of its timestamp fields.
b. While doing operations on a mounted filesystem:
Timestamps start getting clamped after the filesystem is mounted.
7.2.2. In both the above cases, a function is invoked as per the callbacks registered
by filesystems.
8. Testing
This is a proof of concept implementation.
I want to get some feedback before I convert rest of the file systems.
I've done some initial testing based on the patches below on x86 64 bit arch.
Testing was mainly done on the root filesystem.
mount, stat, touch, read, write system calls were used for testing timestamp clamps and
other functionality.
Patches 8-15 are only included to provide a complete picture.
Deepa Dinamani (15):
fs: add Kconfig entry CONFIG_FS_USES_64BIT_TIME
vfs: Change all structures to support 64 bit time
kernel: time: Add macros and functions to support 64 bit time
vfs: Add support for vfs code to use 64 bit time
fs: cifs: Add support for cifs to use 64 bit time
fs: fat: convert fat to 64 bit time
fs: ext4: convert to use 64 bit time
fs: Enable 64 bit time
fs: cifs: replace inode_timespec with timespec64
fs: fat: replace inode_timespec with timespec64
fs: ext4: replace inode_timespec with timespec64
vfs: remove inode_timespec and timespec references
kernel: time: change inode_timespec to timespec64
vfs: Remove inode_timespec aliases
fs: Drop CONFIG_FS_USES_64BIT_TIME
fs/attr.c | 15 ++---
fs/bad_inode.c | 10 ++-
fs/binfmt_misc.c | 7 +-
fs/cifs/cache.c | 16 +++--
fs/cifs/cifsencrypt.c | 2 +-
fs/cifs/cifsglob.h | 6 +-
fs/cifs/cifsproto.h | 9 +--
fs/cifs/cifssmb.c | 17 +++--
fs/cifs/file.c | 9 ++-
fs/cifs/inode.c | 65 ++++++++++++-------
fs/cifs/netmisc.c | 26 ++++----
fs/ext4/acl.c | 3 +-
fs/ext4/ext4.h | 44 +++++++------
fs/ext4/extents.c | 25 ++++++--
fs/ext4/ialloc.c | 9 ++-
fs/ext4/inline.c | 10 ++-
fs/ext4/inode.c | 16 +++--
fs/ext4/ioctl.c | 16 +++--
fs/ext4/namei.c | 40 ++++++++----
fs/ext4/super.c | 6 +-
fs/ext4/xattr.c | 2 +-
fs/fat/dir.c | 7 +-
fs/fat/fat.h | 8 ++-
fs/fat/file.c | 10 ++-
fs/fat/inode.c | 46 ++++++++++----
fs/fat/misc.c | 7 +-
fs/fat/namei_msdos.c | 40 +++++++-----
fs/fat/namei_vfat.c | 41 ++++++++----
fs/inode.c | 53 +++++++++++-----
fs/libfs.c | 50 ++++++++++++---
fs/locks.c | 5 +-
fs/nsfs.c | 6 +-
fs/pipe.c | 6 +-
fs/posix_acl.c | 2 +-
fs/stack.c | 6 +-
fs/stat.c | 6 +-
fs/super.c | 10 +++
fs/utimes.c | 6 +-
include/linux/fs.h | 101 +++++++++++++++++++++++++----
include/linux/fs_stack.h | 9 +--
include/linux/stat.h | 6 +-
include/linux/time64.h | 4 ++
kernel/time/time.c | 162 ++++++++++++++++++++++++++++++++++++++++++-----
43 files changed, 691 insertions(+), 253 deletions(-)
--
1.9.1
32 bit systems using 'struct timeval' will break in the year 2038, so
we replace the code appropriately.
This patch replaces struct timeval and do_gettimeofday() with
monotonic ktime_get_ns(). Since we are interested in microseconds
portion of the time, we can use NSEC_PER_USEC macro but this would
lead to expensive division for a frequently used function.
Alternatively a bit shift has been done which performs a division of
1024 instead of 1000 which slightly alters the value returned by this
function.
Signed-off-by: Amitoj Kaur Chawla <amitoj1606(a)gmail.com>
---
drivers/scsi/bfa/bfa_cs.h | 8 +-------
1 file changed, 1 insertion(+), 7 deletions(-)
diff --git a/drivers/scsi/bfa/bfa_cs.h b/drivers/scsi/bfa/bfa_cs.h
index 91a8aa3..daee860 100644
--- a/drivers/scsi/bfa/bfa_cs.h
+++ b/drivers/scsi/bfa/bfa_cs.h
@@ -32,13 +32,7 @@
#define BFA_TRC_MAX (4 * 1024)
#endif
-#define BFA_TRC_TS(_trcm) \
- ({ \
- struct timeval tv; \
- \
- do_gettimeofday(&tv); \
- (tv.tv_sec*1000000+tv.tv_usec); \
- })
+#define BFA_TRC_TS(_trcm) (ktime_get_ns() >> 10)
#ifndef BFA_TRC_TS
#define BFA_TRC_TS(_trcm) ((_trcm)->ticks++)
--
1.9.1
32 bit systems using 'time_t' will break in the year 2038, so
we modify the code appropriately.
This patch removes the cast to 'time_t' in the assignment statement
since we are eventually removing the time_t definition from the kernel
as an effort to solve the y2038 problem. This change will avoid the
build error but the code is still broken and requires a change in the
ioctl interface.
Further, since the variable io_profile_start_time will break in 2038
or 2106 depending on user space interpreting it as signed or unsigned,
comments have been added to highlight the same.
Signed-off-by: Amitoj Kaur Chawla <amitoj1606(a)gmail.com>
---
Only apply this patch if it's seen as acceptable that the
io_profile_start_time remains truncated to 32 bits in
IOCMD_ITNIM_GET_IOPROFILE. If this is something that needs to
be fixed by adding a replacement vendor command, leave the
cast in place as a reminder.
drivers/scsi/bfa/bfa_defs_svc.h | 4 ++++
drivers/scsi/bfa/bfa_fcpim.c | 3 ++-
2 files changed, 6 insertions(+), 1 deletion(-)
diff --git a/drivers/scsi/bfa/bfa_defs_svc.h b/drivers/scsi/bfa/bfa_defs_svc.h
index 638f441f..8ab7964 100644
--- a/drivers/scsi/bfa/bfa_defs_svc.h
+++ b/drivers/scsi/bfa/bfa_defs_svc.h
@@ -1211,6 +1211,10 @@ struct bfa_itnim_ioprofile_s {
u32 clock_res_mul;
u32 clock_res_div;
u32 index;
+ /*
+ * Overflow in 2038 or 2106 depending on user space interpreting it as
+ * signed or unsigned.
+ */
u32 io_profile_start_time; /* IO profile start time */
u32 iocomps[BFA_IOBUCKET_MAX]; /* IO completed */
struct bfa_itnim_latency_s io_latency;
diff --git a/drivers/scsi/bfa/bfa_fcpim.c b/drivers/scsi/bfa/bfa_fcpim.c
index 6730340..56df8d0 100644
--- a/drivers/scsi/bfa/bfa_fcpim.c
+++ b/drivers/scsi/bfa/bfa_fcpim.c
@@ -1478,7 +1478,8 @@ bfa_itnim_get_ioprofile(struct bfa_itnim_s *itnim,
return BFA_STATUS_IOPROFILE_OFF;
itnim->ioprofile.index = BFA_IOBUCKET_MAX;
- itnim->ioprofile.io_profile_start_time = (u32)(time_t)
+ /* io_profile_start_time will overflow in 2038 or 2106 */
+ itnim->ioprofile.io_profile_start_time = (u32)
bfa_io_profile_start_time(itnim->bfa);
itnim->ioprofile.clock_res_mul = bfa_io_lat_clock_res_mul;
itnim->ioprofile.clock_res_div = bfa_io_lat_clock_res_div;
--
1.9.1
32 bit systems using 'struct timeval' will break in the year 2038, so
we modify the code appropriately.
We only need to find the elapsed seconds rather than absolute time,
and we only care about full seconds, so it's better to use monotonic
times, so using ktime_get_seconds() makes the code more efficient
and more robust against a concurrent settimeofday()
Since we need monotonic time only, stats_reset_time variable
does not need to be changed from u32 to u64 type.
After the conversion we get a harmless compiler warning about the
possible use of an uninitialised warning. gcc is wrong here and the
code is actually ok. Introducing a temporary status_ok variable to
store the condition avoids the warning.
Signed-off-by: Amitoj Kaur Chawla <amitoj1606(a)gmail.com>
---
drivers/scsi/bfa/bfa_svc.c | 15 +++++++--------
1 file changed, 7 insertions(+), 8 deletions(-)
diff --git a/drivers/scsi/bfa/bfa_svc.c b/drivers/scsi/bfa/bfa_svc.c
index b3668e9..6521896 100644
--- a/drivers/scsi/bfa/bfa_svc.c
+++ b/drivers/scsi/bfa/bfa_svc.c
@@ -3081,7 +3081,6 @@ bfa_fcport_attach(struct bfa_s *bfa, void *bfad, struct bfa_iocfc_cfg_s *cfg,
struct bfa_fcport_s *fcport = BFA_FCPORT_MOD(bfa);
struct bfa_port_cfg_s *port_cfg = &fcport->cfg;
struct bfa_fcport_ln_s *ln = &fcport->ln;
- struct timeval tv;
fcport->bfa = bfa;
ln->fcport = fcport;
@@ -3094,8 +3093,7 @@ bfa_fcport_attach(struct bfa_s *bfa, void *bfad, struct bfa_iocfc_cfg_s *cfg,
/*
* initialize time stamp for stats reset
*/
- do_gettimeofday(&tv);
- fcport->stats_reset_time = tv.tv_sec;
+ fcport->stats_reset_time = ktime_get_seconds();
fcport->stats_dma_ready = BFA_FALSE;
/*
@@ -3345,16 +3343,17 @@ __bfa_cb_fcport_stats_get(void *cbarg, bfa_boolean_t complete)
struct bfa_cb_pending_q_s *cb;
struct list_head *qe, *qen;
union bfa_fcport_stats_u *ret;
+ bool status_ok = (fcport->stats_status == BFA_STATUS_OK);
if (complete) {
- struct timeval tv;
- if (fcport->stats_status == BFA_STATUS_OK)
- do_gettimeofday(&tv);
+ time64_t timestamp;
+ if (status_ok)
+ timestamp = ktime_get_seconds();
list_for_each_safe(qe, qen, &fcport->stats_pending_q) {
bfa_q_deq(&fcport->stats_pending_q, &qe);
cb = (struct bfa_cb_pending_q_s *)qe;
- if (fcport->stats_status == BFA_STATUS_OK) {
+ if (status_ok) {
ret = (union bfa_fcport_stats_u *)cb->data;
/* Swap FC QoS or FCoE stats */
if (bfa_ioc_get_fcmode(&fcport->bfa->ioc))
@@ -3364,7 +3363,7 @@ __bfa_cb_fcport_stats_get(void *cbarg, bfa_boolean_t complete)
bfa_fcport_fcoe_stats_swap(&ret->fcoe,
&fcport->stats->fcoe);
ret->fcoe.secs_reset =
- tv.tv_sec - fcport->stats_reset_time;
+ timestamp - fcport->stats_reset_time;
}
}
bfa_cb_queue_status(fcport->bfa, &cb->hcb_qe,
--
1.9.1
These series of patches try to convert parport device(ppdev) to
y2038 safe, and support y2038 safe and unsafe application at the
same time. The first two version is here[1][2][3].
An y2038 safe application/kernel use 64bit time_t(aka time64_t)
to avoid 32-bit time types broken in the year 2038. Given that
some time relative struct(e.g. timeval in ppdev.c) is mainly the
offset of the real time, the old 32bit time_t in such application
is safe. We need to handle the 32bit time_t and 64bit time_t
application at the same time. My approach here is handle them as
different ioctl command for different size of timeval.
Build successful on arm64, arm and x86_64 with C=1.
Changes since v3:
1. Remove the useless compat ioctl in fs/compat_ioctl.c for
parport device.
Changes since v2:
1. Fix the wrong parameter in copy_to_user.
Changes since v1:
1. Fix the warning when build against x86_64.
[1] https://lkml.org/lkml/2015/12/9/32
[2] https://lkml.org/lkml/2015/12/17/111
[3] http://www.spinics.net/lists/y2038/msg01059.html
Bamvor Jian Zhang (3):
ppdev: convert to y2038 safe
ppdev: add support for compat ioctl
fs/compat: remove useless compat ioctl for parport device
drivers/char/ppdev.c | 87 ++++++++++++++++++++++++++++++++++++++++------------
fs/compat_ioctl.c | 22 -------------
2 files changed, 67 insertions(+), 42 deletions(-)
--
2.1.4
These series of patches try to convert parport device(ppdev) to
y2038 safe, and support y2038 safe and unsafe application at the
same time. The first version is here[1].
An y2038 safe application/kernel use 64bit time_t(aka time64_t)
to avoid 32-bit time types broken in the year 2038. Given that
some time relative struct(e.g. timeval in ppdev.c) is mainly the
offset of the real time, the old 32bit time_t in such application
is safe. We need to handle the 32bit time_t and 64bit time_t
application at the same time. My approach here is handle them as
different ioctl command for different size of timeval.
Build successful on arm64, arm and x86_64.
Changes since v1:
1. Fix the warning when build against x86_64.
[1] https://lkml.org/lkml/2015/12/9/32
Bamvor Jian Zhang (2):
ppdev: convert to y2038 safe
ppdev: add support for compat ioctl
drivers/char/ppdev.c | 87 ++++++++++++++++++++++++++++++++++++++++------------
1 file changed, 67 insertions(+), 20 deletions(-)
--
2.1.4
On Thu, Jan 07, 2016 at 09:50:30AM +0100, Michael Adam wrote:
> Hi,
>
> the patch contains a conflict resolution artifact..
>
Thanks, I've fixed it in my tree now.
I will wait to hear other comments before I send an update.
-Deepa
These series of patches try to convert parport device(ppdev) to
y2038 safe, and support y2038 safe and unsafe application at the
same time. The first two version is here[1][2].
An y2038 safe application/kernel use 64bit time_t(aka time64_t)
to avoid 32-bit time types broken in the year 2038. Given that
some time relative struct(e.g. timeval in ppdev.c) is mainly the
offset of the real time, the old 32bit time_t in such application
is safe. We need to handle the 32bit time_t and 64bit time_t
application at the same time. My approach here is handle them as
different ioctl command for different size of timeval.
Build successful on arm64, arm and x86_64.
Changes since v2:
1. Fix the wrong parameter in copy_to_user.
Changes since v1:
1. Fix the warning when build against x86_64.
[1] https://lkml.org/lkml/2015/12/9/32
[2] https://lkml.org/lkml/2015/12/17/111
Bamvor Jian Zhang (2):
ppdev: convert to y2038 safe
ppdev: add support for compat ioctl
drivers/char/ppdev.c | 87 ++++++++++++++++++++++++++++++++++++++++------------
1 file changed, 67 insertions(+), 20 deletions(-)
--
2.1.4
The y2038 issue of printer exist in the time_t of timeval in ioctl
LPSETTIME. This patch try to convert it to y2038 safe by the
following steps:
1. Remove timeval from lp_set_timeout in order to support 32bit and
64bit time_t in the same function without the new definition
of timeval64 or something else.
2. Handle both 32bit and 64bit time in the same LPSETTIMEOUT switch
case in order to support y2038 safe and non-safe cases.
3. Merge compat of LPSETTIMEOUT into non-comapt one.
I thought split these steps into three different patches. But I feel
these changes are simple and direct.
Signed-off-by: Bamvor Jian Zhang <bamvor.zhangjian(a)linaro.org>
---
drivers/char/lp.c | 94 ++++++++++++++++++++++++++++++-------------------------
1 file changed, 52 insertions(+), 42 deletions(-)
diff --git a/drivers/char/lp.c b/drivers/char/lp.c
index c4094c4..a207e0c 100644
--- a/drivers/char/lp.c
+++ b/drivers/char/lp.c
@@ -136,6 +136,14 @@
#include <asm/irq.h>
#include <asm/uaccess.h>
+/*
+ * FIXME: It should be removed after COMPAT_USE_64BIT_TIME is accessible for
+ * 32bit architecture.
+ */
+#ifndef COMPAT_USE_64BIT_TIME
+#define COMPAT_USE_64BIT_TIME (0)
+#endif /* COMPAT_USE_64BIT_TIME */
+
/* if you have more than 8 printers, remember to increase LP_NO */
#define LP_NO 8
@@ -572,6 +580,22 @@ static int lp_release(struct inode * inode, struct file * file)
return 0;
}
+static int lp_set_timeout(unsigned int minor, s64 tv_sec, s64 tv_usec)
+{
+ long to_jiffies;
+
+ if ((tv_sec < 0) || (tv_usec < 0))
+ return -EINVAL;
+
+ to_jiffies = usecs_to_jiffies(tv_usec);
+ to_jiffies += tv_sec * (long)HZ;
+ if (to_jiffies <= 0)
+ return -EINVAL;
+
+ lp_table[minor].timeout = to_jiffies;
+ return 0;
+}
+
static int lp_do_ioctl(unsigned int minor, unsigned int cmd,
unsigned long arg, void __user *argp)
{
@@ -586,6 +610,9 @@ static int lp_do_ioctl(unsigned int minor, unsigned int cmd,
if ((LP_F(minor) & LP_EXIST) == 0)
return -ENODEV;
switch ( cmd ) {
+ s32 time32[2];
+ s64 time64[2];
+
case LPTIME:
if (arg > UINT_MAX / HZ)
return -EINVAL;
@@ -647,58 +674,49 @@ static int lp_do_ioctl(unsigned int minor, unsigned int cmd,
sizeof(struct lp_stats));
break;
#endif
- case LPGETFLAGS:
- status = LP_F(minor);
+ case LPGETFLAGS:
+ status = LP_F(minor);
if (copy_to_user(argp, &status, sizeof(int)))
return -EFAULT;
break;
+ case LPSETTIMEOUT:
+ /*
+ * For 64bit application or 32bit application with 64bit
+ * time_t
+ */
+ if ((IS_ENABLED(CONFIG_64BIT) && !is_compat_task())
+ || COMPAT_USE_64BIT_TIME) {
+ if (copy_from_user(time64, argp,
+ sizeof(time64)))
+ return -EFAULT;
+
+ return lp_set_timeout(minor, time64[0],
+ time64[1]);
+ } else {
+ if (copy_from_user(time32, argp,
+ sizeof(time32)))
+ return -EFAULT;
+
+ return lp_set_timeout(minor, time32[0],
+ time32[1]);
+ }
+ break;
default:
retval = -EINVAL;
}
return retval;
}
-static int lp_set_timeout(unsigned int minor, struct timeval *par_timeout)
-{
- long to_jiffies;
-
- /* Convert to jiffies, place in lp_table */
- if ((par_timeout->tv_sec < 0) ||
- (par_timeout->tv_usec < 0)) {
- return -EINVAL;
- }
- to_jiffies = DIV_ROUND_UP(par_timeout->tv_usec, 1000000/HZ);
- to_jiffies += par_timeout->tv_sec * (long) HZ;
- if (to_jiffies <= 0) {
- return -EINVAL;
- }
- lp_table[minor].timeout = to_jiffies;
- return 0;
-}
-
static long lp_ioctl(struct file *file, unsigned int cmd,
unsigned long arg)
{
unsigned int minor;
- struct timeval par_timeout;
int ret;
minor = iminor(file_inode(file));
mutex_lock(&lp_mutex);
- switch (cmd) {
- case LPSETTIMEOUT:
- if (copy_from_user(&par_timeout, (void __user *)arg,
- sizeof (struct timeval))) {
- ret = -EFAULT;
- break;
- }
- ret = lp_set_timeout(minor, &par_timeout);
- break;
- default:
- ret = lp_do_ioctl(minor, cmd, arg, (void __user *)arg);
- break;
- }
+ ret = lp_do_ioctl(minor, cmd, arg, (void __user *)arg);
mutex_unlock(&lp_mutex);
return ret;
@@ -709,19 +727,11 @@ static long lp_compat_ioctl(struct file *file, unsigned int cmd,
unsigned long arg)
{
unsigned int minor;
- struct timeval par_timeout;
int ret;
minor = iminor(file_inode(file));
mutex_lock(&lp_mutex);
switch (cmd) {
- case LPSETTIMEOUT:
- if (compat_get_timeval(&par_timeout, compat_ptr(arg))) {
- ret = -EFAULT;
- break;
- }
- ret = lp_set_timeout(minor, &par_timeout);
- break;
#ifdef LP_STATS
case LPGETSTATS:
/* FIXME: add an implementation if you set LP_STATS */
--
2.1.4
From: Shraddha Barke <shraddha.6596(a)gmail.com>
32-bit systems using 'struct timeval' will break in the year 2038,
in order to avoid that replace the code with more appropriate types.
This patch replaces the use of struct timeval and do_gettimeofday()
with ktime_get_real_seconds() which returns a 64 bit seconds value.
Real time is used since if monotonic time is used we would get
duplicate timestamps after reboot as monotonic time starts from
zero on every reboot.
Signed-off-by: Shraddha Barke <shraddha.6596(a)gmail.com>
---
Changes in v2-
Used real time and updated commit message.
drivers/block/sx8.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/drivers/block/sx8.c b/drivers/block/sx8.c
index 59c91d4..1ec9fd2 100644
--- a/drivers/block/sx8.c
+++ b/drivers/block/sx8.c
@@ -23,7 +23,7 @@
#include <linux/workqueue.h>
#include <linux/bitops.h>
#include <linux/delay.h>
-#include <linux/time.h>
+#include <linux/ktime.h>
#include <linux/hdreg.h>
#include <linux/dma-mapping.h>
#include <linux/completion.h>
@@ -671,17 +671,17 @@ static int carm_send_special (struct carm_host *host, carm_sspc_t func)
static unsigned int carm_fill_sync_time(struct carm_host *host,
unsigned int idx, void *mem)
{
- struct timeval tv;
struct carm_msg_sync_time *st = mem;
- do_gettimeofday(&tv);
+ time64_t kt = ktime_get_real_seconds();
memset(st, 0, sizeof(*st));
st->type = CARM_MSG_MISC;
st->subtype = MISC_SET_TIME;
st->handle = cpu_to_le32(TAG_ENCODE(idx));
- st->timestamp = cpu_to_le32(tv.tv_sec);
+ st->timestamp = cpu_to_le32(kt);
+ /* This driver will break in 2106 */
return sizeof(struct carm_msg_sync_time);
}
--
2.1.4
A new fax document for you.
To view it please open the attachment.
Scanned at: Wed, 23 Dec 2015 10:26:50 +0300
Scanned by: Ernest Hoover
Filesize: 116 Kb
Pages: 12
Quality: 400 DPI
File name: fax_00325060.doc
Processed in: 50 seconds
Thanks for choosing Interfax!
You have a new fax!
Please, download fax document attached to this email.
Pages sent: 4
Scanned: Tue, 22 Dec 2015 12:17:43 +0300
Processed in: 44 seconds
Resolution: 600 DPI
Fax name: scanned_00284615.doc
Author: Felix Singer
Filesize: 300 Kb
Thank you for using Interfax!
32-bit systems using 'struct timeval' will break in the year 2038,
in order to avoid that replace the code with more appropriate types.
This patch replaces timeval with 64 bit ktime_t which is y2038 safe.
Since st->timestamp is only interested in seconds, directly using
time64_t here. Function ktime_get_seconds is used since it uses
monotonic instead of real time and thus will not cause overflow.
Signed-off-by: Shraddha Barke <shraddha.6596(a)gmail.com>
---
drivers/block/sx8.c | 7 +++----
1 file changed, 3 insertions(+), 4 deletions(-)
diff --git a/drivers/block/sx8.c b/drivers/block/sx8.c
index 59c91d4..baadb77 100644
--- a/drivers/block/sx8.c
+++ b/drivers/block/sx8.c
@@ -23,7 +23,7 @@
#include <linux/workqueue.h>
#include <linux/bitops.h>
#include <linux/delay.h>
-#include <linux/time.h>
+#include <linux/ktime.h>
#include <linux/hdreg.h>
#include <linux/dma-mapping.h>
#include <linux/completion.h>
@@ -671,16 +671,15 @@ static int carm_send_special (struct carm_host *host, carm_sspc_t func)
static unsigned int carm_fill_sync_time(struct carm_host *host,
unsigned int idx, void *mem)
{
- struct timeval tv;
struct carm_msg_sync_time *st = mem;
- do_gettimeofday(&tv);
+ time64_t tv = ktime_get_seconds();
memset(st, 0, sizeof(*st));
st->type = CARM_MSG_MISC;
st->subtype = MISC_SET_TIME;
st->handle = cpu_to_le32(TAG_ENCODE(idx));
- st->timestamp = cpu_to_le32(tv.tv_sec);
+ st->timestamp = cpu_to_le32(tv);
return sizeof(struct carm_msg_sync_time);
}
--
2.1.4
From: Shraddha Barke <shraddha.6596(a)gmail.com>
32-bit systems using 'struct timeval' will break in the year 2038,
in order to avoid that the code should be replaced with appropriate
types. This patch replaces timeval with 64-bit ktime_t which is y2038
safe. Here, time64_t is used directly since mlc->lcv_t is interested
only in seconds.
Signed-off-by: Shraddha Barke <shraddha.6596(a)gmail.com>
---
drivers/input/serio/hil_mlc.c | 8 +++-----
include/linux/hil_mlc.h | 2 +-
2 files changed, 4 insertions(+), 6 deletions(-)
diff --git a/drivers/input/serio/hil_mlc.c b/drivers/input/serio/hil_mlc.c
index 65605e4..fb297aa 100644
--- a/drivers/input/serio/hil_mlc.c
+++ b/drivers/input/serio/hil_mlc.c
@@ -274,14 +274,12 @@ static int hilse_match(hil_mlc *mlc, int unused)
/* An LCV used to prevent runaway loops, forces 5 second sleep when reset. */
static int hilse_init_lcv(hil_mlc *mlc, int unused)
{
- struct timeval tv;
+ time64_t now = ktime_get_seconds();
- do_gettimeofday(&tv);
-
- if (mlc->lcv && (tv.tv_sec - mlc->lcv_tv.tv_sec) < 5)
+ if (mlc->lcv && (now - mlc->lcv_t) < 5)
return -1;
- mlc->lcv_tv = tv;
+ mlc->lcv_t = now;
mlc->lcv = 0;
return 0;
diff --git a/include/linux/hil_mlc.h b/include/linux/hil_mlc.h
index 394a840..29bb5e3 100644
--- a/include/linux/hil_mlc.h
+++ b/include/linux/hil_mlc.h
@@ -149,7 +149,7 @@ struct hil_mlc {
int ddi; /* Last operational device id */
int lcv; /* LCV to throttle loops */
- struct timeval lcv_tv; /* Time loop was started */
+ time64_t lcv_t; /* Time loop was started */
int di_map[7]; /* Maps below items to live devs */
struct hil_mlc_devinfo di[HIL_MLC_DEVMEM];
--
2.1.4
The first two patches contain the basic framework for the 64 bit time migration
for filesystems.
The next two patches shows how the framework has been adapted to vfs layer and
cifs filesystem.
There might be some minor changes or additions required as I start adapting to
other filesystems.
The change to timestamp conversion functions(to and from unix format to others)
and range checks will be part of a separate series.
Changes since v1:
* move SYSTEM_TIME macros to fs.h
* add 64 bit version of CURRENT_TIME macros.
Deepa Dinamani (4):
vfs: Add 64 bit time support
kernel: time: Add macros and functions to support 64 bit time
vfs: Add support for vfs code to use 64 bit time.
fs: cifs: Add support for cifs to use 64 bit time
fs/attr.c | 14 ++++-----
fs/bad_inode.c | 9 ++++--
fs/binfmt_misc.c | 7 +++--
fs/cifs/cache.c | 16 ++++++----
fs/cifs/cifsencrypt.c | 2 +-
fs/cifs/cifsglob.h | 6 ++--
fs/cifs/cifsproto.h | 7 +++--
fs/cifs/cifssmb.c | 9 ++++--
fs/cifs/file.c | 9 ++++--
fs/cifs/inode.c | 68 +++++++++++++++++++++++++---------------
fs/cifs/netmisc.c | 10 +++---
fs/inode.c | 44 ++++++++++++++++----------
fs/libfs.c | 58 +++++++++++++++++++++++++---------
fs/locks.c | 5 ++-
fs/nsfs.c | 6 +++-
fs/pipe.c | 6 +++-
fs/posix_acl.c | 2 +-
fs/stat.c | 6 ++--
fs/utimes.c | 4 +--
include/linux/fs.h | 85 +++++++++++++++++++++++++++++++++++++++++++-------
include/linux/stat.h | 6 ++--
include/linux/time64.h | 39 +++++++++++++++++++++++
kernel/time/time.c | 65 +++++++++++++++++++++++++++++++++++++-
23 files changed, 366 insertions(+), 117 deletions(-)
--
1.9.1
The first two patches contain the basic framework for the 64 bit time migration
for filesystems.
The next two patches shows how the framework has been adapted to vfs layer and
cifs filesystem.
There might be some minor changes or additions required as I start adapting to
other filesystems.
The change to timestamp conversion functions(to and from unix format to others)
and range checks will be part of a separate series.
Changes since RFC:
* struct inode_time added unconditionally
* uniform use of CONFIG_FS_USES_64BIT_TIME
* struct inode_timespec added
* merged the first two patches in the previous series
Deepa Dinamani (4):
vfs: Add 64 bit time support
kernel: time: Add macros and functions to support 64 bit time
vfs: Add support for vfs code to use 64 bit time.
fs: cifs: Add support for cifs to use 64 bit time
fs/attr.c | 14 +++++-----
fs/bad_inode.c | 9 ++++--
fs/binfmt_misc.c | 7 +++--
fs/cifs/cache.c | 16 +++++++----
fs/cifs/cifsencrypt.c | 2 +-
fs/cifs/cifsglob.h | 6 ++--
fs/cifs/cifsproto.h | 7 +++--
fs/cifs/cifssmb.c | 9 ++++--
fs/cifs/file.c | 9 ++++--
fs/cifs/inode.c | 68 +++++++++++++++++++++++++++++-----------------
fs/cifs/netmisc.c | 10 +++----
fs/inode.c | 44 +++++++++++++++++++-----------
fs/libfs.c | 58 +++++++++++++++++++++++++++++----------
fs/locks.c | 5 ++--
fs/nsfs.c | 6 +++-
fs/pipe.c | 6 +++-
fs/posix_acl.c | 2 +-
fs/stat.c | 6 ++--
fs/utimes.c | 4 +--
include/linux/fs.h | 74 ++++++++++++++++++++++++++++++++++++++++++--------
include/linux/stat.h | 6 ++--
include/linux/time64.h | 43 +++++++++++++++++++++++++++++
kernel/time/time.c | 65 +++++++++++++++++++++++++++++++++++++++++++-
23 files changed, 359 insertions(+), 117 deletions(-)
--
1.9.1
Concerned with migrating the key related structs in security/keys to
use 64-bit time datatypes; and their corresponding system calls and
macros. The patches are highly correlated and should be either accepted
or rejected as a series. However, they were generated in such
a way that they would be independent. This is for the sake of
readability and to avoid the introduction of new warnings while
building the kernel.
Aya Mahfouz (2):
security: keys: migrate structs key and keyring_search_context
security: keys: migrate struct key_preparsed_payload and time_t
variables
include/linux/key-type.h | 2 +-
include/linux/key.h | 6 +++---
security/keys/gc.c | 20 ++++++++++----------
security/keys/internal.h | 8 ++++----
security/keys/key.c | 20 +++++++-------------
security/keys/keyring.c | 16 ++++++++--------
security/keys/permission.c | 3 +--
security/keys/proc.c | 8 ++++----
security/keys/process_keys.c | 2 +-
9 files changed, 39 insertions(+), 46 deletions(-)
--
2.4.3
--
Kind Regards,
Aya Saif El-yazal Mahfouz
This is the basic framework for the 64 bit time migration for filesystems.
There might be some changes or additions required as I start adapting to
filesystems.
This gives the basic high level concept so that we can start discussing.
Actual changes to vfs and other file systems will be in a separate
series.
Changes since v1:
* struct inode_time added unconditionally
* uniform use of CONFIG_FS_USES_64BIT_TIME
Deepa Dinamani (4):
fs: vfs: add accessors for inode times
fs: Add new data type for inode times
fs: Add support for 64 bit time
fs: macros and functions support 64 bit time
include/linux/fs.h | 42 +++++++++++++++++++++++++++++++++++-------
include/linux/stat.h | 12 +++++++++---
include/linux/time.h | 2 ++
include/linux/time64.h | 50 ++++++++++++++++++++++++++++++++++++++++++++++++++
kernel/time/time.c | 28 ++++++++++++++++++++++++++++
5 files changed, 124 insertions(+), 10 deletions(-)
--
1.9.1
Hi,
I am new to linux kernel and trying to understand the process of
different git branch to work.
So, if I am not wrong then there are different branch like stable, next,
staging etc. Previously I work with staging branch so if I am making
any changes for drivers/staging I have to work with staging branch like
follow.
git clone
git checkout -t -b staging-testing origin/staging-testing
git chekcout -b MY_LOCAL_BRANCH
not do work and subimt
So, how it work for other source structure, like now I want to make some
for y2038 -> drivers/scsi which branch should I set up and work with,
next/stable/or is there any specific y2038 branch.
Any wiki link or documentation that explain this full process which
branch to work with when making changes to specific directory will be
useful.
Thanks,
Shirish
These series of patches try to convert parport device(ppdev) to
y2038 safe, and support y2038 safe and unsafe application at the
same time. There were some discussions in y2038 mailing list[1].
An y2038 safe application/kernel use 64bit time_t(aka time64_t)
to avoid 32-bit time types broken in the year 2038. Given that
some time relative struct(e.g. timeval in ppdev.c) is mainly the
offset of the real time, the old 32bit time_t in such application
is safe. We need to handle the 32bit time_t and 64bit time_t
application at the same time. My approach here is handle them as
different ioctl command for different size of timeval.
Build successful on arm64 and arm.
[1] https://lists.linaro.org/pipermail/y2038/
Bamvor Jian Zhang (2):
ppdev: convert to y2038 safe
ppdev: add support for compat ioctl
drivers/char/ppdev.c | 86 ++++++++++++++++++++++++++++++++++++++++------------
1 file changed, 66 insertions(+), 20 deletions(-)
--
2.1.4
Here is the sixth version for converting parport device(ppdev) to
y2038 safe. The first four could found at [1][2][3][4][5].
An y2038 safe application/kernel use 64bit time_t(aka time64_t)
instead of 32bit time_t. Given that some time relative struct(e.g.
timeval in ppdev.c) is mainly the offset of the real time, the old
32bit time_t in such application is safe. We need to handle the
32bit time_t and 64bit time_t application at the same time.
My approach here is handle them as different ioctl command for
different size of timeval.
Build successful on arm64 and arm.
Changes since v5:
1. Replace PP[GS]ETTIME_safe/unsafe with PP[GS]ETTIME32/64.
2. Rewirte PPSETTIME ioctl with jiffies_to_timespec64 in order to
replace user fake HZ(TICK_USEC) to kernel HZ(TICK_NSEC).
3. define tv_sec as long and tv_usec as int in pp_set_timeout. It
should be enough for the timeout.
Change since v4:
1. change type of tv_sec and tv_usec to s64 in pp_set_timeout.
Use s64 could avoid s64 cast to s32 in arm 32bit.
Changes since V3:
1. create pp_set_timeout, pp_get_timeout to reduce the duplicated
code in my patch according to the suggestion of arnd.
I use div_u64_rem instead of jiffies_to_timespec64 because
it could save a divide operaion.
[1] https://lists.linaro.org/pipermail/y2038/2015-June/000522.html
[2] https://lists.linaro.org/pipermail/y2038/2015-June/000567.html
[3] https://lists.linaro.org/pipermail/y2038/2015-November/001093.html
[4] https://lists.linaro.org/pipermail/y2038/2015-November/001132.html
[5] https://lists.linaro.org/pipermail/y2038/2015-December/001201.html
Bamvor Jian Zhang (2):
ppdev: convert to y2038 safe
ppdev: add support for compat ioctl
drivers/char/ppdev.c | 86 ++++++++++++++++++++++++++++++++++++++++------------
1 file changed, 66 insertions(+), 20 deletions(-)
--
2.1.4
This is the basic framework for the 64 bit time migration for filesystems.
There might be some changes or additions required as I start adapting to
filesystems.
This gives the basic high level concept so that we can start discussing.
Actual changes to vfs and other file systems will be in a separate
series.
Deepa Dinamani (4):
fs: vfs: add accessors for inode times
fs: Add new data type for inode times
fs: Add support for 64 bit time
fs: macros and functions support 64 bit time
include/linux/fs.h | 42 ++++++++++++++++++++++++++++++++-------
include/linux/stat.h | 12 +++++++++---
include/linux/time.h | 2 ++
include/linux/time64.h | 53 ++++++++++++++++++++++++++++++++++++++++++++++++++
kernel/time/time.c | 28 ++++++++++++++++++++++++++
5 files changed, 127 insertions(+), 10 deletions(-)
--
1.9.1
Here is the fifth version for converting parport device(ppdev) to
y2038 safe. The first four could found at [1], [2], [3], [4].
An y2038 safe application/kernel use 64bit time_t(aka time64_t)
instead of 32bit time_t. There are the 5 cases need to support:
summary |u:arch |u:tv_sec |k:arch |k:tv_sec
-------------------|-------|---------|-------|--------
32_y2038_unsafe |32 |32 |32 |32
32_y2038_safe |32 |64 |32 |64
compat_y2038_unsafe|32 |32 |64 |64
compat_y2038_safe |32 |64 |64 |64
64_y2038_safe |64 |64 |64 |64
notes:
1. xxx_y2038_safe/unsafe. 32 means app running on the 32bit
kernel. Compat means 32bit app running on 64bit kernel. 64
means 64bit app running on 64bit kernel.
2. 1.3.5 are the original one, we need keep the compatability.
2,4 is new one we need to support.
There are different ways to do this. Convert to 64bit time and/or
define COMPAT_USE_64BIT_TIME 0 or 1 to indicate y2038 safe or unsafe.
But it is not mean that we need to convert all the time relative
struct to 64bit. Because some time relative struct(e.g. timeval in
ppdev.c) is mainly the offset of the real time.
The main issue in ppdev.c is PPSETTIME/PPGETTIME which transfer
timeval between user space and kernel. My approach here is handle them
as different ioctl command.
Build successful on arm64 and arm.
Change since v4:
1. change type of tv_sec and tv_usec to s64 in pp_set_timeout.
Use s64 could avoid s64 cast to s32 in arm 32bit.
Changes since V3:
1. create pp_set_timeout, pp_get_timeout to reduce the duplicated
code in my patch according to the suggestion of arnd.
I use div_u64_rem instead of jiffies_to_timespec64 because
it could save a divide operaion.
[1] https://lists.linaro.org/pipermail/y2038/2015-June/000522.html
[2] https://lists.linaro.org/pipermail/y2038/2015-June/000567.html
[3] https://lists.linaro.org/pipermail/y2038/2015-November/001093.html
[4] https://lists.linaro.org/pipermail/y2038/2015-November/001132.html
Bamvor Jian Zhang (2):
ppdev: convert to y2038 safe
ppdev: add support for compat ioctl
drivers/char/ppdev.c | 92 ++++++++++++++++++++++++++++++++++++++++------------
1 file changed, 72 insertions(+), 20 deletions(-)
--
2.1.4
On Friday 27 November 2015 18:00:29 WEN Pingbo wrote:
> To solve the y2038 problem in input_event, I had some attempts before [1],
> and this is the second one.
>
> We can force userspace to use monotonic time in event timestamp, so the
> 'struct timeval' is enough to keep y2038-safe, as Arnd suggested. But we
> can not find a way to make kernel compatible with old binaries, which use
> realtime, and there are still some devices, which depend on realtime.
>
> So I get a idea to add a new evdev interface, which is y2038 safe. And
> userspace can switch between the old and new interface via ioctl.
>
> The patch series add three evdev interface type:
>
> - EV_IF_LEGACY
> send event by input_event. This is the default option, keep kernel
> backward compatible.
The problem I see with this approach is that it still breaks any
legacy source code that is compiled with a new libc that uses 64-bit
time_t. If we are requiring source code changes for building users
of input devices with a new libc, we can easily get them to handle
the overflow (they normally only care about the microsecond portion
anyway, so it doesn't matter in most cases), or to use monotonic time.
Did I miss something here?
Arnd
Notice to Appear,
You have not paid for driving on a toll road.
You are kindly asked to pay your debt as soon as possible.
You can review the invoice in the attachment.
Sincerely,
Floyd Donovan,
E-ZPass Agent.
Hi,
Is your target market already defined?
Are your new customer acquisition efforts ineffective through direct mail,
phone contact, or traditional mass media?
Where do you find verified Email Marketing lists mailing lists that I know
are deliverable?
Our highly targeted databases are guaranteed to put you, your sales teams,
and your products or services in front of the correct buying contacts in
your industry. With the highest ROI of all marketing channels, acquisition
email as a lead generation medium is second to none.
We provide verified prospect lists from your industry and region today,
complete with vital company and contact information, and of course, email
addresses.
Our lists will allow you to:
. Extend your reach: Introduce your company, product or service to
new audiences.
. Extend your relevance: Reach more of the correct prospects and
relevant buyers through the most active and responsive business
communication channel available today, email.
We're so confident in our data that we'll allow you to sample it at no cost.
Test us.test the data.it's that simple!
Talk to us or reply back with your target market criteria, including your
target industries and the job titles for the contacts who are the primary
purchasers of your products and services. We will get back to you with the
sample.
Jessica Smith
Sr. Marketing Executive
____________________________________________________________________________
__
We respect your privacy. If you do not wish to receive future e-mail please
reply with "REMOVE".
On Friday 27 November 2015 18:00:31 WEN Pingbo wrote:
> This patch depends on 'introduce new evdev interface'.
>
> Userspace cat set / get evdev interface type via the two ioctl
> commands. And default interface type is EV_IF_LEGACY, so the old binary
> will work normal with new kernel. Maybe we should change this default
> option to encourage people to move to new interface.
>
> And since all events are stored as input_value in evdev, there are no
> need to flush evdev_client's buffer if we change clk_type and if_type.
I would split out the change to evdev_set_clk_type into a separate patch.
> + case EVIOCSIFTYPE:
> + if (get_user(if_type, ip))
> + return -EFAULT;
> +
> + return evdev_set_if_type(client, if_type);
> + case EVIOCGIFTYPE:
> + return put_user(client->if_type, ip);
> }
This look asymmetric: EVIOCSIFTYPE uses a EVDEV_* constant, while
EVIOCGIFTYPE returns a EV_IF_* constant. Should those just
be the same constants anyway?
Arnd