From: Samuel Thibault <samuel.thibault@eu.citrix.com>
To: qemu-devel@nongnu.org
Subject: [Qemu-devel] Re: memory usage and ioports
Date: Mon, 19 Nov 2007 15:34:21 +0000 [thread overview]
Message-ID: <20071119153421.GH6331@implementation.uk.xensource.com> (raw)
In-Reply-To: <20071119152016.GE6331@implementation.uk.xensource.com>
[-- Attachment #1: Type: text/plain, Size: 502 bytes --]
Samuel Thibault, le Mon 19 Nov 2007 15:20:16 +0000, a écrit :
> Qemu currently uses 6 65k tables of pointers for handling ioports, which
> makes 3MB on 64bit machines. There's a comment that says "XXX: use a two
> level table to limit memory usage". But wouldn't it be more simple and
> effective to just allocate them through mmap() and when a NULL pointer
> is read, call the default handlers?
For the ioport_opaque array (500KB on 64bit), it's much simpler, as the
attached patch suggests.
Samuel
[-- Attachment #2: patch --]
[-- Type: text/plain, Size: 743 bytes --]
diff -r 6a6eace79e93 tools/ioemu/vl.c
--- qemu/vl.c Mon Nov 19 15:04:05 2007 +0000
+++ qemu/vl.c Mon Nov 19 15:31:35 2007 +0000
@@ -139,7 +139,7 @@
const char *bios_dir = CONFIG_QEMU_SHAREDIR;
char phys_ram_file[1024];
-void *ioport_opaque[MAX_IOPORTS];
+void **ioport_opaque;
IOPortReadFunc *ioport_read_table[3][MAX_IOPORTS];
IOPortWriteFunc *ioport_write_table[3][MAX_IOPORTS];
/* Note: bs_table[MAX_DISKS] is a dummy block driver if none available
@@ -265,6 +265,7 @@ void init_ioports(void)
{
int i;
+ ioport_opaque = malloc(MAX_IOPORTS * sizeof(*ioport_opaque));
for(i = 0; i < MAX_IOPORTS; i++) {
ioport_read_table[0][i] = default_ioport_readb;
ioport_write_table[0][i] = default_ioport_writeb;
next prev parent reply other threads:[~2007-11-19 15:34 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-11-19 15:20 [Qemu-devel] memory usage and ioports Samuel Thibault
2007-11-19 15:34 ` Samuel Thibault [this message]
2007-11-19 16:17 ` [Qemu-devel] " Paul Brook
2007-11-19 16:23 ` Samuel Thibault
2008-02-06 14:24 ` [Qemu-devel] [PATCH] " Samuel Thibault
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=20071119153421.GH6331@implementation.uk.xensource.com \
--to=samuel.thibault@eu.citrix.com \
--cc=qemu-devel@nongnu.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).