From: Frederic Barrat <fbarrat@linux.ibm.com>
To: Vaibhav Jain <vaibhav@linux.ibm.com>, linuxppc-dev@lists.ozlabs.org
Cc: Philippe Bergheaud <philippe.bergheaud@fr.ibm.com>,
Alastair D'Silva <alastair@linux.ibm.com>,
Christophe Lombard <christophe_lombard@fr.ibm.com>,
Andrew Donnellan <andrew.donnellan@au1.ibm.com>
Subject: Re: [PATCH] cxl: Wrap iterations over afu slices inside 'afu_list_lock'
Date: Fri, 25 Jan 2019 15:11:11 -0600 [thread overview]
Message-ID: <4a90ada0-99dc-df32-7331-ffb3191ebf40@linux.ibm.com> (raw)
In-Reply-To: <20190125044052.32059-1-vaibhav@linux.ibm.com>
> diff --git a/drivers/misc/cxl/pci.c b/drivers/misc/cxl/pci.c
> index c79ba1c699ad..28c28bceb063 100644
> --- a/drivers/misc/cxl/pci.c
> +++ b/drivers/misc/cxl/pci.c
> @@ -1932,14 +1935,20 @@ static pci_ers_result_t cxl_pci_error_detected(struct pci_dev *pdev,
> * * In slot_reset, free the old resources and allocate new ones.
> * * In resume, clear the flag to allow things to start.
> */
> +
> + /* Make sure no one else changes the afu list */
> + spin_lock(&adapter->afu_list_lock);
> +
> for (i = 0; i < adapter->slices; i++) {
> afu = adapter->afu[i];
>
> afu_result = cxl_vphb_error_detected(afu, state);
>
> - cxl_context_detach_all(afu);
> - cxl_ops->afu_deactivate_mode(afu, afu->current_mode);
> - pci_deconfigure_afu(afu);
> + if (afu != NULL) {
> + cxl_context_detach_all(afu);
> + cxl_ops->afu_deactivate_mode(afu, afu->current_mode);
> + pci_deconfigure_afu(afu);
> + }
I can see you're also checking if cxl_vphb_error_detected() is called
with a NULL afu from within the function, but why not move the call to
cxl_vphb_error_detected() within that "if (afu != NULL)... " statement?
Otherwise, it looks suspicious when reading the code.
> @@ -2051,10 +2067,11 @@ static void cxl_pci_resume(struct pci_dev *pdev)
> * This is not the place to be checking if everything came back up
> * properly, because there's no return value: do that in slot_reset.
> */
> + spin_lock(&adapter->afu_list_lock);
> for (i = 0; i < adapter->slices; i++) {
> afu = adapter->afu[i];
>
> - if (afu->phb == NULL)
> + if (afu || afu->phb == NULL)
> continue;
if (afu == NULL ...
Fred
next prev parent reply other threads:[~2019-01-25 21:12 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-01-25 4:40 [PATCH] cxl: Wrap iterations over afu slices inside 'afu_list_lock' Vaibhav Jain
2019-01-25 21:11 ` Frederic Barrat [this message]
2019-01-26 11:48 ` Vaibhav Jain
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=4a90ada0-99dc-df32-7331-ffb3191ebf40@linux.ibm.com \
--to=fbarrat@linux.ibm.com \
--cc=alastair@linux.ibm.com \
--cc=andrew.donnellan@au1.ibm.com \
--cc=christophe_lombard@fr.ibm.com \
--cc=linuxppc-dev@lists.ozlabs.org \
--cc=philippe.bergheaud@fr.ibm.com \
--cc=vaibhav@linux.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).