RFC ARM: Add a generic macro for declaring proc_info structs
Get series with b4
b4 am [email protected]Versions newest first
- v1 RFC Latest0 of 2 patches 0 repliesNew
Patches in v1 No applies recorded yet
None of the 2 patches the cover letter announces are in this archive.
Reviews trailers per patch
No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.
Cover letter [RFC PATCH 0/2] ARM: Add a generic macro for declaring proc_info structs
Quoted 59 lines · Russell King - ARM Linux
Quoted 12 lines · Russell King - ARM Linux
Quoted 10 lines · Dave Martin
Quoted 3 lines · Russell King - ARM Linux
It does look very much like a sledge hammer to me. All we're really after is whether the size of the region is what we expect it to be - which will tell us whether there's a T2 instruction in there.
True, although the intent was no to solve just that one problem, but to show how to avoid a whole variety of trivial mistakes. Since
proc_infostructs don't tend to get changed much after they're initially written, I guess that such mistakes don't actually occur very often, though.Quoted 8 lines
We have several other structures encoded in assembly - and to do this for every one would be excessive. The amount of churn produced too would be large.
Historically we've had little problem with these structs being wrong - about once or twice pre-Thumb for a decade IIRC (where at least one was down to "using an old patch but didn't update it properly for the new proc-*.S files".)
What may be worth doing is something like this, where all entries follow a well defined naming scheme:
.macro
processor_functions, name, dabort, pabort, suspend, nommu
.type \name\()_processor_functions, #object
ENTRY(\name\()_processor_functions).word \dabort\()_abort .word \pabort\()_pabort .word cpu_\name\()_proc_init .word cpu_\name\()_proc_fin .word cpu_\name\()_reset .word cpu_\name\()_do_idle .word cpu_\name\()_dcache_clean_area .word cpu_\name\()_switch_mm .ifne \nommu .word 0 .else .word cpu_\name\()_set_pte_ext .endif .ifne \suspend .word cpu_\name\()_suspend_size .word cpu_\name\()_do_suspend .word cpu_\name\()_do_resume .else .word 0 .word 0 .word 0 .endif .size \name\()_processor_functions, . - \name\()_processor_functions .endmand this has great value to ensuring that the structure in assembly matches what is in the headers as it means that instead of having N places to update these structures, we're down to its header and one macro - and also ensures that proc files which miss out on the update won't link to an apparantly working kernel.
Quoted 6 lines
The cache and tlb structures follow a very similar naming scheme to the above.
The
proc_infostructures are much harder to deal with because they don't contain such commonality, but I'm sure it may be possible to come up with something along these lines.
Hmmm, that could be quite a nice approach.
I guess it's not urgent, but I'll have a think about it and maybe propose a patch for just one of the structures initially, to see what it looks like.
Using macros such as you suggest would force a consistent naming on different CPUs' helper functions, which actually seems rather a good thing. A possible downside is that the relationship between those functions and the macro becomes invisible in proc-*.S (though a very brief comment or two could easibly address that).
Cheers
---Dave