linux-acpi.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Bjorn Helgaas <bhelgaas@google.com>
To: Lance Ortiz <lance.ortiz@hp.com>
Cc: lance_ortiz@hotmail.com, jiang.liu@huawei.com,
	tony.luck@intel.com, bp@alien8.de, rostedt@goodmis.org,
	mchehab@redhat.com, linux-acpi@vger.kernel.org,
	linux-pci@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v9 3/3] aerdrv: Cleanup log output for AER
Date: Fri, 4 Jan 2013 15:07:30 -0700	[thread overview]
Message-ID: <CAErSpo5LV5QApKqVVV7FdpjdFFZ9=+8JJfaDtDqJ2AzFpxM+HA@mail.gmail.com> (raw)
In-Reply-To: <20130103223415.10751.17744.stgit@grignak.americas.hpqcorp.net>

On Thu, Jan 3, 2013 at 3:34 PM, Lance Ortiz <lance.ortiz@hp.com> wrote:
> These changes make cper_print_aer more consistent with aer_print_error
> and clean things up by elimiating the use of the prefix variable and
> replacing it with dev_printk.
>
> v1-v2 fix some compile errors withinn the #ifdef
> v3-v4 remove agent id stuff and kept print the same to avoid
> compatibility issues
> v7-v8 Updated to use dev_printk instated of prefix. Changed
> log levels to KERN_ERR as per Mauro's suggestion.
> v8-v9 Changed dev_printk to dev_err since all log levels are KERN_ERR.
>
> Signed-off-by: Lance Ortiz <lance.ortiz@hp.com>
> Acked-by: Tony Luck <tony.luck@intel.com>

Acked-by: Bjorn Helgaas <bhelgaas@google.com>

Nits (no need to fix them unless you have other reasons to touch this patch):

s/elimiating/eliminating/ above.

I remove the "v1-v2" notes when I merge patches because I don't think
they're useful any more.  But if Tony applies these, he can use his
judgment.

And a couple more below.

