From patchwork Tue Sep 10 19:15:34 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: David Hildenbrand X-Patchwork-Id: 13799278 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 3F0D7EDE9AB for ; Tue, 10 Sep 2024 19:16:01 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 6416A8D00A5; Tue, 10 Sep 2024 15:16:00 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 5F1308D0002; Tue, 10 Sep 2024 15:16:00 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 4B8678D00A5; Tue, 10 Sep 2024 15: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 2E4E28D0002 for ; Tue, 10 Sep 2024 15:16:00 -0400 (EDT) Received: from smtpin22.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay01.hostedemail.com (Postfix) with ESMTP id 9C9001C2011 for ; Tue, 10 Sep 2024 19:15:59 +0000 (UTC) X-FDA: 82549783638.22.516F2E0 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by imf26.hostedemail.com (Postfix) with ESMTP id C091314001F for ; Tue, 10 Sep 2024 19:15:56 +0000 (UTC) Authentication-Results: imf26.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=Y4nij0+1; dmarc=pass (policy=none) header.from=redhat.com; spf=pass (imf26.hostedemail.com: domain of david@redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=david@redhat.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1725995680; a=rsa-sha256; cv=none; b=Ypv04Mk4L0aAoqU3glmbh326nstQ4yJZfT1ozx7QqzeCLmRuYdZ7fsVJPs3OIk7FvieWFq BT/pcr0ZNgHFE01YPB5+L/YY7mueeODGICyhIAXBOIx9CQAm3NPEPl3h6sL6KhIVfoocjY Z2BSlLf3QAnXuHAmghNWgjZ6KZdRkDE= ARC-Authentication-Results: i=1; imf26.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=Y4nij0+1; dmarc=pass (policy=none) header.from=redhat.com; spf=pass (imf26.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=1725995680; 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=p5VO7xFGUC34u9yUYNmEroA6AIpumzSXtSSwu0Hwc8c=; b=7QXEOE8gR6CsQSKhahE42/no31dI//4EtZLF16CbnxDhza4aLk/AQ2w4YVqenqkZQHfF5i XEHl3sDmQl5AzDdMiaBsWRhy7/x9ilBBYYlYj7YaYXVp3wly3xn44ZeUF1BsbaHn6YLh8x JzJQdaohdTqRQbJWFaH/eDze+P70zJU= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1725995755; 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=p5VO7xFGUC34u9yUYNmEroA6AIpumzSXtSSwu0Hwc8c=; b=Y4nij0+1RWML7HE59VjJGdj2P70MhwVyi3TmChy0BRAD92kPszLpb2cUMZCDFi32MdE/k4 hxTEviUhzKdOdQgSOaJl2oZH1/ph52BMwQrHG9Vl+q8gfLQ2YCn3HBEY7R8ZN0HT7wm/0/ Mrr9y+0wILQMcJeYaDv4kCkBGKZkoiM= 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-608-1Yk_m0wcPrS7gXs10S8K3w-1; Tue, 10 Sep 2024 15:15:52 -0400 X-MC-Unique: 1Yk_m0wcPrS7gXs10S8K3w-1 Received: from mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.4]) (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 7521E1953945; Tue, 10 Sep 2024 19:15:50 +0000 (UTC) Received: from t14s.fritz.box (unknown [10.22.17.222]) by mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 891B93001D0F; Tue, 10 Sep 2024 19: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, 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 Subject: [PATCH v1 0/5] virtio-mem: s390x support Date: Tue, 10 Sep 2024 21:15:34 +0200 Message-ID: <20240910191541.2179655-1-david@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.4 X-Rspamd-Queue-Id: C091314001F X-Rspam-User: X-R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pW1cf+dTh1VFA1xIbCCnR/kpwjBPNwUQSfW/SvfOKDwIgyctAJGp8DTa/CsHaC/sFG0RbByfeCf59cf1rGfcN8Yxug3bN9B2A52WgCHJUKsG863AhDDlESUsRv+3PX5dVF9GuPGUMzDki3vfMobYqeZGWOfHGDl+ortmBQ44PIuCapGE40eaJYGdJrcMGZ99z7Tu3vQRYSAPjiY0HiubWC183JNdiLtbltJRJJFMiVt9bOG+g1DET72ev6P23h46Kg7Sb/WxqMq+sLxDrprY0HH1fXY4unZvVDAjHj0beF9ehHext8qREPsJI8rs1Fvujsb9VvFBv0JXLu3Iligi2xmiBgMRUVs1bY8crdPrjGoUgFfDOj7UgtLfSCDRu21Xtzv54jSAi8ecMrGJhL6FDypdLf/3i84TjGyM/6pHmR4v7Y7bd9v5uRiZt1mvGZnGH9s6QBBiDaBGPymm+mo1eZ7wuwpe7WD4FFJCOcyHkq7uiQQCZtlnt6DXxNKFycmTwVke1V14RQOn0unJKCHGAxGk9sJy/34io4/Ezh+eMb7u/n+IwvaXCA76k6b1DtwkJgob0c/Sg== 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 s390x support for virtio-mem; my last RFC was sent 4 years ago, and a lot changed in the meantime. This is based on mm/stable. I sent out the QEMU part earlier today [1], that contains some more details and a usage example on s390x (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". Once this and the QEMU part will go upstream, it will get documented in [2] 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 [3]. 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. I am working on a prototype that will be fairly straight forward, because the virtio-mem driver already supports a special kdump mode and dracut will already include it in the initrd as default. With holiday and conferences coming up I rather sent this out now. [1] https://lkml.kernel.org/r/20240910175809.2135596-1-david@redhat.com [2] https://gitlab.com/davidhildenbrand/s390x-os-virt-spec [3] https://virtio-mem.gitlab.io/user-guide/user-guide-linux.html 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 David Hildenbrand (5): s390/kdump: implement is_kdump_kernel() s390/physmem_info: query diag500(STORAGE_LIMIT) to support QEMU/KVM memory devices virtio-mem: s390x support lib/Kconfig.debug: default STRICT_DEVMEM to "y" on s390x s390/sparsemem: reduce section size to 128 MiB 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 +- 7 files changed, 64 insertions(+), 11 deletions(-)