kvm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Janosch Frank <frankja@linux.ibm.com>
To: Thomas Huth <thuth@redhat.com>,
	kvm@vger.kernel.org, Paolo Bonzini <pbonzini@redhat.com>
Cc: Laurent Vivier <lvivier@redhat.com>,
	Cornelia Huck <cohuck@redhat.com>,
	Claudio Imbrenda <imbrenda@linux.ibm.com>,
	David Hildenbrand <david@redhat.com>
Subject: Re: [kvm-unit-tests PATCH 3/4] lib/s390x: Fix the epsw inline assembly
Date: Wed, 23 Jun 2021 09:33:58 +0200	[thread overview]
Message-ID: <559e9999-3f52-5843-de28-481d90b41da5@linux.ibm.com> (raw)
In-Reply-To: <20210622135517.234801-4-thuth@redhat.com>

On 6/22/21 3:55 PM, Thomas Huth wrote:
> According to the Principles of Operation, the epsw instruction
> does not touch the second register if it is r0. With GCC we were
> lucky so far that it never tried to use r0 here, but when compiling
> the kvm-unit-tests with Clang, this indeed happens and leads to
> very weird crashes. Thus let's make sure to never use r0 for the
> second operand of the epsw instruction.
> 
> Signed-off-by: Thomas Huth <thuth@redhat.com>
> ---
>  lib/s390x/asm/arch_def.h | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/lib/s390x/asm/arch_def.h b/lib/s390x/asm/arch_def.h
> index 3aa5da9..15cf7d4 100644
> --- a/lib/s390x/asm/arch_def.h
> +++ b/lib/s390x/asm/arch_def.h
> @@ -265,7 +265,7 @@ static inline uint64_t extract_psw_mask(void)
>  
>  	asm volatile(
>  		"	epsw	%0,%1\n"
> -		: "+r" (mask_upper), "+r" (mask_lower) : : );
> +		: "=r" (mask_upper), "=a" (mask_lower));
>  
>  	return (uint64_t) mask_upper << 32 | mask_lower;
>  }
> 

With Claudio's nits fixed:
Acked-by: Janosch Frank <frankja@linux.ibm.com>

  parent reply	other threads:[~2021-06-23  7:34 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-06-22 13:55 [kvm-unit-tests PATCH 0/4] Test compiling with Clang in the Travis-CI Thomas Huth
2021-06-22 13:55 ` [kvm-unit-tests PATCH 1/4] configure: Add the possibility to specify additional cflags Thomas Huth
2021-06-22 13:55 ` [kvm-unit-tests PATCH 2/4] powerpc: Probe whether the compiler understands -mabi=no-altivec Thomas Huth
2021-06-22 13:55 ` [kvm-unit-tests PATCH 3/4] lib/s390x: Fix the epsw inline assembly Thomas Huth
2021-06-22 14:12   ` Claudio Imbrenda
2021-06-22 16:40     ` Thomas Huth
2021-06-23  7:33   ` Janosch Frank [this message]
2021-06-22 13:55 ` [kvm-unit-tests PATCH 4/4] Test compilation with Clang on aarch64, ppc64le and s390x in Travis-CI Thomas Huth
2021-06-22 16:25 ` [kvm-unit-tests PATCH 0/4] Test compiling with Clang in the Travis-CI 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=559e9999-3f52-5843-de28-481d90b41da5@linux.ibm.com \
    --to=frankja@linux.ibm.com \
    --cc=cohuck@redhat.com \
    --cc=david@redhat.com \
    --cc=imbrenda@linux.ibm.com \
    --cc=kvm@vger.kernel.org \
    --cc=lvivier@redhat.com \
    --cc=pbonzini@redhat.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 NNTP newsgroup(s).