From: Dan Carpenter <dan.carpenter@oracle.com>
To: Alex Deucher <alexander.deucher@amd.com>
Cc: "Tao Zhou" <tao.zhou1@amd.com>, "David Airlie" <airlied@linux.ie>,
kernel-janitors@vger.kernel.org, "Pan,
Xinhui" <Xinhui.Pan@amd.com>, "Nirmoy Das" <nirmoy.das@amd.com>,
amd-gfx@lists.freedesktop.org, "Lijo Lazar" <lijo.lazar@amd.com>,
"Michel Dänzer" <mdaenzer@redhat.com>,
yipechai <YiPeng.Chai@amd.com>,
dri-devel@lists.freedesktop.org,
"Daniel Vetter" <daniel@ffwll.ch>,
"Evan Quan" <evan.quan@amd.com>,
"Christian König" <christian.koenig@amd.com>,
"Dennis Li" <Dennis.Li@amd.com>, "Alex Xie" <AlexBin.Xie@amd.com>
Subject: [PATCH] drm/amdgpu: fix off by one in amdgpu_gfx_kiq_acquire()
Date: Wed, 16 Mar 2022 11:41:48 +0300 [thread overview]
Message-ID: <20220316084148.GD30941@kili> (raw)
This post-op should be a pre-op so that we do not pass -1 as the bit
number to test_bit(). The current code will loop downwards from 63 to
-1. After changing to a pre-op, it loops from 63 to 0.
Fixes: 71c37505e7ea ("drm/amdgpu/gfx: move more common KIQ code to amdgpu_gfx.c")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
---
drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c
index 8fe939976224..28a736c507bb 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c
@@ -266,7 +266,7 @@ static int amdgpu_gfx_kiq_acquire(struct amdgpu_device *adev,
* adev->gfx.mec.num_pipe_per_mec
* adev->gfx.mec.num_queue_per_pipe;
- while (queue_bit-- >= 0) {
+ while (--queue_bit >= 0) {
if (test_bit(queue_bit, adev->gfx.mec.queue_bitmap))
continue;
--
2.20.1
WARNING: multiple messages have this Message-ID (diff)
From: Dan Carpenter <dan.carpenter@oracle.com>
To: Alex Deucher <alexander.deucher@amd.com>
Cc: "Christian König" <christian.koenig@amd.com>,
"Pan, Xinhui" <Xinhui.Pan@amd.com>,
"David Airlie" <airlied@linux.ie>,
"Daniel Vetter" <daniel@ffwll.ch>, yipechai <YiPeng.Chai@amd.com>,
"Tao Zhou" <tao.zhou1@amd.com>, "Lijo Lazar" <lijo.lazar@amd.com>,
"Evan Quan" <evan.quan@amd.com>,
"Michel Dänzer" <mdaenzer@redhat.com>,
"Dennis Li" <Dennis.Li@amd.com>,
"Nirmoy Das" <nirmoy.das@amd.com>,
"Alex Xie" <AlexBin.Xie@amd.com>,
amd-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org,
kernel-janitors@vger.kernel.org
Subject: [PATCH] drm/amdgpu: fix off by one in amdgpu_gfx_kiq_acquire()
Date: Wed, 16 Mar 2022 11:41:48 +0300 [thread overview]
Message-ID: <20220316084148.GD30941@kili> (raw)
This post-op should be a pre-op so that we do not pass -1 as the bit
number to test_bit(). The current code will loop downwards from 63 to
-1. After changing to a pre-op, it loops from 63 to 0.
Fixes: 71c37505e7ea ("drm/amdgpu/gfx: move more common KIQ code to amdgpu_gfx.c")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
---
drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c
index 8fe939976224..28a736c507bb 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c
@@ -266,7 +266,7 @@ static int amdgpu_gfx_kiq_acquire(struct amdgpu_device *adev,
* adev->gfx.mec.num_pipe_per_mec
* adev->gfx.mec.num_queue_per_pipe;
- while (queue_bit-- >= 0) {
+ while (--queue_bit >= 0) {
if (test_bit(queue_bit, adev->gfx.mec.queue_bitmap))
continue;
--
2.20.1
WARNING: multiple messages have this Message-ID (diff)
From: Dan Carpenter <dan.carpenter@oracle.com>
To: Alex Deucher <alexander.deucher@amd.com>
Cc: "Tao Zhou" <tao.zhou1@amd.com>, "David Airlie" <airlied@linux.ie>,
kernel-janitors@vger.kernel.org, "Pan,
Xinhui" <Xinhui.Pan@amd.com>, "Nirmoy Das" <nirmoy.das@amd.com>,
amd-gfx@lists.freedesktop.org, "Lijo Lazar" <lijo.lazar@amd.com>,
"Michel Dänzer" <mdaenzer@redhat.com>,
yipechai <YiPeng.Chai@amd.com>,
dri-devel@lists.freedesktop.org, "Evan Quan" <evan.quan@amd.com>,
"Christian König" <christian.koenig@amd.com>,
"Dennis Li" <Dennis.Li@amd.com>, "Alex Xie" <AlexBin.Xie@amd.com>
Subject: [PATCH] drm/amdgpu: fix off by one in amdgpu_gfx_kiq_acquire()
Date: Wed, 16 Mar 2022 11:41:48 +0300 [thread overview]
Message-ID: <20220316084148.GD30941@kili> (raw)
This post-op should be a pre-op so that we do not pass -1 as the bit
number to test_bit(). The current code will loop downwards from 63 to
-1. After changing to a pre-op, it loops from 63 to 0.
Fixes: 71c37505e7ea ("drm/amdgpu/gfx: move more common KIQ code to amdgpu_gfx.c")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
---
drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c
index 8fe939976224..28a736c507bb 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c
@@ -266,7 +266,7 @@ static int amdgpu_gfx_kiq_acquire(struct amdgpu_device *adev,
* adev->gfx.mec.num_pipe_per_mec
* adev->gfx.mec.num_queue_per_pipe;
- while (queue_bit-- >= 0) {
+ while (--queue_bit >= 0) {
if (test_bit(queue_bit, adev->gfx.mec.queue_bitmap))
continue;
--
2.20.1
next reply other threads:[~2022-03-16 8:42 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-03-16 8:41 Dan Carpenter [this message]
2022-03-16 8:41 ` [PATCH] drm/amdgpu: fix off by one in amdgpu_gfx_kiq_acquire() Dan Carpenter
2022-03-16 8:41 ` Dan Carpenter
2022-03-17 20:37 ` Alex Deucher
2022-03-17 20:37 ` Alex Deucher
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=20220316084148.GD30941@kili \
--to=dan.carpenter@oracle.com \
--cc=AlexBin.Xie@amd.com \
--cc=Dennis.Li@amd.com \
--cc=Xinhui.Pan@amd.com \
--cc=YiPeng.Chai@amd.com \
--cc=airlied@linux.ie \
--cc=alexander.deucher@amd.com \
--cc=amd-gfx@lists.freedesktop.org \
--cc=christian.koenig@amd.com \
--cc=daniel@ffwll.ch \
--cc=dri-devel@lists.freedesktop.org \
--cc=evan.quan@amd.com \
--cc=kernel-janitors@vger.kernel.org \
--cc=lijo.lazar@amd.com \
--cc=mdaenzer@redhat.com \
--cc=nirmoy.das@amd.com \
--cc=tao.zhou1@amd.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 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.