public inbox for linux-s390@vger.kernel.org
 help / color / mirror / Atom feed
From: Janosch Frank <frankja@linux.ibm.com>
To: Heiko Carstens <hca@linux.ibm.com>, Nico Boehr <nrb@linux.ibm.com>
Cc: kvm@vger.kernel.org, linux-s390@vger.kernel.org,
	imbrenda@linux.ibm.com, david@redhat.com, thuth@redhat.com
Subject: Re: [PATCH kvm-unit-tests 2/2] s390x: diag288: Improve readability
Date: Fri, 17 Dec 2021 15:15:01 +0100	[thread overview]
Message-ID: <d2658470-8ede-bda7-8857-c2d3334d59ed@linux.ibm.com> (raw)
In-Reply-To: <YbxvoacUvh8+2zQ/@osiris>

On 12/17/21 12:08, Heiko Carstens wrote:
> On Fri, Dec 17, 2021 at 11:31:37AM +0100, Nico Boehr wrote:
>> Use a more descriptive name instead of the magic number 424 (address of
>> restart new PSW in the lowcore).
>>
>> In addition, add a comment to make it more obvious what the ASM snippet
>> does.
>>
>> Signed-off-by: Nico Boehr <nrb@linux.ibm.com>
>> ---
>>   s390x/diag288.c | 7 +++++--
>>   1 file changed, 5 insertions(+), 2 deletions(-)
>>
>> diff --git a/s390x/diag288.c b/s390x/diag288.c
>> index da7b06c365bf..a2c263e38338 100644
>> --- a/s390x/diag288.c
>> +++ b/s390x/diag288.c
>> @@ -94,12 +94,15 @@ static void test_bite(void)
>>   	/* Arm watchdog */
>>   	lc->restart_new_psw.mask = extract_psw_mask() & ~PSW_MASK_EXT;
>>   	diag288(CODE_INIT, 15, ACTION_RESTART);
>> +	/* Wait for restart interruption */
>>   	asm volatile("		larl	0, 1f\n"
>> -		     "		stg	0, 424\n"
>> +		     "		stg	0, %[restart_new_psw]\n"
>>   		     "0:	nop\n"
>>   		     "		j	0b\n"
>>   		     "1:"
>> -		     : : : "0");
>> +		     :
>> +		     : [restart_new_psw] "T" (lc->restart_new_psw.addr)
> 
> Even though it was wrong and missing before: this is an output not an input
> parameter. Also, older compilers might fail if only the "T" constraint is
> given (see gcc commit 3e4be43f69da ("S/390: Memory constraint cleanup")).
> Which means: "=RT" would be correct. To be on the safe side, and to avoid
> that gcc optimizes any potential prior C code away, I'd recommend to use
> "+RT" in this case.

Thanks for clearing that up, those intricate details are quite hard to 
find/remember if you only write inline assembly every few months.

> 
> Also there is an ordering problem here: starting the time bomb before the
> restart psw has been setup is racy. It is unlikely that this fails, but
> still...
> 
> Correct would be to setup the restart psw, and then start the time
> bomb. This would also allow to shorten the runtime of this test case to
> 1 second, instead of the 15 seconds it is running now.

While you are correct, the minimum value of the timer is 15s.
Racing that will be quite hard.

@Nico but yes, while you're at it you could switch that around so I 
don't have to explain that a second time.

> 
> It was all like that before, I know. Just some comments ;)
> 


      reply	other threads:[~2021-12-17 14:15 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-12-17 10:31 [PATCH kvm-unit-tests 0/2] s390x: diag288: Improve readability Nico Boehr
2021-12-17 10:31 ` [PATCH kvm-unit-tests 1/2] s390x: diag288: Add missing clobber Nico Boehr
2021-12-17 13:47   ` Thomas Huth
2021-12-17 14:16     ` Janosch Frank
2021-12-17 14:23       ` Claudio Imbrenda
2021-12-17 14:24       ` Thomas Huth
2021-12-17 10:31 ` [PATCH kvm-unit-tests 2/2] s390x: diag288: Improve readability Nico Boehr
2021-12-17 11:08   ` Heiko Carstens
2021-12-17 14:15     ` Janosch Frank [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=d2658470-8ede-bda7-8857-c2d3334d59ed@linux.ibm.com \
    --to=frankja@linux.ibm.com \
    --cc=david@redhat.com \
    --cc=hca@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=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