Re: [Xen-devel] [PATCH v9.1 02/16] Rename PSR sysctl/domctl interfaces and xsm policy to make them be general

2017-10-30 Thread Daniel De Graaf

On 10/24/2017 05:10 AM, Yi Sun wrote:

This patch renames PSR sysctl/domctl interfaces and related xsm policy to
make them be general for all resource allocation features but not only
for CAT. Then, we can resuse the interfaces for all allocation features.

Basically, it changes 'psr_cat_op' to 'psr_alloc', and remove 'CAT_' from some
macros. E.g.:
1. psr_cat_op -> psr_alloc
2. XEN_DOMCTL_psr_cat_op -> XEN_DOMCTL_psr_alloc
3. XEN_SYSCTL_psr_cat_op -> XEN_SYSCTL_psr_alloc
4. XEN_DOMCTL_PSR_CAT_SET_L3_CBM -> XEN_DOMCTL_PSR_SET_L3_CBM
5. XEN_SYSCTL_PSR_CAT_get_l3_info -> XEN_SYSCTL_PSR_get_l3_info


Acked-by: Daniel De Graaf 

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


Re: [Xen-devel] [PATCH v9.1 02/16] Rename PSR sysctl/domctl interfaces and xsm policy to make them be general

2017-10-30 Thread Yi Sun
On 17-10-24 06:27:26, Jan Beulich wrote:
> >>> On 24.10.17 at 11:10,  wrote:
> > This patch renames PSR sysctl/domctl interfaces and related xsm policy to
> > make them be general for all resource allocation features but not only
> > for CAT. Then, we can resuse the interfaces for all allocation features.
> > 
> > Basically, it changes 'psr_cat_op' to 'psr_alloc', and remove 'CAT_' from 
> > some
> > macros. E.g.:
> > 1. psr_cat_op -> psr_alloc
> > 2. XEN_DOMCTL_psr_cat_op -> XEN_DOMCTL_psr_alloc
> > 3. XEN_SYSCTL_psr_cat_op -> XEN_SYSCTL_psr_alloc
> > 4. XEN_DOMCTL_PSR_CAT_SET_L3_CBM -> XEN_DOMCTL_PSR_SET_L3_CBM
> > 5. XEN_SYSCTL_PSR_CAT_get_l3_info -> XEN_SYSCTL_PSR_get_l3_info
> > 
> > Signed-off-by: Yi Sun 
> > Reviewed-by: Wei Liu 
> > Reviewed-by: Roger Pau Monné 
> > Acked-by: Jan Beulich 
> > Acked-by: Daniel De Graaf 
> > ---
> > CC: Jan Beulich 
> > CC: Andrew Cooper 
> > CC: Wei Liu 
> > CC: Ian Jackson 
> > CC: Daniel De Graaf 
> > CC: Roger Pau Monné 
> > CC: Chao Peng 
> > 
> > v9:
> > - rename 'psr_cat_op' to 'psr_alloc' in xen.if.
> 
> Even if this was just a simple oversight and an easy rename, I think
> strictly speaking it invalidates Daniel's ack.
> 
> Jan

Sorry for that.

Hi, Daniel,

Could you please review the change again? Thank you!

BRs,
Sun Yi

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


Re: [Xen-devel] [PATCH v9.1 02/16] Rename PSR sysctl/domctl interfaces and xsm policy to make them be general

2017-10-24 Thread Jan Beulich
>>> On 24.10.17 at 11:10,  wrote:
> This patch renames PSR sysctl/domctl interfaces and related xsm policy to
> make them be general for all resource allocation features but not only
> for CAT. Then, we can resuse the interfaces for all allocation features.
> 
> Basically, it changes 'psr_cat_op' to 'psr_alloc', and remove 'CAT_' from some
> macros. E.g.:
> 1. psr_cat_op -> psr_alloc
> 2. XEN_DOMCTL_psr_cat_op -> XEN_DOMCTL_psr_alloc
> 3. XEN_SYSCTL_psr_cat_op -> XEN_SYSCTL_psr_alloc
> 4. XEN_DOMCTL_PSR_CAT_SET_L3_CBM -> XEN_DOMCTL_PSR_SET_L3_CBM
> 5. XEN_SYSCTL_PSR_CAT_get_l3_info -> XEN_SYSCTL_PSR_get_l3_info
> 
> Signed-off-by: Yi Sun 
> Reviewed-by: Wei Liu 
> Reviewed-by: Roger Pau Monné 
> Acked-by: Jan Beulich 
> Acked-by: Daniel De Graaf 
> ---
> CC: Jan Beulich 
> CC: Andrew Cooper 
> CC: Wei Liu 
> CC: Ian Jackson 
> CC: Daniel De Graaf 
> CC: Roger Pau Monné 
> CC: Chao Peng 
> 
> v9:
> - rename 'psr_cat_op' to 'psr_alloc' in xen.if.

Even if this was just a simple oversight and an easy rename, I think
strictly speaking it invalidates Daniel's ack.

Jan

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


[Xen-devel] [PATCH v9.1 02/16] Rename PSR sysctl/domctl interfaces and xsm policy to make them be general

2017-10-24 Thread Yi Sun
This patch renames PSR sysctl/domctl interfaces and related xsm policy to
make them be general for all resource allocation features but not only
for CAT. Then, we can resuse the interfaces for all allocation features.

Basically, it changes 'psr_cat_op' to 'psr_alloc', and remove 'CAT_' from some
macros. E.g.:
1. psr_cat_op -> psr_alloc
2. XEN_DOMCTL_psr_cat_op -> XEN_DOMCTL_psr_alloc
3. XEN_SYSCTL_psr_cat_op -> XEN_SYSCTL_psr_alloc
4. XEN_DOMCTL_PSR_CAT_SET_L3_CBM -> XEN_DOMCTL_PSR_SET_L3_CBM
5. XEN_SYSCTL_PSR_CAT_get_l3_info -> XEN_SYSCTL_PSR_get_l3_info

Signed-off-by: Yi Sun 
Reviewed-by: Wei Liu 
Reviewed-by: Roger Pau Monné 
Acked-by: Jan Beulich 
Acked-by: Daniel De Graaf 
---
CC: Jan Beulich 
CC: Andrew Cooper 
CC: Wei Liu 
CC: Ian Jackson 
CC: Daniel De Graaf 
CC: Roger Pau Monné 
CC: Chao Peng 

v9:
- rename 'psr_cat_op' to 'psr_alloc' in xen.if.
v7:
- add single trailing underscore for internal variabled in macro.
  (suggested by Jan Beulich)
- add parentheses for input parameters of marcro.
  (suggested by Jan Beulich)
- adjust the postion of macro.
  (suggested by Jan Beulich)
v6:
- move macro definition into the function and undefine it after use.
  (suggested by Roger Pau Monné)
- do not bump sysctl version because it has been bumped for 4.10.
  (suggested by Roger Pau Monné)
v5:
- remove domctl version number upgrade.
  (suggested by Jan Beulich)
- restore 'XEN_SYSCTL_PSR_CAT_L3_CDP'.
  (suggested by Jan Beulich)
- define a local macro to complete psr get value flow.
  (suggested by Roger Pau Monné)
- remove 'Reviewed-by' and 'Acked-by'.
  (suggested by Wei Liu)
v4:
- remove 'ALLOC_' from names.
  (suggested by Roger Pau Monné)
- fix comments.
  (suggested by Roger Pau Monné)
v3:
- remove 'op/OP' from names and modify some names from 'PSR_CAT' to
  'PSR_ALLOC'.
  (suggested by Roger Pau Monné)
v1:
- add description about what to be changed in commit message.
  (suggested by Wei Liu)
- bump sysctl/domctl version numbers.
  (suggested by Wei Liu)
---
 tools/flask/policy/modules/dom0.te  |  4 +--
 tools/flask/policy/modules/xen.if   |  2 +-
 tools/libxc/xc_psr.c| 50 +-
 xen/arch/x86/domctl.c   | 71 ++---
 xen/arch/x86/sysctl.c   | 28 +++
 xen/include/public/domctl.h | 24 ++---
 xen/include/public/sysctl.h | 12 +++
 xen/xsm/flask/hooks.c   |  8 ++---
 xen/xsm/flask/policy/access_vectors |  8 ++---
 9 files changed, 103 insertions(+), 104 deletions(-)

diff --git a/tools/flask/policy/modules/dom0.te 
b/tools/flask/policy/modules/dom0.te
index 1643b40..07de3d5 100644
--- a/tools/flask/policy/modules/dom0.te
+++ b/tools/flask/policy/modules/dom0.te
@@ -14,7 +14,7 @@ allow dom0_t xen_t:xen {
tmem_control getscheduler setscheduler
 };
 allow dom0_t xen_t:xen2 {
-   resource_op psr_cmt_op psr_cat_op pmu_ctrl get_symbol
+   resource_op psr_cmt_op psr_alloc pmu_ctrl get_symbol
get_cpu_levelling_caps get_cpu_featureset livepatch_op
gcov_op set_parameter
 };
@@ -39,7 +39,7 @@ allow dom0_t dom0_t:domain {
 };
 allow dom0_t dom0_t:domain2 {
set_cpuid gettsc settsc setscheduler set_max_evtchn set_vnumainfo
-   get_vnumainfo psr_cmt_op psr_cat_op set_gnttab_limits
+   get_vnumainfo psr_cmt_op psr_alloc set_gnttab_limits
 };
 allow dom0_t dom0_t:resource { add remove };
 
diff --git a/tools/flask/policy/modules/xen.if 
b/tools/flask/policy/modules/xen.if
index 5543749..cb48a6c 100644
--- a/tools/flask/policy/modules/xen.if
+++ b/tools/flask/policy/modules/xen.if
@@ -52,7 +52,7 @@ define(`create_domain_common', `
settime setdomainhandle getvcpucontext set_misc_info };
allow $1 $2:domain2 { set_cpuid settsc setscheduler setclaim
set_max_evtchn set_vnumainfo get_vnumainfo cacheflush
-   psr_cmt_op psr_cat_op soft_reset set_gnttab_limits };
+   psr_cmt_op psr_alloc soft_reset set_gnttab_limits };
allow $1 $2:security check_context;
allow $1 $2:shadow enable;
allow $1 $2:mmu { map_read map_write adjust memorymap physmap pinpage 
mmuext_op updatemp };
diff --git a/tools/libxc/xc_psr.c b/tools/libxc/xc_psr.c
index edec4d1..78deba0 100644
--- a/tools/libxc/xc_psr.c
+++ b/tools/libxc/xc_psr.c
@@ -258,27 +258,27 @@ int xc_psr_cat_set_domain_data(xc_interface *xch, 
uint32_t domid,
 switch ( type )
 {
 case XC_PSR_CAT_L3_CBM:
-cmd = XEN_DOMCTL_PSR_CAT_OP_SET_L3_CBM;
+cmd =