Re: [PATCH 1/5] qom: Allow objects to be allocated with increased alignment

2020-09-15 Thread Eduardo Habkost
On Tue, Sep 15, 2020 at 02:30:34PM -0700, Richard Henderson wrote: > On 9/15/20 2:27 PM, Eduardo Habkost wrote: > > On Tue, Sep 15, 2020 at 01:51:48PM -0700, Richard Henderson wrote: > >> On 9/15/20 1:19 PM, Eduardo Habkost wrote: > >>> Once we move to C11, we can just use max_align_t. > >> > >> Ye

Re: [PATCH 1/5] qom: Allow objects to be allocated with increased alignment

2020-09-15 Thread Richard Henderson
On 9/15/20 2:27 PM, Eduardo Habkost wrote: > On Tue, Sep 15, 2020 at 01:51:48PM -0700, Richard Henderson wrote: >> On 9/15/20 1:19 PM, Eduardo Habkost wrote: >>> Once we move to C11, we can just use max_align_t. >> >> Yes. >> >>> While we don't move to C11, why not just use >>> __alignof__(union

Re: [PATCH 1/5] qom: Allow objects to be allocated with increased alignment

2020-09-15 Thread Eduardo Habkost
On Tue, Sep 15, 2020 at 01:51:48PM -0700, Richard Henderson wrote: > On 9/15/20 1:19 PM, Eduardo Habkost wrote: > > Once we move to C11, we can just use max_align_t. > > Yes. > > > While we don't move to C11, why not just use > > __alignof__(union { long l; void *p; double d; long double ld;})

Re: [PATCH 1/5] qom: Allow objects to be allocated with increased alignment

2020-09-15 Thread Richard Henderson
On 9/15/20 1:19 PM, Eduardo Habkost wrote: > Once we move to C11, we can just use max_align_t. Yes. > While we don't move to C11, why not just use > __alignof__(union { long l; void *p; double d; long double ld;}) > ? For i386, this is 4. r~

Re: [PATCH 1/5] qom: Allow objects to be allocated with increased alignment

2020-09-15 Thread Eduardo Habkost
On Tue, Sep 15, 2020 at 12:09:59PM -0700, Richard Henderson wrote: > On 9/15/20 11:07 AM, Eduardo Habkost wrote: > > On Tue, Sep 15, 2020 at 10:46:31AM -0700, Richard Henderson wrote: > >> It turns out that some hosts have a default malloc alignment less > >> than that required for vectors. > >> >

Re: [PATCH 1/5] qom: Allow objects to be allocated with increased alignment

2020-09-15 Thread Richard Henderson
On 9/15/20 11:07 AM, Eduardo Habkost wrote: > On Tue, Sep 15, 2020 at 10:46:31AM -0700, Richard Henderson wrote: >> It turns out that some hosts have a default malloc alignment less >> than that required for vectors. >> >> We assume that, with compiler annotation on CPUArchState, that we >> can pro

Re: [PATCH 1/5] qom: Allow objects to be allocated with increased alignment

2020-09-15 Thread Eduardo Habkost
On Tue, Sep 15, 2020 at 10:46:31AM -0700, Richard Henderson wrote: > It turns out that some hosts have a default malloc alignment less > than that required for vectors. > > We assume that, with compiler annotation on CPUArchState, that we > can properly align the vector portion of the guest state.

[PATCH 1/5] qom: Allow objects to be allocated with increased alignment

2020-09-15 Thread Richard Henderson
It turns out that some hosts have a default malloc alignment less than that required for vectors. We assume that, with compiler annotation on CPUArchState, that we can properly align the vector portion of the guest state. Fix the alignment of the allocation by using qemu_memalloc when required.