[LTP] [RFC PATCH v2 3/7] m4: Remove check for struct perf_event_attr
Petr Vorel
pvorel@suse.cz
Wed Jan 26 13:35:43 CET 2022
It was added by Ingo Molnar in 2009 to perf_event_open01.c after his
change to in v2.6.32-rc1 cdd6c482c9ff ("perf: Do the big rename:
Performance Counters -> Performance Events"), where he renamed struct
perf_counter_attr to struct perf_event_attr and rename header where
defined from include/linux/perf_counter.h to include/linux/perf_event.h.
It was safe to remove the check long time ago. Not checking for
linux/perf_event.h because although we check for some kernel headers
presence, we expect kernel headers to be installed.
Signed-off-by: Petr Vorel <pvorel@suse.cz>
---
New in v2
configure.ac | 1 -
m4/ltp-perf_event_open.m4 | 16 ----------------
testcases/cve/cve-2015-3290.c | 7 ++++---
.../syscalls/perf_event_open/perf_event_open01.c | 16 ++--------------
.../syscalls/perf_event_open/perf_event_open02.c | 8 +-------
.../syscalls/perf_event_open/perf_event_open03.c | 7 +------
6 files changed, 8 insertions(+), 47 deletions(-)
delete mode 100644 m4/ltp-perf_event_open.m4
diff --git a/configure.ac b/configure.ac
index 8becd74c2c..6ff761837a 100644
--- a/configure.ac
+++ b/configure.ac
@@ -376,7 +376,6 @@ fi
AC_DEFINE_UNQUOTED(NUMA_ERROR_MSG, ["$numa_error_msg"], [Error message when no NUMA support])
-LTP_CHECK_SYSCALL_PERF_EVENT_OPEN
LTP_CHECK_SYSCALL_SIGNALFD
LTP_CHECK_SYSCALL_UTIMENSAT
LTP_CHECK_TASKSTATS
diff --git a/m4/ltp-perf_event_open.m4 b/m4/ltp-perf_event_open.m4
deleted file mode 100644
index 6966cf2708..0000000000
--- a/m4/ltp-perf_event_open.m4
+++ /dev/null
@@ -1,16 +0,0 @@
-dnl SPDX-License-Identifier: GPL-2.0-or-later
-dnl Copyright (c) 2014 Fujitsu Ltd.
-dnl Copyright (c) 2014 Cyril Hrubis <chrubis@suse.cz>
-dnl Author: Xiaoguang Wang <wangxg.fnst@cn.fujitsu.com>
-
-AC_DEFUN([LTP_CHECK_SYSCALL_PERF_EVENT_OPEN],[
-AH_TEMPLATE(HAVE_PERF_EVENT_ATTR,
-[Define to 1 if you have struct perf_event_attr])
-AC_MSG_CHECKING([for perf_event_attr in linux/perf_event.h])
-AC_TRY_COMPILE([#include <unistd.h>
- #include <linux/perf_event.h>],
- [
- struct perf_event_attr pe;
- ],
- AC_DEFINE(HAVE_PERF_EVENT_ATTR) AC_MSG_RESULT(yes), AC_MSG_RESULT(no))
-])
diff --git a/testcases/cve/cve-2015-3290.c b/testcases/cve/cve-2015-3290.c
index 6c4fd57acc..fd1abe136d 100644
--- a/testcases/cve/cve-2015-3290.c
+++ b/testcases/cve/cve-2015-3290.c
@@ -1,6 +1,7 @@
// SPDX-License-Identifier: GPL-2.0-or-later
/*
* Copyright (c) 2017 Pavel Boldin <pboldin@cloudlinux.com>
+ * Copyright (c) 2018-2022 Linux Test Project
*/
/*
@@ -117,7 +118,7 @@ perhaps unsurprisingly.)
#include "tst_test.h"
#include "tst_timer.h"
-#if HAVE_PERF_EVENT_ATTR && (defined(__x86_64__) || defined(__i386__))
+#if defined(__x86_64__) || defined(__i386__)
#include <stdlib.h>
#include <stdio.h>
@@ -476,8 +477,8 @@ static struct tst_test test = {
}
};
-#else /* HAVE_PERF_EVENT_ATTR && (defined(__x86_64__) || defined(__i386__)) */
+#else /* defined(__x86_64__) || defined(__i386__) */
-TST_TEST_TCONF("no perf_event_attr or not (i386 or x86_64)");
+TST_TEST_TCONF("not (i386 or x86_64)");
#endif
diff --git a/testcases/kernel/syscalls/perf_event_open/perf_event_open01.c b/testcases/kernel/syscalls/perf_event_open/perf_event_open01.c
index 3807b2df10..30c0d7594f 100644
--- a/testcases/kernel/syscalls/perf_event_open/perf_event_open01.c
+++ b/testcases/kernel/syscalls/perf_event_open/perf_event_open01.c
@@ -1,6 +1,7 @@
/******************************************************************************/
/* */
/* Ingo Molnar <mingo@elte.hu>, 2009 */
+/* Copyright (c) Linux Test Project, 2014-2022 */
/* */
/* This program is free software; you can redistribute it and/or modify */
/* it under the terms of the GNU General Public License as published by */
@@ -38,9 +39,7 @@
#include <fcntl.h>
#include <stdint.h>
#include "config.h"
-#if HAVE_PERF_EVENT_ATTR
-# include <linux/perf_event.h>
-#endif
+#include <linux/perf_event.h>
#include "test.h"
#include "lapi/syscalls.h"
@@ -48,7 +47,6 @@
char *TCID = "perf_event_open01";
-#if HAVE_PERF_EVENT_ATTR
static void setup(void);
static void cleanup(void);
@@ -198,13 +196,3 @@ static void verify(struct test_case_t *tc)
static void cleanup(void)
{
}
-
-#else
-
-int main(void)
-{
- tst_brkm(TCONF, NULL, "This system doesn't have "
- "header file:<linux/perf_event.h> or "
- "no struct perf_event_attr defined");
-}
-#endif
diff --git a/testcases/kernel/syscalls/perf_event_open/perf_event_open02.c b/testcases/kernel/syscalls/perf_event_open/perf_event_open02.c
index 0335a296e8..618a270160 100644
--- a/testcases/kernel/syscalls/perf_event_open/perf_event_open02.c
+++ b/testcases/kernel/syscalls/perf_event_open/perf_event_open02.c
@@ -1,7 +1,7 @@
// SPDX-License-Identifier: GPL-2.0-or-later
/*
* Copyright (c) 2009 Paul Mackerras <paulus@samba.org>
- * Copyright (c) 2019 Linux Test Project
+ * Copyright (c) 2014-2022 Linux Test Project
*/
/*
* Here's a little test program that checks whether software counters
@@ -45,7 +45,6 @@
#include "lapi/cpuset.h"
#include "lapi/syscalls.h"
-#if HAVE_PERF_EVENT_ATTR
#include "perf_event_open.h"
#define MAX_CTRS 1000
@@ -336,8 +335,3 @@ static struct tst_test test = {
.test_all = verify,
.needs_root = 1,
};
-
-#else /* HAVE_PERF_EVENT_ATTR */
-TST_TEST_TCONF("This system doesn't have <linux/perf_event.h> or "
- "struct perf_event_attr is not defined.");
-#endif
diff --git a/testcases/kernel/syscalls/perf_event_open/perf_event_open03.c b/testcases/kernel/syscalls/perf_event_open/perf_event_open03.c
index f58bea79e8..dcb7096277 100644
--- a/testcases/kernel/syscalls/perf_event_open/perf_event_open03.c
+++ b/testcases/kernel/syscalls/perf_event_open/perf_event_open03.c
@@ -1,6 +1,7 @@
// SPDX-License-Identifier: GPL-2.0-or-later
/*
* Copyright (c) 2021 SUSE LLC <mdoucha@suse.cz>
+ * Copyright (c) 2022 Linux Test Project
*
* CVE-2020-25704
*
@@ -17,7 +18,6 @@
#include "tst_test.h"
#include "lapi/syscalls.h"
-#if HAVE_PERF_EVENT_ATTR
#include "perf_event_open.h"
#define INTEL_PT_PATH "/sys/bus/event_source/devices/intel_pt/type"
@@ -77,8 +77,3 @@ static struct tst_test test = {
{}
}
};
-
-#else /* HAVE_PERF_EVENT_ATTR */
-TST_TEST_TCONF("This system doesn't have <linux/perf_event.h> or "
- "struct perf_event_attr is not defined.");
-#endif
--
2.34.1
More information about the ltp
mailing list