]> bbs.cooldavid.org Git - net-next-2.6.git/commitdiff
x86/oprofile: Add counter reservation check for virtual counters
authorRobert Richter <robert.richter@amd.com>
Fri, 10 Jul 2009 16:15:21 +0000 (18:15 +0200)
committerRobert Richter <robert.richter@amd.com>
Mon, 20 Jul 2009 14:43:21 +0000 (16:43 +0200)
This patch adds a check for the availability of a counter. A virtual
counter is used only if its physical counter is not reserved.

Signed-off-by: Robert Richter <robert.richter@amd.com>
arch/x86/oprofile/nmi_int.c

index 5856e61cb098ffbdc5c86a0f645e3473d8c991bd..cb88b1a0bd5f1c2c1a9b34a6e93c33400114f4ef 100644 (file)
@@ -435,15 +435,13 @@ static int nmi_create_files(struct super_block *sb, struct dentry *root)
                struct dentry *dir;
                char buf[4];
 
-#ifndef CONFIG_OPROFILE_EVENT_MULTIPLEX
                /* quick little hack to _not_ expose a counter if it is not
                 * available for use.  This should protect userspace app.
                 * NOTE:  assumes 1:1 mapping here (that counters are organized
                 *        sequentially in their struct assignment).
                 */
-               if (unlikely(!avail_to_resrv_perfctr_nmi_bit(i)))
+               if (!avail_to_resrv_perfctr_nmi_bit(op_x86_virt_to_phys(i)))
                        continue;
-#endif /* CONFIG_OPROFILE_EVENT_MULTIPLEX */
 
                snprintf(buf,  sizeof(buf), "%d", i);
                dir = oprofilefs_mkdir(sb, root, buf);