Replace the use of struct timeval and do_gettimeofday() with
64 bit ktime_get_real_seconds. Prevents 32-bit type overflow
in year 2038 on 32-bit systems.
Driver was using the seconds portion of struct timeval (.tv_secs)
to pass a millseconds timestamp to the firmware. This change maintains
that same behavior using ktime_get_real_seconds.
The structure used to pass the timestamp to firmware is 48 bits and
works fine as long as the top 16 bits are zero and they will be zero
for a long time..ie. thousands of years.
Alternative Change: Add sub second granularity to timestamp
As noted above, the driver only used the seconds portion of timeval,
ignores the microseconds portion, and by multiplying by 1000 effectively
does a <<10 and always writes zero into timestamp[0].
The alternative change would pass all the bits to the firmware:
struct timespec64 ts;
ktime_get_real_ts64(&ts);
timestamp = ts.tv_sec * MSEC_PER_SEC + ts.tv_nsec / NSEC_PER_MSEC;
MAINTAINER: Please request alternate change if preferred.
Signed-off-by: Alison Schofield <amsfield22(a)gmail.com>
---
Change in v3:
* move alternative change proposal above the '---' to save
Changes in v2:
* add pmcraid to subject line
* update commit msg w additional detail
* add alternative change proposal per reviewer feedback
drivers/scsi/pmcraid.c | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/drivers/scsi/pmcraid.c b/drivers/scsi/pmcraid.c
index ed31d8c..3f64275 100644
--- a/drivers/scsi/pmcraid.c
+++ b/drivers/scsi/pmcraid.c
@@ -45,6 +45,7 @@
#include <asm/processor.h>
#include <linux/libata.h>
#include <linux/mutex.h>
+#include <linux/ktime.h>
#include <scsi/scsi.h>
#include <scsi/scsi_host.h>
#include <scsi/scsi_device.h>
@@ -5563,11 +5564,9 @@ static void pmcraid_set_timestamp(struct pmcraid_cmd *cmd)
__be32 time_stamp_len = cpu_to_be32(PMCRAID_TIMESTAMP_LEN);
struct pmcraid_ioadl_desc *ioadl = ioarcb->add_data.u.ioadl;
- struct timeval tv;
__le64 timestamp;
- do_gettimeofday(&tv);
- timestamp = tv.tv_sec * 1000;
+ timestamp = ktime_get_real_seconds() * 1000;
pinstance->timestamp_data->timestamp[0] = (__u8)(timestamp);
pinstance->timestamp_data->timestamp[1] = (__u8)((timestamp) >> 8);
--
2.1.4
Hi,
I was wondering if you would like to acquire the following databases for
your marketing campaigns.
Own the database in excel file for unlimited usages:
1. We have got 450,000 IT decision makers across globe (Titles are like
CIO, CTO, CISO, EVP/SVP/VP/Director of IT, IS, Administrators, Networking,
Storage, Finance, Operation, Business Intelligence, Database etc.) contacts
(name, title, email, phone, address and company details).
2. Storage users list: Brocade, Dell, Hitachi, HP, IBM, NetApp,
Plasmon, SanDisk, Seagate, Oracle, VMware Storage customers.
3. Cloud computing users list: VMware, Citrix, NetApp, Microsoft
HyperV, Amazon EC2, Salesforce.com, Oracle Solaris, Rackspace, Windows
Azure, Google Apps customers.
4. CRM users Lists: MS Dynamic CRM , MS Exchange Server, Siebel, SAP
CRM, Salesforce, IBM Lotus, Goldmine, Sage SalesLogix, Act by Sage, ADERANT,
CDC Software, eGain, MS Outlook, Pivotal CRM, SPSS, SugarCRM etc.
5. ERP users Lists: Actuate, Algorithmics, Ariba, ATG, BizFlow, BMC,
Bridgeline, Business Objects, Cognos, Deltek, FileNet, Hyperion, IBM
ClearCase, IBM Rational, IBM Tivoli, IBM WebSphere, Infor Baan ERP, Infor
Mapics, Informatica, JD Edwards, Lawson, MS Active, MS BizTalk Server, MS
Com, MS Dynamics, MS Forefront, MS MQ, MS Visual SourceSafe 5.0, Netsuite,
Open Text Livelink, Oracle E-Business, Panorama, PeopleSoft, Ramco ERP,
Saba, Sage Abra HRIS, Sage Abra HRMS, Sage MAS 90, Sage Payroll Services,
SAP NetWeaver, SAP R/3, Serena, Siemens PLM, Sitecore, Software AG,
Sterling, Syspro, Telelogic, Tibco, Tidal Software, Ultimus BPM, UltiPro,
Unica etc.
6. Business Intelligence users list: SAP BI, Oracle BI, Tibco BI,
Microsoft BI, Cognos BI etc.
7. Network Security software users list: CA, Citrix, D-Link, F5, McAfee
etc.
8. IT security software users list: Symantec, Trend Micro, McAfee,
Check Point, EMC, CA, Kaspersky, Websense, Verint, AVG, Sophos, Panda
Security etc.
9. Database application users list: MySQL, Teradata, Oracle, IBM,
Sybase etc.
Please review and let me know if you have any such database requirement at
this time.
Kind Regards,
Tania Cuevas
Database Specialist
_____
We respect your privacy. If you do not wish to receive future e-mail please
reply with "REMOVE".
Here is the third version for converting parport device(ppdev) to y2038 safe.
The first two version could found at [1],[2].
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.
[1] https://lists.linaro.org/pipermail/y2038/2015-June/000522.html
[2] https://lists.linaro.org/pipermail/y2038/2015-June/000567.html
Bamvor Jian Zhang (2):
ppdev: convert to y2038 safe
ppdev: add support for compat ioctl
drivers/char/ppdev.c | 85 ++++++++++++++++++++++++++++++++++++++++++----------
1 file changed, 69 insertions(+), 16 deletions(-)
--
2.1.4
This is my second attempt to convert subsystem-wide code in v4l
for y2038 changes, removing uses of time_t in common files
and adding support for user space that defines time_t as 64 bit.
Based on the initial feedback from Hans Verkuil, I've changed the
ioctl handling to remain 100% compatible with existing headers,
which also makes it more likely that existing source code can
compile without changes.
This comes at a noticeable expense of adding complexity to
the v4l2-ioctl.c file, as we now have to handle two versions
of each ioctl command that passes a time_t in its arguments.
I have not added support for the new binary layout of v4l2_timeval
to v4l2-compat-ioctl32 yet, that is something I can do when the
basic approach has been agreed on.
Arnd
Arnd Bergmann (9):
[media] dvb: use ktime_t for internal timeout
[media] dvb: remove unused systime() function
[media] dvb: don't use 'time_t' in event ioctl
[media] exynos4-is: use monotonic timestamps as advertized
[media] make VIDIOC_DQEVENT work with 64-bit time_t
[media] use v4l2_get_timestamp where possible
[media] v4l2: introduce v4l2_timeval
[media] handle 64-bit time_t in v4l2_buffer
[media] omap3isp: support 64-bit version of omap3isp_stat_data
drivers/media/dvb-core/demux.h | 2 +-
drivers/media/dvb-core/dmxdev.c | 2 +-
drivers/media/dvb-core/dvb_demux.c | 17 +-
drivers/media/dvb-core/dvb_demux.h | 4 +-
drivers/media/dvb-core/dvb_net.c | 2 +-
drivers/media/dvb-frontends/dibx000_common.c | 10 -
drivers/media/dvb-frontends/dibx000_common.h | 2 -
drivers/media/pci/bt8xx/bttv-driver.c | 7 +-
drivers/media/pci/cx18/cx18-mailbox.c | 2 +-
drivers/media/pci/meye/meye.h | 2 +-
drivers/media/pci/zoran/zoran.h | 2 +-
drivers/media/platform/coda/coda.h | 2 +-
drivers/media/platform/exynos4-is/fimc-capture.c | 8 +-
drivers/media/platform/exynos4-is/fimc-lite.c | 7 +-
drivers/media/platform/omap/omap_vout.c | 4 +-
drivers/media/platform/omap3isp/isph3a_aewb.c | 2 +
drivers/media/platform/omap3isp/isph3a_af.c | 2 +
drivers/media/platform/omap3isp/isphist.c | 2 +
drivers/media/platform/omap3isp/ispstat.c | 20 +-
drivers/media/platform/omap3isp/ispstat.h | 4 +-
drivers/media/platform/s3c-camif/camif-capture.c | 8 +-
drivers/media/platform/vim2m.c | 2 +-
drivers/media/platform/vivid/vivid-ctrls.c | 2 +-
drivers/media/usb/cpia2/cpia2.h | 2 +-
drivers/media/usb/cpia2/cpia2_v4l.c | 2 +-
drivers/media/usb/gspca/gspca.c | 6 +-
drivers/media/usb/usbvision/usbvision.h | 2 +-
drivers/media/v4l2-core/v4l2-common.c | 6 +-
drivers/media/v4l2-core/v4l2-compat-ioctl32.c | 35 ----
drivers/media/v4l2-core/v4l2-dev.c | 1 +
drivers/media/v4l2-core/v4l2-event.c | 35 +++-
drivers/media/v4l2-core/v4l2-ioctl.c | 227 ++++++++++++++++++++---
drivers/media/v4l2-core/v4l2-subdev.c | 6 +
drivers/staging/media/omap4iss/iss_video.c | 5 +-
include/media/v4l2-common.h | 2 +-
include/media/v4l2-event.h | 2 +
include/media/videobuf-core.h | 2 +-
include/trace/events/v4l2.h | 12 +-
include/uapi/linux/dvb/video.h | 3 +-
include/uapi/linux/omap3isp.h | 19 ++
include/uapi/linux/videodev2.h | 78 ++++++++
41 files changed, 415 insertions(+), 145 deletions(-)
--
2.1.0.rc2