dri-devel Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Stanislaw Gruszka <stanislaw.gruszka@linux.intel.com>
To: Jeffrey Hugo <quic_jhugo@quicinc.com>
Cc: Oded Gabbay <ogabbay@kernel.org>,
	Jacek Lawrynowicz <jacek.lawrynowicz@linux.intel.com>,
	dri-devel@lists.freedesktop.org
Subject: Re: [PATCH 2/7] accel/ivpu: Cancel recovery work
Date: Wed, 22 Mar 2023 15:55:19 +0100	[thread overview]
Message-ID: <20230322145519.GA2130371@linux.intel.com> (raw)
In-Reply-To: <e08e5d48-3139-01e8-2c91-c439a42824d9@quicinc.com>

On Wed, Mar 22, 2023 at 08:21:03AM -0600, Jeffrey Hugo wrote:
> On 3/22/2023 3:18 AM, Stanislaw Gruszka wrote:
> > Prevent running recovery_work after device is removed.
> > 
> > Signed-off-by: Stanislaw Gruszka <stanislaw.gruszka@linux.intel.com>
> > ---
> >   drivers/accel/ivpu/ivpu_drv.c |  2 ++
> >   drivers/accel/ivpu/ivpu_pm.c  | 15 +++++++++++++--
> >   drivers/accel/ivpu/ivpu_pm.h  |  1 +
> >   3 files changed, 16 insertions(+), 2 deletions(-)
> > 
> > diff --git a/drivers/accel/ivpu/ivpu_drv.c b/drivers/accel/ivpu/ivpu_drv.c
> > index ac06bbfca920..d9e311b40348 100644
> > --- a/drivers/accel/ivpu/ivpu_drv.c
> > +++ b/drivers/accel/ivpu/ivpu_drv.c
> > @@ -580,6 +580,8 @@ static void ivpu_dev_fini(struct ivpu_device *vdev)
> >   	ivpu_pm_disable(vdev);
> >   	ivpu_shutdown(vdev);
> >   	ivpu_job_done_thread_fini(vdev);
> > +	ivpu_pm_cancel_recovery(vdev);
> > +
> >   	ivpu_ipc_fini(vdev);
> >   	ivpu_fw_fini(vdev);
> >   	ivpu_mmu_global_context_fini(vdev);
> > diff --git a/drivers/accel/ivpu/ivpu_pm.c b/drivers/accel/ivpu/ivpu_pm.c
> > index a880f1dd857e..df2e98cc0a56 100644
> > --- a/drivers/accel/ivpu/ivpu_pm.c
> > +++ b/drivers/accel/ivpu/ivpu_pm.c
> > @@ -98,11 +98,17 @@ static int ivpu_resume(struct ivpu_device *vdev)
> >   static void ivpu_pm_recovery_work(struct work_struct *work)
> >   {
> >   	struct ivpu_pm_info *pm = container_of(work, struct ivpu_pm_info, recovery_work);
> > -	struct ivpu_device *vdev =  pm->vdev;
> > +	struct ivpu_device *vdev = pm->vdev;
> >   	char *evt[2] = {"IVPU_PM_EVENT=IVPU_RECOVER", NULL};
> >   	int ret;
> > -	ret = pci_reset_function(to_pci_dev(vdev->drm.dev));
> > +retry:
> > +	ret = pci_try_reset_function(to_pci_dev(vdev->drm.dev));
> > +	if (ret == -EAGAIN && !drm_dev_is_unplugged(&vdev->drm)) {
> > +		cond_resched();
> > +		goto retry;
> > +	}
> > +
> >   	if (ret)
> >   		ivpu_err(vdev, "Failed to reset VPU: %d\n", ret);
> 
> I'm unsure about this now.  Yes, you did fail to reset the VPU, but is it an
> error if the device is unplugged?  Feels like this message could be
> misleading in that corner case.

Yes, it's not elegant to print error message on unplug.
I'll change this to:

	if (ret && ret != -EAGAIN)
   		ivpu_err(vdev, "Failed to reset VPU: %d\n", ret);

Regards
Stanislaw


  reply	other threads:[~2023-03-22 14:55 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-03-22  9:18 [PATCH 0/7] acell/ivpu: Fixes for 6.3 Stanislaw Gruszka
2023-03-22  9:18 ` [PATCH 1/7] accel/ivpu: Do not access HW registers after unbind Stanislaw Gruszka
2023-03-22 14:16   ` Jeffrey Hugo
2023-03-22  9:18 ` [PATCH 2/7] accel/ivpu: Cancel recovery work Stanislaw Gruszka
2023-03-22 14:21   ` Jeffrey Hugo
2023-03-22 14:55     ` Stanislaw Gruszka [this message]
2023-03-22  9:18 ` [PATCH 3/7] accel/ivpu: Do not use SSID 1 Stanislaw Gruszka
2023-03-22 14:25   ` Jeffrey Hugo
2023-03-22 15:10     ` Stanislaw Gruszka
2023-03-22  9:18 ` [PATCH 4/7] accel/ivpu: Fix power down sequence Stanislaw Gruszka
2023-03-22 14:28   ` Jeffrey Hugo
2023-03-22  9:18 ` [PATCH 5/7] accel/ivpu: Disable buttress on device removal Stanislaw Gruszka
2023-03-22 14:33   ` Jeffrey Hugo
2023-03-22  9:18 ` [PATCH 6/7] accel/ivpu: Remove support for 1 tile SKUs Stanislaw Gruszka
2023-03-22 14:36   ` Jeffrey Hugo
2023-03-22  9:19 ` [PATCH 7/7] accel/ivpu: Fix VPU clock calculation Stanislaw Gruszka
2023-03-22 14:52   ` Jeffrey Hugo
2023-03-22 16:28     ` Stanislaw Gruszka
2023-03-23 11:00       ` Stanislaw Gruszka

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=20230322145519.GA2130371@linux.intel.com \
    --to=stanislaw.gruszka@linux.intel.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=jacek.lawrynowicz@linux.intel.com \
    --cc=ogabbay@kernel.org \
    --cc=quic_jhugo@quicinc.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