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] [thread-next>] [day] [month] [year] [list]
Message-ID: <54CB9EE3.3030804@redhat.com>
Date:	Fri, 30 Jan 2015 16:10:27 +0100
From:	Paolo Bonzini <pbonzini@...hat.com>
To:	Radim Krčmář <rkrcmar@...hat.com>
CC:	linux-kernel@...r.kernel.org, kvm@...r.kernel.org,
	Nadav Amit <namit@...technion.ac.il>,
	Gleb Natapov <gleb@...nel.org>
Subject: Re: [PATCH 7/8] KVM: x86: avoid logical_map when it is invalid



On 30/01/2015 15:56, Radim Krčmář wrote:
> 2015-01-30 10:38+0100, Paolo Bonzini:
>> On 29/01/2015 22:48, Radim Krčmář wrote:
>>> +		if (hweight8(new->mode) != 1)
>>
>> Better (more optimized):
>>
>> 	if (new->mode & (new->mode - 1))
> 
> True, hweight needs to have X86_FEATURE_POPCNT to be efficient ...
> 
> Do you know of a difference with it?
>   new->mode & (new->mode - 1)   |  hweight8(new->mode) != 1
>     lea    -0x1(%rax),%edi      |    popcnt %edi,%eax
>     test   %eax,%edi            |    cmp    $1,%eax

x & (x - 1) is really hweight8(new->mode) > 1.  So if new->mode == 0 it
would have a different result.

>> Please add a comment to kvm_irq_delivery_to_apic_fast to explain what
>> you are doing.
> 
> Would naming it kvm_apic_need_slow_delivery(), or something, be enough?

Or kvm_apic_map_valid() perhaps?

Paolo

>>> +		if (hweight8(map->mode) != 1) {
>>> +			/* Not deliverable with optimized map. */
>>> +			ret = false;
>>> +			goto out;
>>> +		}
>>
>> Put this before the computation of cid and mda.  The cid and mda are all
>> wrong with a mixed map, and the result of the "if" before is influenced
>> by the wrong cid.  Fixed by patch 8, but better get it right here.
> 
> Will do,
> 
> thanks.
> 
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