lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Wed, 21 Jun 2023 09:30:02 +0200
From:   Andrew Jones <ajones@...tanamicro.com>
To:     Haibo Xu <xiaobo55x@...il.com>
Cc:     Haibo Xu <haibo1.xu@...el.com>, maz@...nel.org,
        oliver.upton@...ux.dev, seanjc@...gle.com,
        Paolo Bonzini <pbonzini@...hat.com>,
        Jonathan Corbet <corbet@....net>,
        Anup Patel <anup@...infault.org>,
        Atish Patra <atishp@...shpatra.org>,
        Paul Walmsley <paul.walmsley@...ive.com>,
        Palmer Dabbelt <palmer@...belt.com>,
        Albert Ou <aou@...s.berkeley.edu>,
        Shuah Khan <shuah@...nel.org>,
        James Morse <james.morse@....com>,
        Suzuki K Poulose <suzuki.poulose@....com>,
        Zenghui Yu <yuzenghui@...wei.com>,
        Ben Gardon <bgardon@...gle.com>,
        David Matlack <dmatlack@...gle.com>,
        Vipin Sharma <vipinsh@...gle.com>,
        Colton Lewis <coltonlewis@...gle.com>, kvm@...r.kernel.org,
        linux-doc@...r.kernel.org, linux-kernel@...r.kernel.org,
        kvm-riscv@...ts.infradead.org, linux-riscv@...ts.infradead.org,
        linux-kselftest@...r.kernel.org,
        linux-arm-kernel@...ts.infradead.org, kvmarm@...ts.linux.dev
Subject: Re: [PATCH v3 10/10] KVM: riscv: selftests: Add get-reg-list test

On Wed, Jun 21, 2023 at 09:55:13AM +0800, Haibo Xu wrote:
> On Tue, Jun 20, 2023 at 6:44 PM Andrew Jones <ajones@...tanamicro.com> wrote:
> >
> > On Tue, Jun 20, 2023 at 06:05:59PM +0800, Haibo Xu wrote:
> > > On Fri, Jun 9, 2023 at 9:35 PM Andrew Jones <ajones@...tanamicro.com> wrote:
> > > >
> > > > On Fri, Jun 09, 2023 at 10:12:18AM +0800, Haibo Xu wrote:
> > > > > +static struct vcpu_reg_list aia_config = {
> > > > > +     .sublists = {
> > > > > +     BASE_SUBLIST,
> > > > > +     AIA_REGS_SUBLIST,
> > > > > +     {0},
> > > > > +     },
> > > > > +};
> > > > > +
> > > > > +static struct vcpu_reg_list fp_f_d_config = {
> > > > > +     .sublists = {
> > > > > +     BASE_SUBLIST,
> > > > > +     FP_F_REGS_SUBLIST,
> > > > > +     FP_D_REGS_SUBLIST,
> > > > > +     {0},
> > > > > +     },
> > > > > +};
> > > > > +
> > > > > +struct vcpu_reg_list *vcpu_configs[] = {
> > > > > +     &zicbo_config,
> > > > > +     &aia_config,
> > > > > +     &fp_f_d_config,
> > > > > +};
> > > > > +int vcpu_configs_n = ARRAY_SIZE(vcpu_configs);
> > > > > --
> > > > > 2.34.1
> > > > >
> > > >
> > > > I see we have a bit of a problem with the configs for riscv. Since we
> > > > don't disable anything we're not testing, then for any test that is
> > > > missing, for example, the f and d registers, we'll get output like
> > > > "There are 66 new registers. Consider adding them to the blessed reg
> > > > list with the following lines:" and then a dump of all the f and d
> > > > registers. The test doesn't fail, but it's messy and confusing. Ideally
> > > > we'd disable all registers of all sublists not in the config, probably
> > > > by starting by disabling everything and then only reenabling the ones
> > > > in the config.
> > > >
> > > > Anything that can't be disabled is either a KVM bug, i.e. we should
> > > > be able to disable it, because we can't expect every host to have it,
> > > > or it needs to be in the base register sublist (meaning every host
> > > > will always have it).
> > > >
> > >
> > > HI Andrew,
> > >
> > > I found several multi-letters ISA EXT(AIA/SSTC etc) were not allowed
> > > to be disabled.
> > > Is it a bug? shall we fix it?
> >
> > Extensions that a guest could use (regardless of whether or not the host
> > described it in the guest's isa string), because the instructions or CSR
> > accesses don't trap, can't truly be disabled. So, it's not a bug to
> > prohibit disabling them and indeed the test cases should actually ensure
> > disabling them fails.
> >
> 
> So these kinds of ISA_EXT_* regs should be in the base reg list, right?
>

Ah, this is getting a bit messy. We don't want all these extensions in a
"base", which represents extensions for all possible hosts, because the
extensions are optional, but, we can't remove them from get-reg-list
output by disabling them, since they can't be disabled. It seems we
need the concept of "base", which is the common set expected on all hosts,
and also the concept of "this host's base". I'm struggling to think of
a nice way to deal with that. A first thought is to both add these types
of registers to their own extension-specific sublists and to filter_reg().
I think that will keep them from being reported as new registers in every
test, but also allow detection of them going missing when they're
extension is present.

Thanks,
drew

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