From: Janosch Frank <frankja@linux.ibm.com>
To: Janis Schoetterl-Glausch <scgl@linux.ibm.com>,
Thomas Huth <thuth@redhat.com>,
Claudio Imbrenda <imbrenda@linux.ibm.com>,
David Hildenbrand <david@redhat.com>,
Richard Henderson <richard.henderson@linaro.org>
Cc: kvm@vger.kernel.org, linux-s390@vger.kernel.org, qemu-s390x@nongnu.org
Subject: Re: [kvm-unit-tests PATCH v5 1/2] s390x: Add specification exception test
Date: Fri, 26 Aug 2022 13:55:13 +0200 [thread overview]
Message-ID: <8aa423e5-39e9-155d-b1ed-df4ebef72757@linux.ibm.com> (raw)
In-Reply-To: <c7d094b7eb2d06449f8afe2d8486a0e853858483.camel@linux.ibm.com>
On 8/26/22 13:23, Janis Schoetterl-Glausch wrote:
> On Wed, 2022-08-24 at 11:35 +0200, Janosch Frank wrote:
>> On 7/20/22 16:25, Janis Schoetterl-Glausch wrote:
>>> Generate specification exceptions and check that they occur.
>>>
>>> Signed-off-by: Janis Schoetterl-Glausch <scgl@linux.ibm.com>
>>> ---
>>> s390x/Makefile | 1 +
>>> lib/s390x/asm/arch_def.h | 5 ++
>>> s390x/spec_ex.c | 180 +++++++++++++++++++++++++++++++++++++++
>>> s390x/unittests.cfg | 3 +
>>> 4 files changed, 189 insertions(+)
>>> create mode 100644 s390x/spec_ex.c
>>>
>>>
>>> +
>>> +/*
>>> + * Load possibly invalid psw, but setup fixup_psw before,
>>> + * so that fixup_invalid_psw() can bring us back onto the right track.
Not sure if the second line is needed as fixup_psw is a descriptive name
already.
>>> + * Also acts as compiler barrier, -> none required in expect/check_invalid_psw
>>> + */
>>> +static void load_psw(struct psw psw)
>>> +{
>>> + uint64_t scratch;
>>> +
>
> [...]
>
>> /*
>> Store a valid mask and the address of the nop into the fixup PSW.
>> Then load the possibly invalid PSW.
>> */
>
> This seems a bit redundant given the function comment, but I can
> drop a comment in here describing how the fixup psw is computed.
Well, I skipped the function comment, got confused by the addr asm
variable and then decided to propose the comment.
It's a bit confusing since you have the invalid PSW and the global fixup
PSW in one function.
Maybe something like:
/* From here to the lpswe we're computing and setting the fixup PSW */
>
>>
>>> + fixup_psw.mask = extract_psw_mask();
>>> + asm volatile ( "larl %[scratch],0f\n"
>>> + " stg %[scratch],%[addr]\n"
>>> + " lpswe %[psw]\n"
>>> + "0: nop\n"
>>> + : [scratch] "=&d"(scratch),
>>> + [addr] "=&T"(fixup_psw.addr)
>>
>> s/addr/psw_addr/ ?
>>
>>> + : [psw] "Q"(psw)
>>> + : "cc", "memory"
>>> + );
>>> +}
>>> +
>>> +static void load_short_psw(struct short_psw psw)
>>> +{
>>> + uint64_t scratch;
>>> +
>>> + fixup_psw.mask = extract_psw_mask();
>>> + asm volatile ( "larl %[scratch],0f\n"
>>> + " stg %[scratch],%[addr]\n"
>>> + " lpsw %[psw]\n"
>>> + "0: nop\n"
>>> + : [scratch] "=&d"(scratch),
>>> + [addr] "=&T"(fixup_psw.addr)
>>> + : [psw] "Q"(psw)
>>> + : "cc", "memory"
>>> + );
>>
>> Same story.
>
> Do you want me to repeat the comments here or just rename addr?
Just rename addr
>
> [...]
>
>>> +static int not_even(void)
>>> +{
>>> + uint64_t quad[2] __attribute__((aligned(16))) = {0};
>>> +
>>> + asm volatile (".insn rxy,0xe3000000008f,%%r7,%[quad]" /* lpq %%r7,%[quad] */
>>> + : : [quad] "T"(quad)
>>
>> Is there a reason you never put a space after the constraint?
>
> TBH I never noticed I'm unusual in that regard. I guess I tend to think
> of the operand and constraint as one entity.
> I'll add the spaces.
>
>>
>>> + : "%r7", "%r8"
>>> + );
>>> + return 0;
>>> +}
>>> +
>
> [...]
next prev parent reply other threads:[~2022-08-26 11:55 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-07-20 14:25 [kvm-unit-tests PATCH v5 0/2] Add specification exception tests Janis Schoetterl-Glausch
2022-07-20 14:25 ` [kvm-unit-tests PATCH v5 1/2] s390x: Add specification exception test Janis Schoetterl-Glausch
2022-08-24 9:35 ` Janosch Frank
2022-08-25 7:38 ` Janosch Frank
2022-08-26 11:23 ` Janis Schoetterl-Glausch
2022-08-26 11:55 ` Janosch Frank [this message]
2022-07-20 14:25 ` [kvm-unit-tests PATCH v5 2/2] s390x: Test specification exceptions during transaction Janis Schoetterl-Glausch
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=8aa423e5-39e9-155d-b1ed-df4ebef72757@linux.ibm.com \
--to=frankja@linux.ibm.com \
--cc=david@redhat.com \
--cc=imbrenda@linux.ibm.com \
--cc=kvm@vger.kernel.org \
--cc=linux-s390@vger.kernel.org \
--cc=qemu-s390x@nongnu.org \
--cc=richard.henderson@linaro.org \
--cc=scgl@linux.ibm.com \
--cc=thuth@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox