From: Bjorn Helgaas <bjorn.helgaas@hp.com>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: x86@kernel.org, linux-kernel@vger.kernel.org,
Alan Cox <alan@lxorguk.ukuu.org.uk>
Subject: Re: [PATCH v2] DMI: log system, BIOS, and board information
Date: Tue, 5 Oct 2010 08:02:46 -0600 [thread overview]
Message-ID: <201010050802.49055.bjorn.helgaas@hp.com> (raw)
In-Reply-To: <20101004195406.96d71305.akpm@linux-foundation.org>
On Monday, October 04, 2010 08:54:06 pm Andrew Morton wrote:
> On Mon, 4 Oct 2010 20:45:29 -0600 Bjorn Helgaas <bjorn.helgaas@hp.com> wrote:
>
> > On Mon, Oct 04, 2010 at 04:19:26PM -0700, Andrew Morton wrote:
> > > On Thu, 30 Sep 2010 10:49:05 -0600
> > > Bjorn Helgaas <bjorn.helgaas@hp.com> wrote:
> > >
> > > >
> > > > Put basic system information in the dmesg log. There are lots of dmesg
> > > > logs on the web, and it would be useful if they contained this information
> > > > for debugging platform problems.
> > > >
> > > > Signed-off-by: Bjorn Helgaas <bjorn.helgaas@hp.com>
> > > > ---
> > > >
> > > > drivers/firmware/dmi_scan.c | 35 ++++++++++++++++++++++++++++++++++-
> > > > 1 files changed, 34 insertions(+), 1 deletions(-)
> > > >
> > > >
> > > > diff --git a/drivers/firmware/dmi_scan.c b/drivers/firmware/dmi_scan.c
> > > > index b3d22d6..d625e53 100644
> > > > --- a/drivers/firmware/dmi_scan.c
> > > > +++ b/drivers/firmware/dmi_scan.c
> > > > @@ -2,6 +2,7 @@
> > > > #include <linux/string.h>
> > > > #include <linux/init.h>
> > > > #include <linux/module.h>
> > > > +#include <linux/ctype.h>
> > > > #include <linux/dmi.h>
> > > > #include <linux/efi.h>
> > > > #include <linux/bootmem.h>
> > > > @@ -361,6 +362,36 @@ static void __init dmi_decode(const struct dmi_header *dm, void *dummy)
> > > > }
> > > > }
> > > >
> > > > +static const char * __init dmi_printable_system_info(int field)
> > > > +{
> > > > + const char *info, *p;
> > > > +
> > > > + info = dmi_get_system_info(field);
> > > > + if (!info)
> > > > + return NULL;
> > > > +
> > > > + for (p = info; *p; p++)
> > > > + if (!isprint(*p))
> > > > + return "<...>";
> > > > +
> > > > + return info;
> > > > +}
> > >
> > > So if the string contains any non-printable character, we suppress the
> > > whole string.
> > >
> > > Is that the best thing to do? Would it be better to present the
> > > oddball character as \xNN or such?
> >
> > I would definitely prefer to do that, but that would mean allocating
> > memory, and this happens so early that it looked like it would be
> > more trouble than it's worth. I'm not saying I couldn't be convinced,
> > though.
>
> Well, one could print the data one char at a time. If we're running
> early in boot with a single CPU up then that wouldn't make too big a
> mess.
>
> Is there some upper bound to the length of a DMI string? If so, use a
> static initdata buffer dimensioned to 4x that?
Yeah, good ideas. I'll push on that a little bit more.
Bjorn
prev parent reply other threads:[~2010-10-05 14:03 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-09-30 16:49 [PATCH v2] DMI: log system, BIOS, and board information Bjorn Helgaas
2010-10-04 23:19 ` Andrew Morton
2010-10-05 2:45 ` Bjorn Helgaas
2010-10-05 2:54 ` Andrew Morton
2010-10-05 14:02 ` Bjorn Helgaas [this message]
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=201010050802.49055.bjorn.helgaas@hp.com \
--to=bjorn.helgaas@hp.com \
--cc=akpm@linux-foundation.org \
--cc=alan@lxorguk.ukuu.org.uk \
--cc=linux-kernel@vger.kernel.org \
--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