All of lore.kernel.org
 help / color / mirror / Atom feed
From: Christoffer Dall <cdall@linaro.org>
To: Andrew Jones <drjones@redhat.com>
Cc: "kvm@vger.kernel.org" <kvm@vger.kernel.org>,
	"kvmarm@lists.cs.columbia.edu" <kvmarm@lists.cs.columbia.edu>,
	"Alexander Graf" <agraf@suse.de>,
	"Paolo Bonzini" <pbonzini@redhat.com>,
	"Radim Krčmář" <rkrcmar@redhat.com>,
	"Jintack Lim" <jintack@cs.columbia.edu>,
	"Marc Zyngier" <marc.zyngier@arm.com>
Subject: Re: [PATCH kvm-unit-tests 3/3] arm64: timer: Add support for phys timer testing
Date: Tue, 18 Jul 2017 16:15:23 +0200	[thread overview]
Message-ID: <CAMJs5B-vjze6dZ_fhzjbY=vsx9S7HaCa_LXNwt_NhOWAFsWraQ@mail.gmail.com> (raw)
In-Reply-To: <20170718135003.4vzeoc2ahykvi4ol@kamzik.brq.redhat.com>

On Tue, Jul 18, 2017 at 3:50 PM, Andrew Jones <drjones@redhat.com> wrote:
> On Tue, Jul 18, 2017 at 03:31:03PM +0200, Christoffer Dall wrote:
>> On Tue, Jul 18, 2017 at 03:23:24PM +0200, Andrew Jones wrote:
>> > On Tue, Jul 18, 2017 at 03:01:53PM +0200, Christoffer Dall wrote:
>> > > On Tue, Jul 18, 2017 at 02:09:57PM +0200, Andrew Jones wrote:
>> > > > On Thu, Jul 13, 2017 at 09:20:09PM +0200, Christoffer Dall wrote:
>> > > > > Rearrange the code to be able to reuse as much as posible and add
>> > > > > support for testing the physical timer as well.
>> > > > >
>> > > > > Also change the default unittests configuration to run a separate vtimer
>> > > > > and ptimer test so that older kernels without ptimer support just show a
>> > > > > failure.
>> > > >
>> > > > We could run tests for both the ptimer and vtimer in a single execution,
>> > > > rather than splitting them and requiring the input, because the read of
>> > > > cntp_ctl_el0 will predictably cause an UNKNOWN exception. Also, by
>> > > > applying the errata framework we can ensure that if we expect the read
>> > > > to work, i.e. the host kernel is recent enough, then, if we still get
>> > > > an UNKNOWN exception, we can report FAIL instead of SKIP. Below is an
>> > > > add on patch that makes the conversion. Let me know what you think.
>> > >
>> > > The problem with this patch, is that we then report SKIP instead of
>> > > FAIL, when we regress the kernel and actually break physical counter
>> > > access (which I did while developing my series).
>> > >
>> >
>> > Well, as long as the cntp_ctl_el0 read isn't regressed into generating
>> > an unknown exception, then the ptimer tests will always be run, reporting
>> > failures as they should.
>> >
>>
>> And that is exactly what we've done a couple of times around, because
>> VHE changes the layout of the trap control register to EL2, and the way
>> we handle traps to KVM of the physical counter register is to inject an
>> undefined exception...
>>
>> > > I think something like this should be discovered by way of capabilities
>> > > or hardcoding a kernel version.
>> >
>> > That's possible already by making one more change (which I should have
>> > made in the first place)
>> >
>> > diff --git a/errata.txt b/errata.txt
>> > index 5608a308ce7c9..8859d4f1d3860 100644
>> > --- a/errata.txt
>> > +++ b/errata.txt
>> > @@ -4,4 +4,5 @@
>> >  #---------------:-----------------------:--------------------------------------
>> >  9e3f7a296940   : 4.9                   : arm64: KVM: pmu: Fix AArch32 cycle counter access
>> >  6c7a5dce22b3   : 4.12                  : KVM: arm/arm64: fix races in kvm_psci_vcpu_on
>> > +7b6b46311a85   : 4.11                  : KVM: arm/arm64: Emulate the EL1 phys timer registers
>> >  #---------------:-----------------------:--------------------------------------
>> >
>> > With that change, when the test runtime system detects it's running on
>> > a host with at least a 4.11 kernel, then it will automatically set
>> > ERRATA_7b6b46311a85=y (unless overridden by the user). Having that
>> > errata set will even ensure the cntp_ctl_el0 read is tested.
>> >
>>
>> ah, ok then that makes perfect sense.
>>
>> I'm a little confused about the logic though, if we regress the physical
>> counter access on a newer kernel in a way that gives you an undefined
>> exception, will we get FAIL or SKIP?
>>
>> We should get FAIL.
>
> We'll get FAIL as long as the user doesn't override ERRATA_7b6b46311a85
> to be 'n'. See the if-else in set_ptimer_unsupported()
>
>   if (ptimer_unsupported && !ERRATA(7b6b46311a85)) {
>           report_skip("Skipping ptimer tests. Set ERRATA_7b6b46311a85=y to enable.");
>   } else if (ptimer_unsupported) {
>           report("ptimer: read CNTP_CTL_EL0", false);
>           report_info("ptimer: skipping remaining tests");
>   }

