From: Pixel Ding <Pixel.Ding-5C7GfCeVMHo@public.gmane.org>
To: amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org
Cc: Pixel Ding <Pixel.Ding-5C7GfCeVMHo@public.gmane.org>
Subject: [PATCH 2/2] drm/amdgpu/virt: schedule work to handle vm fault for VF
Date: Mon, 6 Feb 2017 15:00:03 +0800 [thread overview]
Message-ID: <1486364403-29374-1-git-send-email-Pixel.Ding@amd.com> (raw)
VF uses KIQ to access registers that invoking fence_wait to get the
accessing completed. When VM fault occurs, the driver can't sleep in
interrupt context.
For some test cases, VM fault is 'legal' and shouldn't cause driver soft
lockup.
Signed-off-by: Pixel Ding <Pixel.Ding@amd.com>
---
drivers/gpu/drm/amd/amdgpu/gmc_v8_0.c | 46 ++++++++++++++++++++++++++++++++---
1 file changed, 43 insertions(+), 3 deletions(-)
diff --git a/drivers/gpu/drm/amd/amdgpu/gmc_v8_0.c b/drivers/gpu/drm/amd/amdgpu/gmc_v8_0.c
index 7669b32..75c913f 100644
--- a/drivers/gpu/drm/amd/amdgpu/gmc_v8_0.c
+++ b/drivers/gpu/drm/amd/amdgpu/gmc_v8_0.c
@@ -1231,9 +1231,9 @@ static int gmc_v8_0_vm_fault_interrupt_state(struct amdgpu_device *adev,
return 0;
}
-static int gmc_v8_0_process_interrupt(struct amdgpu_device *adev,
- struct amdgpu_irq_src *source,
- struct amdgpu_iv_entry *entry)
+static int gmc_v8_0_process_vm_fault(struct amdgpu_device *adev,
+ struct amdgpu_irq_src *source,
+ struct amdgpu_iv_entry *entry)
{
u32 addr, status, mc_client;
@@ -1262,6 +1262,46 @@ static int gmc_v8_0_process_interrupt(struct amdgpu_device *adev,
return 0;
}
+struct gmc_vm_fault_work {
+ struct work_struct base;
+ struct amdgpu_device *adev;
+ struct amdgpu_irq_src *source;
+ struct amdgpu_iv_entry *entry;
+};
+
+static void gmc_v8_0_vm_fault_sched(struct work_struct *work)
+{
+ struct gmc_vm_fault_work *vm_work =
+ container_of(work, struct gmc_vm_fault_work, base);
+ struct amdgpu_device *adev = vm_work->adev;
+ struct amdgpu_irq_src *source = vm_work->source;
+ struct amdgpu_iv_entry *entry = vm_work->entry;
+
+ gmc_v8_0_process_vm_fault(adev, source, entry);
+
+ kfree(vm_work);
+}
+
+static int gmc_v8_0_process_interrupt(struct amdgpu_device *adev,
+ struct amdgpu_irq_src *source,
+ struct amdgpu_iv_entry *entry)
+{
+ struct gmc_vm_fault_work *work = NULL;
+
+ if (amdgpu_sriov_vf(adev)) {
+ work = kmalloc(sizeof(struct gmc_vm_fault_work), GFP_ATOMIC);
+ if (!work)
+ return -ENOMEM;
+ INIT_WORK(&work->base, gmc_v8_0_vm_fault_sched);
+ work->adev = adev;
+ work->source = source;
+ work->entry = entry;
+ return schedule_work(&work->base);
+ }
+
+ return gmc_v8_0_process_vm_fault(adev, source, entry);
+}
+
static void fiji_update_mc_medium_grain_clock_gating(struct amdgpu_device *adev,
bool enable)
{
--
2.7.4
_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
next reply other threads:[~2017-02-06 7:00 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-02-06 7:00 Pixel Ding [this message]
[not found] ` <1486364403-29374-1-git-send-email-Pixel.Ding-5C7GfCeVMHo@public.gmane.org>
2017-02-06 7:33 ` [PATCH 2/2] drm/amdgpu/virt: schedule work to handle vm fault for VF Zhou, David(ChunMing)
[not found] ` <MWHPR1201MB020685071A36546095A5A248B4400-3iK1xFAIwjrUF/YbdlDdgWrFom/aUZj6nBOFsp37pqbUKgpGm//BTAC/G2K4zDHf@public.gmane.org>
2017-02-06 7:55 ` Ding, Pixel
[not found] ` <B238C54C-4230-411A-890F-00FDDBED699B-5C7GfCeVMHo@public.gmane.org>
2017-02-06 8:36 ` zhoucm1
[not found] ` <58983571.9010009-5C7GfCeVMHo@public.gmane.org>
2017-02-06 8:56 ` Christian König
[not found] ` <83606ab6-6cf4-fcb6-31e9-a30d35339497-ANTagKRnAhcb1SvskN2V4Q@public.gmane.org>
2017-02-07 5:30 ` Ding, Pixel
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=1486364403-29374-1-git-send-email-Pixel.Ding@amd.com \
--to=pixel.ding-5c7gfcevmho@public.gmane.org \
--cc=amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org \
/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.