lkml.org 
[lkml]   [2020]   [Sep]   [22]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    /
    Date
    From
    SubjectRe: [PATCH v38 16/24] x86/sgx: Add a page reclaimer
    On Tue, Sep 22, 2020 at 09:24:38AM -0700, Sean Christopherson wrote:
    > The "else if" is correct. Version Array (VA) pages have 512 slots that hold
    > metadata for evicted EPC pages, i.e. swapping a page out of the EPC requires
    > a VA slot. For simplicity (LOL),

    I'll say.

    > the approach we are taking for initial support is to reserve a VA slot
    > when adding a page to the enclave[*]. In most cases, reserving a slot
    > does not require allocating a new VA page, e.g. to reserve slots 1-511
    > of the "current" VA page. The if-elif is handling the case where the
    > current VA page is fully reserved and a new one needs to be allocated.
    > The if handles the error, the elif handles success, i.e.
    >
    > if (IS_ERR(va_page)) <- needed a new VA page, allocation failed
    > return PTR_ERR(va_page);
    > else if (va_page) <- needed a new VA page, allocation succeeded
    > list_add(&va_page->list, &encl->va_pages);
    > else
    > <- reused the current VA page

    Aha, in that case va_page will be NULL but you're not using it in that
    function later and that current VA page is on encl->va_pages which
    others can get from there. Ok, gotcha.

    Thx.

    --
    Regards/Gruss,
    Boris.

    https://people.kernel.org/tglx/notes-about-netiquette

    \
     
     \ /
      Last update: 2020-09-22 20:02    [W:3.911 / U:0.220 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site