All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] xenbaked.c: Avoid divide by zero issue on dump_stats()
@ 2018-03-14  1:38 Joe Jin
  2018-03-14  2:24 ` Konrad Rzeszutek Wilk
  0 siblings, 1 reply; 4+ messages in thread
From: Joe Jin @ 2018-03-14  1:38 UTC (permalink / raw)
  To: Konrad Rzeszutek Wilk, Wei Liu, Ian Campbell; +Cc: xen-devel, Philip Lee

run_time on dump_stats() maybe zero if break xenmon.py immediately after it
started, then xenbaked hit divide by zero fault.

Signed-off-by: Joe Jin <joe.jin@oracle.com>
Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Cc: Wei Liu <wei.liu2@citrix.com>
Cc: Ian Campbell <ian.campbell@citrix.com>
---
 tools/xenmon/xenbaked.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/tools/xenmon/xenbaked.c b/tools/xenmon/xenbaked.c
index 3d9e0ed900..d3f940a26b 100644
--- a/tools/xenmon/xenbaked.c
+++ b/tools/xenmon/xenbaked.c
@@ -243,10 +243,12 @@ static void dump_stats(void)
     }
 
     printf("processed %d total records in %d seconds (%ld per second)\n",
-           rec_count, (int)run_time, (long)(rec_count/run_time));
+           rec_count, (int)run_time,
+           run_time ? (long)(rec_count/run_time) : 0L);
 
-    printf("woke up %d times in %d seconds (%ld per second)\n", wakeups,
-	   (int) run_time, (long)(wakeups/run_time));
+    printf("woke up %d times in %d seconds (%ld per second)\n",
+           wakeups, (int) run_time,
+           run_time ? (long)(wakeups/run_time) : 0L);
 
     check_gotten_sum();
 }
-- 
2.14.3 (Apple Git-98)


_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel

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

* Re: [PATCH] xenbaked.c: Avoid divide by zero issue on dump_stats()
  2018-03-14  1:38 [PATCH] xenbaked.c: Avoid divide by zero issue on dump_stats() Joe Jin
@ 2018-03-14  2:24 ` Konrad Rzeszutek Wilk
  2018-03-14 10:54   ` George Dunlap
  0 siblings, 1 reply; 4+ messages in thread
From: Konrad Rzeszutek Wilk @ 2018-03-14  2:24 UTC (permalink / raw)
  To: Joe Jin; +Cc: xen-devel, Philip Lee, Wei Liu, Ian Campbell

On Tue, Mar 13, 2018 at 06:38:24PM -0700, Joe Jin wrote:
> run_time on dump_stats() maybe zero if break xenmon.py immediately after it

s/maybe/can be/
> started, then xenbaked hit divide by zero fault.

And:

"Note that run_time is computed using two values which are retrieved using 'time'
system call which gives us resolution in seconds."

> 
> Signed-off-by: Joe Jin <joe.jin@oracle.com>
> Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
> Cc: Wei Liu <wei.liu2@citrix.com>
> Cc: Ian Campbell <ian.campbell@citrix.com>
> ---
>  tools/xenmon/xenbaked.c | 8 +++++---
>  1 file changed, 5 insertions(+), 3 deletions(-)
> 
> diff --git a/tools/xenmon/xenbaked.c b/tools/xenmon/xenbaked.c
> index 3d9e0ed900..d3f940a26b 100644
> --- a/tools/xenmon/xenbaked.c
> +++ b/tools/xenmon/xenbaked.c
> @@ -243,10 +243,12 @@ static void dump_stats(void)
>      }
>  
>      printf("processed %d total records in %d seconds (%ld per second)\n",
> -           rec_count, (int)run_time, (long)(rec_count/run_time));
> +           rec_count, (int)run_time,
> +           run_time ? (long)(rec_count/run_time) : 0L);
>  
> -    printf("woke up %d times in %d seconds (%ld per second)\n", wakeups,
> -	   (int) run_time, (long)(wakeups/run_time));
> +    printf("woke up %d times in %d seconds (%ld per second)\n",
> +           wakeups, (int) run_time,
> +           run_time ? (long)(wakeups/run_time) : 0L);
>  
>      check_gotten_sum();
>  }
> -- 
> 2.14.3 (Apple Git-98)
> 

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel

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

* Re: [PATCH] xenbaked.c: Avoid divide by zero issue on dump_stats()
  2018-03-14  2:24 ` Konrad Rzeszutek Wilk
@ 2018-03-14 10:54   ` George Dunlap
  2018-03-14 14:04     ` Konrad Rzeszutek Wilk
  0 siblings, 1 reply; 4+ messages in thread
From: George Dunlap @ 2018-03-14 10:54 UTC (permalink / raw)
  To: Konrad Rzeszutek Wilk
  Cc: xen-devel, Philip Lee, Joe Jin, Wei Liu, Ian Campbell

On Wed, Mar 14, 2018 at 2:24 AM, Konrad Rzeszutek Wilk
<konrad.wilk@oracle.com> wrote:
> On Tue, Mar 13, 2018 at 06:38:24PM -0700, Joe Jin wrote:
>> run_time on dump_stats() maybe zero if break xenmon.py immediately after it
>
> s/maybe/can be/
>> started, then xenbaked hit divide by zero fault.
>
> And:
>
> "Note that run_time is computed using two values which are retrieved using 'time'
> system call which gives us resolution in seconds."

Is anyone still using this?  Does it even work?  I thought we had
talked about removing it at some point.

 -George

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel

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

* Re: [PATCH] xenbaked.c: Avoid divide by zero issue on dump_stats()
  2018-03-14 10:54   ` George Dunlap
@ 2018-03-14 14:04     ` Konrad Rzeszutek Wilk
  0 siblings, 0 replies; 4+ messages in thread
From: Konrad Rzeszutek Wilk @ 2018-03-14 14:04 UTC (permalink / raw)
  To: George Dunlap; +Cc: xen-devel, Philip Lee, Joe Jin, Wei Liu, Ian Campbell

On Wed, Mar 14, 2018 at 10:54:42AM +0000, George Dunlap wrote:
> On Wed, Mar 14, 2018 at 2:24 AM, Konrad Rzeszutek Wilk
> <konrad.wilk@oracle.com> wrote:
> > On Tue, Mar 13, 2018 at 06:38:24PM -0700, Joe Jin wrote:
> >> run_time on dump_stats() maybe zero if break xenmon.py immediately after it
> >
> > s/maybe/can be/
> >> started, then xenbaked hit divide by zero fault.
> >
> > And:
> >
> > "Note that run_time is computed using two values which are retrieved using 'time'
> > system call which gives us resolution in seconds."
> 
> Is anyone still using this?  Does it even work?  I thought we had

Yes as we found out as folks start coming out of the woods with the need
to update their OS thanks to spectre.

They use it with 'xenmon.py' combination.

> talked about removing it at some point.
> 
>  -George

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel

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

end of thread, other threads:[~2018-03-14 14:05 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-03-14  1:38 [PATCH] xenbaked.c: Avoid divide by zero issue on dump_stats() Joe Jin
2018-03-14  2:24 ` Konrad Rzeszutek Wilk
2018-03-14 10:54   ` George Dunlap
2018-03-14 14:04     ` Konrad Rzeszutek Wilk

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.