netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 06/11] net/bonding: take msecs_to_jiffies_min into use
       [not found] ` <1368188011-23661-1-git-send-email-imre.deak@intel.com>
@ 2013-05-10 12:13   ` Imre Deak
  2013-05-10 13:58     ` Michal Kubecek
  2013-05-10 12:13   ` [PATCH 07/11] net/peak_pcmcia: " Imre Deak
                     ` (4 subsequent siblings)
  5 siblings, 1 reply; 10+ messages in thread
From: Imre Deak @ 2013-05-10 12:13 UTC (permalink / raw)
  To: linux-kernel
  Cc: Andrew Morton, Daniel Vetter, Jay Vosburgh, Andy Gospodarek, netdev

Use msecs_to_jiffies_min instead of open-coding the same.

Signed-off-by: Imre Deak <imre.deak@intel.com>
---
 drivers/net/bonding/bond_main.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c
index 07401a3..0c2de73 100644
--- a/drivers/net/bonding/bond_main.c
+++ b/drivers/net/bonding/bond_main.c
@@ -1751,7 +1751,7 @@ int bond_enslave(struct net_device *bond_dev, struct net_device *slave_dev)
 	read_lock(&bond->lock);
 
 	new_slave->last_arp_rx = jiffies -
-		(msecs_to_jiffies(bond->params.arp_interval) + 1);
+		(msecs_to_jiffies_min(bond->params.arp_interval));
 
 	if (bond->params.miimon && !bond->params.use_carrier) {
 		link_reporting = bond_check_dev_link(bond, slave_dev, 1);
-- 
1.7.10.4

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

* [PATCH 07/11] net/peak_pcmcia: take msecs_to_jiffies_min into use
       [not found] ` <1368188011-23661-1-git-send-email-imre.deak@intel.com>
  2013-05-10 12:13   ` [PATCH 06/11] net/bonding: take msecs_to_jiffies_min into use Imre Deak
@ 2013-05-10 12:13   ` Imre Deak
  2013-05-15  9:12     ` Marc Kleine-Budde
  2013-05-10 12:13   ` [PATCH 09/11] net/sunrpc: " Imre Deak
                     ` (3 subsequent siblings)
  5 siblings, 1 reply; 10+ messages in thread
From: Imre Deak @ 2013-05-10 12:13 UTC (permalink / raw)
  To: linux-kernel
  Cc: Andrew Morton, Daniel Vetter, Wolfgang Grandegger,
	Marc Kleine-Budde, Bill Pemberton, David S. Miller,
	Greg Kroah-Hartman, Joe Perches, linux-can, netdev

Use msecs_to_jiffies_min instead of open-coding the same.

Signed-off-by: Imre Deak <imre.deak@intel.com>
---
 drivers/net/can/sja1000/peak_pcmcia.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/can/sja1000/peak_pcmcia.c b/drivers/net/can/sja1000/peak_pcmcia.c
index 1a7020b..3e45e16 100644
--- a/drivers/net/can/sja1000/peak_pcmcia.c
+++ b/drivers/net/can/sja1000/peak_pcmcia.c
@@ -253,7 +253,7 @@ static inline int pcan_pccard_present(struct pcan_pccard *card)
 static int pcan_wait_spi_busy(struct pcan_pccard *card)
 {
 	unsigned long timeout = jiffies +
-				msecs_to_jiffies(PCC_SPI_MAX_BUSY_WAIT_MS) + 1;
+				msecs_to_jiffies_min(PCC_SPI_MAX_BUSY_WAIT_MS);
 
 	/* be sure to read status at least once after sleeping */
 	while (pcan_read_reg(card, PCC_CSR) & PCC_CSR_SPI_BUSY) {
-- 
1.7.10.4

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

* [PATCH 09/11] net/sunrpc: take msecs_to_jiffies_min into use
       [not found] ` <1368188011-23661-1-git-send-email-imre.deak@intel.com>
  2013-05-10 12:13   ` [PATCH 06/11] net/bonding: take msecs_to_jiffies_min into use Imre Deak
  2013-05-10 12:13   ` [PATCH 07/11] net/peak_pcmcia: " Imre Deak
