diff mbox series

syscalls/perf_event_open01: Allow EINVAL

Message ID mvm34n6aziu.fsf@suse.de
State Accepted
Headers show
Series syscalls/perf_event_open01: Allow EINVAL | expand

Commit Message

Andreas Schwab Aug. 15, 2024, 9:47 a.m. UTC
A request for an unsupported perf event can also result in EINVAL.

Signed-off-by: Andreas Schwab <schwab@suse.de>
---
 testcases/kernel/syscalls/perf_event_open/perf_event_open01.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Petr Vorel Aug. 15, 2024, 10:15 a.m. UTC | #1
Hi Andreas,

> A request for an unsupported perf event can also result in EINVAL.

Thanks for fixing LTP!
Yes, man page mentions this.

Reviewed-by: Petr Vorel <pvorel@suse.cz>

Out of curiosity, what are you fixing?
(Which kernel, arch, which event gives that).

Kind regards,
Petr
Andreas Schwab Aug. 15, 2024, 10:26 a.m. UTC | #2
On Aug 15 2024, Petr Vorel wrote:

> Out of curiosity, what are you fixing?

perf_event_open01    1  TFAIL  :  perf_event_open01.c:156: perf_event_open PERF_COUNT_HW_INSTRUCTIONS failed unexpectedly: TEST_ERRNO=EINVAL(22): Invalid argument
Martin Doucha Aug. 15, 2024, 11:27 a.m. UTC | #3
Hi,
thanks for the patch.

Reviewed-by: Martin Doucha <mdoucha@suse.cz>

On 15. 08. 24 11:47, Andreas Schwab wrote:
> A request for an unsupported perf event can also result in EINVAL.
> 
> Signed-off-by: Andreas Schwab <schwab@suse.de>
> ---
>   testcases/kernel/syscalls/perf_event_open/perf_event_open01.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> 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 30c0d7594..86a134b51 100644
> --- a/testcases/kernel/syscalls/perf_event_open/perf_event_open01.c
> +++ b/testcases/kernel/syscalls/perf_event_open/perf_event_open01.c
> @@ -148,7 +148,7 @@ static void verify(struct test_case_t *tc)
>   	TEST(perf_event_open(&pe, 0, -1, -1, 0));
>   	if (TEST_RETURN == -1) {
>   		if (TEST_ERRNO == ENOENT || TEST_ERRNO == EOPNOTSUPP ||
> -		    TEST_ERRNO == ENODEV) {
> +		    TEST_ERRNO == ENODEV || TEST_ERRNO == EINVAL) {
>   			tst_resm(TCONF | TTERRNO,
>   			         "perf_event_open for %s not supported",
>   			         tc->config_name);
Petr Vorel Aug. 15, 2024, 1:30 p.m. UTC | #4
Hi all,

thanks, merged!

Kind regards,
Petr
diff mbox series

Patch

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 30c0d7594..86a134b51 100644
--- a/testcases/kernel/syscalls/perf_event_open/perf_event_open01.c
+++ b/testcases/kernel/syscalls/perf_event_open/perf_event_open01.c
@@ -148,7 +148,7 @@  static void verify(struct test_case_t *tc)
 	TEST(perf_event_open(&pe, 0, -1, -1, 0));
 	if (TEST_RETURN == -1) {
 		if (TEST_ERRNO == ENOENT || TEST_ERRNO == EOPNOTSUPP ||
-		    TEST_ERRNO == ENODEV) {
+		    TEST_ERRNO == ENODEV || TEST_ERRNO == EINVAL) {
 			tst_resm(TCONF | TTERRNO,
 			         "perf_event_open for %s not supported",
 			         tc->config_name);