[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Xen-devel] [PATCH v5 3/4] VT-d PI: restrict the number of vcpus in a given pcpu's PI blocking list



>>> On 16.08.17 at 07:14, <chao.gao@xxxxxxxxx> wrote:
> +static inline bool pi_over_limit(unsigned int cpu)
> +{
> +    /* Compare w/ constant first to save a division and an add */
> +    if ( likely(read_atomic(&per_cpu(vmx_pi_blocking, cpu).counter) <=
> +                PI_LIST_FIXED_LIMIT) )
> +        return 0;

false

> +    else

Pointless else.

> +static unsigned int pi_get_blocking_cpu(unsigned int cpu, unsigned long 
> *flags)
> +{
> +    spinlock_t *pi_blocking_list_lock;
> +
> +    for ( ; ; )
> +    {
> +        while ( unlikely(pi_over_limit(cpu)) )
> +            cpu = cpumask_cycle(cpu, &cpu_online_map);
> +
> +        pi_blocking_list_lock = &per_cpu(vmx_pi_blocking, cpu).lock;
> +        if ( flags )
> +            spin_lock_irqsave(pi_blocking_list_lock, *flags);
> +        else
> +            spin_lock(pi_blocking_list_lock);

This is ugly, but I think I see why you want it this way. Let's see
what the maintainers think.

Jan


_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
https://lists.xen.org/xen-devel

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.