diff options
Diffstat (limited to 'arch/powerpc/perf/core-book3s.c')
| -rw-r--r-- | arch/powerpc/perf/core-book3s.c | 12 | 
1 files changed, 8 insertions, 4 deletions
| diff --git a/arch/powerpc/perf/core-book3s.c b/arch/powerpc/perf/core-book3s.c index 9e3da168d54c..fce545774d50 100644 --- a/arch/powerpc/perf/core-book3s.c +++ b/arch/powerpc/perf/core-book3s.c @@ -410,8 +410,12 @@ static __u64 power_pmu_bhrb_to(u64 addr)  	int ret;  	__u64 target; -	if (is_kernel_addr(addr)) -		return branch_target((unsigned int *)addr); +	if (is_kernel_addr(addr)) { +		if (probe_kernel_read(&instr, (void *)addr, sizeof(instr))) +			return 0; + +		return branch_target(&instr); +	}  	/* Userspace: need copy instruction here then translate it */  	pagefault_disable(); @@ -1415,7 +1419,7 @@ static int collect_events(struct perf_event *group, int max_count,  	int n = 0;  	struct perf_event *event; -	if (!is_software_event(group)) { +	if (group->pmu->task_ctx_nr == perf_hw_context) {  		if (n >= max_count)  			return -1;  		ctrs[n] = group; @@ -1423,7 +1427,7 @@ static int collect_events(struct perf_event *group, int max_count,  		events[n++] = group->hw.config;  	}  	list_for_each_entry(event, &group->sibling_list, group_entry) { -		if (!is_software_event(event) && +		if (event->pmu->task_ctx_nr == perf_hw_context &&  		    event->state != PERF_EVENT_STATE_OFF) {  			if (n >= max_count)  				return -1; |