All of lore.kernel.org
 help / color / mirror / Atom feed
From: Daniel Kiper <daniel.kiper@oracle.com>
To: grub-devel@gnu.org, linux-kernel@vger.kernel.org,
	trenchboot-devel@googlegroups.com, x86@kernel.org,
	xen-devel@lists.xenproject.org
Cc: alec.brown@oracle.com, alexander.burmashev@oracle.com,
	andrew.cooper3@citrix.com, ard.biesheuvel@linaro.org,
	dpsmith@apertussolutions.com, eric.snowberg@oracle.com,
	hpa@zytor.com, javierm@redhat.com, kanth.ghatraju@oracle.com,
	konrad.wilk@oracle.com, krystian.hebel@3mdeb.com,
	leif@nuviainc.com, lukasz.hawrylko@linux.intel.com,
	michal.zygowski@3mdeb.com, mjg59@google.com, mtottenh@akamai.com,
	phcoder@gmail.com, piotr.krol@3mdeb.com, pjones@redhat.com,
	ross.philipson@oracle.com
Subject: [BOOTLOADER SPECIFICATION RFC] The bootloader log format for TrenchBoot and others
Date: Fri, 29 May 2020 13:27:35 +0200	[thread overview]
Message-ID: <20200529112735.qln44ds6z7djheof@tomti.i.net-space.pl> (raw)

Hey,

Below you can find my rough idea of the bootloader log format which is
generic thing but initially will be used for TrenchBoot work. I discussed
this proposal with Ross and Daniel S. So, the idea went through initial
sanitization. Now I would like to take feedback from other folks too.
So, please take a look and complain...

In general we want to pass the messages produced by the bootloader to the OS
kernel and finally to the userspace for further processing and analysis. Below
is the description of the structures which will be used for this thing.

  struct bootloader_log_msgs
  {
    grub_uint32_t level;
    grub_uint32_t facility;
    char type[];
    char msg[];
  }

  struct bootloader_log
  {
    grub_uint32_t version;
    grub_uint32_t producer;
    grub_uint32_t size;
    grub_uint32_t next_off;
    bootloader_log_msgs msgs[];
  }

The members of struct bootloader_log:
  - version: the bootloader log format version number, 1 for now,
  - producer: the producer/bootloader type; we can steal some values from
    linux/Documentation/x86/boot.rst:type_of_loader,
  - size: total size of the log buffer including the bootloader_log struct,
  - next_off: offset in bytes, from start of the bootloader_log struct,
    of the next byte after the last log message in the msgs[];
    i.e. the offset of the next available log message slot,
  - msgs: the array of log messages.

The members of struct bootloader_log_msgs:
  - level: similar to syslog meaning; can be used to differentiate
    normal messages from debug messages; exact interpretation depends
    on the current producer/bootloader type specified in the
    bootloader_log.producer,
  - facility: similar to syslog meaning; can be used to differentiate
    the sources of the messages, e.g. message produced by networking
    module; exact interpretation depends on the current producer/bootloader
    type specified in the bootloader_log.producer,
  - type: similar to the facility member but NUL terminated string instead of integer;
    this will be used by GRUB for messages printed using grub_dprintf(),
  - msg: the bootloader log message, NUL terminated string.

Note: The bootloaders are free to use/ignore any given set of level,
      facility and/or type members. Though the usage of these members
      has to be clearly defined. Ignored integer members should be set
      to 0. Ignored type member should contain an empty NUL terminated
      string. msg member is mandatory but can be an empty NUL terminated
      string.

Taking into account [1] and [2] I want to make this functionality generic
as much as possible. So, this bootloader log can be used with any bootloader
and OS kernel. However, initially the functionality will be implemented for
the Linux kernel and its boot protocol.

In case of Linux kernel the pointer to the bootloader_log struct should
be passed from the bootloader to the kernel through the boot_params and
the bootloader_log struct contents should be exposed via sysfs. E.g.
somewhere at /sys/kernel/debug or /sys/kernel/tracing or maybe we should
create new /sys/bootloader/log node.

If everybody is OK with this rough proposal then I will start working
on making it a part of Multiboot2 specification (the text above is just
raw description of the idea; it is not final text which land into the
spec). If you see better place for this thing just drop me a line.

Daniel

[1] https://lists.gnu.org/archive/html/grub-devel/2019-10/msg00107.html
[2] https://lists.gnu.org/archive/html/grub-devel/2019-11/msg00079.html

WARNING: multiple messages have this Message-ID (diff)
From: Daniel Kiper <daniel.kiper@oracle.com>
To: grub-devel@gnu.org, linux-kernel@vger.kernel.org,
	trenchboot-devel@googlegroups.com, x86@kernel.org,
	xen-devel@lists.xenproject.org
Cc: michal.zygowski@3mdeb.com, eric.snowberg@oracle.com,
	mtottenh@akamai.com, ard.biesheuvel@linaro.org,
	dpsmith@apertussolutions.com, andrew.cooper3@citrix.com,
	konrad.wilk@oracle.com, phcoder@gmail.com, javierm@redhat.com,
	mjg59@google.com, alexander.burmashev@oracle.com,
	krystian.hebel@3mdeb.com, kanth.ghatraju@oracle.com,
	lukasz.hawrylko@linux.intel.com, ross.philipson@oracle.com,
	hpa@zytor.com, leif@nuviainc.com, pjones@redhat.com,
	alec.brown@oracle.com, piotr.krol@3mdeb.com
