From patchwork Tue Sep 10 19:15:37 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Hildenbrand X-Patchwork-Id: 13799284 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 54212EDE9AB for ; Tue, 10 Sep 2024 19:16:23 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id C82FB8D00A8; Tue, 10 Sep 2024 15:16:22 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id C59BB8D0002; Tue, 10 Sep 2024 15:16:22 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id B219E8D00A8; Tue, 10 Sep 2024 15:16:22 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0017.hostedemail.com [216.40.44.17]) by kanga.kvack.org (Postfix) with ESMTP id 93FF38D0002 for ; Tue, 10 Sep 2024 15:16:22 -0400 (EDT) Received: from smtpin29.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay08.hostedemail.com (Postfix) with ESMTP id 4558E140851 for ; Tue, 10 Sep 2024 19:16:22 +0000 (UTC) X-FDA: 82549784604.29.21939CB Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by imf25.hostedemail.com (Postfix) with ESMTP id 63737A000C for ; Tue, 10 Sep 2024 19:16:20 +0000 (UTC) Authentication-Results: imf25.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=QI+OYWFe; dmarc=pass (policy=none) header.from=redhat.com; spf=pass (imf25.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=1725995776; a=rsa-sha256; cv=none; b=ObgRQ5I+NDsI23IlW1n0rZJN/goDEL/ErctMBnJ/EKGSzRG0duPkpizbSEYn8EgbIiS4Rc mI45xDfHrLsjzZYsyExeBr61jxZx4eEQLh3bCgs/0cSM67yEN4G/yhooYjyU9ZWRZ+5+7d CFDUp1Z5tU702Vr0GBNZdynp2sBrzYw= ARC-Authentication-Results: i=1; imf25.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=QI+OYWFe; dmarc=pass (policy=none) header.from=redhat.com; spf=pass (imf25.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=1725995776; 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=f8jrsz+oSo4UCVf0NzVCWgl3T4VzNafVCQ5XVw1eXHQ=; b=bQvnRwORY0f+YZ0QebrnDeUO7kRKGJeD+QtHk32A3ELHlFlZyfSJBeUUYtiRahMcyah5vh EzIKNrYfbz21Garli3jyP9Nvzp9eHolgMZpvurm5ds5DlnsLnP7KNrHRG2JYv7OKUJUrB1 MA9WOzsj3BOkMDHZwIXeimqmC7Bddm4= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1725995779; 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=f8jrsz+oSo4UCVf0NzVCWgl3T4VzNafVCQ5XVw1eXHQ=; b=QI+OYWFey2knFXg/6TV3zWfXWgBA6brmw7vu1RU/4CAWjhqZp7obg2EW20gJGwpc9GeeiR BjiQ6iLeW1Nf2uLUC+LmUup/k7OP4CuglmpB/A64PFGbPvypykr7B/Zbim+NkC7W8xDVH1 PD2GBd1Mn6BNIxVPWwrA8xi/yDMhQ5U= 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-315-dB9lZH7VNWyNeRxWmJ1cNA-1; Tue, 10 Sep 2024 15:16:16 -0400 X-MC-Unique: dB9lZH7VNWyNeRxWmJ1cNA-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-03.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id DDF491956069; Tue, 10 Sep 2024 19:16:10 +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 6DC0130001A1; Tue, 10 Sep 2024 19:16: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, 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 3/5] virtio-mem: s390x support Date: Tue, 10 Sep 2024 21:15:37 +0200 Message-ID: <20240910191541.2179655-4-david@redhat.com> In-Reply-To: <20240910191541.2179655-1-david@redhat.com> References: <20240910191541.2179655-1-david@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.4 X-Rspam-User: X-Stat-Signature: n5gwyrci8xe4mnmq1k7wimfngpesiixs X-Rspamd-Queue-Id: 63737A000C X-Rspamd-Server: rspam02 X-HE-Tag: 1725995780-626089 X-HE-Meta: U2FsdGVkX1/tz2GqDtCEUOZ9TQGx3cJFpo+SOY/tAZny1zB3YXTPbzuQGwiVLE4QefU2WqYVg9POP1yp+adAjkZ1FzIYh8u0bXWKpvtfxqGUw93eYyKmJ8cKlDhtv478oAP/phh0uWHe93ij/lwIGUdeDeG+nsYemKdhi7GS2/Qm9i8evbENDLka0ze16rDNlvs5RQ50I27IuMzwQV+kkGbYuyH2KLzbRVEYgA5Hs3DmNyPEQAsk1tMVQ1YrrNb21k+5+kG9Wz8nyx4YL5rellGParIBzer80TdxgEM5wMKit977Ct/w8nA3XlqwAH8zzOn5PQ7uOX23ky9dUh4wka62kcCSSiVJTQeuL7w5BsLlvx0xcJQRd83v5s4A8QZdqumd16jO00UsQ7htYMFp1t0CkCEg69OMvR9WHBg0x1gcZblZqhhm0d9aV75r9anRTPvc09fOVx4Yiy9qteKEFYTnhcvt0eEOZcKDMbGh8q5+wbvXNlfOksc5bUz3hKxcVMwS73JvqBuLHBSugwhKKW6/DvBSXW1kBkyoCE/CURAI7Z/e3pW8kITyDmhCPgrXdBCGPwKxFq5Ofl1Odv6di3JIMUr+dWQAc4pa5W2PznS+krptm9RKEzMeSBY6OJAVRt7ECBjSkouguRcM9B3NAPWcFVdlTQY9HvDYrwk+1+c5TSyKS0dtfZxgP4Pfhqy3GQRLU9BHSQVbINRnUAK5rg0jGXmDQqITFN3YyDAk5nf/2jjDB5h3G+UIAb6imxyuSt1O8CZD1brp5pFNGQJ5eMPIX3U3DMarEplx6TPGu2mKCv+FohE6WzEf13e/U9O8bIo56Scg4OwclrBS3gkFYuTp812iYgEc2TVpQd1RbCqR5TIjCnJf0quSrdWtAhI2aVKlUa2HgUBOCPIl92yydN2H1SwAU/cXBkUszL94yESB8W/yrgDIYseZzc0XpBZvv/0gJ8tKfyh0AaCPtX9 yd8Pjb9D OVhcLSrUzrQ/QziEPLaznVqsg3rSKESb38sTQbSKouG7SvmKsP0XlZFe1/7ntVJKAXhZ15eqeqPzYlZO0o6BzxuszKecsgS5qw7cQN5O7dmCiNp57sjY3n62q2Rjch+ysXdu+NAbevGs4Vk4gNMH3gezoUqWx8j/JC48pWTLGF0JDY3Njtdm7NmMJ2oiIjlUHQWXzw5D8q/gz8TK/LJV5DenjQWRDG+MhfDDEnZsS4VnyIbQMpvgEkZbNX4hZd6+Bmym+u8VhjH0cyWg1FuQTRBtbB7+r8wVRauVloSgCCHLyVveJ3H96IWeu5VopNhPMu7ARsgKKLOrh4xM= 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 s390x 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 s390x. 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 s390x 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. Signed-off-by: David Hildenbrand Acked-by: Michael S. Tsirkin --- drivers/virtio/Kconfig | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/drivers/virtio/Kconfig b/drivers/virtio/Kconfig index 42a48ac763ee..fb320eea70fe 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 s390x. + 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.