linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] scsi_transport_fc: use 64-bit timestamps consistently
@ 2018-06-18 15:29 Arnd Bergmann
  2018-06-25  7:50 ` Johannes Thumshirn
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: Arnd Bergmann @ 2018-06-18 15:29 UTC (permalink / raw)
  To: James E.J. Bottomley, Martin K. Petersen
  Cc: y2038, Arnd Bergmann, Hannes Reinecke, Johannes Thumshirn,
	James Smart, Jens Axboe, Tyrel Datwyler, Steffen Maier,
	linux-scsi, linux-kernel

The get_seconds() helper returns an 'unsigned long' value, which can
overflow on 32-bit architectures. Since the interface we pass it into
already uses a 64-bit type, we can just use ktime_get_real_seconds()
instead.

While we generally prefer local timestamps in CLOCK_MONOTONIC format
(ktime_get_seconds), this keeps using the CLOCK_REALTIME version
in order to maintain compatibility with existing code.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
 drivers/scsi/scsi_transport_fc.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/scsi/scsi_transport_fc.c b/drivers/scsi/scsi_transport_fc.c
index 1da3d71e9f61..bb6de88aa724 100644
--- a/drivers/scsi/scsi_transport_fc.c
+++ b/drivers/scsi/scsi_transport_fc.c
@@ -567,7 +567,7 @@ fc_host_post_event(struct Scsi_Host *shost, u32 event_number,
 
 	INIT_SCSI_NL_HDR(&event->snlh, SCSI_NL_TRANSPORT_FC,
 				FC_NL_ASYNC_EVENT, len);
-	event->seconds = get_seconds();
+	event->seconds = ktime_get_real_seconds();
 	event->vendor_id = 0;
 	event->host_no = shost->host_no;
 	event->event_datalen = sizeof(u32);	/* bytes */
@@ -635,7 +635,7 @@ fc_host_post_vendor_event(struct Scsi_Host *shost, u32 event_number,
 
 	INIT_SCSI_NL_HDR(&event->snlh, SCSI_NL_TRANSPORT_FC,
 				FC_NL_ASYNC_EVENT, len);
-	event->seconds = get_seconds();
+	event->seconds = ktime_get_real_seconds();
 	event->vendor_id = vendor_id;
 	event->host_no = shost->host_no;
 	event->event_datalen = data_len;	/* bytes */
-- 
2.9.0


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH] scsi_transport_fc: use 64-bit timestamps consistently
  2018-06-18 15:29 [PATCH] scsi_transport_fc: use 64-bit timestamps consistently Arnd Bergmann
@ 2018-06-25  7:50 ` Johannes Thumshirn
  2018-06-25 19:30 ` Tyrel Datwyler
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: Johannes Thumshirn @ 2018-06-25  7:50 UTC (permalink / raw)
  To: Arnd Bergmann
  Cc: James E.J. Bottomley, Martin K. Petersen, y2038, Hannes Reinecke,
	James Smart, Jens Axboe, Tyrel Datwyler, Steffen Maier,
	linux-scsi, linux-kernel

Looks good,
Reviewed-by: Johannes Thumshirn <jthumshirn@suse.de>
-- 
Johannes Thumshirn                                          Storage
jthumshirn@suse.de                                +49 911 74053 689
SUSE LINUX GmbH, Maxfeldstr. 5, 90409 Nürnberg
GF: Felix Imendörffer, Jane Smithard, Graham Norton
HRB 21284 (AG Nürnberg)
Key fingerprint = EC38 9CAB C2C4 F25D 8600 D0D0 0393 969D 2D76 0850

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] scsi_transport_fc: use 64-bit timestamps consistently
  2018-06-18 15:29 [PATCH] scsi_transport_fc: use 64-bit timestamps consistently Arnd Bergmann
  2018-06-25  7:50 ` Johannes Thumshirn
