From: Russell Currey <ruscur@russell.cc>
To: Michael Ellerman <mpe@ellerman.id.au>, linuxppc-dev@lists.ozlabs.org
Cc: gwshan@linux.vnet.ibm.com
Subject: Re: [PATCH] powernv/pci: Add PHB register dump debugfs handle
Date: Tue, 26 Jul 2016 15:37:23 +1000 [thread overview]
Message-ID: <1469511443.5228.2.camel@russell.cc> (raw)
In-Reply-To: <146949753931.3859.11305398485148230358@concordia>
On Tue, 2016-07-26 at 11:45 +1000, Michael Ellerman wrote:
> Quoting Russell Currey (2016-07-22 15:23:36)
> >
> > On EEH events the kernel will print a dump of relevant registers.
> > If EEH is unavailable (i.e. CONFIG_EEH is disabled, a new platform
> > doesn't have EEH support, etc) this information isn't readily available.
> >
> > Add a new debugfs handler to trigger a PHB register dump, so that this
> > information can be made available on demand.
>
> This is a bit weird.
>
> It's a debugfs file, but when you read from it you get nothing (I think,
> you have no read() defined).
>
> When you write to it, regardless of what you write, the kernel spits
> some stuff out to dmesg and throws away whatever you wrote.
>
> Ideally pnv_pci_dump_phb_diag_data() would write its output to a buffer,
> which we could then either send to dmesg, or give to debugfs. But that
> might be more work than we want to do for this.
>
> If we just want a trigger file, then I think it'd be preferable to just
> use a simple attribute, with a set and no show, eg. something like:
>
> static int foo_set(void *data, u64 val)
> {
> if (val != 1)
> return -EINVAL;
>
> ...
>
> return 0;
> }
>
> DEFINE_SIMPLE_ATTRIBUTE(fops_foo, NULL, foo_set, "%llu\n");
>
> That requires that you write "1" to the file to trigger the reg dump.
I don't think I can use this here. Triggering the diag dump on the given PHB
(these are in /sys/kernel/debug/powerpc/PCI####), and that PHB is retrieved from
the file handler. It looks like I have no access to the file struct if using a
simple getter/setter.
>
>
> >
> > diff --git a/arch/powerpc/platforms/powernv/pci-ioda.c
> > b/arch/powerpc/platforms/powernv/pci-ioda.c
> > index 891fc4a..ada2f3c 100644
> > --- a/arch/powerpc/platforms/powernv/pci-ioda.c
> > +++ b/arch/powerpc/platforms/powernv/pci-ioda.c
> > @@ -3036,6 +3068,9 @@ static void pnv_pci_ioda_create_dbgfs(void)
> > if (!phb->dbgfs)
> > pr_warning("%s: Error on creating debugfs on
> > PHB#%x\n",
> > __func__, hose->global_number);
> > +
> > + debugfs_create_file("regdump", 0200, phb->dbgfs, hose,
> > + &pnv_pci_debug_ops);
> > }
>
> You shouldn't be trying to create the file if the directory create failed. So
> the check for (!phb->dbgfs) should probably print and then continue.
Good catch.
>
> And a better name would be "dump-regs", because it indicates that the file
> does
> something, rather than is something.
That is indeed better.
>
> cheers
next prev parent reply other threads:[~2016-07-26 5:37 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-07-22 5:23 [PATCH] powernv/pci: Add PHB register dump debugfs handle Russell Currey
2016-07-22 6:36 ` Gavin Shan
2016-07-25 17:53 ` Tyrel Datwyler
2016-07-25 23:45 ` Gavin Shan
2016-07-26 1:06 ` Michael Ellerman
2016-07-26 0:37 ` Russell Currey
2016-07-26 1:45 ` Michael Ellerman
2016-07-26 5:37 ` Russell Currey [this message]
2016-07-26 9:47 ` Michael Ellerman
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=1469511443.5228.2.camel@russell.cc \
--to=ruscur@russell.cc \
--cc=gwshan@linux.vnet.ibm.com \
--cc=linuxppc-dev@lists.ozlabs.org \
--cc=mpe@ellerman.id.au \
/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.