linux-pci.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jesse Barnes <jbarnes@virtuousgeek.org>
To: Arjan van de Ven <arjan@infradead.org>
Cc: linux-pci@vger.kernel.org, arjanvandeven@gmail.com
Subject: Re: pci: Annotate PCI quirks in initcall_debug style
Date: Fri, 10 Feb 2012 11:42:27 -0800	[thread overview]
Message-ID: <20120210114227.0b0679db@jbarnes-desktop> (raw)
In-Reply-To: <20120130205207.41636a23@infradead.org>

[-- Attachment #1: Type: text/plain, Size: 2679 bytes --]

On Mon, 30 Jan 2012 20:52:07 -0800
Arjan van de Ven <arjan@infradead.org> wrote:

> From 77fcc610189853f9c8cf35f77bb8bcfc68833202 Mon Sep 17 00:00:00 2001
> From: Arjan van de Ven <arjan@linux.intel.com>
> Date: Mon, 30 Jan 2012 20:30:03 -0800
> Subject: [PATCH] pci: Annotate PCI quirks in initcall_debug style
> 
> While diagnosing some boot time issues on a platform, all that I
> could see in the bootgraph/dmesg was that the system was spending
> a lot of time in applying one or more PCI quirks... which
> was virtually undebuggable.
> 
> This patch adds printk's in "initcall_debug" style to the dmesg,
> which are added when the user asks for the initcall_debug
> (the nr one tool to use when debugging boot hangs or boot time issues)
> kernel command line option.
> 
> CC: Jesse Barnes <jbarnes@virtuousgeek.org>
> CC: linux-pci@vger.kernel.org
> 
> Signed-off-by: Arjan van de Ven <arjan@linux.intel.com>
> ---
>  drivers/pci/quirks.c |   21 ++++++++++++++++++++-
>  1 files changed, 20 insertions(+), 1 deletions(-)
> 
> diff --git a/drivers/pci/quirks.c b/drivers/pci/quirks.c
> index 6476547..b3afa1c 100644
> --- a/drivers/pci/quirks.c
> +++ b/drivers/pci/quirks.c
> @@ -2906,6 +2906,22 @@ DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, 0x65f8, quirk_intel_mc_errata);
>  DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, 0x65f9, quirk_intel_mc_errata);
>  DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, 0x65fa, quirk_intel_mc_errata);
>  
> +
> +static void do_one_fixup_debug(void (*fn)(struct pci_dev *dev), struct pci_dev *dev)
> +{
> +	ktime_t calltime, delta, rettime;
> +	unsigned long long duration;
> +
> +	printk(KERN_DEBUG "calling  %pF @ %i\n", fn, task_pid_nr(current));
> +	calltime = ktime_get();
> +	fn(dev);
> +	rettime = ktime_get();
> +	delta = ktime_sub(rettime, calltime);
> +	duration = (unsigned long long) ktime_to_ns(delta) >> 10;
> +	printk(KERN_DEBUG "pci fixup %pF returned after %lld usecs\n", fn,
> +		duration);
> +}
> +
>  static void pci_do_fixups(struct pci_dev *dev, struct pci_fixup *f,
>  			  struct pci_fixup *end)
>  {
> @@ -2913,7 +2929,10 @@ static void pci_do_fixups(struct pci_dev *dev, struct pci_fixup *f,
>  		if ((f->vendor == dev->vendor || f->vendor == (u16) PCI_ANY_ID) &&
>  		    (f->device == dev->device || f->device == (u16) PCI_ANY_ID)) {
>  			dev_dbg(&dev->dev, "calling %pF\n", f->hook);
> -			f->hook(dev);
> +			if (initcall_debug)
> +				do_one_fixup_debug(f->hook, dev);
> +			else
> +				f->hook(dev);
>  		}
>  		f++;
>  	}

Looks cool Arjan, thanks.  Applied to my -next branch.

-- 
Jesse Barnes, Intel Open Source Technology Center

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 836 bytes --]

      reply	other threads:[~2012-02-10 19:42 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-01-31  4:52 pci: Annotate PCI quirks in initcall_debug style Arjan van de Ven
2012-02-10 19:42 ` Jesse Barnes [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=20120210114227.0b0679db@jbarnes-desktop \
    --to=jbarnes@virtuousgeek.org \
    --cc=arjan@infradead.org \
    --cc=arjanvandeven@gmail.com \
    --cc=linux-pci@vger.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).