From patchwork Fri Oct 25 14:14:46 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Hildenbrand X-Patchwork-Id: 13850763 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 33380D0C616 for ; Fri, 25 Oct 2024 14:15:21 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id C309D6B0095; Fri, 25 Oct 2024 10:15:20 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id BBCCB6B0096; Fri, 25 Oct 2024 10:15:20 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id A5DF76B0098; Fri, 25 Oct 2024 10:15:20 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0013.hostedemail.com [216.40.44.13]) by kanga.kvack.org (Postfix) with ESMTP id 3DF7E6B0095 for ; Fri, 25 Oct 2024 10:15:20 -0400 (EDT) Received: from smtpin09.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay01.hostedemail.com (Postfix) with ESMTP id 472721C6800 for ; Fri, 25 Oct 2024 14:14:57 +0000 (UTC) X-FDA: 82712320908.09.7831FD4 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by imf18.hostedemail.com (Postfix) with ESMTP id 477581C0018 for ; Fri, 25 Oct 2024 14:15:09 +0000 (UTC) Authentication-Results: imf18.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=Ji8SCkuP; spf=pass (imf18.hostedemail.com: domain of david@redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=david@redhat.com; dmarc=pass (policy=none) header.from=redhat.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1729865563; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=c02jmCltsV6yISoJOqxBYZsRrdNBar2VI+HnnpDo3Tk=; b=wYnabtKyD0hdbOLJPvrLg9R2IHqR3p4k2kg4YOclMKmXya+JKhqGa5IX/1q1xGebt+zHKh Pevcm7eU8naxN6nJfGZA5xSJHbzzYB8DI2Q4KfOSVWcgezAjYfUHwX9JoBhVQWlfqX3BYe dNG6psrucHNkLfpbxIptS39J7n9RNlQ= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1729865563; a=rsa-sha256; cv=none; b=gOkoxm8ZIv5ng4Rc8NDCGSfwP7p81x0TGybKaj3ZMW0dQ0Kdwn+dLqD7MpShA+PKlBtAnP zzWksfRW/IjoIbjnjcXJ5OtZggL9cJp1FONLAU3b8JKOqi4sf8BQYCCcvHQCcjtLtzz1+i U9wM4MYa3S3T7+89dwEUIj151he2zTI= ARC-Authentication-Results: i=1; imf18.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=Ji8SCkuP; spf=pass (imf18.hostedemail.com: domain of david@redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=david@redhat.com; dmarc=pass (policy=none) header.from=redhat.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1729865717; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=c02jmCltsV6yISoJOqxBYZsRrdNBar2VI+HnnpDo3Tk=; b=Ji8SCkuPQz/v9qfGaUEDfTrnYrE8j0PN1REG3B5XiKBvtsL9WuH2RQ2FIEnzSUTh2egMPH CWwsKRrfE0iYzMW8coJA2M+8I3zF9Hh/iUKyurCfLbFpQMjieRnOgtCj62ikezKWRMytuL 22TXNl/E0PwtpbwBjiYmqNtYcHgqWjc= Received: from mx-prod-mc-03.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-314-tzlcknbTOoqc6cAii0r6cA-1; Fri, 25 Oct 2024 10:15:13 -0400 X-MC-Unique: tzlcknbTOoqc6cAii0r6cA-1 Received: from mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.12]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-03.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id B750C1955D47; Fri, 25 Oct 2024 14:15:10 +0000 (UTC) Received: from t14s.redhat.com (unknown [10.22.65.27]) by mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 44BD01955F3B; Fri, 25 Oct 2024 14:15:03 +0000 (UTC) From: David Hildenbrand To: linux-kernel@vger.kernel.org Cc: linux-mm@kvack.org, linux-s390@vger.kernel.org, virtualization@lists.linux.dev, linux-doc@vger.kernel.org, kvm@vger.kernel.org, David Hildenbrand , Heiko Carstens , Vasily Gorbik , Alexander Gordeev , Christian Borntraeger , Sven Schnelle , Thomas Huth , Cornelia Huck , Janosch Frank , Claudio Imbrenda , "Michael S. Tsirkin" , Jason Wang , Xuan Zhuo , =?utf-8?q?Eugenio_P=C3=A9rez?= , Eric Farman , Andrew Morton , Jonathan Corbet Subject: [PATCH v3 1/7] Documentation: s390-diag.rst: make diag500 a generic KVM hypercall Date: Fri, 25 Oct 2024 16:14:46 +0200 Message-ID: <20241025141453.1210600-2-david@redhat.com> In-Reply-To: <20241025141453.1210600-1-david@redhat.com> References: <20241025141453.1210600-1-david@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.0 on 10.30.177.12 X-Rspam-User: X-Rspamd-Server: rspam04 X-Rspamd-Queue-Id: 477581C0018 X-Stat-Signature: ht873syu3k4bub37oosbe3g9cff8o98z X-HE-Tag: 1729865709-247515 X-HE-Meta: U2FsdGVkX1/sX50fdlh6Rk8Q+85KlLCnVdhIkB1fLI74doPDsJ7zE1DJczwFi0CrHb1l1pTc6V0yGVAi6hbuso4BPE8sGSsl9P0hbULsfqza4ToWKwSVEfBG6thnDzl7Qd0/C4Y3rk2yzdLpdHet1nGW7cyYq9UvPcXZ1DbWxW2KI7Nx5J0cVWExFQI/dR6P1ERFw4+ec41O2/PpB8QPQgIN05DabxU7G+3/ud09A4jcL9xzPZNnu3eW2pYmAtq+lpZT86g17lYRY7bTxNTO7wVaXK6wbfO7aXHVPnXu+begUKV3YB4/wH7sMBO67lbCehGt1UC3LjOA+WWlbM/sMDW+BMWKPTYFAbk+ro1ypL8pNBzcRnx7WCbuJbzKvysyWB/Y6ANh8p/cEGsgIo5vSOJyDIXSr9C8d+R2/BJyq2Fukbdxr154WPjx0Vk1fyWVhe1gkyEfj8YuO7hHxZXaCCYCVsxYh58AzsFlHa/s6ewutP8wG2Avf0AaPobyeYbD6vzwb+amPTC5K7okN+Ge7yQfmzRVhjTPy/kmfp59zvnEAdj0Gaf/8NO1NBlUZpTjUghxoVEHq0yVG5GKLYppfE8CmNkbuHq9b7o7itFRB783WRd4wYgF56+DdjXiyyZfdiUF6SE6T+r0U2ZQ+yPFRUcxEzOX6MqABzR6eQZeWIZcwmMIPcAYsdM+tULw9ft6+qh08mFlcSAs/QaRpI/VLjgSv+6209xZ3iBzRJhVOzsOTSxdqqpUsGp+jDtjXwaq9DGv1yuOgNALbYEMtCIRQ8BCFiGayb39VrwibSqueF/mBwI9C+mQGnAGRRvkvcwpSldUPV0bf+7+fWHRe0u9MQSTSeUWSQMSH/10ToIChb/KEMHjIEZSAj+zmaikohSDNpqJO+PmIBCDWVbjoa1gKEB2xB3s1BSMpizum+rlLMdHjjygfjXKnmTKshj/y+xAz5trkMtYKA9zEt842Fa HW+PZ843 pR648fVzp9l52GvdIaz3RIhb1pQk1tCUzAuIOJ2TogyBRxPJJnBnKkqTWQtVw+4v+EGfHPz3nAtKaAWmYm9Nk8/3Ixv90YokYjcG69/+CEZu45BdvLAIXBm24xx1a1Ja7Fh6NvSR1v1tDa+e33OYEWqweCJJaMGkftSCD2eLIHSO93lv10LCVdXpo/gD4JPgypnykd9Qx23MQ1Gt79IBkwzdUTp7phsVCi57Kp/exLYtV4rTrpYCZYszPENjIFDDwpWar56Hz5wVocxGGe015LFaxf5cjnEyavGGx32UeM/v7Q9S+pHpeF++TCoBafc6Tf/CM/ohLIq8+NhM= X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: Let's make it a generic KVM hypercall, allowing other subfunctions to be more independent of virtio. While at it, document that unsupported/unimplemented subfunctions result in a SPECIFICATION exception. This is a preparation for documenting a new hypercall. Signed-off-by: David Hildenbrand --- Documentation/virt/kvm/s390/s390-diag.rst | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/Documentation/virt/kvm/s390/s390-diag.rst b/Documentation/virt/kvm/s390/s390-diag.rst index ca85f030eb0b..48a326d41cc0 100644 --- a/Documentation/virt/kvm/s390/s390-diag.rst +++ b/Documentation/virt/kvm/s390/s390-diag.rst @@ -35,20 +35,24 @@ DIAGNOSE function codes not specific to KVM, please refer to the documentation for the s390 hypervisors defining them. -DIAGNOSE function code 'X'500' - KVM virtio functions ------------------------------------------------------ +DIAGNOSE function code 'X'500' - KVM functions +---------------------------------------------- -If the function code specifies 0x500, various virtio-related functions -are performed. +If the function code specifies 0x500, various KVM-specific functions +are performed, including virtio functions. -General register 1 contains the virtio subfunction code. Supported -virtio subfunctions depend on KVM's userspace. Generally, userspace -provides either s390-virtio (subcodes 0-2) or virtio-ccw (subcode 3). +General register 1 contains the subfunction code. Supported subfunctions +depend on KVM's userspace. Regarding virtio subfunctions, generally +userspace provides either s390-virtio (subcodes 0-2) or virtio-ccw +(subcode 3). Upon completion of the DIAGNOSE instruction, general register 2 contains the function's return code, which is either a return code or a subcode specific value. +If the specified subfunction is not supported, a SPECIFICATION exception +will be triggered. + Subcode 0 - s390-virtio notification and early console printk Handled by userspace. From patchwork Fri Oct 25 14:14:47 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Hildenbrand X-Patchwork-Id: 13850764 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id E4466D0C616 for ; Fri, 25 Oct 2024 14:15:31 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 6B50B6B0098; Fri, 25 Oct 2024 10:15:31 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 665AE6B0099; Fri, 25 Oct 2024 10:15:31 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 52D5B6B009B; Fri, 25 Oct 2024 10:15:31 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0013.hostedemail.com [216.40.44.13]) by kanga.kvack.org (Postfix) with ESMTP id 333BC6B0098 for ; Fri, 25 Oct 2024 10:15:31 -0400 (EDT) Received: from smtpin01.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay06.hostedemail.com (Postfix) with ESMTP id 1DECEAC574 for ; Fri, 25 Oct 2024 14:14:52 +0000 (UTC) X-FDA: 82712321496.01.63F99F0 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by imf17.hostedemail.com (Postfix) with ESMTP id E499540011 for ; Fri, 25 Oct 2024 14:15:13 +0000 (UTC) Authentication-Results: imf17.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=gEsaMdXn; dmarc=pass (policy=none) header.from=redhat.com; spf=pass (imf17.hostedemail.com: domain of david@redhat.com designates 170.10.129.124 as permitted sender) smtp.mailfrom=david@redhat.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1729865603; a=rsa-sha256; cv=none; b=I0pkcAxqP49x+6OkWoEUHwXIm3s5bwua54PNlv/yB7FEG2nUwZ9jRE4xm8sCLiYAgbxn/y bVzecoLmpobgOj4X7q9NjFE3AME2YFZZ1dmVBtL9kvw51hZ4mgD1bOkCe7Sn/ZGGztB9ih uEyf56uuyxt1zDFdocyxy+0YLhXQ4gE= ARC-Authentication-Results: i=1; imf17.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=gEsaMdXn; dmarc=pass (policy=none) header.from=redhat.com; spf=pass (imf17.hostedemail.com: domain of david@redhat.com designates 170.10.129.124 as permitted sender) smtp.mailfrom=david@redhat.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1729865603; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=ZrDkTfigLaNGazXPM44aNCnZCzJMkV9GdJkwS2fHAmE=; b=rj6iLkTOd1ZvucT/DUx6TtLvpojDm+VvekPorL+r7OX/H9FTiJoOwQ1baLy/TG2VkdHtuN Jg21KlSd0+wyu2kU6IbKztAUAKCwXCtPvY26jHqmdPu9NMacjrsJ7H9B7drWncGxTZU0K3 Ot8Sm7WPya2NLlQ1hXMUmzy3stCLTbs= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1729865728; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=ZrDkTfigLaNGazXPM44aNCnZCzJMkV9GdJkwS2fHAmE=; b=gEsaMdXnLi8lveCQ6r2EnMx0GkFLlhxfnOgw7BprXHDmoCXhRmRPrSBGFUlDnjZXuRIL8Q iWqot5d92f648KgeYY8Edu4+mGbsHn2I/L1EGPnYs1k0EZlX1QFa/nG8lsZhWOXh1K4KpH 2ymO55StYVyv6Nk+j6qEmXhXvzubWVA= Received: from mx-prod-mc-03.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-493-5G9aywhZMEOYyzT-kYfMXQ-1; Fri, 25 Oct 2024 10:15:24 -0400 X-MC-Unique: 5G9aywhZMEOYyzT-kYfMXQ-1 Received: from mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.12]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-03.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 4594C1955E85; Fri, 25 Oct 2024 14:15:18 +0000 (UTC) Received: from t14s.redhat.com (unknown [10.22.65.27]) by mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 25C4219560A2; Fri, 25 Oct 2024 14:15:10 +0000 (UTC) From: David Hildenbrand To: linux-kernel@vger.kernel.org Cc: linux-mm@kvack.org, linux-s390@vger.kernel.org, virtualization@lists.linux.dev, linux-doc@vger.kernel.org, kvm@vger.kernel.org, David Hildenbrand , Heiko Carstens , Vasily Gorbik , Alexander Gordeev , Christian Borntraeger , Sven Schnelle , Thomas Huth , Cornelia Huck , Janosch Frank , Claudio Imbrenda , "Michael S. Tsirkin" , Jason Wang , Xuan Zhuo , =?utf-8?q?Eugenio_P=C3=A9rez?= , Eric Farman , Andrew Morton , Jonathan Corbet Subject: [PATCH v3 2/7] Documentation: s390-diag.rst: document diag500(STORAGE LIMIT) subfunction Date: Fri, 25 Oct 2024 16:14:47 +0200 Message-ID: <20241025141453.1210600-3-david@redhat.com> In-Reply-To: <20241025141453.1210600-1-david@redhat.com> References: <20241025141453.1210600-1-david@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.0 on 10.30.177.12 X-Rspamd-Server: rspam12 X-Rspamd-Queue-Id: E499540011 X-Stat-Signature: byehogmupt6i36tp6y6fwpzsqakxz18m X-Rspam-User: X-HE-Tag: 1729865713-603476 X-HE-Meta: U2FsdGVkX1+ezOlZsdpbEywbtai8B9HxO5rvj852IOuslhBoHDfml8Zs1x3ZfPI1iVxoUn2Cr/0MTz6OXfgXt4PnuctPD90+hOWfaaRnibZn74/f746lI67XGun+HQRdGy8QH9ZZJm2SM3Gb4rVXldVvRzqTxiHVvIQyBBg7wQmJiFb23MGYqIcGc9bun2DAO7+4VGecPSfklRBTVxohX9SrvWnpixh7MMTLWKCt1ZizSEHHCjCEpBjeegVLs27J+7A08XWFfNiFK9667hEofHX0O81/93sJK9Po5rfXOKifGfx7Ry37vqZGUvbF9zpAiE7gJHUwWse3BHBr2KLcHyBecU+/ENGIZlUUj9TXkcfQNzwxIQhSTBGMYyEavjQt9NgyF0UFrrqOKHUim19oeseZig0KE0RDl88bnCNtKw6O8wCmDpkAulLUrlWlUF6+fBLmkUCk7JMnLgp2qK2ZWD7P9I0K50YqxFtm5/jwmSfVSmDMBsyUtAC3Jn4gPm7NN3cy6I7kOhvWRMKvDWW0dJmPmK4+ZfqbUiLQXUoBcEGakwReceZ4OL2z5VcdM1HnRAfjniY6ud9Bw2sl8ORZblbvdCCGJnBIBHLLD7z5zyoXBGk9m7vPvbUC7GozRoPQE3EyPFB5iHqb4xlj/gQAEk/1WhV+hsHN2c4c9UFA9gbSnt0rHYS6F9Q8fLGmxzCq25s2WGJhv8tuXNG2WOCTJ2K519slwSv0ZP/QrhEySr1OqX6UuFNMdPQx1JjKxdLm27gAVw6acDI+kzY1VGWnls5+N8Zl/fbXicHPsQCL5nxe18/w9eTU+JxBAIRVKT6+MxmdgZy6sHwpukELnhE/VLfiRdzJy/jPlnifVUqyn2KXb90lOpAVvy/FMeeDvuN9JRsPUiCbO8HVnQx+LUIZHDZB2NpP+XfsEYe1tKvo87QR76qN7F/VfNdWbVm31Gs1pFg5iP3rsa2vYwYOiVc uVUiJvsk w1YKP2mpWZJQtkumD10WhEMfPFEqELpgVjPGltUBh1cVeYDtbJsZer9FEFzdgs62jukULG3XtMwIyWhKmhOzDHx+6X//rgFZ3i+QVkNFP3hkOnXUv1D6MM/hjAjApI+ymIfSx7++x+MtLMGhFaB+jw+Qhq/mVDpBlE+hhgnnJO7X4tALiXNIolf2nJzl2VJf/+h0T7ihvNvxxBv2zc30fEvCk0vLSZEyBPNDHJPHpbwswmWOjSsWgGIFrhnZ+7W3SnN9oWqoRgjoFbisZEt5OmkyApkAw6HWR5cZHm/wy3umPwDUwtu6pwSQwGEtJfRCkee/Q/RMihKp2dxo= X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: Let's document our new diag500 subfunction that can be implemented by userspace. Signed-off-by: David Hildenbrand --- Documentation/virt/kvm/s390/s390-diag.rst | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/Documentation/virt/kvm/s390/s390-diag.rst b/Documentation/virt/kvm/s390/s390-diag.rst index 48a326d41cc0..3e4f9e3bef81 100644 --- a/Documentation/virt/kvm/s390/s390-diag.rst +++ b/Documentation/virt/kvm/s390/s390-diag.rst @@ -80,6 +80,23 @@ Subcode 3 - virtio-ccw notification See also the virtio standard for a discussion of this hypercall. +Subcode 4 - storage-limit + Handled by userspace. + + After completion of the DIAGNOSE call, general register 2 will + contain the storage limit: the maximum physical address that might be + used for storage throughout the lifetime of the VM. + + The storage limit does not indicate currently usable storage, it may + include holes, standby storage and areas reserved for other means, such + as memory hotplug or virtio-mem devices. Other interfaces for detecting + actually usable storage, such as SCLP, must be used in conjunction with + this subfunction. + + Note that the storage limit can be larger, but never smaller than the + maximum storage address indicated by SCLP via the "maximum storage + increment" and the "increment size". + DIAGNOSE function code 'X'501 - KVM breakpoint ---------------------------------------------- From patchwork Fri Oct 25 14:14:48 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Hildenbrand X-Patchwork-Id: 13850765 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id D39AAD0C616 for ; Fri, 25 Oct 2024 14:15:39 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 72CB76B009B; Fri, 25 Oct 2024 10:15:39 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 6DAF96B009C; Fri, 25 Oct 2024 10:15:39 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 5A2FD6B009D; Fri, 25 Oct 2024 10:15:39 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0012.hostedemail.com [216.40.44.12]) by kanga.kvack.org (Postfix) with ESMTP id 3ED4A6B009B for ; Fri, 25 Oct 2024 10:15:39 -0400 (EDT) Received: from smtpin18.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay10.hostedemail.com (Postfix) with ESMTP id AE027C0BA9 for ; Fri, 25 Oct 2024 14:15:17 +0000 (UTC) X-FDA: 82712322378.18.6E8791A Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by imf22.hostedemail.com (Postfix) with ESMTP id A5C83C002A for ; Fri, 25 Oct 2024 14:15:12 +0000 (UTC) Authentication-Results: imf22.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=Ds8kipDp; dmarc=pass (policy=none) header.from=redhat.com; spf=pass (imf22.hostedemail.com: domain of david@redhat.com designates 170.10.129.124 as permitted sender) smtp.mailfrom=david@redhat.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1729865566; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=P/OWBKgNxsqut2xHOcIgEvQRSrYiossJkI+amYxch/4=; b=1jZPFQE1R+CG8lZlIFrWxA8mkQY7YCVOhCmxea8mrRQK9pr76sZwxRDGjLngcT+H1NKoxS tQqlCSp+GcELoB/N7JCBYNO+9o+mv+LBuJA+8/jAlGeU6XuPeWpuewguo26VwimQGQoEI/ SwIATY7NAQjTUmGq3ThSi+ijqigGL9g= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1729865566; a=rsa-sha256; cv=none; b=js8tJgJ5DDfMOC14cIQFZKo+f6ADSVoOmp5o7AxkntdqnQZtGpeaGrKZF/+f+i+E2ZZu1n sYcQKM29tQ8sslVbNxj/fn7GNTYhz7VPj5bKFmPM7DF0YkkXsB7s+meFcAFmOBPXYaWbYm YC5uOe2xtW0GGQFq1hdx90yzghmkRa4= ARC-Authentication-Results: i=1; imf22.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=Ds8kipDp; dmarc=pass (policy=none) header.from=redhat.com; spf=pass (imf22.hostedemail.com: domain of david@redhat.com designates 170.10.129.124 as permitted sender) smtp.mailfrom=david@redhat.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1729865736; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=P/OWBKgNxsqut2xHOcIgEvQRSrYiossJkI+amYxch/4=; b=Ds8kipDpbfjYEWY5jY1RGOxLt41HdxtmJVjhSfvE4mDzE+Qe9ucUteSSRWSSryKP1GNDMZ fvmfSTLPHypbeUn0NEfQa/DqP0LDmcjAVn8gOXMq32DJFcZOe8D9PBKOjofNjF7jRcLn97 4hQU1oDwilVbIsJACPCoqDh3xuk9pxo= Received: from mx-prod-mc-01.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-321-u59Cgv1VPbS7mn3iPCL1Vg-1; Fri, 25 Oct 2024 10:15:33 -0400 X-MC-Unique: u59Cgv1VPbS7mn3iPCL1Vg-1 Received: from mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.12]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 4636A1955F3B; Fri, 25 Oct 2024 14:15:26 +0000 (UTC) Received: from t14s.redhat.com (unknown [10.22.65.27]) by mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id C14B519560A2; Fri, 25 Oct 2024 14:15:18 +0000 (UTC) From: David Hildenbrand To: linux-kernel@vger.kernel.org Cc: linux-mm@kvack.org, linux-s390@vger.kernel.org, virtualization@lists.linux.dev, linux-doc@vger.kernel.org, kvm@vger.kernel.org, David Hildenbrand , Heiko Carstens , Vasily Gorbik , Alexander Gordeev , Christian Borntraeger , Sven Schnelle , Thomas Huth , Cornelia Huck , Janosch Frank , Claudio Imbrenda , "Michael S. Tsirkin" , Jason Wang , Xuan Zhuo , =?utf-8?q?Eugenio_P=C3=A9rez?= , Eric Farman , Andrew Morton , Jonathan Corbet , Mario Casquero Subject: [PATCH v3 3/7] s390/physmem_info: query diag500(STORAGE LIMIT) to support QEMU/KVM memory devices Date: Fri, 25 Oct 2024 16:14:48 +0200 Message-ID: <20241025141453.1210600-4-david@redhat.com> In-Reply-To: <20241025141453.1210600-1-david@redhat.com> References: <20241025141453.1210600-1-david@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.0 on 10.30.177.12 X-Rspamd-Server: rspam07 X-Rspamd-Queue-Id: A5C83C002A X-Stat-Signature: r3kc7fuqcr59xojw97frhmajdcsp7r38 X-Rspam-User: X-HE-Tag: 1729865712-688075 X-HE-Meta: U2FsdGVkX18wIdpbUFrwwiy+aODYiu+RsIB4cob5G9sbl6u7oeV/FHOkmonW6CAI8/7iT/tKvUwR8CJuZ7I1tyCbTaYu1J6xRv+90vbveDlft3Fwe4+gVemIqCj5AB0mQsqmjFKrnPSgnI3neZIK1ZhT4XTs3d2rsIXZOYInPw6hFXdg8e6XATPHVvV0axlzkNgtfF1DlnGDUZCSQ94rEA6FM5THJpLUEiTWDDvajwtVLNSjCL4FTnwoSh8jPqKe9WUp4JnCUSr4sK5d+q3aH93scn7Bd0NzjE8JI8RiIh/4bZhoeg/uqA05j2pr8ya2Yb6rR0aSErxhvxS/10Df7rFG83zPisWEsG9snY4OW8PT8MJul0zjLXSXv6oBTylsH3x+U9pYdaSTT9WVP2EuVY5UsgVXdLKbJhGAHP995k+DI6ZbhkTTJF0oNFdDwqQrPZLXwajW4EvecImju+7DesJIZ5TCt099yMh9R5t5Pam5Nz5WxQOcULgBb5e/U5qoVmgtCJT4BbkLUlXsNFH9wmdca6gV7JbE95JxRrgXsJE5uLIrSD9bTya2DWoz0STwextl9E0fahjUhfgRaXDMxW1kZicqGW9n5zXSSnyu8fRYXNSWDfhn1lUFPFs9IOdwCf73KJ9/1nKGGDd6L+8VtrioZFt01q8OJH+UMTe7zg/QN7eQz7vZgEiu1JkKK1dBVq5rqUU+KYmWeaXGs/J8nyIRxLqQoPmsxSBMrRl+WnINORDwGidKL/1XxNcB2HplbPwMomOM9sXr1Rb56GQDtglaZ2q/VikS9P5+byGU7fvQUoW5Rs60irHYRHFEFLtWcvOItNqCWxs4mCMdfDuAEu1y0N23DdA5rO2i949xiWCn1QafPifjQnYcF8xeTNPtlJwcYxXsxO7khJ4f6X4uRfMvxYQC7kb8/QarXiTqtaav/kWkO9i1yscH5G23eYpNKZN2u8VFdshzn+ibctG VsLC10Ql QAoxoFbhQ2UVxpQ2fIFMBn3sgsmk/fHrmxKyp5/xHnfpLIJmF9j45O/nTQuPJ8N31ftKA3QRqczUpj3Ws1G9Xc6A6XvqZEpnfWQdczaN2bzzQ4vaaWCSviaayIqf0XHtueVZTsbR0fhS9dye9sZiJaQ3Z/wYjYAoeKnIXpn/pXBeVCK2a0k8/S3zq0Xtx7MkCsVWha7r03rRPadmN2UdTq6nBDJhGDj+qMXQ5J+JngiopfVZIATt+Dt02jvAqNyyCNJok8AVfG9uuc1/fWY/7d7ka1+HEflOX+L3hcRdRG9SeK476+clRIxX1CVrYZYt2AMBVzzEdHmDTRll8yegAoT1cj/Ok2LFBjsIePJrkjj+D2sO0sfCglWe0Ow== X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: To support memory devices under QEMU/KVM, such as virtio-mem, we have to prepare our kernel virtual address space accordingly and have to know the highest possible physical memory address we might see later: the storage limit. The good old SCLP interface is not suitable for this use case. In particular, memory owned by memory devices has no relationship to storage increments, it is always detected using the device driver, and unaware OSes (no driver) must never try making use of that memory. Consequently this memory is located outside of the "maximum storage increment"-indicated memory range. Let's use our new diag500 STORAGE_LIMIT subcode to query this storage limit that can exceed the "maximum storage increment", and use the existing interfaces (i.e., SCLP) to obtain information about the initial memory that is not owned+managed by memory devices. If a hypervisor does not support such memory devices, the address exposed through diag500 STORAGE_LIMIT will correspond to the maximum storage increment exposed through SCLP. To teach kdump on s390 to include memory owned by memory devices, there will be ways to query the relevant memory ranges from the device via a driver running in special kdump mode (like virtio-mem already implements to filter /proc/vmcore access so we don't end up reading from unplugged device blocks). Update setup_ident_map_size(), to clarify that there can be more than just online and standby memory. Tested-by: Mario Casquero Signed-off-by: David Hildenbrand --- arch/s390/boot/physmem_info.c | 47 +++++++++++++++++++++++++++- arch/s390/boot/startup.c | 7 +++-- arch/s390/include/asm/physmem_info.h | 3 ++ 3 files changed, 54 insertions(+), 3 deletions(-) diff --git a/arch/s390/boot/physmem_info.c b/arch/s390/boot/physmem_info.c index 1d131a81cb8b..f3ea5dbff10b 100644 --- a/arch/s390/boot/physmem_info.c +++ b/arch/s390/boot/physmem_info.c @@ -109,6 +109,42 @@ static int diag260(void) return 0; } +#define DIAG500_SC_STOR_LIMIT 4 + +static int diag500_storage_limit(unsigned long *max_physmem_end) +{ + unsigned long storage_limit; + unsigned long reg1, reg2; + psw_t old; + + asm volatile( + " mvc 0(16,%[psw_old]),0(%[psw_pgm])\n" + " epsw %[reg1],%[reg2]\n" + " st %[reg1],0(%[psw_pgm])\n" + " st %[reg2],4(%[psw_pgm])\n" + " larl %[reg1],1f\n" + " stg %[reg1],8(%[psw_pgm])\n" + " lghi 1,%[subcode]\n" + " lghi 2,0\n" + " diag 2,4,0x500\n" + "1: mvc 0(16,%[psw_pgm]),0(%[psw_old])\n" + " lgr %[slimit],2\n" + : [reg1] "=&d" (reg1), + [reg2] "=&a" (reg2), + [slimit] "=d" (storage_limit), + "=Q" (get_lowcore()->program_new_psw), + "=Q" (old) + : [psw_old] "a" (&old), + [psw_pgm] "a" (&get_lowcore()->program_new_psw), + [subcode] "i" (DIAG500_SC_STOR_LIMIT) + : "memory", "1", "2"); + if (!storage_limit) + return -EINVAL; + /* Convert inclusive end to exclusive end */ + *max_physmem_end = storage_limit + 1; + return 0; +} + static int tprot(unsigned long addr) { unsigned long reg1, reg2; @@ -157,7 +193,9 @@ unsigned long detect_max_physmem_end(void) { unsigned long max_physmem_end = 0; - if (!sclp_early_get_memsize(&max_physmem_end)) { + if (!diag500_storage_limit(&max_physmem_end)) { + physmem_info.info_source = MEM_DETECT_DIAG500_STOR_LIMIT; + } else if (!sclp_early_get_memsize(&max_physmem_end)) { physmem_info.info_source = MEM_DETECT_SCLP_READ_INFO; } else { max_physmem_end = search_mem_end(); @@ -170,6 +208,13 @@ void detect_physmem_online_ranges(unsigned long max_physmem_end) { if (!sclp_early_read_storage_info()) { physmem_info.info_source = MEM_DETECT_SCLP_STOR_INFO; + } else if (physmem_info.info_source == MEM_DETECT_DIAG500_STOR_LIMIT) { + unsigned long online_end; + + if (!sclp_early_get_memsize(&online_end)) { + physmem_info.info_source = MEM_DETECT_SCLP_READ_INFO; + add_physmem_online_range(0, online_end); + } } else if (!diag260()) { physmem_info.info_source = MEM_DETECT_DIAG260; } else if (max_physmem_end) { diff --git a/arch/s390/boot/startup.c b/arch/s390/boot/startup.c index c8f149ad77e5..76c33c7442df 100644 --- a/arch/s390/boot/startup.c +++ b/arch/s390/boot/startup.c @@ -182,12 +182,15 @@ static void kaslr_adjust_got(unsigned long offset) * Merge information from several sources into a single ident_map_size value. * "ident_map_size" represents the upper limit of physical memory we may ever * reach. It might not be all online memory, but also include standby (offline) - * memory. "ident_map_size" could be lower then actual standby or even online + * memory or memory areas reserved for other means (e.g., memory devices such as + * virtio-mem). + * + * "ident_map_size" could be lower then actual standby/reserved or even online * memory present, due to limiting factors. We should never go above this limit. * It is the size of our identity mapping. * * Consider the following factors: - * 1. max_physmem_end - end of physical memory online or standby. + * 1. max_physmem_end - end of physical memory online, standby or reserved. * Always >= end of the last online memory range (get_physmem_online_end()). * 2. CONFIG_MAX_PHYSMEM_BITS - the maximum size of physical memory the * kernel is able to support. diff --git a/arch/s390/include/asm/physmem_info.h b/arch/s390/include/asm/physmem_info.h index f45cfc8bc233..51b68a43e195 100644 --- a/arch/s390/include/asm/physmem_info.h +++ b/arch/s390/include/asm/physmem_info.h @@ -9,6 +9,7 @@ enum physmem_info_source { MEM_DETECT_NONE = 0, MEM_DETECT_SCLP_STOR_INFO, MEM_DETECT_DIAG260, + MEM_DETECT_DIAG500_STOR_LIMIT, MEM_DETECT_SCLP_READ_INFO, MEM_DETECT_BIN_SEARCH }; @@ -107,6 +108,8 @@ static inline const char *get_physmem_info_source(void) return "sclp storage info"; case MEM_DETECT_DIAG260: return "diag260"; + case MEM_DETECT_DIAG500_STOR_LIMIT: + return "diag500 storage limit"; case MEM_DETECT_SCLP_READ_INFO: return "sclp read info"; case MEM_DETECT_BIN_SEARCH: From patchwork Fri Oct 25 14:14:49 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Hildenbrand X-Patchwork-Id: 13850766 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2DCC7D0C614 for ; Fri, 25 Oct 2024 14:15:43 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id B49B66B009D; Fri, 25 Oct 2024 10:15:42 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id AFAF06B009E; Fri, 25 Oct 2024 10:15:42 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 99CBC6B009F; Fri, 25 Oct 2024 10:15:42 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0010.hostedemail.com [216.40.44.10]) by kanga.kvack.org (Postfix) with ESMTP id 761396B009D for ; Fri, 25 Oct 2024 10:15:42 -0400 (EDT) Received: from smtpin20.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay06.hostedemail.com (Postfix) with ESMTP id 28BF0AB124 for ; Fri, 25 Oct 2024 14:15:03 +0000 (UTC) X-FDA: 82712321580.20.3C23326 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by imf11.hostedemail.com (Postfix) with ESMTP id 4DAF34001A for ; Fri, 25 Oct 2024 14:15:16 +0000 (UTC) Authentication-Results: imf11.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=BjGBJ6lZ; dmarc=pass (policy=none) header.from=redhat.com; spf=pass (imf11.hostedemail.com: domain of david@redhat.com designates 170.10.129.124 as permitted sender) smtp.mailfrom=david@redhat.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1729865570; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=U+nIERtDVeS/EhO1Z1RMDJ6bPWg7jhlY/grynlrcupM=; b=op7Bti0VscP9uJXPxGXIPOCdALd/pDflysrkO5S4rc8CI7TrzHSEiy2KS72lGTcDDmv5oI 3OMVASzpC6A+7CwEU6bTh4r+WK1eiYk27vYSPPYV5FH1Ty1oNPLy7xSdb030KqlJGIoPEK 55paVkJx9Xd23gFK1WEV9BeVLFQrRxo= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1729865570; a=rsa-sha256; cv=none; b=AzN0jyrqHqYhR3U8AqiVoBeKIGq2QLU9YxZTNnt4229AVB4VDiPzthkC5oJIs8i4B1Ed6B 2W583eKUqphBkALANfiDefMOzttUNY1K3B6fogERgp83wF+nmeWtc8DtJM3AyCPj3ybNDx kA+WxmTUKMpoQqRlqdv0hUcWcyKsPm4= ARC-Authentication-Results: i=1; imf11.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=BjGBJ6lZ; dmarc=pass (policy=none) header.from=redhat.com; spf=pass (imf11.hostedemail.com: domain of david@redhat.com designates 170.10.129.124 as permitted sender) smtp.mailfrom=david@redhat.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1729865739; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=U+nIERtDVeS/EhO1Z1RMDJ6bPWg7jhlY/grynlrcupM=; b=BjGBJ6lZztlyntSA9zEW5N+/GZf7XrS62FJVQUXGAMtc90pW/g753fhXsAqms6BTbGORQY NKIvnBQ9YTFzjwCI6c3mC8RtXaySZgt35bS713pywFps06mjD1BKbmUYocJAO55D64DsAV 9+ocV031HSO2bGnC+BC2n3ejCTafQjo= Received: from mx-prod-mc-02.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-659-F9VDsh4JNJadqAm0djARcA-1; Fri, 25 Oct 2024 10:15:37 -0400 X-MC-Unique: F9VDsh4JNJadqAm0djARcA-1 Received: from mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.12]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-02.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id DA7941955EAA; Fri, 25 Oct 2024 14:15:34 +0000 (UTC) Received: from t14s.redhat.com (unknown [10.22.65.27]) by mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id D6E921955F39; Fri, 25 Oct 2024 14:15:26 +0000 (UTC) From: David Hildenbrand To: linux-kernel@vger.kernel.org Cc: linux-mm@kvack.org, linux-s390@vger.kernel.org, virtualization@lists.linux.dev, linux-doc@vger.kernel.org, kvm@vger.kernel.org, David Hildenbrand , Heiko Carstens , Vasily Gorbik , Alexander Gordeev , Christian Borntraeger , Sven Schnelle , Thomas Huth , Cornelia Huck , Janosch Frank , Claudio Imbrenda , "Michael S. Tsirkin" , Jason Wang , Xuan Zhuo , =?utf-8?q?Eugenio_P=C3=A9rez?= , Eric Farman , Andrew Morton , Jonathan Corbet , Mario Casquero Subject: [PATCH v3 4/7] virtio-mem: s390 support Date: Fri, 25 Oct 2024 16:14:49 +0200 Message-ID: <20241025141453.1210600-5-david@redhat.com> In-Reply-To: <20241025141453.1210600-1-david@redhat.com> References: <20241025141453.1210600-1-david@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.0 on 10.30.177.12 X-Rspamd-Server: rspam07 X-Rspamd-Queue-Id: 4DAF34001A X-Stat-Signature: xxw8xa1w8mhzbcyyzjodc5ea8sp95ujg X-Rspam-User: X-HE-Tag: 1729865716-517168 X-HE-Meta: U2FsdGVkX1+xd58xIUKwpXC389p2iZP7TxxfkZQesoWOozT6TsiwoBgtg043KFdyLTHtZpB56+EO5z0+bC/nZfy1Hp3bHH/T01rBO8SZ/Ofd7tHpHN0dlbfEBjie4rVxMSM5Nhn8owKtfSFN/cBVy7u+l8FMO60jexLe3GDaiKxZ+hUoMHu5agvsVoYTeFjdSXe9My4a9c/Ax7VQNg5I4Sb8pmyhHjajSYHJ4wpUiLwlWbheEEmvNzwkv+h6OJSsndTB2dfYR7HhYkYUCWMUuDK1vwAKAFutH+f0m2gOAagdYVlD3pGSXnMXTHD9DP/wo4bnvYc51dBeabnZhEK9fqcdThlyVbPLoK54xBrfzqAi8dMhtn4cRx2Fl0L8QFg8ezCg1hX0gshexU1B11XpF6itXyka+cK+GzK4sv3ApqqE7dZtuzJYfku8mZBGPO5VSmq6Epobyf9efzYmAtMYW4ZHXpSkD4a4GM2Spou20xlSXWICW8fzcEYHTHaIMlDK119iZujeyUub4ZKRkZ/iNQLW0fy5pSyRF/uFjUFkup3P7MD8lqWOrPH4RD9fBlvgMM2oqdrp52zsOydtKonc9rGdgXsb+KPlMZ6PtGoN1UJSU4eLjaXlRkcMneKcwl8MiynKOH3/Jy62wsfFnyzM1osBjktslWKnSl/B3aZuZ7tzfd6LkzC8vD5MYiGOu/2K2/+Ms3zw3KCpHZE/eN6GWG1BwCYZ8v7fmELoIl0ZzNokAX+yZI0sqXZyOfxOBDELNw3lkNyjRFSOebtYYCaiDxlbvmTK3qCsM+ZDa2R/G1prr900kOhY5KNWs0RuFrUBk9uZ0pYeQ4WiRUw/pC49TtGas9YLOPra876SPEncPYQ//Y/dA1NUwNZtELzPFiT1cXLg6IvKIAGRjW0wKY5hJ0/L58mxXZ7Eex4brm/aH+zQj2Lu/aWvsiZJrMkvi20LcBBFxGrjsb5ABQ3ndre JgSJf/1Y yWgMlTnixMztj/VBL5Mb2QaaPNC+ci817FK2GGEpYlGOsbWoRpamK77gpmkod9MUJ5ej9OkQXhMWQGwJW+/97khYakfD5kEAuyfN27lViNbvyH70wgmv8gt6wRcQigslgH2iV5gdOQL1Sab7CP83PCHRvCOPNy4VfM2R/+9+L3tcAP/mR32f2ahuJ/6s11wHa4GsSxQDD45KLQfsTudQj3UYn9kowu5SlkH+Ci0k3vv3wW+w5x/kcdIeD9bw5VI9EspAqeDBdCTgG5NBuyDi8Oly6fZESnbywvKUWNXlHv6NKLc61nXCIs2OoTkCRSEmwVQHWzE0oFLmt6rY= X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: Now that s390 code is prepared for memory devices that reside above the maximum storage increment exposed through SCLP, everything is in place to unlock virtio-mem support. As virtio-mem in Linux currently supports logically onlining/offlining memory in pageblock granularity, we have an effective hot(un)plug granularity of 1 MiB on s390. As virito-mem adds/removes individual Linux memory blocks (256MB), we will currently never use gigantic pages in the identity mapping. It is worth noting that neither storage keys nor storage attributes (e.g., data / nodat) are touched when onlining memory blocks, which is good because we are not supposed to touch these parts for unplugged device blocks that are logically offline in Linux. We will currently never initialize storage keys for virtio-mem memory -- IOW, storage_key_init_range() is never called. It could be added in the future when plugging device blocks. But as that function essentially does nothing without modifying the code (changing PAGE_DEFAULT_ACC), that's just fine for now. kexec should work as intended and just like on other architectures that support virtio-mem: we will never place kexec binaries on virtio-mem memory, and never indicate virtio-mem memory to the 2nd kernel. The device driver in the 2nd kernel can simply reset the device -- turning all memory unplugged, to then start plugging memory and adding them to Linux, without causing trouble because the memory is already used elsewhere. The special s390 kdump mode, whereby the 2nd kernel creates the ELF core header, won't currently dump virtio-mem memory. The virtio-mem driver has a special kdump mode, from where we can detect memory ranges to dump. Based on this, support for dumping virtio-mem memory can be added in the future fairly easily. Acked-by: Michael S. Tsirkin Tested-by: Mario Casquero Signed-off-by: David Hildenbrand --- drivers/virtio/Kconfig | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/drivers/virtio/Kconfig b/drivers/virtio/Kconfig index 42a48ac763ee..2eb747311bfd 100644 --- a/drivers/virtio/Kconfig +++ b/drivers/virtio/Kconfig @@ -122,7 +122,7 @@ config VIRTIO_BALLOON config VIRTIO_MEM tristate "Virtio mem driver" - depends on X86_64 || ARM64 || RISCV + depends on X86_64 || ARM64 || RISCV || S390 depends on VIRTIO depends on MEMORY_HOTPLUG depends on MEMORY_HOTREMOVE @@ -132,11 +132,11 @@ config VIRTIO_MEM This driver provides access to virtio-mem paravirtualized memory devices, allowing to hotplug and hotunplug memory. - This driver currently only supports x86-64 and arm64. Although it - should compile on other architectures that implement memory - hot(un)plug, architecture-specific and/or common - code changes may be required for virtio-mem, kdump and kexec to work as - expected. + This driver currently supports x86-64, arm64, riscv and s390. + Although it should compile on other architectures that implement + memory hot(un)plug, architecture-specific and/or common + code changes may be required for virtio-mem, kdump and kexec to + work as expected. If unsure, say M. From patchwork Fri Oct 25 14:14:50 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Hildenbrand X-Patchwork-Id: 13850767 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 366B6D0C617 for ; Fri, 25 Oct 2024 14:15:51 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id C0D206B009F; Fri, 25 Oct 2024 10:15:50 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id BBCC06B00A0; Fri, 25 Oct 2024 10:15:50 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id A84AF6B00A1; Fri, 25 Oct 2024 10:15:50 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0012.hostedemail.com [216.40.44.12]) by kanga.kvack.org (Postfix) with ESMTP id 88BD66B009F for ; Fri, 25 Oct 2024 10:15:50 -0400 (EDT) Received: from smtpin01.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay10.hostedemail.com (Postfix) with ESMTP id 44546C0B20 for ; Fri, 25 Oct 2024 14:15:29 +0000 (UTC) X-FDA: 82712322294.01.D8C45DA Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by imf02.hostedemail.com (Postfix) with ESMTP id 02CC280010 for ; Fri, 25 Oct 2024 14:15:10 +0000 (UTC) Authentication-Results: imf02.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=cEDhe00H; spf=pass (imf02.hostedemail.com: domain of david@redhat.com designates 170.10.129.124 as permitted sender) smtp.mailfrom=david@redhat.com; dmarc=pass (policy=none) header.from=redhat.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1729865670; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=dV9SC24YC4T4aWYHNQCxY+WbG2Bhk/i+Kj0AtdnRckY=; b=JCyEee8ksX1qquyethE2MU/Qy/7gHCbp8ga+dyzP+lrfCEAzrkeqcOlVhU8tBA0AfXj1su knNmRufpNI+uaPP3+hgbtGYO5B7eCHGH+vjqxrfLIlnfvfHOezMHkJNbyoXfPTZTb/1rVw wgY7ZO5AZ++Dm096YsVzEN4p0FDuQ68= ARC-Authentication-Results: i=1; imf02.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=cEDhe00H; spf=pass (imf02.hostedemail.com: domain of david@redhat.com designates 170.10.129.124 as permitted sender) smtp.mailfrom=david@redhat.com; dmarc=pass (policy=none) header.from=redhat.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1729865670; a=rsa-sha256; cv=none; b=3TJMT9saWlVz78kuvKXBDLucvC562uI6zlS1aT0QBLnRO/Exld9xoxS1jgU+Xvc/ePFBiH od+Tyv7Pjkc4JnP9Ebp1x0CyCMi5BzY4sEP9KktQIIaDQ/aSLAygkNWnua0+0pH7YQlTPe ZUJAZMi+TBHjPud18llpwiyBvQ6vucQ= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1729865748; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=dV9SC24YC4T4aWYHNQCxY+WbG2Bhk/i+Kj0AtdnRckY=; b=cEDhe00HXmJZl+m+L29VjX96XiHVTe9gCnjtuFBwEtxKyzunfVxLp6NcI04BJj16fKWeFl szPCWQfK2OoxcccXKNEi3KJ0KBbXfOeIuuyYpgJCd91l4jwjW+SFDT5QDyIMZYqof4IeRl LTiS1ZLtqgbxkdKZ+ZZeWG3fMx/ghv4= Received: from mx-prod-mc-02.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-427-hNG7DXsQMK2z95OHSVmGKQ-1; Fri, 25 Oct 2024 10:15:44 -0400 X-MC-Unique: hNG7DXsQMK2z95OHSVmGKQ-1 Received: from mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.12]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-02.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 8C14C1955DCD; Fri, 25 Oct 2024 14:15:42 +0000 (UTC) Received: from t14s.redhat.com (unknown [10.22.65.27]) by mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 499AE1955F30; Fri, 25 Oct 2024 14:15:35 +0000 (UTC) From: David Hildenbrand To: linux-kernel@vger.kernel.org Cc: linux-mm@kvack.org, linux-s390@vger.kernel.org, virtualization@lists.linux.dev, linux-doc@vger.kernel.org, kvm@vger.kernel.org, David Hildenbrand , Heiko Carstens , Vasily Gorbik , Alexander Gordeev , Christian Borntraeger , Sven Schnelle , Thomas Huth , Cornelia Huck , Janosch Frank , Claudio Imbrenda , "Michael S. Tsirkin" , Jason Wang , Xuan Zhuo , =?utf-8?q?Eugenio_P=C3=A9rez?= , Eric Farman , Andrew Morton , Jonathan Corbet , Mario Casquero Subject: [PATCH v3 5/7] lib/Kconfig.debug: default STRICT_DEVMEM to "y" on s390 Date: Fri, 25 Oct 2024 16:14:50 +0200 Message-ID: <20241025141453.1210600-6-david@redhat.com> In-Reply-To: <20241025141453.1210600-1-david@redhat.com> References: <20241025141453.1210600-1-david@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.0 on 10.30.177.12 X-Rspamd-Server: rspam03 X-Rspam-User: X-Rspamd-Queue-Id: 02CC280010 X-Stat-Signature: rzaym7egpdfgzbgez4p49trsm6ayrppm X-HE-Tag: 1729865710-558134 X-HE-Meta: U2FsdGVkX1+IXhdqKCIs7qVcsymS1ogZeOuIukwn483XeMtGZz/oSolWZbUsPhj5AMd8qWgzbyI+0c1UbSvrd/ju991q8+ShbYpisXC+Q3SMLHnSaxarJJZlPpZDsdUbxayRyzWI8Dm5BJeKnS9c+g//l9WeyxZ3sEPlVnmFxWN6891fuQElAlAW/RRp3NOugy/NtQg5kGtwPQFZPuSms2Cn+etsprasmXe+yRnzOPhzjysFKuS/NI/IPEa2/jhSPS5MgAsiLKCqVM1tJh/IuDDoMSKLYcWLJl7BzGZWKLb28+YS+uhnhZizji2Bz+smc0OqLCCnM1X/jl+fJ8QlOFn1GdD2Hfazdo2VaC+o7KIH5a5eagDaSsNOZtOb2LqPUqfLkHsgtPDG/SKkJZXEy4Rs/t2B2er41u+E8BVa/IJOxrKoGxuag72JAaP2xrLKc4nWZY9ijFlkaPfGya+qi12obpQ8YU73nmgdCP1TWt+Nl8tUoZgvdkmEldUQsE+VRv06UfU//lsVeComzA8fIPCj15fj9yNJihRTTJPAWLdIgx2fnjbDHFcvN2IW/QNgHog8/ip2ZjccO7cA+k0mMg2uXal4jetMT/RwyD4xb18w1k9tGLY/GET+5ofUHsPBrrmTNafriYzYgjyrrCaPDV1+AmxgLrppTDUioAGNbwsGUTKCi104Oga5vYFVU2yyV4W28pjqtSf+DAgqs4r4GBuavQ/IJRzMahczrmq+BH+gnyo+ajhrzyT88XWRyhtlFSQDKgYN+cadINfmkkrXO1DgPuz3iNYGXLHY+ccoS9cXQHZBezaaELePZi//G8Gp8b0d8ACesFX5uvmyopPlgTkgqhjDPivH4hPYGj1bprQP504qRaDJ/4vkxDRZsXG6k0lwMjRcr6JdIFglyMsfvpwUDSrd14f9tSEbb1FnL/Oy8fbpNcAHoffGj2j/ThBP3t/Z08W1C0iOYaci85w o6foYwQT 0xFV3XEm5Lw/npoMBfJQSgKVteul359IrvdDR4UbFjk0SaB0UBIvQ0xTLUliJuDnt6JmYOK+FXJliQOqc4MorEZkC3cf7LqxkJb9Ww6yRjBWLijxdIgEQ89BNTgk4GTK6/ZdGIWQoUtGXr9fDy40omED67yO+f5x+IftiIBUu/TvNLGw8G5Z3tVtGcUOeo0UOlEVlQhtt93dphp+vh5NEt9FNdK4yIr3LKJ8SWganIti8bJw4q8sGwCs52rsnjq0t+pQ6CFpXbh1nj1JukkGkxO/hR+s4OYe0Y4364VWSnesRrXZu3KHajffW4pyA+TYxJM66Ds29xOMkPRsVtMDJOGk5cXB/NRHT7Fw1NxyinYCD5CcuD24h+HHrg5YvmJwuvuqtRD7gpQZfxdo= X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: virtio-mem currently depends on !DEVMEM | STRICT_DEVMEM. Let's default STRICT_DEVMEM to "y" just like we do for arm64 and x86. There could be ways in the future to filter access to virtio-mem device memory even without STRICT_DEVMEM, but for now let's just keep it simple. Tested-by: Mario Casquero Acked-by: Heiko Carstens Signed-off-by: David Hildenbrand --- lib/Kconfig.debug | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/Kconfig.debug b/lib/Kconfig.debug index 7312ae7c3cc5..fcad505e7c8b 100644 --- a/lib/Kconfig.debug +++ b/lib/Kconfig.debug @@ -1905,7 +1905,7 @@ config STRICT_DEVMEM bool "Filter access to /dev/mem" depends on MMU && DEVMEM depends on ARCH_HAS_DEVMEM_IS_ALLOWED || GENERIC_LIB_DEVMEM_IS_ALLOWED - default y if PPC || X86 || ARM64 + default y if PPC || X86 || ARM64 || S390 help If this option is disabled, you allow userspace (root) access to all of memory, including kernel and userspace memory. Accidental From patchwork Fri Oct 25 14:14:51 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Hildenbrand X-Patchwork-Id: 13850768 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id C0B48D0C614 for ; Fri, 25 Oct 2024 14:16:00 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 5A4036B00A1; Fri, 25 Oct 2024 10:16:00 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 554BA6B00A2; Fri, 25 Oct 2024 10:16:00 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 41C976B00A3; Fri, 25 Oct 2024 10:16:00 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0013.hostedemail.com [216.40.44.13]) by kanga.kvack.org (Postfix) with ESMTP id 237C46B00A1 for ; Fri, 25 Oct 2024 10:16:00 -0400 (EDT) Received: from smtpin27.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay10.hostedemail.com (Postfix) with ESMTP id D95ECC0B20 for ; Fri, 25 Oct 2024 14:15:38 +0000 (UTC) X-FDA: 82712322840.27.1C6B5D3 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by imf04.hostedemail.com (Postfix) with ESMTP id F28DC40013 for ; Fri, 25 Oct 2024 14:15:32 +0000 (UTC) Authentication-Results: imf04.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=Cpy55fY5; dmarc=pass (policy=none) header.from=redhat.com; spf=pass (imf04.hostedemail.com: domain of david@redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=david@redhat.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1729865588; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=minQPvjcAw7BmTU59AI15v5UYV4aItz4WqTTQMtatbA=; b=XSJdBegygZq3dTMTL6ugrGRt3fSiBzOHtsbDeSh9g69a15deRicE6VKzKAOm85I9We5MKB 67s3O4nXw2pzRWNC904k0YxMhxegiprQMjGhKI+L4CDawbi1L3FqqfDxaEyHC3bXh+XXp+ Ch0jLYuETczxxN95v/AJBLAMJNX+sG0= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1729865588; a=rsa-sha256; cv=none; b=n8AFzC0bo6AAGraiS5xgk5w+K0M6gp/qC6cPu4P9qtVwZTIKY827xRCHuImseXpAc0Blxb 8ww+Cxpx/+BAIixf+UcaNK+uwH+hXj86VVX4iwgyhi4Dojsox/7sK3DeSAjVSDwT23b3tI 2vfvgzTieMoBB35q5Jet5L/NGT5riLY= ARC-Authentication-Results: i=1; imf04.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=Cpy55fY5; dmarc=pass (policy=none) header.from=redhat.com; spf=pass (imf04.hostedemail.com: domain of david@redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=david@redhat.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1729865757; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=minQPvjcAw7BmTU59AI15v5UYV4aItz4WqTTQMtatbA=; b=Cpy55fY5LI2w/vkgUGLC2Yg9qDCeAoy6mlb6SiIYbrtEy6pIIAeEsniwQPQnhqmozs2zlB ih4L2iSoMpHR07vKdGw60oxI52JI2yyeRYIiUX6zplGKR/jub0v5ERXm66/jHbQ0L53YHX y16COZyQ1BuMHzA2dfL5Bw/o6uWqoU8= Received: from mx-prod-mc-01.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-604-cIntWAoSP6e3AMrL0U5dWA-1; Fri, 25 Oct 2024 10:15:54 -0400 X-MC-Unique: cIntWAoSP6e3AMrL0U5dWA-1 Received: from mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.12]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 8804419560B5; Fri, 25 Oct 2024 14:15:50 +0000 (UTC) Received: from t14s.redhat.com (unknown [10.22.65.27]) by mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 2754819560A2; Fri, 25 Oct 2024 14:15:42 +0000 (UTC) From: David Hildenbrand To: linux-kernel@vger.kernel.org Cc: linux-mm@kvack.org, linux-s390@vger.kernel.org, virtualization@lists.linux.dev, linux-doc@vger.kernel.org, kvm@vger.kernel.org, David Hildenbrand , Heiko Carstens , Vasily Gorbik , Alexander Gordeev , Christian Borntraeger , Sven Schnelle , Thomas Huth , Cornelia Huck , Janosch Frank , Claudio Imbrenda , "Michael S. Tsirkin" , Jason Wang , Xuan Zhuo , =?utf-8?q?Eugenio_P=C3=A9rez?= , Eric Farman , Andrew Morton , Jonathan Corbet , Mario Casquero Subject: [PATCH v3 6/7] s390/sparsemem: reduce section size to 128 MiB Date: Fri, 25 Oct 2024 16:14:51 +0200 Message-ID: <20241025141453.1210600-7-david@redhat.com> In-Reply-To: <20241025141453.1210600-1-david@redhat.com> References: <20241025141453.1210600-1-david@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.0 on 10.30.177.12 X-Rspamd-Server: rspam07 X-Rspamd-Queue-Id: F28DC40013 X-Stat-Signature: khmfoanq8drbwk7r4qtxqmwuaxjq4fg7 X-Rspam-User: X-HE-Tag: 1729865732-34010 X-HE-Meta: U2FsdGVkX1+v34OJkdgMxxI0hJXKuiQSt6DtV5D0KZK3tuyfdc1TMR9FZ1kv66qWrGIk1kjhmAZJY529IEeZ8Hiszxpk0LFrrqBWRSf187H0O3EXtpd1FaIGTiykuEE+ZFx3AA2bprxLOAb+L2truVt4rbd8QPp7X+Lx3ZTDC+bxlE2BVyokRc2LPZHMee1f93R63HsB/oXvGmUQm+5GhzOCrj41H4Uhvi8+y2LHLzXHQfIa3shEm86w5QMC6e+WebDKpgeCYmE7WS8xYSo3Rvf3afBRJJ0uOhhiURFMtNEQbrblRyrSYuGbyk4/3QvrPVrfY799zwqzsFMLtSD+4TOuiJzFS4QW8YqDa3uFxdLy+MCNHYyTdkHbkEOb8WdZzyb2ulhlPM1sa5FamEr/yV1ofJXlQ6fg1kpAti0fY9awIAy2iffCvT0ugLgo0G/APH9reVfUB2qoOv1nYyZx98ZEQm34mbVzdKzPPBpiAoUeNK1vCPl7/EdxjadNA0rBVrdAbv+wNZmtHbbItJD0VZ+FxGWZwqvkFA3tOkm07W9YPk4Kef0jtmBv9oiH8jl84rPLZRofu29reZN7Q4wQId+eOUkAQEm/kmZRW0YjOpECdL5/89XP829KhZY5MJRtE3nFSDEfIx1pqq3d61g5XRettX4Lu0tAYSl1fymn5nkv9K9PsJ6xE82kyjMEpnrW6Ktu6pwPyD+mGbvn1ZWAGHoE+wkWWqGa18ykqfxyz7ZelDlPKJowuEhFsJtIsci3VQkv7dqKdptQOHnf/EyUmweKS+V4R/lHKmvfDkUNcvjza7h/HwbVFPTNz0288May4e5BEwRZc7QyJKY0fgLhsCtiRCIptVQwjdQX9Q9OtF3t6JC8U181nchoMtdOOD0t3h1gixeKYtO0SPBvTD2AoGh58Pj54eo0Xn0EyDkPfsWq5ak+RJ+MDCYEuB9ooRulJa2WgCVn76QfKgfOMQ5 +/9R/12G LkjiJP/gW/Tpe655iTDNLkVrsnzCZBKOtlYGm6mmuTLXLXUS0DaCz6N5dAwj3VdvQJxyukPJZyTf/4i9/jh1LOxziALCdQej6vI6qs1+o/lv+k7MkhKDHF4GOw9NUKraamL+4D0AjCVOc/Nv7QFsj3Gc7IciUxI4jH7W0FKA15BqqCZX1BV6uNgFecO8bxAbZIpP5JiRklcZJfo4UvjWcfmbqRhLNE11BVaXXrjdKhJQVBAWa1kn5KXMupmz0DKdxVvm/jiPL28MdDk+vbHqVIxVLvfpWW1pmFIfWqmjM7OarVMGbcQkuuag58GV51ODmKlV6omyw7F+3SvoXqfncfbmQefUnPPPceP5v X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: Ever since commit 421c175c4d609 ("[S390] Add support for memory hot-add.") we've been using a section size of 256 MiB on s390 and 32 MiB on s390. Before that, we were using a section size of 32 MiB on both architectures. Now that we have a new mechanism to expose additional memory to a VM -- virtio-mem -- reduce the section size to 128 MiB to allow for more flexibility and reduce the metadata overhead when dealing with hot(un)plug granularity smaller than 256 MiB. 128 MiB has been used by x86-64 since the very beginning. arm64 with 4k base pages switched to 128 MiB as well: it's just big enough on these architectures to allows for using a huge page (2 MiB) in the vmemmap in sane setups with sizeof(struct page) == 64 bytes and a huge page mapping in the direct mapping, while still allowing for small hot(un)plug granularity. For s390, we could even switch to a 64 MiB section size, as our huge page size is 1 MiB: but the smaller the section size, the more sections we'll have to manage especially on bigger machines. Making it consistent with x86-64 and arm64 feels like the right thing for now. Note that the smallest memory hot(un)plug granularity is also limited by the memory block size, determined by extracting the memory increment size from SCLP. Under QEMU/KVM, implementing virtio-mem, we expose 0; therefore, we'll end up with a memory block size of 128 MiB with a 128 MiB section size. Tested-by: Mario Casquero Acked-by: Heiko Carstens Signed-off-by: David Hildenbrand --- arch/s390/include/asm/sparsemem.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/s390/include/asm/sparsemem.h b/arch/s390/include/asm/sparsemem.h index c549893602ea..ff628c50afac 100644 --- a/arch/s390/include/asm/sparsemem.h +++ b/arch/s390/include/asm/sparsemem.h @@ -2,7 +2,7 @@ #ifndef _ASM_S390_SPARSEMEM_H #define _ASM_S390_SPARSEMEM_H -#define SECTION_SIZE_BITS 28 +#define SECTION_SIZE_BITS 27 #define MAX_PHYSMEM_BITS CONFIG_MAX_PHYSMEM_BITS #endif /* _ASM_S390_SPARSEMEM_H */ From patchwork Fri Oct 25 14:14:52 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Hildenbrand X-Patchwork-Id: 13850769 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 13FC1D0C615 for ; Fri, 25 Oct 2024 14:16:10 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 9C30A6B00A3; Fri, 25 Oct 2024 10:16:09 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 973436B00A4; Fri, 25 Oct 2024 10:16:09 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 83B1B6B00A5; Fri, 25 Oct 2024 10:16:09 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0011.hostedemail.com [216.40.44.11]) by kanga.kvack.org (Postfix) with ESMTP id 5CD9A6B00A3 for ; Fri, 25 Oct 2024 10:16:09 -0400 (EDT) Received: from smtpin25.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay03.hostedemail.com (Postfix) with ESMTP id 6D91EA0C24 for ; Fri, 25 Oct 2024 14:15:33 +0000 (UTC) X-FDA: 82712323302.25.1171CF2 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by imf18.hostedemail.com (Postfix) with ESMTP id B6F601C0019 for ; Fri, 25 Oct 2024 14:15:58 +0000 (UTC) Authentication-Results: imf18.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=C9r6rA0a; spf=pass (imf18.hostedemail.com: domain of david@redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=david@redhat.com; dmarc=pass (policy=none) header.from=redhat.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1729865714; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=RqrSCL9SnqQxdMhiUeTqL0vv0HNcmyIpWy8EeAUhBAs=; b=4SmCbiQ2+za7ulTXxSf7ieHzBBpsTxfn1RiYFCYTbyTnQPeS2WepGKryxF9IXaMxUIUv8u bjeQqR8Er5cnFPl4KFVgRsxU2zx3vG8WgfGk9ryNnd/SydWVArK5EZEoA8Y6qbSxS2Cu7D t1mhfxm6k3vxLbMnyO1I63HW9bJhPoA= ARC-Authentication-Results: i=1; imf18.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=C9r6rA0a; spf=pass (imf18.hostedemail.com: domain of david@redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=david@redhat.com; dmarc=pass (policy=none) header.from=redhat.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1729865714; a=rsa-sha256; cv=none; b=Z572+f35Td2JglTY+y5HnW8KQfb07DIzmQiLRSeHR4sBrAsl8eKkNI8riMLCdWYKZpqFg/ FKUWzBHXd6zr4uVdbLAsJ2sfORIoM+97rNJEFdC1utIiAhYysxihgM8sCPXJwnW/zGC31J qtY/nPDMRXxjIdb4UkLQIIKIdVzgMBo= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1729865766; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=RqrSCL9SnqQxdMhiUeTqL0vv0HNcmyIpWy8EeAUhBAs=; b=C9r6rA0aoWWpbjb8Ba3OVDYB0V8tBX+mamaKMmGG9SDO87KpbGMXUxNh28nH+RHcTd3ZZQ xPp8HH6K72/NXBIVqtFg9kk3IvXR6k/tqODMQPv0woV0dP4Kxd47fH2FTsjf/ge8sdEKrB qVauuuVoXGvRUZFCO98eeCum4rkHNXU= Received: from mx-prod-mc-05.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-378-QVg6coorOeq0mXJ05YLkIw-1; Fri, 25 Oct 2024 10:16:03 -0400 X-MC-Unique: QVg6coorOeq0mXJ05YLkIw-1 Received: from mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.12]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 6CF7E1955F3F; Fri, 25 Oct 2024 14:15:58 +0000 (UTC) Received: from t14s.redhat.com (unknown [10.22.65.27]) by mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 2459119560A2; Fri, 25 Oct 2024 14:15:50 +0000 (UTC) From: David Hildenbrand To: linux-kernel@vger.kernel.org Cc: linux-mm@kvack.org, linux-s390@vger.kernel.org, virtualization@lists.linux.dev, linux-doc@vger.kernel.org, kvm@vger.kernel.org, David Hildenbrand , Heiko Carstens , Vasily Gorbik , Alexander Gordeev , Christian Borntraeger , Sven Schnelle , Thomas Huth , Cornelia Huck , Janosch Frank , Claudio Imbrenda , "Michael S. Tsirkin" , Jason Wang , Xuan Zhuo , =?utf-8?q?Eugenio_P=C3=A9rez?= , Eric Farman , Andrew Morton , Jonathan Corbet Subject: [PATCH v3 7/7] s390/sparsemem: provide memory_add_physaddr_to_nid() with CONFIG_NUMA Date: Fri, 25 Oct 2024 16:14:52 +0200 Message-ID: <20241025141453.1210600-8-david@redhat.com> In-Reply-To: <20241025141453.1210600-1-david@redhat.com> References: <20241025141453.1210600-1-david@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.0 on 10.30.177.12 X-Rspam-User: X-Stat-Signature: i4rpotr3ixztq5q3fw8dpf6j7q44csq7 X-Rspamd-Queue-Id: B6F601C0019 X-Rspamd-Server: rspam11 X-HE-Tag: 1729865758-871761 X-HE-Meta: U2FsdGVkX192sdvdpx7+Qnejcv3NfblGLQomDDnd4FY41EnAVRABHPnYfRmL12FmXLgIiVi7hOh/ZK2075yy0OvzYxjptqpOj5HN82HsrxfNL6va4dRGNLj4tMyD7n0wg/ZIj0/6xhlvFqX/3K2qykOsiTfSItrviKhVIN6Y6SsGQAXGwLLFWWYLVNAQah5USbhrN4xGqLBSSQNDCETnsg6d22axOv53XPhPXadAWnDMmQ9xLHyNu9yGtTrX6/cKKrAIHA5qT5YQ49MrX2r95z0MqEH90w2MBW6OxLUDAs8B0Xvf54UTH6AxNTCOqNMu0GmdF5eoR+NX144f3GvmAANnGMlmAlEDUTdMVOj4dpq7XxL/WwcBscr45i9DdSSNes8vpykw/U9slxAJPuFCmKEmMQgRDyDGIhTv2Vrfj2232LeH+93iJWtAvKlDBnUHtFPnQu7LV+JH8GYMtwgj3AC5E48M/q/5NE3UtI691dwqXMV3aD3eCwZU34S2oxuv9OmXdgBOmA7mOCuFDuN5Sh7V7vARs7cTW7uPndasCm53RdBH909fgnCeOICV4pxk40vik/51reAMeo6Oiw/kvF2SzlA5DlBT4n6Jz4LkGMgmCHUp6REzObzvUV12eHE2cEH7Diks/b0Ac1Difg/xjqTYkCT3RAcCFDn9+ndCzQ4J6P+OAucQXF6Jm/oZeRNf6u3mipJBfEpF+qmt0LpOXRouNGCUs3/K/RaYmVPC4nhfjIN/mncusJbbjYwXmuZl8QQgsIC1BvpfGg+xn+uZFd5S6ek54eUCkALs8unmEm5b9f+UFILBCqtbAPhoY8VSH5DK4kmFyzzMbR/BjkAMoon9TGlIM/JSSi42xzzUlLWFC0+OD1btXFYksrEMcuFVABLpJYW2EdPQOaWI+QwteNO31PVlQBgl/4Og2cP00t5GqVD/30TwajYFogZzGr3/Xgrf59OKwUCGBeduYAa xW0CuvEn rLlZiVql5KkjDID/fYo/0IXjfblsW101H2eA0dcLat3nwM1oPiA6V8NpCugOk81JHBU1xjPINoC2Pb+v15pb/G76BuIPu16I2LbtSFbWrYZrsGxmT2vf7EToXwhkQ2jb1t5/IJ+W94Mmfuid0DWaOQb0mCycWmrURb8Hzc7vQz9M6Nnwci3YN2dT3JUYv73Y9hmKBAr04DimGEWML1c632/iY/WXClBOkS7ot+EMMVTExmzC1lI6fu/+YVPMBt0X2ImNVJ4XPWQNPxEvmowbXTYc4xZdwErB+GK8885MWOQ824PO0sL9k0arJmlDVhl1wFJdYWM+a8aWyZtNJJ4TQYu4TuqS0O6o04pZcQ9KNLOe3TeUz0hmC6wwVHg== X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: virtio-mem uses memory_add_physaddr_to_nid() to determine the NID to use for memory it adds. We currently fallback to the dummy implementation in mm/numa.c with CONFIG_NUMA, which will end up triggering an undesired pr_info_once(): Unknown online node for memory at 0x100000000, assuming node 0 On s390, we map all cpus and memory to node 0, so let's add a simple memory_add_physaddr_to_nid() implementation that does exactly that, but without complaining. Signed-off-by: David Hildenbrand --- arch/s390/include/asm/sparsemem.h | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/arch/s390/include/asm/sparsemem.h b/arch/s390/include/asm/sparsemem.h index ff628c50afac..6377b7ea8a40 100644 --- a/arch/s390/include/asm/sparsemem.h +++ b/arch/s390/include/asm/sparsemem.h @@ -5,4 +5,12 @@ #define SECTION_SIZE_BITS 27 #define MAX_PHYSMEM_BITS CONFIG_MAX_PHYSMEM_BITS +#ifdef CONFIG_NUMA +static inline int memory_add_physaddr_to_nid(u64 addr) +{ + return 0; +} +#define memory_add_physaddr_to_nid memory_add_physaddr_to_nid +#endif /* CONFIG_NUMA */ + #endif /* _ASM_S390_SPARSEMEM_H */