All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2] xen/pcifront: Remove usage of struct timeval
@ 2015-05-19  6:08 Tina Ruchandani
  2015-05-19 14:14 ` Boris Ostrovsky
                   ` (7 more replies)
  0 siblings, 8 replies; 12+ messages in thread
From: Tina Ruchandani @ 2015-05-19  6:08 UTC (permalink / raw)
  To: Arnd Bergmann
  Cc: y2038, Konrad Rzeszutek Wilk, Boris Ostrovsky, David Vrabel,
	Bjorn Helgaas, xen-devel, linux-pci

struct timeval uses a 32-bit field for representing seconds,
which will overflow in the year 2038 and beyond. This patch replaces
struct timeval with 64-bit ktime_t which is 2038 safe.
The patch is part of a larger effort to remove instances of
32-bit timekeeping variables (timeval, time_t and timespec)
from the kernel.

Signed-off-by: Tina Ruchandani <ruchandani.tina@gmail.com>
Suggested-by: Arnd Bergmann <arnd@arndb.de>
--
Changes in v2:
- Use monotonic time (ktime_get_ns()) instead of real time
since we only care about elapsed delta here.
- Use macro ktime_get_ns() instead of getting ktime_t and
converting it to ns.
---
 drivers/pci/xen-pcifront.c | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)

diff --git a/drivers/pci/xen-pcifront.c b/drivers/pci/xen-pcifront.c
index 7cfd2db..c4796c8 100644
--- a/drivers/pci/xen-pcifront.c
+++ b/drivers/pci/xen-pcifront.c
@@ -20,6 +20,7 @@
 #include <linux/workqueue.h>
 #include <linux/bitops.h>
 #include <linux/time.h>
+#include <linux/ktime.h>
 #include <xen/platform_pci.h>
 
 #include <asm/xen/swiotlb-xen.h>
@@ -115,7 +116,6 @@ static int do_pci_op(struct pcifront_device *pdev, struct xen_pci_op *op)
 	evtchn_port_t port = pdev->evtchn;
 	unsigned irq = pdev->irq;
 	s64 ns, ns_timeout;
-	struct timeval tv;
 
 	spin_lock_irqsave(&pdev->sh_info_lock, irq_flags);
 
@@ -132,8 +132,7 @@ static int do_pci_op(struct pcifront_device *pdev, struct xen_pci_op *op)
 	 * (in the latter case we end up continually re-executing poll() with a
 	 * timeout in the past). 1s difference gives plenty of slack for error.
 	 */
-	do_gettimeofday(&tv);
-	ns_timeout = timeval_to_ns(&tv) + 2 * (s64)NSEC_PER_SEC;
+	ns_timeout = ktime_get_ns() + 2 * (s64)NSEC_PER_SEC;
 
 	xen_clear_irq_pending(irq);
 
