xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
From: Keir Fraser <keir.xen@gmail.com>
To: Konrad Rzeszutek Wilk <konrad@darnok.org>
Cc: ian.jackson@citrix.com, xen-devel@lists.xensource.com,
	Andres Lagar-Cavilla <andres@lagarcavilla.org>,
	ian.campbell@citrix.com
Subject: Re: memop struct packing, 32/64 bits
Date: Sun, 22 Jan 2012 20:43:15 +0000	[thread overview]
Message-ID: <CB422563.295C9%keir.xen@gmail.com> (raw)
In-Reply-To: <20120122203714.GB30288@andromeda.dapyr.net>

On 22/01/2012 20:37, "Konrad Rzeszutek Wilk" <konrad@darnok.org> wrote:

>>> luck? Am I missing something?
>> 
>> Where older structs were not 32/64-bit invariant, compat shims were
>> implemented. See common/compat/memory.c, for example. Well worth avoiding
>> that!
> 
> So for the "Fun" of it I tried to see if the 'struct
> xen_processor_performance' has some 32/64-bit issues and was surprised
> to find they do. What I am more surprised to find is that nobody seems
> to have had any troubles with this as it seems to have been there since
> it was initially implemented. The major issue would have been with the
> 'shared_type', 'domain_info' and the pointer to the 'states' being at
> different offsets (So when running a 32-bit dom0 with a 64-bit
> hypervisor).

It works because x86/64 Xen has a compat shim for that platform hypercall
command, which it uses when the caller is a 32-bit guest.

See xen/include/xlat.lst, xen/include/compat/platform.h (auto-generated),
xen/arch/x86/x86_64/platform_hypercall.c. For more details, ask Jan -- he
implemented most of it. ;-)

 -- Keir

> The attached little C program has the identified issues and the
> // FIX is my attempt at making the structs of the same size on 32 and 64
> bit builds. Right now when built as 32-bit the struct is 96 bytes, while on
> 64-bit it is 104.
> 
> Was wondering what is the right fix? The thoughts I had was to either
> leave them as be and the domain would have to figure out whether the
> hypervisor
> is 32-bit or 64-bit and provide the _right_ structure.
> 
> Or perhaps fix it and provide a "version" hypercall, but that would not
> be backwards compatible.

  reply	other threads:[~2012-01-22 20:43 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-01-19 20:30 memop struct packing, 32/64 bits Andres Lagar-Cavilla
2012-01-19 20:49 ` Keir Fraser
2012-01-19 20:57   ` Andres Lagar-Cavilla
2012-01-19 21:11     ` Ian Campbell
2012-01-19 21:21       ` Andres Lagar-Cavilla
2012-01-19 21:23       ` Andres Lagar-Cavilla
2012-01-19 21:56         ` Keir Fraser
2012-01-19 22:00           ` Keir Fraser
2012-01-19 22:04             ` Keir Fraser
2012-01-19 22:05             ` Andres Lagar-Cavilla
2012-01-22 20:37   ` Konrad Rzeszutek Wilk
2012-01-22 20:43     ` Keir Fraser [this message]
2012-01-23  9:24     ` Jan Beulich
2012-01-23 15:02       ` Konrad Rzeszutek Wilk
2012-01-19 20:49 ` Konrad Rzeszutek Wilk
2012-01-19 21:07   ` Keir Fraser
2012-01-19 21:12     ` Ian Campbell
2012-01-19 21:56       ` Keir Fraser
2012-01-20 10:12         ` Jan Beulich
2012-01-20 10:32           ` Keir Fraser

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=CB422563.295C9%keir.xen@gmail.com \
    --to=keir.xen@gmail.com \
    --cc=andres@lagarcavilla.org \
    --cc=ian.campbell@citrix.com \
    --cc=ian.jackson@citrix.com \
    --cc=konrad@darnok.org \
    --cc=xen-devel@lists.xensource.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).