/* * See struct hv_deposit_memory. The first u64 is partition ID, the rest * are GPAs.
*/ #define HV_DEPOSIT_MAX (HV_HYP_PAGE_SIZE / sizeof(u64) - 1)
/* Deposits exact number of pages. Must be called with interrupts enabled. */ int hv_call_deposit_pages(int node, u64 partition_id, u32 num_pages)
{ struct page **pages, *page; int *counts; int num_allocations; int i, j, page_count; int order;
u64 status; int ret;
u64 base_pfn; struct hv_deposit_memory *input_page; unsignedlong flags;
if (num_pages > HV_DEPOSIT_MAX) return -E2BIG; if (!num_pages) return 0;
/* One buffer for page pointers and counts */
page = alloc_page(GFP_KERNEL); if (!page) return -ENOMEM;
pages = page_address(page);
int hv_call_add_logical_proc(int node, u32 lp_index, u32 apic_id)
{ struct hv_input_add_logical_processor *input; struct hv_output_add_logical_processor *output;
u64 status; unsignedlong flags; int ret = 0;
/* * When adding a logical processor, the hypervisor may return * HV_STATUS_INSUFFICIENT_MEMORY. When that happens, we deposit more * pages and retry.
*/ do {
local_irq_save(flags);
input = *this_cpu_ptr(hyperv_pcpu_input_arg); /* We don't do anything with the output right now */
output = *this_cpu_ptr(hyperv_pcpu_output_arg);
if (hv_result(status) != HV_STATUS_INSUFFICIENT_MEMORY) { if (!hv_result_success(status)) {
hv_status_err(status, "cpu %u apic ID: %u\n",
lp_index, apic_id);
ret = hv_result_to_errno(status);
} break;
}
ret = hv_call_deposit_pages(node, hv_current_partition_id, 1);
} while (!ret);
return ret;
}
int hv_call_create_vp(int node, u64 partition_id, u32 vp_index, u32 flags)
{ struct hv_create_vp *input;
u64 status; unsignedlong irq_flags; int ret = 0;
/* Root VPs don't seem to need pages deposited */ if (partition_id != hv_current_partition_id) { /* The value 90 is empirically determined. It may change. */
ret = hv_call_deposit_pages(node, partition_id, 90); if (ret) return ret;
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.