public inbox for libc-alpha@sourceware.org
 help / color / mirror / Atom feed
From: Adhemerval Zanella <adhemerval.zanella@linaro.org>
To: Shawn Landden <shawn@git.icu>,
	Florian Weimer <fweimer@redhat.com>,
	Tulio Magno Quites Machado Filho <tuliom@ascii.art.br>
Cc: "law@redhat.com" <law@redhat.com>,
	"libc-alpha@sourceware.org" <libc-alpha@sourceware.org>
Subject: Re: [PATCH] powerpc: Move cache line size to rtld_global_ro
Date: Fri, 10 Jan 2020 18:19:00 -0000	[thread overview]
Message-ID: <ae355c29-3e8e-d466-864f-26a4dcdb93d6@linaro.org> (raw)
In-Reply-To: <20359371578672582@iva2-d0266d205f48.qloud-c.yandex.net>



On 10/01/2020 13:09, Shawn Landden wrote:
> Not trying to say anything stupid, but why can't we just detect the cache line size using the "dcbz" instruction, as documented in the PowerISA document? It is because the ancient G5 also has a "dcbzl" instruction that clears a wider size (the actually cache line size)?
> 

AFAIK you can't detect the data cache block size using the dcbz instruction,
in fact PowerISA 3.0B states that this information should be provided by the
operation system (Book II, Chapter 4.1 Parameters Useful to Application
Programs).

Linux provided it by AT_DCACHEBSIZE field in auxv and it is implemented in the
kernel by a pre-defined table (arch/powerpc/kernel/cputable.c). This is how
glibc obtain such information (sysdeps/unix/sysv/linux/powerpc/dl-sysdep.c).

The issue I pointed out is for static binaries that dlopen a shared library,
mem* calls done by the library (which will call the loaded libc.so one) won't
see the field properly initialized. Some architectures fix rtld initialization
by reimplementing the _dl_static_init.  It looks up for the '_dl_var_init' and
calls it, taking care of relro segments by unmap/mmap the segment.

And the dcbzl seems to be a hack pushed by Apple for some reason, which should
not be required on Linux:

"dcbz" only operates on 32 bytes when the special HID5 compatiblity bit that 
apple added to the 970 is set. This is _NOT_ the normal case and this bit isn't 
set in linux unless you explicitely set it by modifying the kernel [1]." 

[1] https://lists.ozlabs.org/pipermail/linuxppc64-dev/2004-March/001383.html

  reply	other threads:[~2020-01-10 18:19 UTC|newest]

Thread overview: 37+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-11-21  1:19 powerpc build failure with GCC mainline -fno-common change Joseph Myers
2019-11-21  9:23 ` Andreas Schwab
2019-12-23 18:48   ` [PATCH] powerpc: Move cache line size to rtld_global_ro Tulio Magno Quites Machado Filho
2019-12-26 17:04     ` Adhemerval Zanella
2019-12-27 15:42       ` Tulio Magno Quites Machado Filho
2019-12-27 16:47         ` Adhemerval Zanella
2020-01-09 10:30           ` Florian Weimer
2020-01-09 16:43             ` Jeff Law
2020-01-09 17:20               ` Tulio Magno Quites Machado Filho
2020-01-09 18:04                 ` Adhemerval Zanella
2020-01-09 18:49                   ` Tulio Magno Quites Machado Filho
2020-01-09 18:55                     ` Adhemerval Zanella
2020-01-10 22:30                       ` [PATCH 1/2] powerpc: Initialize rtld_global_ro for static dlopen [BZ #20802] Tulio Magno Quites Machado Filho
2020-01-10 22:31                         ` [PATCH 2/2] powerpc: Move cache line size to rtld_global_ro Tulio Magno Quites Machado Filho
2020-01-16 17:47                           ` Carlos O'Donell
2020-01-17  3:57                             ` Siddhesh Poyarekar
2020-01-17 12:41                               ` Tulio Magno Quites Machado Filho
2020-01-17 17:15                                 ` Florian Weimer
2020-01-17 17:23                                 ` Joseph Myers
2020-01-17 22:54                                   ` Tulio Magno Quites Machado Filho
2020-01-17 23:50                           ` [PATCH] powerpc32: Fix syntax error in __GLRO macro Andreas Schwab
2020-01-18  1:23                             ` Tulio Magno Quites Machado Filho
2020-07-23 14:47                           ` [PATCH 2/2] powerpc: Move cache line size to rtld_global_ro Joseph Myers
2020-07-23 16:46                             ` Andreas Schwab
2020-07-31 12:42                             ` Florian Weimer
2020-07-31 18:35                               ` Joseph Myers
2020-08-03  8:15                                 ` Florian Weimer
2020-08-03 16:07                                   ` Carlos O'Donell
2020-01-16 16:26                         ` [PATCH 1/2] powerpc: Initialize rtld_global_ro for static dlopen [BZ #20802] Carlos O'Donell
2020-01-16 16:31                           ` Siddhesh Poyarekar
2020-01-09 18:56                     ` [PATCH] powerpc: Move cache line size to rtld_global_ro Tulio Magno Quites Machado Filho
2020-01-10  9:39                 ` Florian Weimer
2020-01-10 16:09                   ` Shawn Landden
2020-01-10 18:19                     ` Adhemerval Zanella [this message]
2019-11-22 16:58 ` powerpc build failure with GCC mainline -fno-common change Tulio Magno Quites Machado Filho
2019-11-23 13:24   ` Florian Weimer
2019-11-26 13:27     ` 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=ae355c29-3e8e-d466-864f-26a4dcdb93d6@linaro.org \
    --to=adhemerval.zanella@linaro.org \
    --cc=fweimer@redhat.com \
    --cc=law@redhat.com \
    --cc=libc-alpha@sourceware.org \
    --cc=shawn@git.icu \
    --cc=tuliom@ascii.art.br \
    /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).