All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] x86, amd: Be more verbose about LVT offset assignments
@ 2012-03-27 19:30 Robert Richter
  2012-03-28 11:49 ` Ingo Molnar
  0 siblings, 1 reply; 3+ messages in thread
From: Robert Richter @ 2012-03-27 19:30 UTC (permalink / raw)
  To: Ingo Molnar; +Cc: LKML, Robert Richter

Add information about LVT offset assignments to better debug firmware
bug messages related to this.

Signed-off-by: Robert Richter <robert.richter@amd.com>
---
 arch/x86/kernel/apic/apic.c |   13 +++++++++----
 1 files changed, 9 insertions(+), 4 deletions(-)

diff --git a/arch/x86/kernel/apic/apic.c b/arch/x86/kernel/apic/apic.c
index 2eec05b..11544d8 100644
--- a/arch/x86/kernel/apic/apic.c
+++ b/arch/x86/kernel/apic/apic.c
@@ -383,20 +383,25 @@ static inline int eilvt_entry_is_changeable(unsigned int old, unsigned int new)
 
 static unsigned int reserve_eilvt_offset(int offset, unsigned int new)
 {
-	unsigned int rsvd;			/* 0: uninitialized */
+	unsigned int rsvd, vector;
 
 	if (offset >= APIC_EILVT_NR_MAX)
 		return ~0;
 
-	rsvd = atomic_read(&eilvt_offsets[offset]) & ~APIC_EILVT_MASKED;
+	rsvd = atomic_read(&eilvt_offsets[offset]);
 	do {
-		if (rsvd &&
-		    !eilvt_entry_is_changeable(rsvd, new))
+		vector = rsvd & ~APIC_EILVT_MASKED;	/* 0: unassigned */
+		if (vector && !eilvt_entry_is_changeable(vector, new))
 			/* may not change if vectors are different */
 			return rsvd;
 		rsvd = atomic_cmpxchg(&eilvt_offsets[offset], rsvd, new);
 	} while (rsvd != new);
 
+	rsvd &= ~APIC_EILVT_MASKED;
+	if (rsvd && rsvd != vector)
+		pr_info("LVT offset %d assigned for vector 0x%02x\n",
+			offset, rsvd);
+
 	return new;
 }
 
-- 
1.7.8.4



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

* Re: [PATCH] x86, amd: Be more verbose about LVT offset assignments
  2012-03-27 19:30 [PATCH] x86, amd: Be more verbose about LVT offset assignments Robert Richter
@ 2012-03-28 11:49 ` Ingo Molnar
  2012-03-28 13:12   ` Robert Richter
  0 siblings, 1 reply; 3+ messages in thread
From: Ingo Molnar @ 2012-03-28 11:49 UTC (permalink / raw)
  To: Robert Richter; +Cc: Ingo Molnar, LKML, Thomas Gleixner, H. Peter Anvin


* Robert Richter <robert.richter@amd.com> wrote:

> Add information about LVT offset assignments to better debug 
> firmware bug messages related to this.

Which particular bug message(s) is this related to, can you 
quote an example perhaps?

Thanks,

	Ingo

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

* Re: [PATCH] x86, amd: Be more verbose about LVT offset assignments
  2012-03-28 11:49 ` Ingo Molnar
@ 2012-03-28 13:12   ` Robert Richter
  0 siblings, 0 replies; 3+ messages in thread
From: Robert Richter @ 2012-03-28 13:12 UTC (permalink / raw)
  To: Ingo Molnar; +Cc: Ingo Molnar, LKML, Thomas Gleixner, H. Peter Anvin

On 28.03.12 13:49:45, Ingo Molnar wrote:
> 
> * Robert Richter <robert.richter@amd.com> wrote:
> 
> > Add information about LVT offset assignments to better debug 
> > firmware bug messages related to this.
> 
> Which particular bug message(s) is this related to, can you 
> quote an example perhaps?

Yeah, should have put it into the commit message. Updated patch below.

-Robert


>From efb205d18ba569a058555283c4a66d736118ca6d Mon Sep 17 00:00:00 2001
From: Robert Richter <robert.richter@amd.com>
Date: Tue, 27 Mar 2012 20:04:02 +0200
Subject: [PATCH] x86, amd: Be more verbose about LVT offset assignments

Add information about LVT offset assignments to better debug firmware
bugs related to this. See following examples.

 # dmesg | grep -i 'offset\|ibs'
 LVT offset 0 assigned for vector 0xf9
 [Firmware Bug]: cpu 0, try to use APIC500 (LVT offset 0) for vector 0x10400, but the register is already in use for vector 0xf9 on another cpu
 [Firmware Bug]: cpu 0, IBS interrupt offset 0 not available (MSRC001103A=0x0000000000000100)
 Failed to setup IBS, -22

In this case the BIOS assigns both offsets for MCE (0xf9) and IBS
(0x400) vectors to offset 0, which is why the second APIC setup (IBS)
failed.

With correct setup you get:

 # dmesg | grep -i 'offset\|ibs'
 LVT offset 0 assigned for vector 0xf9
 LVT offset 1 assigned for vector 0x400
 IBS: LVT offset 1 assigned
 perf: AMD IBS detected (0x00000007)
 oprofile: AMD IBS detected (0x00000007)

Note: The vector includes also the message type to handle also NMIs
(0x400). In the firmware bug message the format is the same as of the
APIC500 register and includes the mask bit (bit 16) in addition.

Signed-off-by: Robert Richter <robert.richter@amd.com>
---
 arch/x86/kernel/apic/apic.c |   13 +++++++++----
 1 files changed, 9 insertions(+), 4 deletions(-)

diff --git a/arch/x86/kernel/apic/apic.c b/arch/x86/kernel/apic/apic.c
index 2eec05b..11544d8 100644
--- a/arch/x86/kernel/apic/apic.c
+++ b/arch/x86/kernel/apic/apic.c
@@ -383,20 +383,25 @@ static inline int eilvt_entry_is_changeable(unsigned int old, unsigned int new)
 
 static unsigned int reserve_eilvt_offset(int offset, unsigned int new)
 {
-	unsigned int rsvd;			/* 0: uninitialized */
+	unsigned int rsvd, vector;
 
 	if (offset >= APIC_EILVT_NR_MAX)
 		return ~0;
 
-	rsvd = atomic_read(&eilvt_offsets[offset]) & ~APIC_EILVT_MASKED;
+	rsvd = atomic_read(&eilvt_offsets[offset]);
 	do {
-		if (rsvd &&
-		    !eilvt_entry_is_changeable(rsvd, new))
+		vector = rsvd & ~APIC_EILVT_MASKED;	/* 0: unassigned */
+		if (vector && !eilvt_entry_is_changeable(vector, new))
 			/* may not change if vectors are different */
 			return rsvd;
 		rsvd = atomic_cmpxchg(&eilvt_offsets[offset], rsvd, new);
 	} while (rsvd != new);
 
+	rsvd &= ~APIC_EILVT_MASKED;
+	if (rsvd && rsvd != vector)
+		pr_info("LVT offset %d assigned for vector 0x%02x\n",
+			offset, rsvd);
+
 	return new;
 }
 
-- 
1.7.8.4


-- 
Advanced Micro Devices, Inc.
Operating System Research Center


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

end of thread, other threads:[~2012-03-28 13:12 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-03-27 19:30 [PATCH] x86, amd: Be more verbose about LVT offset assignments Robert Richter
2012-03-28 11:49 ` Ingo Molnar
2012-03-28 13:12   ` Robert Richter

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.