|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [Xen-devel] [PATCH v9 3/6] x86: collect CQM information from all sockets
>>> On 19.02.14 at 07:32, Dongxiao Xu <dongxiao.xu@xxxxxxxxx> wrote:
> +static void read_cqm_data(void *arg)
> +{
> + uint64_t cqm_data;
> + unsigned int rmid;
> + int socket = cpu_to_socket(smp_processor_id());
> + unsigned long i;
> +
> + ASSERT(system_supports_cqm());
> +
> + if ( socket < 0 )
> + return;
> +
> + for ( rmid = cqm->min_rmid; rmid <= cqm->max_rmid; rmid++ )
> + {
> + if ( cqm->rmid_to_dom[rmid] == DOMID_INVALID )
> + continue;
> +
> + wrmsr(MSR_IA32_QOSEVTSEL, QOS_MONITOR_EVTID_L3, rmid);
> + rdmsrl(MSR_IA32_QMC, cqm_data);
> +
> + i = (unsigned long)(cqm->max_rmid + 1) * socket + rmid;
> + if ( !(cqm_data & IA32_QM_CTR_ERROR_MASK) )
> + cqm->buffer[i] = cqm_data * cqm->upscaling_factor;
So my earlier comment regarding the NR_CPUS use in the allocation
of this buffer becomes even more relevant with the fact that you're
indexing by socket here, not by CPU - in that case, even nr_cpu_ids
is likely to be a gross overestimation.
> +static void select_socket_cpu(cpumask_t *cpu_bitmap)
> +{
> + int i;
> + unsigned int cpu;
> + int socket, socket_curr = cpu_to_socket(smp_processor_id());
> + DECLARE_BITMAP(sockets, NR_CPUS);
Please avoid putting a 4095-bit bitmap on the stack.
> +
> + bitmap_zero(sockets, NR_CPUS);
> + if (socket_curr >= 0)
Coding style.
Jan
_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |