linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Eugen Hristev <eugen.hristev@linaro.org>
To: David Hildenbrand <david@redhat.com>,
	Thomas Gleixner <tglx@linutronix.de>,
	linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org,
	linux-mm@kvack.org, andersson@kernel.org, pmladek@suse.com,
	rdunlap@infradead.org, corbet@lwn.net, mhocko@suse.com
Cc: tudor.ambarus@linaro.org, mukesh.ojha@oss.qualcomm.com,
	linux-arm-kernel@lists.infradead.org,
	linux-hardening@vger.kernel.org, jonechou@google.com,
	rostedt@goodmis.org, linux-doc@vger.kernel.org,
	devicetree@vger.kernel.org
Subject: Re: [RFC][PATCH v3 09/16] genirq/irqdesc: Have nr_irqs as non-static
Date: Wed, 17 Sep 2025 18:32:41 +0300	[thread overview]
Message-ID: <10540b3e-09ca-403d-bc20-b9412a7fe28a@linaro.org> (raw)
In-Reply-To: <7f4aa4c6-7b77-422b-9f7a-d01530c54bff@redhat.com>



On 9/17/25 18:18, David Hildenbrand wrote:
> On 17.09.25 17:02, Eugen Hristev wrote:
>>
>>
>> On 9/17/25 17:46, David Hildenbrand wrote:
>>> On 17.09.25 16:10, Thomas Gleixner wrote:
>>>> On Wed, Sep 17 2025 at 09:16, David Hildenbrand wrote:
>>>>> On 17.09.25 07:43, Eugen Hristev wrote:
>>>>>> On 9/17/25 00:16, Thomas Gleixner wrote:
>>>>>>> I pointed you to a solution for that and just because David does not
>>>>>>> like it means that it's acceptable to fiddle in subsystems and expose
>>>>>>> their carefully localized variables.
>>>>>
>>>>> It would have been great if we could have had that discussion in the
>>>>> previous thread.
>>>>
>>>> Sorry. I was busy with other stuff and did not pay attention to that
>>>> discussion.
>>>
>>> I understand, I'm busy with too much stuff such that sometimes it might
>>> be good to interrupt me earlier: "David, nooo, you're all wrong"
>>>
>>>>
>>>>> Some other subsystem wants to have access to this information. I agree
>>>>> that exposing these variables as r/w globally is not ideal.
>>>>
>>>> It's a nono in this case. We had bugs (long ago) where people fiddled
>>>> with this stuff (I assume accidentally for my mental sanity sake) and
>>>> caused really nasty to debug issues. C is a horrible language to
>>>> encapsulate stuff properly as we all know.
>>>
>>> Yeah, there is this ACCESS_PRIVATE stuff but it only works with structs
>>> and relies on sparse IIRC.
>>>
>>>>
>>>>> I raised the alternative of exposing areas or other information through
>>>>> simple helper functions that kmemdump can just use to compose whatever
>>>>> it needs to compose.
>>>>>
>>>>> Do we really need that .section thingy?
>>>>
>>>> The section thing is simple and straight forward as it just puts the
>>>> annotated stuff into the section along with size and id and I definitely
>>>> find that more palatable, than sprinkling random functions all over the
>>>> place to register stuff.
>>>>
>>>> Sure, you can achieve the same thing with an accessor function. In case
>>>> of nr_irqs there is already one: irq_get_nr_irqs(), but for places which
>>>
>>> Right, the challenge really is that we want the memory range covered by
>>> that address, otherwise it would be easy.
>>>
>>>> do not expose the information already for real functional reasons adding
>>>> such helpers just for this coredump muck is really worse than having a
>>>> clearly descriptive and obvious annotation which results in the section
>>>> build.
>>>
>>> Yeah, I'm mostly unhappy about the "#include <linux/kmemdump.h>" stuff.
>>>
>>> Guess it would all feel less "kmemdump" specific if we would just have a
>>> generic way to tag/describe certain physical memory areas and kmemdump
>>> would simply make use of that.
>>
>> The idea was to make "kmemdump" exactly this generic way to tag/describe
>> the memory.
> 
> That's probably where I got lost, after reading the cover letter 
> assuming that this is primarily to program kmemdump backends, which I 
> understood to just special hw/firmware areas, whereby kinfo acts as a 
> filter.

If there is a mechanism to tag all this memory, or regions, into a
specific section, what we would do with it next ?
It would have a purpose to be parsed and reused by different drivers,
that would be able to actually use it.
So there has a to be some kind of middleman, that holds onto this list
of regions, manages it (unique id, add/remove), and allows certain
drivers to use it.
Now it would be interesting to have different kind of drivers connect to
it (or backends how I called them).
One of these programs an internal table for the firmware to use.
Another , writes information into a dedicated reserved-memory for the
bootloader to use on the next soft reboot (memory preserved).
I called this middleman kmemdump. But it can be named differently, and
it can reside in different places in the kernel.
But what I would like to avoid is to just tag all this memory and have
any kind of driver connect to the table. That works, but it's quite
loose on having control over the table. E.g. no kmemdump, tag all the
memory to sections, and have specific drivers (that would reside where?)
walk it.

> 
>> If we would call it differently , simply dump , would it be better ?
>> e.g. include linux/dump.h
>> and then DUMP(var, size) ?
>>
>> could we call it maybe MARK ? or TAG ?
>> TAG_MEM(area, size)
> 
> I'm wondering whether there could be any other user for this kind of 
> information.
> 
> Like R/O access in a debug kernel to these areas, exporting the 
> ranges/names + easy read access to content through debugfs or something.

One idea I had to to have a jtag script read the table , parse it, and
know where some information resides.
Another idea is to use Uboot in case of persistent memory across reboot,
and Uboot can read all the sections and assemble a ready-to-download
coredump. (sure this doesn't work in all cases)
What can be done in case of hypervisor is to implement there a routine
that would read it, in case the OS is non-responsive, or even in the
secure monitor.
Another suggestion I had from someone was to use a pure software default
backend in which to just keep the regions stored, and it could be
accessed through userspace or read by a crash analyzer.

> 
> Guess that partially falls under the "dump" category.
> 
> Including that information in a vmcore info would probably allow to 
> quickly extract some information even without the debug symbols around 
> (I run into that every now and then).
> 
>>
>> this would go to a separate section called .tagged_memory.
>>
> 
> Maybe just "tagged_memory.h" or sth. like that? I'm bad at naming, so I 
> would let others make better suggestions.
> 
>> Then anyone can walk through the section and collect the data.
>>
>> I am just coming up with ideas here.
>> Could it be even part of mm.h instead of having a new header perhaps ?
>> Then we won't need to include one more.
> 
> I don't really have something against a new include, just not one that 
> sounded like a very specific subsystem, not something more generic.
> 



  reply	other threads:[~2025-09-17 15:32 UTC|newest]

Thread overview: 42+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-09-12 15:08 [RFC][PATCH v3 00/16] Introduce kmemdump Eugen Hristev
2025-09-12 15:08 ` [RFC][PATCH v3 01/16] kmemdump: " Eugen Hristev
2025-09-12 15:08 ` [RFC][PATCH v3 02/16] Documentation: Add kmemdump Eugen Hristev
2025-09-12 15:08 ` [RFC][PATCH v3 03/16] kmemdump: Add coreimage ELF layer Eugen Hristev
2025-09-12 15:08 ` [RFC][PATCH v3 04/16] Documentation: kmemdump: Add section for coreimage ELF Eugen Hristev
2025-09-12 15:08 ` [RFC][PATCH v3 05/16] kernel/vmcore_info: Register dynamic information into Kmemdump Eugen Hristev
2025-09-12 15:08 ` [RFC][PATCH v3 06/16] kmemdump: Introduce qcom-minidump backend driver Eugen Hristev
2025-09-12 15:08 ` [RFC][PATCH v3 07/16] soc: qcom: smem: Add minidump device Eugen Hristev
2025-09-12 15:08 ` [RFC][PATCH v3 08/16] init/version: Add banner_len to save banner length Eugen Hristev
2025-09-12 15:08 ` [RFC][PATCH v3 09/16] genirq/irqdesc: Have nr_irqs as non-static Eugen Hristev
2025-09-16 21:10   ` Thomas Gleixner
2025-09-16 21:16     ` Thomas Gleixner
2025-09-17  5:43       ` Eugen Hristev
2025-09-17  7:16         ` David Hildenbrand
2025-09-17 14:10           ` Thomas Gleixner
2025-09-17 14:26             ` Eugen Hristev
2025-09-17 14:46             ` David Hildenbrand
2025-09-17 15:02               ` Eugen Hristev
2025-09-17 15:18                 ` David Hildenbrand
2025-09-17 15:32                   ` Eugen Hristev [this message]
2025-09-17 15:44                     ` David Hildenbrand
2025-09-17 18:42                   ` Thomas Gleixner
2025-09-17 19:03                     ` David Hildenbrand
2025-09-18  8:23                       ` Thomas Gleixner
2025-09-18 13:53                         ` Eugen Hristev
2025-09-18 18:43                           ` Randy Dunlap
2025-09-25 20:11                           ` David Hildenbrand
2025-09-12 15:08 ` [RFC][PATCH v3 10/16] panic: Have tainted_mask " Eugen Hristev
2025-09-12 15:08 ` [RFC][PATCH v3 11/16] mm/swapfile: Have nr_swapfiles " Eugen Hristev
2025-09-12 15:08 ` [RFC][PATCH v3 12/16] printk: Register information into Kmemdump Eugen Hristev
2025-09-12 15:08 ` [RFC][PATCH v3 13/16] sched: Add sched_get_runqueues_area Eugen Hristev
2025-09-12 15:08 ` [RFC][PATCH v3 14/16] kernel/vmcoreinfo: Register kmemdump core image information Eugen Hristev
2025-09-12 15:08 ` [RFC][PATCH v3 15/16] kmemdump: Add Kinfo backend driver Eugen Hristev
2025-09-16  5:48   ` Alexey Klimov
2025-09-22 10:01   ` Tudor Ambarus
2025-09-12 15:08 ` [RFC][PATCH v3 16/16] dt-bindings: Add Google Kinfo Eugen Hristev
2025-09-14 11:56   ` Krzysztof Kozlowski
2025-09-12 15:56 ` [RFC][PATCH v3 00/16] Introduce kmemdump David Hildenbrand
2025-09-12 18:35   ` Eugen Hristev
2025-09-16  7:49 ` Mukesh Ojha
2025-09-16 15:25   ` Luck, Tony
2025-09-16 15:27     ` Eugen Hristev

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=10540b3e-09ca-403d-bc20-b9412a7fe28a@linaro.org \
    --to=eugen.hristev@linaro.org \
    --cc=andersson@kernel.org \
    --cc=corbet@lwn.net \
    --cc=david@redhat.com \
    --cc=devicetree@vger.kernel.org \
    --cc=jonechou@google.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-arm-msm@vger.kernel.org \
    --cc=linux-doc@vger.kernel.org \
    --cc=linux-hardening@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=mhocko@suse.com \
    --cc=mukesh.ojha@oss.qualcomm.com \
    --cc=pmladek@suse.com \
    --cc=rdunlap@infradead.org \
    --cc=rostedt@goodmis.org \
    --cc=tglx@linutronix.de \
    --cc=tudor.ambarus@linaro.org \
    /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 NNTP newsgroup(s).