lkml.org 
[lkml]   [2023]   [Mar]   [3]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
SubjectRe: [PATCH 2/2] perf test: Add selftest to test IBS invocation via core pmu events
From
Hi Namhyung,

>> +static int test__ibs_via_core_pmu(struct test_suite *text __maybe_unused,
>> + int subtest __maybe_unused)
>> +{
>> + struct perf_pmu *ibs_pmu;
>> + int ret = TEST_OK;
>> + int fd, i;
>> +
>> + if (list_empty(&pmus))
>> + perf_pmu__scan(NULL);
>> +
>> + ibs_pmu = perf_pmu__find("ibs_op");
>> + if (!ibs_pmu)
>> + return TEST_SKIP;
>> +
>> + for (i = 0; i < NR_SUB_TESTS; i++) {
>> + fd = event_open(sub_tests[i].type, sub_tests[i].config);
>> + pr_debug("type: 0x%x, config: 0x%lx, fd: %d - ", sub_tests[i].type,
>> + sub_tests[i].config, fd);
>> + if ((sub_tests[i].valid && fd == -1) ||
>> + (!sub_tests[i].valid && fd > 0)) {
>> + pr_debug("Fail\n");
>> + ret = TEST_FAIL;
>
> You need to close(fd) when it's succeeded for invalid one.

Yup. Will fix it.

Thanks,
Ravi

\
 
 \ /
  Last update: 2023-03-27 00:42    [W:0.061 / U:0.072 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site