> ---
>
>  drivers/pci/pcie/aer/aerdrv_errprint.c |   54 +++++++++++++++-----------------
>  1 files changed, 26 insertions(+), 28 deletions(-)
>
> diff --git a/drivers/pci/pcie/aer/aerdrv_errprint.c b/drivers/pci/pcie/aer/aerdrv_errprint.c
> index d3e5fc5..5ab1425 100644
> --- a/drivers/pci/pcie/aer/aerdrv_errprint.c
> +++ b/drivers/pci/pcie/aer/aerdrv_errprint.c
> @@ -124,12 +124,11 @@ static const char *aer_agent_string[] = {
>         "Transmitter ID"
>  };
>
> -static void __aer_print_error(const char *prefix,
> +static void __aer_print_error(struct pci_dev *dev,
>                               struct aer_err_info *info)

This looks like it would fit on one line.

>  {
>         int i, status;
>         const char *errmsg = NULL;
> -

Don't remove this blank line.

>         status = (info->status & ~info->mask);
>
>         for (i = 0; i < 32; i++) {
> @@ -144,26 +143,22 @@ static void __aer_print_error(const char *prefix,
>                                 aer_uncorrectable_error_string[i] : NULL;
>
>                 if (errmsg)
> -                       printk("%s""   [%2d] %-22s%s\n", prefix, i, errmsg,
> +                       dev_err(&dev->dev, "   [%2d] %-22s%s\n", i, errmsg,
>                                 info->first_error == i ? " (First)" : "");
>                 else
> -                       printk("%s""   [%2d] Unknown Error Bit%s\n", prefix, i,
> -                               info->first_error == i ? " (First)" : "");
> +                       dev_err(&dev->dev, "   [%2d] Unknown Error Bit%s\n",
> +                               i, info->first_error == i ? " (First)" : "");
>         }
>  }
>
>  void aer_print_error(struct pci_dev *dev, struct aer_err_info *info)
>  {
>         int id = ((dev->bus->number << 8) | dev->devfn);
> -       char prefix[44];
> -
> -       snprintf(prefix, sizeof(prefix), "%s%s %s: ",
> -                (info->severity == AER_CORRECTABLE) ? KERN_WARNING : KERN_ERR,
> -                dev_driver_string(&dev->dev), dev_name(&dev->dev));
>
>         if (info->status == 0) {
> -               printk("%s""PCIe Bus Error: severity=%s, type=Unaccessible, "
> -                       "id=%04x(Unregistered Agent ID)\n", prefix,
> +               dev_err(&dev->dev,
> +                       "PCIe Bus Error: severity=%s, type=Unaccessible, "
> +                       "id=%04x(Unregistered Agent ID)\n",
>                         aer_error_severity_string[info->severity], id);

This means these messages will all be KERN_ERR, when they used to be
KERN_WARNING or KERN_ERR depending on the severity.  That's OK with
me, but mentioning in the changelog would make clear that this is what
you intended.

>         } else {
>                 int layer, agent;
> @@ -171,22 +166,24 @@ void aer_print_error(struct pci_dev *dev, struct aer_err_info *info)
>                 layer = AER_GET_LAYER_ERROR(info->severity, info->status);
>                 agent = AER_GET_AGENT(info->severity, info->status);
>
> -               printk("%s""PCIe Bus Error: severity=%s, type=%s, id=%04x(%s)\n",
> -                       prefix, aer_error_severity_string[info->severity],
> +               dev_err(&dev->dev,
> +                       "PCIe Bus Error: severity=%s, type=%s, id=%04x(%s)\n",
> +                       aer_error_severity_string[info->severity],
>                         aer_error_layer[layer], id, aer_agent_string[agent]);
>
> -               printk("%s""  device [%04x:%04x] error status/mask=%08x/%08x\n",
> -                       prefix, dev->vendor, dev->device,
> +               dev_err(&dev->dev,
> +                       "  device [%04x:%04x] error status/mask=%08x/%08x\n",
> +                       dev->vendor, dev->device,
>                         info->status, info->mask);
>
> -               __aer_print_error(prefix, info);
> +               __aer_print_error(dev, info);
>
>                 if (info->tlp_header_valid) {
>                         unsigned char *tlp = (unsigned char *) &info->tlp;
> -                       printk("%s""  TLP Header:"
> +                       dev_err(&dev->dev, "  TLP Header:"
>                                 " %02x%02x%02x%02x %02x%02x%02x%02x"
>                                 " %02x%02x%02x%02x %02x%02x%02x%02x\n",
> -                               prefix, *(tlp + 3), *(tlp + 2), *(tlp + 1), *tlp,
> +                               *(tlp + 3), *(tlp + 2), *(tlp + 1), *tlp,
>                                 *(tlp + 7), *(tlp + 6), *(tlp + 5), *(tlp + 4),
>                                 *(tlp + 11), *(tlp + 10), *(tlp + 9),
>                                 *(tlp + 8), *(tlp + 15), *(tlp + 14),
> @@ -195,8 +192,9 @@ void aer_print_error(struct pci_dev *dev, struct aer_err_info *info)
>         }
>
>         if (info->id && info->error_dev_num > 1 && info->id == id)
> -               printk("%s""  Error of this Agent(%04x) is reported first\n",
> -                       prefix, id);
> +               dev_err(&dev->dev,
> +                          "  Error of this Agent(%04x) is reported first\n",
> +                       id);
>         trace_aer_event(dev_name(&dev->dev), (info->status & ~info->mask),
>                         info->severity);
>  }
> @@ -244,21 +242,21 @@ void cper_print_aer(const char *prefix, struct pci_dev *dev, int cper_severity,
>         }
>         layer = AER_GET_LAYER_ERROR(aer_severity, status);
>         agent = AER_GET_AGENT(aer_severity, status);
> -       printk("%s""aer_status: 0x%08x, aer_mask: 0x%08x\n",
> -              prefix, status, mask);
> +       dev_err(&dev->dev, "aer_status: 0x%08x, aer_mask: 0x%08x\n",
> +              status, mask);
>         cper_print_bits(prefix, status, status_strs, status_strs_size);
> -       printk("%s""aer_layer=%s, aer_agent=%s\n", prefix,
> +       dev_err(&dev->dev, "aer_layer=%s, aer_agent=%s\n",
>                aer_error_layer[layer], aer_agent_string[agent]);
>         if (aer_severity != AER_CORRECTABLE)
> -               printk("%s""aer_uncor_severity: 0x%08x\n",
> -                      prefix, aer->uncor_severity);
> +               dev_err(&dev->dev, "aer_uncor_severity: 0x%08x\n",
> +                      aer->uncor_severity);
>         if (tlp_header_valid) {
>                 const unsigned char *tlp;
>                 tlp = (const unsigned char *)&aer->header_log;
> -               printk("%s""aer_tlp_header:"
> +               dev_err(&dev->dev, "aer_tlp_header:"
>                         " %02x%02x%02x%02x %02x%02x%02x%02x"
>                         " %02x%02x%02x%02x %02x%02x%02x%02x\n",
> -                       prefix, *(tlp + 3), *(tlp + 2), *(tlp + 1), *tlp,
> +                       *(tlp + 3), *(tlp + 2), *(tlp + 1), *tlp,
>                         *(tlp + 7), *(tlp + 6), *(tlp + 5), *(tlp + 4),
>                         *(tlp + 11), *(tlp + 10), *(tlp + 9),
>                         *(tlp + 8), *(tlp + 15), *(tlp + 14),
>

  reply	other threads:[~2013-01-04 22:07 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-01-03 22:34 [PATCH v9 1/3] aerdrv: Trace Event for AER Lance Ortiz
2013-01-03 22:34 ` [PATCH v9 2/3] aerdrv: Enhanced AER logging Lance Ortiz
2013-01-04 22:07   ` Bjorn Helgaas
2013-01-03 22:34 ` [PATCH v9 3/3] aerdrv: Cleanup log output for AER Lance Ortiz
2013-01-04 22:07   ` Bjorn Helgaas [this message]
2013-01-04 22:22     ` Luck, Tony

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='CAErSpo5LV5QApKqVVV7FdpjdFFZ9=+8JJfaDtDqJ2AzFpxM+HA@mail.gmail.com' \
    --to=bhelgaas@google.com \
    --cc=bp@alien8.de \
    --cc=jiang.liu@huawei.com \
    --cc=lance.ortiz@hp.com \
    --cc=lance_ortiz@hotmail.com \
    --cc=linux-acpi@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pci@vger.kernel.org \
    --cc=mchehab@redhat.com \
    --cc=rostedt@goodmis.org \
    --cc=tony.luck@intel.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;
as well as URLs for NNTP newsgroup(s).