From: Alexey Kardashevskiy <aik@ozlabs.ru>
To: Sam Bobroff <sbobroff@linux.ibm.com>
Cc: oohall@gmail.com, linuxppc-dev@lists.ozlabs.org,
tyreld@linux.vnet.ibm.com
Subject: Re: [PATCH v2 3/6] powerpc/eeh: Improve debug messages around device addition
Date: Thu, 20 Jun 2019 12:40:49 +1000 [thread overview]
Message-ID: <e8f68068-bb62-6d2e-f484-d6a111811fbc@ozlabs.ru> (raw)
In-Reply-To: <20190619042706.GA24143@tungsten.ozlabs.ibm.com>
On 19/06/2019 14:27, Sam Bobroff wrote:
> On Tue, Jun 11, 2019 at 03:47:58PM +1000, Alexey Kardashevskiy wrote:
>>
>>
>> On 07/05/2019 14:30, Sam Bobroff wrote:
>>> Also remove useless comment.
>>>
>>> Signed-off-by: Sam Bobroff <sbobroff@linux.ibm.com>
>>> Reviewed-by: Alexey Kardashevskiy <aik@ozlabs.ru>
>>> ---
>>> arch/powerpc/kernel/eeh.c | 2 +-
>>> arch/powerpc/platforms/powernv/eeh-powernv.c | 14 ++++++++----
>>> arch/powerpc/platforms/pseries/eeh_pseries.c | 23 +++++++++++++++-----
>>> 3 files changed, 28 insertions(+), 11 deletions(-)
>>>
>>> diff --git a/arch/powerpc/kernel/eeh.c b/arch/powerpc/kernel/eeh.c
>>> index 8d3c36a1f194..b14d89547895 100644
>>> --- a/arch/powerpc/kernel/eeh.c
>>> +++ b/arch/powerpc/kernel/eeh.c
>>> @@ -1291,7 +1291,7 @@ void eeh_add_device_late(struct pci_dev *dev)
>>> pdn = pci_get_pdn_by_devfn(dev->bus, dev->devfn);
>>> edev = pdn_to_eeh_dev(pdn);
>>> if (edev->pdev == dev) {
>>> - pr_debug("EEH: Already referenced !\n");
>>> + pr_debug("EEH: Device %s already referenced!\n", pci_name(dev));
>>> return;
>>> }
>>>
>>> diff --git a/arch/powerpc/platforms/powernv/eeh-powernv.c b/arch/powerpc/platforms/powernv/eeh-powernv.c
>>> index 6fc1a463b796..0e374cdba961 100644
>>> --- a/arch/powerpc/platforms/powernv/eeh-powernv.c
>>> +++ b/arch/powerpc/platforms/powernv/eeh-powernv.c
>>> @@ -50,10 +50,7 @@ void pnv_pcibios_bus_add_device(struct pci_dev *pdev)
>>> if (!pdev->is_virtfn)
>>> return;
>>>
>>> - /*
>>> - * The following operations will fail if VF's sysfs files
>>> - * aren't created or its resources aren't finalized.
>>> - */
>>> + pr_debug("%s: EEH: Setting up device %s.\n", __func__, pci_name(pdev));
>>
>>
>> dev_dbg() seems more appropriate.
>
> Oh! It does, or even pci_debug() :-)
>
> I'll change it if I need to do another version, otherwise I'll clean it
> up later.
>
>>> eeh_add_device_early(pdn);
>>> eeh_add_device_late(pdev);
>>> eeh_sysfs_add_device(pdev);
>>> @@ -397,6 +394,10 @@ static void *pnv_eeh_probe(struct pci_dn *pdn, void *data)
>>> int ret;
>>> int config_addr = (pdn->busno << 8) | (pdn->devfn);
>>>
>>> + pr_debug("%s: probing %04x:%02x:%02x.%01x\n",
>>> + __func__, hose->global_number, pdn->busno,
>>> + PCI_SLOT(pdn->devfn), PCI_FUNC(pdn->devfn));
>>> +
>>> /*
>>> * When probing the root bridge, which doesn't have any
>>> * subordinate PCI devices. We don't have OF node for
>>> @@ -491,6 +492,11 @@ static void *pnv_eeh_probe(struct pci_dn *pdn, void *data)
>>> /* Save memory bars */
>>> eeh_save_bars(edev);
>>>
>>> + pr_debug("%s: EEH enabled on %02x:%02x.%01x PHB#%x-PE#%x\n",
>>> + __func__, pdn->busno, PCI_SLOT(pdn->devfn),
>>> + PCI_FUNC(pdn->devfn), edev->pe->phb->global_number,
>>> + edev->pe->addr);
>>> +
>>> return NULL;
>>> }
>>>
>>> diff --git a/arch/powerpc/platforms/pseries/eeh_pseries.c b/arch/powerpc/platforms/pseries/eeh_pseries.c
>>> index 7aa50258dd42..ae06878fbdea 100644
>>> --- a/arch/powerpc/platforms/pseries/eeh_pseries.c
>>> +++ b/arch/powerpc/platforms/pseries/eeh_pseries.c
>>> @@ -65,6 +65,8 @@ void pseries_pcibios_bus_add_device(struct pci_dev *pdev)
>>> if (!pdev->is_virtfn)
>>> return;
>>>
>>> + pr_debug("%s: EEH: Setting up device %s.\n", __func__, pci_name(pdev));
>>> +
>>> pdn->device_id = pdev->device;
>>> pdn->vendor_id = pdev->vendor;
>>> pdn->class_code = pdev->class;
>>> @@ -251,6 +253,10 @@ static void *pseries_eeh_probe(struct pci_dn *pdn, void *data)
>>> int enable = 0;
>>> int ret;
>>>
>>> + pr_debug("%s: probing %04x:%02x:%02x.%01x\n",
>>> + __func__, pdn->phb->global_number, pdn->busno,
>>> + PCI_SLOT(pdn->devfn), PCI_FUNC(pdn->devfn));
>>> +
>>> /* Retrieve OF node and eeh device */
>>> edev = pdn_to_eeh_dev(pdn);
>>> if (!edev || edev->pe)
>>> @@ -294,7 +300,12 @@ static void *pseries_eeh_probe(struct pci_dn *pdn, void *data)
>>>
>>> /* Enable EEH on the device */
>>> ret = eeh_ops->set_option(&pe, EEH_OPT_ENABLE);
>>> - if (!ret) {
>>> + if (ret) {
>>> + pr_debug("%s: EEH failed to enable on %02x:%02x.%01x PHB#%x-PE#%x (code %d)\n",
>>> + __func__, pdn->busno, PCI_SLOT(pdn->devfn),
>>> + PCI_FUNC(pdn->devfn), pe.phb->global_number,
>>> + pe.addr, ret);
>>> + } else {
>>
>>
>> edev!=NULL here so you could do dev_dbg(&edev->pdev->dev,...) and skip
>> PCI_SLOT/PCI_FUNC. Or is (edev!=NULL && edev->pdev==NULL) possible (it
>> could be, just asking)?
>
> I can see that edev will be non-NULL here, but that pr_debug() pattern
> (using the PDN information to form the PCI address) is quite common
> across the EEH code, so I think rather than changing a couple of
> specific cases, I should do a separate cleanup patch and introduce
> something like pdn_debug(pdn, "...."). What do you think?
I'd switch them all to already existing dev_dbg/pci_debug rather than
adding pdn_debug as imho it should not have been used in the first place
really...
> (I don't know exactly when edev->pdev can be NULL.)
... and if you switch to dev_dbg/pci_debug, I think quite soon you'll
know if it can or cannot be NULL :)
>
>>
>>> /* Retrieve PE address */
>>> edev->pe_config_addr = eeh_ops->get_pe_addr(&pe);
>>> pe.addr = edev->pe_config_addr;
>>> @@ -310,11 +321,6 @@ static void *pseries_eeh_probe(struct pci_dn *pdn, void *data)
>>> if (enable) {
>>> eeh_add_flag(EEH_ENABLED);
>>> eeh_add_to_parent_pe(edev);
>>> -
>>> - pr_debug("%s: EEH enabled on %02x:%02x.%01x PHB#%x-PE#%x\n",
>>> - __func__, pdn->busno, PCI_SLOT(pdn->devfn),
>>> - PCI_FUNC(pdn->devfn), pe.phb->global_number,
>>> - pe.addr);
>>> } else if (pdn->parent && pdn_to_eeh_dev(pdn->parent) &&
>>> (pdn_to_eeh_dev(pdn->parent))->pe) {
>>> /* This device doesn't support EEH, but it may have an
>>> @@ -323,6 +329,11 @@ static void *pseries_eeh_probe(struct pci_dn *pdn, void *data)
>>> edev->pe_config_addr = pdn_to_eeh_dev(pdn->parent)->pe_config_addr;
>>> eeh_add_to_parent_pe(edev);
>>> }
>>> + pr_debug("%s: EEH %s on %02x:%02x.%01x PHB#%x-PE#%x (code %d)\n",
>>> + __func__, (enable ? "enabled" : "unsupported"),
>>> + pdn->busno, PCI_SLOT(pdn->devfn),
>>> + PCI_FUNC(pdn->devfn), pe.phb->global_number,
>>> + pe.addr, ret);
>>
>> Same here. I understand though this one is a cut-n-paste :)
>>
>>
>>> }
>>>
>>> /* Save memory bars */
>>>
>>
>> --
>> Alexey
--
Alexey
next prev parent reply other threads:[~2019-06-20 2:42 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-05-07 4:30 [PATCH v2 0/6] Sam Bobroff
2019-05-07 4:30 ` [PATCH v2 1/6] powerpc/64: Adjust order in pcibios_init() Sam Bobroff
2019-05-07 4:30 ` [PATCH v2 2/6] powerpc/eeh: Clear stale EEH_DEV_NO_HANDLER flag Sam Bobroff
2019-05-07 4:30 ` [PATCH v2 3/6] powerpc/eeh: Improve debug messages around device addition Sam Bobroff
2019-06-11 5:47 ` Alexey Kardashevskiy
2019-06-19 4:27 ` Sam Bobroff
2019-06-20 2:40 ` Alexey Kardashevskiy [this message]
2019-06-20 3:45 ` Oliver O'Halloran
2019-07-16 6:48 ` [EXTERNAL] " Sam Bobroff
2019-07-16 7:00 ` Oliver O'Halloran
2019-07-18 5:24 ` Sam Bobroff
2019-05-07 4:30 ` [PATCH v2 4/6] powerpc/eeh: Initialize EEH address cache earlier Sam Bobroff
2019-05-07 4:30 ` [PATCH v2 5/6] powerpc/eeh: EEH for pSeries hot plug Sam Bobroff
2019-05-07 4:30 ` [PATCH v2 6/6] powerpc/eeh: Refactor around eeh_probe_devices() Sam Bobroff
2019-06-05 5:49 ` Oliver
2019-06-19 5:53 ` Sam Bobroff
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=e8f68068-bb62-6d2e-f484-d6a111811fbc@ozlabs.ru \
--to=aik@ozlabs.ru \
--cc=linuxppc-dev@lists.ozlabs.org \
--cc=oohall@gmail.com \
--cc=sbobroff@linux.ibm.com \
--cc=tyreld@linux.vnet.ibm.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).