Message ID | 20200916004638.2444147-1-richard.henderson@linaro.org |
---|---|
Headers | show |
Series | qom: Allow object to be aligned | expand |
On Tue, Sep 15, 2020 at 5:47 PM Richard Henderson <richard.henderson@linaro.org> wrote: > > Fix alignment of CPURISCVState.vreg. > > Signed-off-by: Richard Henderson <richard.henderson@linaro.org> Reviewed-by: Alistair Francis <alistair.francis@wdc.com> Alistair > --- > Cc: Alistair Francis <Alistair.Francis@wdc.com> > Cc: qemu-riscv@nongnu.org > --- > target/riscv/cpu.c | 1 + > 1 file changed, 1 insertion(+) > > diff --git a/target/riscv/cpu.c b/target/riscv/cpu.c > index 57c006df5d..0bbfd7f457 100644 > --- a/target/riscv/cpu.c > +++ b/target/riscv/cpu.c > @@ -628,6 +628,7 @@ static const TypeInfo riscv_cpu_type_infos[] = { > .name = TYPE_RISCV_CPU, > .parent = TYPE_CPU, > .instance_size = sizeof(RISCVCPU), > + .instance_align = __alignof__(RISCVCPU), > .instance_init = riscv_cpu_init, > .abstract = true, > .class_size = sizeof(RISCVCPUClass), > -- > 2.25.1 > >
On 9/17/20 11:43 AM, Eduardo Habkost wrote: > On Tue, Sep 15, 2020 at 05:46:33PM -0700, Richard Henderson wrote: >> We do not need or want to be allocating page sized quanta. >> >> Signed-off-by: Richard Henderson <richard.henderson@linaro.org> > > Would it be safe to keep patches 2-6 applied in case this one > gets dropped or reverted for any reason? Yes. Only objects using QEMU_ALIGNED() should have an __alignof__ larger than qemu_max_align_t. Therefore, I believe that the CPUArchState objects to be the only ones that will go through qemu_memalign. So we won't end up with all QOM objects being page allocated on Windows. r~
On Tue, Sep 15, 2020 at 05:46:32PM -0700, Richard Henderson wrote: > I've seen some failures on arm and s390x hosts after > enabling host vector support. It turns out that the > malloc for these hosts does not provide 16-byte alignment. > > We already have a function that can alloc with alignment, > but we need to pass this down from the structure. We also > don't want to use this function unconditionally, because > the windows version does page allocation, which would be > overkill for the vast majority of the objects allocated. I'm queueing patches 2-6. Thanks!