diff options
| author | Michael Ellerman <michael@ellerman.id.au> | 2013-05-15 16:19:30 -0400 |
|---|---|---|
| committer | Benjamin Herrenschmidt <benh@kernel.crashing.org> | 2013-05-31 18:29:29 -0400 |
| commit | cbda6aa10bd2d97e38f4d26a03a0b2183ad580ba (patch) | |
| tree | 17a5e32e8e24b61f4314ea19d39ae93440727754 | |
| parent | 858957ab1e3a7ee29ed40309bdf0f1b7bcf5bf30 (diff) | |
powerpc/perf: Revert to original NO_SIPR logic
This is a revert and then some of commit 860aad7 "Add regs_no_sipr()".
This workaround was only needed on early chip versions.
As before NO_SIPR becomes a static flag of the PMU struct.
Signed-off-by: Michael Ellerman <michael@ellerman.id.au>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
| -rw-r--r-- | arch/powerpc/perf/core-book3s.c | 30 |
1 files changed, 6 insertions, 24 deletions
diff --git a/arch/powerpc/perf/core-book3s.c b/arch/powerpc/perf/core-book3s.c index 426180b84978..b2f873bc891b 100644 --- a/arch/powerpc/perf/core-book3s.c +++ b/arch/powerpc/perf/core-book3s.c | |||
| @@ -110,7 +110,7 @@ static inline void power_pmu_bhrb_read(struct cpu_hw_events *cpuhw) {} | |||
| 110 | 110 | ||
| 111 | static bool regs_use_siar(struct pt_regs *regs) | 111 | static bool regs_use_siar(struct pt_regs *regs) |
| 112 | { | 112 | { |
| 113 | return !!(regs->result & 1); | 113 | return !!regs->result; |
| 114 | } | 114 | } |
| 115 | 115 | ||
| 116 | /* | 116 | /* |
| @@ -181,11 +181,6 @@ static bool regs_sipr(struct pt_regs *regs) | |||
| 181 | return !!(regs->dsisr & sipr); | 181 | return !!(regs->dsisr & sipr); |
| 182 | } | 182 | } |
| 183 | 183 | ||
| 184 | static bool regs_no_sipr(struct pt_regs *regs) | ||
| 185 | { | ||
| 186 | return !!(regs->result & 2); | ||
| 187 | } | ||
| 188 | |||
| 189 | static inline u32 perf_flags_from_msr(struct pt_regs *regs) | 184 | static inline u32 perf_flags_from_msr(struct pt_regs *regs) |
| 190 | { | 185 | { |
| 191 | if (regs->msr & MSR_PR) | 186 | if (regs->msr & MSR_PR) |
| @@ -208,7 +203,7 @@ static inline u32 perf_get_misc_flags(struct pt_regs *regs) | |||
| 208 | * SIAR which should give slightly more reliable | 203 | * SIAR which should give slightly more reliable |
| 209 | * results | 204 | * results |
| 210 | */ | 205 | */ |
| 211 | if (regs_no_sipr(regs)) { | 206 | if (ppmu->flags & PPMU_NO_SIPR) { |
| 212 | unsigned long siar = mfspr(SPRN_SIAR); | 207 | unsigned long siar = mfspr(SPRN_SIAR); |
| 213 | if (siar >= PAGE_OFFSET) | 208 | if (siar >= PAGE_OFFSET) |
| 214 | return PERF_RECORD_MISC_KERNEL; | 209 | return PERF_RECORD_MISC_KERNEL; |
| @@ -239,22 +234,9 @@ static inline void perf_read_regs(struct pt_regs *regs) | |||
| 239 | int use_siar; | 234 | int use_siar; |
| 240 | 235 | ||
| 241 | regs->dsisr = mmcra; | 236 | regs->dsisr = mmcra; |
| 242 | regs->result = 0; | ||
| 243 | |||
| 244 | if (ppmu->flags & PPMU_NO_SIPR) | ||
| 245 | regs->result |= 2; | ||
| 246 | |||
| 247 | /* | ||
| 248 | * On power8 if we're in random sampling mode, the SIER is updated. | ||
| 249 | * If we're in continuous sampling mode, we don't have SIPR. | ||
| 250 | */ | ||
| 251 | if (ppmu->flags & PPMU_HAS_SIER) { | ||
| 252 | if (marked) | ||
| 253 | regs->dar = mfspr(SPRN_SIER); | ||
| 254 | else | ||
| 255 | regs->result |= 2; | ||
| 256 | } | ||
| 257 | 237 | ||
| 238 | if (ppmu->flags & PPMU_HAS_SIER) | ||
| 239 | regs->dar = mfspr(SPRN_SIER); | ||
| 258 | 240 | ||
| 259 | /* | 241 | /* |
| 260 | * If this isn't a PMU exception (eg a software event) the SIAR is | 242 | * If this isn't a PMU exception (eg a software event) the SIAR is |
| @@ -279,12 +261,12 @@ static inline void perf_read_regs(struct pt_regs *regs) | |||
| 279 | use_siar = 1; | 261 | use_siar = 1; |
| 280 | else if ((ppmu->flags & PPMU_NO_CONT_SAMPLING)) | 262 | else if ((ppmu->flags & PPMU_NO_CONT_SAMPLING)) |
| 281 | use_siar = 0; | 263 | use_siar = 0; |
| 282 | else if (!regs_no_sipr(regs) && regs_sipr(regs)) | 264 | else if (!(ppmu->flags & PPMU_NO_SIPR) && regs_sipr(regs)) |
| 283 | use_siar = 0; | 265 | use_siar = 0; |
| 284 | else | 266 | else |
| 285 | use_siar = 1; | 267 | use_siar = 1; |
| 286 | 268 | ||
| 287 | regs->result |= use_siar; | 269 | regs->result = use_siar; |
| 288 | } | 270 | } |
| 289 | 271 | ||
| 290 | /* | 272 | /* |
