From: Thomas Hellstrom <thomas@shipmail.org>
To: Jerome Glisse <j.glisse@gmail.com>
Cc: "Michel Dänzer" <michel@daenzer.net>,
jglisse@redhat.com, dri-devel@lists.freedesktop.org
Subject: Re: [PATCH] drm/radeon/kms: forbid big bo allocation (fdo 31708) v2
Date: Mon, 22 Nov 2010 18:31:35 +0100 [thread overview]
Message-ID: <4CEAA8F7.4000201@shipmail.org> (raw)
In-Reply-To: <AANLkTikqAYf21DsM7m+U9nT=tQ4Rq_Y8v1yGsvLDGxDj@mail.gmail.com>
On 11/22/2010 06:07 PM, Jerome Glisse wrote:
> 2010/11/22 Michel Dänzer<michel@daenzer.net>:
>
>> On Fre, 2010-11-19 at 16:34 -0500, jglisse@redhat.com wrote:
>>
>>> From: Jerome Glisse<jglisse@redhat.com>
>>>
>>> Forbid allocating buffer bigger than visible VRAM or GTT, also
>>> properly set lpfn field.
>>>
>>> v2 - use max macro
>>> - silence warning
>>>
>>> Signed-off-by: Jerome Glisse<jglisse@redhat.com>
>>> ---
>>> drivers/gpu/drm/radeon/radeon_object.c | 34 ++++++++++++++++++++++++++-----
>>> 1 files changed, 28 insertions(+), 6 deletions(-)
>>>
>>> diff --git a/drivers/gpu/drm/radeon/radeon_object.c b/drivers/gpu/drm/radeon/radeon_object.c
>>> index 1d06774..c2fa64c 100644
>>> --- a/drivers/gpu/drm/radeon/radeon_object.c
>>> +++ b/drivers/gpu/drm/radeon/radeon_object.c
>>> @@ -69,18 +69,28 @@ void radeon_ttm_placement_from_domain(struct radeon_bo *rbo, u32 domain)
>>> u32 c = 0;
>>>
>>> rbo->placement.fpfn = 0;
>>> - rbo->placement.lpfn = rbo->rdev->mc.active_vram_size>> PAGE_SHIFT;
>>> + rbo->placement.lpfn = 0;
>>> rbo->placement.placement = rbo->placements;
>>> rbo->placement.busy_placement = rbo->placements;
>>> - if (domain& RADEON_GEM_DOMAIN_VRAM)
>>> + if (domain& RADEON_GEM_DOMAIN_VRAM) {
>>> + rbo->placement.lpfn = max((unsigned)rbo->placement.lpfn, (unsigned)rbo->rdev->mc.active_vram_size>> PAGE_SHIFT);
>>> rbo->placements[c++] = TTM_PL_FLAG_WC | TTM_PL_FLAG_UNCACHED |
>>> TTM_PL_FLAG_VRAM;
>>> - if (domain& RADEON_GEM_DOMAIN_GTT)
>>> + }
>>> + if (domain& RADEON_GEM_DOMAIN_GTT) {
>>> + rbo->placement.lpfn = max((unsigned)rbo->placement.lpfn, (unsigned)rbo->rdev->mc.gtt_size>> PAGE_SHIFT);
>>> rbo->placements[c++] = TTM_PL_MASK_CACHING | TTM_PL_FLAG_TT;
>>> - if (domain& RADEON_GEM_DOMAIN_CPU)
>>> + }
>>> + if (domain& RADEON_GEM_DOMAIN_CPU) {
>>> + /* 4G limit for CPU domain */
>>> + rbo->placement.lpfn = max(rbo->placement.lpfn, 0xFFFFFFFF>> PAGE_SHIFT);
>>> rbo->placements[c++] = TTM_PL_MASK_CACHING | TTM_PL_FLAG_SYSTEM;
>>> - if (!c)
>>> + }
>>> + if (!c) {
>>> + /* 4G limit for CPU domain */
>>> + rbo->placement.lpfn = max(rbo->placement.lpfn, 0xFFFFFFFF>> PAGE_SHIFT);
>>> rbo->placements[c++] = TTM_PL_MASK_CACHING | TTM_PL_FLAG_SYSTEM;
>>> + }
>>>
>> I don't think taxing the maximum is the right thing to do: If domain is
>> (RADEON_GEM_DOMAIN_VRAM | RADEON_GEM_DOMAIN_GTT) and VRAM doesn't happen
>> to be the same size as GTT, lpfn will end up larger than one of them.
>>
>> AFAICT radeon_ttm_placement_from_domain() should just set lpfn to 0
>> (i.e. unrestricted), the callers that need it to be non-0 already set it
>> afterwards.
>>
>> Out of curiosity, where does the 4G limit come from?
>>
>>
>>
> > From my hat, but iirc ttm limit things to 1G anyway (vm size for
> mapping object in drm file and iirc we will report error if we can't
> find a mapping for userspace object). I guess at one point we should
> start thinking about what we want to do on that front.
>
That limit is taken from *my* hat. Nothing prevents us to increase that
limit to whatever.
/Thomas
> Doing a v3.
>
> Cheers,
> Jerome
> _______________________________________________
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/dri-devel
>
next prev parent reply other threads:[~2010-11-22 17:31 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-11-19 21:34 [PATCH] drm/radeon/kms: forbid big bo allocation (fdo 31708) v2 jglisse
2010-11-22 16:56 ` Michel Dänzer
2010-11-22 17:07 ` Jerome Glisse
2010-11-22 17:15 ` Alex Deucher
2010-11-22 17:31 ` Thomas Hellstrom [this message]
2010-11-22 17:35 ` Jerome Glisse
2010-11-22 17:40 ` Alex Deucher
2010-11-29 10:13 ` Thomas Hellstrom
2010-11-29 14:20 ` Jerome Glisse
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=4CEAA8F7.4000201@shipmail.org \
--to=thomas@shipmail.org \
--cc=dri-devel@lists.freedesktop.org \
--cc=j.glisse@gmail.com \
--cc=jglisse@redhat.com \
--cc=michel@daenzer.net \
/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.