public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
From: Janosch Frank <frankja@linux.ibm.com>
To: Nico Boehr <nrb@linux.ibm.com>,
	Claudio Imbrenda <imbrenda@linux.ibm.com>,
	Nina Schoetterl-Glausch <nsg@linux.ibm.com>,
	Thomas Huth <thuth@redhat.com>
Cc: David Hildenbrand <david@redhat.com>,
	kvm@vger.kernel.org, Nicholas Piggin <npiggin@gmail.com>,
	linux-s390@vger.kernel.org
Subject: Re: [kvm-unit-tests PATCH v4 4/6] s390x: Add library functions for exiting from snippet
Date: Mon, 21 Oct 2024 15:04:26 +0200	[thread overview]
Message-ID: <f176ede8-1780-4fef-a4fb-a49ea0f0d429@linux.ibm.com> (raw)
In-Reply-To: <172949890741.324297.5665746219783039207@t14-nrb.local>

On 10/21/24 10:21 AM, Nico Boehr wrote:
> Quoting Janosch Frank (2024-10-18 14:53:34)
>> On 10/18/24 12:56 PM, Nico Boehr wrote:
>>> Quoting Janosch Frank (2024-10-18 10:02:37)
>>> [...]
>>>>> +static inline uint64_t snippet_get_force_exit_value(struct vm *vm)
>>>>> +{
>>>>> +     struct kvm_s390_sie_block *sblk = vm->sblk;
>>>>> +
>>>>> +     assert(snippet_is_force_exit_value(vm));
>>>>> +
>>>>> +     return vm->save_area.guest.grs[sblk_ip_as_diag(sblk).r_1];
>>>>> +}
>>>>
>>>> The cpu address parameter for 9C is 16 bit.
>>>> While we could make it 64 bit for snippets I don't see a reason to do
>>>> so. The 16 bits are enough to indicate something to the host which can
>>>> then go and fetch memory for more data.
>>>
>>> Mh, how exactly would you "fetch memory"? That requires knowledge on where
>>> things are in guest memory which can be painful to figure out from the
>>> host.
>>>
>>> I've found it useful to be able to pass a pointer from guest to host. Maybe
>>> a diag500 is the better option? gr2 contains the cookie which is a 64-bit
>>> value - see Linux' Documentation/virt/kvm/s390/s390-diag.rst.
>>>
>>> P.S. Did I miss the part in the docs where the 16-bit restriction of 9c is
>>> documented or is it missing?
>>
>> For ASM snippets addresses 0x2000 to 0x4000 are a free area.
>> For C snippets that area is the stack.
>> The 16 bits should be good enough to point into that area.
> 
> Actually, it's currently just enough to point into the stack (snippet stack
> is 64K)... also requires additional fiddling in the host to figure out the
> complete address. Probably also in the guest, if you do it r15-relative
> (can't think of a different solution right now).

I think you looked into the wrong lds; the unit tests have 64k, the 
snippets don't.
The snippet stack is from 0x4000 to 0x2000 whereas the unit test stack 
is located behind the binary.

I have no recollection about why I placed it there, though the mail 
archive may or may not have answers.


> 
>> If the snippet requires a lot of memory then you can use constant
>> addresses which are way over the snippet binary or just store a 64 bit
>> address in a "free" lowcore location.
> 
> Would you prefer any of those over the diag500 solution?

I think the diag500 is a bit cleaner and more future proof.


  reply	other threads:[~2024-10-21 13:04 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-10-16 18:03 [kvm-unit-tests PATCH v4 0/6] s390x: STFLE nested interpretation Nina Schoetterl-Glausch
2024-10-16 18:03 ` [kvm-unit-tests PATCH v4 1/6] s390x: lib: Remove double include Nina Schoetterl-Glausch
2024-10-16 18:03 ` [kvm-unit-tests PATCH v4 2/6] s390x: Add sie_is_pv Nina Schoetterl-Glausch
2024-10-16 18:03 ` [kvm-unit-tests PATCH v4 3/6] s390x: Add function for checking diagnose intercepts Nina Schoetterl-Glausch
2024-10-18  7:50   ` Janosch Frank
2024-10-16 18:03 ` [kvm-unit-tests PATCH v4 4/6] s390x: Add library functions for exiting from snippet Nina Schoetterl-Glausch
2024-10-18  8:02   ` Janosch Frank
2024-10-18 10:56     ` Nico Boehr
2024-10-18 12:53       ` Janosch Frank
2024-10-21  8:21         ` Nico Boehr
2024-10-21 13:04           ` Janosch Frank [this message]
2024-12-10 10:20   ` Nico Boehr
2024-12-12 15:33     ` Nina Schoetterl-Glausch
2025-01-08  8:27       ` Nico Boehr
2024-10-16 18:03 ` [kvm-unit-tests PATCH v4 5/6] s390x: Use library functions for snippet exit Nina Schoetterl-Glausch
2024-10-18  8:03   ` Janosch Frank
2024-10-16 18:03 ` [kvm-unit-tests PATCH v4 6/6] s390x: Add test for STFLE interpretive execution (format-0) 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=f176ede8-1780-4fef-a4fb-a49ea0f0d429@linux.ibm.com \
    --to=frankja@linux.ibm.com \
    --cc=david@redhat.com \
    --cc=imbrenda@linux.ibm.com \
    --cc=kvm@vger.kernel.org \
    --cc=linux-s390@vger.kernel.org \
    --cc=npiggin@gmail.com \
    --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