From: Juan Quintela <quintela@redhat.com>
To: andrzej zaborowski <balrogg@gmail.com>
Cc: Peter Maydell <peter.maydell@linaro.org>,
Igor Mitsyanko <i.mitsyanko@samsung.com>,
e.voevodin@samsung.com, qemu-devel@nongnu.org,
kyungmin.park@samsung.com, d.solodkiy@samsung.com,
m.kozlov@samsung.com, afaerber@suse.de
Subject: Re: [Qemu-devel] [PATCH 3/5] hw/pxa2xx_lcd.c: drop VMSTATE_UINTTL usage
Date: Wed, 22 Feb 2012 14:56:48 +0100 [thread overview]
Message-ID: <87linvug2n.fsf@elfo.elfo> (raw)
In-Reply-To: <CAOq732J4Sp583N27Wi2jcuYpeHhv-3XYugDzvyKhRRBzZvE-uQ@mail.gmail.com> (andrzej zaborowski's message of "Wed, 22 Feb 2012 13:13:21 +0100")
andrzej zaborowski <balrogg@gmail.com> wrote:
> On 22 February 2012 13:00, Peter Maydell <peter.maydell@linaro.org> wrote:
>> On 22 February 2012 11:36, andrzej zaborowski <balrog@zabor.org> wrote:
>>> On 22 February 2012 11:15, Igor Mitsyanko <i.mitsyanko@samsung.com> wrote:
>>>> Convert three variables in DMAChannel state from type
>>>> target_phys_addr_t to uint32_t,
>>>> use VMSTATE_UINT32 instead of VMSTATE_UINTTL for these variables.
>>>> We can do it safely because:
>>>> 1) pxa2xx has 32-bit physical address;
>>>> 2) rest of the code in this file treats these variables as uint32_t;
>>>
>>> Why's uint32_t more correct though? The purpose of using a named type
>>> across qemu is to mark fields as memory addresses (similar to size_t
>>> being used for sizes, etc.), uint32_t conveys less information -- only
>>> the size.
>>>
>>> It's a safe hack, but I don't see the rationale.
>>
>> Because we might change target_phys_addr_t to 64 bits globally
>> some day (it's certainly been mooted) and that shouldn't suddenly
>> change the register width and certainly shouldn't change the
>> migration state.
>>
>> Basically VMSTATE_UINTTL in hw/ is always a bug, because its
>> behaviour depends on the size of target_ulong, which is a
>> property of the CPU, which is a completely separate device.
>
> I'm not really discussing that, my question is unrelated to
> migration/savevm because the patch touches parts that shouldn't be
> concerned with migration. If a particular function (like migration)
> needs the type converted to something then that's why C has type
> conversions. A type conversion that compiles to no code is still a
> type conversion.
For migration, UINTTL is _always_ wrong, we need to handle it that way
for backward compatibility.
#if TARGET_LONG_BITS == 64
#define VMSTATE_UINTTL_V(_f, _s, _v) \
VMSTATE_UINT64_V(_f, _s, _v)
#define VMSTATE_UINTTL_ARRAY_V(_f, _s, _n, _v) \
VMSTATE_UINT64_ARRAY_V(_f, _s, _n, _v)
#else
#define VMSTATE_UINTTL_V(_f, _s, _v) \
VMSTATE_UINT32_V(_f, _s, _v)
#define VMSTATE_UINTTL_ARRAY_V(_f, _s, _n, _v) \
VMSTATE_UINT32_ARRAY_V(_f, _s, _n, _v)
#endif
this was done for CPU's, not devices. If we use this, we can't access a
device state without knowing the "long-iness" (don't you like the word)
of the cpu that it is running.
IMHO, something that always sent 64bit, and on reception if target_long
is 32bit and value don't fit -> just break migration makes much more
sense.
But that can only be done for new code :-(
On the other hand, I understand andrzej, we are missig a
target_phys_addr32_t
or whatever we want to call it, that is for devices that _only_ support
32bit addressing. That is something that is valuable to document,
independently of how migration is done.
Later, Juan.
next prev parent reply other threads:[~2012-02-22 13:57 UTC|newest]
Thread overview: 36+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-02-22 10:15 [Qemu-devel] [PATCH 0/5] VMState cleanups Igor Mitsyanko
2012-02-22 10:15 ` [Qemu-devel] [PATCH 1/5] target-alpha/machine.c: use VMSTATE_UINT64* instead of VMSTATE_UINTTL* Igor Mitsyanko
2012-02-22 11:19 ` Peter Maydell
2012-02-22 13:49 ` Juan Quintela
2012-02-22 10:15 ` [Qemu-devel] [PATCH 2/5] hw/pxa2xx_dma.c: drop VMSTATE_UINTTL usage Igor Mitsyanko
2012-02-22 11:06 ` Peter Maydell
2012-02-22 13:47 ` Juan Quintela
2012-02-22 13:52 ` Peter Maydell
2012-02-22 14:05 ` Juan Quintela
2012-02-22 10:15 ` [Qemu-devel] [PATCH 3/5] hw/pxa2xx_lcd.c: " Igor Mitsyanko
2012-02-22 11:07 ` Peter Maydell
2012-02-22 11:36 ` andrzej zaborowski
2012-02-22 12:00 ` Peter Maydell
2012-02-22 12:13 ` andrzej zaborowski
2012-02-22 12:48 ` Peter Maydell
2012-02-22 12:56 ` andrzej zaborowski
2012-02-22 13:32 ` Mitsyanko Igor
2012-02-22 13:56 ` Juan Quintela [this message]
2012-02-22 12:26 ` Mitsyanko Igor
2012-02-22 12:48 ` andrzej zaborowski
2012-02-22 13:30 ` Mitsyanko Igor
2012-02-22 10:15 ` [Qemu-devel] [PATCH 4/5] vmstate: refactor and move VMSTATE_UINTTL* macro Igor Mitsyanko
2012-02-22 14:00 ` Juan Quintela
2012-02-22 10:15 ` [Qemu-devel] [PATCH 5/5] vmstate: introduce get_bufsize entry in VMStateField Igor Mitsyanko
2012-02-22 11:26 ` [Qemu-devel] [PATCH 0/5] VMState cleanups Peter Maydell
2012-02-22 12:01 ` Mitsyanko Igor
2012-02-22 12:49 ` Andreas Färber
2012-02-22 12:50 ` Peter Maydell
2012-02-22 14:02 ` Juan Quintela
2012-02-22 15:37 ` Andreas Färber
2012-02-22 15:42 ` Peter Maydell
2012-02-22 16:04 ` Andreas Färber
2012-02-22 16:09 ` Peter Maydell
2012-02-22 23:41 ` Alexander Graf
2012-02-23 13:52 ` Juan Quintela
2012-02-22 12:06 ` Peter Maydell
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=87linvug2n.fsf@elfo.elfo \
--to=quintela@redhat.com \
--cc=afaerber@suse.de \
--cc=balrogg@gmail.com \
--cc=d.solodkiy@samsung.com \
--cc=e.voevodin@samsung.com \
--cc=i.mitsyanko@samsung.com \
--cc=kyungmin.park@samsung.com \
--cc=m.kozlov@samsung.com \
--cc=peter.maydell@linaro.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).