Linux-S390 Archive mirror
 help / color / mirror / Atom feed
From: Heiko Carstens <hca@linux.ibm.com>
To: Nico Boehr <nrb@linux.ibm.com>
Cc: Janosch Frank <frankja@linux.ibm.com>,
	kvm@vger.kernel.org, linux-s390@vger.kernel.org,
	imbrenda@linux.ibm.com, thuth@redhat.com, david@redhat.com,
	nsg@linux.ibm.com
Subject: Re: [kvm-unit-tests RFC 2/2] lib: s390x: css: Name inline assembly arguments and clean them up
Date: Mon, 22 Apr 2024 12:57:20 +0200	[thread overview]
Message-ID: <20240422105720.31205-A-hca@linux.ibm.com> (raw)
In-Reply-To: <171377182433.14316.15188579220205837716@t14-nrb>

On Mon, Apr 22, 2024 at 09:43:44AM +0200, Nico Boehr wrote:
> Quoting Janosch Frank (2024-02-01 15:23:56)
> [...]
> > diff --git a/lib/s390x/css.h b/lib/s390x/css.h
> > index 504b3f14..e4311124 100644
> > --- a/lib/s390x/css.h
> > +++ b/lib/s390x/css.h
> [...]
> > @@ -167,11 +167,11 @@ static inline int msch(unsigned long schid, struct schib *addr)
> >         int cc;
> >  
> >         asm volatile(
> > -               "       msch    0(%3)\n"
> > -               "       ipm     %0\n"
> > -               "       srl     %0,28"
> > -               : "=d" (cc)
> > -               : "d" (reg1), "m" (*addr), "a" (addr)
> > +               "       msch    0(%[addr])\n"
> > +               "       ipm     %[cc]\n"
> > +               "       srl     %[cc],28"
> > +               : [cc] "=d" (cc)
> > +               : "d" (reg1), [addr] "a" (addr)
> 
> I think there was a reason why the "m"(*addr) was here. Either add it back
> or add a memory clobber.

It is there to tell the compiler that the memory contents at *addr are used
as input. Without that, and only the "a" contraint, the compiler is free to
discard any potential previous writes to *addr.

The best solution here would be to use the Q constraint (memory reference
with short displacement and without index register) for the second operand
address of msch. Or simply copy the current implementation from the kernel
(drivers/s390/cio/ioasm.c).

      reply	other threads:[~2024-04-22 10:57 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-02-01 14:23 [kvm-unit-tests RFC 0/2] lib: s390x: Inline asm cleanup Janosch Frank
2024-02-01 14:23 ` [kvm-unit-tests RFC 1/2] lib: s390x: sigp: Name inline assembly arguments Janosch Frank
2024-02-01 17:52   ` Claudio Imbrenda
2024-02-01 14:23 ` [kvm-unit-tests RFC 2/2] lib: s390x: css: Name inline assembly arguments and clean them up Janosch Frank
2024-04-22  7:43   ` Nico Boehr
2024-04-22 10:57     ` Heiko Carstens [this message]

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=20240422105720.31205-A-hca@linux.ibm.com \
    --to=hca@linux.ibm.com \
    --cc=david@redhat.com \
    --cc=frankja@linux.ibm.com \
    --cc=imbrenda@linux.ibm.com \
    --cc=kvm@vger.kernel.org \
    --cc=linux-s390@vger.kernel.org \
    --cc=nrb@linux.ibm.com \
    --cc=nsg@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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).