Re: [Xen-devel] [PATCH v10 00/13] enable Cache Allocation Technology (CAT) for VMs

2015-07-08 Thread Chao Peng
On Wed, Jul 08, 2015 at 11:02:10AM +0100, Wei Liu wrote:
> 
> Chao, 4.6 freeze is on Friday. Can you fix that minor bug and
> repost your series within two days?
> 
Sure, I will post another version later today.
Thanks,

Chao

___
Xen-devel mailing list
Xen-devel@lists.xen.org
http://lists.xen.org/xen-devel


Re: [Xen-devel] [PATCH v10 00/13] enable Cache Allocation Technology (CAT) for VMs

2015-07-08 Thread Wei Liu
On Wed, Jul 08, 2015 at 05:40:47PM +0800, Chao Peng wrote:
> On Tue, Jul 07, 2015 at 03:46:21PM +0100, Ian Campbell wrote:
> > On Fri, 2015-06-26 at 16:43 +0800, Chao Peng wrote:
> > > Chao Peng (13):
> > >   x86: add socket_cpumask
> > >   x86: detect and initialize Intel CAT feature
> > >   x86: maintain COS to CBM mapping for each socket
> > >   x86: add COS information for each domain
> > >   x86: expose CBM length and COS number information
> > >   x86: dynamically get/set CBM for a domain
> > >   x86: add scheduling support for Intel CAT
> > >   xsm: add CAT related xsm policies
> > 
> > Jan applied to here.
> > 
> > So I was going to apply these 5:
> > 
> > >   tools/libxl: minor name changes for CMT commands
> > >   tools/libxl: add command to show PSR hardware info
> > >   tools/libxl: introduce some socket helpers
> > >   tools: add tools support for Intel CAT
> > >   docs: add xl-psr.markdown
> > 
> > But, on i686 I see:
> > 
> > xl_cmdimpl.c: In function ‘psr_cat_hwinfo’:
> > xl_cmdimpl.c:8390:16: error: format ‘%llx’ expects argument of type ‘long 
> > long unsigned int’, but argument 3 has type ‘long unsigned int’ 
> > [-Werror=format=]
> > (1ul << info->cbm_len) - 1);
> > ^
> > xl_cmdimpl.c: In function ‘psr_cat_print_socket’:
> > xl_cmdimpl.c:8450:5: error: format ‘%llx’ expects argument of type ‘long 
> > long unsigned int’, but argument 3 has type ‘long unsigned int’ 
> > [-Werror=format=]
> >  printf("%-16s: %#"PRIx64"\n", "Default CBM", (1ul << info->cbm_len) - 
> > 1);
> >  ^
> > cc1: all warnings being treated as errors
> > 
> > It seems there is some mismatch between your types and the printf
> > formats used.
> > 
> > The appropriate format specifier for an unsigned long (which you have
> > from the "ul" in the constant) is %#lx and not "%#"PRIxXX which is
> > associated with uintXX_t types.
> > 
> > If you need a 64 bit type then you might have meant instead to use "ull"
> > in which case you want "%#llx" as the format specifier.
> 
> This is what I need. Thanks for suggestion.
> 

Chao, 4.6 freeze is on Friday. Can you fix that minor bug and
repost your series within two days?

Wei.

> Chao
> > 
> > If you really want/need an exactly 64 bit type then you'll have to do
> > some nasty casting, something like "((uint64_t)1) << info->cbm_len) - 1"
> > or something, that's pretty ugly though. If you have to go this route
> > then please test both builds, in case I've gotten my ()'s wrong.
> > 
> > Ian.
> > 
> > 
> > ___
> > Xen-devel mailing list
> > Xen-devel@lists.xen.org
> > http://lists.xen.org/xen-devel

___
Xen-devel mailing list
Xen-devel@lists.xen.org
http://lists.xen.org/xen-devel


Re: [Xen-devel] [PATCH v10 00/13] enable Cache Allocation Technology (CAT) for VMs

