From: Anthony Liguori <anthony@codemonkey.ws>
To: qemu-devel@nongnu.org
Cc: Samuel Thibault <samuel.thibault@eu.citrix.com>
Subject: Re: [Qemu-devel] [PATCH] Save 3MB ioport table memory
Date: Tue, 22 Jul 2008 20:52:27 -0500 [thread overview]
Message-ID: <48868EDB.7010809@codemonkey.ws> (raw)
In-Reply-To: <20080721120211.GD4501@implementation.uk.xensource.com>
Samuel Thibault wrote:
> Hello,
>
> On 64bit machines, qemu uses 3MB of memory for the ioport tables, while
> the actual use of them is quite sparse. The patch below saves that
> memory by leaving them zeroed and just test for that and use the default
> pointer.
>
I really like the idea of this patch. You have some whitespace damage
(tabs instead of 8 spaces) and it needs a Signed-off-by: if you'd like
me to apply it.
> Samuel
>
> Index: vl.c
> ===================================================================
> --- vl.c (révision 4917)
> +++ vl.c (copie de travail)
> @@ -279,17 +279,29 @@
> static uint32_t default_ioport_readw(void *opaque, uint32_t address)
> {
> uint32_t data;
> - data = ioport_read_table[0][address](ioport_opaque[address], address);
> + IOPortReadFunc *func = ioport_read_table[0][address];
> + if (!func)
> + func = default_ioport_readb;
>
Perhaps you can introduce an accessor? Something like:
static uint32_t ioport_read_defaults(void *opaque, int index, uint32_t
address)
{
static IOPortReadFunc *default_funcs[3] = {default_ioport_readb,
default_ioport_readw, default_ioport_readl};
IOPortReadFunc *func = ioport_read_table[index][address];
if (!func)
func = default_funcs[index];
return func(opaque, address);
}
That would simplify the rest of the changes significantly.
Regards,
Anthony Liguori
next prev parent reply other threads:[~2008-07-23 1:53 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-07-21 12:02 [Qemu-devel] [PATCH] Save 3MB ioport table memory Samuel Thibault
2008-07-23 1:52 ` Anthony Liguori [this message]
2008-07-23 10:58 ` Samuel Thibault
2008-07-23 12:15 ` Paul Brook
2008-07-23 12:39 ` Samuel Thibault
2008-07-23 15:21 ` Anthony Liguori
2008-07-23 15:50 ` Paul Brook
2008-07-23 16:11 ` Anthony Liguori
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=48868EDB.7010809@codemonkey.ws \
--to=anthony@codemonkey.ws \
--cc=qemu-devel@nongnu.org \
--cc=samuel.thibault@eu.citrix.com \
/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).