[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [qemu-s390x] [Qemu-devel] [PATCH v2 2/3] hw/s390x/css: Remove QEMU_P
From: |
Thomas Huth |
Subject: |
Re: [qemu-s390x] [Qemu-devel] [PATCH v2 2/3] hw/s390x/css: Remove QEMU_PACKED from struct SenseId |
Date: |
Wed, 26 Sep 2018 13:26:23 +0200 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.9.1 |
On 2018-09-26 13:21, David Hildenbrand wrote:
>
>>> diff --git a/hw/s390x/css.c b/hw/s390x/css.c
>>> index 5a9fe45ce8..db378f6238 100644
>>> --- a/hw/s390x/css.c
>>> +++ b/hw/s390x/css.c
>>> @@ -750,12 +750,13 @@ static void sch_handle_halt_func(SubchDev *sch)
>>>
>>> }
>>>
>>> -static void copy_sense_id_to_guest(SenseId *dest, SenseId *src)
>>> +static void copy_sense_id_to_guest(SenseIdPacked *dest, SenseId *src)
>>> {
>>> int i;
>>>
>>> dest->reserved = src->reserved;
>>> - dest->cu_type = cpu_to_be16(src->cu_type);
>>> + /* avoid unaligned accesses */
>>> + dest->cu_type[0] = cpu_to_be16(src->cu_type) >> 8;
>>
>> The error Peter reported was "load of misaligned address", so the
>> culprit is the cpu_to_be16() call. See bswap16s() casting an unaligned u16.
>>
>> IMHO your patch should trigger the same issue.
>
> No, src->cu_type would be aligned now ...
>
>>
>> What about this instead?
>>
>> dest->cu_type = lduw_be_p(&src->cu_type);
>>
>
> ... however that certainly looks better ...
>
> ... but looks like Thomas wants to stick to the handcrafted approach.
That would still does not fix the issue in the migration code
("VMSTATE_UINT16(cu_type, SenseId)").
Thomas
- Re: [qemu-s390x] [PATCH v2 2/3] hw/s390x/css: Remove QEMU_PACKED from struct SenseId, (continued)
- Re: [qemu-s390x] [PATCH v2 2/3] hw/s390x/css: Remove QEMU_PACKED from struct SenseId, David Hildenbrand, 2018/09/26
- Re: [qemu-s390x] [PATCH v2 2/3] hw/s390x/css: Remove QEMU_PACKED from struct SenseId, Thomas Huth, 2018/09/26
- Re: [qemu-s390x] [PATCH v2 2/3] hw/s390x/css: Remove QEMU_PACKED from struct SenseId, David Hildenbrand, 2018/09/26
- Re: [qemu-s390x] [PATCH v2 2/3] hw/s390x/css: Remove QEMU_PACKED from struct SenseId, Thomas Huth, 2018/09/26
- Re: [qemu-s390x] [PATCH v2 2/3] hw/s390x/css: Remove QEMU_PACKED from struct SenseId, David Hildenbrand, 2018/09/26
- Re: [qemu-s390x] [PATCH v2 2/3] hw/s390x/css: Remove QEMU_PACKED from struct SenseId, Cornelia Huck, 2018/09/26
- Re: [qemu-s390x] [PATCH v2 2/3] hw/s390x/css: Remove QEMU_PACKED from struct SenseId, Thomas Huth, 2018/09/26
- Re: [qemu-s390x] [PATCH v2 2/3] hw/s390x/css: Remove QEMU_PACKED from struct SenseId, David Hildenbrand, 2018/09/26
- Re: [qemu-s390x] [Qemu-devel] [PATCH v2 2/3] hw/s390x/css: Remove QEMU_PACKED from struct SenseId, Philippe Mathieu-Daudé, 2018/09/26
- Re: [qemu-s390x] [Qemu-devel] [PATCH v2 2/3] hw/s390x/css: Remove QEMU_PACKED from struct SenseId, David Hildenbrand, 2018/09/26
- Re: [qemu-s390x] [Qemu-devel] [PATCH v2 2/3] hw/s390x/css: Remove QEMU_PACKED from struct SenseId,
Thomas Huth <=
- Re: [qemu-s390x] [PATCH v2 2/3] hw/s390x/css: Remove QEMU_PACKED from struct SenseId, Thomas Huth, 2018/09/26
Re: [qemu-s390x] [PATCH v2 2/3] hw/s390x/css: Remove QEMU_PACKED from struct SenseId, Cornelia Huck, 2018/09/26
[qemu-s390x] [PATCH v2 3/3] hw/s390x/ioinst: Fix alignment problem in struct SubchDev, Thomas Huth, 2018/09/26