2015-07-08 Thread Chao Peng
On Tue, Jul 07, 2015 at 03:46:21PM +0100, Ian Campbell wrote:
> On Fri, 2015-06-26 at 16:43 +0800, Chao Peng wrote:
> > Chao Peng (13):
> >   x86: add socket_cpumask
> >   x86: detect and initialize Intel CAT feature
> >   x86: maintain COS to CBM mapping for each socket
> >   x86: add COS information for each domain
> >   x86: expose CBM length and COS number information
> >   x86: dynamically get/set CBM for a domain
> >   x86: add scheduling support for Intel CAT
> >   xsm: add CAT related xsm policies
> 
> Jan applied to here.
> 
> So I was going to apply these 5:
> 
> >   tools/libxl: minor name changes for CMT commands
> >   tools/libxl: add command to show PSR hardware info
> >   tools/libxl: introduce some socket helpers
> >   tools: add tools support for Intel CAT
> >   docs: add xl-psr.markdown
> 
> But, on i686 I see:
> 
> xl_cmdimpl.c: In function ‘psr_cat_hwinfo’:
> xl_cmdimpl.c:8390:16: error: format ‘%llx’ expects argument of type ‘long 
> long unsigned int’, but argument 3 has type ‘long unsigned int’ 
> [-Werror=format=]
> (1ul << info->cbm_len) - 1);
> ^
> xl_cmdimpl.c: In function ‘psr_cat_print_socket’:
> xl_cmdimpl.c:8450:5: error: format ‘%llx’ expects argument of type ‘long long 
> unsigned int’, but argument 3 has type ‘long unsigned int’ [-Werror=format=]
>  printf("%-16s: %#"PRIx64"\n", "Default CBM", (1ul << info->cbm_len) - 1);
>  ^
> cc1: all warnings being treated as errors
> 
> It seems there is some mismatch between your types and the printf
> formats used.
> 
> The appropriate format specifier for an unsigned long (which you have
> from the "ul" in the constant) is %#lx and not "%#"PRIxXX which is
> associated with uintXX_t types.
> 
> If you need a 64 bit type then you might have meant instead to use "ull"
> in which case you want "%#llx" as the format specifier.

This is what I need. Thanks for suggestion.

Chao
> 
> If you really want/need an exactly 64 bit type then you'll have to do
> some nasty casting, something like "((uint64_t)1) << info->cbm_len) - 1"
> or something, that's pretty ugly though. If you have to go this route
> then please test both builds, in case I've gotten my ()'s wrong.
> 
> Ian.
> 
> 
> ___
> Xen-devel mailing list
> Xen-devel@lists.xen.org
> http://lists.xen.org/xen-devel

___
Xen-devel mailing list
Xen-devel@lists.xen.org
http://lists.xen.org/xen-devel


Re: [Xen-devel] [PATCH v10 00/13] enable Cache Allocation Technology (CAT) for VMs

2015-07-07 Thread Ian Campbell
On Fri, 2015-06-26 at 16:43 +0800, Chao Peng wrote:
> Chao Peng (13):
>   x86: add socket_cpumask
>   x86: detect and initialize Intel CAT feature
>   x86: maintain COS to CBM mapping for each socket
>   x86: add COS information for each domain
>   x86: expose CBM length and COS number information
>   x86: dynamically get/set CBM for a domain
>   x86: add scheduling support for Intel CAT
>   xsm: add CAT related xsm policies

Jan applied to here.

So I was going to apply these 5:

>   tools/libxl: minor name changes for CMT commands
>   tools/libxl: add command to show PSR hardware info
>   tools/libxl: introduce some socket helpers
>   tools: add tools support for Intel CAT
>   docs: add xl-psr.markdown

But, on i686 I see:

xl_cmdimpl.c: In function ‘psr_cat_hwinfo’:
xl_cmdimpl.c:8390:16: error: format ‘%llx’ expects argument of type ‘long long 
unsigned int’, but argument 3 has type ‘long unsigned int’ [-Werror=format=]
(1ul << info->cbm_len) - 1);
^
xl_cmdimpl.c: In function ‘psr_cat_print_socket’:
xl_cmdimpl.c:8450:5: error: format ‘%llx’ expects argument of type ‘long long 
unsigned int’, but argument 3 has type ‘long unsigned int’ [-Werror=format=]
 printf("%-16s: %#"PRIx64"\n", "Default CBM", (1ul << info->cbm_len) - 1);
 ^
cc1: all warnings being treated as errors

It seems there is some mismatch between your types and the printf
formats used.

The appropriate format specifier for an unsigned long (which you have
from the "ul" in the constant) is %#lx and not "%#"PRIxXX which is
associated with uintXX_t types.

If you need a 64 bit type then you might have meant instead to use "ull"
in which case you want "%#llx" as the format specifier.

If you really want/need an exactly 64 bit type then you'll have to do
some nasty casting, something like "((uint64_t)1) << info->cbm_len) - 1"
or something, that's pretty ugly though. If you have to go this route
then please test both builds, in case I've gotten my ()'s wrong.

Ian.


___
Xen-devel mailing list
Xen-devel@lists.xen.org
http://lists.xen.org/xen-devel


[Xen-devel] [PATCH v10 00/13] enable Cache Allocation Technology (CAT) for VMs