@ 2013-05-10 12:13   ` Imre Deak
  2013-05-10 12:13   ` [PATCH 10/11] net/tipc: " Imre Deak
                     ` (2 subsequent siblings)
  5 siblings, 0 replies; 10+ messages in thread
From: Imre Deak @ 2013-05-10 12:13 UTC (permalink / raw)
  To: linux-kernel
  Cc: Andrew Morton, Daniel Vetter, J. Bruce Fields, Trond Myklebust,
	David S. Miller, Haggai Eran, Or Gerlitz, Shani Michaeli,
	Roland Dreier, linux-nfs, netdev

Use msecs_to_jiffies_min instead of open-coding the same.

Signed-off-by: Imre Deak <imre.deak@intel.com>
---
 net/sunrpc/xprtrdma/verbs.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/net/sunrpc/xprtrdma/verbs.c b/net/sunrpc/xprtrdma/verbs.c
index 93726560..9cac2c8 100644
--- a/net/sunrpc/xprtrdma/verbs.c
+++ b/net/sunrpc/xprtrdma/verbs.c
@@ -404,7 +404,7 @@ rpcrdma_create_id(struct rpcrdma_xprt *xprt,
 		goto out;
 	}
 	wait_for_completion_interruptible_timeout(&ia->ri_done,
-				msecs_to_jiffies(RDMA_RESOLVE_TIMEOUT) + 1);
+				msecs_to_jiffies_min(RDMA_RESOLVE_TIMEOUT));
 	rc = ia->ri_async_rc;
 	if (rc)
 		goto out;
@@ -417,7 +417,7 @@ rpcrdma_create_id(struct rpcrdma_xprt *xprt,
 		goto out;
 	}
 	wait_for_completion_interruptible_timeout(&ia->ri_done,
-				msecs_to_jiffies(RDMA_RESOLVE_TIMEOUT) + 1);
+				msecs_to_jiffies_min(RDMA_RESOLVE_TIMEOUT));
 	rc = ia->ri_async_rc;
 	if (rc)
 		goto out;
-- 
1.7.10.4

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

* [PATCH 10/11] net/tipc: take msecs_to_jiffies_min into use
       [not found] ` <1368188011-23661-1-git-send-email-imre.deak@intel.com>
                     ` (2 preceding siblings ...)
  2013-05-10 12:13   ` [PATCH 09/11] net/sunrpc: " Imre Deak
@ 2013-05-10 12:13   ` Imre Deak
  2013-05-14 14:48   ` [PATCH v2 6/8] net/sunrpc: take msecs_to_jiffies_timeout " Imre Deak
  2013-05-14 14:48   ` [PATCH v2 7/8] net/tipc: " Imre Deak
  5 siblings, 0 replies; 10+ messages in thread
From: Imre Deak @ 2013-05-10 12:13 UTC (permalink / raw)
  To: linux-kernel
  Cc: Andrew Morton, Daniel Vetter, Jon Maloy, Allan Stephens,
	David S. Miller, netdev, tipc-discussion

Use msecs_to_jiffies_min instead of open-coding the same.

Signed-off-by: Imre Deak <imre.deak@intel.com>
---
 net/tipc/core.h |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/net/tipc/core.h b/net/tipc/core.h
index 0207db0..3f23e22 100644
--- a/net/tipc/core.h
+++ b/net/tipc/core.h
@@ -133,7 +133,7 @@ static inline void k_init_timer(struct timer_list *timer, Handler routine,
  */
 static inline void k_start_timer(struct timer_list *timer, unsigned long msec)
 {
-	mod_timer(timer, jiffies + msecs_to_jiffies(msec) + 1);
+	mod_timer(timer, jiffies + msecs_to_jiffies_min(msec));
 }
 
 /**
-- 
1.7.10.4

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

* Re: [PATCH 06/11] net/bonding: take msecs_to_jiffies_min into use
  2013-05-10 12:13   ` [PATCH 06/11] net/bonding: take msecs_to_jiffies_min into use Imre Deak
