From: Oleksij Rempel <o.rempel@pengutronix.de>
To: Alexander Graf <graf@amazon.com>
Cc: linux-kernel@vger.kernel.org, linux-trace-kernel@vger.kernel.org,
linux-mm@kvack.org, devicetree@vger.kernel.org,
linux-arm-kernel@lists.infradead.org, kexec@lists.infradead.org,
linux-doc@vger.kernel.org, x86@kernel.org,
Eric Biederman <ebiederm@xmission.com>,
"H . Peter Anvin" <hpa@zytor.com>,
Andy Lutomirski <luto@kernel.org>,
Peter Zijlstra <peterz@infradead.org>,
Steven Rostedt <rostedt@goodmis.org>,
Andrew Morton <akpm@linux-foundation.org>,
Mark Rutland <mark.rutland@arm.com>,
Tom Lendacky <thomas.lendacky@amd.com>,
Ashish Kalra <ashish.kalra@amd.com>,
James Gowans <jgowans@amazon.com>,
Stanislav Kinsburskii <skinsburskii@linux.microsoft.com>,
arnd@arndb.de, pbonzini@redhat.com, madvenka@linux.microsoft.com,
Anthony Yznaga <anthony.yznaga@oracle.com>,
Usama Arif <usama.arif@bytedance.com>,
David Woodhouse <dwmw@amazon.co.uk>,
Benjamin Herrenschmidt <benh@kernel.crashing.org>,
Rob Herring <robh+dt@kernel.org>,
Krzysztof Kozlowski <krzk@kernel.org>
Subject: Re: [PATCH v3 00/17] kexec: Allow preservation of ftrace buffers
Date: Tue, 6 Feb 2024 15:40:22 +0100 [thread overview]
Message-ID: <ZcJE1qQy29lR42-G@pengutronix.de> (raw)
In-Reply-To: <c7157097-4727-4360-80a0-20e7d8015e13@amazon.com>
On Tue, Feb 06, 2024 at 02:43:15PM +0100, Alexander Graf wrote:
> Hey Oleksij!
>
> On 06.02.24 09:17, Oleksij Rempel wrote:
> > Hi Alexander,
> >
> > Nice work!
> >
> > On Wed, Jan 17, 2024 at 02:46:47PM +0000, Alexander Graf wrote:
> > > Make sure to fill ftrace with contents that you want to observe after
> > > kexec. Then, before you invoke file based "kexec -l", activate KHO:
> > >
> > > # echo 1 > /sys/kernel/kho/active
> > > # kexec -l Image --initrd=initrd -s
> > > # kexec -e
> > >
> > > The new kernel will boot up and contain the previous kernel's trace
> > > buffers in /sys/kernel/debug/tracing/trace.
> > Assuming:
> > - we wont to start tracing as early as possible, before rootfs
> > or initrd would be able to configure it.
> > - traces are stored on a different device, not RAM. For example NVMEM.
> > - Location of NVMEM is different for different board types, but
> > bootloader is able to give the right configuration to the kernel.
>
>
> Let me try to really understand what you're tracing here. Are we talking
> about exposing boot loader traces into Linux [1]? In that case, I think a
> mechanism like [2] is what you're looking for.
>
> Or do you want to transfer genuine Linux ftrace traces? In that case, why
> would you want to store them outside of RAM?
The high level object of what i need is to find how embedded systems in
fields do break. Since this devices should be always on, there are
different situations where system may reboot. For example, voltage
related issues, temperature, scheduled system updates, HW or SW errors.
To get better understand on what is going on, information should be
collected. But there are some limitations:
- voltage drops can be recorder only with prepared HW:
https://www.spinics.net/lists/devicetree/msg644030.html
- In case of voltage drops RAM or block devices can't be used. Instead,
some variant of NVMEM should be used. In my case, NVMEM has 8 bits of
storage :) So, only one entry of the "trace" is compressed to this storage.
https://lore.kernel.org/all/20240124122204.730370-1-o.rempel@pengutronix.de
The reset reason information is provide by kernel and used by firmware
and kernel on next reboot
The implementation is not a big deal. The problematic part is the way
how the system should get information about existence of recorder and
where the recorder should stored things, for example NVMEM cell.
In my initial implementation I used devicetree to configure the software
based recorder and linked it with NVMEM cell. But it is against the DT
purpose to describe only HW and it makes this recorder unusable for
not DT basd systems.
Krzysztof is suggesting to configure it from initrd. This has own
limitations as well:
- record can't be used before initrd.
- we have multiple configuration point of board specific information -
firmware (bootloader) and initrd.
- initrd take place and reduce boot time for device which do not needed
it before.
Other variants like kernel command-line and/or module parameters seems
to be not acceptable depending maintainer. So, I'm still seeking
proper, acceptable, portable way to hand over not HW specific
information to the kernel.
> > What would be the best, acceptable for mainline, way to provide this
> > kind of configuration? At least part of this information do not
> > describes devices or device states, this would not fit in to devicetree
> > universe. Amount of possible information would not fit in to bootconfig
> > too.
>
>
> We have precedence for configuration in device tree: You can use device tree
> to describe partitions on a NAND device, you can use it to specify MAC
> address overrides of devices attached to USB, etc etc. At the end of the day
> when people say they don't want configuration in device tree, what they mean
> is that device tree should be a hand over data structure from firmware to
> kernel, not from OS integrator to kernel :). If your firmware is the place
> that knows about offsets and you need to pass those offsets, IMHO DT is a
> good fit.
Yes, the layout of the NVMEM can be described in the DT. How can I tell
the system that this NVMEM cell should be used by some recorder or
tracer? Before sysfs is available any how. @Krzysztof ?
> > Other more or less overlapping use case I have in mind is a netbootable
> > embedded system with a requirement to boot as fast as possible. Since
> > bootloader already established a link and got all needed ip
> > configuration, it would be able to hand over etherent controller and ip
> > configuration states. Wille be the KHO the way to go for this use case?
>
>
> That's an interesting one too. I would lean towards "try with normal device
> tree first" here as well. It's again a very clear case of "firmware wants to
> tell OS about things it knows, but the OS doesn't know" to me. That means
> device tree should be fine to describe it.
I can imagine description of PHY and MAC state. But IP configuration
state of the firmware seems to be out of DT scope?
Regards,
Oleksij
--
Pengutronix e.K. | |
Steuerwalder Str. 21 | http://www.pengutronix.de/ |
31137 Hildesheim, Germany | Phone: +49-5121-206917-0 |
Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |
next prev parent reply other threads:[~2024-02-06 14:40 UTC|newest]
Thread overview: 34+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-01-17 14:46 [PATCH v3 00/17] kexec: Allow preservation of ftrace buffers Alexander Graf
2024-01-17 14:46 ` [PATCH v3 01/17] mm,memblock: Add support for scratch memory Alexander Graf
2024-01-17 14:46 ` [PATCH v3 02/17] memblock: Declare scratch memory as CMA Alexander Graf
2024-02-23 15:53 ` Pratyush Yadav
2024-01-17 14:46 ` [PATCH v3 03/17] kexec: Add Kexec HandOver (KHO) generation helpers Alexander Graf
2024-01-17 14:46 ` [PATCH v3 04/17] kexec: Add KHO parsing support Alexander Graf
2024-02-16 15:57 ` Pratyush Yadav
2024-01-17 14:46 ` [PATCH v3 05/17] kexec: Add KHO support to kexec file loads Alexander Graf
2024-02-16 15:37 ` Pratyush Yadav
2024-01-17 14:46 ` [PATCH v3 06/17] kexec: Add config option for KHO Alexander Graf
2024-01-17 14:46 ` [PATCH v3 07/17] kexec: Add documentation " Alexander Graf
2024-01-17 14:46 ` [PATCH v3 08/17] arm64: Add KHO support Alexander Graf
2024-01-31 14:49 ` Rob Herring
2024-01-17 14:46 ` [PATCH v3 09/17] x86: " Alexander Graf
2024-02-20 10:30 ` Mike Rapoport
2024-01-17 14:46 ` [PATCH v3 10/17] tracing: Initialize fields before registering Alexander Graf
2024-01-17 14:46 ` [PATCH v3 11/17] tracing: Introduce kho serialization Alexander Graf
2024-02-16 15:36 ` Pratyush Yadav
2024-01-17 14:46 ` [PATCH v3 12/17] tracing: Add kho serialization of trace buffers Alexander Graf
2024-01-17 14:47 ` [PATCH v3 13/17] tracing: Recover trace buffers from kexec handover Alexander Graf
2024-01-18 6:46 ` kernel test robot
2024-01-18 15:16 ` kernel test robot
2024-01-17 14:47 ` [PATCH v3 14/17] tracing: Add kho serialization of trace events Alexander Graf
2024-01-18 5:23 ` kernel test robot
2024-01-17 14:47 ` [PATCH v3 15/17] tracing: Recover trace events from kexec handover Alexander Graf
2024-01-17 14:47 ` [PATCH v3 16/17] tracing: Add config option for " Alexander Graf
2024-01-17 14:47 ` [PATCH v3 17/17] Documentation: KHO: Add ftrace bindings Alexander Graf
2024-01-29 16:34 ` [PATCH v3 00/17] kexec: Allow preservation of ftrace buffers Philipp Rudo
2024-02-02 12:58 ` Alexander Graf
2024-02-09 16:59 ` Philipp Rudo
2024-02-06 8:17 ` Oleksij Rempel
2024-02-06 13:43 ` Alexander Graf
2024-02-06 14:40 ` Oleksij Rempel [this message]
2024-02-16 15:29 ` Pratyush Yadav
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=ZcJE1qQy29lR42-G@pengutronix.de \
--to=o.rempel@pengutronix.de \
--cc=akpm@linux-foundation.org \
--cc=anthony.yznaga@oracle.com \
--cc=arnd@arndb.de \
--cc=ashish.kalra@amd.com \
--cc=benh@kernel.crashing.org \
--cc=devicetree@vger.kernel.org \
--cc=dwmw@amazon.co.uk \
--cc=ebiederm@xmission.com \
--cc=graf@amazon.com \
--cc=hpa@zytor.com \
--cc=jgowans@amazon.com \
--cc=kexec@lists.infradead.org \
--cc=krzk@kernel.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-doc@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=linux-trace-kernel@vger.kernel.org \
--cc=luto@kernel.org \
--cc=madvenka@linux.microsoft.com \
--cc=mark.rutland@arm.com \
--cc=pbonzini@redhat.com \
--cc=peterz@infradead.org \
--cc=robh+dt@kernel.org \
--cc=rostedt@goodmis.org \
--cc=skinsburskii@linux.microsoft.com \
--cc=thomas.lendacky@amd.com \
--cc=usama.arif@bytedance.com \
--cc=x86@kernel.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).