@@ -141,8 +140,7 @@ static int do_pci_op(struct pcifront_device *pdev, struct xen_pci_op *op)
 			(unsigned long *)&pdev->sh_info->flags)) {
 		xen_poll_irq_timeout(irq, jiffies + 3*HZ);
 		xen_clear_irq_pending(irq);
-		do_gettimeofday(&tv);
-		ns = timeval_to_ns(&tv);
+		ns = ktime_get_ns();
 		if (ns > ns_timeout) {
 			dev_err(&pdev->xdev->dev,
 				"pciback not responding!!!\n");
-- 
2.2.0.rc0.207.ga3a616c


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

* Re: [PATCH v2] xen/pcifront: Remove usage of struct timeval
  2015-05-19  6:08 [PATCH v2] xen/pcifront: Remove usage of struct timeval Tina Ruchandani
  2015-05-19 14:14 ` Boris Ostrovsky
@ 2015-05-19 14:14 ` Boris Ostrovsky
  2015-05-20 12:21 ` [Y2038] " Arnd Bergmann
                   ` (5 subsequent siblings)
  7 siblings, 0 replies; 12+ messages in thread
From: Boris Ostrovsky @ 2015-05-19 14:14 UTC (permalink / raw)
  To: Tina Ruchandani, Arnd Bergmann
  Cc: y2038, Konrad Rzeszutek Wilk, David Vrabel, Bjorn Helgaas,
	xen-devel, linux-pci

On 05/19/2015 02:08 AM, Tina Ruchandani wrote:
> struct timeval uses a 32-bit field for representing seconds,
> which will overflow in the year 2038 and beyond. This patch replaces
> struct timeval with 64-bit ktime_t which is 2038 safe.
> The patch is part of a larger effort to remove instances of
> 32-bit timekeeping variables (timeval, time_t and timespec)
> from the kernel.
>
> Signed-off-by: Tina Ruchandani <ruchandani.tina@gmail.com>
> Suggested-by: Arnd Bergmann <arnd@arndb.de>

Reviewed-by: Boris Ostrovsky <boris.ostrovsky@oracle.com>


> --
> Changes in v2:
> - Use monotonic time (ktime_get_ns()) instead of real time
> since we only care about elapsed delta here.
> - Use macro ktime_get_ns() instead of getting ktime_t and
> converting it to ns.
> ---
>   drivers/pci/xen-pcifront.c | 8 +++-----
>   1 file changed, 3 insertions(+), 5 deletions(-)
>
> diff --git a/drivers/pci/xen-pcifront.c b/drivers/pci/xen-pcifront.c
> index 7cfd2db..c4796c8 100644
> --- a/drivers/pci/xen-pcifront.c
> +++ b/drivers/pci/xen-pcifront.c
> @@ -20,6 +20,7 @@
>   #include <linux/workqueue.h>
>   #include <linux/bitops.h>
>   #include <linux/time.h>
> +#include <linux/ktime.h>
>   #include <xen/platform_pci.h>
>   
>   #include <asm/xen/swiotlb-xen.h>
> @@ -115,7 +116,6 @@ static int do_pci_op(struct pcifront_device *pdev, struct xen_pci_op *op)
>   	evtchn_port_t port = pdev->evtchn;
>   	unsigned irq = pdev->irq;
>   	s64 ns, ns_timeout;
> -	struct timeval tv;
>   
>   	spin_lock_irqsave(&pdev->sh_info_lock, irq_flags);
>   
> @@ -132,8 +132,7 @@ static int do_pci_op(struct pcifront_device *pdev, struct xen_pci_op *op)
>   	 * (in the latter case we end up continually re-executing poll() with a
>   	 * timeout in the past). 1s difference gives plenty of slack for error.
>   	 */
> -	do_gettimeofday(&tv);
> -	ns_timeout = timeval_to_ns(&tv) + 2 * (s64)NSEC_PER_SEC;
> +	ns_timeout = ktime_get_ns() + 2 * (s64)NSEC_PER_SEC;
>   
>   	xen_clear_irq_pending(irq);
>   
> @@ -141,8 +140,7 @@ static int do_pci_op(struct pcifront_device *pdev, struct xen_pci_op *op)
>   			(unsigned long *)&pdev->sh_info->flags)) {
>   		xen_poll_irq_timeout(irq, jiffies + 3*HZ);
>   		xen_clear_irq_pending(irq);
> -		do_gettimeofday(&tv);
> -		ns = timeval_to_ns(&tv);
> +		ns = ktime_get_ns();
>   		if (ns > ns_timeout) {
>   			dev_err(&pdev->xdev->dev,
>   				"pciback not responding!!!\n");


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

* Re: [PATCH v2] xen/pcifront: Remove usage of struct timeval
  2015-05-19  6:08 [PATCH v2] xen/pcifront: Remove usage of struct timeval Tina Ruchandani
@ 2015-05-19 14:14 ` Boris Ostrovsky
  2015-05-19 14:14 ` Boris Ostrovsky
                   ` (6 subsequent siblings)
  7 siblings, 0 replies; 12+ messages in thread
From: Boris Ostrovsky @ 2015-05-19 14:14 UTC (permalink / raw)
  To: Tina Ruchandani, Arnd Bergmann
  Cc: y2038, linux-pci, David Vrabel, Bjorn Helgaas, xen-devel

On 05/19/2015 02:08 AM, Tina Ruchandani wrote:
> struct timeval uses a 32-bit field for representing seconds,
> which will overflow in the year 2038 and beyond. This patch replaces
> struct timeval with 64-bit ktime_t which is 2038 safe.
> The patch is part of a larger effort to remove instances of
> 32-bit timekeeping variables (timeval, time_t and timespec)
> from the kernel.
>
> Signed-off-by: Tina Ruchandani <ruchandani.tina@gmail.com>
> Suggested-by: Arnd Bergmann <arnd@arndb.de>

Reviewed-by: Boris Ostrovsky <boris.ostrovsky@oracle.com>


> --
> Changes in v2:
> - Use monotonic time (ktime_get_ns()) instead of real time
> since we only care about elapsed delta here.
> - Use macro ktime_get_ns() instead of getting ktime_t and
> converting it to ns.
> ---
>   drivers/pci/xen-pcifront.c | 8 +++-----
>   1 file changed, 3 insertions(+), 5 deletions(-)
>
> diff --git a/drivers/pci/xen-pcifront.c b/drivers/pci/xen-pcifront.c
> index 7cfd2db..c4796c8 100644
> --- a/drivers/pci/xen-pcifront.c
> +++ b/drivers/pci/xen-pcifront.c
> @@ -20,6 +20,7 @@
>   #include <linux/workqueue.h>
>   #include <linux/bitops.h>
>   #include <linux/time.h>
> +#include <linux/ktime.h>
>   #include <xen/platform_pci.h>
>   
>   #include <asm/xen/swiotlb-xen.h>
> @@ -115,7 +116,6 @@ static int do_pci_op(struct pcifront_device *pdev, struct xen_pci_op *op)
>   	evtchn_port_t port = pdev->evtchn;
>   	unsigned irq = pdev->irq;
>   	s64 ns, ns_timeout;
> -	struct timeval tv;
>   
>   	spin_lock_irqsave(&pdev->sh_info_lock, irq_flags);
>   
> @@ -132,8 +132,7 @@ static int do_pci_op(struct pcifront_device *pdev, struct xen_pci_op *op)
>   	 * (in the latter case we end up continually re-executing poll() with a
>   	 * timeout in the past). 1s difference gives plenty of slack for error.
>   	 */
> -	do_gettimeofday(&tv);
> -	ns_timeout = timeval_to_ns(&tv) + 2 * (s64)NSEC_PER_SEC;
> +	ns_timeout = ktime_get_ns() + 2 * (s64)NSEC_PER_SEC;
>   
>   	xen_clear_irq_pending(irq);
>   
> @@ -141,8 +140,7 @@ static int do_pci_op(struct pcifront_device *pdev, struct xen_pci_op *op)
>   			(unsigned long *)&pdev->sh_info->flags)) {
>   		xen_poll_irq_timeout(irq, jiffies + 3*HZ);
>   		xen_clear_irq_pending(irq);
> -		do_gettimeofday(&tv);
> -		ns = timeval_to_ns(&tv);
> +		ns = ktime_get_ns();
>   		if (ns > ns_timeout) {
>   			dev_err(&pdev->xdev->dev,
>   				"pciback not responding!!!\n");

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

* Re: [Y2038] [PATCH v2] xen/pcifront: Remove usage of struct timeval
  2015-05-19  6:08 [PATCH v2] xen/pcifront: Remove usage of struct timeval Tina Ruchandani
  2015-05-19 14:14 ` Boris Ostrovsky
  2015-05-19 14:14 ` Boris Ostrovsky
@ 2015-05-20 12:21 ` Arnd Bergmann
  2015-05-20 12:21 ` Arnd Bergmann
                   ` (4 subsequent siblings)
  7 siblings, 0 replies; 12+ messages in thread
From: Arnd Bergmann @ 2015-05-20 12:21 UTC (permalink / raw)
  To: y2038
  Cc: Tina Ruchandani, Konrad Rzeszutek Wilk, linux-pci, David Vrabel,
	Bjorn Helgaas, xen-devel, Boris Ostrovsky

On Tuesday 19 May 2015 11:38:09 Tina Ruchandani wrote:
> struct timeval uses a 32-bit field for representing seconds,
> which will overflow in the year 2038 and beyond. This patch replaces
> struct timeval with 64-bit ktime_t which is 2038 safe.
> The patch is part of a larger effort to remove instances of
> 32-bit timekeeping variables (timeval, time_t and timespec)
> from the kernel.
> 
> Signed-off-by: Tina Ruchandani <ruchandani.tina@gmail.com>
> Suggested-by: Arnd Bergmann <arnd@arndb.de>
> 

Reviewed-by: Arnd Bergmann <arnd@arndb.de>

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

* Re: [Y2038] [PATCH v2] xen/pcifront: Remove usage of struct timeval
  2015-05-19  6:08 [PATCH v2] xen/pcifront: Remove usage of struct timeval Tina Ruchandani
                   ` (2 preceding siblings ...)
  2015-05-20 12:21 ` [Y2038] " Arnd Bergmann
@ 2015-05-20 12:21 ` Arnd Bergmann
  2015-05-20 13:16 ` Bjorn Helgaas
                   ` (3 subsequent siblings)
  7 siblings, 0 replies; 12+ messages in thread
From: Arnd Bergmann @ 2015-05-20 12:21 UTC (permalink / raw)
  To: y2038
  Cc: linux-pci, Tina Ruchandani, David Vrabel, Bjorn Helgaas,
	xen-devel, Boris Ostrovsky

On Tuesday 19 May 2015 11:38:09 Tina Ruchandani wrote:
> struct timeval uses a 32-bit field for representing seconds,
> which will overflow in the year 2038 and beyond. This patch replaces
> struct timeval with 64-bit ktime_t which is 2038 safe.
> The patch is part of a larger effort to remove instances of
> 32-bit timekeeping variables (timeval, time_t and timespec)
> from the kernel.
> 
> Signed-off-by: Tina Ruchandani <ruchandani.tina@gmail.com>
> Suggested-by: Arnd Bergmann <arnd@arndb.de>
> 

Reviewed-by: Arnd Bergmann <arnd@arndb.de>

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

* Re: [PATCH v2] xen/pcifront: Remove usage of struct timeval
  2015-05-19  6:08 [PATCH v2] xen/pcifront: Remove usage of struct timeval Tina Ruchandani
                   ` (4 preceding siblings ...)
  2015-05-20 13:16 ` Bjorn Helgaas
@ 2015-05-20 13:16 ` Bjorn Helgaas
  2015-06-05 19:07   ` Konrad Rzeszutek Wilk
  2015-06-05 19:07   ` Konrad Rzeszutek Wilk
  2015-06-08 10:18 ` David Vrabel
  2015-06-08 10:18 ` [Xen-devel] " David Vrabel
  7 siblings, 2 replies; 12+ messages in thread
From: Bjorn Helgaas @ 2015-05-20 13:16 UTC (permalink / raw)
  To: Tina Ruchandani
  Cc: Arnd Bergmann, y2038, Konrad Rzeszutek Wilk, Boris Ostrovsky,
	David Vrabel, xen-devel, linux-pci

On Tue, May 19, 2015 at 1:08 AM, Tina Ruchandani
<ruchandani.tina@gmail.com> wrote:
> struct timeval uses a 32-bit field for representing seconds,
> which will overflow in the year 2038 and beyond. This patch replaces
> struct timeval with 64-bit ktime_t which is 2038 safe.
> The patch is part of a larger effort to remove instances of
> 32-bit timekeeping variables (timeval, time_t and timespec)
> from the kernel.
>
> Signed-off-by: Tina Ruchandani <ruchandani.tina@gmail.com>
> Suggested-by: Arnd Bergmann <arnd@arndb.de>

Acked-by: Bjorn Helgaas <bhelgaas@google.com>

This isn't PCI-related, so I expect Konrad, Boris, or David will merge this.

> --
> Changes in v2:
> - Use monotonic time (ktime_get_ns()) instead of real time
> since we only care about elapsed delta here.
> - Use macro ktime_get_ns() instead of getting ktime_t and
> converting it to ns.
> ---
>  drivers/pci/xen-pcifront.c | 8 +++-----
>  1 file changed, 3 insertions(+), 5 deletions(-)
>
> diff --git a/drivers/pci/xen-pcifront.c b/drivers/pci/xen-pcifront.c
> index 7cfd2db..c4796c8 100644
> --- a/drivers/pci/xen-pcifront.c
> +++ b/drivers/pci/xen-pcifront.c
> @@ -20,6 +20,7 @@
>  #include <linux/workqueue.h>
>  #include <linux/bitops.h>
>  #include <linux/time.h>
> +#include <linux/ktime.h>
>  #include <xen/platform_pci.h>
>
>  #include <asm/xen/swiotlb-xen.h>
> @@ -115,7 +116,6 @@ static int do_pci_op(struct pcifront_device *pdev, struct xen_pci_op *op)
>         evtchn_port_t port = pdev->evtchn;
>         unsigned irq = pdev->irq;
>         s64 ns, ns_timeout;
> -       struct timeval tv;
>
>         spin_lock_irqsave(&pdev->sh_info_lock, irq_flags);
>
> @@ -132,8 +132,7 @@ static int do_pci_op(struct pcifront_device *pdev, struct xen_pci_op *op)
>          * (in the latter case we end up continually re-executing poll() with a
>          * timeout in the past). 1s difference gives plenty of slack for error.
>          */
> -       do_gettimeofday(&tv);
> -       ns_timeout = timeval_to_ns(&tv) + 2 * (s64)NSEC_PER_SEC;
> +       ns_timeout = ktime_get_ns() + 2 * (s64)NSEC_PER_SEC;
>
>         xen_clear_irq_pending(irq);
>
> @@ -141,8 +140,7 @@ static int do_pci_op(struct pcifront_device *pdev, struct xen_pci_op *op)
>                         (unsigned long *)&pdev->sh_info->flags)) {
>                 xen_poll_irq_timeout(irq, jiffies + 3*HZ);
>                 xen_clear_irq_pending(irq);
> -               do_gettimeofday(&tv);
> -               ns = timeval_to_ns(&tv);
> +               ns = ktime_get_ns();
>                 if (ns > ns_timeout) {
>                         dev_err(&pdev->xdev->dev,
>                                 "pciback not responding!!!\n");
> --
> 2.2.0.rc0.207.ga3a616c
>

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

* Re: [PATCH v2] xen/pcifront: Remove usage of struct timeval
  2015-05-19  6:08 [PATCH v2] xen/pcifront: Remove usage of struct timeval Tina Ruchandani
                   ` (3 preceding siblings ...)
  2015-05-20 12:21 ` Arnd Bergmann
@ 2015-05-20 13:16 ` Bjorn Helgaas
  2015-05-20 13:16 ` Bjorn Helgaas
                   ` (2 subsequent siblings)
  7 siblings, 0 replies; 12+ messages in thread
From: Bjorn Helgaas @ 2015-05-20 13:16 UTC (permalink / raw)
  To: Tina Ruchandani
  Cc: Arnd Bergmann, y2038, linux-pci, David Vrabel, xen-devel,
	Boris Ostrovsky

On Tue, May 19, 2015 at 1:08 AM, Tina Ruchandani
<ruchandani.tina@gmail.com> wrote:
> struct timeval uses a 32-bit field for representing seconds,
> which will overflow in the year 2038 and beyond. This patch replaces
> struct timeval with 64-bit ktime_t which is 2038 safe.
> The patch is part of a larger effort to remove instances of
> 32-bit timekeeping variables (timeval, time_t and timespec)
> from the kernel.
>
> Signed-off-by: Tina Ruchandani <ruchandani.tina@gmail.com>
> Suggested-by: Arnd Bergmann <arnd@arndb.de>

Acked-by: Bjorn Helgaas <bhelgaas@google.com>

This isn't PCI-related, so I expect Konrad, Boris, or David will merge this.

> --
> Changes in v2:
> - Use monotonic time (ktime_get_ns()) instead of real time
> since we only care about elapsed delta here.
> - Use macro ktime_get_ns() instead of getting ktime_t and
> converting it to ns.
> ---
>  drivers/pci/xen-pcifront.c | 8 +++-----
>  1 file changed, 3 insertions(+), 5 deletions(-)
>
> diff --git a/drivers/pci/xen-pcifront.c b/drivers/pci/xen-pcifront.c
> index 7cfd2db..c4796c8 100644
> --- a/drivers/pci/xen-pcifront.c
> +++ b/drivers/pci/xen-pcifront.c
> @@ -20,6 +20,7 @@
>  #include <linux/workqueue.h>
>  #include <linux/bitops.h>
>  #include <linux/time.h>
> +#include <linux/ktime.h>
>  #include <xen/platform_pci.h>
>
>  #include <asm/xen/swiotlb-xen.h>
> @@ -115,7 +116,6 @@ static int do_pci_op(struct pcifront_device *pdev, struct xen_pci_op *op)
>         evtchn_port_t port = pdev->evtchn;
>         unsigned irq = pdev->irq;
>         s64 ns, ns_timeout;
> -       struct timeval tv;
>
>         spin_lock_irqsave(&pdev->sh_info_lock, irq_flags);
>
> @@ -132,8 +132,7 @@ static int do_pci_op(struct pcifront_device *pdev, struct xen_pci_op *op)
>          * (in the latter case we end up continually re-executing poll() with a
>          * timeout in the past). 1s difference gives plenty of slack for error.
>          */
> -       do_gettimeofday(&tv);
> -       ns_timeout = timeval_to_ns(&tv) + 2 * (s64)NSEC_PER_SEC;
> +       ns_timeout = ktime_get_ns() + 2 * (s64)NSEC_PER_SEC;
>
>         xen_clear_irq_pending(irq);
>
> @@ -141,8 +140,7 @@ static int do_pci_op(struct pcifront_device *pdev, struct xen_pci_op *op)
>                         (unsigned long *)&pdev->sh_info->flags)) {
>                 xen_poll_irq_timeout(irq, jiffies + 3*HZ);
>                 xen_clear_irq_pending(irq);
> -               do_gettimeofday(&tv);
> -               ns = timeval_to_ns(&tv);
> +               ns = ktime_get_ns();
>                 if (ns > ns_timeout) {
>                         dev_err(&pdev->xdev->dev,
>                                 "pciback not responding!!!\n");
> --
> 2.2.0.rc0.207.ga3a616c
>

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

* Re: [PATCH v2] xen/pcifront: Remove usage of struct timeval
  2015-05-20 13:16 ` Bjorn Helgaas
  2015-06-05 19:07   ` Konrad Rzeszutek Wilk
@ 2015-06-05 19:07   ` Konrad Rzeszutek Wilk
  1 sibling, 0 replies; 12+ messages in thread
From: Konrad Rzeszutek Wilk @ 2015-06-05 19:07 UTC (permalink / raw)
  To: Bjorn Helgaas
  Cc: Tina Ruchandani, Arnd Bergmann, y2038, Boris Ostrovsky,
	David Vrabel, xen-devel, linux-pci

On Wed, May 20, 2015 at 08:16:24AM -0500, Bjorn Helgaas wrote:
> On Tue, May 19, 2015 at 1:08 AM, Tina Ruchandani
> <ruchandani.tina@gmail.com> wrote:
> > struct timeval uses a 32-bit field for representing seconds,
> > which will overflow in the year 2038 and beyond. This patch replaces
> > struct timeval with 64-bit ktime_t which is 2038 safe.
> > The patch is part of a larger effort to remove instances of
> > 32-bit timekeeping variables (timeval, time_t and timespec)
> > from the kernel.
> >
> > Signed-off-by: Tina Ruchandani <ruchandani.tina@gmail.com>
> > Suggested-by: Arnd Bergmann <arnd@arndb.de>
> 
> Acked-by: Bjorn Helgaas <bhelgaas@google.com>
> 
> This isn't PCI-related, so I expect Konrad, Boris, or David will merge this.

OK. Thanks.
> 
> > --
> > Changes in v2:
> > - Use monotonic time (ktime_get_ns()) instead of real time
> > since we only care about elapsed delta here.
> > - Use macro ktime_get_ns() instead of getting ktime_t and
> > converting it to ns.
> > ---
> >  drivers/pci/xen-pcifront.c | 8 +++-----
> >  1 file changed, 3 insertions(+), 5 deletions(-)
> >
> > diff --git a/drivers/pci/xen-pcifront.c b/drivers/pci/xen-pcifront.c
> > index 7cfd2db..c4796c8 100644
> > --- a/drivers/pci/xen-pcifront.c
> > +++ b/drivers/pci/xen-pcifront.c
> > @@ -20,6 +20,7 @@
> >  #include <linux/workqueue.h>
> >  #include <linux/bitops.h>
> >  #include <linux/time.h>
> > +#include <linux/ktime.h>
> >  #include <xen/platform_pci.h>
> >
> >  #include <asm/xen/swiotlb-xen.h>
> > @@ -115,7 +116,6 @@ static int do_pci_op(struct pcifront_device *pdev, struct xen_pci_op *op)
> >         evtchn_port_t port = pdev->evtchn;
> >         unsigned irq = pdev->irq;
> >         s64 ns, ns_timeout;
> > -       struct timeval tv;
> >
> >         spin_lock_irqsave(&pdev->sh_info_lock, irq_flags);
> >
> > @@ -132,8 +132,7 @@ static int do_pci_op(struct pcifront_device *pdev, struct xen_pci_op *op)
> >          * (in the latter case we end up continually re-executing poll() with a
> >          * timeout in the past). 1s difference gives plenty of slack for error.
> >          */
> > -       do_gettimeofday(&tv);
> > -       ns_timeout = timeval_to_ns(&tv) + 2 * (s64)NSEC_PER_SEC;
> > +       ns_timeout = ktime_get_ns() + 2 * (s64)NSEC_PER_SEC;
> >
> >         xen_clear_irq_pending(irq);
> >
> > @@ -141,8 +140,7 @@ static int do_pci_op(struct pcifront_device *pdev, struct xen_pci_op *op)
> >                         (unsigned long *)&pdev->sh_info->flags)) {
> >                 xen_poll_irq_timeout(irq, jiffies + 3*HZ);
> >                 xen_clear_irq_pending(irq);
> > -               do_gettimeofday(&tv);
> > -               ns = timeval_to_ns(&tv);
> > +               ns = ktime_get_ns();
> >                 if (ns > ns_timeout) {
> >                         dev_err(&pdev->xdev->dev,
> >                                 "pciback not responding!!!\n");
> > --
> > 2.2.0.rc0.207.ga3a616c
> >

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

* Re: [PATCH v2] xen/pcifront: Remove usage of struct timeval
  2015-05-20 13:16 ` Bjorn Helgaas
@ 2015-06-05 19:07   ` Konrad Rzeszutek Wilk
  2015-06-05 19:07   ` Konrad Rzeszutek Wilk
  1 sibling, 0 replies; 12+ messages in thread
From: Konrad Rzeszutek Wilk @ 2015-06-05 19:07 UTC (permalink / raw)
  To: Bjorn Helgaas
  Cc: Arnd Bergmann, y2038, linux-pci, Tina Ruchandani, David Vrabel,
	xen-devel, Boris Ostrovsky

On Wed, May 20, 2015 at 08:16:24AM -0500, Bjorn Helgaas wrote:
> On Tue, May 19, 2015 at 1:08 AM, Tina Ruchandani
> <ruchandani.tina@gmail.com> wrote:
> > struct timeval uses a 32-bit field for representing seconds,
> > which will overflow in the year 2038 and beyond. This patch replaces
> > struct timeval with 64-bit ktime_t which is 2038 safe.
> > The patch is part of a larger effort to remove instances of
> > 32-bit timekeeping variables (timeval, time_t and timespec)
> > from the kernel.
> >
> > Signed-off-by: Tina Ruchandani <ruchandani.tina@gmail.com>
> > Suggested-by: Arnd Bergmann <arnd@arndb.de>
> 
> Acked-by: Bjorn Helgaas <bhelgaas@google.com>
> 
> This isn't PCI-related, so I expect Konrad, Boris, or David will merge this.

OK. Thanks.
> 
> > --
> > Changes in v2:
> > - Use monotonic time (ktime_get_ns()) instead of real time
> > since we only care about elapsed delta here.
> > - Use macro ktime_get_ns() instead of getting ktime_t and
> > converting it to ns.
> > ---
> >  drivers/pci/xen-pcifront.c | 8 +++-----
> >  1 file changed, 3 insertions(+), 5 deletions(-)
> >
> > diff --git a/drivers/pci/xen-pcifront.c b/drivers/pci/xen-pcifront.c
> > index 7cfd2db..c4796c8 100644
> > --- a/drivers/pci/xen-pcifront.c
> > +++ b/drivers/pci/xen-pcifront.c
> > @@ -20,6 +20,7 @@
> >  #include <linux/workqueue.h>
> >  #include <linux/bitops.h>
> >  #include <linux/time.h>
> > +#include <linux/ktime.h>
> >  #include <xen/platform_pci.h>
> >
> >  #include <asm/xen/swiotlb-xen.h>
> > @@ -115,7 +116,6 @@ static int do_pci_op(struct pcifront_device *pdev, struct xen_pci_op *op)
> >         evtchn_port_t port = pdev->evtchn;
> >         unsigned irq = pdev->irq;
> >         s64 ns, ns_timeout;
> > -       struct timeval tv;
> >
> >         spin_lock_irqsave(&pdev->sh_info_lock, irq_flags);
> >
> > @@ -132,8 +132,7 @@ static int do_pci_op(struct pcifront_device *pdev, struct xen_pci_op *op)
> >          * (in the latter case we end up continually re-executing poll() with a
> >          * timeout in the past). 1s difference gives plenty of slack for error.
> >          */
> > -       do_gettimeofday(&tv);
> > -       ns_timeout = timeval_to_ns(&tv) + 2 * (s64)NSEC_PER_SEC;
> > +       ns_timeout = ktime_get_ns() + 2 * (s64)NSEC_PER_SEC;
> >
> >         xen_clear_irq_pending(irq);
> >
> > @@ -141,8 +140,7 @@ static int do_pci_op(struct pcifront_device *pdev, struct xen_pci_op *op)
> >                         (unsigned long *)&pdev->sh_info->flags)) {
> >                 xen_poll_irq_timeout(irq, jiffies + 3*HZ);
> >                 xen_clear_irq_pending(irq);
> > -               do_gettimeofday(&tv);
> > -               ns = timeval_to_ns(&tv);
> > +               ns = ktime_get_ns();
> >                 if (ns > ns_timeout) {
> >                         dev_err(&pdev->xdev->dev,
> >                                 "pciback not responding!!!\n");
> > --
> > 2.2.0.rc0.207.ga3a616c
> >

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

* Re: [Xen-devel] [PATCH v2] xen/pcifront: Remove usage of struct timeval
  2015-05-19  6:08 [PATCH v2] xen/pcifront: Remove usage of struct timeval Tina Ruchandani
                   ` (6 preceding siblings ...)
  2015-06-08 10:18 ` David Vrabel
@ 2015-06-08 10:18 ` David Vrabel
  7 siblings, 0 replies; 12+ messages in thread
From: David Vrabel @ 2015-06-08 10:18 UTC (permalink / raw)
  To: Tina Ruchandani, Arnd Bergmann
  Cc: y2038, linux-pci, David Vrabel, Bjorn Helgaas, xen-devel,
	Boris Ostrovsky

On 19/05/15 07:08, Tina Ruchandani wrote:
> struct timeval uses a 32-bit field for representing seconds,
> which will overflow in the year 2038 and beyond. This patch replaces
> struct timeval with 64-bit ktime_t which is 2038 safe.
> The patch is part of a larger effort to remove instances of
> 32-bit timekeeping variables (timeval, time_t and timespec)
> from the kernel.

Applied to for-linus-4.2, thanks.

"This patch" is a bit redundant in a commit message so I tweaked it to read:

    struct timeval uses a 32-bit field for representing seconds, which
    will overflow in the year 2038 and beyond. Replace struct timeval
    with 64-bit ktime_t which is 2038 safe.  This is part of a larger
    effort to remove instances of 32-bit timekeeping variables
    (timeval, time_t and timespec) from the kernel.

> Signed-off-by: Tina Ruchandani <ruchandani.tina@gmail.com>
> Suggested-by: Arnd Bergmann <arnd@arndb.de>
> --

Use 3 hyphens as a separator here.

> Changes in v2:

David

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

* Re: [PATCH v2] xen/pcifront: Remove usage of struct timeval
  2015-05-19  6:08 [PATCH v2] xen/pcifront: Remove usage of struct timeval Tina Ruchandani
                   ` (5 preceding siblings ...)
  2015-05-20 13:16 ` Bjorn Helgaas
@ 2015-06-08 10:18 ` David Vrabel
  2015-06-08 10:18 ` [Xen-devel] " David Vrabel
  7 siblings, 0 replies; 12+ messages in thread
From: David Vrabel @ 2015-06-08 10:18 UTC (permalink / raw)
  To: Tina Ruchandani, Arnd Bergmann
  Cc: y2038, linux-pci, David Vrabel, Bjorn Helgaas, xen-devel,
	Boris Ostrovsky

On 19/05/15 07:08, Tina Ruchandani wrote:
> struct timeval uses a 32-bit field for representing seconds,
> which will overflow in the year 2038 and beyond. This patch replaces
> struct timeval with 64-bit ktime_t which is 2038 safe.
> The patch is part of a larger effort to remove instances of
> 32-bit timekeeping variables (timeval, time_t and timespec)
> from the kernel.

Applied to for-linus-4.2, thanks.

"This patch" is a bit redundant in a commit message so I tweaked it to read:

    struct timeval uses a 32-bit field for representing seconds, which
    will overflow in the year 2038 and beyond. Replace struct timeval
    with 64-bit ktime_t which is 2038 safe.  This is part of a larger
    effort to remove instances of 32-bit timekeeping variables
    (timeval, time_t and timespec) from the kernel.

> Signed-off-by: Tina Ruchandani <ruchandani.tina@gmail.com>
> Suggested-by: Arnd Bergmann <arnd@arndb.de>
> --

Use 3 hyphens as a separator here.

> Changes in v2:

David

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

* [PATCH v2] xen/pcifront: Remove usage of struct timeval
@ 2015-05-19  6:08 Tina Ruchandani
  0 siblings, 0 replies; 12+ messages in thread
From: Tina Ruchandani @ 2015-05-19  6:08 UTC (permalink / raw)
  To: Arnd Bergmann
  Cc: y2038, linux-pci, David Vrabel, Bjorn Helgaas, xen-devel,
	Boris Ostrovsky

struct timeval uses a 32-bit field for representing seconds,
which will overflow in the year 2038 and beyond. This patch replaces
struct timeval with 64-bit ktime_t which is 2038 safe.
The patch is part of a larger effort to remove instances of
32-bit timekeeping variables (timeval, time_t and timespec)
from the kernel.

Signed-off-by: Tina Ruchandani <ruchandani.tina@gmail.com>
Suggested-by: Arnd Bergmann <arnd@arndb.de>
--
Changes in v2:
- Use monotonic time (ktime_get_ns()) instead of real time
since we only care about elapsed delta here.
- Use macro ktime_get_ns() instead of getting ktime_t and
converting it to ns.
---
 drivers/pci/xen-pcifront.c | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)

diff --git a/drivers/pci/xen-pcifront.c b/drivers/pci/xen-pcifront.c
index 7cfd2db..c4796c8 100644
--- a/drivers/pci/xen-pcifront.c
+++ b/drivers/pci/xen-pcifront.c
@@ -20,6 +20,7 @@
 #include <linux/workqueue.h>
 #include <linux/bitops.h>
 #include <linux/time.h>
+#include <linux/ktime.h>
 #include <xen/platform_pci.h>
 
 #include <asm/xen/swiotlb-xen.h>
@@ -115,7 +116,6 @@ static int do_pci_op(struct pcifront_device *pdev, struct xen_pci_op *op)
 	evtchn_port_t port = pdev->evtchn;
 	unsigned irq = pdev->irq;
 	s64 ns, ns_timeout;
-	struct timeval tv;
 
 	spin_lock_irqsave(&pdev->sh_info_lock, irq_flags);
 
@@ -132,8 +132,7 @@ static int do_pci_op(struct pcifront_device *pdev, struct xen_pci_op *op)
 	 * (in the latter case we end up continually re-executing poll() with a
 	 * timeout in the past). 1s difference gives plenty of slack for error.
 	 */
-	do_gettimeofday(&tv);
-	ns_timeout = timeval_to_ns(&tv) + 2 * (s64)NSEC_PER_SEC;
+	ns_timeout = ktime_get_ns() + 2 * (s64)NSEC_PER_SEC;
 
 	xen_clear_irq_pending(irq);
 
@@ -141,8 +140,7 @@ static int do_pci_op(struct pcifront_device *pdev, struct xen_pci_op *op)
 			(unsigned long *)&pdev->sh_info->flags)) {
 		xen_poll_irq_timeout(irq, jiffies + 3*HZ);
 		xen_clear_irq_pending(irq);
-		do_gettimeofday(&tv);
-		ns = timeval_to_ns(&tv);
+		ns = ktime_get_ns();
 		if (ns > ns_timeout) {
 			dev_err(&pdev->xdev->dev,
 				"pciback not responding!!!\n");
-- 
2.2.0.rc0.207.ga3a616c

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

end of thread, other threads:[~2015-06-08 10:18 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-05-19  6:08 [PATCH v2] xen/pcifront: Remove usage of struct timeval Tina Ruchandani
2015-05-19 14:14 ` Boris Ostrovsky
2015-05-19 14:14 ` Boris Ostrovsky
2015-05-20 12:21 ` [Y2038] " Arnd Bergmann
2015-05-20 12:21 ` Arnd Bergmann
2015-05-20 13:16 ` Bjorn Helgaas
2015-05-20 13:16 ` Bjorn Helgaas
2015-06-05 19:07   ` Konrad Rzeszutek Wilk
2015-06-05 19:07   ` Konrad Rzeszutek Wilk
2015-06-08 10:18 ` David Vrabel
2015-06-08 10:18 ` [Xen-devel] " David Vrabel
  -- strict thread matches above, loose matches on Subject: below --
2015-05-19  6:08 Tina Ruchandani

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.