Re: [RFC PATCH 1/2] KVM: selftests: Add a macro to get string of vm_mem_backing_src_type

From: Sean Christopherson
Date: Tue Feb 09 2021 - 12:39:24 EST


On Tue, Feb 09, 2021, Ben Gardon wrote:
> On Tue, Feb 9, 2021 at 3:21 AM wangyanan (Y) <wangyanan55@xxxxxxxxxx> wrote:
> >
> >
> > On 2021/2/9 2:13, Ben Gardon wrote:
> > > On Mon, Feb 8, 2021 at 1:08 AM Yanan Wang <wangyanan55@xxxxxxxxxx> wrote:
> > >> Add a macro to get string of the backing source memory type, so that
> > >> application can add choices for source types in the help() function,
> > >> and users can specify which type to use for testing.
> > > Coincidentally, I sent out a change last week to do the same thing:
> > > "KVM: selftests: Add backing src parameter to dirty_log_perf_test"
> > > (https://lkml.org/lkml/2021/2/2/1430)
> > > Whichever way this ends up being implemented, I'm happy to see others
> > > interested in testing different backing source types too.
> >
> > Thanks Ben! I have a little question here.
> >
> > Can we just present three IDs (0/1/2) but not strings for users to
> > choose which backing_src_type to use like the way of guest modes,
>
> That would be fine with me. The string names are easier for me to read
> than an ID number (especially if you were to add additional options
> e.g. 1G hugetlb or file backed / shared memory) but it's mostly an
> aesthetic preference, so I don't have strong feelings either way.

I vote to expose/consume strings, being able to do ".dirty_log_perf_test --help"
and understand the backing options without having to dig into source was super
nice.