All of lore.kernel.org
 help / color / mirror / Atom feed
From: Chao Peng <chao.p.peng@linux.intel.com>
To: Meng Xu <xumengpanda@gmail.com>
Cc: Andrew Cooper <andrew.cooper3@citrix.com>,
	"xen-devel@lists.xen.org" <xen-devel@lists.xen.org>,
	"Autee, Priya V" <priya.v.autee@intel.com>
Subject: Re: Question about the CAT and CMT in Xen
Date: Wed, 2 Sep 2015 10:31:56 +0800	[thread overview]
Message-ID: <20150902023156.GD19417@pengc-linux.bj.intel.com> (raw)
In-Reply-To: <CAENZ-+ntXMFoz3nzfg+Qw3BnKpgKqTb3q3==xJP4=upP8_Cn_g@mail.gmail.com>

On Tue, Sep 01, 2015 at 09:51:57PM -0400, Meng Xu wrote:
> Hi Andrew and Chao,
> 
> [Important things go first] It turns out my machine (Intel E5-2618L
> v3) does have CAT capability!
> Xen gives the false alarm that my machine does not have it. This
> should be a bug, IMO. :-)

Even some Haswell Servers do support CAT, but it's usually
model-specific and the feature is not enumerated in a standard way as
listed in Intel SDM. Xen now however only takes care of the standard
enumeration so your case is not detected.

This could be done by adding cpu model check in Xen code or even use
updated firmware, which is I prefered.

> 
> 2015-09-01 10:42 GMT-04:00 Meng Xu <xumengpanda@gmail.com>:
> > 2015-09-01 10:30 GMT-04:00 Andrew Cooper <andrew.cooper3@citrix.com>:
> >> On 01/09/15 15:20, Meng Xu wrote:
> >>> 2015-09-01 9:04 GMT-04:00 Andrew Cooper <andrew.cooper3@citrix.com>:
> >>>> On 01/09/15 13:55, Meng Xu wrote:
> >>>>> 2015-09-01 1:47 GMT-04:00 Chao Peng <chao.p.peng@linux.intel.com>:
> >>>>>> On Mon, Aug 31, 2015 at 04:09:31PM -0400, Meng Xu wrote:
> >>>>>>> I looked into the xen/arch/x86/psr.c and found that the function
> >>>>>>> cat_cpu_init() just returned without initializing the variable
> >>>>>>> "cat_socket_enable".
> >>>>>>>
> >>>>>>> Both  !cpu_has(c, X86_FEATURE_CAT) and c->cpuid_level <
> >>>>>>> PSR_CPUID_LEVEL_CAT are evaluated as 1 inside the function
> >>>>>>> cat_cpu_init().
> 
> I'm thinking this check could be wrong for Intel E5-2618L v3. It
> should work on Chao's machine but not on mine. There should be a
> better way to check this probably. :-)
> 
> ---
> 
> I used another way to check the CAT capability, as suggested by Priya
> (cc.ed) from Intel.
> I did the following steps as Priya suggested:
> 1. Download msr-tools utility on your linux distribution to perform
> msr read write operations./ if you already have it installed modprobe
> msr
> 2. rdmsr 0xc91
> which returns 0xfffff
> 3. wrmsr -p 1 0xc91 0xf
> which does not return anything
> 4. wrmsr -p 1 0xc8f 0x100000000
> which does not return anything
> 5. rdmsr 0xc91
> which returns 0xf
> 
> This shows that the CPU does have the MSRs that are used for CAT.
> 
> I also run the CAT tools on Linux provided by Intel, which can be
> downloaded at https://01.org/packet-processing/cache-monitoring-technology-memory-bandwidth-monitoring-cache-allocation-technology.
> It shows me that I can set up different cache partitions for different COS.
> Basically, the pre-configured cache setting provided by the CAT tools
> work perfectly on my machine. :-)
> 
> ------
> OK. That just check the registers are there and tools do not return
> error. It may still not work, right? :-)
> Well, I also did some performance evaluation by running a small simple
> benchmark I wrote.
> 
> The benchmark task sequentially access a 6MB array;
> 
> I run the benchmark on core 0 in the following scenarios:
> 
> Scenario 1): Core 0 is allocated for 8MB cache with CAT, the latency
> of accessing the 6MB array is around 5.5M cycles;
> Scenario 2): Core 0 is allocated for 4MB cache with CAT, the latency
> of accessing the 6MB array is around 16.9M cycles.
> The slowdown in scenario 2) is 16.9M / 5.5M ~=3x.
> 
> ------ISSUES-------
> I tried to run some noisy neighbors on another core to see how good
> the LLC isolation CAT can provide, but found some *weird result*.
> I run the benchmark task on core 0 and the noisy neighbor that access
> 20MB array on core 1;
> These two cores are configured to have *different* cache areas: core 0
> has  8MB cache, core 1 has 4MB cache;
> These two cores are in two isolated cpuset. No other tasks runs on
> these two cores.
> If I run the benchmark alone, the latency is around 5.5M cycles;
> but if run the benchmark along with the noisy neighbor, the latency
> *decreases* to 4.9M cycles.
> 
> I double checked that the Turbo Boost is disabled by checking the MSR
> value with the following command:
>     rdmsr -pi 0x1a0 -f 38:38
>     1=disabled
>     0=enabled
>     it returns 1.
> I also disabled the cache prefetch in BIOS.
> 
> Now I'm very confused. How come the latency decreases when a noisy
> neighbor is running. It seems that the noisy neighbor may help some
> hardware/software prefetcher to prefetch the data for the benchmark.
> But right now, I couldn't think out any other prefetchers that may
> cause this...
> The benchmark and the noisy neighbor are independent and don't share
> the array data.

Did you reboot the machine between your two tests and are the two cores
you used in the same socket?

Thanks,
Chao

  reply	other threads:[~2015-09-02  2:31 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-08-31 17:42 Question about the CAT and CMT in Xen Meng Xu
2015-08-31 18:25 ` Andrew Cooper
2015-08-31 20:09   ` Meng Xu
2015-08-31 20:22     ` Andrew Cooper
2015-09-01  5:47     ` Chao Peng
2015-09-01 12:55       ` Meng Xu
2015-09-01 13:04         ` Andrew Cooper
2015-09-01 14:20           ` Meng Xu
2015-09-01 14:30             ` Andrew Cooper
2015-09-01 14:42               ` Meng Xu
2015-09-02  1:47                 ` Chao Peng
2015-09-02  1:53                   ` Meng Xu
2015-09-02  1:51                 ` Meng Xu
2015-09-02  2:31                   ` Chao Peng [this message]
2015-09-02  2:55                     ` Meng Xu
2015-09-02  8:34                       ` Jan Beulich

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20150902023156.GD19417@pengc-linux.bj.intel.com \
    --to=chao.p.peng@linux.intel.com \
    --cc=andrew.cooper3@citrix.com \
    --cc=priya.v.autee@intel.com \
    --cc=xen-devel@lists.xen.org \
    --cc=xumengpanda@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.