From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mx0a-001b2d01.pphosted.com (mx0a-001b2d01.pphosted.com [148.163.156.1]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 895A91F7092; Mon, 21 Oct 2024 13:04:38 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=148.163.156.1 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729515880; cv=none; b=bt1n9CAPy0JKB2TEAEXwQIWk4mWGDV59ZdV6XvOIJ5UMMWaAjMgq1R8KtBtSn2VjYKWTGubT5SnWd/kKbmgPH0y734ddwSPzzgVY1tLuhXho9rByRteZxQqajRNnJ4sjpTFMyOA3t4LdMJk1YZQKVz3yTBXTCxV0J8LgVduafMk= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729515880; c=relaxed/simple; bh=kCehHTOSjnEQN/+N3r04sbwJEyeIPfKmJ3Z0WMpi2dc=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=c81R3P1MONxX5XyzWoBG7btK34WAK2Mw5KdyvNeFexN7CjY30vQ2sk01eKoTx6UudslMxLTmoMcSQiZpDsaVh8+qD4MQYiU4ogbdMaLvLEIo7aUhqgN+0h8rkYGbmYnw4Y2BOQdnZ269F1qTd5WJKXRQ5rm9eAp9WC2XE9p21MU= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.ibm.com; spf=pass smtp.mailfrom=linux.ibm.com; dkim=pass (2048-bit key) header.d=ibm.com header.i=@ibm.com header.b=TcBtuRo+; arc=none smtp.client-ip=148.163.156.1 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.ibm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.ibm.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=ibm.com header.i=@ibm.com header.b="TcBtuRo+" Received: from pps.filterd (m0360083.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 49L2KHP8032521; Mon, 21 Oct 2024 13:04:34 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=cc :content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to; s=pp1; bh=J3kC8U zU2rpgZ//C26h9nfmUXa0RAB1icaExjfE4Yu4=; b=TcBtuRo+s9fURAgcy1hbYH YSiv1x6TWEbq3R966TQycvfeQeumi2uewkZ5MbKCTg23e9L0th0IGeua+kNEabZL NbFVtqRbiHsgzTDERrL4yP0zIJGoVW9KQjIewrSkaTFojV7RREK4JnXd0Fbp+PsV wTAu7C4py56vvAr/9DtM8amP9zjtk6ArxWrwWSv3B5LzRx67WrKTL6ipc4GJa+l5 S7suutO9UYarekzwKhsvO6fL9oFMULTm80KFnEPbBAye/58cf//BnvTY4MrtcN5C GzhOdXtsyfyapXEhRmzI2o4QWP6rdJIYgmRst2UZgOkpvUnz9a0VG70vIU6dtuoQ == Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 42c5hm9ckt-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 21 Oct 2024 13:04:33 +0000 (GMT) Received: from m0360083.ppops.net (m0360083.ppops.net [127.0.0.1]) by pps.reinject (8.18.0.8/8.18.0.8) with ESMTP id 49LD4X3e029354; Mon, 21 Oct 2024 13:04:33 GMT Received: from ppma21.wdc07v.mail.ibm.com (5b.69.3da9.ip4.static.sl-reverse.com [169.61.105.91]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 42c5hm9ckm-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 21 Oct 2024 13:04:33 +0000 (GMT) Received: from pps.filterd (ppma21.wdc07v.mail.ibm.com [127.0.0.1]) by ppma21.wdc07v.mail.ibm.com (8.18.1.2/8.18.1.2) with ESMTP id 49LBomB3009296; Mon, 21 Oct 2024 13:04:31 GMT Received: from smtprelay05.fra02v.mail.ibm.com ([9.218.2.225]) by ppma21.wdc07v.mail.ibm.com (PPS) with ESMTPS id 42cr3mpefd-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 21 Oct 2024 13:04:31 +0000 Received: from smtpav01.fra02v.mail.ibm.com (smtpav01.fra02v.mail.ibm.com [10.20.54.100]) by smtprelay05.fra02v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 49LD4RAJ56754684 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 21 Oct 2024 13:04:27 GMT Received: from smtpav01.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 8F4F120043; Mon, 21 Oct 2024 13:04:27 +0000 (GMT) Received: from smtpav01.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 302CD20040; Mon, 21 Oct 2024 13:04:27 +0000 (GMT) Received: from [9.179.25.115] (unknown [9.179.25.115]) by smtpav01.fra02v.mail.ibm.com (Postfix) with ESMTP; Mon, 21 Oct 2024 13:04:27 +0000 (GMT) Message-ID: Date: Mon, 21 Oct 2024 15:04:26 +0200 Precedence: bulk X-Mailing-List: kvm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [kvm-unit-tests PATCH v4 4/6] s390x: Add library functions for exiting from snippet To: Nico Boehr , Claudio Imbrenda , Nina Schoetterl-Glausch , Thomas Huth Cc: David Hildenbrand , kvm@vger.kernel.org, Nicholas Piggin , linux-s390@vger.kernel.org References: <20241016180320.686132-1-nsg@linux.ibm.com> <20241016180320.686132-5-nsg@linux.ibm.com> <172924897145.324297.7466880604426455626@t14-nrb.local> <606b3c63-f4e1-449a-b3de-6fbb5e8211d7@linux.ibm.com> <172949890741.324297.5665746219783039207@t14-nrb.local> Content-Language: en-US From: Janosch Frank Autocrypt: addr=frankja@linux.ibm.com; keydata= xsFNBFubpD4BEADX0uhkRhkj2AVn7kI4IuPY3A8xKat0ihuPDXbynUC77mNox7yvK3X5QBO6 qLqYr+qrG3buymJJRD9xkp4mqgasHdB5WR9MhXWKH08EvtvAMkEJLnqxgbqf8td3pCQ2cEpv 15mH49iKSmlTcJ+PvJpGZcq/jE42u9/0YFHhozm8GfQdb9SOI/wBSsOqcXcLTUeAvbdqSBZe zuMRBivJQQI1esD9HuADmxdE7c4AeMlap9MvxvUtWk4ZJ/1Z3swMVCGzZb2Xg/9jZpLsyQzb lDbbTlEeyBACeED7DYLZI3d0SFKeJZ1SUyMmSOcr9zeSh4S4h4w8xgDDGmeDVygBQZa1HaoL Esb8Y4avOYIgYDhgkCh0nol7XQ5i/yKLtnNThubAcxNyryw1xSstnKlxPRoxtqTsxMAiSekk 0m3WJwvwd1s878HrQNK0orWd8BzzlSswzjNfQYLF466JOjHPWFOok9pzRs+ucrs6MUwDJj0S cITWU9Rxb04XyigY4XmZ8dywaxwi2ZVTEg+MD+sPmRrTw+5F+sU83cUstuymF3w1GmyofgsU Z+/ldjToHnq21MNa1wx0lCEipCCyE/8K9B9bg9pUwy5lfx7yORP3JuAUfCYb8DVSHWBPHKNj HTOLb2g2UT65AjZEQE95U2AY9iYm5usMqaWD39pAHfhC09/7NQARAQABzSVKYW5vc2NoIEZy YW5rIDxmcmFua2phQGxpbnV4LmlibS5jb20+wsF3BBMBCAAhBQJbm6Q+AhsjBQsJCAcCBhUI CQoLAgQWAgMBAh4BAheAAAoJEONU5rjiOLn4p9gQALjkdj5euJVI2nNT3/IAxAhQSmRhPEt0 AmnCYnuTcHRWP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Fs2/cmgD1bqBTNHHcTWwWtRTLgmnqJbVisMJuYJt4KNPqphTWsPY8SEtbufIlY HXOJ2lqUzOReTrie2u0qcSvGAbSfec9apTFl2Xko/ddqPcZMpKhBiXmY8tJzSPk3+G4tqur4 6TYAm5ouitJsgAR61Cu7s+PNuq/pTLDhK+6/Njmc94NGBcRA4qTuysEGE79vYWP2oIAU4Fv6 gqaWHZ4MEI2XTqH8wiwzPdCQPYsSE0fXWiYu7ObeErT6iLSTZGx4rQARAQABwsFfBBgBCAAJ BQJbm6Q+AhsMAAoJEONU5rjiOLn4DDEP/RuyckW65SZcPG4cMfNgWxZF8rVjeVl/9PBfy01K 8R0hajU40bWtXSMiby7j0/dMjz99jN6L+AJHJvrLz4qYRzn2Ys843W+RfXj62Zde4YNBE5SL jJweRCbMWKaJLj6499fctxTyeb9+AMLQS4yRSwHuAZLmAb5AyCW1gBcTWZb8ON5BmWnRqeGm IgC1EvCnHy++aBnHTn0m+zV89BhTLTUal35tcjUFwluBY39R2ux/HNlBO1GY3Z+WYXhBvq7q katThLjaQSmnOrMhzqYmdShP1leFTVbzXUUIYv/GbynO/YrL2gaQpaP1bEUEi8lUAfXJbEWG dnHFkciryi092E8/9j89DJg4mmZqOau7TtUxjRMlBcIliXkzSLUk+QvD4LK1kWievJse4mte FBdkWHfP4BH/+8DxapRcG1UAheSnSRQ5LiO50annOB7oXF+vgKIaie2TBfZxQNGAs3RQ+bga DchCqFm5adiSP5+OT4NjkKUeGpBe/aRyQSle/RropTgCi85pje/juYEn2P9UAgkfBJrOHvQ9 Z+2Sva8FRd61NJLkCJ4LFumRn9wQlX2icFbi8UDV3do0hXJRRYTWCxrHscMhkrFWLhYiPF4i phX7UNdOWBQ90qpHyAxHmDazdo27gEjfvsgYMdveKknEOTEb5phwxWgg7BcIDoJf9UMC In-Reply-To: <172949890741.324297.5665746219783039207@t14-nrb.local> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-TM-AS-GCONF: 00 X-Proofpoint-ORIG-GUID: 3ExxkJN8YOc7YIQA9BHrGOE2lkDaNVJu X-Proofpoint-GUID: cEAVECs-ZxX_GhcHhxlqQB4YI5dOzscl X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1051,Hydra:6.0.680,FMLib:17.12.62.30 definitions=2024-10-15_01,2024-10-11_01,2024-09-30_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 spamscore=0 clxscore=1015 phishscore=0 impostorscore=0 priorityscore=1501 lowpriorityscore=0 bulkscore=0 mlxscore=0 adultscore=0 mlxlogscore=999 suspectscore=0 malwarescore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2409260000 definitions=main-2410210090 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.