Commit 027440b
perf/x86/core: Refactor hw->idx checks and cleanup
For intel_pmu_en/disable_event(), reorder the branches checks for hw->idx
and make them sorted by probability: gp,fixed,bts,others.
Clean up the x86_assign_hw_event() by converting multiple if-else
statements to a switch statement.
To skip x86_perf_event_update() and x86_perf_event_set_period(),
it's generic to replace "idx == INTEL_PMC_IDX_FIXED_BTS" check with
'!hwc->event_base' because that should be 0 for all non-gp/fixed cases.
Wrap related bit operations into intel_set/clear_masks() and make the main
path more cleaner and readable.
No functional changes.
Signed-off-by: Like Xu <like.xu@linux.intel.com>
Original-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Link: https://lkml.kernel.org/r/20200613080958.132489-3-like.xu@linux.intel.com1 parent 3cb9d54 commit 027440b
2 files changed
+62
-48
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
71 | 71 | | |
72 | 72 | | |
73 | 73 | | |
74 | | - | |
75 | 74 | | |
76 | 75 | | |
77 | | - | |
| 76 | + | |
78 | 77 | | |
79 | 78 | | |
80 | 79 | | |
| |||
1097 | 1096 | | |
1098 | 1097 | | |
1099 | 1098 | | |
| 1099 | + | |
1100 | 1100 | | |
1101 | | - | |
| 1101 | + | |
1102 | 1102 | | |
1103 | 1103 | | |
1104 | 1104 | | |
1105 | | - | |
| 1105 | + | |
| 1106 | + | |
1106 | 1107 | | |
1107 | 1108 | | |
1108 | | - | |
| 1109 | + | |
| 1110 | + | |
| 1111 | + | |
1109 | 1112 | | |
1110 | | - | |
1111 | | - | |
1112 | | - | |
| 1113 | + | |
| 1114 | + | |
| 1115 | + | |
| 1116 | + | |
| 1117 | + | |
| 1118 | + | |
1113 | 1119 | | |
1114 | 1120 | | |
1115 | 1121 | | |
| 1122 | + | |
1116 | 1123 | | |
1117 | 1124 | | |
1118 | 1125 | | |
| |||
1233 | 1240 | | |
1234 | 1241 | | |
1235 | 1242 | | |
1236 | | - | |
| 1243 | + | |
1237 | 1244 | | |
1238 | 1245 | | |
1239 | 1246 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2136 | 2136 | | |
2137 | 2137 | | |
2138 | 2138 | | |
2139 | | - | |
| 2139 | + | |
| 2140 | + | |
| 2141 | + | |
| 2142 | + | |
| 2143 | + | |
| 2144 | + | |
| 2145 | + | |
| 2146 | + | |
| 2147 | + | |
| 2148 | + | |
| 2149 | + | |
| 2150 | + | |
| 2151 | + | |
| 2152 | + | |
| 2153 | + | |
| 2154 | + | |
| 2155 | + | |
| 2156 | + | |
2140 | 2157 | | |
| 2158 | + | |
| 2159 | + | |
| 2160 | + | |
| 2161 | + | |
| 2162 | + | |
| 2163 | + | |
| 2164 | + | |
| 2165 | + | |
| 2166 | + | |
| 2167 | + | |
2141 | 2168 | | |
2142 | 2169 | | |
2143 | 2170 | | |
| |||
2148 | 2175 | | |
2149 | 2176 | | |
2150 | 2177 | | |
2151 | | - | |
2152 | | - | |
2153 | | - | |
2154 | | - | |
2155 | | - | |
2156 | 2178 | | |
2157 | 2179 | | |
2158 | 2180 | | |
2159 | | - | |
| 2181 | + | |
2160 | 2182 | | |
2161 | | - | |
| 2183 | + | |
| 2184 | + | |
| 2185 | + | |
| 2186 | + | |
| 2187 | + | |
| 2188 | + | |
| 2189 | + | |
2162 | 2190 | | |
2163 | 2191 | | |
2164 | | - | |
2165 | 2192 | | |
2166 | 2193 | | |
2167 | | - | |
2168 | | - | |
2169 | | - | |
2170 | | - | |
2171 | | - | |
2172 | | - | |
2173 | | - | |
2174 | | - | |
2175 | | - | |
2176 | 2194 | | |
2177 | 2195 | | |
2178 | 2196 | | |
| |||
2238 | 2256 | | |
2239 | 2257 | | |
2240 | 2258 | | |
2241 | | - | |
2242 | | - | |
2243 | | - | |
2244 | | - | |
2245 | | - | |
2246 | | - | |
2247 | | - | |
2248 | | - | |
2249 | | - | |
2250 | | - | |
2251 | | - | |
2252 | | - | |
2253 | | - | |
2254 | | - | |
2255 | | - | |
2256 | | - | |
2257 | | - | |
| 2259 | + | |
2258 | 2260 | | |
2259 | 2261 | | |
2260 | 2262 | | |
2261 | 2263 | | |
2262 | | - | |
| 2264 | + | |
| 2265 | + | |
| 2266 | + | |
| 2267 | + | |
| 2268 | + | |
2263 | 2269 | | |
2264 | | - | |
| 2270 | + | |
| 2271 | + | |
| 2272 | + | |
| 2273 | + | |
2265 | 2274 | | |
2266 | | - | |
2267 | | - | |
2268 | 2275 | | |
2269 | 2276 | | |
2270 | 2277 | | |
| |||
0 commit comments