|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [Xen-devel] [PATCH v1 09/13] tools: implement the new get hw info interface suitable to all psr allocation features
On 17-08-21 18:13:07, Chao Peng wrote:
>
> > int libxl_psr_cat_get_info(libxl_ctx *ctx, libxl_psr_cat_info **info,
> > int *nr, unsigned int lvl)
> > {
> > GC_INIT(ctx);
> > int rc;
> > - int i = 0, socketid, nr_sockets;
> > - libxl_bitmap socketmap;
> > + unsigned int i;
> > + libxl_psr_hw_info *hw_info;
> > libxl_psr_cat_info *ptr;
> >
> > - libxl_bitmap_init(&socketmap);
> > -
> > - rc = libxl__count_physical_sockets(gc, &nr_sockets);
> > - if (rc) {
> > - LOGE(ERROR, "failed to get system socket count");
> > + rc = libxl_psr_get_hw_info(ctx, &hw_info, (unsigned int *)nr,
> > + LIBXL_PSR_FEAT_TYPE_CAT_INFO, lvl);
> > + if (rc)
> > goto out;
> > - }
> >
> > - libxl_socket_bitmap_alloc(ctx, &socketmap, nr_sockets);
> > - rc = libxl_get_online_socketmap(ctx, &socketmap);
> > - if (rc < 0) {
> > - LOGE(ERROR, "failed to get available sockets");
> > - goto out;
> > - }
> > + ptr = libxl__malloc(NOGC, *nr * sizeof(libxl_psr_cat_info));
> >
> > - ptr = libxl__malloc(NOGC, nr_sockets *
> > sizeof(libxl_psr_cat_info));
> > -
> > - libxl_for_each_set_bit(socketid, socketmap) {
> > - ptr[i].id = socketid;
> > - if (xc_psr_cat_get_info(ctx->xch, socketid, lvl,
> > &ptr[i].cos_max,
> > - &ptr[i].cbm_len,
> > &ptr[i].cdp_enabled)) {
> > + for (i = 0; i < *nr; i++) {
> > + if (libxl__psr_hw_info_to_libxl_psr_cat_info(
> > + LIBXL_PSR_FEAT_TYPE_CAT_INFO,
> > + &hw_info[i], &ptr[i])) {
> > rc = ERROR_FAIL;
> > free(ptr);
> > goto out;
> > }
> > - i++;
> > }
> >
> > *info = ptr;
> > - *nr = i;
> > out:
> > - libxl_bitmap_dispose(&socketmap);
>
> You probably need to call libxl_psr_hw_info_list_free some where.
>
Yes, you are right. Thanks!
> Chao
> > GC_FREE;
> > return rc;
> > }
> > @@ -439,15 +441,120 @@ int libxl_psr_get_val(libxl_ctx *ctx, uint32_t
> > domid,
> > return ERROR_FAIL;
> > }
> >
_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
https://lists.xen.org/xen-devel
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |