* [PATCH] s390/dasd: avoid calling do_gettimeofday()
@ 2017-11-06 14:02 Arnd Bergmann
2017-11-08 13:27 ` Stefan Haberland
2017-11-08 15:47 ` kbuild test robot
0 siblings, 2 replies; 5+ messages in thread
From: Arnd Bergmann @ 2017-11-06 14:02 UTC (permalink / raw)
To: Stefan Haberland, Jan Hoeppner, Martin Schwidefsky, Heiko Carstens
Cc: Arnd Bergmann, linux-s390, linux-kernel
do_gettimeofday() is deprecated because it's not y2038-safe on
32-bit architectures. Since it is basically a wrapper around
ktime_get_real_ts64(), we can just call that function directly
instead.
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
drivers/s390/block/dasd_eer.c | 16 ++++++++--------
1 file changed, 8 insertions(+), 8 deletions(-)
diff --git a/drivers/s390/block/dasd_eer.c b/drivers/s390/block/dasd_eer.c
index 4630782b5456..5169c717c9d6 100644
--- a/drivers/s390/block/dasd_eer.c
+++ b/drivers/s390/block/dasd_eer.c
@@ -296,7 +296,7 @@ static void dasd_eer_write_standard_trigger(struct dasd_device *device,
{
struct dasd_ccw_req *temp_cqr;
int data_size;
- struct timeval tv;
+ struct timespec64 ts64;
struct dasd_eer_header header;
unsigned long flags;
struct eerbuffer *eerb;
@@ -310,9 +310,9 @@ static void dasd_eer_write_standard_trigger(struct dasd_device *device,
header.total_size = sizeof(header) + data_size + 4; /* "EOR" */
header.trigger = trigger;
- do_gettimeofday(&tv);
- header.tv_sec = tv.tv_sec;
- header.tv_usec = tv.tv_usec;
+ ktime_get_real_ts64(&ts);
+ header.tv_sec = ts.tv_sec;
+ header.tv_usec = ts.tv_nsec / NSEC_PER_USEC;
strncpy(header.busid, dev_name(&device->cdev->dev),
DASD_EER_BUSID_SIZE);
@@ -340,7 +340,7 @@ static void dasd_eer_write_snss_trigger(struct dasd_device *device,
{
int data_size;
int snss_rc;
- struct timeval tv;
+ struct timespec64 ts;
struct dasd_eer_header header;
unsigned long flags;
struct eerbuffer *eerb;
@@ -353,9 +353,9 @@ static void dasd_eer_write_snss_trigger(struct dasd_device *device,
header.total_size = sizeof(header) + data_size + 4; /* "EOR" */
header.trigger = DASD_EER_STATECHANGE;
- do_gettimeofday(&tv);
- header.tv_sec = tv.tv_sec;
- header.tv_usec = tv.tv_usec;
+ ktime_get_real_ts64(&ts);
+ header.tv_sec = ts.tv_sec;
+ header.tv_usec = ts.tv_nsec / NSEC_PER_USEC;
strncpy(header.busid, dev_name(&device->cdev->dev),
DASD_EER_BUSID_SIZE);
--
2.9.0
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH] s390/dasd: avoid calling do_gettimeofday()
2017-11-06 14:02 [PATCH] s390/dasd: avoid calling do_gettimeofday() Arnd Bergmann
@ 2017-11-08 13:27 ` Stefan Haberland
2017-11-08 13:56 ` Arnd Bergmann
2017-11-08 15:47 ` kbuild test robot
1 sibling, 1 reply; 5+ messages in thread
From: Stefan Haberland @ 2017-11-08 13:27 UTC (permalink / raw)
To: Arnd Bergmann, Jan Hoeppner, Martin Schwidefsky, Heiko Carstens
Cc: linux-s390, linux-kernel
On 06.11.2017 15:02, Arnd Bergmann wrote:
> do_gettimeofday() is deprecated because it's not y2038-safe on
> 32-bit architectures. Since it is basically a wrapper around
> ktime_get_real_ts64(), we can just call that function directly
> instead.
>
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
> ---
> drivers/s390/block/dasd_eer.c | 16 ++++++++--------
> 1 file changed, 8 insertions(+), 8 deletions(-)
>
> diff --git a/drivers/s390/block/dasd_eer.c b/drivers/s390/block/dasd_eer.c
> index 4630782b5456..5169c717c9d6 100644
> --- a/drivers/s390/block/dasd_eer.c
> +++ b/drivers/s390/block/dasd_eer.c
> @@ -296,7 +296,7 @@ static void dasd_eer_write_standard_trigger(struct dasd_device *device,
> {
> struct dasd_ccw_req *temp_cqr;
> int data_size;
> - struct timeval tv;
> + struct timespec64 ts64;
...
> + ktime_get_real_ts64(&ts);
> + header.tv_sec = ts.tv_sec;
> + header.tv_usec = ts.tv_nsec / NSEC_PER_USEC;
>
I renamed ts64 to ts to match the usage below and fix the compile error.
Beside of this, applied. Thanks for the patch.
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] s390/dasd: avoid calling do_gettimeofday()
2017-11-08 13:27 ` Stefan Haberland
@ 2017-11-08 13:56 ` Arnd Bergmann
0 siblings, 0 replies; 5+ messages in thread
From: Arnd Bergmann @ 2017-11-08 13:56 UTC (permalink / raw)
To: Stefan Haberland
Cc: Jan Hoeppner, Martin Schwidefsky, Heiko Carstens, linux-s390,
Linux Kernel Mailing List
On Wed, Nov 8, 2017 at 2:27 PM, Stefan Haberland <sth@linux.vnet.ibm.com> wrote:
> On 06.11.2017 15:02, Arnd Bergmann wrote:
>> diff --git a/drivers/s390/block/dasd_eer.c b/drivers/s390/block/dasd_eer.c
>> index 4630782b5456..5169c717c9d6 100644
>> --- a/drivers/s390/block/dasd_eer.c
>> +++ b/drivers/s390/block/dasd_eer.c
>> @@ -296,7 +296,7 @@ static void dasd_eer_write_standard_trigger(struct
>> dasd_device *device,
>> {
>> struct dasd_ccw_req *temp_cqr;
>> int data_size;
>> - struct timeval tv;
>> + struct timespec64 ts64;
>
> ...
>>
>> + ktime_get_real_ts64(&ts);
>> + header.tv_sec = ts.tv_sec;
>> + header.tv_usec = ts.tv_nsec / NSEC_PER_USEC;
>>
>
> I renamed ts64 to ts to match the usage below and fix the compile error.
>
> Beside of this, applied. Thanks for the patch.
>
Thanks and sorry for not build-testing it properly, I thought I had at
least compiled
this one separately with my cross-toolchain, but maybe I renamed the variable
after testing it, or I misremember testing it.
Arnd
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] s390/dasd: avoid calling do_gettimeofday()
2017-11-06 14:02 [PATCH] s390/dasd: avoid calling do_gettimeofday() Arnd Bergmann
@ 2017-11-08 15:47 ` kbuild test robot
2017-11-08 15:47 ` kbuild test robot
1 sibling, 0 replies; 5+ messages in thread
From: kbuild test robot @ 2017-11-08 15:47 UTC (permalink / raw)
To: Arnd Bergmann
Cc: kbuild-all, Stefan Haberland, Jan Hoeppner, Martin Schwidefsky,
Heiko Carstens, Arnd Bergmann, linux-s390, linux-kernel
[-- Attachment #1: Type: text/plain, Size: 4492 bytes --]
Hi Arnd,
I love your patch! Yet something to improve:
[auto build test ERROR on s390/features]
[also build test ERROR on v4.14-rc8 next-20171108]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]
url: https://github.com/0day-ci/linux/commits/Arnd-Bergmann/s390-dasd-avoid-calling-do_gettimeofday/20171108-213507
base: https://git.kernel.org/pub/scm/linux/kernel/git/s390/linux.git features
config: s390-default_defconfig (attached as .config)
compiler: s390x-linux-gnu-gcc (Debian 6.1.1-9) 6.1.1 20160705
reproduce:
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# save the attached .config to linux build tree
make.cross ARCH=s390
All errors (new ones prefixed by >>):
In file included from include/linux/ktime.h:272:0,
from include/linux/timer.h:5,
from include/linux/workqueue.h:8,
from include/linux/srcu.h:34,
from include/linux/notifier.h:15,
from arch/s390/include/asm/uprobes.h:11,
from include/linux/uprobes.h:62,
from include/linux/mm_types.h:13,
from include/linux/fs.h:21,
from drivers/s390/block/dasd_eer.c:12:
drivers/s390/block/dasd_eer.c: In function 'dasd_eer_write_standard_trigger':
>> drivers/s390/block/dasd_eer.c:312:23: error: 'ts' undeclared (first use in this function)
ktime_get_real_ts64(&ts);
^
include/linux/timekeeping.h:160:50: note: in definition of macro 'ktime_get_real_ts64'
#define ktime_get_real_ts64(ts) getnstimeofday64(ts)
^~
drivers/s390/block/dasd_eer.c:312:23: note: each undeclared identifier is reported only once for each function it appears in
ktime_get_real_ts64(&ts);
^
include/linux/timekeeping.h:160:50: note: in definition of macro 'ktime_get_real_ts64'
#define ktime_get_real_ts64(ts) getnstimeofday64(ts)
^~
drivers/s390/block/dasd_eer.c:298:20: warning: unused variable 'ts64' [-Wunused-variable]
struct timespec64 ts64;
^~~~
vim +/ts +312 drivers/s390/block/dasd_eer.c
284
285 /*
286 * The following function can be used for those triggers that have
287 * all necessary data available when the function is called.
288 * If the parameter cqr is not NULL, the chain of requests will be searched
289 * for valid sense data, and all valid sense data sets will be added to
290 * the triggers data.
291 */
292 static void dasd_eer_write_standard_trigger(struct dasd_device *device,
293 struct dasd_ccw_req *cqr,
294 int trigger)
295 {
296 struct dasd_ccw_req *temp_cqr;
297 int data_size;
298 struct timespec64 ts64;
299 struct dasd_eer_header header;
300 unsigned long flags;
301 struct eerbuffer *eerb;
302 char *sense;
303
304 /* go through cqr chain and count the valid sense data sets */
305 data_size = 0;
306 for (temp_cqr = cqr; temp_cqr; temp_cqr = temp_cqr->refers)
307 if (dasd_get_sense(&temp_cqr->irb))
308 data_size += 32;
309
310 header.total_size = sizeof(header) + data_size + 4; /* "EOR" */
311 header.trigger = trigger;
> 312 ktime_get_real_ts64(&ts);
313 header.tv_sec = ts.tv_sec;
314 header.tv_usec = ts.tv_nsec / NSEC_PER_USEC;
315 strncpy(header.busid, dev_name(&device->cdev->dev),
316 DASD_EER_BUSID_SIZE);
317
318 spin_lock_irqsave(&bufferlock, flags);
319 list_for_each_entry(eerb, &bufferlist, list) {
320 dasd_eer_start_record(eerb, header.total_size);
321 dasd_eer_write_buffer(eerb, (char *) &header, sizeof(header));
322 for (temp_cqr = cqr; temp_cqr; temp_cqr = temp_cqr->refers) {
323 sense = dasd_get_sense(&temp_cqr->irb);
324 if (sense)
325 dasd_eer_write_buffer(eerb, sense, 32);
326 }
327 dasd_eer_write_buffer(eerb, "EOR", 4);
328 }
329 spin_unlock_irqrestore(&bufferlock, flags);
330 wake_up_interruptible(&dasd_eer_read_wait_queue);
331 }
332
---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation
[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 17513 bytes --]
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] s390/dasd: avoid calling do_gettimeofday()
@ 2017-11-08 15:47 ` kbuild test robot
0 siblings, 0 replies; 5+ messages in thread
From: kbuild test robot @ 2017-11-08 15:47 UTC (permalink / raw)
To: Arnd Bergmann
Cc: kbuild-all, Stefan Haberland, Jan Hoeppner, Martin Schwidefsky,
Heiko Carstens, linux-s390, linux-kernel
[-- Attachment #1: Type: text/plain, Size: 4492 bytes --]
Hi Arnd,
I love your patch! Yet something to improve:
[auto build test ERROR on s390/features]
[also build test ERROR on v4.14-rc8 next-20171108]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]
url: https://github.com/0day-ci/linux/commits/Arnd-Bergmann/s390-dasd-avoid-calling-do_gettimeofday/20171108-213507
base: https://git.kernel.org/pub/scm/linux/kernel/git/s390/linux.git features
config: s390-default_defconfig (attached as .config)
compiler: s390x-linux-gnu-gcc (Debian 6.1.1-9) 6.1.1 20160705
reproduce:
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# save the attached .config to linux build tree
make.cross ARCH=s390
All errors (new ones prefixed by >>):
In file included from include/linux/ktime.h:272:0,
from include/linux/timer.h:5,
from include/linux/workqueue.h:8,
from include/linux/srcu.h:34,
from include/linux/notifier.h:15,
from arch/s390/include/asm/uprobes.h:11,
from include/linux/uprobes.h:62,
from include/linux/mm_types.h:13,
from include/linux/fs.h:21,
from drivers/s390/block/dasd_eer.c:12:
drivers/s390/block/dasd_eer.c: In function 'dasd_eer_write_standard_trigger':
>> drivers/s390/block/dasd_eer.c:312:23: error: 'ts' undeclared (first use in this function)
ktime_get_real_ts64(&ts);
^
include/linux/timekeeping.h:160:50: note: in definition of macro 'ktime_get_real_ts64'
#define ktime_get_real_ts64(ts) getnstimeofday64(ts)
^~
drivers/s390/block/dasd_eer.c:312:23: note: each undeclared identifier is reported only once for each function it appears in
ktime_get_real_ts64(&ts);
^
include/linux/timekeeping.h:160:50: note: in definition of macro 'ktime_get_real_ts64'
#define ktime_get_real_ts64(ts) getnstimeofday64(ts)
^~
drivers/s390/block/dasd_eer.c:298:20: warning: unused variable 'ts64' [-Wunused-variable]
struct timespec64 ts64;
^~~~
vim +/ts +312 drivers/s390/block/dasd_eer.c
284
285 /*
286 * The following function can be used for those triggers that have
287 * all necessary data available when the function is called.
288 * If the parameter cqr is not NULL, the chain of requests will be searched
289 * for valid sense data, and all valid sense data sets will be added to
290 * the triggers data.
291 */
292 static void dasd_eer_write_standard_trigger(struct dasd_device *device,
293 struct dasd_ccw_req *cqr,
294 int trigger)
295 {
296 struct dasd_ccw_req *temp_cqr;
297 int data_size;
298 struct timespec64 ts64;
299 struct dasd_eer_header header;
300 unsigned long flags;
301 struct eerbuffer *eerb;
302 char *sense;
303
304 /* go through cqr chain and count the valid sense data sets */
305 data_size = 0;
306 for (temp_cqr = cqr; temp_cqr; temp_cqr = temp_cqr->refers)
307 if (dasd_get_sense(&temp_cqr->irb))
308 data_size += 32;
309
310 header.total_size = sizeof(header) + data_size + 4; /* "EOR" */
311 header.trigger = trigger;
> 312 ktime_get_real_ts64(&ts);
313 header.tv_sec = ts.tv_sec;
314 header.tv_usec = ts.tv_nsec / NSEC_PER_USEC;
315 strncpy(header.busid, dev_name(&device->cdev->dev),
316 DASD_EER_BUSID_SIZE);
317
318 spin_lock_irqsave(&bufferlock, flags);
319 list_for_each_entry(eerb, &bufferlist, list) {
320 dasd_eer_start_record(eerb, header.total_size);
321 dasd_eer_write_buffer(eerb, (char *) &header, sizeof(header));
322 for (temp_cqr = cqr; temp_cqr; temp_cqr = temp_cqr->refers) {
323 sense = dasd_get_sense(&temp_cqr->irb);
324 if (sense)
325 dasd_eer_write_buffer(eerb, sense, 32);
326 }
327 dasd_eer_write_buffer(eerb, "EOR", 4);
328 }
329 spin_unlock_irqrestore(&bufferlock, flags);
330 wake_up_interruptible(&dasd_eer_read_wait_queue);
331 }
332
---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation
[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 17513 bytes --]
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2017-11-08 15:48 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-11-06 14:02 [PATCH] s390/dasd: avoid calling do_gettimeofday() Arnd Bergmann
2017-11-08 13:27 ` Stefan Haberland
2017-11-08 13:56 ` Arnd Bergmann
2017-11-08 15:47 ` kbuild test robot
2017-11-08 15:47 ` kbuild test robot
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.