2015-06-26 Thread Chao Peng
Changes in v10:
Address comments from Jan, mainly:
* Check socket < nr_sockets in cat_cpu_prepare().
* Use for_each_set_bit().
* Change psr_get_cat_l3_info to return either errno or psr_cat_socket_info.
Changes in v9:
Address comments from Jan, mainly:
* Move set_nr_sockets() invocation from __start_xen() to smp_prepare_cpus().
* Add check for cpuid_level.
* Add priority for cpu notifier.
* Allocate cos_to_cbm with opt_cos_max instead of the actual cos_max from cpuid.
* Move CAT initialization code back to CPU_STARTING.
* Initialize 'info' explictly so that compiler would not complain.
* Add an additional check for cbm to make sure at least one bit is set(which is 
required).
Changes in v8:
Address comments from Jan, mainly:
* Remove total_cpus and retrofit the algorithm for calculating nr_sockets.
* Change per-socket cpumask allocation as on demand.
* Remove cat_socket_init_bitmap and rename cat_socket_enable_bitmap.
* Ensure opt_cos_max is not too small.
* Use the right notification for memory allocation/freeing.
Changes in v7:
Address comments from Jan/Ian, mainly:
* Introduce total_cpus to calculate nr_sockets.
* Clear the init/enable flag when a socket going offline.
* Reorder the statements in init_psr_cat.
* Copyback psr_cat_op only for XEN_SYSCTL_PSR_CAT_get_l3_info.
* Broadcast LIBXL_HAVE_SOCKET_BITMAP_ALLOC.
* Add PSR head1 level section and change CMT/CAT as its subsections for xl man 
page.
Changes in v6:
Address comments from Andrew/Dario/Ian, mainly:
* Introduce cat_socket_init(_enable)_bitmap.
* Merge xl psr-cmt/cat-hwinfo => xl psr-hwinfo.
* Add function header to explain the 'target' parameter.
* Use bitmap instead of TARGETS_ALL.
* Document fix.
Changes in v5:
* Address comments from Andrew and Ian(Detail in patch).
* Add socket_to_cpumask.
* Add xl psr-cmt/cat-hwinfo.
* Add some libxl CMT enhancement.
Changes in v4:
* Address comments from Andrew and Ian(Detail in patch).
* Split COS/CBM management patch into 4 small patches.
* Add documentation xl-psr.markdown.
Changes in v3:
* Address comments from Jan and Ian(Detail in patch).
* Add xl sample output in cover letter.
Changes in v2:
* Address comments from Konrad and Jan(Detail in patch):
* Make all cat unrelated changes into the preparation patches. 

This patch serial enables the new Cache Allocation Technology (CAT) feature
found in Intel Broadwell and later server platform. In Xen's implementation,
CAT is used to control cache allocation on VM basis.

Detail hardware spec can be found in section 17.15 of the Intel SDM [1].
The design for XEN can be found at [2].

patch1: preparation.
patch2-8:   real work for CAT.
patch9-10:  enhancement for CMT.
patch11:libxl prepareation
patch12:tools side work for CAT.
patch13:xl document for CMT/MBM/CAT.

[1] Intel SDM 
(http://www.intel.com/content/dam/www/public/us/en/documents/manuals/64-ia-32-architectures-software-developer-manual-325462.pdf)
[2] CAT design for XEN( 
http://lists.xen.org/archives/html/xen-devel/2014-12/msg01382.html)


Chao Peng (13):
  x86: add socket_cpumask
  x86: detect and initialize Intel CAT feature
  x86: maintain COS to CBM mapping for each socket
  x86: add COS information for each domain
  x86: expose CBM length and COS number information
  x86: dynamically get/set CBM for a domain
  x86: add scheduling support for Intel CAT
  xsm: add CAT related xsm policies
  tools/libxl: minor name changes for CMT commands
  tools/libxl: add command to show PSR hardware info
  tools/libxl: introduce some socket helpers
  tools: add tools support for Intel CAT
  docs: add xl-psr.markdown

 docs/man/xl.pod.1|  76 -
 docs/misc/xen-command-line.markdown  |  15 +-
 docs/misc/xl-psr.markdown| 133 +
 tools/flask/policy/policy/modules/xen/xen.if |   2 +-
 tools/flask/policy/policy/modules/xen/xen.te |   4 +-
 tools/libxc/include/xenctrl.h|  15 +
 tools/libxc/xc_psr.c |  76 +
 tools/libxl/libxl.h  |  42 +++
 tools/libxl/libxl_internal.h |   2 +
 tools/libxl/libxl_psr.c  | 143 +-
 tools/libxl/libxl_types.idl  |  10 +
 tools/libxl/libxl_utils.c|  46 +++
 tools/libxl/libxl_utils.h|   2 +
 tools/libxl/xl.h |   5 +
 tools/libxl/xl_cmdimpl.c | 262 +-
 tools/libxl/xl_cmdtable.c|  27 +-
 xen/arch/x86/domain.c|   6 +-
 xen/arch/x86/domctl.c|  20 ++
 xen/arch/x86/mpparse.c   |  17 ++
 xen/arch/x86/psr.c   | 399 ++-
 xen/arch/x86/smpboot.c   |  26 +-
 xen/arch/x86/sysctl.c|  18 ++
 xen/include/asm-x86/cpufeature.h |   1 +
 xen/include/asm-x86/domain.h |   5 +-
 xen/include/asm-x86/