@ 2013-05-10 13:58     ` Michal Kubecek
  2013-05-10 21:19       ` Imre Deak
  0 siblings, 1 reply; 10+ messages in thread
From: Michal Kubecek @ 2013-05-10 13:58 UTC (permalink / raw)
  To: Imre Deak
  Cc: linux-kernel, Andrew Morton, Daniel Vetter, Jay Vosburgh,
	Andy Gospodarek, netdev

On Fri, May 10, 2013 at 03:13:24PM +0300, Imre Deak wrote:
> --- a/drivers/net/bonding/bond_main.c
> +++ b/drivers/net/bonding/bond_main.c
> @@ -1751,7 +1751,7 @@ int bond_enslave(struct net_device *bond_dev, struct net_device *slave_dev)
>  	read_lock(&bond->lock);
>  
>  	new_slave->last_arp_rx = jiffies -
> -		(msecs_to_jiffies(bond->params.arp_interval) + 1);
> +		(msecs_to_jiffies_min(bond->params.arp_interval));
>  
>  	if (bond->params.miimon && !bond->params.use_carrier) {
>  		link_reporting = bond_check_dev_link(bond, slave_dev, 1);

This "+ 1" was actually meant as "plus one". We need to ensure that

  slave->last_arp_rx + msecs_to_jiffies(bond->params.arp_interval)

is strictly less than current value of jiffies. So with proposed
definition of msecs_to_jiffies_min() it works correctly but if the
implementation ever changes in such way that

  msecs_to_jiffies_min(x) >= msecs_to_jiffies(x)

for some value of x, the code would be incorrect.

                                                       Michal Kubeček

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

* Re: [PATCH 06/11] net/bonding: take msecs_to_jiffies_min into use
  2013-05-10 13:58     ` Michal Kubecek
@ 2013-05-10 21:19       ` Imre Deak
  0 siblings, 0 replies; 10+ messages in thread
From: Imre Deak @ 2013-05-10 21:19 UTC (permalink / raw)
  To: Michal Kubecek
  Cc: linux-kernel, Andrew Morton, Daniel Vetter, Jay Vosburgh,
	Andy Gospodarek, netdev

On Fri, 2013-05-10 at 15:58 +0200, Michal Kubecek wrote:
> On Fri, May 10, 2013 at 03:13:24PM +0300, Imre Deak wrote:
> > --- a/drivers/net/bonding/bond_main.c
> > +++ b/drivers/net/bonding/bond_main.c
> > @@ -1751,7 +1751,7 @@ int bond_enslave(struct net_device *bond_dev, struct net_device *slave_dev)
> >  	read_lock(&bond->lock);
> >  
> >  	new_slave->last_arp_rx = jiffies -
> > -		(msecs_to_jiffies(bond->params.arp_interval) + 1);
> > +		(msecs_to_jiffies_min(bond->params.arp_interval));
> >  
> >  	if (bond->params.miimon && !bond->params.use_carrier) {
> >  		link_reporting = bond_check_dev_link(bond, slave_dev, 1);
> 
> This "+ 1" was actually meant as "plus one". We need to ensure that
> 
>   slave->last_arp_rx + msecs_to_jiffies(bond->params.arp_interval)
> 
> is strictly less than current value of jiffies.

Ok, I see, the adjustment here is for a different reason and
msecs_to_jiffies_min wouldn't express this properly. So we should drop
this patch. Perhaps it'd be nice to add something like the above
explanation as a code comment, to make it clear that the adjustment is
not for guaranteeing a minimum duration as it is in many other places.

--Imre

> So with proposed
> definition of msecs_to_jiffies_min() it works correctly but if the
> implementation ever changes in such way that
> 
>   msecs_to_jiffies_min(x) >= msecs_to_jiffies(x)
> 
> for some value of x, the code would be incorrect.
> 
>                                                        Michal Kubeček
> 

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

* [PATCH v2 6/8] net/sunrpc: take msecs_to_jiffies_timeout into use
       [not found] ` <1368188011-23661-1-git-send-email-imre.deak@intel.com>
                     ` (3 preceding siblings ...)
  2013-05-10 12:13   ` [PATCH 10/11] net/tipc: " Imre Deak
@ 2013-05-14 14:48   ` Imre Deak
  2013-05-14 14:48   ` [PATCH v2 7/8] net/tipc: " Imre Deak
  5 siblings, 0 replies; 10+ messages in thread
From: Imre Deak @ 2013-05-14 14:48 UTC (permalink / raw)
  To: linux-kernel
  Cc: Andrew Morton, Daniel Vetter, J. Bruce Fields, Trond Myklebust,
	David S. Miller, Haggai Eran, Or Gerlitz, Shani Michaeli,
	Roland Dreier, linux-nfs, netdev

Use msecs_to_jiffies_timeout instead of open-coding the same.

Signed-off-by: Imre Deak <imre.deak@intel.com>
---
 net/sunrpc/xprtrdma/verbs.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/net/sunrpc/xprtrdma/verbs.c b/net/sunrpc/xprtrdma/verbs.c
index 93726560..8a6575d 100644
--- a/net/sunrpc/xprtrdma/verbs.c
+++ b/net/sunrpc/xprtrdma/verbs.c
@@ -404,7 +404,7 @@ rpcrdma_create_id(struct rpcrdma_xprt *xprt,
 		goto out;
 	}
 	wait_for_completion_interruptible_timeout(&ia->ri_done,
-				msecs_to_jiffies(RDMA_RESOLVE_TIMEOUT) + 1);
+				msecs_to_jiffies_timeout(RDMA_RESOLVE_TIMEOUT));
 	rc = ia->ri_async_rc;
 	if (rc)
 		goto out;
@@ -417,7 +417,7 @@ rpcrdma_create_id(struct rpcrdma_xprt *xprt,
 		goto out;
 	}
 	wait_for_completion_interruptible_timeout(&ia->ri_done,
-				msecs_to_jiffies(RDMA_RESOLVE_TIMEOUT) + 1);
+				msecs_to_jiffies_timeout(RDMA_RESOLVE_TIMEOUT));
 	rc = ia->ri_async_rc;
 	if (rc)
 		goto out;
-- 
1.7.10.4

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

* [PATCH v2 7/8] net/tipc: take msecs_to_jiffies_timeout into use
       [not found] ` <1368188011-23661-1-git-send-email-imre.deak@intel.com>
                     ` (4 preceding siblings ...)
  2013-05-14 14:48   ` [PATCH v2 6/8] net/sunrpc: take msecs_to_jiffies_timeout " Imre Deak
@ 2013-05-14 14:48   ` Imre Deak
  5 siblings, 0 replies; 10+ messages in thread
From: Imre Deak @ 2013-05-14 14:48 UTC (permalink / raw)
  To: linux-kernel
  Cc: Andrew Morton, Daniel Vetter, Jon Maloy, Allan Stephens,
	David S. Miller, netdev, tipc-discussion

Use msecs_to_jiffies_timeout instead of open-coding the same.

Signed-off-by: Imre Deak <imre.deak@intel.com>
---
 net/tipc/core.h |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/net/tipc/core.h b/net/tipc/core.h
index 0207db0..b24e2fc 100644
--- a/net/tipc/core.h
+++ b/net/tipc/core.h
@@ -133,7 +133,7 @@ static inline void k_init_timer(struct timer_list *timer, Handler routine,
  */
 static inline void k_start_timer(struct timer_list *timer, unsigned long msec)
 {
-	mod_timer(timer, jiffies + msecs_to_jiffies(msec) + 1);
+	mod_timer(timer, jiffies + msecs_to_jiffies_timeout(msec));
 }
 
 /**
-- 
1.7.10.4

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

* Re: [PATCH 07/11] net/peak_pcmcia: take msecs_to_jiffies_min into use
  2013-05-10 12:13   ` [PATCH 07/11] net/peak_pcmcia: " Imre Deak
@ 2013-05-15  9:12     ` Marc Kleine-Budde
  2013-05-15 11:45       ` Marc Kleine-Budde
  0 siblings, 1 reply; 10+ messages in thread
From: Marc Kleine-Budde @ 2013-05-15  9:12 UTC (permalink / raw)
  To: Imre Deak
  Cc: linux-kernel, Andrew Morton, Daniel Vetter, Wolfgang Grandegger,
	Bill Pemberton, David S. Miller, Greg Kroah-Hartman, Joe Perches,
	linux-can, netdev

[-- Attachment #1: Type: text/plain, Size: 484 bytes --]

On 05/10/2013 02:13 PM, Imre Deak wrote:
> Use msecs_to_jiffies_min instead of open-coding the same.
> 
> Signed-off-by: Imre Deak <imre.deak@intel.com>

Tnx, applied to linux-can-next/master.

Marc

-- 
Pengutronix e.K.                  | Marc Kleine-Budde           |
Industrial Linux Solutions        | Phone: +49-231-2826-924     |
Vertretung West/Dortmund          | Fax:   +49-5121-206917-5555 |
Amtsgericht Hildesheim, HRA 2686  | http://www.pengutronix.de   |


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 263 bytes --]

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

* Re: [PATCH 07/11] net/peak_pcmcia: take msecs_to_jiffies_min into use
  2013-05-15  9:12     ` Marc Kleine-Budde
@ 2013-05-15 11:45       ` Marc Kleine-Budde
  0 siblings, 0 replies; 10+ messages in thread
From: Marc Kleine-Budde @ 2013-05-15 11:45 UTC (permalink / raw)
  To: Imre Deak
  Cc: linux-kernel, Andrew Morton, Daniel Vetter, Wolfgang Grandegger,
	Bill Pemberton, David S. Miller, Greg Kroah-Hartman, Joe Perches,
	linux-can, netdev

[-- Attachment #1: Type: text/plain, Size: 726 bytes --]

On 05/15/2013 11:12 AM, Marc Kleine-Budde wrote:
> On 05/10/2013 02:13 PM, Imre Deak wrote:
>> Use msecs_to_jiffies_min instead of open-coding the same.
>>
>> Signed-off-by: Imre Deak <imre.deak@intel.com>
> 
> Tnx, applied to linux-can-next/master.

Removed, as requested by Imre:

> The reason is that in that driver I wasn't sure about why +1 was
> added, since the time_after() check already guarantees a minimum wait
> time.

Marc
-- 
Pengutronix e.K.                  | Marc Kleine-Budde           |
Industrial Linux Solutions        | Phone: +49-231-2826-924     |
Vertretung West/Dortmund          | Fax:   +49-5121-206917-5555 |
Amtsgericht Hildesheim, HRA 2686  | http://www.pengutronix.de   |


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 263 bytes --]

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

end of thread, other threads:[~2013-05-15 11:45 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <1368542918-8861-1-git-send-email-imre.deak@intel.com>
     [not found] ` <1368188011-23661-1-git-send-email-imre.deak@intel.com>
2013-05-10 12:13   ` [PATCH 06/11] net/bonding: take msecs_to_jiffies_min into use Imre Deak
2013-05-10 13:58     ` Michal Kubecek
2013-05-10 21:19       ` Imre Deak
2013-05-10 12:13   ` [PATCH 07/11] net/peak_pcmcia: " Imre Deak
2013-05-15  9:12     ` Marc Kleine-Budde
2013-05-15 11:45       ` Marc Kleine-Budde
2013-05-10 12:13   ` [PATCH 09/11] net/sunrpc: " Imre Deak
2013-05-10 12:13   ` [PATCH 10/11] net/tipc: " Imre Deak
2013-05-14 14:48   ` [PATCH v2 6/8] net/sunrpc: take msecs_to_jiffies_timeout " Imre Deak
2013-05-14 14:48   ` [PATCH v2 7/8] net/tipc: " Imre Deak

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).