[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH v4 05/10] common/domain: allocate vmtrace_pt_buffer
- To: Michał Leszczyński <michal.leszczynski@xxxxxxx>, xen-devel@xxxxxxxxxxxxxxxxxxxx
- From: Julien Grall <julien@xxxxxxx>
- Date: Wed, 1 Jul 2020 16:35:56 +0100
- Cc: Stefano Stabellini <sstabellini@xxxxxxxxxx>, tamas.lengyel@xxxxxxxxx, Wei Liu <wl@xxxxxxx>, Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, Ian Jackson <ian.jackson@xxxxxxxxxxxxx>, George Dunlap <george.dunlap@xxxxxxxxxx>, Jan Beulich <jbeulich@xxxxxxxx>, luwei.kang@xxxxxxxxx, Roger Pau Monné <roger.pau@xxxxxxxxxx>
- Delivery-date: Wed, 01 Jul 2020 15:36:17 +0000
- List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
Hi,
On 30/06/2020 13:33, Michał Leszczyński wrote:
+static int vmtrace_alloc_buffers(struct vcpu *v)
+{
+ struct page_info *pg;
+ uint64_t size = v->domain->vmtrace_pt_size;
+
+ if ( size < PAGE_SIZE || size > GB(4) || (size & (size - 1)) )
+ {
+ /*
+ * We don't accept trace buffer size smaller than single page
+ * and the upper bound is defined as 4GB in the specification.
This is common code, so what specification are you talking about?
I am guessing this is an Intel one, but I don't think Intel should
dictate the common code implementation.
+ * The buffer size must be also a power of 2.
+ */
+ return -EINVAL;
+ }
+
+ pg = alloc_domheap_pages(v->domain, get_order_from_bytes(size),
+ MEMF_no_refcount);
+
+ if ( !pg )
+ return -ENOMEM;
+
+ v->arch.vmtrace.pt_buf = pg;
v->arch.vmtrace.pt_buf is not defined on Arm. Please make sure common
code build on all arch.
Cheers,
--
Julien Grall
|