lkml.org 
[lkml]   [2022]   [Apr]   [6]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    /
    SubjectRe: [RFC PATCH v5 060/104] KVM: TDX: Create initial guest memory
    From
    Date
    On Fri, 2022-03-04 at 11:49 -0800, isaku.yamahata@intel.com wrote:
    > + /*
    > + * In case of TDP MMU, fault handler can run concurrently.  Note
    > + * 'source_pa' is a TD scope variable, meaning if there are multiple
    > + * threads reaching here with all needing to access 'source_pa', it
    > + * will break.  However fortunately this won't happen, because below
    > + * TDH_MEM_PAGE_ADD code path is only used when VM is being created
    > + * before it is running, using KVM_TDX_INIT_MEM_REGION ioctl (which
    > + * always uses vcpu 0's page table and protected by vcpu->mutex).
    > + */
    > + WARN_ON(kvm_tdx->source_pa == INVALID_PAGE);

    We can just KVM_BUG_ON() and return here.

    > + source_pa = kvm_tdx->source_pa & ~KVM_TDX_MEASURE_MEMORY_REGION;
    > +
    > + err = tdh_mem_page_add(kvm_tdx->tdr.pa, gpa, hpa, source_pa, &out);
    > + if (KVM_BUG_ON(err, kvm))
    > + pr_tdx_error(TDH_MEM_PAGE_ADD, err, &out);
    > + else if ((kvm_tdx->source_pa & KVM_TDX_MEASURE_MEMORY_REGION))
    > + tdx_measure_page(kvm_tdx, gpa);
    > +
    > + kvm_tdx->source_pa = INVALID_PAGE;

    \
     
     \ /
      Last update: 2022-04-07 17:29    [W:2.128 / U:0.032 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site