diff mbox

[04/14] xen: credit2: pack trace data better for xentrace_format

Message ID 20160205183357.4543.57665.stgit@Solace.station (mailing list archive)
State New, archived
Headers show

Commit Message

Dario Faggioli Feb. 5, 2016, 6:33 p.m. UTC
when tracing runstate changes, the vcpu and domain IDs
are encoded in the lower and higher, respectively, parts
of a 32 bits integer. When decoding a trace with
xentrace_format, this makes it possible to display
such events like this:

CPU0  833435853624 (+     768)  running_to_runnable [ dom:vcpu = 0x7fff0000 ]
CPU0  833435854416 (+     792)  runnable_to_running [ dom:vcpu = 0x00000007 ]

For consistency, we should do the same when displaying
the events coming from the Credit2 scheduler (when using
the same tool), and to do that, we need to invert the
order in which the fields are being put in the trace
struct right now.

Signed-off-by: Dario Faggioli <dario.faggioli@citrix.com>
---
Cc: George Dunlap <george.dunlap@citrix.com>
Cc: Olaf Hering <olaf@aepfle.de>
---
 xen/common/sched_credit2.c |   16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)

Comments

Konrad Rzeszutek Wilk Feb. 15, 2016, 4:29 p.m. UTC | #1
On Fri, Feb 05, 2016 at 07:33:57PM +0100, Dario Faggioli wrote:
> when tracing runstate changes, the vcpu and domain IDs
> are encoded in the lower and higher, respectively, parts
> of a 32 bits integer. When decoding a trace with
> xentrace_format, this makes it possible to display
> such events like this:
> 
> CPU0  833435853624 (+     768)  running_to_runnable [ dom:vcpu = 0x7fff0000 ]
> CPU0  833435854416 (+     792)  runnable_to_running [ dom:vcpu = 0x00000007 ]
> 
> For consistency, we should do the same when displaying
> the events coming from the Credit2 scheduler (when using
> the same tool), and to do that, we need to invert the
> order in which the fields are being put in the trace
> struct right now.
> 

Reviewed-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>

> Signed-off-by: Dario Faggioli <dario.faggioli@citrix.com>
> ---
> Cc: George Dunlap <george.dunlap@citrix.com>
> Cc: Olaf Hering <olaf@aepfle.de>
> ---
>  xen/common/sched_credit2.c |   16 ++++++++--------
>  1 file changed, 8 insertions(+), 8 deletions(-)
> 
> diff --git a/xen/common/sched_credit2.c b/xen/common/sched_credit2.c
> index 78220a7..cf40f68 100644
> --- a/xen/common/sched_credit2.c
> +++ b/xen/common/sched_credit2.c
> @@ -382,7 +382,7 @@ __update_svc_load(const struct scheduler *ops,
>  
>      {
>          struct {
> -            unsigned dom:16,vcpu:16;
> +            unsigned vcpu:16, dom:16;
>              unsigned v_avgload:32;
>          } d;
>          d.dom = svc->vcpu->domain->domain_id;
> @@ -450,7 +450,7 @@ runq_insert(const struct scheduler *ops, unsigned int cpu, struct csched2_vcpu *
>  
>      {
>          struct {
> -            unsigned dom:16,vcpu:16;
> +            unsigned vcpu:16, dom:16;
>              unsigned pos;
>          } d;
>          d.dom = svc->vcpu->domain->domain_id;
> @@ -536,7 +536,7 @@ runq_tickle(const struct scheduler *ops, unsigned int cpu, struct csched2_vcpu *
>  
>          /* TRACE */ {
>              struct {
> -                unsigned dom:16,vcpu:16;
> +                unsigned vcpu:16, dom:16;
>                  unsigned credit;
>              } d;
>              d.dom = cur->vcpu->domain->domain_id;
> @@ -561,9 +561,9 @@ tickle:
>  
>      /* TRACE */ {
>          struct {
> -            unsigned cpu:8;
> +            unsigned cpu:16, pad:16;
>          } d;
> -        d.cpu = ipid;
> +        d.cpu = ipid; d.pad = 0;
>          trace_var(TRC_CSCHED2_TICKLE, 0,
>                    sizeof(d),
>                    (unsigned char *)&d);
> @@ -634,7 +634,7 @@ static void reset_credit(const struct scheduler *ops, int cpu, s_time_t now,
>  
>          /* TRACE */ {
>              struct {
> -                unsigned dom:16,vcpu:16;
> +                unsigned vcpu:16, dom:16;
>                  unsigned credit_start, credit_end;
>                  unsigned multiplier;
>              } d;
> @@ -683,7 +683,7 @@ void burn_credits(struct csched2_runqueue_data *rqd, struct csched2_vcpu *svc, s
>      /* TRACE */
>      {
>          struct {
> -            unsigned dom:16,vcpu:16;
> +            unsigned vcpu:16, dom:16;
>              unsigned credit;
>              int delta;
>          } d;
> @@ -812,7 +812,7 @@ __runq_assign(struct csched2_vcpu *svc, struct csched2_runqueue_data *rqd)
>      /* TRACE */
>      {
>          struct {
> -            unsigned dom:16,vcpu:16;
> +            unsigned vcpu:16, dom:16;
>              unsigned rqi:16;
>          } d;
>          d.dom = svc->vcpu->domain->domain_id;
> 
> 
> _______________________________________________
> Xen-devel mailing list
> Xen-devel@lists.xen.org
> http://lists.xen.org/xen-devel
diff mbox

Patch

diff --git a/xen/common/sched_credit2.c b/xen/common/sched_credit2.c
index 78220a7..cf40f68 100644
--- a/xen/common/sched_credit2.c
+++ b/xen/common/sched_credit2.c
@@ -382,7 +382,7 @@  __update_svc_load(const struct scheduler *ops,
 
     {
         struct {
-            unsigned dom:16,vcpu:16;
+            unsigned vcpu:16, dom:16;
             unsigned v_avgload:32;
         } d;
         d.dom = svc->vcpu->domain->domain_id;
@@ -450,7 +450,7 @@  runq_insert(const struct scheduler *ops, unsigned int cpu, struct csched2_vcpu *
 
     {
         struct {
-            unsigned dom:16,vcpu:16;
+            unsigned vcpu:16, dom:16;
             unsigned pos;
         } d;
         d.dom = svc->vcpu->domain->domain_id;
@@ -536,7 +536,7 @@  runq_tickle(const struct scheduler *ops, unsigned int cpu, struct csched2_vcpu *
 
         /* TRACE */ {
             struct {
-                unsigned dom:16,vcpu:16;
+                unsigned vcpu:16, dom:16;
                 unsigned credit;
             } d;
             d.dom = cur->vcpu->domain->domain_id;
@@ -561,9 +561,9 @@  tickle:
 
     /* TRACE */ {
         struct {
-            unsigned cpu:8;
+            unsigned cpu:16, pad:16;
         } d;
-        d.cpu = ipid;
+        d.cpu = ipid; d.pad = 0;
         trace_var(TRC_CSCHED2_TICKLE, 0,
                   sizeof(d),
                   (unsigned char *)&d);
@@ -634,7 +634,7 @@  static void reset_credit(const struct scheduler *ops, int cpu, s_time_t now,
 
         /* TRACE */ {
             struct {
-                unsigned dom:16,vcpu:16;
+                unsigned vcpu:16, dom:16;
                 unsigned credit_start, credit_end;
                 unsigned multiplier;
             } d;
@@ -683,7 +683,7 @@  void burn_credits(struct csched2_runqueue_data *rqd, struct csched2_vcpu *svc, s
     /* TRACE */
     {
         struct {
-            unsigned dom:16,vcpu:16;
+            unsigned vcpu:16, dom:16;
             unsigned credit;
             int delta;
         } d;
@@ -812,7 +812,7 @@  __runq_assign(struct csched2_vcpu *svc, struct csched2_runqueue_data *rqd)
     /* TRACE */
     {
         struct {
-            unsigned dom:16,vcpu:16;
+            unsigned vcpu:16, dom:16;
             unsigned rqi:16;
         } d;
         d.dom = svc->vcpu->domain->domain_id;