[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <bd974cdc810443748d8e4e3c7d1677a5@intel.com>
Date: Sat, 9 Oct 2021 07:50:57 +0000
From: "Wang, Wei W" <wei.w.wang@...el.com>
To: "Yamahata, Isaku" <isaku.yamahata@...el.com>,
Thomas Gleixner <tglx@...utronix.de>,
Ingo Molnar <mingo@...hat.com>, Borislav Petkov <bp@...en8.de>,
"H . Peter Anvin" <hpa@...or.com>,
Paolo Bonzini <pbonzini@...hat.com>,
Vitaly Kuznetsov <vkuznets@...hat.com>,
Wanpeng Li <wanpengli@...cent.com>,
Jim Mattson <jmattson@...gle.com>,
Joerg Roedel <joro@...tes.org>,
"erdemaktas@...gle.com" <erdemaktas@...gle.com>,
"Connor Kuehl" <ckuehl@...hat.com>,
Sean Christopherson <seanjc@...gle.com>,
"x86@...nel.org" <x86@...nel.org>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
"kvm@...r.kernel.org" <kvm@...r.kernel.org>
CC: "Yamahata, Isaku" <isaku.yamahata@...el.com>,
"isaku.yamahata@...il.com" <isaku.yamahata@...il.com>,
Sean Christopherson <sean.j.christopherson@...el.com>,
Kai Huang <kai.huang@...ux.intel.com>,
"Li, Xiaoyao" <xiaoyao.li@...el.com>
Subject: RE: [RFC PATCH v2 07/69] KVM: TDX: define and export helper functions
for KVM TDX support
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
Powered by blists - more mailing lists