Re: [PATCH v10 2/2] arm64: boot: Support Flat Image Tree

2024-02-25 Thread Masahiro Yamada
On Wed, Feb 21, 2024 at 9:37 PM Masahiro Yamada  wrote:
>
> On Sat, Feb 3, 2024 at 2:30 AM Simon Glass  wrote:
> >
> > Add a script which produces a Flat Image Tree (FIT), a single file
> > containing the built kernel and associated devicetree files.
> > Compression defaults to gzip which gives a good balance of size and
> > performance.
> >
> > The files compress from about 86MB to 24MB using this approach.
> >
> > The FIT can be used by bootloaders which support it, such as U-Boot
> > and Linuxboot. It permits automatic selection of the correct
> > devicetree, matching the compatible string of the running board with
> > the closest compatible string in the FIT. There is no need for
> > filenames or other workarounds.
> >
> > Add a 'make image.fit' build target for arm64, as well.
> >
> > The FIT can be examined using 'dumpimage -l'.
> >
> > This uses the 'dtbs-list' file but processes only .dtb files, ignoring
> > the overlay .dtbo files.
> >
> > This features requires pylibfdt (use 'pip install libfdt'). It also
> > requires compression utilities for the algorithm being used. Supported
> > compression options are the same as the Image.xxx files. Use
> > FIT_COMPRESSION to select an algorithm other than gzip.
> >
> > While FIT supports a ramdisk / initrd, no attempt is made to support
> > this here, since it must be built separately from the Linux build.
> >
> > Signed-off-by: Simon Glass 
> > ---
> >
> > Changes in v10:
> > - Make use of dtbs-list file
> > - Mention dtbs-list and FIT_COMPRESSION
> > - Update copyright year
> > - Update cover letter to take account of an applied patch
> >
> > Changes in v9:
> > - Move the compression control into Makefile.lib
> >
> > Changes in v8:
> > - Drop compatible string in FDT node
> > - Correct sorting of MAINTAINERS to before ARM64 PORT
> > - Turn compress part of the make_fit.py comment in to a sentence
> > - Add two blank lines before parse_args() and setup_fit()
> > - Use 'image.fit: dtbs' instead of BUILD_DTBS var
> > - Use '$( > - Add 'mkimage' details Documentation/process/changes.rst
> > - Allow changing the compression used
> > - Tweak cover letter since there is only one clean-up patch
> >
> > Changes in v7:
> > - Add Image as a dependency of image.fit
> > - Drop kbuild tag
> > - Add dependency on dtbs
> > - Drop unnecessary path separator for dtbs
> > - Rebase to -next
> >
> > Changes in v5:
> > - Drop patch previously applied
> > - Correct compression rule which was broken in v4
> >
> > Changes in v4:
> > - Use single quotes for UIMAGE_NAME
> >
> > Changes in v3:
> > - Drop temporary file image.itk
> > - Drop patch 'Use double quotes for image name'
> > - Drop double quotes in use of UIMAGE_NAME
> > - Drop unnecessary CONFIG_EFI_ZBOOT condition for help
> > - Avoid hard-coding "arm64" for the DT architecture
> >
> > Changes in v2:
> > - Drop patch previously applied
> > - Add .gitignore file
> > - Move fit rule to Makefile.lib using an intermediate file
> > - Drop dependency on CONFIG_EFI_ZBOOT
> > - Pick up .dtb files separately from the kernel
> > - Correct pylint too-many-args warning for write_kernel()
> > - Include the kernel image in the file count
> > - Add a pointer to the FIT spec and mention of its wide industry usage
> > - Mention the kernel version in the FIT description
> >
> >  Documentation/process/changes.rst |   9 +
> >  MAINTAINERS   |   7 +
> >  arch/arm64/Makefile   |   7 +-
> >  arch/arm64/boot/.gitignore|   1 +
> >  arch/arm64/boot/Makefile  |   6 +-
> >  scripts/Makefile.lib  |  16 ++
> >  scripts/make_fit.py   | 298 ++
> >  7 files changed, 341 insertions(+), 3 deletions(-)
> >  create mode 100755 scripts/make_fit.py
> >
> > diff --git a/Documentation/process/changes.rst 
> > b/Documentation/process/changes.rst
> > index 50b3d1cb1115..a8110965e4e1 100644
> > --- a/Documentation/process/changes.rst
> > +++ b/Documentation/process/changes.rst
> > @@ -62,6 +62,7 @@ Sphinx\ [#f1]_ 2.4.4sphinx-build 
> > --version
> >  cpio   any  cpio --version
> >  GNU tar1.28 tar --version
> >  gtags (optional)   6.6.5gtags --version
> > +mkimage (optional) 2017.01  mkimage --version
> >  == ===  
> > 
> >
> >  .. [#f1] Sphinx is needed only to build the Kernel documentation
> > @@ -189,6 +190,14 @@ The kernel build requires GNU GLOBAL version 6.6.5 or 
> > later to generate
> >  tag files through ``make gtags``.  This is due to its use of the gtags
> >  ``-C (--directory)`` flag.
> >
> > +mkimage
> > +---
> > +
> > +This tool is used when building a Flat Image Tree (FIT), commonly used on 
> > ARM
> > +platforms. The tool is available via the ``u-boot-tools`` package or can be
> > +built from the U-Boot source code. See the instructions at
> > +https://docs.u-boot.org/en

Re: [PATCH v5] tracing: Support to dump instance traces by ftrace_dump_on_oops

2024-02-25 Thread Google
On Thu, 8 Feb 2024 21:18:14 +0800
Huang Yiwei  wrote:

> Currently ftrace only dumps the global trace buffer on an OOPs. For
> debugging a production usecase, instance trace will be helpful to
> check specific problems since global trace buffer may be used for
> other purposes.
> 
> This patch extend the ftrace_dump_on_oops parameter to dump a specific
> or multiple trace instances:
> 
>   - ftrace_dump_on_oops=0: as before -- don't dump
>   - ftrace_dump_on_oops[=1]: as before -- dump the global trace buffer
>   on all CPUs
>   - ftrace_dump_on_oops=2 or =orig_cpu: as before -- dump the global
>   trace buffer on CPU that triggered the oops
>   - ftrace_dump_on_oops=: new behavior -- dump the
>   tracing instance matching 
>   - ftrace_dump_on_oops[=2/orig_cpu],[=2/orig_cpu],

Would you mean "ftrace_dump_on_oops," ?
As far as I can see, it doesn't work. Command line parser requires "="
for parameter value. Also, is there any reason to limit the parameter
to 2 or orig_cpu?

What about this syntax?

ftrace_dump_on_oops=<0|1|2|orig_cpu>[,[=<1|2|orig_cpu>][,...]

or

ftrace_dump_on_oops=instance_name[=<1|2|orig_cpu>][,...]

or

ftrace_dump_on_oops

e.g.
"ftrace_dump_on_oops=0,foo=orig_cpu" is equal to 
"ftrace_dump_on_oops=foo=orig_cpu"

Thank you,


>   [=2/orig_cpu]: new behavior -- dump the global trace
>   buffer and multiple instance buffer on all CPUs, or only dump on CPU
>   that triggered the oops if =2 or =orig_cpu is given


> 
> Also, the sysctl node can handle the input accordingly.
> 
> Cc: Ross Zwisler 
> Signed-off-by: Joel Fernandes (Google) 
> Signed-off-by: Huang Yiwei 
> ---
>  .../admin-guide/kernel-parameters.txt |  26 ++-
>  Documentation/admin-guide/sysctl/kernel.rst   |  30 +++-
>  include/linux/ftrace.h|   4 +-
>  include/linux/kernel.h|   1 +
>  kernel/sysctl.c   |   4 +-
>  kernel/trace/trace.c  | 156 +-
>  kernel/trace/trace_selftest.c |   2 +-
>  7 files changed, 168 insertions(+), 55 deletions(-)
> 
> diff --git a/Documentation/admin-guide/kernel-parameters.txt 
> b/Documentation/admin-guide/kernel-parameters.txt
> index 31b3a25680d0..3d6ea8e80c2f 100644
> --- a/Documentation/admin-guide/kernel-parameters.txt
> +++ b/Documentation/admin-guide/kernel-parameters.txt
> @@ -1561,12 +1561,28 @@
>   The above will cause the "foo" tracing instance to 
> trigger
>   a snapshot at the end of boot up.
>  
> - ftrace_dump_on_oops[=orig_cpu]
> + ftrace_dump_on_oops[=2(orig_cpu) | =][, |
> +   ,=2(orig_cpu)]
>   [FTRACE] will dump the trace buffers on oops.
> - If no parameter is passed, ftrace will dump
> - buffers of all CPUs, but if you pass orig_cpu, it will
> - dump only the buffer of the CPU that triggered the
> - oops.
> + If no parameter is passed, ftrace will dump global
> + buffers of all CPUs, if you pass 2 or orig_cpu, it
> + will dump only the buffer of the CPU that triggered
> + the oops, or the specific instance will be dumped if
> + its name is passed. Multiple instance dump is also
> + supported, and instances are separated by commas. Each
> + instance supports only dump on CPU that triggered the
> + oops by passing 2 or orig_cpu to it.
> +
> + ftrace_dump_on_oops=foo=orig_cpu
> +
> + The above will dump only the buffer of "foo" instance
> + on CPU that triggered the oops.
> +
> + ftrace_dump_on_oops,foo,bar=orig_cpu
> +
> + The above will dump global buffer on all CPUs, the
> + buffer of "foo" instance on all CPUs and the buffer
> + of "bar" instance on CPU that triggered the oops.
>  
>   ftrace_filter=[function-list]
>   [FTRACE] Limit the functions traced by the function
> diff --git a/Documentation/admin-guide/sysctl/kernel.rst 
> b/Documentation/admin-guide/sysctl/kernel.rst
> index 6584a1f9bfe3..ea8e5f152edc 100644
> --- a/Documentation/admin-guide/sysctl/kernel.rst
> +++ b/Documentation/admin-guide/sysctl/kernel.rst
> @@ -296,12 +296,30 @@ kernel panic). This will output the contents of the 
> ftrace buffers to
>  the console.  This is very useful for capturing traces that lead to
>  crashes and outputting them to a serial console.
>  
> -= ===
> -0 Disabled (default).
> -1 Dump buffers of all CPUs.
> -2 Dump the buffer of the CPU that triggered the oops.
> -= ===
> -
> +=== ===
> +0