Re: [PATCH v3 2/5] x86/sgx: Use sgx_free_epc_page() in sgx_reclaim_pages()

From: Dave Hansen
Date: Wed Mar 10 2021 - 10:56:36 EST


On 3/10/21 7:11 AM, Jarkko Sakkinen wrote:
>>> - section = &sgx_epc_sections[epc_page->section];
>>> - spin_lock(&section->lock);
>>> - list_add_tail(&epc_page->list, &section->page_list);
>>> - section->free_cnt++;
>>> - spin_unlock(&section->lock);
>>> + sgx_free_epc_page(epc_page);
>>> }
>>> }
>> In current upstream (3fb6d0e00e), sgx_free_epc_page() calls __eremove().
>> This code does not call __eremove(). That seems to be changing
>> behavior where none was intended.
> EREMOVE does not matter here, as it doesn't in almost all most of the sites
> where sgx_free_epc_page() is used in the driver. It does nothing to an
> uninitialized pages.
>
> The two patches that I posted originally for Kai's series took EREMOVE out
> of sgx_free_epc_page() and put an explicit EREMOVE where it is actually
> needed, but for reasons unknown to me, that change is gone.
>
> Replacing the ad-hoc code with sgx_free_epc_page() is absolutely the right
> action to take because it follows the pattern how sgx_free_epc_page() is
> used in the driver.

That sounds generally fine. But, this is a functional change. Where
there are functional changes, I always hope to see some mention of the
change in the changelog.

Could you add some of this to the next changelog, please?