mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Andrew Morton <akpm@linux-foundation.org>
To: Prarit Bhargava <prarit@redhat.com>
Cc: linux-kernel@vger.kernel.org, Arnd Bergmann <arnd@arndb.de>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Subject: Re: [PATCH 1/3] Introduce FW_INFO* functions and messages
Date: Tue, 3 Dec 2013 13:21:20 -0800	[thread overview]
Message-ID: <20131203132120.6a7ab2cd7cc99720712cbe6a@linux-foundation.org> (raw)
In-Reply-To: <1385997579-22240-2-git-send-email-prarit@redhat.com>

On Mon,  2 Dec 2013 10:19:37 -0500 Prarit Bhargava <prarit@redhat.com> wrote:

> Logging and tracking firmware bugs in the kernel has long been an issue
> for system administrators.  The current kernel does not have a good
> uniform method of reporting firmware bugs and the code in the kernel is a
> mix of printk's and WARN_ONs.  This causes problems for both system
> administrators and QA engineers who attempt to diagnose problems within
> the kernel.
> 
> Using printk's is somewhat effective but lacks information useful for
> reporting a bug such as the system vendor or model, BIOS revision, etc.
> Using WARN_ONs is also questionable because the data like the backtrace
> and the list of modules is usually unnecessary for firmware issues as the
> warning stems from one call path during system or driver initialization.
> We have heard many complaints from users about the excess verbosity and
> confusing stacktraces for these messages.
> 
> I'm proposing with this patch to do something similar to the WARN()
> mechanism that is currently implemented in the kernel.  This
> patchset introduces FW_INFO() and FW_INFO_DEV() which logs output like:
> 
> [  230.661137] [Firmware Info]: pci_bus 0000:00: at
> /home/prarit_modules/prarit.c:21 Your BIOS is broken because it is
> -ENOWORKY.
> [  230.671076] [Firmware Info]: Intel Corporation SandyBridge Platform/To
> be filled by O.E.M., BIOS RMLCRB.86I.R3.27.D685.1305151733 05/15/2013
> 
> instead of the verbose back traces we are currently seeing.  These messages
> can be easily gleaned from /var/log/messages, etc., by automatic bug
> reporting tools and system administrators to properly report bugs to
> hardware vendors.
> 
> I found an improperly classified FW_INFO in arch/x86/kernel/cpu/amd.c
> which that should be a FW_BUG.

A slight simplification:

> +static inline char *dump_hadware_arch_desc(void)
> +{
> +	return NULL;
> +}

	return "unavailable";

> +void warn_slowpath_fmt_dev(const char *file, int line,
> +			   struct device *dev, int level, const char *fmt, ...)
> +{
> +	struct slowpath_args args;
> +	static char fw_str[16] = "\0";
> +
> +	switch (level) {
> +	case 1:
> +		strcpy(fw_str, "[Firmware Info]");
> +		break;
> +	case 2:
> +		strcpy(fw_str, "[Firmware Warn]");
> +		break;
> +	case 3:
> +		strcpy(fw_str, "[Firmware Bug]");

What's With The Crazy Capitalization In This Code?  It's Illiterate!

> +		add_taint(TAINT_FIRMWARE_WORKAROUND, LOCKDEP_STILL_OK);
> +		break;
> +	default:
> +		strcpy(fw_str, "[Firmware Bug]");
> +		break;
> +	}
> +
> +	if (dev)
> +		pr_info("%s: %s %s ", fw_str,
> +			dev_driver_string(dev), dev_name(dev));
> +	pr_info("%s: at %s:%d\n", fw_str, file, line);
> +
> +	args.fmt = fmt;
> +	va_start(args.args, fmt);
> +	printk(KERN_WARNING "%s: %pV", fw_str, &args);
> +	va_end(args.args);
> +
> +	if (dump_hardware_arch_desc())
> +		pr_info("%s: System Info: %s\n", fw_str,
> +			dump_hardware_arch_desc());
> +	else
> +		pr_info("%s: System Info: Hardware Unidentified\n", fw_str);

	pr_info(""%s: system info: %s\n", fw_str, dump_hardware_arch_desc());

> +}
> +EXPORT_SYMBOL(warn_slowpath_fmt_dev);
> +
> +

> +char *dump_hardware_arch_desc(void)
> +{
> +	if (dump_stack_arch_desc_str[0] != '\0')
> +		return dump_stack_arch_desc_str;
> +	return NULL;

	return "unavaliable";

> +}


The general thrust of the patchset seems useful and important.  I do
agree with Joe's suggestion regarding the presentation, although it
isn't a show-stopper.

I do wonder if it all should be generalised a bit - it creates a bunch
of infrastructure which is specific to system firmware issues, but
what's so special about firmware?  Why can't I use this infrastructure
to log netdev errors or acpi errors or PM errors or...?  But I didn't
think about it much ;)



  reply	other threads:[~2013-12-03 21:21 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-12-02 15:19 [PATCH 0/3] Add Firmware Info, Warn, and Bug messages Prarit Bhargava
2013-12-02 15:19 ` [PATCH 1/3] Introduce FW_INFO* functions and messages Prarit Bhargava
2013-12-03 21:21   ` Andrew Morton [this message]
2013-12-04 11:51     ` Prarit Bhargava
2013-12-04 17:20       ` Joe Perches
2013-12-04 18:22     ` Arnd Bergmann
2013-12-05 11:30       ` Matt Fleming
2013-12-05 15:55         ` Joe Perches
2013-12-06 12:30           ` Matt Fleming
2013-12-16 13:01             ` Prarit Bhargava
2013-12-16 16:31               ` Joe Perches
2013-12-02 15:19 ` [PATCH 2/3] Introduce FW_WARN* " Prarit Bhargava
2013-12-02 15:19 ` [PATCH 3/3] Introduce FW_BUG* " Prarit Bhargava
2013-12-02 17:34 ` [PATCH 0/3] Add Firmware Info, Warn, and Bug messages Joe Perches

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=20131203132120.6a7ab2cd7cc99720712cbe6a@linux-foundation.org \
    --to=akpm@linux-foundation.org \
    --cc=arnd@arndb.de \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=prarit@redhat.com \
    /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

all inboxes | Powered by JetHome®