soc/qman: Sleep instead of stuck hacking jiffies.
PATCH 1/1 soc/qman: Sleep instead of stuck hacking jiffies.
Use msleep() instead of stucking with
long delay will be more efficient.
--- drivers/soc/fsl/qbman/qman.c | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-)
drivers/soc/fsl/qbman/qman.c +1 -5
@@ -1084,11 +1084,7 @@ static int drain_mr_fqrni(struct qm_portal *p)* entries well before the ring has been fully consumed, so * we're being *really* paranoid here. */ -u64 now, then = jiffies; - -do { - now = jiffies; - }while ((then +10000 ) > now); +msleep (1 ); msg =qm_mr_current (p);if (!msg)return 0 ;
Signature · 1 line
2.7.4
From: Karim Eshapa
Quoted 3 lines
Sent: 25 June 2017 16:14
Usemsleep()instead of stucking with
long delay will be more efficient.
...
drivers/soc/fsl/qbman/qman.c static int drain_mr_fqrni(struct qm_portal *p) · line 1087
Quoted 12 lines
drivers/soc/fsl/qbman/qman.c +1
-5@@ -1084,11 +1084,7 @@ static int drain_mr_fqrni(struct qm_portal *p)* entries well before the ring has been fully consumed, so * we're being *really* paranoid here. */ -u64 now, then = jiffies; - -do { - now = jiffies; - }while ((then +10000 ) > now); +msleep (1 );
...
How is that in any way equivalent?
If HZ is 1000 the old code loops for 10 seconds.
If HZ is 250 (common for some distros) it loops for 40 seconds.
Clearly both are horrid, but it isn't at all clear that a 1ms sleep is performing the same job.
My guess is that this code is never called, and broken if actually called.
David
Quoted 34 lines
-----Original Message-----
From: Linuxppc-dev [mailto:linuxppc-dev- bounces+leoli=freescale.com at lists.ozlabs.org] On Behalf Of David Laight
Sent: Monday, June 26, 2017 10:55 AM
To: 'Karim Eshapa' <[email protected]>; oss at buserror.net
Cc: Roy Pledge <[email protected]>; linux-kernel at vger.kernel.org; Claudiu Manoil <[email protected]>; colin.king at canonical.com; linuxppc-dev at lists.ozlabs.org; linux-arm-kernel at lists.infradead.org
Subject: RE: [PATCH] soc/qman: Sleep instead of stuck hacking jiffies.From: Karim Eshapa
Quoted 3 lines
Sent: 25 June 2017 16:14
Usemsleep()instead of stucking with
long delay will be more efficient....
drivers/soc/fsl/qbman/qman.c static int drain_mr_fqrni(struct qm_portal *p) · line 1087
Quoted 12 lines
drivers/soc/fsl/qbman/qman.c +1
-5@@ -1084,11 +1084,7 @@ static int drain_mr_fqrni(struct qm_portal *p)* entries well before the ring has been fully consumed, so * we're being *really* paranoid here. */ -u64 now, then = jiffies; - -do { - now = jiffies; - }while ((then +10000 ) > now); +msleep (1 );...
How is that in any way equivalent?
If HZ is 1000 the old code loops for 10 seconds.
If HZ is 250 (common for some distros) it loops for 40 seconds.
Quoted 4 lines
Clearly both are horrid, but it isn't at all clear that a 1ms sleep is performing the same job.
My guess is that this code is never called, and broken if actually called.
It was indeed broken. The intent was to wait for 10000 cycles but mistakenly coded as 10000 jiffies. I think we choose 1ms as it is not too long and almost guarantees the 10000 cycles delay.
Regards,
Leo