~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

TOMOYO Linux Cross Reference
Linux/tools/testing/selftests/powerpc/pmu/ebb/event_attributes_test.c

Version: ~ [ linux-6.11.5 ] ~ [ linux-6.10.14 ] ~ [ linux-6.9.12 ] ~ [ linux-6.8.12 ] ~ [ linux-6.7.12 ] ~ [ linux-6.6.58 ] ~ [ linux-6.5.13 ] ~ [ linux-6.4.16 ] ~ [ linux-6.3.13 ] ~ [ linux-6.2.16 ] ~ [ linux-6.1.114 ] ~ [ linux-6.0.19 ] ~ [ linux-5.19.17 ] ~ [ linux-5.18.19 ] ~ [ linux-5.17.15 ] ~ [ linux-5.16.20 ] ~ [ linux-5.15.169 ] ~ [ linux-5.14.21 ] ~ [ linux-5.13.19 ] ~ [ linux-5.12.19 ] ~ [ linux-5.11.22 ] ~ [ linux-5.10.228 ] ~ [ linux-5.9.16 ] ~ [ linux-5.8.18 ] ~ [ linux-5.7.19 ] ~ [ linux-5.6.19 ] ~ [ linux-5.5.19 ] ~ [ linux-5.4.284 ] ~ [ linux-5.3.18 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.322 ] ~ [ linux-4.18.20 ] ~ [ linux-4.17.19 ] ~ [ linux-4.16.18 ] ~ [ linux-4.15.18 ] ~ [ linux-4.14.336 ] ~ [ linux-4.13.16 ] ~ [ linux-4.12.14 ] ~ [ linux-4.11.12 ] ~ [ linux-4.10.17 ] ~ [ linux-4.9.337 ] ~ [ linux-4.4.302 ] ~ [ linux-3.10.108 ] ~ [ linux-2.6.32.71 ] ~ [ linux-2.6.0 ] ~ [ linux-2.4.37.11 ] ~ [ unix-v6-master ] ~ [ ccs-tools-1.8.9 ] ~ [ policy-sample ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

  1 // SPDX-License-Identifier: GPL-2.0-only
  2 /*
  3  * Copyright 2014, Michael Ellerman, IBM Corp.
  4  */
  5 
  6 #include <stdio.h>
  7 #include <stdlib.h>
  8 
  9 #include "ebb.h"
 10 
 11 
 12 /*
 13  * Test various attributes of the EBB event are enforced.
 14  */
 15 int event_attributes(void)
 16 {
 17         struct event event, leader;
 18 
 19         SKIP_IF(!ebb_is_supported());
 20 
 21         event_init(&event, 0x1001e);
 22         event_leader_ebb_init(&event);
 23         /* Expected to succeed */
 24         FAIL_IF(event_open(&event));
 25         event_close(&event);
 26 
 27 
 28         event_init(&event, 0x001e); /* CYCLES - no PMC specified */
 29         event_leader_ebb_init(&event);
 30         /* Expected to fail, no PMC specified */
 31         FAIL_IF(event_open(&event) == 0);
 32 
 33 
 34         event_init(&event, 0x2001e);
 35         event_leader_ebb_init(&event);
 36         event.attr.exclusive = 0;
 37         /* Expected to fail, not exclusive */
 38         FAIL_IF(event_open(&event) == 0);
 39 
 40 
 41         event_init(&event, 0x3001e);
 42         event_leader_ebb_init(&event);
 43         event.attr.freq = 1;
 44         /* Expected to fail, sets freq */
 45         FAIL_IF(event_open(&event) == 0);
 46 
 47 
 48         event_init(&event, 0x4001e);
 49         event_leader_ebb_init(&event);
 50         event.attr.sample_period = 1;
 51         /* Expected to fail, sets sample_period */
 52         FAIL_IF(event_open(&event) == 0);
 53 
 54 
 55         event_init(&event, 0x1001e);
 56         event_leader_ebb_init(&event);
 57         event.attr.enable_on_exec = 1;
 58         /* Expected to fail, sets enable_on_exec */
 59         FAIL_IF(event_open(&event) == 0);
 60 
 61 
 62         event_init(&event, 0x1001e);
 63         event_leader_ebb_init(&event);
 64         event.attr.inherit = 1;
 65         /* Expected to fail, sets inherit */
 66         FAIL_IF(event_open(&event) == 0);
 67 
 68 
 69         event_init(&leader, 0x1001e);
 70         event_leader_ebb_init(&leader);
 71         FAIL_IF(event_open(&leader));
 72 
 73         event_init(&event, 0x20002);
 74         event_ebb_init(&event);
 75 
 76         /* Expected to succeed */
 77         FAIL_IF(event_open_with_group(&event, leader.fd));
 78         event_close(&leader);
 79         event_close(&event);
 80 
 81 
 82         event_init(&leader, 0x1001e);
 83         event_leader_ebb_init(&leader);
 84         FAIL_IF(event_open(&leader));
 85 
 86         event_init(&event, 0x20002);
 87 
 88         /* Expected to fail, event doesn't request EBB, leader does */
 89         FAIL_IF(event_open_with_group(&event, leader.fd) == 0);
 90         event_close(&leader);
 91 
 92 
 93         event_init(&leader, 0x1001e);
 94         event_leader_ebb_init(&leader);
 95         /* Clear the EBB flag */
 96         leader.attr.config &= ~(1ull << 63);
 97 
 98         FAIL_IF(event_open(&leader));
 99 
100         event_init(&event, 0x20002);
101         event_ebb_init(&event);
102 
103         /* Expected to fail, leader doesn't request EBB */
104         FAIL_IF(event_open_with_group(&event, leader.fd) == 0);
105         event_close(&leader);
106 
107 
108         event_init(&leader, 0x1001e);
109         event_leader_ebb_init(&leader);
110         leader.attr.exclusive = 0;
111         /* Expected to fail, leader isn't exclusive */
112         FAIL_IF(event_open(&leader) == 0);
113 
114 
115         event_init(&leader, 0x1001e);
116         event_leader_ebb_init(&leader);
117         leader.attr.pinned = 0;
118         /* Expected to fail, leader isn't pinned */
119         FAIL_IF(event_open(&leader) == 0);
120 
121         event_init(&event, 0x1001e);
122         event_leader_ebb_init(&event);
123         /* Expected to fail, not a task event */
124         SKIP_IF(require_paranoia_below(1));
125         FAIL_IF(event_open_with_cpu(&event, 0) == 0);
126 
127         return 0;
128 }
129 
130 int main(void)
131 {
132         return test_harness(event_attributes, "event_attributes");
133 }
134 

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

kernel.org | git.kernel.org | LWN.net | Project Home | SVN repository | Mail admin

Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.

sflogo.php