From: "Tulio Magno Quites Machado Filho" <tuliom@linux.vnet.ibm.com>
To: pc@us.ibm.com, libc-alpha@sourceware.org
Cc: Joseph Myers <joseph@codesourcery.com>
Subject: Re: [PATCH v2] powerpc: add sysconf support for cache geometries
Date: Wed, 24 May 2017 19:41:00 -0000 [thread overview]
Message-ID: <87zie22gdr.fsf@totoro.lan> (raw)
In-Reply-To: <c38ad1df-626a-d53a-bca3-78e6e98a76b1@us.ibm.com>
Paul Clarke <pc@us.ibm.com> writes:
> There is currently no "cross-platform" (x86 and POWER) support for
> determining the cacheline size.
>
> This patch adds support to sysconf() to correctly report cacheline sizes
> based on the information in the auxilliary vector.
>
> Thus, using sysconf() is a cross-platform (x86 and POWER) solution for
> determining cacheline sizes.
>
> Support is added (on powerpc) for:
> _SC_LEVEL1_ICACHE_SIZE _SC_LEVEL1_ICACHE_ASSOC _SC_LEVEL1_ICACHE_LINESIZE
> _SC_LEVEL1_DCACHE_SIZE _SC_LEVEL1_DCACHE_ASSOC _SC_LEVEL1_DCACHE_LINESIZE
> _SC_LEVEL2_CACHE_SIZE _SC_LEVEL2_CACHE_ASSOC _SC_LEVEL2_CACHE_LINESIZE
> _SC_LEVEL3_CACHE_SIZE _SC_LEVEL3_CACHE_ASSOC _SC_LEVEL3_CACHE_LINESIZE
>
> 2017-04-28 Paul A. Clarke <pc@us.ibm.com>
>
> * sysdeps/unix/sysv/linux/powerpc/sysconf.c: New file.
> Add powerpc-specific overrides for L1, L2, L3 CACHE_SIZEs,
> CACHE_ASSOCs, and CACHE_LINESIZEs, retrieving from auxv.
> * sysdeps/unix/sysv/linux/powerpc/test-powerpc-linux-sysconf.c:
> New file. Invoke newly supported sysconf values for powerpc,
> and report results. If none are supported, report so.
> * sysdeps/unix/sysv/linux/powerpc/Makefile (tests): Add new test,
> tst-sysconf.
The patch looks good except for a small issue.
> diff --git a/sysdeps/unix/sysv/linux/powerpc/sysconf.c b/sysdeps/unix/sysv/linux/powerpc/sysconf.c
> new file mode 100644
> index 0000000..bb89933
> --- /dev/null
> +++ b/sysdeps/unix/sysv/linux/powerpc/sysconf.c
> @@ -0,0 +1,96 @@
> +/* Get system-specific information at run-time. Linux/powerpc version.
> + Copyright (C) 2017 Free Software Foundation, Inc.
> + This file is part of the GNU C Library.
> +
> + The GNU C Library is free software; you can redistribute it and/or
> + modify it under the terms of the GNU Lesser General Public
> + License as published by the Free Software Foundation; either
> + version 2.1 of the License, or (at your option) any later version.
> +
> + The GNU C Library is distributed in the hope that it will be useful,
> + but WITHOUT ANY WARRANTY; without even the implied warranty of
> + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
> + Lesser General Public License for more details.
> +
> + You should have received a copy of the GNU Lesser General Public
> + License along with the GNU C Library; if not, see
> + <http://www.gnu.org/licenses/>. */
> +
> +#include <errno.h>
> +#include <unistd.h>
> +#include <sys/auxv.h>
> +
> +static long linux_sysconf (int name);
> +
> +static long
> +auxv2sysconf (unsigned long type)
> +{
> + long rc;
> + rc = getauxval (type);
You need to bypass the PLT. The problem is that neither getauxval()
nor __getauxval() provide this for you.
I'm sending a patch to treat this.
--
Tulio Magno
next prev parent reply other threads:[~2017-05-24 19:41 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-04-28 19:15 Paul Clarke
2017-05-24 19:41 ` Tulio Magno Quites Machado Filho [this message]
2017-06-09 17:46 ` Tulio Magno Quites Machado Filho
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87zie22gdr.fsf@totoro.lan \
--to=tuliom@linux.vnet.ibm.com \
--cc=joseph@codesourcery.com \
--cc=libc-alpha@sourceware.org \
--cc=pc@us.ibm.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).