mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2024-11-11 04:18:39 +08:00
Fix deadlock in SGX NUMA node search
-----BEGIN PGP SIGNATURE----- iQIzBAABCgAdFiEEV76QKkVc4xCGURexaDWVMHDJkrAFAmbiE0YACgkQaDWVMHDJ krCmUw//T2NZu0k3H7z2AyBvLlxpdN61tZVZ9UArw71u6PNmDPhhU4Idt/vyidoM x0+tGswjpIBgxpt/qU2oN0rYMqKO0Dnwdnbw7u1Wfr+ldHYD3jupgzdQtNvCs70P U8qQZN4ltgppYXIEFnfCXoypaiIafyPiRJhR0YZQoVJ75uwbRB2Vu2ax5n1dak4u Wkwb55X0ucu2Q93z51tISdtUQQ8+yEytbXP5blu77GCtDf6ZPOFSF/VsBjKU6lER XQv7H2ReMUaYrPxvn7z60AApsYVDcbOwC0BDe1FmlNllmLlxxoThpfUMX+9+0pAs szHzta5ZZ83VXoFpVzbLIaEvKJZSrksi4EEsfr1qxEzo1QgTrONWt79OFH3GBi/i mMug+3vqlVKdx+YoHhZ+e4UcDftz4gqWEwvrlxh0CLomaprZU5ENDF8K53AYVa3g whnWzCG3fEAdIfFJ3Jfxw6U0mk8l7AnOM98vJK4Wa7faErJGi1nwNkWScmpYEMMP mJf0TOJZ3fXire51Ivq/xA+xsdb/P2h2nzbUZlaZ3vrGN8jBuglsHZtm9c/Rk+dC y7/peyPgFGL/1ngOKzzmz6mEQc7POJBKYYuiOe0MEwO3O2YtvK2hAeiL30GPJ31+ lkXC/F8BwNdxaxcE8KGsEUqFpV3ynvS61Oqvl8CQhYmE8JaAAII= =c73j -----END PGP SIGNATURE----- Merge tag 'x86_sgx_for_6.12-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip Pull x86 SGX updates from Dave Hansen: "These fix a deadlock in the SGX NUMA allocator. It's probably only triggerable today on servers with buggy BIOSes, but it's theoretically possible it can happen on less goofy systems" * tag 'x86_sgx_for_6.12-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip: x86/sgx: Log information when a node lacks an EPC section x86/sgx: Fix deadlock in SGX NUMA node search
This commit is contained in:
commit
a4ebad655b
@ -475,24 +475,25 @@ struct sgx_epc_page *__sgx_alloc_epc_page(void)
|
||||
{
|
||||
struct sgx_epc_page *page;
|
||||
int nid_of_current = numa_node_id();
|
||||
int nid = nid_of_current;
|
||||
int nid_start, nid;
|
||||
|
||||
if (node_isset(nid_of_current, sgx_numa_mask)) {
|
||||
page = __sgx_alloc_epc_page_from_node(nid_of_current);
|
||||
if (page)
|
||||
return page;
|
||||
}
|
||||
|
||||
/* Fall back to the non-local NUMA nodes: */
|
||||
while (true) {
|
||||
nid = next_node_in(nid, sgx_numa_mask);
|
||||
if (nid == nid_of_current)
|
||||
break;
|
||||
/*
|
||||
* Try local node first. If it doesn't have an EPC section,
|
||||
* fall back to the non-local NUMA nodes.
|
||||
*/
|
||||
if (node_isset(nid_of_current, sgx_numa_mask))
|
||||
nid_start = nid_of_current;
|
||||
else
|
||||
nid_start = next_node_in(nid_of_current, sgx_numa_mask);
|
||||
|
||||
nid = nid_start;
|
||||
do {
|
||||
page = __sgx_alloc_epc_page_from_node(nid);
|
||||
if (page)
|
||||
return page;
|
||||
}
|
||||
|
||||
nid = next_node_in(nid, sgx_numa_mask);
|
||||
} while (nid != nid_start);
|
||||
|
||||
return ERR_PTR(-ENOMEM);
|
||||
}
|
||||
@ -847,6 +848,13 @@ static bool __init sgx_page_cache_init(void)
|
||||
return false;
|
||||
}
|
||||
|
||||
for_each_online_node(nid) {
|
||||
if (!node_isset(nid, sgx_numa_mask) &&
|
||||
node_state(nid, N_MEMORY) && node_state(nid, N_CPU))
|
||||
pr_info("node%d has both CPUs and memory but doesn't have an EPC section\n",
|
||||
nid);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user