linux-riscv.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: Michael Forney <mforney@mforney.org>
To: dri-devel@lists.freedesktop.org,
	virtualization@lists.linux-foundation.org,
	linux-riscv@lists.infradead.org
Subject: virtio-gpu without ARCH_HAS_SG_CHAIN
Date: Mon, 29 Oct 2018 12:46:34 -0700	[thread overview]
Message-ID: <CAGw6cBsWHB4aRf=kPoT+v-FbtL0ymeBtZNEwKYobFizc0cLeaQ@mail.gmail.com> (raw)
Message-ID: <20181029194634.vVwc67BlQnfUxsfz2hIzS32KeKxrtYRfZ_F6jzAYCCQ@z> (raw)

Hi,

I was looking at adding virtio-gpu support to tinyemu
(https://bellard.org/tinyemu/). I got it to work on x86, but just for
fun I tried it under riscv and ran into an issue with buffer
allocations (though, this should affect any arch without
ARCH_HAS_SG_CHAIN).

virtio-gpu uses ttm to allocate buffers, which swaps pages to ensure
that they aren't consecutive[0][1]. However, this causes
sg_alloc_table_from_pages to use a sg entry for every single page,
limiting buffers to only 170 pages (the number of sg entries that can
fit into a page). This is only 417x417 with 32bpp. I believe the page
swapping also makes TRANSFER_TO_HOST_2D inefficient by forcing the
host to do many memcpys instead of just a few.

Commenting out the swaps in [0] and [1] makes it work with larger
buffers. I don't know anything about huge pages, or how sg chaining
works, so I have a few questions:
- Is virtio-gpu intended to be usable without ARCH_HAS_SG_CHAIN?
- Is it still necessary to swap the pages when
CONFIG_TRANSPARENT_HUGEPAGE is disabled?
- Should riscv support ARCH_HAS_SG_CHAIN?

Thanks for any help!

[0] https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/drivers/gpu/drm/ttm/ttm_page_alloc.c?id=fdb1a2236b07948e83e0a777e1795d4f07e52c33
[1] https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/drivers/gpu/drm/ttm/ttm_page_alloc.c?id=ae937fe19636067ec5e20d7f1fa10c6cc6000b52

_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv

             reply	other threads:[~2018-10-29 19:47 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-10-29 19:46 Michael Forney [this message]
2018-10-29 19:46 ` virtio-gpu without ARCH_HAS_SG_CHAIN Michael Forney
2018-10-29 20:06 ` David Abdurachmanov
2018-10-29 20:06   ` David Abdurachmanov
2018-10-30 17:25   ` Michael Forney
2018-10-30 17:25     ` Michael Forney
2018-10-31  8:48     ` David Abdurachmanov
2018-10-31  8:48       ` David Abdurachmanov
2018-10-30  7:23 ` Gerd Hoffmann
2018-10-30  7:23   ` Gerd Hoffmann
2018-10-30  9:27   ` Koenig, Christian
2018-10-30  9:27     ` Koenig, Christian
2018-10-31  6:12 ` Christoph Hellwig
2018-10-31  6:12   ` Christoph Hellwig

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='CAGw6cBsWHB4aRf=kPoT+v-FbtL0ymeBtZNEwKYobFizc0cLeaQ@mail.gmail.com' \
    --to=mforney@mforney.org \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=linux-riscv@lists.infradead.org \
    --cc=virtualization@lists.linux-foundation.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).