lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <a5a5d2a0-e900-6cb0-ba65-911e939dcdcb@linux.intel.com>
Date:   Mon, 17 Jul 2017 16:28:38 +0800
From:   "Jin, Yao" <yao.jin@...ux.intel.com>
To:     Jiri Olsa <jolsa@...hat.com>
Cc:     acme@...nel.org, jolsa@...nel.org, peterz@...radead.org,
        mingo@...hat.com, alexander.shishkin@...ux.intel.com,
        mpe@...erman.id.au, Linux-kernel@...r.kernel.org,
        ak@...ux.intel.com, kan.liang@...el.com, yao.jin@...el.com
Subject: Re: [PATCH v9 2/7] perf/x86/intel: Record branch type



On 7/17/2017 4:11 PM, Jiri Olsa wrote:
> On Mon, Jul 17, 2017 at 07:06:38PM +0800, Jin Yao wrote:
>
> SNIP
>
>> +#define X86_BR_TYPE_MAP_MAX	16
>> +
>> +static int
>> +common_branch_type(int type)
>> +{
>> +	int i;
>> +	const int branch_map[X86_BR_TYPE_MAP_MAX] = {
>> +		PERF_BR_CALL,		/* X86_BR_CALL */
>> +		PERF_BR_RET,		/* X86_BR_RET */
>> +		PERF_BR_SYSCALL,	/* X86_BR_SYSCALL */
>> +		PERF_BR_SYSRET,		/* X86_BR_SYSRET */
>> +		PERF_BR_UNKNOWN,	/* X86_BR_INT */
>> +		PERF_BR_UNKNOWN,	/* X86_BR_IRET */
>> +		PERF_BR_COND,		/* X86_BR_JCC */
>> +		PERF_BR_UNCOND,		/* X86_BR_JMP */
>> +		PERF_BR_UNKNOWN,	/* X86_BR_IRQ */
>> +		PERF_BR_IND_CALL,	/* X86_BR_IND_CALL */
>> +		PERF_BR_UNKNOWN,	/* X86_BR_ABORT */
>> +		PERF_BR_UNKNOWN,	/* X86_BR_IN_TX */
>> +		PERF_BR_UNKNOWN,	/* X86_BR_NO_TX */
>> +		PERF_BR_CALL,		/* X86_BR_ZERO_CALL */
>> +		PERF_BR_UNKNOWN,	/* X86_BR_CALL_STACK */
>> +		PERF_BR_IND,		/* X86_BR_IND_JMP */
>> +	};
> should the branch_map array be static? having it on stack makes
> the compiler to create it every time we call the function
>
> jirka

OK, agree to let branch_map array be static. I will add this in v10.

I'm also waiting for Peter's review comments for this patch update.

Thanks
Jin Yao

>
>> +
>> +	type >>= 2; /* skip X86_BR_USER and X86_BR_KERNEL */
>> +
>> +	if (type) {
>> +		i = __ffs(type);
>> +		if (i < X86_BR_TYPE_MAP_MAX)
>> +			return branch_map[i];
>> +	}
>> +
>> +	return PERF_BR_UNKNOWN;
>> +}
>> +
>>   /*
>>    * implement actual branch filter based on user demand.
>>    * Hardware may not exactly satisfy that request, thus
>> @@ -942,7 +987,8 @@ intel_pmu_lbr_filter(struct cpu_hw_events *cpuc)
>>   	bool compress = false;
>>   
>>   	/* if sampling all branches, then nothing to filter */
>> -	if ((br_sel & X86_BR_ALL) == X86_BR_ALL)
>> +	if (((br_sel & X86_BR_ALL) == X86_BR_ALL) &&
>> +	    ((br_sel & X86_BR_TYPE_SAVE) != X86_BR_TYPE_SAVE))
>>   		return;
>>   
>>   	for (i = 0; i < cpuc->lbr_stack.nr; i++) {
>> @@ -963,6 +1009,9 @@ intel_pmu_lbr_filter(struct cpu_hw_events *cpuc)
>>   			cpuc->lbr_entries[i].from = 0;
>>   			compress = true;
>>   		}
>> +
>> +		if ((br_sel & X86_BR_TYPE_SAVE) == X86_BR_TYPE_SAVE)
>> +			cpuc->lbr_entries[i].type = common_branch_type(type);
>>   	}
>>   
>>   	if (!compress)
>> -- 
>> 2.7.4
>>

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