From: Anthony Liguori <aliguori@us.ibm.com>
To: Paolo Bonzini <pbonzini@redhat.com>,
Markus Armbruster <armbru@redhat.com>
Cc: Gerd Hoffmann <kraxel@redhat.com>,
qemu-devel@nongnu.org, Richard Henderson <rth@twiddle.net>
Subject: Re: [Qemu-devel] [PULL 3/5] exec: Support 64-bit operations in address_space_rw
Date: Wed, 17 Jul 2013 10:50:31 -0500 [thread overview]
Message-ID: <8761w9gp88.fsf@codemonkey.ws> (raw)
In-Reply-To: <51E67B7A.8000800@redhat.com>
Paolo Bonzini <pbonzini@redhat.com> writes:
> Il 17/07/2013 11:50, Markus Armbruster ha scritto:
>> Richard Henderson <rth@twiddle.net> writes:
>>
>>> Honor the implementation maximum access size, and at least check
>>> the minimum access size.
>>>
>>> Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
>>> Signed-off-by: Richard Henderson <rth@twiddle.net>
>>
>> Fails for me:
>>
>> qemu-system-x86_64: /work/armbru/qemu/exec.c:1927: memory_access_size: Assertion `l >= access_size_min' failed.
>
> This:
>
> unsigned access_size_min = mr->ops->impl.min_access_size;
> unsigned access_size_max = mr->ops->impl.max_access_size;
>
> must be respectively:
>
> unsigned access_size_min = 1;
> unsigned access_size_max = mr->ops->valid.max_access_size;
>
> access_size_min can be 1 because erroneous accesses must not crash
> QEMU, they should trigger exceptions in the guest or just return
> garbage (depending on the CPU). I'm not sure I understand the comment,
> placing a 4-byte field at the last byte of a region makes no sense
> (unless impl.unaligned is true).
>
> access_size_max can be mr->ops->valid.max_access_size because memory.c
> can and will still break accesses bigger than
> mr->ops->impl.max_access_size.
>
> Markus, can you try the minimal patch above? Or this one that also
> does the consequent simplifications.
FYI, the reproducer is very simple:
qemu-system-x86_64 -usb
Regards,
Anthony Liguori
>
> diff --git a/exec.c b/exec.c
> index c99a883..0904283 100644
> --- a/exec.c
> +++ b/exec.c
> @@ -1898,14 +1898,8 @@ static inline bool memory_access_is_direct(MemoryRegion *mr, bool is_write)
>
> static int memory_access_size(MemoryRegion *mr, unsigned l, hwaddr addr)
> {
> - unsigned access_size_min = mr->ops->impl.min_access_size;
> - unsigned access_size_max = mr->ops->impl.max_access_size;
> + unsigned access_size_max = mr->ops->valid.max_access_size;
>
> - /* Regions are assumed to support 1-4 byte accesses unless
> - otherwise specified. */
> - if (access_size_min == 0) {
> - access_size_min = 1;
> - }
> if (access_size_max == 0) {
> access_size_max = 4;
> }
> @@ -1922,9 +1916,6 @@ static int memory_access_size(MemoryRegion *mr, unsigned l, hwaddr addr)
> if (l > access_size_max) {
> l = access_size_max;
> }
> - /* ??? The users of this function are wrong, not supporting minimums larger
> - than the remaining length. C.f. memory.c:access_with_adjusted_size. */
> - assert(l >= access_size_min);
>
> return l;
> }
>
> Paolo
next prev parent reply other threads:[~2013-07-17 15:50 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-07-14 22:16 [Qemu-devel] [PULL 0/5] alpha-softmmu fixes Richard Henderson
2013-07-14 22:16 ` [Qemu-devel] [PULL 1/5] hw/alpha: Don't use get_system_io Richard Henderson
2013-07-14 22:16 ` [Qemu-devel] [PULL 2/5] hw/alpha: Don't machine check on missing pci i/o Richard Henderson
2013-07-14 22:16 ` [Qemu-devel] [PULL 3/5] exec: Support 64-bit operations in address_space_rw Richard Henderson
2013-07-17 9:50 ` Markus Armbruster
2013-07-17 11:09 ` Paolo Bonzini
2013-07-17 13:23 ` Richard Henderson
2013-07-17 13:45 ` Paolo Bonzini
2013-07-17 14:29 ` Richard Henderson
2013-07-17 14:41 ` Paolo Bonzini
2013-07-17 15:50 ` Anthony Liguori [this message]
2013-07-17 17:32 ` Paolo Bonzini
2013-07-17 18:26 ` Richard Henderson
2013-07-17 18:57 ` Paolo Bonzini
2013-07-17 19:28 ` Richard Henderson
2013-07-17 19:56 ` Paolo Bonzini
2013-07-17 20:05 ` Richard Henderson
2013-07-17 18:28 ` Anthony Liguori
2013-07-14 22:16 ` [Qemu-devel] [PULL 4/5] hw/alpha: Drop latch_tmp hack Richard Henderson
2013-07-14 22:16 ` [Qemu-devel] [PULL 5/5] hw/alpha: Use SRM epoch Richard Henderson
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=8761w9gp88.fsf@codemonkey.ws \
--to=aliguori@us.ibm.com \
--cc=armbru@redhat.com \
--cc=kraxel@redhat.com \
--cc=pbonzini@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=rth@twiddle.net \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.