Skip to contentSkip to conversation

perfc: count number of explicit vcpu yields

PATCH In review Ian Campbell 6 participants 9 messages Nov 9, 2015

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 perfc: count number of explicit vcpu yields

---
 xen/common/schedule.c        | 1 +
 xen/include/xen/perfc_defn.h | 1 +
 2 files changed, 2 insertions(+)
xen/common/schedule.c +1 -0
index 292e9a0..86d6cc0 100644
@@ -896,6 +896,7 @@ long vcpu_yield(void)
     struct vcpu * v=current;
     spinlock_t *lock = vcpu_schedule_lock_irq(v);
 
+    SCHED_STAT_CRANK(sched_yield);
     SCHED_OP(VCPU2OP(v), yield, v);
     vcpu_schedule_unlock_irq(lock, v);
 
xen/include/xen/perfc_defn.h +1 -0
index 76ee803..034c7d3 100644
@@ -16,6 +16,7 @@ PERFCOUNTER(ipis,                   "#IPIs")
 PERFCOUNTER(sched_irq,              "sched: timer")
 PERFCOUNTER(sched_run,              "sched: runs through scheduler")
 PERFCOUNTER(sched_ctx,              "sched: context switches")
+PERFCOUNTER(sched_yield,            "sched: vcpu yield")
 PERFCOUNTER(schedule,               "sched: specific scheduler")
 PERFCOUNTER(dom_init,               "sched: dom_init")
 PERFCOUNTER(dom_destroy,            "sched: dom_destroy")
Signature · 1 line
2.1.4
Reviewed-by on v1 1/1
#2 lore raw
In reply to Ian Campbell
Quoted 1 line · Ian Campbell
Quoted 30 lines
---
 xen/common/schedule.c        | 1 +
 xen/include/xen/perfc_defn.h | 1 +
 2 files changed, 2 insertions(+)
xen/common/schedule.c +1 -0
index 292e9a0..86d6cc0 100644
@@ -896,6 +896,7 @@ long vcpu_yield(void)
     struct vcpu * v=current;
     spinlock_t *lock = vcpu_schedule_lock_irq(v);
 
+    SCHED_STAT_CRANK(sched_yield);
     SCHED_OP(VCPU2OP(v), yield, v);
     vcpu_schedule_unlock_irq(lock, v);
 
xen/include/xen/perfc_defn.h +1 -0
index 76ee803..034c7d3 100644
@@ -16,6 +16,7 @@ PERFCOUNTER(ipis,                   "#IPIs")
 PERFCOUNTER(sched_irq,              "sched: timer")
 PERFCOUNTER(sched_run,              "sched: runs through scheduler")
 PERFCOUNTER(sched_ctx,              "sched: context switches")
+PERFCOUNTER(sched_yield,            "sched: vcpu yield")
 PERFCOUNTER(schedule,               "sched: specific scheduler")
 PERFCOUNTER(dom_init,               "sched: dom_init")
 PERFCOUNTER(dom_destroy,            "sched: dom_destroy")
Reviewed-by on v1 1/1
#3 lore raw
In reply to Ian Campbell
Quoted 2 lines · Ian Campbell

And, while we're here, I've been thinking since a while to try implementing an xl interface for these counters... How bad of an idea is that?

Is something like that possible already via Boris' PMU work?

Regards,
Dario

Signature · 4 lines
<<This happens because I choose it to happen!>> (Raistlin Majere)
-----------------------------------------------------------------
Dario Faggioli, Ph.D, http://about.me/dario.faggioli
Senior Software Engineer, Citrix Systems R&D Ltd., Cambridge (UK)

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel

#4 lore raw
Quoted 10 lines · Dario Faggioli
Quoted 2 lines · Ian Campbell

And, while we're here, I've been thinking since a while to try implementing an xl interface for these counters... How bad of an idea is that?

Is something like that possible already via Boris' PMU work?

VPMU only covers CPU's hardware counters and this patch deals with software events in the hypervisor.

As far as xl accessibility --- doesn't xenperf already read them out?

-boris

#5 lore raw
Quoted 11 lines · Boris Ostrovsky
Quoted 10 lines · Dario Faggioli
Quoted 2 lines · Ian Campbell

And, while we're here, I've been thinking since a while to try implementing an xl interface for these counters... How bad of an idea
is that?

Quoted 5 lines
Quoted 1 line

Is something like that possible already via Boris' PMU work?

VPMU only covers CPU's hardware counters and this patch deals with software events in the hypervisor.

Right, I just wanted to be sure (I've planned to familiarize with that work, but haven't got to doing it yet).

Quoted 2 lines

As far as xl accessibility --- doesn't xenperf already read them out?

Mmm... ISTR having tried without much luck, and having heard that it wasn't functional any longer, but maybe I'm confusing it with something else. I'll try again.

Thanks and Regards,
Dario

Signature · 4 lines
<<This happens because I choose it to happen!>> (Raistlin Majere)
-----------------------------------------------------------------
Dario Faggioli, Ph.D, http://about.me/dario.faggioli
Senior Software Engineer, Citrix Systems R&D Ltd., Cambridge (UK)

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel

#6 lore raw
Quoted 6 lines · Dario Faggioli

Quoted 2 lines

As far as xl accessibility --- doesn't xenperf already read them out?

Mmm... ISTR having tried without much luck, and having heard that it wasn't functional any longer, but maybe I'm confusing it with something else. I'll try again.

