[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAHp75Ve6WD8Tq+5-YkLx6dvJcXP8gte2Rg_bfAgzm8rs+wbW0Q@mail.gmail.com>
Date: Tue, 30 May 2017 19:38:14 +0300
From: Andy Shevchenko <andy.shevchenko@...il.com>
To: Vitaly Kuznetsov <vkuznets@...hat.com>
Cc: "x86@...nel.org" <x86@...nel.org>, devel@...uxdriverproject.org,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
"K. Y. Srinivasan" <kys@...rosoft.com>,
Haiyang Zhang <haiyangz@...rosoft.com>,
Stephen Hemminger <sthemmin@...rosoft.com>,
Thomas Gleixner <tglx@...utronix.de>,
Ingo Molnar <mingo@...hat.com>,
"H. Peter Anvin" <hpa@...or.com>,
Steven Rostedt <rostedt@...dmis.org>,
Jork Loeser <Jork.Loeser@...rosoft.com>,
Simon Xiao <sixiao@...rosoft.com>,
Andy Lutomirski <luto@...nel.org>
Subject: Re: [PATCH v5 07/10] hyper-v: globalize vp_index
On Tue, May 30, 2017 at 2:34 PM, Vitaly Kuznetsov <vkuznets@...hat.com> wrote:
> To support implementing remote TLB flushing on Hyper-V with a hypercall
> we need to make vp_index available outside of vmbus module. Rename and
> globalize.
> +u32 *hv_vp_index;
> + hv_vp_index[smp_processor_id()] = (u32)msr_vp_index;
Redundant casting.
> + /* Allocate percpu VP index */
> + hv_vp_index = kcalloc(num_possible_cpus(), sizeof(*hv_vp_index),
> + GFP_KERNEL);
> + if (!hv_vp_index)
> + return;
Consider to use kmalloc_array _if_ it doesn't require to be zeroed.
> +static inline int hv_cpu_number_to_vp_number(int cpu_number)
> +{
> + WARN_ON(hv_vp_index[cpu_number] == -1);
How come? u32 will be never negative.
Perhaps you meant == ~0U or U32_MAX
> for_each_cpu_and(cpu, dest, cpu_online_mask)
> - params->vp_mask |= (1ULL << vmbus_cpu_number_to_vp_number(cpu));
> + params->vp_mask |= (1ULL << hv_cpu_number_to_vp_number(cpu));
__set_bit() ?
> for_each_cpu_and(cpu, affinity, cpu_online_mask) {
> int_pkt->int_desc.cpu_mask |=
> - (1ULL << vmbus_cpu_number_to_vp_number(cpu));
> + (1ULL << hv_cpu_number_to_vp_number(cpu));
Ditto.
--
With Best Regards,
Andy Shevchenko
Powered by blists - more mailing lists