From: Thomas Hellstrom <thellstrom@vmware.com>
To: Matthew Wilcox <willy@infradead.org>
Cc: pv-drivers@vmware.com, linux-graphics-maintainer@vmware.com,
dri-devel@lists.freedesktop.org
Subject: Re: [PATCH -fixes 5/5] drm/vmwgfx: Fix a buffer object eviction regression
Date: Thu, 13 Sep 2018 16:56:53 +0200 [thread overview]
Message-ID: <7eb47317-b385-d9c5-4d50-910219f8dbdf@vmware.com> (raw)
In-Reply-To: <20180913141048.GA22737@bombadil.infradead.org>
Hi,
On 09/13/2018 04:10 PM, Matthew Wilcox wrote:
> On Thu, Sep 13, 2018 at 01:58:37PM +0200, Thomas Hellstrom wrote:
>> Commit 4eb085e42fde ("drm/vmwgfx: Convert to new IDA API") indroduced
>> an incorrect return value from the function vmw_gmrid_man_get_node(),
>> when we run out if integer ids. Instead of returning 0 (meaning
>> non-fatal error) we forward the ida_simple_get error code -ENOSPC.
>> This causes TTM not to retry allocation after buffer eviction and
>> instead return -ENOSPC to user-space.
>>
>> Fix this by returning 0 when ida_simple_get() returns -ENOSPC.
> Thanks. I got confused by the convoluted code that was there before ;-(
>
> I think this could be better though ... if ida_alloc() ever starts
> returning a different errno in the future, you'll hit the same problem,
> right? So how about this ...
>
> id = ida_alloc_max(&gman->gmr_ida, gman->max_gmr_ids - 1, GFP_KERNEL);
> + if (id == -ENOMEM)
> + return -ENOMEM;
> + if (id < 0)
> + return 0;
>
> spin_lock(&gman->lock);
>
> But I wonder ... why is -ENOMEM seen as a fatal error? If you free up
> some memory, you'll free up an ID, so the next time around you should
> be able to allocate an ID. So shouldn't this function just have
> been doing this all along?
>
> id = ida_alloc_max(&gman->gmr_ida, gman->max_gmr_ids - 1, GFP_KERNEL);
> + if (id < 0)
> + return 0;
>
Non-fatal errors are errors that can be remedied by GPU buffer eviction,
and buffer eviction will free up IDA space, so basically we need to
target only the error code that indicates we've run out of IDA space.
If we're worried that ida_alloc_max() will change return value, I guess
we will have to increase the IDA space and detect the error ourselves:
error if (id >= gman->max_gmr_ids)
/Thomas
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel
next prev parent reply other threads:[~2018-09-13 14:57 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-09-13 11:58 [PATCH -fixes 1/5] drm/vmwgfx: don't check for old_crtc_state enable status Thomas Hellstrom
2018-09-13 11:58 ` [PATCH -fixes 2/5] drm/vmwgfx: limit screen size to stdu_max during check_modeset Thomas Hellstrom
2018-09-13 11:58 ` [PATCH -fixes 3/5] drm/vmwgfx: limit mode size for all display unit to texture_max Thomas Hellstrom
2018-09-13 11:58 ` [PATCH -fixes 4/5] drm/vmwgfx: Don't impose STDU limits on framebuffer size Thomas Hellstrom
2018-09-13 11:58 ` [PATCH -fixes 5/5] drm/vmwgfx: Fix a buffer object eviction regression Thomas Hellstrom
2018-09-13 14:10 ` Matthew Wilcox
2018-09-13 14:56 ` Thomas Hellstrom [this message]
2018-09-13 15:28 ` Matthew Wilcox
2018-09-13 16:52 ` Thomas Hellstrom
2018-09-13 17:38 ` Matthew Wilcox
2018-09-13 18:17 ` Thomas Hellstrom
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=7eb47317-b385-d9c5-4d50-910219f8dbdf@vmware.com \
--to=thellstrom@vmware.com \
--cc=dri-devel@lists.freedesktop.org \
--cc=linux-graphics-maintainer@vmware.com \
--cc=pv-drivers@vmware.com \
--cc=willy@infradead.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