Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1543238 > unrolled thread

[PATCH] liquidio CN23XX: make timeout HZ independent

Started byNicholas Mc Guire <hofrat@osadl.org>
First post2016-12-16 09:10 +0100
Last post2016-12-16 21:10 +0100
Articles 2 — 2 participants

Back to article view | Back to linux.kernel


Contents

  [PATCH] liquidio CN23XX: make timeout HZ independent Nicholas Mc Guire <hofrat@osadl.org> - 2016-12-16 09:10 +0100
    RE: [PATCH] liquidio CN23XX: make timeout HZ independent "Chickles, Derek" <Derek.Chickles@cavium.com> - 2016-12-16 21:10 +0100

#1543238 — [PATCH] liquidio CN23XX: make timeout HZ independent

FromNicholas Mc Guire <hofrat@osadl.org>
Date2016-12-16 09:10 +0100
Subject[PATCH] liquidio CN23XX: make timeout HZ independent
Message-ID<sOVKy-RH-3@gated-at.bofh.it>
schedule_timeout_* takes a timeout in jiffies but the code currently is
passing in a constant which makes this timeout HZ dependent, so pass it
through msecs_to_jiffies() to fix this up.

Signed-off-by: Nicholas Mc Guire <hofrat@osadl.org>
---

Problem found by coccinelle spatch

The current delay can vary by a factor 10 depending on the HZ
setting chose, which does not seem reasonable here.

The below patch sets the timeout to 10ms - it is though not clear
if this is the intent or if it should be longer/shorter as it is not
clear what HZ setting was assumed during design and used for testing.

This needs an ack by someone who knows the device and can confirm that
10ms is reasonable to wait for completion of queuing.

Patch was compile tested with: x86_64_defconfig + CONFIG_LIQUIDIO_VF=m
Note that this driver has a large number of sparse warnings !

Patch is against 4.9.0 (localversion-next is -next-20161216)

 drivers/net/ethernet/cavium/liquidio/octeon_mailbox.c | 2 ++-
 1 file changed, 2 insertion(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/cavium/liquidio/octeon_mailbox.c b/drivers/net/ethernet/cavium/liquidio/octeon_mailbox.c
index 73696b42..1a0fcbe 100644
--- a/drivers/net/ethernet/cavium/liquidio/octeon_mailbox.c
+++ b/drivers/net/ethernet/cavium/liquidio/octeon_mailbox.c
@@ -171,7 +171,8 @@ int octeon_mbox_write(struct octeon_device *oct,
 			count = 0;
 			while (readq(mbox->mbox_write_reg) !=
 			       OCTEON_PFVFACK) {
-				schedule_timeout_uninterruptible(10);
+				schedule_timeout_uninterruptible(
+							msecs_to_jiffies(10));
 				if (count++ == LIO_MBOX_WRITE_WAIT_CNT) {
 					ret = OCTEON_MBOX_STATUS_FAILED;
 					break;
-- 
2.1.4

[toc] | [next] | [standalone]


#1543725

From"Chickles, Derek" <Derek.Chickles@cavium.com>
Date2016-12-16 21:10 +0100
Message-ID<sP6Zk-8fR-11@gated-at.bofh.it>
In reply to#1543238
> -----Original Message-----
> From: Nicholas Mc Guire [mailto:hofrat@osadl.org]
> Sent: Friday, December 16, 2016 12:11 AM
> To: Chickles, Derek
> Cc: Burla, Satananda; Manlunas, Felix; Vatsavayi, Raghu;
> netdev@vger.kernel.org; linux-kernel@vger.kernel.org; Nicholas Mc Guire
> Subject: [PATCH] liquidio CN23XX: make timeout HZ independent
> 
> schedule_timeout_* takes a timeout in jiffies but the code currently is
> passing in a constant which makes this timeout HZ dependent, so pass it
> through msecs_to_jiffies() to fix this up.
> 
> Signed-off-by: Nicholas Mc Guire <hofrat@osadl.org>
> ---
> 
> Problem found by coccinelle spatch
> 
> The current delay can vary by a factor 10 depending on the HZ
> setting chose, which does not seem reasonable here.
> 
> The below patch sets the timeout to 10ms - it is though not clear
> if this is the intent or if it should be longer/shorter as it is not
> clear what HZ setting was assumed during design and used for testing.
> 
> This needs an ack by someone who knows the device and can confirm that
> 10ms is reasonable to wait for completion of queuing.

We were actually looking at this in parallel already to speed up driver
loading. It would be better if we changed LIO_MBOX_WRITE_WAIT_TIME
to 1 and applied the msecs_to_jiffies() to the line specified in your patch
and the loop just above that.

        while (readq(mbox->mbox_write_reg) != OCTEON_PFVFSIG) {
                schedule_timeout_uninterruptible(LIO_MBOX_WRITE_WAIT_TIME);
                if (count++ == LIO_MBOX_WRITE_WAIT_CNT) {
                        ret = OCTEON_MBOX_STATUS_FAILED;
                        break;
                }
        }       

If you can provide a new patch with both the changes we'll sign off on it.
Otherwise, it's on our list and we'll submit it soon ourselves.

Thanks,
Derek

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web