Skip to contentSkip to conversation

2.6.25 new perfmon kernel patch + libpfm + pfmon available

PATCH Applied Arjan van de Ven 4 participants 14 messages Apr 29, 2008 – Jun 27, 2008 1 message not in the archive

Subsystems (2)
lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

#1 lore raw

Hello,

I have released the perfmon2 kernel patch for kernel v2.6.25. There is no major features. However, there were a major restructuring of the code to make it more readable, isolate features per module. The header files have also been restructured to separate user vs. kernel, and generic only vs. shared with arch. The restructuring of the interrupt handler yielded a nice 15% latency improvement on single counter sampling runs on X86. This new structure will make it easier to extract features and merge them with the mainline kernel.

In the time frame of 2.6.26, I will push a few bits and pieces to LKML for final review and integration.

Here are some of the kernel changes:
- Cell updates (Carl Love, Takashi Yamamoto)
- new perfmon_debug boot option to enable debug (Robert Richter)
- several bugs fixes on Itanium, MIPS and generic hrtimer management
- Power locking updates (Corey Ashford)

There is also a new release for libpfm, now at version 3.4. The changes include:
- AMD Phenom (a.k.a. Barcelona) IBS support (Robert Richter)
- Python bindings and examples (Arun Sharma)
- environment variable support to enable debugging
- auto-detection of syscall base number for 2.6.24 and 2.6.25
- new multi-threaded self-sampling example (Mark W. Krentel)
- man pages cleanups (Steve Kaufmann)

Special thanks to Arun (Google). The Python bindings are a nice addition to libpfm especially for prototyping and writing testsuites.

Finally, a new major version of pfmon, now at pfmon-3.4. Among the many changes:
- added support for dmalloc (Andrzej Nowak)
- updated support for Cell processor (Takashi Yamamoto)
- possibility to terminate pfmon cleanly with SIGTERM
- --follow-fork and derivatives fixed on Itanium and other platforms
- tracking of dlopen now works on mixed ABI environments
- lots of bugs fixes

As usual all files and more detailed changelogs can be downloaded from our website at:

http://perfmon.sourceforge.net

Enjoy,

#2 lore raw
Quoted 5 lines · On Tue, 29 Apr 2008 23:47:17 +0200 "stephane eranian" <[email protected]>…

As usual all files and more detailed changelogs can be downloaded
from our website at:

http://perfmon.sourceforge.net

