public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
From: Janis Schoetterl-Glausch <scgl@linux.ibm.com>
To: Nico Boehr <nrb@linux.ibm.com>, kvm@vger.kernel.org
Cc: linux-s390@vger.kernel.org
Subject: Re: [kvm-unit-tests PATCH v6 1/2] s390x: Add specification exception test
Date: Tue, 30 Aug 2022 17:16:10 +0200	[thread overview]
Message-ID: <4bb9026dee15e94f4643a36c7171fa1c8714bad2.camel@linux.ibm.com> (raw)
In-Reply-To: <166187009028.75997.13672950150134705250@t14-nrb>

On Tue, 2022-08-30 at 16:34 +0200, Nico Boehr wrote:
> Quoting Janis Schoetterl-Glausch (2022-08-26 18:11:11)
> > Generate specification exceptions and check that they occur.
> > 
> > Signed-off-by: Janis Schoetterl-Glausch <scgl@linux.ibm.com>
> 
> Reviewed-by: Nico Boehr <nrb@linux.ibm.com>

Thanks
> 
> with minor nits below you may want to consider
> 
> > diff --git a/s390x/spec_ex.c b/s390x/spec_ex.c
> > new file mode 100644
> [...]
> > +static int bad_alignment(void)
> > +{
> > +       uint32_t words[5] __attribute__((aligned(16)));
> > +       uint32_t (*bad_aligned)[4] = (uint32_t (*)[4])&words[1];
> 
> Why not simply:
> 
> uint32_t *bad_aligned = &words[1];

This is a pointer to a word, the argument to lpq is a quadword.
Your way would probably work, especially since we don't actually want
the asm to do anything, but no harm in doing it the correct way.
> 
> > +
> > +       /* LOAD PAIR FROM QUADWORD (LPQ) requires quadword alignment */
> > +       asm volatile ("lpq %%r6,%[bad]"
> > +                     : : [bad] "T" (*bad_aligned)
> > +                     : "%r6", "%r7"
> > +       );
> > +       return 0;
> > +}
> > +
> > +static int not_even(void)
> > +{
> > +       uint64_t quad[2] __attribute__((aligned(16))) = {0};
> > +
> > +       asm volatile (".insn    rxy,0xe3000000008f,%%r7,%[quad]" /* lpq %%r7,%[quad] */
> 
> Here you use .insn above you use lpq - why?

The assembler will complain about the odd register number, but that is
intentional.

  reply	other threads:[~2022-08-30 15:16 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-08-26 16:11 [kvm-unit-tests PATCH v6 0/2] Add specification exception tests Janis Schoetterl-Glausch
2022-08-26 16:11 ` [kvm-unit-tests PATCH v6 1/2] s390x: Add specification exception test Janis Schoetterl-Glausch
2022-08-30 14:34   ` Nico Boehr
2022-08-30 15:16     ` Janis Schoetterl-Glausch [this message]
2022-09-26  7:59   ` Janosch Frank
2022-08-26 16:11 ` [kvm-unit-tests PATCH v6 2/2] s390x: Test specification exceptions during transaction Janis Schoetterl-Glausch
2022-09-01 14:59   ` Nico Boehr
2022-09-01 16:08     ` Janis Schoetterl-Glausch
2022-09-05  7:10       ` Nico Boehr
2022-09-26 13:18   ` Janosch Frank

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=4bb9026dee15e94f4643a36c7171fa1c8714bad2.camel@linux.ibm.com \
    --to=scgl@linux.ibm.com \
    --cc=kvm@vger.kernel.org \
    --cc=linux-s390@vger.kernel.org \
    --cc=nrb@linux.ibm.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