lkml.org 
[lkml]   [2021]   [Oct]   [9]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
SubjectRE: [RFC PATCH v2 07/69] KVM: TDX: define and export helper functions for KVM TDX support
Date
On Saturday, July 3, 2021 6:04 AM, Isaku Yamahata wrote:
> Subject: [RFC PATCH v2 07/69] KVM: TDX: define and export helper functions
> for KVM TDX support
> +/*
> + * Setup one-cpu-per-pkg array to do package-scoped SEAMCALLs. The
> +array is
> + * only necessary if there are multiple packages.
> + */
> +int __init init_package_masters(void)
> +{
> + int cpu, pkg, nr_filled, nr_pkgs;
> +
> + nr_pkgs = topology_max_packages();
> + if (nr_pkgs == 1)
> + return 0;
> +
> + tdx_package_masters = kcalloc(nr_pkgs, sizeof(int), GFP_KERNEL);


Where is the corresponding kfree() invoked? (except the one invoked on error conditions below)


> + if (!tdx_package_masters)
> + return -ENOMEM;
> +
> + memset(tdx_package_masters, -1, nr_pkgs * sizeof(int));
> +
> + nr_filled = 0;
> + for_each_online_cpu(cpu) {
> + pkg = topology_physical_package_id(cpu);
> + if (tdx_package_masters[pkg] >= 0)
> + continue;
> +
> + tdx_package_masters[pkg] = cpu;
> + if (++nr_filled == topology_max_packages())
> + break;
> + }
> +
> + if (WARN_ON(nr_filled != topology_max_packages())) {
> + kfree(tdx_package_masters);
> + return -EIO;
> + }

Best,
Wei

\
 
 \ /
  Last update: 2021-10-09 09:51    [W:1.234 / U:1.296 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site