I happened to have an xterm with this in its scroll buffer from earlier:

root@marilith-n0:~# xenperf 
invalid hypercalls                  T=         0           0          0          0          0
trap: wfi                           T=     85068       56068      11762       8461       8777
trap: wfe                           T=      2811         614        716        964        517
trap: cp15 32-bit access            T=         4           1          1          1          1
trap: cp15 64-bit access            T=         0           0          0          0          0
trap: cp14 32-bit access            T=         0           0          0          0          0
trap: cp14 64-bit access            T=         0           0          0          0          0
trap: cp14 dbg access               T=         0           0          0          0          0
trap: cp access                     T=         0           0          0          0          0
trap: 32-bit smc                    T=         0           0          0          0          0
trap: 32-bit hvc                    T=      1291         510        568        161         52
trap: guest instr abort             T=         0           0          0          0          0
trap: guest data abort              T=     16446        6885       4358       3431       1772
trap: condition failed              T=         0           0          0          0          0
[...]

So I think it works.

You need to build the hypervisor binary with perfc=y (and optionally perfc_arrays=y) or it doesn't do anything.

Ian.
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel

#7 lore raw
Quoted 45 lines · Ian Campbell
Quoted 9 lines · Dario Faggioli
Quoted 4 lines

As far as xl accessibility --- doesn't xenperf already read them out?

Mmm... ISTR having tried without much luck, and having heard that it
wasn't functional any longer, but maybe I'm confusing it with something
else. I'll try again.

I happened to have an xterm with this in its scroll buffer from earlier:

root@marilith-n0:~# xenperf 
invalid hypercalls                  T=         0           0         
 0          0          0
trap: wfi                           T=     85068       56068     
 11762       8461       8777
trap: wfe                           T=      2811         614       
 716        964        517
trap: cp15 32-bit access            T=         4           1         
 1          1          1
trap: cp15 64-bit access            T=         0           0         
 0          0          0
trap: cp14 32-bit access            T=         0           0         
 0          0          0
trap: cp14 64-bit access            T=         0           0         
 0          0          0
trap: cp14 dbg access               T=         0           0         
 0          0          0
trap: cp access                     T=         0           0         
 0          0          0
trap: 32-bit smc                    T=         0           0         
 0          0          0
trap: 32-bit hvc                    T=      1291         510       
 568        161         52
trap: guest instr abort             T=         0           0         
 0          0          0
trap: guest data abort              T=     16446        6885      
 4358       3431       1772
trap: condition failed              T=         0           0         
 0          0          0
[...]
Quoted 2 lines

So I think it works.

Ok, thanks for the confirmation, and sorry for the noise then.

Quoted 3 lines

You need to build the hypervisor binary with perfc=y (and optionally perfc_arrays=y) or it doesn't do anything.

Yeah, that I knew.

Thanks again and Regards,
Dario

Signature · 4 lines
<<This happens because I choose it to happen!>> (Raistlin Majere)
-----------------------------------------------------------------
Dario Faggioli, Ph.D, http://about.me/dario.faggioli
Senior Software Engineer, Citrix Systems R&D Ltd., Cambridge (UK)

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel

#8 lore raw
Quoted 46 lines · Dario Faggioli
Quoted 45 lines · Ian Campbell
Quoted 9 lines · Dario Faggioli
Quoted 4 lines

As far as xl accessibility --- doesn't xenperf already read them out?

Mmm... ISTR having tried without much luck, and having heard that it
wasn't functional any longer, but maybe I'm confusing it with something
else. I'll try again.

I happened to have an xterm with this in its scroll buffer from earlier:

root@marilith-n0:~# xenperf 
invalid hypercalls                  T=         0           0         
 0          0          0
trap: wfi                           T=     85068       56068     
 11762       8461       8777
trap: wfe                           T=      2811         614       
 716        964        517
trap: cp15 32-bit access            T=         4           1         
 1          1          1
trap: cp15 64-bit access            T=         0           0         
 0          0          0
trap: cp14 32-bit access            T=         0           0         
 0          0          0
trap: cp14 64-bit access            T=         0           0         
 0          0          0
trap: cp14 dbg access               T=         0           0         
 0          0          0
trap: cp access                     T=         0           0         
 0          0          0
trap: 32-bit smc                    T=         0           0         
 0          0          0
trap: 32-bit hvc                    T=      1291         510       
 568        161         52
trap: guest instr abort             T=         0           0         
 0          0          0
trap: guest data abort              T=     16446        6885      
 4358       3431       1772
trap: condition failed              T=         0           0         
 0          0          0
[...]
Quoted 8 lines
Quoted 2 lines

So I think it works.

Ok, thanks for the confirmation, and sorry for the noise then.

Quoted 3 lines

You need to build the hypervisor binary with perfc=y (and optionally perfc_arrays=y) or it doesn't do anything.

Yeah, that I knew.

And you need to apply an patch this patch for x86:

http://lists.xen.org/archives/html/xen-devel/2015-11/msg00633.html
since the lock_profile also adds tons of data in the 'struct spinlock' making the 'struct domain' bigger than 4K (to 68K!).

Quoted 16 lines

Thanks again and Regards,
Dario

Signature · 12 lines
<<This happens because I choose it to happen!>> (Raistlin Majere)
-----------------------------------------------------------------
Dario Faggioli, Ph.D, http://about.me/dario.faggioli
Senior Software Engineer, Citrix Systems R&D Ltd., Cambridge (UK)




_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel