public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Anatoliy Glagolev <glagolig@gmail.com>
To: Brian King <brking@linux.vnet.ibm.com>
Cc: aglagolev@purestorage.com, qla2xxx-upstream@qlogic.com,
	jejb@linux.vnet.ibm.com, martin.petersen@oracle.com,
	linux-scsi@vger.kernel.org, linux-kernel@vger.kernel.org,
	Benjamin Herrenschmidt <benh@au1.ibm.com>,
	kmahlkuc@linux.vnet.ibm.com
Subject: Re: [PATCH] scsi: qla2xxx: disabling pci error handler early
Date: Mon, 10 Dec 2018 10:38:54 -0700	[thread overview]
Message-ID: <20181210173853.GA36196@xldev-tmpl.dev.purestorage.com> (raw)
In-Reply-To: <d7b867f3-22d1-855d-86ce-43089e46ca6a@linux.vnet.ibm.com>

Thanks, Brian. Great point. Even for AER, it looks like in-flight
error handler completion is not guaranteed on
pci_disable_pcie_error_reporting call, so the crash is still possible.
It looks like we need to maintain per-pci_dev context and keep track
of in-flight callbacks to make a clean fix. I will send a new patch.

On Fri, Dec 07, 2018 at 04:00:27PM -0600, Brian King wrote:
> On 12/07/2018 01:56 PM, Anatoliy Glagolev wrote:
> > qla2x00_disable_board_on_pci_error and pcie error handlers may run
> > in parallel. Specifically, I observed qla2xxx_pci_slot_reset running
> > at around the same moment as qla2x00_disable_board_on_pci_error.
> > If scsi_qla_host_t or qla_hw_data structs are removed before an error
> > handler completes, the handler crashes.
> > 
> > This patch disables pcie error handling early in
> > qla2x00_disable_board_on_pci_error and in other paths that remove
> > those structs.
> 
> While this may fix this issue for PCIe AER, I think you'll still have
> the exposure for EEH errors on a Power system, since we don't have
> the pci_enable_pcie_error_reporting API wired up to do anything,
> nor do we have much ability to do anything with it since its an
> attribute of the hardware.
> 
> Is there a way to fix this that doesn't break Power?
> 
> Thanks,
> 
> Brian
> 
> > 
> > Signed-off-by: Anatoliy Glagolev <glagolig@gmail.com>
> > ---
> >  drivers/scsi/qla2xxx/qla_os.c | 15 +++++++++------
> >  1 file changed, 9 insertions(+), 6 deletions(-)
> > 
> > diff --git a/drivers/scsi/qla2xxx/qla_os.c b/drivers/scsi/qla2xxx/qla_os.c
> > index e881fce..b8f277a 100644
> > --- a/drivers/scsi/qla2xxx/qla_os.c
> > +++ b/drivers/scsi/qla2xxx/qla_os.c
> > @@ -2775,9 +2775,6 @@ static void qla2x00_iocb_work_fn(struct work_struct *work)
> >  			return ret;
> >  	}
> > 
> > -	/* This may fail but that's ok */
> > -	pci_enable_pcie_error_reporting(pdev);
> > -
> >  	ha = kzalloc(sizeof(struct qla_hw_data), GFP_KERNEL);
> >  	if (!ha) {
> >  		ql_log_pci(ql_log_fatal, pdev, 0x0009,
> > @@ -3039,6 +3036,9 @@ static void qla2x00_iocb_work_fn(struct work_struct *work)
> >  		goto probe_hw_failed;
> >  	}
> > 
> > +	/* This may fail but that's ok */
> > +	pci_enable_pcie_error_reporting(pdev);
> > +
> >  	pci_set_drvdata(pdev, base_vha);
> >  	set_bit(PFLG_DRIVER_PROBING, &base_vha->pci_flags);
> > 
> > @@ -3400,6 +3400,8 @@ static void qla2x00_iocb_work_fn(struct work_struct *work)
> >  		kthread_stop(t);
> >  	}
> > 
> > +	pci_disable_pcie_error_reporting();
> > +
> >  	qla2x00_free_device(base_vha);
> >  	scsi_host_put(base_vha->host);
> >  	/*
> > @@ -3625,6 +3627,8 @@ static void qla2x00_iocb_work_fn(struct work_struct *work)
> >  	}
> >  	qla2x00_wait_for_hba_ready(base_vha);
> > 
> > +	pci_disable_pcie_error_reporting(pdev);
> > +
> >  	qla2x00_wait_for_sess_deletion(base_vha);
> > 
> >  	/*
> > @@ -3698,8 +3702,6 @@ static void qla2x00_iocb_work_fn(struct work_struct *work)
> >  	pci_release_selected_regions(ha->pdev, ha->bars);
> >  	kfree(ha);
> > 
> > -	pci_disable_pcie_error_reporting(pdev);
> > -
> >  	pci_disable_device(pdev);
> >  }
> > 
> > @@ -5826,6 +5828,8 @@ void qla2x00_relogin(struct scsi_qla_host *vha)
> >  		return;
> >  	}
> > 
> > +	pci_disable_pcie_error_reporting(pdev);
> > +
> >  	qla2x00_wait_for_sess_deletion(base_vha);
> > 
> >  	set_bit(UNLOADING, &base_vha->dpc_flags);
> > @@ -5866,7 +5870,6 @@ void qla2x00_relogin(struct scsi_qla_host *vha)
> >  	qla2x00_unmap_iobases(ha);
> > 
> >  	pci_release_selected_regions(ha->pdev, ha->bars);
> > -	pci_disable_pcie_error_reporting(pdev);
> >  	pci_disable_device(pdev);
> > 
> >  	/*
> > 
> 
> 
> -- 
> Brian King
> Power Linux I/O
> IBM Linux Technology Center
> 

  reply	other threads:[~2018-12-10 17:39 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-12-07 19:56 [PATCH] scsi: qla2xxx: disabling pci error handler early Anatoliy Glagolev
2018-12-07 22:00 ` Brian King
2018-12-10 17:38   ` Anatoliy Glagolev [this message]
2018-12-13 19:29 ` [PATCH v2] scsi: qla2xxx: pci error handler sync Anatoliy Glagolev

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=20181210173853.GA36196@xldev-tmpl.dev.purestorage.com \
    --to=glagolig@gmail.com \
    --cc=aglagolev@purestorage.com \
    --cc=benh@au1.ibm.com \
    --cc=brking@linux.vnet.ibm.com \
    --cc=jejb@linux.vnet.ibm.com \
    --cc=kmahlkuc@linux.vnet.ibm.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-scsi@vger.kernel.org \
    --cc=martin.petersen@oracle.com \
    --cc=qla2xxx-upstream@qlogic.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