Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1679599

Re: [PATCH v5 01/12] x86/apic: Construct a selector for the interrupt delivery mode

Path csiph.com!news.redatomik.org!aioe.org!bofh.it!news.nic.it!robomod
From Dou Liyang <douly.fnst@cn.fujitsu.com>
Newsgroups linux.kernel
Subject Re: [PATCH v5 01/12] x86/apic: Construct a selector for the interrupt delivery mode
Date Mon, 03 Jul 2017 03:50:01 +0200
Message-ID <tYYEV-2rT-9@gated-at.bofh.it> (permalink)
References <tXVpM-np-9@gated-at.bofh.it> <tXVpM-np-11@gated-at.bofh.it> <tYR0J-5cR-5@gated-at.bofh.it>
X-Ironport-Av E=Sophos;i="5.22,518,1449504000"; d="scan'208";a="20758566"
User-Agent Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.4.0
MIME-Version 1.0
Content-Type text/plain; charset="windows-1252"; format=flowed
Content-Transfer-Encoding 7bit
X-Originating-IP [10.167.226.106]
X-Yoursite-Mailscanner-ID 8C3A647E9887.AD2D4
X-Yoursite-Mailscanner Found to be clean
X-Yoursite-Mailscanner-From douly.fnst@cn.fujitsu.com
Sender robomod@news.nic.it
List-ID <linux-kernel.vger.kernel.org>
X-Mailing-List linux-kernel@vger.kernel.org
Approved robomod@news.nic.it
Lines 102
Organization linux.* mail to news gateway
X-Original-Cc <x86@kernel.org>, <linux-kernel@vger.kernel.org>, <xen-devel@lists.xenproject.org>, <mingo@kernel.org>, <hpa@zytor.com>, <ebiederm@xmission.com>, <bhe@redhat.com>, <boris.ostrovsky@oracle.com>, <peterz@infradead.org>, <izumi.taku@jp.fujitsu.com>
X-Original-Date Mon, 3 Jul 2017 09:44:09 +0800
X-Original-Message-ID <6bbe35a1-2d8b-4891-1b0d-f0e4b54008f3@cn.fujitsu.com>
X-Original-References <cover.1498795030.git.douly.fnst@cn.fujitsu.com> <15d82d40aeec8d5935cca2c64ead8710861cd5f8.1498795030.git.douly.fnst@cn.fujitsu.com> <alpine.DEB.2.20.1707021922000.2296@nanos>
X-Original-Sender linux-kernel-owner@vger.kernel.org
Xref csiph.com linux.kernel:1679599

Show key headers only | View raw


Hi Thomas,

At 07/03/2017 01:37 AM, Thomas Gleixner wrote:
> On Fri, 30 Jun 2017, Dou Liyang wrote:
>> +static int __init apic_intr_mode_select(void)
>> +{
>> +	/* Check kernel option */
>> +	if (disable_apic) {
>> +		pr_info("APIC disabled via kernel command line\n");
>> +		return APIC_PIC;
>> +	}
>> +
>> +	/* Check BIOS */
>> +#ifdef CONFIG_X86_64
>> +	/* On 64-bit, the APIC must be integrated, Check local APIC only */
>> +	if (!boot_cpu_has(X86_FEATURE_APIC)) {
>> +		disable_apic = 1;
>> +		pr_info("APIC disabled by BIOS\n");
>> +		return APIC_PIC;
>> +	}
>> +#else
>> +	/*
>> +	 * On 32-bit, check whether there is a separate chip or integrated
>> +	 * APIC
>> +	 */
>> +
>> +	/* Has a local APIC ? */
>> +	if (!boot_cpu_has(X86_FEATURE_APIC) &&
>> +		APIC_INTEGRATED(boot_cpu_apic_version)) {
>
> This looks wrong. The existing logic is:
>
> 	if (!boot_cpu_has(X86_FEATURE_APIC) && !smp_found_config)
> 		return -1;
>
> 	if (!boot_cpu_has(X86_FEATURE_APIC) &&
> 	                APIC_INTEGRATED(boot_cpu_apic_version)) {
> 		pr_err(....);
>
> I know that this is magically the same because boot_cpu_apic_version is 0
> in the !boot_cpu_has(X86_FEATURE_APIC) && !smp_found_config case, so you
> don't fall into that conditional,

I see, it an unnecessary and surplus thing I did.

  but it's completely non obvious and does
> not really make the code more understandable. Quite the contrary.

You are right.

>
>> +		disable_apic = 1;
>> +		pr_err(FW_BUG "Local APIC %d not detected, force emulation\n",
>> +				       boot_cpu_physical_apicid);
>> +		return APIC_PIC;
>> +	}
>> +
>> +	/* Has a separate chip ? */
>> +	if (!boot_cpu_has(X86_FEATURE_APIC) && !smp_found_config) {
>> +		disable_apic = 1;
>> +
>> +		return APIC_PIC;
>> +	}
>
> So if you move exactly that check above the other then it's clear what's
> going on.

Will keep the order like the existing logic you gave above.

>
>> +#endif
>> +
>> +	/* Check MP table or ACPI MADT configuration */
>> +	if (!smp_found_config) {
>> +		disable_ioapic_support();
>> +
>> +		if (!acpi_lapic)
>> +			pr_info("APIC: ACPI MADT or MP tables are not detected\n");
>> +
>> +		return APIC_VIRTUAL_WIRE;
>> +	}
>> +
>> +	/* Other checks of APIC options will be done in each setup function */
>> +
>
> Please remove the extra new line. It's not helping readability.

Yes, remove right now.

Thanks,
	dou.

>
>> +	return APIC_SYMMETRIC_IO;
>> +}
>
> Thanks,
>
> 	tglx
>
>
>

Back to linux.kernel | Previous | Next — Previous in thread | Find similar | Unroll thread


Thread

[PATCH v5 01/12] x86/apic: Construct a selector for the interrupt delivery mode Dou Liyang <douly.fnst@cn.fujitsu.com> - 2017-06-30 06:10 +0200
  Re: [PATCH v5 01/12] x86/apic: Construct a selector for the interrupt  delivery mode Thomas Gleixner <tglx@linutronix.de> - 2017-07-02 19:40 +0200
    Re: [PATCH v5 01/12] x86/apic: Construct a selector for the interrupt  delivery mode Dou Liyang <douly.fnst@cn.fujitsu.com> - 2017-07-03 03:50 +0200

csiph-web