qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Arnd Bergmann <arnd@arndb.de>
To: Alex Williamson <alex.williamson@redhat.com>
Cc: Jes Sorensen <Jes.Sorensen@redhat.com>,
	qemu-devel@nongnu.org, kvm@vger.kernel.org
Subject: Re: [Qemu-devel] Re: [PATCH] pc: e820 qemu_cfg tables need to be packed
Date: Thu, 14 Oct 2010 23:19:09 +0200	[thread overview]
Message-ID: <201010142319.09412.arnd@arndb.de> (raw)
In-Reply-To: <1287089944.2987.33.camel@x201>

On Thursday 14 October 2010 22:59:04 Alex Williamson wrote:
> The structs in question only contain 4 & 8 byte elements, so there
> shouldn't be any change on x86-32 using one-byte aligned packing.

I'm talking about the alignment of the structure, not the members
within the structure. The data structure should be compatible, but
not accesses to it.

> AFAIK, e820 is x86-only, so we don't need to worry about breaking anyone
> else.

You can use qemu to emulate an x86 pc on anything...

> Performance isn't much of a consideration for this type of
> interface since it's only used pre-boot.  In fact, the channel between
> qemu and the bios is only one byte wide, so wider alignment can cost
> extra emulated I/O accesses.

Right, the data gets passed as bytes, so it hardly matters in the end.
Still the e820_add_entry assigns data to the struct members, which
it either does using byte accesses and shifts or a multiple 32 bit
assignment. Just because using a one byte alignment technically
results in correct output doesn't make it the right solution.

I don't care about the few cycles of execution time or the few bytes
you waste in this particular case, but you are setting a wrong example
by using smaller alignment than necessary.

	Arnd

  reply	other threads:[~2010-10-14 21:19 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-10-14 18:33 [Qemu-devel] [PATCH] pc: e820 qemu_cfg tables need to be packed Alex Williamson
2010-10-14 19:44 ` [Qemu-devel] " Jes Sorensen
2010-10-14 19:48   ` Anthony Liguori
2010-10-14 19:58     ` Alex Williamson
2010-10-14 19:59       ` Anthony Liguori
2010-10-14 20:20       ` Arnd Bergmann
2010-10-14 20:59         ` Alex Williamson
2010-10-14 21:19           ` Arnd Bergmann [this message]
2010-10-15  4:01             ` Alex Williamson
2010-10-15  4:08 ` [Qemu-devel] [PATCH v2] " Alex Williamson
2010-10-15 10:20   ` [Qemu-devel] " Arnd Bergmann

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=201010142319.09412.arnd@arndb.de \
    --to=arnd@arndb.de \
    --cc=Jes.Sorensen@redhat.com \
    --cc=alex.williamson@redhat.com \
    --cc=kvm@vger.kernel.org \
    --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).