Skip to contentSkip to conversation

powerpc/perf: use is_kernel_addr macro in perf_get_misc_flags()

PATCH Applied Madhavan Srinivasan 3 participants 4 messages Dec 24, 2016 – Feb 19, 2017 PowerPC

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 powerpc/perf: use is_kernel_addr macro in perf_get_misc_flags()

Cleanup to use is_kernel_addr macro.

---
 arch/powerpc/perf/core-book3s.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/powerpc/perf/core-book3s.c +1 -1
index 2cdf2647cdb0..d9c74fd1b37b 100644
@@ -243,7 +243,7 @@ static inline u32 perf_get_misc_flags(struct pt_regs *regs)
 	 */
 	if (ppmu->flags & PPMU_NO_SIPR) {
 		unsigned long siar = mfspr(SPRN_SIAR);
-		if (siar >= PAGE_OFFSET)
+		if (is_kernel_addr(siar))
 			return PERF_RECORD_MISC_KERNEL;
 		return PERF_RECORD_MISC_USER;
 	}
Signature · 1 line
2.7.4
#1 lore raw
Quoted 12 lines · Madhavan Srinivasan

Cleanup to use is_kernel_addr macro.

---
 arch/powerpc/perf/core-book3s.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/powerpc/perf/core-book3s.c +0 -0
index 2cdf2647cdb0..d9c74fd1b37b 100644

arch/powerpc/perf/core-book3s.c static inline u32 perf_get_misc_flags(struct pt_regs *regs) · line 249

Quoted 8 lines
arch/powerpc/perf/core-book3s.c +1 -1
@@ -243,7 +243,7 @@ static inline u32 perf_get_misc_flags(struct pt_regs *regs)
 	 */
 	if (ppmu->flags & PPMU_NO_SIPR) {
 		unsigned long siar = mfspr(SPRN_SIAR);
-		if (siar >= PAGE_OFFSET)
+		if (is_kernel_addr(siar))
 			return PERF_RECORD_MISC_KERNEL;
 		return PERF_RECORD_MISC_USER;
 	}

While you are at this, why not also clean up these in the xmon code as well.

arch/powerpc/xmon/xmon.c: if (sp < PAGE_OFFSET) {
arch/powerpc/xmon/xmon.c: if (lr < PAGE_OFFSET
arch/powerpc/xmon/xmon.c: } else if (lr >= PAGE_OFFSET
arch/powerpc/xmon/xmon.c: if (addr < PAGE_OFFSET)

#2 lore raw
Quoted 8 lines · Anshuman Khandual
Quoted 7 lines · Madhavan Srinivasan

Cleanup to use is_kernel_addr macro.

---
  arch/powerpc/perf/core-book3s.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
Quoted 15 lines

arch/powerpc/perf/core-book3s.c static inline u32 perf_get_misc_flags(struct pt_regs *regs) · line 249

Quoted 13 lines
arch/powerpc/perf/core-book3s.c +1 -1
index 2cdf2647cdb0..d9c74fd1b37b 100644
@@ -243,7 +243,7 @@ static inline u32 perf_get_misc_flags(struct pt_regs *regs)
  	 */
  	if (ppmu->flags & PPMU_NO_SIPR) {
  		unsigned long siar = mfspr(SPRN_SIAR);
-		if (siar >= PAGE_OFFSET)
+		if (is_kernel_addr(siar))
  			return PERF_RECORD_MISC_KERNEL;
  		return PERF_RECORD_MISC_USER;
  	}

While you are at this, why not also clean up these in the xmon code as well.

Yes. Have handled this in a separate patch.

Maddy

Quoted 4 lines

arch/powerpc/xmon/xmon.c: if (sp < PAGE_OFFSET) {
arch/powerpc/xmon/xmon.c: if (lr < PAGE_OFFSET
arch/powerpc/xmon/xmon.c: } else if (lr >= PAGE_OFFSET
arch/powerpc/xmon/xmon.c: if (addr < PAGE_OFFSET)