public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
From: Janosch Frank <frankja@linux.ibm.com>
To: Nina Schoetterl-Glausch <nsg@linux.ibm.com>,
	Nico Boehr <nrb@linux.ibm.com>,
	imbrenda@linux.ibm.com, thuth@redhat.com
Cc: kvm@vger.kernel.org, linux-s390@vger.kernel.org
Subject: Re: [kvm-unit-tests PATCH v1 4/4] s390x: add a test for SIE without MSO/MSL
Date: Thu, 6 Apr 2023 10:01:22 +0200	[thread overview]
Message-ID: <5770ea2b-2cf2-a57e-2003-fb043b0bea9c@linux.ibm.com> (raw)
In-Reply-To: <cfd83c1d7a74e969e6e3c922bbe5650f8e9adadd.camel@linux.ibm.com>

On 4/5/23 21:55, Nina Schoetterl-Glausch wrote:
> On Mon, 2023-03-27 at 10:21 +0200, Nico Boehr wrote:
>> Since we now have the ability to run guests without MSO/MSL, add a test
>> to make sure this doesn't break.
>>
>> Signed-off-by: Nico Boehr <nrb@linux.ibm.com>
>> ---

[...]

>> +static inline void force_exit_value(uint64_t val)
>> +{
>> +	asm volatile(
>> +		"	diag	%[val],0,0x9c\n"
>> +		: : [val] "d"(val)
>> +	);
>> +}
>> +
>> +__attribute__((section(".text"))) int main(void)
> 
> Why is the attribute necessary? I know all the snippets have it, but I don't see
> why it's necessary.
> @Janosch ?

"Historical growth" :)

If it doesn't work without it then we need to find a way to fix it.
If it does work without it then we should remove the attribute from all 
snippets.

But this issue is a low priority for me.

> 
>> +{
>> +	uint8_t *invalid_ptr;
>> +
>> +	memset(test_page, 0, sizeof(test_page));
>> +	/* tell the host the page's physical address (we're running DAT off) */
>> +	force_exit_value((uint64_t)test_page);
>> +
>> +	/* write some value to the page so the host can verify it */
>> +	for (size_t i = 0; i < TEST_PAGE_COUNT; i++)
>> +		test_page[i * PAGE_SIZE] = 42 + i;
>> +
>> +	/* indicate we've written all pages */
>> +	force_exit();
>> +
>> +	/* the first unmapped address */
>> +	invalid_ptr = (uint8_t *)(TOTAL_PAGE_COUNT * PAGE_SIZE);
> 
> Why not just use an address high enough you know it will not be mapped?
> -1 should do just fine.
> 
>> +	*invalid_ptr = 42;
>> +
>> +	/* indicate we've written the non-allowed page (should never get here) */
>> +	force_exit();
>> +
>> +	return 0;
>> +}
>> diff --git a/s390x/unittests.cfg b/s390x/unittests.cfg
>> index d97eb5e943c8..aab0e670f2d4 100644
>> --- a/s390x/unittests.cfg
>> +++ b/s390x/unittests.cfg
>> @@ -215,3 +215,6 @@ file = migration-skey.elf
>>   smp = 2
>>   groups = migration
>>   extra_params = -append '--parallel'
>> +
>> +[sie-dat]
>> +file = sie-dat.elf
> 


  reply	other threads:[~2023-04-06  8:01 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-03-27  8:21 [kvm-unit-tests PATCH v1 0/4] s390x: Add support for running guests without MSO/MSL Nico Boehr
2023-03-27  8:21 ` [kvm-unit-tests PATCH v1 1/4] s390x: sie: switch to home space mode before entering SIE Nico Boehr
2023-03-28 14:13   ` Janosch Frank
2023-03-29 12:50     ` Nico Boehr
2023-03-29 13:00       ` Claudio Imbrenda
2023-03-29 13:42         ` Janosch Frank
2023-03-29 14:58         ` Nico Boehr
2023-03-27  8:21 ` [kvm-unit-tests PATCH v1 2/4] s390x: lib: don't forward PSW when handling exception in SIE Nico Boehr
2023-03-27  8:21 ` [kvm-unit-tests PATCH v1 3/4] s390x: lib: sie: don't reenter SIE on pgm int Nico Boehr
2023-03-28 13:42   ` Janosch Frank
2023-03-28 14:16     ` Nico Boehr
2023-03-28 17:01   ` Claudio Imbrenda
2023-03-29 12:51     ` Nico Boehr
2023-03-27  8:21 ` [kvm-unit-tests PATCH v1 4/4] s390x: add a test for SIE without MSO/MSL Nico Boehr
2023-04-05 19:55   ` Nina Schoetterl-Glausch
2023-04-06  8:01     ` Janosch Frank [this message]
2023-04-13  9:43     ` Nico Boehr
2023-04-13 16:33       ` Nina Schoetterl-Glausch
2023-04-14 10:10         ` Nico Boehr
2023-04-14 10:24           ` Nina 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=5770ea2b-2cf2-a57e-2003-fb043b0bea9c@linux.ibm.com \
    --to=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