Skip to contentSkip to conversation

xenoprofile: Add IBS support

PATCH In review Wei Wang2 2 participants 3 messages Jul 30, 2010 – Aug 10, 2010 Xen hypervisor interface

lore
Share & tools
lore

Wei Wang2

author
#0 lore raw

PATCH 2/2 xenoprofile: Add IBS support

Patch for dom0.

Signature · 11 lines
AMD GmbH, Germany
Operating System Research Center

Legal Information:
Advanced Micro Devices GmbH
Karl-Hammerschmidt-Str. 34
85609 Dornach b. München

Geschäftsführer: Andrew Bowd, Thomas M. McCoy, Giuliano Meroni
Sitz: Dornach, Gemeinde Aschheim, Landkreis München
Registergericht München, HRB Nr. 43632
arch/i386/oprofile/op_counter.h +11 -0
index 2880b15..11e9c00 100644
@@ -26,4 +26,15 @@ struct op_counter_config {
 
 extern struct op_counter_config counter_config[];
 
+/* AMD IBS configuration */
+struct op_ibs_config {
+    unsigned long op_enabled;
+    unsigned long fetch_enabled;
+    unsigned long max_cnt_fetch;
+    unsigned long max_cnt_op;
+    unsigned long rand_en;
+    unsigned long dispatched_ops;
+};
+
+extern struct op_ibs_config ibs_config;
 #endif /* OP_COUNTER_H */
arch/i386/oprofile/xenoprof.c +46 -1

83 lines not on this page · raw message

drivers/oprofile/buffer_sync.c +65 -1

89 lines not on this page · raw message

drivers/oprofile/cpu_buffer.c +4 -1
index 58a9c18..7c6deb5 100644
@@ -201,7 +201,10 @@ static int log_sample(struct oprofile_cpu_buffer * cpu_buf, unsigned long pc,
 		cpu_buf->last_task = task;
 		add_code(cpu_buf, (unsigned long)task);
 	}
- 
+
+	if (pc == IBS_FETCH_CODE || pc == IBS_OP_CODE)
+		add_code(cpu_buf, cpu_mode);
+
 	add_sample(cpu_buf, pc, event);
 	return 1;
 }
drivers/oprofile/event_buffer.h +2 -0
index 6a88788..270868b 100644
@@ -36,6 +36,8 @@ void wake_up_buffer_waiter(void);
 #define TRACE_END_CODE			9
 #define XEN_ENTER_SWITCH_CODE		10
 #define DOMAIN_SWITCH_CODE		11
+#define IBS_FETCH_CODE			13
+#define IBS_OP_CODE				14
  
 #define INVALID_COOKIE ~0UL
 #define NO_COOKIE 0UL
drivers/oprofile/oprofile_files.c +1 -1
index 6719420..bd3afc0 100644
@@ -21,7 +21,7 @@
 #include "oprof.h"
 
 unsigned long fs_buffer_size = 131072;
-unsigned long fs_cpu_buffer_size = 8192;
+unsigned long fs_cpu_buffer_size = 131072;
 unsigned long fs_buffer_watershed = 32768; /* FIXME: tune */
 
 static ssize_t depth_read(struct file * file, char __user * buf, size_t count, loff_t * offset)
drivers/xen/xenoprof/xenoprofile.c +0 -0
include/xen/interface/xenoprof.h +15 -2
index 183078d..451b867 100644
@@ -50,7 +50,11 @@
 #define XENOPROF_shutdown           13
 #define XENOPROF_get_buffer         14
 #define XENOPROF_set_backtrace      15
-#define XENOPROF_last_op            15
+/* AMD IBS support */
+#define XENOPROF_get_ibs_caps       16
+#define XENOPROF_ibs_counter        17
+
+#define XENOPROF_last_op            17
 
 #define MAX_OPROF_EVENTS    32
 #define MAX_OPROF_DOMAINS   25
@@ -124,7 +128,16 @@ typedef struct xenoprof_passive {
 } xenoprof_passive_t;
 DEFINE_XEN_GUEST_HANDLE(xenoprof_passive_t);
 
-
+struct xenoprof_ibs_counter {
+    uint64_t op_enabled;
+    uint64_t fetch_enabled;
+    uint64_t max_cnt_fetch;
+    uint64_t max_cnt_op;
+    uint64_t rand_en;
+    uint64_t dispatched_ops;
+};
+typedef struct xenoprof_ibs_counter xenoprof_ibs_counter_t;
+DEFINE_XEN_GUEST_HANDLE(xenoprof_ibs_counter_t);
 #endif /* __XEN_PUBLIC_XENOPROF_H__ */
 
 /*

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel

#1 lore raw

drivers/oprofile/oprofile_files.c line 24

Quoted 9 lines
Quoted 1 line
Quoted 1 line · On 30.07.10 at 15:28, Wei Wang2 <[email protected]> wrote:
drivers/oprofile/oprofile_files.c +1 -1
@@ -21,7 +21,7 @@
 #include "oprof.h"
 
 unsigned long fs_buffer_size = 131072;
-unsigned long fs_cpu_buffer_size = 8192;
+unsigned long fs_cpu_buffer_size = 131072;

Why is this needed at all, why this much of an increase, and why not conditional upon CONFIG_XEN?

Jan

author
#2 lore raw
Quoted 7 lines · On Monday 09 August 2010 13:41:11 Jan Beulich wrote:
Quoted 7 lines
Quoted 1 line
Quoted 1 line · On 30.07.10 at 15:28, Wei Wang2 <[email protected]> wrote:
drivers/oprofile/oprofile_files.c +0 -0
@@ -21,7 +21,7 @@
 #include "oprof.h"
 
Quoted 8 lines

drivers/oprofile/oprofile_files.c line 24

Quoted 3 lines
drivers/oprofile/oprofile_files.c +1 -1
 unsigned long fs_buffer_size = 131072;
-unsigned long fs_cpu_buffer_size = 8192;
+unsigned long fs_cpu_buffer_size = 131072;

Why is this needed at all, why this much of an increase, and why not conditional upon CONFIG_XEN?

Jan

Hi Jan
I had observed over 50% samples lose using following configuration:
opcontrol --start --event=IBS_OP_ALL:50000 --no-vmlinux
if fs_cpu_buffer_size = 8192. The same issue was also seen on native 2.6.34 kernel. In my case, extending fs_cpu_buffer_size or increasing sampling period can fix this issue.

Since each IBS_OP sample will occupy 14 entries in cpu buffer compared with only 1 entry for event-based sample, I suspect that the default size of per-cpu buffer would not be enough for IBS_OP mode in minimum sampling period (50000). I simply extended fs_cpu_buffer_size just to make sure it works for current userland tools. If we intent to force a longer minimum sampling period for IBS_OP_ALL in future release of tools, we could keep fs_cpu_buffer_size = 8192.

Thanks,
Wei