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: <573aeaa2-f99b-47fb-b9ac-1439f601e7e7@amd.com>
Date: Wed, 30 Apr 2025 23:15:52 +0530
From: Ravi Bangoria <ravi.bangoria@....com>
To: Namhyung Kim <namhyung@...nel.org>
Cc: Ingo Molnar <mingo@...hat.com>, Arnaldo Carvalho de Melo
 <acme@...nel.org>, Peter Zijlstra <peterz@...radead.org>,
 Joe Mario <jmario@...hat.com>, Stephane Eranian <eranian@...gle.com>,
 Jiri Olsa <jolsa@...nel.org>, Ian Rogers <irogers@...gle.com>,
 Kan Liang <kan.liang@...ux.intel.com>, linux-kernel@...r.kernel.org,
 linux-perf-users@...r.kernel.org, Santosh Shukla <santosh.shukla@....com>,
 Ananth Narayan <ananth.narayan@....com>, Sandipan Das
 <sandipan.das@....com>, Ravi Bangoria <ravi.bangoria@....com>
Subject: Re: [PATCH v4 1/4] perf amd ibs: Add Load Latency bits in raw dump

Hi Namhyung,

>> +	# perf record -e ibs_op/ldlat=128/ -c 100000 -a
>> +
>> +	Supported load latency threshold values are 128 to 2048 (both inclusive).
> 
> What happens if user gives an out of range value?

Kernel returns error.

>>  static void pr_ibs_op_ctl(union ibs_op_ctl reg)
>>  {
>>  	char l3_miss_only[sizeof(" L3MissOnly _")] = "";
>> +	char ldlat[sizeof(" LdLatThrsh __ LdLatEn _")] = "";
> 
> Shouldn't it reserve 4 characters for the threshold since it can be up
> to 2048?

This function dumps HW register content. IBS_OP_CTL[LdLatThrsh] is a
4 bit field which should be programmed as:

  (actual threshold / 128) - 1

Valid values for LdLatThrsh are 0 to 15.

>>  	if (zen4_ibs_extensions)
>>  		snprintf(l3_miss_only, sizeof(l3_miss_only), " L3MissOnly %d", reg.l3_miss_only);
>>  
>> -	printf("ibs_op_ctl:\t%016llx MaxCnt %9d%s En %d Val %d CntCtl %d=%s CurCnt %9d\n",
>> +	if (ldlat_cap) {
>> +		snprintf(ldlat, sizeof(ldlat), " LdLatThrsh %2d LdLatEn %d",
> 
> Here, it would be %4d.

Since the valid values for LdLatThrsh are 0 to 15, two characters are
sufficient.

Thanks,
Ravi

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