[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Xen-devel] How to make tracking CPU cache-miss on Xen?



On 12/11/2017 09:36 AM, Meng Xu wrote:
> On Mon, Dec 11, 2017 at 8:14 AM, Minjun Hong <nickeysgo@xxxxxxxxx> wrote:
>> Thanks for your answer, George.
>>
>> What I want ultimately is cache misses from the guest, but even I could not 
>> get the cache misses from dom0 also.
>> That's why I'm confused as I know, it should be possible to get cache-misses 
>> from dom0 (is it right??).
>> I already enabled CONFIG_XEN_HAVE_VPMU of current kernel to get cache 
>> misses. Is there anything what I miss during Xen install?
>>
> If this is for a research project, I would suggest you to write your
> own code to monitor the cache misses for domU. This could be faster,
> since it's not complicated to do so.
>
> IIRC, PMU in Xen can only monitor the cache misses when VCPUs are
> pinned to cores.

Counters are virtualized for guests (including dom0) so I am not sure
pinning is required. Pinning is only needed when you try to collect
counters for full system.

OTOH, when a VCPU is migrated you start running with a new cache,
something to keep in mind.

>
>
> Best Regards,
>
> Meng
>
> -----------
> Meng Xu
> Ph.D. Candidate in Computer and Information Science
> University of Pennsylvania
> http://www.cis.upenn.edu/~mengxu/
>>
>> On Mon, Dec 11, 2017 at 7:54 PM, George Dunlap <dunlapg@xxxxxxxxx> wrote:
>>> On Mon, Dec 11, 2017 at 5:59 AM, Minjun Hong <nickeysgo@xxxxxxxxx> wrote:
>>>> Hello, I'm working on the 'credit scheduler' of Xen.
>>>> And I need to compare CPU cache misses between original Xen and my patching
>>>> version.
>>>> But I failed all attempt even if I have tried many methods by googling.
>>>> When I typed 'perf list' with my 'perf' compiled by source code in the
>>>> current kernel source code, it said:
>>>>
>>>>> nickeys@nickeys-linux-machine:~/ubuntu/tools/perf$ ./perf list
>>>>> List of pre-defined events (to be used in -e):
>>>>>   msr/pperf/                                         [Kernel PMU event]
>>>>>   msr/smi/                                           [Kernel PMU event]
>>>>>   msr/tsc/                                           [Kernel PMU event]
>>>>>   power/energy-cores/                                [Kernel PMU event]
>>>>>   power/energy-gpu/                                  [Kernel PMU event]
>>>>>   power/energy-pkg/                                  [Kernel PMU event]
>>>>>   power/energy-psys/                                 [Kernel PMU event]
>>>>>   power/energy-ram/                                  [Kernel PMU event]
>>>>>   rNNN                                               [Raw hardware event
>>>>> descriptor]
>>>>>   cpu/t1=v1[,t2=v2,t3 ...]/modifier                  [Raw hardware event
>>>>> descriptor]
>>>>>    (see 'man perf-list' on how to encode it)
>>>>>   mem:<addr>[/len][:access]                          [Hardware breakpoint]
>>>>> nickeys@nickeys-linux-machine:~/ubuntu/tools/perf$
>>>>
>>>>
>>>> Since there is no HW event in contrast with native environment, I should 
>>>> try
>>>> 'Raw hardware event descriptor' option.
>>>> According to 'Intel® 64 and IA-32 Architectures Software Developer’s Manual
>>>> Volume 3B: System Programming Guide', I used 'r412e' raw hardware event to
>>>> get LLC Misses which is in '18.2.1.2 Pre-defined Architectural Performance
>>>> Events' section of the guide,
>>>> but I found out my 'perf' does not support the feature:
>>>>
>>>>> nickeys@nickeys-linux-machine:~/ubuntu/tools/perf$ sudo ./perf stat -e
>>>>> r412e sleep 1
>>>>>  Performance counter stats for 'sleep 1':
>>>>>    <not supported>      r412e
>>>>>        1.002120111 seconds time elapsed
>>>>> nickeys@nickeys-linux-machine:~/ubuntu/tools/perf$
>>>>
>>>>  I could not understand why I cannot find out the number of cache-misses.
>>>> When I did googling, I did not think there would be a problem because there
>>>> were a lot of posts to get cache-misses in the Xen environment.

Are you sure VPMU is enabled? It is off by default, you need 'vpmu' boot
option for Xen.

What does
    dmesg | grep Performance
in the guest that you are trying to profile say?


-boris

>>> It sounds like what you might want is the vPMU functionality.  CC'ing
>>> Boris Ostrovsky, who has worked on vPMU functionality before.
>>>
>>> However, are you sure that you want to be reading cache misses from
>>> the guest?  It seems like that is *probably* OK, but another option
>>> would be to instrument Xen to read and provide that information.
>>>
>>>  -George
>>
>>
>> _______________________________________________
>> Xen-devel mailing list
>> Xen-devel@xxxxxxxxxxxxxxxxxxxx
>> https://lists.xenproject.org/mailman/listinfo/xen-devel


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

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.