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

Re: [Xen-devel] [PATCH v2 14/15] tools: implement new generic set value interface and MBA set value command



On Thu, Aug 24, 2017 at 09:14:48AM +0800, Yi Sun wrote:
>  int libxl_psr_cat_get_cbm(libxl_ctx *ctx, uint32_t domid,
> @@ -457,7 +431,33 @@ int libxl_psr_set_val(libxl_ctx *ctx, uint32_t domid,
>                        libxl_psr_cbm_type type, libxl_bitmap *target_map,
>                        uint64_t val)
>  {
> -    return ERROR_FAIL;
> +    GC_INIT(ctx);
> +    int rc;
> +    int socketid, nr_sockets;
> +
> +    rc = libxl__count_physical_sockets(gc, &nr_sockets);
> +    if (rc) {
> +        LOGED(ERROR, domid, "failed to get system socket count");
> +        goto out;
> +    }
> +
> +    libxl_for_each_set_bit(socketid, *target_map) {
> +        xc_psr_val_type xc_type;
> +
> +        if (socketid >= nr_sockets)
> +            break;
> +
> +        xc_type = libxl__psr_cbm_type_to_libxc_psr_val_type(type);
> +        if (xc_psr_set_domain_data(ctx->xch, domid, xc_type,
> +                                   socketid, val)) {
> +            libxl__psr_alloc_log_err_msg(gc, errno, type);
> +            rc = ERROR_FAIL;
> +        }
> +    }
> +
> +out:
> +    GC_FREE;
> +    return rc;

Is there no libxl_psr_get_val?

>  }
>  
>  int libxl_psr_get_val(libxl_ctx *ctx, uint32_t domid,
> diff --git a/tools/xl/xl.h b/tools/xl/xl.h
> index 59065c4..2cbe89c 100644
> --- a/tools/xl/xl.h
> +++ b/tools/xl/xl.h
> @@ -206,6 +206,7 @@ int main_psr_cmt_show(int argc, char **argv);
>  #ifdef LIBXL_HAVE_PSR_CAT
>  int main_psr_cat_cbm_set(int argc, char **argv);
>  int main_psr_cat_show(int argc, char **argv);
> +int main_psr_mba_set(int argc, char **argv);
>  int main_psr_mba_show(int argc, char **argv);
>  #endif
>  int main_qemu_monitor_command(int argc, char **argv);
> diff --git a/tools/xl/xl_cmdtable.c b/tools/xl/xl_cmdtable.c
> index 19e5004..5f7122d 100644
> --- a/tools/xl/xl_cmdtable.c
> +++ b/tools/xl/xl_cmdtable.c
> @@ -562,6 +562,12 @@ struct cmd_spec cmd_table[] = {
>        "[options] <Domain>",
>        "-l <level>        Specify the cache level to process, otherwise L3 
> cache is processed\n"
>      },
> +    { "psr-mba-set",
> +      &main_psr_mba_set, 0, 1,
> +      "Set throttling value (THRTL) for a domain",
> +      "[options] <Domain> <THRTL>",
> +      "-s <socket>       Specify the socket to process, otherwise all 
> sockets are processed\n"
> +    },
>      { "psr-mba-show",
>        &main_psr_mba_show, 0, 1,
>        "Show Memory Bandwidth Allocation information",
> diff --git a/tools/xl/xl_psr.c b/tools/xl/xl_psr.c
> index a97dafa..fc5bfcd 100644
> --- a/tools/xl/xl_psr.c
> +++ b/tools/xl/xl_psr.c
> @@ -554,6 +554,61 @@ int main_psr_mba_show(int argc, char **argv)
>      return psr_val_show(domid, LIBXL_PSR_FEAT_TYPE_MBA, 0);
>  }
>  
> +int main_psr_mba_set(int argc, char **argv)
> +{
> +    uint32_t domid;
> +    libxl_psr_cbm_type type;
> +    uint64_t thrtl;
> +    int ret, opt = 0;
> +    libxl_bitmap target_map;
> +    char *value;
> +    libxl_string_list socket_list;
> +    unsigned long start, end;
> +    unsigned int i, j, len;
> +
> +    static struct option opts[] = {

const

Roger.

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

 


Rackspace

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