Bug 1231 - glibc needs dcbt
Summary: glibc needs dcbt
Status: IN_PROGRESS
Alias: None
Product: Libre-SOC's first SoC
Classification: Unclassified
Component: Source Code (show other bugs)
Version: unspecified
Hardware: PC Linux
: --- enhancement
Assignee: Luke Kenneth Casson Leighton
URL:
Depends on:
Blocks:
 
Reported: 2023-12-03 09:48 GMT by Jacob Lifshay
Modified: 2023-12-03 21:41 GMT (History)
2 users (show)

See Also:
NLnet milestone: ---
total budget (EUR) for completion of task and all subtasks: 0
budget (EUR) for this task, excluding subtasks' budget: 0
parent task for budget allocation:
child tasks for budget allocation:
The table of payments (in EUR) for this task; TOML format:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Jacob Lifshay 2023-12-03 09:48:09 GMT
https://sourceware.org/git/?p=glibc.git;a=blob;f=sysdeps/powerpc/powerpc64/strlen.S;h=0d8a38b0cdc7e4582cbb1aa81b07f315a626ee35;hb=d5b411854f0a3135c931921dfa8a33af395acfd3#l104

Since both of dcbt and dcbtst are just hints, it seems easiest to just implement them as no-ops rather than try to fix glibc and probably other software that uses them since afaict all 64-bit PowerISA cpus have implemented them (and probably more, they were first introduced with PPC).

I encountered this while trying to get a statically-linked hello-world to work in bug #1228
Comment 1 Luke Kenneth Casson Leighton 2023-12-03 09:49:43 GMT
(In reply to Jacob Lifshay from comment #0)
> https://sourceware.org/git/?p=glibc.git;a=blob;f=sysdeps/powerpc/powerpc64/
> strlen.S;h=0d8a38b0cdc7e4582cbb1aa81b07f315a626ee35;
> hb=d5b411854f0a3135c931921dfa8a33af395acfd3#l104
> 
> Since both of dcbt and dcbtst are just hints, it seems easiest to just
> implement them as no-ops 

absolutely. this is exactly what microwatt does. leave it with me.
Comment 2 Luke Kenneth Casson Leighton 2023-12-03 11:32:46 GMT
commit 1e80810cfac7e2786aa5b81a92f4831dc1031ec0 (HEAD -> 1228-elf-dynamic, origin/1228-elf-dynamic)
Author: Luke Kenneth Casson Leighton <lkcl@lkcl.net>
Date:   Sun Dec 3 11:32:28 2023 +0000

    bug 1231: all dc* instructions to be treated as nop
    
    https://bugs.libre-soc.org/show_bug.cgi?id=1231#c1
Comment 3 Luke Kenneth Casson Leighton 2023-12-03 11:35:05 GMT
commit 1e80810cfac7e2786aa5b81a92f4831dc1031ec0 (HEAD -> 1228-elf-dynamic, origin/1228-elf-dynamic)
Author: Luke Kenneth Casson Leighton <lkcl@lkcl.net>
Date:   Sun Dec 3 11:32:28 2023 +0000

    bug 1231: all dc* instructions to be treated as nop
    
    https://bugs.libre-soc.org/show_bug.cgi?id=1231#c1
Comment 4 Jacob Lifshay 2023-12-03 11:45:32 GMT
(In reply to Luke Kenneth Casson Leighton from comment #3)
> commit 1e80810cfac7e2786aa5b81a92f4831dc1031ec0 (HEAD -> 1228-elf-dynamic,
> origin/1228-elf-dynamic)
> Author: Luke Kenneth Casson Leighton <lkcl@lkcl.net>
> Date:   Sun Dec 3 11:32:28 2023 +0000
> 
>     bug 1231: all dc* instructions to be treated as nop
>     
>     https://bugs.libre-soc.org/show_bug.cgi?id=1231#c1

it needs to be just dcbt and dcbtst, since some dc* instructions do have an effect even in the simulator:

dcbz -- zero block -- basically a really fast way to write zeros to memory.

our half-baked pseudocode for dcbz:
https://git.libre-soc.org/?p=openpower-isa.git;a=blob;f=openpower/isa/sprset.mdwn;hb=1d45949e369d92c0cbd41b2c247a5bae9c37e11b#l310
Comment 5 Luke Kenneth Casson Leighton 2023-12-03 17:46:36 GMT
commit 79811794450d0eb832313ed26468637da6d27f12 (HEAD -> 1228-elf-dynamic)
Author: Luke Kenneth Casson Leighton <lkcl@lkcl.net>                           Date:   Sun Dec 3 17:45:53 2023 +0000
                                                                                   bug 1228: dcbt* to match against nop, not dc* in ISACaller
Comment 6 Jacob Lifshay 2023-12-03 21:41:26 GMT
(In reply to Luke Kenneth Casson Leighton from comment #5)
> commit 79811794450d0eb832313ed26468637da6d27f12 (HEAD -> 1228-elf-dynamic)
> Author: Luke Kenneth Casson Leighton <lkcl@lkcl.net>                        
> Date:   Sun Dec 3 17:45:53 2023 +0000
>                                                                             
> bug 1228: dcbt* to match against nop, not dc* in ISACaller

Thanks! I'm leaving this bug open so we add dcbt to soc.git.