Re: [PATCH 1/2] x86/sgx: Remove duplicate check for entry->epc_page in sgx_encl_load_page()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, Aug 22, 2019 at 02:29:01AM +0300, Jarkko Sakkinen wrote:
> The existence of the page is checked first hand for legit race
> conditions (either two or more concurrent threads running the #PF
> handler or the reclaimer has taken over the page):
> 
> /* Page is already resident in the EPC. */
> if (entry->epc_page) {
> 	if (entry->desc & SGX_ENCL_PAGE_RECLAIMED)
> 		return ERR_PTR(-EBUSY);
> 
> 	return entry;
> }
> 
> After that the existence is a checked as a condition for ELDU.
> 
> This commit removes the redundant check.
> 
> Cc: Sean Christopherson <sean.j.christopherson@xxxxxxxxx>
> Signed-off-by: Jarkko Sakkinen <jarkko.sakkinen@xxxxxxxxxxxxxxx>
> ---

Ha, I remember seeing this a while back and completely forgot about it.

Reviewed-by: Sean Christopherson <sean.j.christopherson@xxxxxxxxx>

>  arch/x86/kernel/cpu/sgx/encl.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/arch/x86/kernel/cpu/sgx/encl.c b/arch/x86/kernel/cpu/sgx/encl.c
> index a20d498e9dcd..d6397f7ef3b8 100644
> --- a/arch/x86/kernel/cpu/sgx/encl.c
> +++ b/arch/x86/kernel/cpu/sgx/encl.c
> @@ -123,7 +123,7 @@ static struct sgx_encl_page *sgx_encl_load_page(struct sgx_encl *encl,
>  			return ERR_CAST(epc_page);
>  	}
>  
> -	epc_page = entry->epc_page ? entry->epc_page : sgx_encl_eldu(entry);
> +	epc_page = sgx_encl_eldu(entry);
>  	if (IS_ERR(epc_page))
>  		return ERR_CAST(epc_page);
>  
> -- 
> 2.20.1
> 



[Index of Archives]     [AMD Graphics]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux