sgx_reclaimer_write() refinement

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

 



Hi

I noticed that sgx_reclaimer_write() does not destory enclave albeit it
can fail. It should have a proper fallback mechanism.

I would take a long path to fix this by replacing sgx_reclaim_pages()
with

struct sgx_epc_page *sgx_reclaim_page(void)

It would greatly reduce the complexity of the flow. Would be much easier
to do fallback code paths. We have three trial EWB approach, which
should prevent already unnecesaary ETRACK's and IPI's.

The reclaimer thread would loop this until high watermark is reached.

The alloc function would change as:

struct sgx_epc_page *sgx_alloc_page(void *owner, bool reclaim)
{
	struct sgx_epc_page *entry;

	entry = sgx_try_alloc_page(owner);
	if (entry)
		break;

	if (list_empty(&sgx_active_page_list)) {
		entry = ERR_PTR(-ENOMEM);
		goto out;
	}

	if (!reclaim) {
		entry = ERR_PTR(-EBUSY);
		goto out;
	}

	entry = sgx_reclaim_page();

out:
	if (sgx_calc_free_cnt() < SGX_NR_LOW_PAGES)
		wake_up(&ksgxswapd_waitq);

	return entry;
}

We get rid of the loop because the reclaimer function will return the
EPC page. The reclaimer thread will add the page to the active page
list.

/Jarkko



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

  Powered by Linux