From: walter harms <wharms@bfs.de>
To: "Christian König" <christian.koenig@amd.com>
Cc: "Dan Carpenter" <dan.carpenter@oracle.com>,
"Christian König" <deathsimple@vodafone.de>,
"Alex Deucher" <alexander.deucher@amd.com>,
"Chunming Zhou" <David1.Zhou@amd.com>,
"David Airlie" <airlied@linux.ie>,
kernel-janitors@vger.kernel.org,
"Felix Kuehling" <Felix.Kuehling@amd.com>,
"Harish Kasiviswanathan" <Harish.Kasiviswanathan@amd.com>,
amd-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org,
"Zhang, Jerry" <Jerry.Zhang@amd.com>,
"Alex Xie" <AlexBin.Xie@amd.com>
Subject: Re: [PATCH] drm/amdgpu: potential shift wrapping bug
Date: Thu, 10 Aug 2017 13:17:43 +0000 [thread overview]
Message-ID: <598C5CF7.8080702@bfs.de> (raw)
In-Reply-To: <b13fa138-4a14-50bc-953d-0f6ce11d8744@amd.com>
Am 10.08.2017 15:02, schrieb Christian König:
> Am 10.08.2017 um 14:53 schrieb Dan Carpenter:
>> On Thu, Aug 10, 2017 at 02:30:15PM +0200, Christian König wrote:
>>> Am 10.08.2017 um 14:16 schrieb Dan Carpenter:
>>>> "frag_align" is a u64, so presumably we want to use the high bits as
>>>> well instead of shift wrapping.
>>>>
>>>> Fixes: 6be7adb37d9b ("drm/amdgpu: increase fragmentation size for
>>>> Vega10 v2")
>>>> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
>>> The fragment field has only 5bits in hardware and can never be more
>>> than 31,
>>> so the correct fix would actually be using uint32_t here instead.
>>>
>> Changing it to uint32_t introduces a new static checker warning:
>>
>> drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c:1465 amdgpu_vm_frag_ptes()
>> warn: was expecting a 64 bit value instead of '~(frag_align - 1)'
>>
>> Unfortunately, I get so many thousands of those I can't normally even
>> review that sort of bug...
>>
>> Let me resend the original patch but with a modified changelog to say
>> that the bug is a false positive.
>
> Ah, yes of course that's why I made it a 64bit value in the first place.
>
> Mhm, could we use something like (u32)(1 << pages_per_frag) instead to
> silence the static checker warning?
>
> It doesn't make much sense to use a 64bit shift here.
>
> Christian.
>
Why not keeping Dan 1. patch and add a comment that pages_per_frag is always >31 ?
Using 32bit in a 64bit is not forbidden, and changing it causes more problems than
it solves. But doing so should be done in a clean way.
just my 2 cents,
re,
wh
prev parent reply other threads:[~2017-08-10 13:17 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-08-10 12:16 [PATCH] drm/amdgpu: potential shift wrapping bug Dan Carpenter
2017-08-10 12:30 ` Christian König
[not found] ` <1c9843bd-8c8f-b6f7-d413-ebb508c97930-ANTagKRnAhcb1SvskN2V4Q@public.gmane.org>
2017-08-10 12:38 ` Dan Carpenter
2017-08-10 12:53 ` Dan Carpenter
2017-08-10 13:02 ` Christian König
[not found] ` <b13fa138-4a14-50bc-953d-0f6ce11d8744-5C7GfCeVMHo@public.gmane.org>
2017-08-10 13:14 ` Dan Carpenter
2017-08-10 13:17 ` walter harms [this message]
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=598C5CF7.8080702@bfs.de \
--to=wharms@bfs.de \
--cc=AlexBin.Xie@amd.com \
--cc=David1.Zhou@amd.com \
--cc=Felix.Kuehling@amd.com \
--cc=Harish.Kasiviswanathan@amd.com \
--cc=Jerry.Zhang@amd.com \
--cc=airlied@linux.ie \
--cc=alexander.deucher@amd.com \
--cc=amd-gfx@lists.freedesktop.org \
--cc=christian.koenig@amd.com \
--cc=dan.carpenter@oracle.com \
--cc=deathsimple@vodafone.de \
--cc=dri-devel@lists.freedesktop.org \
--cc=kernel-janitors@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;
as well as URLs for NNTP newsgroup(s).