Re: '-D' 'KBUILD_MODSYM=main - like KBUILD_MODNAME, without the quotes ?
... and somethings not right. debugger KBUILD_SYM shows it: these records are same as those shown in early boot output pasted previously these records look right (gdb) p *__start___dyndbg_sites@10 $2 = {{modname = 0x825a8ab9 "head64", filename = 0x825a8ac0 "include/linux/dynamic_debug.h", function = 0x825a8ab9 "head64"}, {modname = 0x825a8ade "ebda", filename = 0x825a8ac0 "include/linux/dynamic_debug.h", function = 0x825a8ade "ebda"}, { modname = 0x825a8ae3 "platform_quirks", filename = 0x825a8ac0 "include/linux/dynamic_debug.h", function = 0x825a8ae3 "platform_quirks"}, {modname = 0x825cac42 "main", filename = 0x825a8afe "init/main.c", function = 0x822000e0 <__func__.2> "run_init_process"}, {modname = 0x825cac42 "main", filename = 0x825a8afe "init/main.c", function = 0x822000e0 <__func__.2> "run_init_process"}, {modname = 0x825cac42 "main", filename = 0x825a8afe "init/main.c", function = 0x822000e0 <__func__.2> "run_init_process"}, {modname = 0x825cac42 "main", filename = 0x825a8afe "init/main.c", function = 0x822000e0 <__func__.2> "run_init_process"}, {modname = 0x825cac42 "main", filename = 0x825a8afe "init/main.c", function = 0x822000a0 <__func__.0> "initcall_blacklisted"}, { modname = 0x825cac42 "main", filename = 0x825a8afe "init/main.c", function = 0x822000c0 <__func__.1> "initcall_blacklist"}, { modname = 0x825cac42 "main", filename = 0x825a8ac0 "include/linux/dynamic_debug.h", function = 0x825cac42 "main"}} Theres evidently something wrong with my KBUILD_MODSYM _dyndbg_site here, the site pointers in all the headers appear the same, but maybe its just an effect of initialization, which I expect to reshape with a union - struct to use the space efficiently (gdb) p *__start___dyndbg@10 $3 = {{site = 0x82b252e8 , format = 0x825a8ab9 "head64", lineno = 0, flags = 0, module_index = 0, key = {dd_key_true = {key = {enabled = {counter = 0}, { type = 0, entries = 0x0 , next = 0x0 }}}, dd_key_false = {key = {enabled = {counter = 0}, {type = 0, entries = 0x0 , next = 0x0 }, {site = 0x82b252e8 , format = 0x825a8ade "ebda", lineno = 0, flags = 0, module_index = 0, key = {dd_key_true = { key = {enabled = {counter = 0}, {type = 0, entries = 0x0 , next = 0x0 }}}, dd_key_false = {key = {enabled = {counter = 0}, {type = 0, entries = 0x0 , next = 0x0 }, { site = 0x82b252e8 , format = 0x825a8ae3 "platform_quirks", lineno = 0, flags = 0, module_index = 0, key = {dd_key_true = {key = {enabled = {counter = 0}, { type = 0, entries = 0x0 , next = 0x0 }}}, dd_key_false = {key = {enabled = {counter = 0}, {type = 0, entries = 0x0 , next = 0x0 }, { site = 0x82b25330 <__UNIQUE_ID_ddebug468_site.13>, format = 0x82653f07 "%s\n", lineno = 1349, flags = 1, module_index = 0, key = {dd_key_true = {key = {enabled = {counter = 1}, { type = 18446744071602861249, entries = 0x826e74c1, next = 0x826e74c1}}}, dd_key_false = {key = {enabled = {counter = 1}, {type = 18446744071602861249, entries = 0x826e74c1, next = 0x826e74c1}, { site = 0x82b25348 <__UNIQUE_ID_ddebug467_site.15>, format = 0x825a8b59 " with environment:\n", lineno = 1347, flags = 1, module_index = 0, key = {dd_key_true = {key = {enabled = {counter = 1}, {type = 18446744071602861265, entries = 0x826e74d1, next = 0x826e74d1}}}, dd_key_false = {key = {enabled = { counter = 1}, {type = 18446744071602861265, entries = 0x826e74d1, next = 0x826e74d1}, {site = 0x82b25360 <__UNIQUE_ID_ddebug466_site.17>, format = 0x82653f07 "%s\n", lineno = 1346, flags = 1, module_index = 0, key = { dd_key_true = {key = {enabled = {counter = 1}, {type = 18446744071602861281, entries = 0x826e74e1, next = 0x826e74e1}}}, dd_key_false = {key = {enabled = { counter = 1}, {type = 18446744071602861281, entries = 0x826e74e1, next = 0x826e74e1}, {site = 0x82b25378 <__UNIQUE_ID_ddebug465_site.19>, format = 0x825a8b46 " with arguments:\n", lineno = 1344, flags = 1, module_index = 0, key = { dd_key_true = {key = {enabled = {counter = 1}, {type = 18446744071602861297, at any rate, I'll probly work this a bit, see if I can resolve a few problems ___ Kernelnewbies mailing list Kernelnewbies@kernelnewbies.org https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbi
Re: '-D' 'KBUILD_MODSYM=main - like KBUILD_MODNAME, without the quotes ?
On Thu, Jan 28, 2021 at 5:16 PM wrote: > > > On Thu, Jan 28, 2021 at 4:57 PM Valdis Klētnieks > wrote: > >> On Thu, 28 Jan 2021 12:11:54 -0700, jim.cro...@gmail.com said: >> >> > In my hacking, Im finding this useful. >> > it adds a version of KBUILD_MODNAME without the quotes >> >> OK, I'll bite. When and how is this useful? >> >> > Let me add more context here. 1st, the long saga. v1 - here, back in august last year. https://lore.kernel.org/kernelnewbies/20200805183023.586590-1-jim.cro...@gmail.com/ not really pertinent here. gregkh pretty much said send it to lkml v2 - RFC to LKML https://lore.kernel.org/lkml/20201225201944.3701590-1-jim.cro...@gmail.com/ this didnt get much attention, no answers to my questions the is still completely accurate, I cannot improve upon it, though many questions in the commit messages Ive answered myself. (or at least made some choices ;) v3 - sits in github now almost identical 1-16/19 with v2 https://github.com/jimc/linux.git dyndbg-next I was hoping to pull off a context-free question, focusing on just the Makefile.lib patch's suitability. I could send the whole series here, or to LKML, or both. I can hope a quick perusal will get you to the interesting parts > heres my use > > Im looking to define a module-unique header record, and to create storage for it in a separate section. Then append that section to the module's __dyndbg section. The pragma is leftover scaffolding from trying to figure out that I needed the _sym_ version also, without the quotes. I un-commented for demo only. #define DEFINE_DYNAMIC_DEBUG_TABLE_(_sym_,_mod_) \ > weak struct _ddebug \ > __used __aligned(8) \ > __section(".gnu.linkonce." _mod_ ".dyndbg") \ > _sym_##_dyndbg_base = { \ > .site = &_sym_##_dyndbg_site, \ > .format = _mod_, \ > .lineno = 0 \ > } > > #define DEFINE_DYNAMIC_DEBUG_TABLE() \ > DEFINE_DYNAMIC_DEBUG_TABLE_(KBUILD_MODSYM, KBUILD_MODNAME); > > I cannot make the _mod_ ## work at the same time as allowing "foo" _mod_ "buzz" catenation, therefore the new _sym_ This DEFINE is "called" from the bottom of include/linux/dynamic_debug.h the combo of weak and ".gnu.linkonce." appear to resolve all all the redundant definitions created by each C files' inclusion of the header. Inspiration came from .gnu.linkonce.this_module --- a/include/asm-generic/vmlinux.lds.h +++ b/include/asm-generic/vmlinux.lds.h @@ -329,10 +329,10 @@ #define DYNAMIC_DEBUG_DATA() \ . = ALIGN(8); \ __start___dyndbg_sites = .; \ - KEEP(*(__dyndbg_sites __dyndbg_sites.header)) \ + KEEP(*(__dyndbg_sites .gnu.linkonce.*.dyndbg_site)) \ __stop___dyndbg_sites = .; \ __start___dyndbg = .; \ - KEEP(*(__dyndbg __dyndbg.header)) \ + KEEP(*(__dyndbg .gnu.linkonce.*.dyndbg)) \ __stop___dyndbg = .; #else #define DYNAMIC_DEBUG_DATA() that puts the header record into the output section, right after the module's set of ddebug's (pr_debug callsite descriptors) By getting the header into a fixed position relative to a callsite, its possible to go from callsite-descriptor to the header (after .module_index is initialized with the offset, determined at _init), then use a single per-module pointer to the separate vector of "decorator" data. Once the 2 vectors of __dyndbg and __dyndbg_site records are indexed by N, I can drop the .site pointer from 1 to other, and shrink the footprint back to ~parity (with + 1 record / module overhead) worst case. with 2 vectors fully decoupled (pointer-wise), the decorator records can be stuffed into compressed block storage, zram, etc, then recovered when a callsite is enabled, and saved into a hashtable, indexed by modname+module-index. global/module hash per experiment. Anyway, I appear to have gotten the header where I want it: [0.315519] dyndbg: header: head64 0 [0.326702] dyndbg: header: ebda 0 [0.342521] dyndbg: header: platform_quirks 0 [0.373523] dyndbg: site.4: main run_init_process [0.406518] dyndbg: site.5: main run_init_process [0.437521] dyndbg: site.6: main run_init_process [0.468521] dyndbg: site.7: main run_init_process [0.500528] dyndbg: site.8: main initcall_blacklisted [0.531519] dyndbg: site.9: main initcall_blacklist [0.20] dyndbg: header: main 0 I have extra headers right now, head64 ebda platform_quirks above, for modules that have no pr-debug callsites. Thats a problem for later, though I posted here about conditional linkage earlier. Im afraid it needs an ld linker language enhancement: KEEP( IF *(__dyndbg) THEN (.gnu.linkonce.dyndbg) ) but Ive yet to try a simpler boolean algrebra KEEP( *(__dyndbg && .gnu.linkonce.dyndbg)) if by some miracle that works, I'll report that shortly. > ___ Kernelnewbies mailing list Kernelnewbies@kernelnewbies.org https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies