From: Oded Gabbay <oded.gabbay@amd.com>
To: <dri-devel@lists.freedesktop.org>
Cc: David Airlie <airlied@linux.ie>,
Jerome Glisse <j.glisse@gmail.com>,
Joerg Roedel <joro@8bytes.org>, <linux-kernel@vger.kernel.org>,
"John Bridgman" <John.Bridgman@amd.com>,
<Alexander.Deucher@amd.com>
Subject: [PATCH 0/3] Use workqueue for device init in amdkfd
Date: Sat, 20 Dec 2014 22:46:11 +0200 [thread overview]
Message-ID: <1419108374-7020-1-git-send-email-oded.gabbay@amd.com> (raw)
This small patch-set, together with amd_iommu_v2 patch at
http://lists.linuxfoundation.org/pipermail/iommu/2014-December/011435.html
was created to solve the bug described at
https://bugzilla.kernel.org/show_bug.cgi?id=89661 (Kernel panic when
trying use amdkfd driver on Kaveri).
That bug appears only when radeon, amdkfd and amd_iommu_v2 are compiled
inside the kernel (not as modules). In that case, the correct loading
order, as determined by the exported symbol used by each driver, is
not enforced anymore and the kernel loads them based on who was linked
first. That makes radeon load first, amdkfd second and amd_iommu_v2
third.
Because the initialization of a device in amdkfd is initiated by radeon,
and can only be completed if amdkfd and amd_iommu_v2 were loaded and
initialized, then in the case mentioned above, this initalization fails
and there is a kernel panic as some pointers are not initialized but
used nontheless.
To solve this problem, amdkfd now checks if both it and amd_iommu_v2
were loaded before trying to initalize the device. If not, it enqueue
the work using a workqueue, which allows radeon to continue its device
initialization (because radeon calls amdkfd to initalize the device).
The work function schedules itself as long as amdkfd and amd_iommu_v2
were not initialized.
Detection of when the modules finished their initialization is done by
a simple variable that is initialized to 1 when the module_init function
is completed successfully. Other methods for detection were checked,
e.g. module_is_live() and MODULE_SOFTDEP(), but they were proved not
to work when all modules are compiled in the kernel image (which is
the problematic scenario to begin with).
Oded
Oded Gabbay (3):
amdkfd: Don't clear *kfd2kgd on kfd_module_init
amdkfd: Track when amdkfd init is complete
amdkfd: Use workqueue for GPU init
drivers/gpu/drm/amd/amdkfd/kfd_device.c | 72 +++++++++++++++++++++++++++++++--
drivers/gpu/drm/amd/amdkfd/kfd_module.c | 14 +++++--
drivers/gpu/drm/amd/amdkfd/kfd_priv.h | 4 ++
3 files changed, 83 insertions(+), 7 deletions(-)
--
2.1.0
next reply other threads:[~2014-12-20 20:46 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-12-20 20:46 Oded Gabbay [this message]
2014-12-20 20:46 ` [PATCH 1/3] amdkfd: Don't clear *kfd2kgd on kfd_module_init Oded Gabbay
2014-12-20 21:25 ` Greg KH
2014-12-21 11:12 ` Oded Gabbay
2014-12-21 11:27 ` Christian König
2014-12-21 11:34 ` Oded Gabbay
2014-12-21 12:19 ` Christian König
2014-12-21 13:06 ` Oded Gabbay
2014-12-21 13:24 ` Oded Gabbay
2014-12-21 15:57 ` Christian König
2014-12-21 16:03 ` Oded Gabbay
2014-12-21 16:10 ` Christian König
2014-12-22 7:34 ` Oded Gabbay
2014-12-22 7:40 ` Dave Airlie
2014-12-22 7:43 ` Oded Gabbay
2014-12-22 8:57 ` Christian König
2014-12-22 9:26 ` Oded Gabbay
2014-12-22 10:22 ` Oded Gabbay
2014-12-20 20:46 ` [PATCH 2/3] amdkfd: Track when amdkfd init is complete Oded Gabbay
2014-12-20 20:46 ` [PATCH 3/3] amdkfd: Use workqueue for GPU init Oded Gabbay
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=1419108374-7020-1-git-send-email-oded.gabbay@amd.com \
--to=oded.gabbay@amd.com \
--cc=Alexander.Deucher@amd.com \
--cc=John.Bridgman@amd.com \
--cc=airlied@linux.ie \
--cc=dri-devel@lists.freedesktop.org \
--cc=j.glisse@gmail.com \
--cc=joro@8bytes.org \
--cc=linux-kernel@vger.kernel.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Powered by JetHome