it hides well there ;(
the website seems to only offer a 2003 version for download.. I doubt that that is the right one..

#4 lore raw
Quoted 5 lines · On Wed, 30 Apr 2008 15:11:11 +0200 "stephane eranian" <[email protected]>…

Sorry,

It's http://perfmon2.sf.net

hummmmm, I wonder why perfmon wants to reimplement half of the PCI layer...

+extern spinlock_t pci_config_lock;
+
+#define PCI_CONF1_ADDRESS(bus, devfn, reg) \
+ (0x80000000 | ((reg & 0xF00) << 16) | ((bus & 0xFF) << 16) \
+ | (devfn << 8) | (reg & 0xFC))
+
+#define is_ibs_pmc(x) (x = 4 || x = 5)
+
+static int pci_read(unsigned int seg, unsigned int bus,
+ unsigned int devfn, int reg, int len, u32 *value)
+{
+ unsigned long flags;

especially since this doesn't seem to use the proper config space abstractions :(

#5 lore raw

If I recall, AMD said that this special initialization would eventually migrate into the core kernel. The pci_read() may be there because it was not exported by the kernel (this particular code lives in a kernel module).

If you think there is now enough support in the core kernel to do this initialization
then I'd be happy to remove this piece of code.

Quoted 28 lines · Arjan van de Ven

On Wed, 30 Apr 2008 15:11:11 +0200

Quoted 5 lines · stephane eranian

Sorry,

It's http://perfmon2.sf.net

hummmmm, I wonder why perfmon wants to reimplement half of the PCI layer...

+extern spinlock_t pci_config_lock;
+
+#define PCI_CONF1_ADDRESS(bus, devfn, reg) \
+ (0x80000000 | ((reg & 0xF00) << 16) | ((bus & 0xFF) << 16) \
+ | (devfn << 8) | (reg & 0xFC))
+
+#define is_ibs_pmc(x) (x = 4 || x = 5)
+
+static int pci_read(unsigned int seg, unsigned int bus,
+ unsigned int devfn, int reg, int len, u32 *value)
+{
+ unsigned long flags;

especially since this doesn't seem to use the proper config space abstractions :(

#6 lore raw
Quoted 4 lines · On Wed, 30 Apr 2008 15:51:39 +0200 "stephane eranian" <[email protected]>…

If I recall, AMD said that this special initialization would eventually migrate into the core kernel. The pci_read() may be there because it was not exported by the kernel (this particular code lives in a kernel module).

... yet your patch adds an EXPORT_SYMBOL() just to make this specific function possible. Weird.

I find it hard to believe that there would be no code in the kernel to read or write config space of a device you have..... :)
In fact I bet 80% of the drivers in the tree use it.

#7 lore raw
Quoted 8 lines · Arjan van de Ven
Quoted 4 lines · On Wed, 30 Apr 2008 15:51:39 +0200 "stephane eranian" <[email protected]>…

If I recall, AMD said that this special initialization would eventually migrate into the core kernel. The pci_read() may be there because it was not exported by the kernel (this particular code lives in a kernel module).

Quoted 5 lines

... yet your patch adds an EXPORT_SYMBOL() just to make this specific function possible. Weird.

I find it hard to believe that there would be no code in the kernel to read or write config space of a device you have..... :)
In fact I bet 80% of the drivers in the tree use it.

Access to extended config space for AMD northbridges was not yet implemented. Recent patches from Yinghai Lu fix this. I will send a patch that uses the in-kernel functions.

-Robert

Signature · 3 lines
Advanced Micro Devices, Inc.
Operating System Research Center
email: [email protected]
#8 lore raw

PATCH 1/2 AMD64: Removing PCI ECS workaround

In reply to stephane eranian

This patch removes the workaround to access the Extended Config Space that is needed to setup IBS interrupts. PCI functions are replaced by standard PCI functions that support now ECS access.

---
 arch/x86/pci/common.c            |    1 -
 arch/x86/perfmon/perfmon_amd64.c |  100 +------------------------------------
 2 files changed, 3 insertions(+), 98 deletions(-)
arch/x86/pci/common.c +0 -1
index 400960b..6e64aaf 100644
@@ -76,7 +76,6 @@ int pcibios_scanned;
  * configuration space.
  */
 DEFINE_SPINLOCK(pci_config_lock);
-EXPORT_SYMBOL(pci_config_lock);
 
 static int __devinit can_skip_ioresource_align(const struct dmi_system_id *d)
 {
arch/x86/perfmon/perfmon_amd64.c +3 -97

118 lines not on this page · raw message

Signature · 1 line
1.5.5.3
#9 lore raw

PATCH 2/2 x86: add PCI extended config space access for AMD Barcelona

In reply to stephane eranian

This patch implements PCI extended configuration space access for AMD's Barcelona CPUs. It extends the method using CF8/CFC IO addresses. An x86 capability bit has been introduced that is set for CPUs supporting PCI extended config space accesses.

---
 arch/x86/kernel/cpu/cpu.h |    3 +
 arch/x86/pci/Makefile_32  |    1 +
 arch/x86/pci/Makefile_64  |    2 +-
 arch/x86/pci/amd_bus.c    |  560 +++++++++++++++++++++++++++++++++++++++++++++
 arch/x86/pci/direct.c     |   25 ++-
 arch/x86/pci/k8-bus_64.c  |  528 ------------------------------------------
 arch/x86/pci/pci.h        |    1 +
 7 files changed, 584 insertions(+), 536 deletions(-)
 create mode 100644 arch/x86/pci/amd_bus.c
 delete mode 100644 arch/x86/pci/k8-bus_64.c
arch/x86/kernel/cpu/cpu.h +3 -0
index 783691b..40ad189 100644
@@ -1,3 +1,4 @@
+#ifdef CONFIG_X86_32
 
 struct cpu_model_info {
 	int vendor;
@@ -36,3 +37,5 @@ extern struct cpu_vendor_dev __x86cpuvendor_start[], __x86cpuvendor_end[];
 
 extern int get_model_name(struct cpuinfo_x86 *c);
 extern void display_cacheinfo(struct cpuinfo_x86 *c);
+
+#endif /* CONFIG_X86_32 */
arch/x86/pci/Makefile_32 +1 -0
index 89ec35d..f647e7e 100644
@@ -22,3 +22,4 @@ pci-$(CONFIG_X86_NUMAQ)		:= numa.o irq.o
 pci-$(CONFIG_NUMA)		+= mp_bus_to_node.o
 
 obj-y				+= $(pci-y) common.o early.o
+obj-y				+= amd_bus.o
arch/x86/pci/Makefile_64 +1 -1
index 8fbd198..fd47068 100644
@@ -13,5 +13,5 @@ obj-y			+= legacy.o irq.o common.o early.o
 # mmconfig has a 64bit special
 obj-$(CONFIG_PCI_MMCONFIG) += mmconfig_64.o direct.o mmconfig-shared.o
 
-obj-y		+= k8-bus_64.o
+obj-y		+= amd_bus.o
 
arch/x86/pci/amd_bus.c new file +560 -0

560 lines not on this page · raw message

arch/x86/pci/direct.c +18 -7
index 21d1e0e..9915293 100644
@@ -8,18 +8,21 @@
 #include "pci.h"
 
 /*
- * Functions for accessing PCI configuration space with type 1 accesses
+ * Functions for accessing PCI base (first 256 bytes) and extended
+ * (4096 bytes per PCI function) configuration space with type 1
+ * accesses.
  */
 
 #define PCI_CONF1_ADDRESS(bus, devfn, reg) \
-	(0x80000000 | (bus << 16) | (devfn << 8) | (reg & ~3))
+	(0x80000000 | ((reg & 0xF00) << 16) | (bus << 16) \
+	| (devfn << 8) | (reg & 0xFC))
 
 static int pci_conf1_read(unsigned int seg, unsigned int bus,
 			  unsigned int devfn, int reg, int len, u32 *value)
 {
 	unsigned long flags;
 
-	if ((bus > 255) || (devfn > 255) || (reg > 255)) {
+	if ((bus > 255) || (devfn > 255) || (reg > 4095)) {
 		*value = -1;
 		return -EINVAL;
 	}
@@ -50,7 +53,7 @@ static int pci_conf1_write(unsigned int seg, unsigned int bus,
 {
 	unsigned long flags;
 
-	if ((bus > 255) || (devfn > 255) || (reg > 255)) 
+	if ((bus > 255) || (devfn > 255) || (reg > 4095))
 		return -EINVAL;
 
 	spin_lock_irqsave(&pci_config_lock, flags);
@@ -260,10 +263,18 @@ void __init pci_direct_init(int type)
 		return;
 	printk(KERN_INFO "PCI: Using configuration type %d for base access\n",
 		 type);
-	if (type == 1)
+	if (type == 1) {
 		raw_pci_ops = &pci_direct_conf1;
-	else
-		raw_pci_ops = &pci_direct_conf2;
+		if (raw_pci_ext_ops)
+			return;
+		if (!(pci_probe & PCI_HAS_IO_ECS))
+			return;
+		printk(KERN_INFO "PCI: Using configuration type 1 "
+		       "for extended access\n");
+		raw_pci_ext_ops = &pci_direct_conf1;
+		return;
+	}
+	raw_pci_ops = &pci_direct_conf2;
 }
 
 int __init pci_direct_probe(void)
arch/x86/pci/k8-bus_64.c deleted +0 -528

528 lines not on this page · raw message

arch/x86/pci/pci.h +1 -0
index 720c4c5..ba263e6 100644
@@ -27,6 +27,7 @@
 #define PCI_CAN_SKIP_ISA_ALIGN	0x8000
 #define PCI_USE__CRS		0x10000
 #define PCI_CHECK_ENABLE_AMD_MMCONF	0x20000
+#define PCI_HAS_IO_ECS		0x40000
 
 extern unsigned int pci_probe;
 extern unsigned long pirq_table_addr;
Signature · 1 line
1.5.5.3
#10 lore raw

Re: [PATCH 2/2] x86: add PCI extended config space access for AMD Barcelona

Quoted 7 lines · Robert Richter

This patch implements PCI extended configuration space access for AMD's Barcelona CPUs. It extends the method using CF8/CFC IO addresses. An x86 capability bit has been introduced that is set for CPUs supporting PCI extended config space accesses.

Quoted 11 lines
---
 arch/x86/kernel/cpu/cpu.h |    3 +
 arch/x86/pci/Makefile_32  |    1 +
 arch/x86/pci/Makefile_64  |    2 +-
 arch/x86/pci/amd_bus.c    |  560 +++++++++++++++++++++++++++++++++++++++++++++
 arch/x86/pci/direct.c     |   25 ++-
 arch/x86/pci/k8-bus_64.c  |  528 ------------------------------------------
 arch/x86/pci/pci.h        |    1 +
 7 files changed, 584 insertions(+), 536 deletions(-)
 create mode 100644 arch/x86/pci/amd_bus.c
 delete mode 100644 arch/x86/pci/k8-bus_64.c

These patches are for the perfmon/master tree. They are based upon tip/x86/cpu.

-Robert

Signature · 3 lines
Advanced Micro Devices, Inc.
Operating System Research Center
email: [email protected]
#11 lore raw

Re: [PATCH 2/2] x86: add PCI extended config space access for AMD Barcelona

Robert,

This patch was applied to the perfmon GIT tree.
Please test.
Thanks.

Quoted 31 lines · Robert Richter
Quoted 7 lines · Robert Richter

This patch implements PCI extended configuration space access for AMD's Barcelona CPUs. It extends the method using CF8/CFC IO addresses. An x86 capability bit has been introduced that is set for CPUs supporting PCI extended config space accesses.

Quoted 11 lines
---
 arch/x86/kernel/cpu/cpu.h |    3 +
 arch/x86/pci/Makefile_32  |    1 +
 arch/x86/pci/Makefile_64  |    2 +-
 arch/x86/pci/amd_bus.c    |  560 +++++++++++++++++++++++++++++++++++++++++++++
 arch/x86/pci/direct.c     |   25 ++-
 arch/x86/pci/k8-bus_64.c  |  528 ------------------------------------------
 arch/x86/pci/pci.h        |    1 +
 7 files changed, 584 insertions(+), 536 deletions(-)
 create mode 100644 arch/x86/pci/amd_bus.c
 delete mode 100644 arch/x86/pci/k8-bus_64.c

These patches are for the perfmon/master tree. They are based upon tip/x86/cpu.

-Robert

--
Advanced Micro Devices, Inc.
Operating System Research Center
email: [email protected]

#12 lore raw

Re: [perfmon2] [PATCH 2/2] x86: add PCI extended config space access for AMD Barcelona

Quoted 36 lines · stephane eranian

Robert,

This patch was applied to the perfmon GIT tree.
Please test.
Thanks.

Quoted 28 lines · Robert Richter
Quoted 7 lines · Robert Richter

This patch implements PCI extended configuration space access for AMD's Barcelona CPUs. It extends the method using CF8/CFC IO addresses. An x86 capability bit has been introduced that is set for CPUs supporting PCI extended config space accesses.

Quoted 11 lines
---
 arch/x86/kernel/cpu/cpu.h |    3 +
 arch/x86/pci/Makefile_32  |    1 +
 arch/x86/pci/Makefile_64  |    2 +-
 arch/x86/pci/amd_bus.c    |  560 +++++++++++++++++++++++++++++++++++++++++++++
 arch/x86/pci/direct.c     |   25 ++-
 arch/x86/pci/k8-bus_64.c  |  528 ------------------------------------------
 arch/x86/pci/pci.h        |    1 +
 7 files changed, 584 insertions(+), 536 deletions(-)
 create mode 100644 arch/x86/pci/amd_bus.c
 delete mode 100644 arch/x86/pci/k8-bus_64.c

These patches are for the perfmon/master tree. They are based upon tip/x86/cpu.

-Robert

--
Advanced Micro Devices, Inc.
Operating System Research Center
email: [email protected]

It looks like the amd_bus.c file didn't get into the git tree. See the builds failing because of that.

-Will

#13 lore raw

Re: [perfmon2] [PATCH 2/2] x86: add PCI extended config space access for AMD Barcelona

Will,

Thanks for noticing this. I obviously forgot to invoke git add. This should be fixed now.

Quoted 50 lines · William Cohen
Quoted 43 lines · stephane eranian

Robert,

This patch was applied to the perfmon GIT tree.
Please test.
Thanks.

Quoted 33 lines · Robert Richter
Quoted 8 lines · Robert Richter

This patch implements PCI extended configuration space access for AMD's Barcelona CPUs. It extends the method using CF8/CFC IO addresses. An x86 capability bit has been introduced that is set for CPUs supporting PCI extended config space accesses.

Quoted 13 lines
---
 arch/x86/kernel/cpu/cpu.h |    3 +
 arch/x86/pci/Makefile_32  |    1 +
 arch/x86/pci/Makefile_64  |    2 +-
 arch/x86/pci/amd_bus.c    |  560
+++++++++++++++++++++++++++++++++++++++++++++
 arch/x86/pci/direct.c     |   25 ++-
 arch/x86/pci/k8-bus_64.c  |  528
------------------------------------------
 arch/x86/pci/pci.h        |    1 +
 7 files changed, 584 insertions(+), 536 deletions(-)
 create mode 100644 arch/x86/pci/amd_bus.c
 delete mode 100644 arch/x86/pci/k8-bus_64.c

These patches are for the perfmon/master tree. They are based upon tip/x86/cpu.

-Robert

--
Advanced Micro Devices, Inc.
Operating System Research Center
email: [email protected]

It looks like the amd_bus.c file didn't get into the git tree. See the builds failing because of that.

-Will

#14 lore raw
In reply to stephane eranian

Hello,

Several people noticed there was a typo in the website url. The actual web site is:

      http://perfmon2.sf.net

Sorry about that.

Quoted 49 lines · stephane eranian

Hello,

I have released the perfmon2 kernel patch for kernel v2.6.25. There is no major features. However, there were a major restructuring of the code to make it more readable, isolate features per module. The header files have also been restructured to separate user vs. kernel, and generic only vs. shared with arch. The restructuring of the interrupt handler yielded a nice 15% latency improvement on single counter sampling runs on X86. This new structure will make it easier to extract features and merge them with the mainline kernel.

In the time frame of 2.6.26, I will push a few bits and pieces to LKML for final review and integration.

Here are some of the kernel changes:
- Cell updates (Carl Love, Takashi Yamamoto)
- new perfmon_debug boot option to enable debug (Robert Richter)
- several bugs fixes on Itanium, MIPS and generic hrtimer management
- Power locking updates (Corey Ashford)

There is also a new release for libpfm, now at version 3.4. The changes include:
- AMD Phenom (a.k.a. Barcelona) IBS support (Robert Richter)
- Python bindings and examples (Arun Sharma)
- environment variable support to enable debugging
- auto-detection of syscall base number for 2.6.24 and 2.6.25
- new multi-threaded self-sampling example (Mark W. Krentel)
- man pages cleanups (Steve Kaufmann)

Special thanks to Arun (Google). The Python bindings are a nice addition to libpfm especially for prototyping and writing testsuites.

Finally, a new major version of pfmon, now at pfmon-3.4. Among the many changes:
- added support for dmalloc (Andrzej Nowak)
- updated support for Cell processor (Takashi Yamamoto)
- possibility to terminate pfmon cleanly with SIGTERM
- --follow-fork and derivatives fixed on Itanium and other platforms
- tracking of dlopen now works on mixed ABI environments
- lots of bugs fixes

As usual all files and more detailed changelogs can be downloaded from our website at:

http://perfmon.sourceforge.net

Enjoy,