so report("...", false); means FAIL?

If so, ok :)

>
> I was guessing we'd want to skip the remaining tests if we can't
> even read the register, but it could be reworked to try every
> ptimer test when ERRATA_7b6b46311a85=y as well.
>

It makes sense to skip the rest, agreed.

Thanks,
-Christoffer

  reply	other threads:[~2017-07-18 14:15 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-07-13 19:20 [PATCH kvm-unit-tests 0/3] Add physical timer test Christoffer Dall
2017-07-13 19:20 ` [PATCH kvm-unit-tests 1/3] arm64: timer: Fix vtimer interrupt test Christoffer Dall
2017-07-14  7:55   ` Marc Zyngier
2017-07-14 15:43     ` Christoffer Dall
2017-07-14 15:54       ` Marc Zyngier
2017-07-13 19:20 ` [PATCH kvm-unit-tests 2/3] arm64: timer: Fix test on APM X-Gene Christoffer Dall
2017-07-14  8:04   ` Marc Zyngier
2017-07-14 15:45     ` Christoffer Dall
2017-07-18 10:05       ` Andrew Jones
2017-07-18 10:35         ` Christoffer Dall
2017-07-18 12:15           ` Andrew Jones
2017-07-24 17:13             ` Paolo Bonzini
2017-07-24 21:25               ` Christoffer Dall
2017-07-26 11:38                 ` Christoffer Dall
2017-07-13 19:20 ` [PATCH kvm-unit-tests 3/3] arm64: timer: Add support for phys timer testing Christoffer Dall
2017-07-18 12:09   ` Andrew Jones
2017-07-18 13:01     ` Christoffer Dall
2017-07-18 13:23       ` Andrew Jones
2017-07-18 13:31         ` Christoffer Dall
2017-07-18 13:50           ` Andrew Jones
2017-07-18 14:15             ` Christoffer Dall [this message]
2017-07-18 14:29               ` Andrew Jones
2017-07-18 14:37                 ` Christoffer Dall
2017-07-18 10:17 ` [PATCH kvm-unit-tests 0/3] Add physical timer test Andrew Jones
2017-07-18 10:42   ` Christoffer Dall
2017-07-18 12:20     ` Andrew Jones
2017-07-24 17:16 ` Paolo Bonzini

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAMJs5B-vjze6dZ_fhzjbY=vsx9S7HaCa_LXNwt_NhOWAFsWraQ@mail.gmail.com' \
    --to=cdall@linaro.org \
    --cc=agraf@suse.de \
    --cc=drjones@redhat.com \
    --cc=jintack@cs.columbia.edu \
    --cc=kvm@vger.kernel.org \
    --cc=kvmarm@lists.cs.columbia.edu \
    --cc=marc.zyngier@arm.com \
    --cc=pbonzini@redhat.com \
    --cc=rkrcmar@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.