[PATCH] S390: Get cache information via sysconf.
Stefan Liebler
stli@linux.vnet.ibm.com
Fri Apr 24 11:17:00 GMT 2015
On 04/24/2015 10:07 AM, Andreas Krebbel wrote:
> On 04/17/2015 03:31 PM, Stefan Liebler wrote:
>> Hi,
>>
>> this patch adds support to query cache information on s390
>> via sysconf() function - e.g. with _SC_LEVEL1_ICACHE_SIZE.
>> The attributes size, linesize and assoc can be queried
>> for cache level 1 - 4 via "extract cpu attribute" instruction,
>> which was first available with z10.
>>
>> Tested on s390/s390x.
>>
>> Ok to commit?
>>
>> Bye
>> Stefan
>>
>> ---
>> 2015-04-17 Stefan Liebler <stli@linux.vnet.ibm.com>
>>
>> * sysdeps/unix/sysv/linux/s390/sysconf.c: New File.
>>
> Thanks! Just some minor nits.
>
> +static long
> +__getCacheInfo (int level, int attr, int type)
>
> Urgs camel case ;) Why to start it with __?
>
> + /* check arguments. */
> + if ((level < 1 || level > CACHE_LEVEL_MAX)
> + || (attr < CACHE_ATTR_LINESIZE || attr > CACHE_ATTR_ASSOC)
> + || (type < CACHE_TYPE_DATA || type > CACHE_TYPE_INSTRUCTION))
> + return 0L;
> +
> + /* check if ecag-instruction is available. */
> + /* ecag - extract CPU attribute (only in zarch; arch >= z10; in as 2.24) */
> + if (((GLRO (dl_hwcap) & HWCAP_S390_STFLE) == 0)
> +#if !defined __s390x__
> + || ((GLRO (dl_hwcap) & HWCAP_S390_ZARCH) == 0)
> + || ((GLRO (dl_hwcap) & HWCAP_S390_HIGH_GPRS) == 0)
> +#endif
>
> Could you please remove the superfluous brackets.
>
> + /* store facility list and check for z10.
> + (see ifunc-resolver for details) */
> ...
> + /* check cache topology, if cache is available at this level. */
> ...
> + /* get cache information for level, attribute and type. */
> ...
>
> Comments usually start with a capital letter.
>
> Perhaps this qualifies for an entry in the NEWS file?
>
> Bye,
>
> -Andreas-
>
>
Ok thanks. Here is the changed patch.
Tested on s390/s390x.
Bye
Stefan
---
2015-04-24 Stefan Liebler <stli@linux.vnet.ibm.com>
* NEWS: Mention sysconf() cache information support for s390.
* sysdeps/unix/sysv/linux/s390/sysconf.c: New File.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: sysconf_cacheinfo_24042015.patch
Type: text/x-patch
Size: 7139 bytes
Desc: not available
URL: <http://sourceware.org/pipermail/libc-alpha/attachments/20150424/c6268967/attachment.bin>
More information about the Libc-alpha
mailing list