lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Date:   Wed, 31 May 2017 17:06:38 +0200
From:   Vitaly Kuznetsov <vkuznets@...hat.com>
To:     Jork Loeser <Jork.Loeser@...rosoft.com>
Cc:     "x86\@kernel.org" <x86@...nel.org>,
        "devel\@linuxdriverproject.org" <devel@...uxdriverproject.org>,
        "linux-kernel\@vger.kernel.org" <linux-kernel@...r.kernel.org>,
        "KY 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>,
        Simon Xiao <sixiao@...rosoft.com>,
        Andy Lutomirski <luto@...nel.org>,
        Andy Shevchenko <andy.shevchenko@...il.com>
Subject: Re: [PATCH v5 09/10] x86/hyper-v: support extended CPU ranges for TLB flush hypercalls

Jork Loeser <Jork.Loeser@...rosoft.com> writes:

>> -----Original Message-----
>> From: Vitaly Kuznetsov [mailto:vkuznets@...hat.com]
>> Sent: Tuesday, May 30, 2017 04:34
>> To: x86@...nel.org; devel@...uxdriverproject.org
>> Cc: linux-kernel@...r.kernel.org; KY 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>; Andy
>> Shevchenko <andy.shevchenko@...il.com>
>> Subject: [PATCH v5 09/10] x86/hyper-v: support extended CPU ranges for TLB
>> flush hypercalls
>> 
>> Hyper-V hosts may support more than 64 vCPUs, we need to use
>> HVCALL_FLUSH_VIRTUAL_ADDRESS_SPACE_EX/LIST_EX hypercalls in this case.
>
>> +static inline int cpumask_to_vp_set(struct hv_flush_pcpu_ex *flush,
>> +				    const struct cpumask *cpus)
>> +{
>> +	int cpu, vcpu, vcpu_bank, vcpu_offset, cur_bank, nr_bank = 0;
>> +	bool has_cpus;
>> +
>> +	/*
>> +	 * We can't be sure that translated vCPU numbers will always be
>> +	 * in ascending order, so iterate over all possible banks and
>> +	 * check all vCPUs in it instead.
>> +	 */
>> +	for (cur_bank = 0; cur_bank < ms_hyperv.max_vp_index/64;
>> cur_bank++) {
>> +		has_cpus = false;
>> +		for_each_cpu(cpu, cpus) {
>> +			vcpu = hv_cpu_number_to_vp_number(cpu);
>> +			vcpu_bank = vcpu / 64;
>> +			vcpu_offset = vcpu % 64;
>> +
>> +			if (vcpu_bank != cur_bank)
>> +				continue;
>> +			__set_bit(vcpu_offset, (unsigned long *)
>> +				  &flush->hv_vp_set.bank_contents[nr_bank]);
>> +			if (!has_cpus) {
>> +				__set_bit(vcpu_bank, (unsigned long *)
>> +					  &flush->hv_vp_set.valid_bank_mask);
>> +				has_cpus = true;
>> +			}
>> +		}
>> +		if (has_cpus)
>> +			nr_bank++;
>> +	}
>> +
>> +	return nr_bank;
>> +}
>
> Note that the HV_VP_SET may contain empty banks. As such, consider
> enabling all (5) bits in the valid_bank_mask, and a single
> for_each(cpu, cpus) pass - setting the bits as per
> hv_cpu_number_to_vp_number(cpu).
>

Oh, I didn't know that! I'll switch to doing a single
pass. Unfortunately I have no Hyper-V setup with > 64 vCPUs so I can't
really test if it works or not (I mean empty banks, *_EX hypercalls
work).

-- 
  Vitaly

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