[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [Xen-devel] [PATCH v12 for-xen-4.5 12/20] x86/VPMU: Initialize PMU for PV(H) guests
>>> On 29.09.14 at 17:41, <boris.ostrovsky@xxxxxxxxxx> wrote: > On 09/29/2014 11:25 AM, Jan Beulich wrote: >>>>> On 25.09.14 at 21:28, <boris.ostrovsky@xxxxxxxxxx> wrote: >>> @@ -389,14 +390,26 @@ static int amd_vpmu_initialise(struct vcpu *v) >>> } >>> } >>> >>> - ctxt = xzalloc_bytes(sizeof(struct xen_pmu_amd_ctxt) + >>> - 2 * sizeof(uint64_t) * AMD_MAX_COUNTERS); >>> - if ( !ctxt ) >>> + regs_size = 2 * sizeof(uint64_t) * AMD_MAX_COUNTERS; >>> + if ( is_hvm_domain(v->domain) ) >>> { >>> - gdprintk(XENLOG_WARNING, "Insufficient memory for PMU, " >>> - " PMU feature is unavailable on domain %d vcpu %d.\n", >>> - v->vcpu_id, v->domain->domain_id); >>> - return -ENOMEM; >>> + ctxt = xzalloc_bytes(sizeof(struct xen_pmu_amd_ctxt) + regs_size); >>> + if ( !ctxt ) >>> + { >>> + gdprintk(XENLOG_WARNING, "Insufficient memory for PMU, " >>> + "PMU feature is unavailable\n"); >>> + return -ENOMEM; >>> + } >>> + } >>> + else >>> + { >>> + if ( sizeof(struct xen_pmu_data) + regs_size > PAGE_SIZE ) >> This is a compile time constant condition - no reason to issue a >> message and return failure at runtime, just BUILD_BUG_ON() instead. > > It will not be if I replace AMD_MAX_COUNTERS with runtime register > count, as you asked in an earlier comment. For which case see the respective VMX side comment. Jan _______________________________________________ Xen-devel mailing list Xen-devel@xxxxxxxxxxxxx http://lists.xen.org/xen-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |