dri-devel Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Zack Rusin <zackr@vmware.com>
To: "Christian König" <christian.koenig@amd.com>,
	dri-devel <dri-devel@lists.freedesktop.org>
Subject: Re: ttm_resource_manager::use_tt
Date: Fri, 28 May 2021 15:30:57 -0400	[thread overview]
Message-ID: <54e4bb04-602b-b1d3-7361-8badce45206a@vmware.com> (raw)
In-Reply-To: <b743342e-5151-110e-e29e-bf89a34d085a@amd.com>

On 5/22/21 3:13 AM, Christian König wrote:
> Hi Zack,
> 
> IIRC that was for the VMW_PL_GMR type, wasn't it?
> 
> As far as I have seen that backend was just giving out unique numbers and it looked questionable that we allocated pages for that.
> 
> E.g. when you set that flag then for each allocation we also allocate a TTM tt structure and a corresponding page.
>

Got ya. Yea, it's a little messy. I think it's correct. Those unique numbers are just identifiers for the bo's but the actual memory for them is regular system memory (e.g. we just tell our virtual hardware, here's some guest system pages and here's a unique id that we'll be using the refer to them).

Tangentially this also relates to a small issue with the rework of the memory accounting and removing the old page allocator. In the old page allocator we could specify what's the limit of system memory that the allocator could use (via ttm_check_under_lowerlimit) so the memory accounting that we've moved back to vmwgfx does nothing right now (well, it "accounts" just doesn't act on the limit ;) ).

We could probably add a call to ttm_check_under_lowerlimit in our ttm_populate callback (vmw_ttm_populate) but it is a little wacky. That's because in some situations we do want to ignore the limit on system memory allocations, purpose which we used to use ttm_operation_ctx::force_alloc for. I don't love designs that are so driver specific so I'd prefer to avoid using force_alloc that is only used internally by vmwgfx but I don't see a clean way of being able to put a limit on system memory that our driver is using.

Just to explain, our virtual hardware is basically an integrated gpu nowadays, so all the memory it allocates comes from system memory (with those unique numbers to identify it) and, especially on vm's that have lower amount of ram, we would like to limit how much of it will be used for graphics.

z

  reply	other threads:[~2021-05-28 19:31 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-05-21 18:17 ttm_resource_manager::use_tt Zack Rusin
2021-05-22  7:13 ` ttm_resource_manager::use_tt Christian König
2021-05-28 19:30   ` Zack Rusin [this message]
2021-05-29 15:23     ` ttm_resource_manager::use_tt Thomas Hellström (Intel)
2021-05-30 16:40       ` ttm_resource_manager::use_tt Christian König

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=54e4bb04-602b-b1d3-7361-8badce45206a@vmware.com \
    --to=zackr@vmware.com \
    --cc=christian.koenig@amd.com \
    --cc=dri-devel@lists.freedesktop.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