From patchwork Mon Oct 14 14:46:12 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: David Hildenbrand X-Patchwork-Id: 13835139 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 EFF8AD1627E for ; Mon, 14 Oct 2024 14:46:38 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 62EB46B0085; Mon, 14 Oct 2024 10:46:38 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 5DDDD6B0088; Mon, 14 Oct 2024 10:46:38 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 4CCA26B0089; Mon, 14 Oct 2024 10:46:38 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0015.hostedemail.com [216.40.44.15]) by kanga.kvack.org (Postfix) with ESMTP id 301096B0085 for ; Mon, 14 Oct 2024 10:46:38 -0400 (EDT) Received: from smtpin12.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay03.hostedemail.com (Postfix) with ESMTP id 4C4C5A0F49 for ; Mon, 14 Oct 2024 14:46:23 +0000 (UTC) X-FDA: 82672483866.12.6BBB193 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by imf13.hostedemail.com (Postfix) with ESMTP id 45C522000E for ; Mon, 14 Oct 2024 14:46:29 +0000 (UTC) Authentication-Results: imf13.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=H0hU1mkU; spf=pass (imf13.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=1728917007; 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-type: content-transfer-encoding:content-transfer-encoding:in-reply-to: references:dkim-signature; bh=CNpmOCUST08vkHQoeG1NSNtCSmJNv1NINO7OIcBeA0Y=; b=mLsxwcDsE0oSLMAmnaegYs/Q/xY6ioN4eC9w6OUzgP4LiMiKzl2AozTOqm5Z7sVmvsPsCT cwIlqRP52gPtrF43e4znqU0VMGzJ86iQdC5jAKMh07A9o/SmxxTJ8VfPqmpBhOg+wdDA+j GCXrxFAE++tnIAgeS4kO7YWqw/jnlKs= ARC-Authentication-Results: i=1; imf13.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=H0hU1mkU; spf=pass (imf13.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=1728917007; a=rsa-sha256; cv=none; b=bNGMRg5+YcsUDdoFbscxXo0axI6r34+YEBV3OrOOlRIu8rE2iHAsnJ/OC44E4sXqpwTykM EGWtzrJb2/s3CGGpr/Z1JQ7f9sTzwMGDTkCiclp1E2FTdAlOAc3fFMzT6i69nJWFX9TdqC ApnM5BQuLjJaG9bsmRqE1TuNxCI5Z0E= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1728917195; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=CNpmOCUST08vkHQoeG1NSNtCSmJNv1NINO7OIcBeA0Y=; b=H0hU1mkUiik6JB1YT7/PTqtq0mX15K5Kt/+PJmb0X9b23R9S9w6TsJKoHpJvXFFJsiMkRg qeT5q4RzYNuiP1McdYX4a5VaeRZkjs6TGMIGW3g2SVJpl03J/VQXvUdNE7Qi/GB0n6VDbo nzkkvjh/LllIszjNfKwxGW7uj+hZWC8= 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-613-NRRBshLPP-2vKK199e8dRA-1; Mon, 14 Oct 2024 10:46:33 -0400 X-MC-Unique: NRRBshLPP-2vKK199e8dRA-1 Received: from mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.17]) (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 806081955F40; Mon, 14 Oct 2024 14:46:31 +0000 (UTC) Received: from t14s.cit.tum.de (unknown [10.22.32.146]) by mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id E97671955E93; Mon, 14 Oct 2024 14:46:23 +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?= , Andrew Morton , Jonathan Corbet Subject: [PATCH v2 0/7] virtio-mem: s390 support Date: Mon, 14 Oct 2024 16:46:12 +0200 Message-ID: <20241014144622.876731-1-david@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.0 on 10.30.177.17 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MrceI/cObKrCmXIAT1oXqbrQy+YU5 P5sEvD8s rJ4Xvn3Iib3s7XC4U/v//rYuSsJ7XtAkBJT5TDdBeQjswwAXy3HrcuE/5vM3+q8ovHYPeGIMffxtuKMiy3YYgnQIqUmaAZNspE4Il4YIJALYOfJPSZMKa5CotR9u0zjzvD5u9smSzy1DwbEfScLpg7rbVXqoDyo2G3B7nX5FeGisdRte1NuOC+pogJ2RSXxo68TpOcqoLpp9dBN72dbbCm1y4Dvupbk9NSyT+AqHUNGFxJgp/MUYul5nTqi4Fd6J7LobIn+K1SuJixv82h0KVCqqgjbYzwNzLF/vCgi4QOehBOvXEDQx2/zQylgUdXIWVCij9akQF3lWUqhbARkzKm3lq7+/JNrW2XFXW2cuXW5cGEs4BTD3VfeAGXbuiKqdF601e7XpNm7ptazZXPeyk1/Ny9bL+g3XyU+2Y7vt5i/YhxqAEEFCZzWehDFaHowWoMZYXlVw/K1sCMK9WQcw7yWU5YCw1yu0K+6nt0ecbeXtNBEFDVLNtU1FfGGiQ4F35he3TpP8TeJTjngK2nsXADWcWS2PCT7cDfbryt+mGByxzapZy2Mfx2oFIQW0HB7hAvmFeb6+Yr02f9hVGGBeb5x9UiBS1kruw2Yx755p8IQhmiWiYRMfMwvfcPHneCh+aCdax 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 finally add s390 support for virtio-mem; my last RFC was sent 4 years ago, and a lot changed in the meantime. The latest QEMU series is available at [1], which contains some more details and a usage example on s390 (last patch). There is not too much in here: The biggest part is querying a new diag(500) STORAGE_LIMIT hypercall to obtain the proper "max_physmem_end". The last two patches are not strictly required but certainly nice-to-have. Note that -- in contrast to standby memory -- virtio-mem memory must be configured to be automatically onlined as soon as hotplugged. The easiest approach is using the "memhp_default_state=" kernel parameter or by using proper udev rules. More details can be found at [2]. I have reviving+upstreaming a systemd service to handle configuring that on my todo list, but for some reason I keep getting distracted ... I tested various things, including: * Various memory hotplug/hotunplug combinations * Device hotplug/hotunplug * /proc/iomem output * reboot * kexec * kdump: make sure we don't hotplug memory One remaining work item is kdump support for virtio-mem memory. This will be sent out separately once initial support landed. [1] https://lkml.kernel.org/r/20241008105455.2302628-1-david@redhat.com [2] https://virtio-mem.gitlab.io/user-guide/user-guide-linux.html v1 -> v2: * Document the new diag500 subfunction * Use "s390" instead of "s390x" consistently Cc: Heiko Carstens Cc: Vasily Gorbik Cc: Alexander Gordeev Cc: Christian Borntraeger Cc: Sven Schnelle Cc: Thomas Huth Cc: Cornelia Huck Cc: Janosch Frank Cc: Claudio Imbrenda Cc: "Michael S. Tsirkin" Cc: Jason Wang Cc: Xuan Zhuo Cc: "Eugenio PĂ©rez" Cc: Andrew Morton Cc: Jonathan Corbet David Hildenbrand (7): s390/kdump: implement is_kdump_kernel() Documentation: s390-diag.rst: make diag500 a generic KVM hypercall Documentation: s390-diag.rst: document diag500(STORAGE LIMIT) subfunction s390/physmem_info: query diag500(STORAGE LIMIT) to support QEMU/KVM memory devices virtio-mem: s390 support lib/Kconfig.debug: default STRICT_DEVMEM to "y" on s390 s390/sparsemem: reduce section size to 128 MiB Documentation/virt/kvm/s390/s390-diag.rst | 32 ++++++++++++---- arch/s390/boot/physmem_info.c | 46 +++++++++++++++++++++-- arch/s390/include/asm/kexec.h | 4 ++ arch/s390/include/asm/physmem_info.h | 3 ++ arch/s390/include/asm/sparsemem.h | 2 +- arch/s390/kernel/crash_dump.c | 6 +++ drivers/virtio/Kconfig | 12 +++--- lib/Kconfig.debug | 2 +- 8 files changed, 89 insertions(+), 18 deletions(-) base-commit: 6485cf5ea253d40d507cd71253c9568c5470cd27