Subject: [BOOTLOADER SPECIFICATION RFC] The bootloader log format for TrenchBoot and others
Date: Fri, 29 May 2020 13:27:35 +0200	[thread overview]
Message-ID: <20200529112735.qln44ds6z7djheof@tomti.i.net-space.pl> (raw)

Hey,

Below you can find my rough idea of the bootloader log format which is
generic thing but initially will be used for TrenchBoot work. I discussed
this proposal with Ross and Daniel S. So, the idea went through initial
sanitization. Now I would like to take feedback from other folks too.
So, please take a look and complain...

In general we want to pass the messages produced by the bootloader to the OS
kernel and finally to the userspace for further processing and analysis. Below
is the description of the structures which will be used for this thing.

  struct bootloader_log_msgs
  {
    grub_uint32_t level;
    grub_uint32_t facility;
    char type[];
    char msg[];
  }

  struct bootloader_log
  {
    grub_uint32_t version;
    grub_uint32_t producer;
    grub_uint32_t size;
    grub_uint32_t next_off;
    bootloader_log_msgs msgs[];
  }

The members of struct bootloader_log:
  - version: the bootloader log format version number, 1 for now,
  - producer: the producer/bootloader type; we can steal some values from
    linux/Documentation/x86/boot.rst:type_of_loader,
  - size: total size of the log buffer including the bootloader_log struct,
  - next_off: offset in bytes, from start of the bootloader_log struct,
    of the next byte after the last log message in the msgs[];
    i.e. the offset of the next available log message slot,
  - msgs: the array of log messages.

The members of struct bootloader_log_msgs:
  - level: similar to syslog meaning; can be used to differentiate
    normal messages from debug messages; exact interpretation depends
    on the current producer/bootloader type specified in the
    bootloader_log.producer,
  - facility: similar to syslog meaning; can be used to differentiate
    the sources of the messages, e.g. message produced by networking
    module; exact interpretation depends on the current producer/bootloader
    type specified in the bootloader_log.producer,
  - type: similar to the facility member but NUL terminated string instead of integer;
    this will be used by GRUB for messages printed using grub_dprintf(),
  - msg: the bootloader log message, NUL terminated string.

Note: The bootloaders are free to use/ignore any given set of level,
      facility and/or type members. Though the usage of these members
      has to be clearly defined. Ignored integer members should be set
      to 0. Ignored type member should contain an empty NUL terminated
      string. msg member is mandatory but can be an empty NUL terminated
      string.

Taking into account [1] and [2] I want to make this functionality generic
as much as possible. So, this bootloader log can be used with any bootloader
and OS kernel. However, initially the functionality will be implemented for
the Linux kernel and its boot protocol.

In case of Linux kernel the pointer to the bootloader_log struct should
be passed from the bootloader to the kernel through the boot_params and
the bootloader_log struct contents should be exposed via sysfs. E.g.
somewhere at /sys/kernel/debug or /sys/kernel/tracing or maybe we should
create new /sys/bootloader/log node.

If everybody is OK with this rough proposal then I will start working
on making it a part of Multiboot2 specification (the text above is just
raw description of the idea; it is not final text which land into the
spec). If you see better place for this thing just drop me a line.

Daniel

[1] https://lists.gnu.org/archive/html/grub-devel/2019-10/msg00107.html
[2] https://lists.gnu.org/archive/html/grub-devel/2019-11/msg00079.html


             reply	other threads:[~2020-05-29 11:30 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-05-29 11:27 Daniel Kiper [this message]
2020-05-29 11:27 ` [BOOTLOADER SPECIFICATION RFC] The bootloader log format for TrenchBoot and others Daniel Kiper
2020-05-29 17:11 ` Andy Lutomirski
2020-05-29 17:11   ` Andy Lutomirski
2020-06-01  9:56   ` Daniel Kiper
2020-06-01  9:56     ` Daniel Kiper
2020-06-01 10:54 ` Roger Pau Monné
2020-06-01 10:54   ` Roger Pau Monné
2020-06-01 18:25 ` Hans Ulrich Niedermann
2020-06-01 18:25   ` Hans Ulrich Niedermann

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=20200529112735.qln44ds6z7djheof@tomti.i.net-space.pl \
    --to=daniel.kiper@oracle.com \
    --cc=alec.brown@oracle.com \
    --cc=alexander.burmashev@oracle.com \
    --cc=andrew.cooper3@citrix.com \
    --cc=ard.biesheuvel@linaro.org \
    --cc=dpsmith@apertussolutions.com \
    --cc=eric.snowberg@oracle.com \
    --cc=grub-devel@gnu.org \
    --cc=hpa@zytor.com \
    --cc=javierm@redhat.com \
    --cc=kanth.ghatraju@oracle.com \
    --cc=konrad.wilk@oracle.com \
    --cc=krystian.hebel@3mdeb.com \
    --cc=leif@nuviainc.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lukasz.hawrylko@linux.intel.com \
    --cc=michal.zygowski@3mdeb.com \
    --cc=mjg59@google.com \
    --cc=mtottenh@akamai.com \
    --cc=phcoder@gmail.com \
    --cc=piotr.krol@3mdeb.com \
    --cc=pjones@redhat.com \
    --cc=ross.philipson@oracle.com \
    --cc=trenchboot-devel@googlegroups.com \
    --cc=x86@kernel.org \
    --cc=xen-devel@lists.xenproject.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.