@ 2018-06-25 19:30 ` Tyrel Datwyler
  2018-06-25 19:56 ` James Smart
  2018-06-26 15:59 ` Martin K. Petersen
  3 siblings, 0 replies; 5+ messages in thread
From: Tyrel Datwyler @ 2018-06-25 19:30 UTC (permalink / raw)
  To: Arnd Bergmann, James E.J. Bottomley, Martin K. Petersen
  Cc: y2038, Hannes Reinecke, Johannes Thumshirn, James Smart,
	Jens Axboe, Steffen Maier, linux-scsi, linux-kernel

On 06/18/2018 08:29 AM, Arnd Bergmann wrote:
> The get_seconds() helper returns an 'unsigned long' value, which can
> overflow on 32-bit architectures. Since the interface we pass it into
> already uses a 64-bit type, we can just use ktime_get_real_seconds()
> instead.
> 
> While we generally prefer local timestamps in CLOCK_MONOTONIC format
> (ktime_get_seconds), this keeps using the CLOCK_REALTIME version
> in order to maintain compatibility with existing code.
> 
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
> ---

Reviewed-by: Tyrel Datwyler <tyreld@linux.vnet.ibm.com>


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] scsi_transport_fc: use 64-bit timestamps consistently
  2018-06-18 15:29 [PATCH] scsi_transport_fc: use 64-bit timestamps consistently Arnd Bergmann
  2018-06-25  7:50 ` Johannes Thumshirn
  2018-06-25 19:30 ` Tyrel Datwyler
@ 2018-06-25 19:56 ` James Smart
  2018-06-26 15:59 ` Martin K. Petersen
  3 siblings, 0 replies; 5+ messages in thread
From: James Smart @ 2018-06-25 19:56 UTC (permalink / raw)
  To: Arnd Bergmann, James E.J. Bottomley, Martin K. Petersen
  Cc: y2038, Hannes Reinecke, Johannes Thumshirn, Jens Axboe,
	Tyrel Datwyler, Steffen Maier, linux-scsi, linux-kernel

On 6/18/2018 8:29 AM, Arnd Bergmann wrote:
> The get_seconds() helper returns an 'unsigned long' value, which can
> overflow on 32-bit architectures. Since the interface we pass it into
> already uses a 64-bit type, we can just use ktime_get_real_seconds()
> instead.
> 
> While we generally prefer local timestamps in CLOCK_MONOTONIC format
> (ktime_get_seconds), this keeps using the CLOCK_REALTIME version
> in order to maintain compatibility with existing code.
> 
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
> ---
>   drivers/scsi/scsi_transport_fc.c | 4 ++--
>   1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/scsi/scsi_transport_fc.c b/drivers/scsi/scsi_transport_fc.c
> index 1da3d71e9f61..bb6de88aa724 100644
> --- a/drivers/scsi/scsi_transport_fc.c
> +++ b/drivers/scsi/scsi_transport_fc.c
> @@ -567,7 +567,7 @@ fc_host_post_event(struct Scsi_Host *shost, u32 event_number,
>   
>   	INIT_SCSI_NL_HDR(&event->snlh, SCSI_NL_TRANSPORT_FC,
>   				FC_NL_ASYNC_EVENT, len);
> -	event->seconds = get_seconds();
> +	event->seconds = ktime_get_real_seconds();
>   	event->vendor_id = 0;
>   	event->host_no = shost->host_no;
>   	event->event_datalen = sizeof(u32);	/* bytes */
> @@ -635,7 +635,7 @@ fc_host_post_vendor_event(struct Scsi_Host *shost, u32 event_number,
>   
>   	INIT_SCSI_NL_HDR(&event->snlh, SCSI_NL_TRANSPORT_FC,
>   				FC_NL_ASYNC_EVENT, len);
> -	event->seconds = get_seconds();
> +	event->seconds = ktime_get_real_seconds();
>   	event->vendor_id = vendor_id;
>   	event->host_no = shost->host_no;
>   	event->event_datalen = data_len;	/* bytes */
> 

looks good

Reviewed-by:  James Smart  <james.smart@broadcom.com>


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] scsi_transport_fc: use 64-bit timestamps consistently
  2018-06-18 15:29 [PATCH] scsi_transport_fc: use 64-bit timestamps consistently Arnd Bergmann
                   ` (2 preceding siblings ...)
  2018-06-25 19:56 ` James Smart
@ 2018-06-26 15:59 ` Martin K. Petersen
  3 siblings, 0 replies; 5+ messages in thread
From: Martin K. Petersen @ 2018-06-26 15:59 UTC (permalink / raw)
  To: Arnd Bergmann
  Cc: James E.J. Bottomley, Martin K. Petersen, y2038, Hannes Reinecke,
	Johannes Thumshirn, James Smart, Jens Axboe, Tyrel Datwyler,
	Steffen Maier, linux-scsi, linux-kernel


Arnd,

> The get_seconds() helper returns an 'unsigned long' value, which can
> overflow on 32-bit architectures. Since the interface we pass it into
> already uses a 64-bit type, we can just use ktime_get_real_seconds()
> instead.
>
> While we generally prefer local timestamps in CLOCK_MONOTONIC format
> (ktime_get_seconds), this keeps using the CLOCK_REALTIME version in
> order to maintain compatibility with existing code.

Applied to 4.19/scsi-queue, thanks!

-- 
Martin K. Petersen	Oracle Linux Engineering

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2018-06-26 16:01 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-06-18 15:29 [PATCH] scsi_transport_fc: use 64-bit timestamps consistently Arnd Bergmann
2018-06-25  7:50 ` Johannes Thumshirn
2018-06-25 19:30 ` Tyrel Datwyler
2018-06-25 19:56 ` James Smart
2018-06-26 15:59 ` Martin K. Petersen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).