From: "Christoph Schlameuss" <schlameuss@linux.ibm.com>
To: "Janosch Frank" <frankja@linux.ibm.com>, <kvm@vger.kernel.org>
Cc: <linux-s390@vger.kernel.org>, <linux-kselftest@vger.kernel.org>,
"Paolo Bonzini" <pbonzini@redhat.com>,
"Shuah Khan" <shuah@kernel.org>,
"Christian Borntraeger" <borntraeger@linux.ibm.com>,
"Claudio Imbrenda" <imbrenda@linux.ibm.com>,
"David Hildenbrand" <david@redhat.com>
Subject: Re: [PATCH v6 2/5] selftests: kvm: s390: Add uc_skey VM test case
Date: Tue, 15 Oct 2024 15:33:04 +0200 [thread overview]
Message-ID: <D4WF2493HS7M.QHC37L73T9L5@linux.ibm.com> (raw)
In-Reply-To: <b7246d28-612e-4f6d-81ba-53d9a28e325b@linux.ibm.com>
On Tue Oct 15, 2024 at 3:22 PM CEST, Janosch Frank wrote:
> On 10/15/24 10:37 AM, Christoph Schlameuss wrote:
> > Add a test case manipulating s390 storage keys from within the ucontrol
> > VM.
> >
> > Storage key instruction (ISKE, SSKE and RRBE) intercepts and
> > Keyless-subset facility are disabled on first use, where the skeys are
> > setup by KVM in non ucontrol VMs.
> >
>
> [...]
>
> > -/* verify SIEIC exit
> > +/*
> > + * Disable skey intercepts and rewind last instruction
> > + * (KVM would init the skeys here)
> > + */
> > +static void uc_skey_enable(FIXTURE_DATA(uc_kvm) *self)
> > +{
> > + struct kvm_s390_sie_block *sie_block = self->sie_block;
> > + int ilen = insn_length(sie_block->ipa >> 8);
> > + struct kvm_run *run = self->run;
> > +
> > + /* disable KSS */
> > + sie_block->cpuflags &= ~CPUSTAT_KSS;
> > + /* disable skey inst interception */
> > + sie_block->ictl &= ~(ICTL_ISKE | ICTL_SSKE | ICTL_RRBE);
> > +
> > + /* rewind to reexecute intercepted instruction */
> > + run->psw_addr = run->psw_addr - ilen;
>
> There's a very important detail between KSS and the SKEY ICTLs:
> KSS is (mostly) nullifying i.e. the PSW points to the instruction that
> caused the KSS exit.
> ICTL intercepts are suppressing which means the PSW points after the
> instruction and hence we need to rewind the PSW if we want to re-issue
> the instruction.
>
> Re-winding on a KSS intercept makes the guest cpu execute the
> instruction before the intercept producing instruction twice.
Oh, yes. You are right, I did mess that up in my cleanup. I will fix that.
Here it does now only work since the KSS is not intercepted on the second
invocation. But I am with you, it should only be executed once.
next prev parent reply other threads:[~2024-10-15 13:33 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-10-15 8:37 [PATCH v6 0/5] selftests: kvm: s390: Add ucontrol memory selftests Christoph Schlameuss
2024-10-15 8:37 ` [PATCH v6 1/5] selftests: kvm: s390: Add uc_map_unmap VM test case Christoph Schlameuss
2024-10-15 8:37 ` [PATCH v6 2/5] selftests: kvm: s390: Add uc_skey " Christoph Schlameuss
2024-10-15 13:22 ` Janosch Frank
2024-10-15 13:33 ` Christoph Schlameuss [this message]
2024-10-15 14:06 ` Christoph Schlameuss
2024-10-15 14:13 ` Christoph Schlameuss
2024-10-15 14:15 ` Christoph Schlameuss
2024-10-18 9:03 ` Janosch Frank
2024-10-15 8:37 ` [PATCH v6 3/5] selftests: kvm: s390: Verify reject memory region operations for ucontrol VMs Christoph Schlameuss
2024-10-15 8:37 ` [PATCH v6 4/5] selftests: kvm: s390: Fix whitespace confusion in ucontrol test Christoph Schlameuss
2024-10-15 8:37 ` [PATCH v6 5/5] selftests: kvm: s390: correct IP.b length in uc_handle_sieic debug output Christoph Schlameuss
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=D4WF2493HS7M.QHC37L73T9L5@linux.ibm.com \
--to=schlameuss@linux.ibm.com \
--cc=borntraeger@linux.ibm.com \
--cc=david@redhat.com \
--cc=frankja@linux.ibm.com \
--cc=imbrenda@linux.ibm.com \
--cc=kvm@vger.kernel.org \
--cc=linux-kselftest@vger.kernel.org \
--cc=linux-s390@vger.kernel.org \
--cc=pbonzini@redhat.com \
--cc=shuah@kernel.org \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox