Re: [PATCH RESEND 2/2] KVM: arm64: nv: Expose shadow page tables in debugfs
From: Wei-Lin Chang
Date: Mon Mar 16 2026 - 06:53:13 EST
On Sat, Mar 14, 2026 at 09:39:17AM +0000, Marc Zyngier wrote:
> On Fri, 13 Mar 2026 22:28:38 +0000,
> Wei-Lin Chang <weilin.chang@xxxxxxx> wrote:
> >
> > On Wed, Mar 11, 2026 at 03:41:32PM +0000, Sebastian Ene wrote:
> > > On Sun, Mar 08, 2026 at 11:18:29PM +0000, Wei-Lin Chang wrote:
>
> [...]
>
> > > > +void kvm_nested_s2_ptdump_create_debugfs(struct kvm_s2_mmu *mmu)
> > > > +{
> > > > + struct dentry *dent;
> > > > + /* format: 0x<vttbr>-0x<vtcr>-s2-{en, dis}abled\0 */
> > > > + char file_name[2 + 16 + 1 + 2 + 16 + 4 + 3 + 6];
> > >
> > > Can you hide the size of this definition behind a macro ?
> >
> > Sure, no problem.
>
> I don't think a macro helps that much on its own. I'd rather this is
> made a bit more foolproof by directly expressing the actual string
> this results into, and use that for the size:
>
> #define S2FNAMESZ sizeof("0x0123456789abcdef-0x0123456789abcdef-s2-disabled")
>
> char file_name[S2FNAME];
>
> which is less ambiguous. The compiler will happily optimise this to a
> nice constant that also accounts for the final '\0'.
Thanks for the advice!
Makes sense to me, I'll change it to that.
Thanks,
Wei-Lin Chang
>
> Thanks,
>
> M.
>
> --
> Jazz isn't dead. It just smells funny.