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 for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Tue, 12 Apr 2016 23:54:06 +0200
From:	Paolo Bonzini <pbonzini@...hat.com>
To:	Radim Krčmář <rkrcmar@...hat.com>,
	Suravee Suthikulpanit <Suravee.Suthikulpanit@....com>
Cc:	joro@...tes.org, bp@...en8.de, gleb@...nel.org,
	alex.williamson@...hat.com, kvm@...r.kernel.org,
	linux-kernel@...r.kernel.org, wei@...hat.com,
	sherry.hurwitz@....com
Subject: Re: [PART1 RFC v4 06/11] KVM: x86: Detect and Initialize AVIC support



On 11/04/2016 22:48, Radim Krčmář wrote:
> 2016-04-07 03:20-0500, Suravee Suthikulpanit:
>> This patch introduces AVIC-related data structure, and AVIC
>> initialization code.
>>
>> There are three main data structures for AVIC:
>>     * Virtual APIC (vAPIC) backing page (per-VCPU)
>>     * Physical APIC ID table (per-VM)
>>     * Logical APIC ID table (per-VM)
>>
>> Currently, AVIC is disabled by default. Users can manually
>> enable AVIC via kernel boot option kvm-amd.avic=1 or during
>> kvm-amd module loading with parameter avic=1.
>>
>> Signed-off-by: Suravee Suthikulpanit <suravee.suthikulpanit@....com>
>> ---
>> diff --git a/arch/x86/kvm/svm.c b/arch/x86/kvm/svm.c
>> @@ -14,6 +14,9 @@
>>   * the COPYING file in the top-level directory.
>>   *
>>   */
>> +
>> +#define pr_fmt(fmt) "SVM: " fmt
>> +
>>  #include <linux/kvm_host.h>
>>  
>>  #include "irq.h"
>> @@ -78,6 +81,11 @@ MODULE_DEVICE_TABLE(x86cpu, svm_cpu_id);
>>  #define TSC_RATIO_MIN		0x0000000000000001ULL
>>  #define TSC_RATIO_MAX		0x000000ffffffffffULL
>>  
>> +#define AVIC_HPA_MASK	~((0xFFFULL << 52) || 0xFFF)
>> +
>> +/* NOTE: Current max index allowed for physical APIC ID table is 255 */
>> +#define AVIC_PHYSICAL_ID_MAX	0xFF
> 
> 0xff is broadcast, so shouldn't the actual last one be 0xfe?

Right, actually 0xFF is the maximum *number* of physical APICs (numbered
0 to 254).  But the code is correct and written for that convention, so
we should just rename the macro:

/* 0xff is broadcast, so the max index allowed for physical APIC ID
 * table is 0xfe.  APIC IDs above 0xff are reserved.
 */
#define AVIC_MAX_PHYSICAL_ID_COUNT	255

You can then remove the comment where Radim pointed out you should use
the constant:

> +	/* Note: APIC ID = 0xff is used for broadcast.
> +	 *       APIC ID > 0xff is reserved.
> +	 */
> +	if (index >= 0xff)

Paolo

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