All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] x86/apic: remove read/write test in verify_local_apic()
@ 2015-03-18 20:45 Bandan Das
  2015-03-27 12:10 ` Ingo Molnar
  0 siblings, 1 reply; 2+ messages in thread
From: Bandan Das @ 2015-03-18 20:45 UTC (permalink / raw)
  To: Thomas Gleixner, Ingo Molnar, H. Peter Anvin; +Cc: x86, linux-kernel


Most newer processors have the APIC_ID read-only and this
test probably fails on most boxes anyway. Fix typos.

Signed-off-by: Bandan Das <bsd@redhat.com>
---
Honestly, I don't think this function is really needed.
It's called for both UP/MP but the return value isn't
used by any of them. Maybe, we should just remove it ?

 arch/x86/kernel/apic/apic.c | 18 +++++++-----------
 1 file changed, 7 insertions(+), 11 deletions(-)

diff --git a/arch/x86/kernel/apic/apic.c b/arch/x86/kernel/apic/apic.c
index ad3639a..d54601e 100644
--- a/arch/x86/kernel/apic/apic.c
+++ b/arch/x86/kernel/apic/apic.c
@@ -1105,13 +1105,13 @@ int __init verify_local_APIC(void)
 	/*
 	 * The two version reads above should print the same
 	 * numbers.  If the second one is different, then we
-	 * poke at a non-APIC.
+	 * are poking at a non-APIC region.
 	 */
 	if (reg1 != reg0)
 		return 0;
 
 	/*
-	 * Check if the version looks reasonably.
+	 * Check if the version looks reasonable.
 	 */
 	reg1 = GET_APIC_VERSION(reg0);
 	if (reg1 == 0x00 || reg1 == 0xff)
@@ -1121,21 +1121,17 @@ int __init verify_local_APIC(void)
 		return 0;
 
 	/*
-	 * The ID register is read/write in a real APIC.
+	 * Just print the APIC ID
+	 * Writing to it is not a reliable test - older processors
+	 * support it, while newer processors don't
 	 */
 	reg0 = apic_read(APIC_ID);
-	apic_printk(APIC_DEBUG, "Getting ID: %x\n", reg0);
-	apic_write(APIC_ID, reg0 ^ apic->apic_id_mask);
-	reg1 = apic_read(APIC_ID);
-	apic_printk(APIC_DEBUG, "Getting ID: %x\n", reg1);
-	apic_write(APIC_ID, reg0);
-	if (reg1 != (reg0 ^ apic->apic_id_mask))
-		return 0;
+	apic_printk(APIC_DEBUG, "Getting Local APIC ID: %x\n", reg0);
 
 	/*
 	 * The next two are just to see if we have sane values.
 	 * They're only really relevant if we're in Virtual Wire
-	 * compatibility mode, but most boxes are anymore.
+	 * compatibility mode, but most boxes aren't anymore.
 	 */
 	reg0 = apic_read(APIC_LVT0);
 	apic_printk(APIC_DEBUG, "Getting LVT0: %x\n", reg0);
-- 
2.1.0


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] x86/apic: remove read/write test in verify_local_apic()
  2015-03-18 20:45 [PATCH] x86/apic: remove read/write test in verify_local_apic() Bandan Das
@ 2015-03-27 12:10 ` Ingo Molnar
  0 siblings, 0 replies; 2+ messages in thread
From: Ingo Molnar @ 2015-03-27 12:10 UTC (permalink / raw)
  To: Bandan Das
  Cc: Thomas Gleixner, Ingo Molnar, H. Peter Anvin, x86, linux-kernel


* Bandan Das <bsd@redhat.com> wrote:

> 
> Most newer processors have the APIC_ID read-only and this
> test probably fails on most boxes anyway. Fix typos.
> 
> Signed-off-by: Bandan Das <bsd@redhat.com>
> ---
> Honestly, I don't think this function is really needed.
> It's called for both UP/MP but the return value isn't
> used by any of them. Maybe, we should just remove it ?

Agreed, lets just remove it.

Thanks,

	Ingo

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2015-03-27 12:11 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-03-18 20:45 [PATCH] x86/apic: remove read/write test in verify_local_apic() Bandan Das
2015-03-27 12:10 ` Ingo Molnar

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.