delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2015/06/23/10:18:00

X-Recipient: archive-cygwin AT delorie DOT com
DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id
:list-unsubscribe:list-subscribe:list-archive:list-post
:list-help:sender:date:from:to:subject:message-id:reply-to
:references:mime-version:content-type:in-reply-to; q=dns; s=
default; b=FJZfI/vSmAmyvvpqLjmx5JrKPu4QEmHITtN8ZQ0knewKuCnAj43MY
S0qEe7Jt9ad6RDM7EHPYzvtX0IscX4QrDa8QHYEgoafkFXorVjCXC1kOMMFjFRc0
IRvrDzi3OryJg+zUwNFREe+GNlqLvZOwEQHFn5iZQtv/bdMCRLix4w=
DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id
:list-unsubscribe:list-subscribe:list-archive:list-post
:list-help:sender:date:from:to:subject:message-id:reply-to
:references:mime-version:content-type:in-reply-to; s=default;
bh=tiHadzfLVfQtOoIIILdAWPJaj4Y=; b=hGtLa0BcQh27L/MfhNaYHSkpZci6
86m3lvfnlfxqSAUsaFJIizO7Z2kofu4KD73ZKoE4bwF5I+3w2XN7N6oLLderbvQV
neIV4DmNcRXUV9Wws/5t5O+kHWgBu/TNrU4BM8ZtajZzLdEfQaD0EwoosOV+uYxE
+YFHFMCuUJXKRgw=
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com
Authentication-Results: sourceware.org; auth=none
X-Virus-Found: No
X-Spam-SWARE-Status: No, score=-3.7 required=5.0 tests=AWL,BAYES_50,KAM_ASCII_DIVIDERS,KAM_LAZY_DOMAIN_SECURITY autolearn=no version=3.3.2
X-HELO: calimero.vinschen.de
Date: Tue, 23 Jun 2015 16:17:37 +0200
From: Corinna Vinschen <corinna-cygwin AT cygwin DOT com>
To: cygwin AT cygwin DOT com
Subject: Re: cpuinfo cache size
Message-ID: <20150623141737.GS28301@calimero.vinschen.de>
Reply-To: cygwin AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
References: <55896193 DOT 2080307 AT gmail DOT com>
MIME-Version: 1.0
In-Reply-To: <55896193.2080307@gmail.com>
User-Agent: Mutt/1.5.23 (2014-03-12)

--7l042bGvurpep9Wg
Content-Type: text/plain; charset=utf-8
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

On Jun 23 15:39, Marco Atzeri wrote:
> Hi Corinna,
>=20
> for a porting of a math lib to cygwin we are trying to obtain
> the same information of
>=20
> sysconf(_SC_LEVEL1_DCACHE_SIZE)
> sysconf(_SC_LEVEL2_CACHE_SIZE)
> sysconf(_SC_LEVEL3_CACHE_SIZE)
> sysconf(_SC_LEVEL4_CACHE_SIZE)
>=20
> but of course none of them is implemented in cygwin.
>=20
> The /proc/cpuinfo contains :
> ------------------------------------------------------------------
> [...]
> cache size      : 256 KB
> [...]
> ------------------------------------------------------------------
>=20
> Looking on the code it seems that for
>   maxe >=3D 0x80000006
>=20
> cache_size reported on cpuinfo is calculated using L1
> and immediately after overwritten with L2 value.

This seems to be right, at least partially.  Linux /proc/cpuinfo
appears to report only the size of the outmost available cache.
So if you have L1 and L2 caches, Linux reports the L2 cache size.

The problem is that the L2 cache isn't the outmost available
cache anymore these days.  On my CPU Cygwin reports 256K, which
is the size of the per-core L2 caches.  However, the shared L3 cache
has a size of 15Megs, and that's what Linux reports:

  $ grep 'cache size' /proc/cpuinfo | head -1
  cache size	: 15360 KB

Cygwin is lacking the code to fetch L3 caches and afaics, it's not
overly simple.  At least calling cpuid as for L1 and L2 caches is not
sufficient, apparently.

> Should be possible to have both info available ?
> Any idea how to obtain the other cache infos ?

Not completely.  You have to use different cpuid codes for AMD and Intel
CPUs, and you have to call cpuid multiple times to get the full info
for all L3 caches of the system's CPUs, but I'm fuzzy on the details.

Patches are certainly welcome.


Corinna

--=20
Corinna Vinschen                  Please, send mails regarding Cygwin to
Cygwin Maintainer                 cygwin AT cygwin DOT com
Red Hat

--7l042bGvurpep9Wg
Content-Type: application/pgp-signature

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2

iQIcBAEBCAAGBQJViWqBAAoJEPU2Bp2uRE+gqGQP/2eP9MSRhkiGNTCYAmbgv97u
+XbfZVXBZFKo2oVlsF9nLUXTUSAW4vqycb0/mOJiEt5HvXzhj8Lk5OMt2lQo1ZBi
pL36vm4fNOG4fL5AnpP7Ju8S2WLgjUTd+DhSHHzJaaNNe6aDxOON7XLUHo0TBFOv
AMqy7LG/ZE07nSBYMtl8MmjXKcPG1XT3Q864KOqO3UE4Uzp8K32oL9A1ceDKE2i/
TbE2+rcyzO9wnyX6IhfCIQGRuUCpMnDInudwkVqo6gdWxBTKSWtZwjlMz1+9CjSl
toArDKASLguhjCeb+BcJh+IdUf6/TYDnLxRHbwAj3HOVDbnU5h5dwA57QVO8BBw7
QbG1zxqlO1QpthKpSWgpCmJ61hB+RPqqcJ6XYh54H0WmtskmH3ojvNK8aVqxYgnE
4HOMQY3kRAp15ff8lkjk/vyl+Fuw8lHazdWY3jKJlOtvJUdqz2vFa2OZGsY9Mh4J
3BO26IWqoVNiS/hu38YznWh1nqWTnZyiFQpn3N8rO5pvd4hL1O/OsgRVn581jbqx
Wq6xcIbRE42t0tLRtXbBaUkQgE0Pk9F+TaPdIVmWjoviFuug1U6ZX9XlWOFgckJ3
aFk0zPDo3Tzyw2xSJpPZHqOBmaKDvfTgDWQ6vtVfzas8olDtHV63QIF7OTkyU+tJ
j4pZUoCMcY6B3/9RRx+m
=7XVr
-----END PGP SIGNATURE-----

--7l042bGvurpep9Wg--

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019