All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH]: canfdtest typo while waiting for tv_stop time
@ 2016-11-16 10:46 Stephane Grosjean
  2016-11-17  8:09 ` Ramesh Shanmugasundaram
  2016-11-21 10:36 ` Marc Kleine-Budde
  0 siblings, 2 replies; 4+ messages in thread
From: Stephane Grosjean @ 2016-11-16 10:46 UTC (permalink / raw)
  To: Marc Kleine-Budde, linux-can

Hello Mark,

After a few complaint about 100% CPU usage of canfdtest over our PCI 
-like boards, I have had a look to the source file, and think I have 
found the issue in:

diff --git a/canfdtest.c b/canfdtest.c
index 2407027..d7ba740 100644
--- a/canfdtest.c
+++ b/canfdtest.c
@@ -239,7 +239,7 @@ static int can_echo_dut(void)
                                 }
                                 gettimeofday(&tvn, NULL);
                                 while ((tv_stop.tv_sec > tvn.tv_sec) ||
-                                      ((tv_stop.tv_sec = tvn.tv_sec) &&
+                                      ((tv_stop.tv_sec == tvn.tv_sec) &&
                                         (tv_stop.tv_usec >= tvn.tv_usec)))
                                         gettimeofday(&tvn, NULL);
                         }

Am I right?

Regards,

Stéphane

--
PEAK-System Technik GmbH
Sitz der Gesellschaft Darmstadt - HRB 9183 
Geschaeftsfuehrung: A.Gach, U.Wilhelm
--

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

* RE: [PATCH]: canfdtest typo while waiting for tv_stop time
  2016-11-16 10:46 [PATCH]: canfdtest typo while waiting for tv_stop time Stephane Grosjean
@ 2016-11-17  8:09 ` Ramesh Shanmugasundaram
  2016-11-21 10:37   ` Marc Kleine-Budde
  2016-11-21 10:36 ` Marc Kleine-Budde
  1 sibling, 1 reply; 4+ messages in thread
From: Ramesh Shanmugasundaram @ 2016-11-17  8:09 UTC (permalink / raw)
  To: Stephane Grosjean, Marc Kleine-Budde, linux-can

> Subject: [PATCH]: canfdtest typo while waiting for tv_stop time
> 
> Hello Mark,
> 
> After a few complaint about 100% CPU usage of canfdtest over our PCI -like
> boards, I have had a look to the source file, and think I have found the
> issue in:
> 
> diff --git a/canfdtest.c b/canfdtest.c
> index 2407027..d7ba740 100644
> --- a/canfdtest.c
> +++ b/canfdtest.c
> @@ -239,7 +239,7 @@ static int can_echo_dut(void)
>                                  }
>                                  gettimeofday(&tvn, NULL);
>                                  while ((tv_stop.tv_sec > tvn.tv_sec) ||
> -                                      ((tv_stop.tv_sec = tvn.tv_sec) &&
> +                                      ((tv_stop.tv_sec == tvn.tv_sec)
> + &&
>                                          (tv_stop.tv_usec >=
> tvn.tv_usec)))
>                                          gettimeofday(&tvn, NULL);
>                          }
> 
> Am I right?

There is one more bug on that piece of code. I submitted a bug & a pull request fixing it

https://github.com/linux-can/can-utils/pull/15

Thanks,
Ramesh

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

* Re: [PATCH]: canfdtest typo while waiting for tv_stop time
  2016-11-16 10:46 [PATCH]: canfdtest typo while waiting for tv_stop time Stephane Grosjean
  2016-11-17  8:09 ` Ramesh Shanmugasundaram
@ 2016-11-21 10:36 ` Marc Kleine-Budde
  1 sibling, 0 replies; 4+ messages in thread
From: Marc Kleine-Budde @ 2016-11-21 10:36 UTC (permalink / raw)
  To: Stephane Grosjean, linux-can


[-- Attachment #1.1: Type: text/plain, Size: 1304 bytes --]

On 11/16/2016 11:46 AM, Stephane Grosjean wrote:
> After a few complaint about 100% CPU usage of canfdtest over our PCI 
> -like boards, I have had a look to the source file, and think I have 
> found the issue in:
> 
> diff --git a/canfdtest.c b/canfdtest.c
> index 2407027..d7ba740 100644
> --- a/canfdtest.c
> +++ b/canfdtest.c
> @@ -239,7 +239,7 @@ static int can_echo_dut(void)
>                                  }
>                                  gettimeofday(&tvn, NULL);
>                                  while ((tv_stop.tv_sec > tvn.tv_sec) ||
> -                                      ((tv_stop.tv_sec = tvn.tv_sec) &&
> +                                      ((tv_stop.tv_sec == tvn.tv_sec) &&
>                                          (tv_stop.tv_usec >= tvn.tv_usec)))
>                                          gettimeofday(&tvn, NULL);
>                          }
> 
> Am I right?

Yes. But it still does a busywait. I've reviewed Ramesh's changes, that
will fix the busywait.

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: 488 bytes --]

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

* Re: [PATCH]: canfdtest typo while waiting for tv_stop time
  2016-11-17  8:09 ` Ramesh Shanmugasundaram
@ 2016-11-21 10:37   ` Marc Kleine-Budde
  0 siblings, 0 replies; 4+ messages in thread
From: Marc Kleine-Budde @ 2016-11-21 10:37 UTC (permalink / raw)
  To: Ramesh Shanmugasundaram, Stephane Grosjean, linux-can


[-- Attachment #1.1: Type: text/plain, Size: 1516 bytes --]

On 11/17/2016 09:09 AM, Ramesh Shanmugasundaram wrote:
>> Subject: [PATCH]: canfdtest typo while waiting for tv_stop time
>>
>> Hello Mark,
>>
>> After a few complaint about 100% CPU usage of canfdtest over our PCI -like
>> boards, I have had a look to the source file, and think I have found the
>> issue in:
>>
>> diff --git a/canfdtest.c b/canfdtest.c
>> index 2407027..d7ba740 100644
>> --- a/canfdtest.c
>> +++ b/canfdtest.c
>> @@ -239,7 +239,7 @@ static int can_echo_dut(void)
>>                                  }
>>                                  gettimeofday(&tvn, NULL);
>>                                  while ((tv_stop.tv_sec > tvn.tv_sec) ||
>> -                                      ((tv_stop.tv_sec = tvn.tv_sec) &&
>> +                                      ((tv_stop.tv_sec == tvn.tv_sec)
>> + &&
>>                                          (tv_stop.tv_usec >=
>> tvn.tv_usec)))
>>                                          gettimeofday(&tvn, NULL);
>>                          }
>>
>> Am I right?
> 
> There is one more bug on that piece of code. I submitted a bug & a pull request fixing it
> 
> https://github.com/linux-can/can-utils/pull/15

See github for the review.

Thanks,
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: 488 bytes --]

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

end of thread, other threads:[~2016-11-21 10:38 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-11-16 10:46 [PATCH]: canfdtest typo while waiting for tv_stop time Stephane Grosjean
2016-11-17  8:09 ` Ramesh Shanmugasundaram
2016-11-21 10:37   ` Marc Kleine-Budde
2016-11-21 10:36 ` Marc Kleine-Budde

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.