Re: [PATCH] regset: use vmalloc() for regset_get_alloc()

From: Al Viro
Date: Thu Feb 01 2024 - 22:49:43 EST


On Thu, Feb 01, 2024 at 07:15:48PM -0800, Doug Anderson wrote:
> >
> > Well, the next step would be to see which regset it is - if you
> > see that kind of allocation, print regset->n, regset->size and
> > regset->core_note_type.
>
> Of course! Here are the big ones:
>
> [ 45.875574] DOUG: Allocating 279584 bytes, n=17474, size=16,
> core_note_type=1029

0x405, NT_ARM_SVE
[REGSET_SVE] = { /* Scalable Vector Extension */
.core_note_type = NT_ARM_SVE,
.n = DIV_ROUND_UP(SVE_PT_SIZE(SVE_VQ_MAX, SVE_PT_REGS_SVE),
SVE_VQ_BYTES),
.size = SVE_VQ_BYTES,

IDGI. Wasn't SVE up to 32 * 2Kbit, i.e. 8Kbyte max? Any ARM folks around?
Sure, I understand that it's variable-sized and we want to allocate enough
for the worst case, but can we really get about 280Kb there? Context switches
would be really unpleasant on such boxen...

> [ 45.884809] DOUG: Allocating 8768 bytes, n=548, size=16, core_note_type=1035
> [ 45.893958] DOUG: Allocating 65552 bytes, n=4097, size=16,
> core_note_type=1036

0x40c, NT_ARM_ZA.
/*
* ZA is a single register but it's variably sized and
* the ptrace core requires that the size of any data
* be an exact multiple of the configured register
* size so report as though we had SVE_VQ_BYTES
* registers. These values aren't exposed to
* userspace.
*/
.n = DIV_ROUND_UP(ZA_PT_SIZE(SME_VQ_MAX), SVE_VQ_BYTES),
.size = SVE_VQ_BYTES,