From patchwork Mon Oct 14 14:46:13 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Hildenbrand X-Patchwork-Id: 13835140 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 9B514D1627E for ; Mon, 14 Oct 2024 14:46:46 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 347A06B0089; Mon, 14 Oct 2024 10:46:46 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 2F81B6B008A; Mon, 14 Oct 2024 10:46:46 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 1E6DD6B008C; Mon, 14 Oct 2024 10:46:46 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0014.hostedemail.com [216.40.44.14]) by kanga.kvack.org (Postfix) with ESMTP id EBA5B6B0089 for ; Mon, 14 Oct 2024 10:46:45 -0400 (EDT) Received: from smtpin05.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay04.hostedemail.com (Postfix) with ESMTP id 98A1B1A0D29 for ; Mon, 14 Oct 2024 14:46:31 +0000 (UTC) X-FDA: 82672484202.05.32DC7F3 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by imf01.hostedemail.com (Postfix) with ESMTP id 560C340009 for ; Mon, 14 Oct 2024 14:46:38 +0000 (UTC) Authentication-Results: imf01.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=FMAjv6Is; dmarc=pass (policy=none) header.from=redhat.com; spf=pass (imf01.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=1728917088; a=rsa-sha256; cv=none; b=ogICwcv7XO5/GRf54EVbLcq3D8UapyRsb9PAJXgckiE7v6TwpKsDOX7dGfmnHcGgu5wWJc 1yo3lw4TQcC6E4OjxrbU94mK0cx1pIeHyoeixZMarp024sOos9JCIOlv14yuWU7DYDQ2in La7PJYe3kR+UQV5L5Ga+Y67jhULcv+o= ARC-Authentication-Results: i=1; imf01.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=FMAjv6Is; dmarc=pass (policy=none) header.from=redhat.com; spf=pass (imf01.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=1728917088; 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=cvU7hgH0NcVyT2s8439e7eS1PoyrARDWsEuaW/yYTUo=; b=2jFhM8E6B2yKUG5QhHWCR/JKERDNcSkV3Ywi6i8kHL94qrn8M8fsFZgN35VDraDDas0J0E 7+UzHkLSQBFCPi6ttugaOa+klMYFgiTbnzeWiOU+koSeyoVjFl6CgTD5KJR6TtRCCbxeM9 WBdpxgjL2gwApxN7gsNlYbV/Donkq/0= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1728917203; 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=cvU7hgH0NcVyT2s8439e7eS1PoyrARDWsEuaW/yYTUo=; b=FMAjv6IsJFvxAVYREyAhKZ9d8u9Cqyeuk5LcIFrNMUA9MyohtVOYgoynDtxsLRy0/SFLQT BewkZ8Tnb5bTv3klvKiMxwOnGnLc8aIu89KQzmQh4Q087cRpSKkYgDHn3lqcTrzb6nyDFR rCW3L1E1NviYu+K+2i06kCG+2qwAGMI= 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-651-d5FnqCvGOkSv9Gj83elS0A-1; Mon, 14 Oct 2024 10:46:41 -0400 X-MC-Unique: d5FnqCvGOkSv9Gj83elS0A-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-02.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 5198B19560A7; Mon, 14 Oct 2024 14:46:39 +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 1ADD21955E8F; Mon, 14 Oct 2024 14:46:31 +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 , Mario Casquero Subject: [PATCH v2 1/7] s390/kdump: implement is_kdump_kernel() Date: Mon, 14 Oct 2024 16:46:13 +0200 Message-ID: <20241014144622.876731-2-david@redhat.com> In-Reply-To: <20241014144622.876731-1-david@redhat.com> References: <20241014144622.876731-1-david@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.0 on 10.30.177.17 X-Rspamd-Server: rspam12 X-Rspamd-Queue-Id: 560C340009 X-Stat-Signature: nqis9e1edsq5dnhsbc6tg47ndqcayyg3 X-Rspam-User: X-HE-Tag: 1728917198-545334 X-HE-Meta: U2FsdGVkX19otWN5kVFOSe2w55M5o7I6I3jYo20t/T5IT6YgpfQwbaLPN7fVqb+9+4ihH9ViYw9IIsMZbrIN5FZsO0Za4dlQ2nQyHKOLEqrkpoWBpa7A/i7culaU39HQuJY4ctxFesmdsJmyvUjEosFzbBZiPix1lAt2Dvv9z0Tjt1akFivjwMTx0opHuScWTEjxvpqkrTQNBYkBZB+S3mTfXLGo+GHJP02TdA+ZaffyUauQ0QxZ95ya15nE8t3TvJg0n5hXq58D3s7o5/+h0Cc0LmPednx1aMng0tePOGCoLvS2M/e/8lDrNRIF3YCiIVfowmRINJb+gPxO142pPddYHbyZcM6Vhxs/WOd5I4qBBs8R+gu3TIh1xri5D63Wt+KR/xOGl1cDVCdPId0LiUkAgDK7VOZaPw+w7PYxgz8X9qDTugjWQx0LgMuliOKdySnYHHzztT7psPAoPruihzDb+3W3e9EM8gut0QsZiHnd3Z+2HcbwBTCdwqrN2pZL83AjH9WUIp9AgJp+hgD3sHOwxoWzfotv5JyImvbV6SZ6FDtVqq47v4j2DR+N36++xE6/O+tLq+jRnYisdpfO+vhT+vOLQYQg7fg2EUcysLcv94ZH6A37mXtjXxnWrdEbhEIK6JnNMQKlUv5mydmmSQaoevBn+QDmo19P0vfnODTrSpFxV7BDzSNyND+rM6Ifamx7cnuHuDFrrELBdO0HDdylYs+SGo6JyEHYwWKp9dpk25nw8Bnoj3TjRa9mfZ+Zqjt6QEZqnq+LmNbPuQ7VN1mwuH6NeNJi66gOR03DxzP7sWxHmcEdwYo3GmOXbuQ4VkVVSfamFhfb5qmWTPt2q6fwG9w3PVDKYjctm335N5paxBZy4rGvSPxkfT8R7QzHOfSFOFGzIKTdvUD8rl1AzH5TOm8pn711HQxKMy5YKdvsvnrgORjp6Iq9E1reV7uxRlcMudxILKzkspo6EFE aesU1ZIJ rw6FzFeybCWazj7xsMZ50KgYkhs4AI+EQgHdbQ3nzfFXAi0tvk3F1njtjhTgfz1bgBBNdThC/zOhMuYr+4J8bDHASlxUaGlXZ3mxA1wOug4yAqKENGtG2D3IuIHIpDDFKVsmI80Qh+mdV5ZZq2lRLzOzcVntHosyr6Rv42rh3L2AUvm1P1Bc5xrwbHRzgIAUHOgqCzDOhHUz4ahcg/yivyWkjBWPHmAaldMf0fdkD9IwOr6ZtKFgqP2Fob7uyDybwBuMZm3ETTtzDeIuetPOLm8qIs5OfBV4vwmYeSwXDIOmLt6Bkzz7EOtK/aABLq6xpoqUVeqkBs+2tBmD9EVWCQS20morSXRTRryBeHXz/mhOLJ42iDMu8KNFXuA== 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: s390 currently always results in is_kdump_kernel() == false, because it sets "elfcorehdr_addr = ELFCORE_ADDR_MAX;" early during setup_arch to deactivate the elfcorehdr= kernel parameter. Let's follow the powerpc example and implement our own logic. This is required for virtio-mem to reliably identify a kdump environment to not try hotplugging memory. Tested-by: Mario Casquero Signed-off-by: David Hildenbrand Signed-off-by: David Hildenbrand Tested-by: Mario Casquero Signed-off-by: David Hildenbrand --- arch/s390/include/asm/kexec.h | 4 ++++ arch/s390/kernel/crash_dump.c | 6 ++++++ 2 files changed, 10 insertions(+) diff --git a/arch/s390/include/asm/kexec.h b/arch/s390/include/asm/kexec.h index 1bd08eb56d5f..bd20543515f5 100644 --- a/arch/s390/include/asm/kexec.h +++ b/arch/s390/include/asm/kexec.h @@ -94,6 +94,9 @@ void arch_kexec_protect_crashkres(void); void arch_kexec_unprotect_crashkres(void); #define arch_kexec_unprotect_crashkres arch_kexec_unprotect_crashkres + +bool is_kdump_kernel(void); +#define is_kdump_kernel is_kdump_kernel #endif #ifdef CONFIG_KEXEC_FILE @@ -107,4 +110,5 @@ int arch_kexec_apply_relocations_add(struct purgatory_info *pi, int arch_kimage_file_post_load_cleanup(struct kimage *image); #define arch_kimage_file_post_load_cleanup arch_kimage_file_post_load_cleanup #endif + #endif /*_S390_KEXEC_H */ diff --git a/arch/s390/kernel/crash_dump.c b/arch/s390/kernel/crash_dump.c index edae13416196..cca1827d3d2e 100644 --- a/arch/s390/kernel/crash_dump.c +++ b/arch/s390/kernel/crash_dump.c @@ -237,6 +237,12 @@ int remap_oldmem_pfn_range(struct vm_area_struct *vma, unsigned long from, prot); } +bool is_kdump_kernel(void) +{ + return oldmem_data.start && !is_ipl_type_dump(); +} +EXPORT_SYMBOL_GPL(is_kdump_kernel); + static const char *nt_name(Elf64_Word type) { const char *name = "LINUX"; From patchwork Mon Oct 14 14:46:14 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Hildenbrand X-Patchwork-Id: 13835141 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 DAAD8D1627E for ; Mon, 14 Oct 2024 14:46:55 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 4CF246B008C; Mon, 14 Oct 2024 10:46:55 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 4581A6B0092; Mon, 14 Oct 2024 10:46:55 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 3204F6B0093; Mon, 14 Oct 2024 10:46:55 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0014.hostedemail.com [216.40.44.14]) by kanga.kvack.org (Postfix) with ESMTP id 0BE356B008C for ; Mon, 14 Oct 2024 10:46:55 -0400 (EDT) Received: from smtpin22.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay06.hostedemail.com (Postfix) with ESMTP id 45F3DABF06 for ; Mon, 14 Oct 2024 14:46:39 +0000 (UTC) X-FDA: 82672484580.22.251D331 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by imf05.hostedemail.com (Postfix) with ESMTP id 4FEDB10000E for ; Mon, 14 Oct 2024 14:46:41 +0000 (UTC) Authentication-Results: imf05.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=FGHN0stU; dmarc=pass (policy=none) header.from=redhat.com; spf=pass (imf05.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=1728917056; 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=a1gfpTnBaz7Rw8DDcy7+GcKNAbMQ0JDruhBEQq7xW1o=; b=ACdZAwNKccXTPXZs+bOTp5KYp21Rl2pCJxvyJaNlIIzKk9cHJ37ir8C87HdgPM2H1U+68v lDOpNri1WPYCMK/g7i33CdvFPMoMR1qGe2hCsLxoicDqKUAiHGKjwkgawGBGCkTER5fI4q DPFSGLSUUoagJzr+MSJPRIZ3y0Lj1lg= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1728917056; a=rsa-sha256; cv=none; b=BV87T4jTEipiqxplbX/6ZmJ61g18oHGNzhPKDIsZpr9zlLGu8HfgfuD9njOvrJkqHOZf+N Wp7p5IVadCRCGl8ZWZXp16xX2lmQ4C+CaG6mP9zx0dRt5AIIhaczkxRKtEMRx2R29/8orZ OYlC/Eic3t4dTmx7yQJaizXwZ3Aeyzs= ARC-Authentication-Results: i=1; imf05.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=FGHN0stU; dmarc=pass (policy=none) header.from=redhat.com; spf=pass (imf05.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=1728917212; 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=a1gfpTnBaz7Rw8DDcy7+GcKNAbMQ0JDruhBEQq7xW1o=; b=FGHN0stUZi/RwFtZYtrfyODBZ79YTTkJy97LjVxY8clo4dXTvNEr3s08iTY+zYirBPBIe6 xdLap9xYffiRppRGO/wDmgc57k/lmCkYUZCw01/az8wHn2mecrPv282ZL828hhBTS4xiYD CL3k5+4IMJVJm/nsjMcl7PLbxifYUzk= 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-571-YaPY5B82Mt2_929L_qPidA-1; Mon, 14 Oct 2024 10:46:49 -0400 X-MC-Unique: YaPY5B82Mt2_929L_qPidA-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 3531919560B5; Mon, 14 Oct 2024 14:46:47 +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 C0E941955E8F; Mon, 14 Oct 2024 14:46:39 +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 2/7] Documentation: s390-diag.rst: make diag500 a generic KVM hypercall Date: Mon, 14 Oct 2024 16:46:14 +0200 Message-ID: <20241014144622.876731-3-david@redhat.com> In-Reply-To: <20241014144622.876731-1-david@redhat.com> References: <20241014144622.876731-1-david@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.0 on 10.30.177.17 X-Rspamd-Server: rspam07 X-Rspamd-Queue-Id: 4FEDB10000E X-Stat-Signature: 8w813jmwdqar7txwaa66t8awd7hkp63c X-Rspam-User: X-HE-Tag: 1728917201-634686 X-HE-Meta: U2FsdGVkX19k9Qys9WSHZ8hUGryaWXFSbIhg1jJxihsEW45Yrbu6UiIg8i1HTQSXpvCHj+DmNIFoVgS8Kb3JA2ZXj+Mtcn6LonANhmXaUuTdv5XVoP1nDCLCj3J9D9Fbj/6WBMPlTydelGT78Exsk2VpaMtjxly8DXXo2vyB8wl/1pEYscPcSqiGqJQpzzHtG5CJccp0dWyPYbl3Wd9O9GHgiZwKFYvPwU4Ush8YdSvtmu7sceKDloRVmJ9O9bIdV8FpJ+jaR1JW1sVNmlsyVLj02JqZXxNu5OV5PccGreQ2JRzdM0sW8Mb+2hsN106/6MaSBh0niZngiPY4xP78znuN2C0+NaO8n2kjBULLo1bJyen2wA8Hwtuxs7mXItA1mVs1P/J72qxmngNR3MxvavrHDePsm8+MtgyjFMozxUqD4g/Q81TKihrVc53uj7gk6+M4h5oqUkt0Q2VUDEw0yV7+AoALxpWqzz3AknWnpIrPe7X6QrasxPoMCcc3PQX5y9HWcqGtrEq2hI6GJ3dcl8ijWtX/nbHYvXaPM361MXBfE4hWsQqvZKnpqaBf1dAy/HK4DurIaTop9nb2DGuTLGPBJPHTtnvyqq0EYwBJfYOMdD4H4SIcGSBW+IGpTLNpme0DPTOhqVFWQT4j6/2qUw7vVk8alztxRRkqSLQZjnvG7h2NHYLyKC4GdHpVLANSr01PzIpgQ/qOKqMBNggg/EgN0x7s6OY/NKntFwmp1TndFcyCpR9Vcz50Rk3khVqLeSBG9rJzGC0k50IcOHjYj5pcqUEPbh7R4XZ57WVToZnuPvju36iJ4mUCjfEs6vjv4iiM/+d8wgU2JU+x+ooY6kiDQnfpuv/O1+/1XwnDvWwxKbOQ+mUOJN6UaUSzaasdAQzS8QdajH5gwemqKhyope6dj+cU2xyUbzk1VYhkoYoBYZrfeyZCS0o75wDJjnQeQcLCyXHxL9V9us0kYpX Gow0ofnO ug8DoYyw1ur+0eWQSGXJrdot0o4I3ZWNBE/U2t65OrN8YmvRq1m6gYFFRb+jzKw3Nhs5umB/HBExgYuS7rzYYhKezkiIN/sed4Xc2F06vuhS4VBS/5kBGvkVCEdaL8YLHKW8bTUKcOxd+8rTBuEueAA/webL4ewZL/MHDSuuwvYZCK7D1/zrMswVHgkUBgl2miypC8m2G0uN8osifi/X2RfCJGayUqFlfjbaQJnfW3zsOqw3YAdaiy23x4sN1LsuSuAxHES0sHCogC+8i32uZ4iesOeZdBqmapGmQPCwHotlfiFE/I5qcWyzNsCl57DlHwToqKLfGL3xRsiw= 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. This is a preparation for documenting a new hypercall. Signed-off-by: David Hildenbrand --- Documentation/virt/kvm/s390/s390-diag.rst | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/Documentation/virt/kvm/s390/s390-diag.rst b/Documentation/virt/kvm/s390/s390-diag.rst index ca85f030eb0b..d9b7c6cbc99e 100644 --- a/Documentation/virt/kvm/s390/s390-diag.rst +++ b/Documentation/virt/kvm/s390/s390-diag.rst @@ -35,15 +35,16 @@ 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 From patchwork Mon Oct 14 14:46:15 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Hildenbrand X-Patchwork-Id: 13835142 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 C6D44D1627E for ; Mon, 14 Oct 2024 14:47:02 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 51E076B0093; Mon, 14 Oct 2024 10:47:02 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 4A5F46B0095; Mon, 14 Oct 2024 10:47:02 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 31FB86B0096; Mon, 14 Oct 2024 10:47:02 -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 109D26B0093 for ; Mon, 14 Oct 2024 10:47:02 -0400 (EDT) Received: from smtpin16.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay09.hostedemail.com (Postfix) with ESMTP id 11D2E81076 for ; Mon, 14 Oct 2024 14:46:55 +0000 (UTC) X-FDA: 82672484916.16.77470AD Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by imf28.hostedemail.com (Postfix) with ESMTP id 06C0AC0009 for ; Mon, 14 Oct 2024 14:46:53 +0000 (UTC) Authentication-Results: imf28.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=P3OkWOmk; spf=pass (imf28.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=1728917077; 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=4Os76zwoG6jFijiPcIPH9iCyJSDWZb0dHletZ1AI4lw=; b=bL3KnKsZ4uc2ysTjcWBLERCyYqVYuz9EWMA5iI7korn8qfOXXz/jhhmCy+wc5dU8Lo04Yl 7jsJm1WLiY2wBW5USrxDj1dpppuikyyon4auS3not22xKnPXCaa/vpTquRFivjNQRNwAc5 r5SuVZzCcaTaj8I5kiyQXz52n/gwrLI= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1728917077; a=rsa-sha256; cv=none; b=7pNh2INIubyHBpGXBnc4HkoF1A7pMZ+RjQUtCn+824otbUBmrnxd0NkIY/9nLJeJgeUyFD h2TPQPiSYtj+K1+oll7mpqE/rhDD0W7opHCZpwM+gpOWqO609ELDrKUU38wi/9DmsULtm7 spUJhiGkerSJnXHXa+0Y1CDrtMqD6Js= ARC-Authentication-Results: i=1; imf28.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=P3OkWOmk; spf=pass (imf28.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 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1728917219; 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=4Os76zwoG6jFijiPcIPH9iCyJSDWZb0dHletZ1AI4lw=; b=P3OkWOmk+8hYvGlubXH4aK0BEF0tu2EXYLSAfRktVfpeBsUlGipXSV7jUkw9GmzsVUJnui 4i6R1+oeM4EL4R9Pm4BsIi/ya8jnSuDZyAXs2J9ovaBwXL60geb8tI4HM67U+xsNsgZ80J bhYRuK2eSOeZO7hmmwfkduXAC4QtVPA= Received: from mx-prod-mc-04.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-677-xXFMHelCOC6T9rvvopYX6w-1; Mon, 14 Oct 2024 10:46:56 -0400 X-MC-Unique: xXFMHelCOC6T9rvvopYX6w-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-04.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 3DEEF19560BC; Mon, 14 Oct 2024 14:46:54 +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 A52E41955E8F; Mon, 14 Oct 2024 14:46:47 +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 3/7] Documentation: s390-diag.rst: document diag500(STORAGE LIMIT) subfunction Date: Mon, 14 Oct 2024 16:46:15 +0200 Message-ID: <20241014144622.876731-4-david@redhat.com> In-Reply-To: <20241014144622.876731-1-david@redhat.com> References: <20241014144622.876731-1-david@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.0 on 10.30.177.17 X-Stat-Signature: nzydy4j813gburgp5d9xpb9gcgqdpnuk X-Rspamd-Queue-Id: 06C0AC0009 X-Rspam-User: X-Rspamd-Server: rspam08 X-HE-Tag: 1728917213-449570 X-HE-Meta: U2FsdGVkX19JwyrYbbQshvEtkJp18/KQCePjNRupks1nHK5gJRcSTeiEn/6IqXknHDdppPt4cqUZLDPgp4tyCKfJeFAPYlc3/rTqTsAhT8s/cC+8Zo3eP2zeBOICH0xZFWGjKuMIMocdmDWOMB2iEELYzSp8VFUygNbxIgEEqDWW1j9EIIeLyJFGZjd5YEPYdKM11H93LxdcutOkP0m63AQA2o0+0U0X4+J8I93LSWR8n1GJIkKN788/5xVuV/iaGxLwb1nOHZnd1EuFCnCygQxiNFmUP0wPiSl/AMeCqgc7yEUNFJZGoYcdB1I9UPJv5gUtMLUzpIKq3dBs1CyqQsTdLh86toEfgFIwLPjhcCPko2G+xwBk6eJZ+iXr9MHerMo2jF26oFwsnbCGr4z0oRpNy3JMe641kXJdw05eYh420prcJRrpgia4qd+g1t4/k0+lUPBBB3KXAagQg29lSMbmygI+ivMv9MH/30LmcXccU/pp2sESS+JgBLILiEYMlrUaZk/mGI4pu5Zvjmiu6E6oGeguDlPlSyqVaJvxStbMvbORCAnOMOz1bc9u4l9CD15OJeGUukbcUCyr5IO39iQEtfeuaYu4NG4KvnD/eo8x7UbQDA/SY4X0KolBjbi++F+8mguJSXoeXimjkxiDeCGEfxI86xdC1mLNNCRzKr2Q3G5anXfC/040fUTLNjmtVU5RgpeEFViFuhEk5gWHKArohfstWJPlBROpJU5ieAM+Be7KedzHcs/CfP94EIzYWPXx4B4IlnXX3W7Ej7UFJUxUbuRksknX2koQHAWOEGmbz0cd+LZs9/2c/u2FD1sTGwJlEvc0vyKKi7hSK0u5/e7Y+9VXj7tNXLtL67MpefaZ+QqvyHUVia2w7Oq7bR3eztSIc18xj92FwVfTtV/istR753Ppiwa8mu8k1F9PvfxH5J8gUkFEZqK5kGTZdjjojczFDZEggktMKR2kZip vI7Fv6il spIAYTyFSxiP+OvQ9Zij1AH4qf9xEmEcSlVrtRk9bpS8siG/5sHmDgetqak5sTGNG8vaeBIPZCeIKpXm7QZMmeVkR5d79u7w28r3oiuY4qb0l2cBa39gQ9xB9ukdGiH+emjx6cMoiloODi+n+zw1J0em0f9Xrx3UtJn33MmX6tWvfBqiJj8bq9e0VgntWoLPYPBwAxWIeBCr7TZU0wBUgBxp4G5ROcMejk5ibbV/O5Ivdm2nGcUQTmyjvFvxvIFNhmllWoWeeTkl5UvoCUm/nHFDPoZNYSj3DM+P53uAgsReMuI4+5zDofBJx1X496WtHCJindg5YotMmq3I= 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 d9b7c6cbc99e..c69c6e0fa71b 100644 --- a/Documentation/virt/kvm/s390/s390-diag.rst +++ b/Documentation/virt/kvm/s390/s390-diag.rst @@ -77,6 +77,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 Mon Oct 14 14:46:16 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Hildenbrand X-Patchwork-Id: 13835143 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 BB646D1627E for ; Mon, 14 Oct 2024 14:47:11 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 4F56B6B0096; Mon, 14 Oct 2024 10:47:11 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 47F176B0098; Mon, 14 Oct 2024 10:47:11 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 2F8C06B0099; Mon, 14 Oct 2024 10:47:11 -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 0B4786B0096 for ; Mon, 14 Oct 2024 10:47:11 -0400 (EDT) Received: from smtpin05.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay05.hostedemail.com (Postfix) with ESMTP id 6A48141028 for ; Mon, 14 Oct 2024 14:47:05 +0000 (UTC) X-FDA: 82672485252.05.4A45021 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by imf05.hostedemail.com (Postfix) with ESMTP id D460D100013 for ; Mon, 14 Oct 2024 14:46:56 +0000 (UTC) Authentication-Results: imf05.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=PPwt6Lu+; spf=pass (imf05.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=1728917156; 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=jQUFS3Gk+h07Pyzz5SlEqpZc8ARhWR4alZK+qKnRzag=; b=OtnqOc6XOn8DVhd8KrNbzD/7wtPg1Klcgg/yZ/fjfqNqOOdfxaCgV3tekamWX1uY6cuAVz 5xqDfvRZR9NMMU61GrIBCFmxWudi6SahNOI3vI0XiQ+8mvbi4pRyy5uPxMr+VYiqz1T88X fPJnKMc0AvJE6dtsqCrno/ROrdNQMHc= ARC-Authentication-Results: i=1; imf05.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=PPwt6Lu+; spf=pass (imf05.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=1728917156; a=rsa-sha256; cv=none; b=MXCC2t4vFZ+/2WTwXFX1y3LDLmrKOKU0yBL1DBgP24tci94V4Cl5Oqf/tcSsyWNABilVk9 rAwEe5ZRI/Cski2odY53lig1gFsOwejVFZMMmBKWF48SoVhAw9RXshgHIf/wk20dIKu7xa eNhM/1FAVa5SfiOpZdI2Vb9CkX49HLw= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1728917228; 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=jQUFS3Gk+h07Pyzz5SlEqpZc8ARhWR4alZK+qKnRzag=; b=PPwt6Lu+rc/bDPm+uBZjcj27xRGA8GtVwtfyi2Jv2foSCu4Vgn3rBI5IHeJZ9w5thhKJpB WJLtB/1MMDJ4OKcx5+2xfAQ85jkixKNSBbF6bffJmXhlbWYLYg5zK0jCB659lzBSP5Ub4b /Ky6vLBzwCkoHG7XH2Psaqmz0fm26gE= Received: from mx-prod-mc-04.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-453-gZo0ZuGeNOKYSOCW-Fnf8w-1; Mon, 14 Oct 2024 10:47:04 -0400 X-MC-Unique: gZo0ZuGeNOKYSOCW-Fnf8w-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-04.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 3D72E1955F42; Mon, 14 Oct 2024 14:47:02 +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 CDE7B1955E93; Mon, 14 Oct 2024 14:46:54 +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 , Mario Casquero Subject: [PATCH v2 4/7] s390/physmem_info: query diag500(STORAGE LIMIT) to support QEMU/KVM memory devices Date: Mon, 14 Oct 2024 16:46:16 +0200 Message-ID: <20241014144622.876731-5-david@redhat.com> In-Reply-To: <20241014144622.876731-1-david@redhat.com> References: <20241014144622.876731-1-david@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.0 on 10.30.177.17 X-Rspamd-Server: rspam03 X-Rspam-User: X-Rspamd-Queue-Id: D460D100013 X-Stat-Signature: zyq9kgzwxgjihrjoouggrxf6c53na83b X-HE-Tag: 1728917216-978250 X-HE-Meta: U2FsdGVkX1+LTzIXO23B1XZYq2k+m1bBIB01FrfdbmtX9B8YOQNb/37/y5UiOgOjU8wSUBMqA4Ci0kfGVUPYUtplGVBiMwJ+Pj74p6vjC0T+iqCCvfM47v95u4WHNtUTGAgpns/KmJeCHXpXoQ2EEzylQw3QV693e/8jjagzrTrOB4ALslyD/PGyAjgG9NuBBZAaIfQvT70oqME9slOrUUKnPkY036Wqf1bCs6qdz4MvtivkiK6M4MeN/R8P3EAvRTn7ABwA2GAYs+tZyrRtzbqwQmTqij52QW0bmFiJPZ+vr9PCxvDqgGRfNNNiZkb2t3yyLZzBDKlX1oFrok0V6MAHyp0jFJMouDltZviK3oFna3yyFkUyVNnty+pKc6+FfMblHaS+HiwY7kNp5nq1w60VpqfOhVkb84Y/bUKCvMprUIhr7y5xGyBKign8T/SYM4utMd5mJWDVv23gkfc+N+KTwJSNYuAXrP5dBWnIf3U2+AaQd3PzlbPNWsXVM6HgC+WANV69e+PBa4E6t8eVB2mkFeb8PRE3SJTgis9dET3p6QZeD1wsCfGB5zWK/D6+Il6rLFtLvRRgM/5bmhBWnRFFAa+5/qYzkMy5M6E8I8UTJJdcZbSWTsg3ocZuwAonB0cT1RpUdltoL2SiiSbKRe0ZUibhJNpWDqx/Jshij0JtacYZXpd5LuUD0QF4tfA7JoP6x6tS6KjuCZWsJ3ORYDZeC3hkgyp81ureSPRTfzxzNVn704VW2Cz+9DSK9JZP7hk1Y47inG4BbjxXsROcmnC3G+4wxxrnuyXTBLnHTJtSEET26feH9bCaJDRaTQP06a1b2g1qTs4coQ1WjTz/lUUSfNIKfjYTzUNWymtT23eaytZ6o9RpV7pwRTnPrq/yzm5d3fnKomEs7KIT3Zouiph7KHbu2PtWd4jxHgoF3bW0ppP307JdZ9TfR75oiH6xFmA729ipr+8qy8sXSC2 W5W7bbV4 P2Iz2mVmoGDojHpMwRc1GM44viYU+v3N2WLihWiIADZO/IzoJUAa/DPFW6A2QIAxvSyfI4qp8r/Y+3fznyMzy+Vi2PGUomCMfOPKtq8goDvwygEbwZg302X1/tSaWV4MThwflY43HfqV72MvQbvnHVqUi3FVlpI9hVHWmKBCiwV5clOWayoRcn22DhkzuczeKFGGsKP4tqmD4Z1NWJm4ogvq9stO4iwLIsY6+/cTPUAYCBqiDEDk+1jBAzDe3aIpDOfksAFsKXMcAKlzHba9srfqwIsueMJRvnt19fkvAvyoQ5GxFF3VgppPqBmbOKcDMW4S8icPlCHJY/2PzAQOC6FdaYiRhDmEmxK5Pbjr89n9YXi0lrpuMy79AOA== 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). Tested-by: Mario Casquero Signed-off-by: David Hildenbrand Reviewed-by: Alexander Gordeev --- arch/s390/boot/physmem_info.c | 46 ++++++++++++++++++++++++++-- arch/s390/include/asm/physmem_info.h | 3 ++ 2 files changed, 46 insertions(+), 3 deletions(-) diff --git a/arch/s390/boot/physmem_info.c b/arch/s390/boot/physmem_info.c index 1d131a81cb8b..fb4e66e80fd8 100644 --- a/arch/s390/boot/physmem_info.c +++ b/arch/s390/boot/physmem_info.c @@ -109,6 +109,38 @@ static int diag260(void) return 0; } +static int diag500_storage_limit(unsigned long *max_physmem_end) +{ + register unsigned long __nr asm("1") = 0x4; + register unsigned long __storage_limit asm("2") = 0; + 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" + " diag 2,4,0x500\n" + "1: mvc 0(16,%[psw_pgm]),0(%[psw_old])\n" + : [reg1] "=&d" (reg1), + [reg2] "=&a" (reg2), + "+&d" (__storage_limit), + "=Q" (get_lowcore()->program_new_psw), + "=Q" (old) + : [psw_old] "a" (&old), + [psw_pgm] "a" (&get_lowcore()->program_new_psw), + "d" (__nr) + : "memory"); + 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 +189,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,11 +204,17 @@ 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; + return; } else if (!diag260()) { physmem_info.info_source = MEM_DETECT_DIAG260; - } else if (max_physmem_end) { - add_physmem_online_range(0, max_physmem_end); + return; + } else if (physmem_info.info_source == MEM_DETECT_DIAG500_STOR_LIMIT) { + max_physmem_end = 0; + if (!sclp_early_get_memsize(&max_physmem_end)) + physmem_info.info_source = MEM_DETECT_SCLP_READ_INFO; } + if (max_physmem_end) + add_physmem_online_range(0, max_physmem_end); } void physmem_set_usable_limit(unsigned long limit) 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 Mon Oct 14 14:46:17 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Hildenbrand X-Patchwork-Id: 13835144 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 376D0D16279 for ; Mon, 14 Oct 2024 14:47:19 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id BFB626B0099; Mon, 14 Oct 2024 10:47:18 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id B83726B009A; Mon, 14 Oct 2024 10:47:18 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 9FDF46B009B; Mon, 14 Oct 2024 10:47:18 -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 7C0826B0099 for ; Mon, 14 Oct 2024 10:47:18 -0400 (EDT) Received: from smtpin22.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay10.hostedemail.com (Postfix) with ESMTP id CEAAEC0CC4 for ; Mon, 14 Oct 2024 14:47:09 +0000 (UTC) X-FDA: 82672485588.22.61B24CE Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by imf28.hostedemail.com (Postfix) with ESMTP id 4F10CC001A for ; Mon, 14 Oct 2024 14:47:10 +0000 (UTC) Authentication-Results: imf28.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b="H/fnZ6UH"; spf=pass (imf28.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=1728917164; 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=eNutO1hsgpqcUEbfHgtLFq1UOgF2cMswuycNM8rERoo=; b=hCqB2/WCWzwsFXE3kMhhG5iU1Ao99UWj0iA0aYH9XR6jwDd/JQ1rOM2J/fN4c42U5kc3Oi S7a3BvP7ckhN+q6cjfVT5KkBmx3jSETnx1pUxHA3EeldKWU56qY8xVepBVpOXZn1gFNp9w f4jrOfPfzwdqf5rMAPYHZps8ILywO6A= ARC-Authentication-Results: i=1; imf28.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b="H/fnZ6UH"; spf=pass (imf28.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=1728917164; a=rsa-sha256; cv=none; b=LNW4tM0gNPiPRSAjAPBCPg0JsU+ylSFUFJzjXHaVCdmIAP6+F2Zo+4SbNFNcH0XIhuJA6h HbFxUI8Pf/IufEp/XvtiSgiBghsP7ICZJstVc+R3LoippaS0eMi9uycqZNiwfZZtY/B1VX 8FwfmlyyFo3mzM/uz6SYFM4mVuFRfg8= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1728917235; 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=eNutO1hsgpqcUEbfHgtLFq1UOgF2cMswuycNM8rERoo=; b=H/fnZ6UHwACmvgJw2lIbfxKBLtPvCj4PEiFuWKhetno7u5RNNyD0vFPtcMcF+DhApSC9rr SUDOyEm0+4eKsYD+oV65gJA0QKZNmH/9n7MP3kiBwO2W/s6uAx3WTYwZPQJpcWPXlHuAk6 IUnK+ePlN4uUCFDLkQ841gaSw/xsWGA= 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-387-aFyz8o1aOxaBv2Y6jRkjlg-1; Mon, 14 Oct 2024 10:47:12 -0400 X-MC-Unique: aFyz8o1aOxaBv2Y6jRkjlg-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 E358A195608B; Mon, 14 Oct 2024 14:47:09 +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 B54F31955E93; Mon, 14 Oct 2024 14:47:02 +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 , Mario Casquero Subject: [PATCH v2 5/7] virtio-mem: s390 support Date: Mon, 14 Oct 2024 16:46:17 +0200 Message-ID: <20241014144622.876731-6-david@redhat.com> In-Reply-To: <20241014144622.876731-1-david@redhat.com> References: <20241014144622.876731-1-david@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.0 on 10.30.177.17 X-Rspamd-Server: rspam03 X-Rspam-User: X-Rspamd-Queue-Id: 4F10CC001A X-Stat-Signature: zgqpeib5dinyjyirpzqrtfrqz7wwfbkb X-HE-Tag: 1728917230-885089 X-HE-Meta: U2FsdGVkX1/VSoYE5MswDTXeIv/HPBNj66moUdSq0wG4MYnjbunODqO/Fbb2IIbTtb8OUVuWBZFpu5Ky6cJzi0ywsBlh9Xef0vBXEVcvXD79hNKB6VOkdNJNMel3ixeJ+r6ZygAEgu394ZynHy+Dm+263veeGHhbCQM7KIllQq02JpyY32Prft+57aKaqFyhO4PIgy5p5Y2R6Trq860LYcCNyXo/33gQxPRj4CCLPqloZV4C5sAonsNKzMHjEWp5wKtlrOtLnZ5FCADlYKzO5VYUWAetOtkrV8A7vjGt1uXp9cgzZ/RRw12xZI6i2t/bYeL7LE21IKLTl6smiByXZK7HlL502LpNy8lP5ZolNgqOcHJERytwMmldXxlthbfnhHJbuRUPl7a2QQWb5r296fq5oaX4WHt5WTi15Sr6MfpIYUcbNiUv6kcvPAE9Wr2vsY4usZ77ffeHr03eKEu0gHN+tNwKbMtOQwHyfEiY2i5SBGfHcuTPQ+CpAVGfXZM/BlD512LGagXpuhbmk4mjvu6ADPyT4HHpQvc+3/doTptAWjrlVot/D9u8A+eKpDhwDI6RY5VD6omS2lwAzxLAaOcE+hsozxNE/+Kw+iDNrMzw/78P5ktgMkWXSif+ZZKi3IfoH72aqfpaZ0n1JU/PtFsGPywVonXy5V+LsaHE73yfAZsabB0xCRf+Ix0FC95+9qKybfFJvnLPRXi8jAtEb1rX9VTKa7eq9Uo329QY7qgXOlMKyr00OYPXxVKRqgKJ3AJzvPig7jfCLdIUtrBR9I+zPFnhCGFD2K/e+v0+5kyT7r9wOOA2D5N5cXFfEkmFAH1cYLZ2b9p4KZP91aktUvMoX5REIXU06uLtxJTHCjyJrtprLFHB1VdjEEiJh0HfSk2bKPY2QYvhSdffTuwVFEbdWpy70Q6J9WIIGYKBNveb2WTu8lnfpwaaksIEB9oy3AGcyqgu/Njyxepz+5c Y5V1gvxi ZCYQVEVT+PA6+oZEQQkEhc0JyIn/fdI9foDJSy7CvXbssIl8tbnEDyxaIZs3tzk/6ugKb/VQU47s55NqQWwju/6EveOGgOFcACo8NQzx6LooPvHDTGQNaRPovkAnmTMKkzyXUvmyzmyNL7TdkgA5IxAj/8LQ/X8ptXDJZOhg34qzOkx+7xkGiXJHPeOxMJfXM0bbuVwH8rQ1LIIgqlle6czBwMujtMLngWefE8N6hN8GKhWtmXc8Q6NC4eIvT2ENCXaNkuc30eb1c5cjX4y8FR1ss0Wr4EkZFCevwQjRVdQZpvPXXVCdv9m9hU9BYhifvn4SGMSC9G4YvRc8= 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..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. From patchwork Mon Oct 14 14:46:18 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Hildenbrand X-Patchwork-Id: 13835145 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 37161D1627E for ; Mon, 14 Oct 2024 14:47:26 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id BAC486B009B; Mon, 14 Oct 2024 10:47:25 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id B5C6F6B009C; Mon, 14 Oct 2024 10:47:25 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 9D7BE6B009D; Mon, 14 Oct 2024 10:47:25 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0014.hostedemail.com [216.40.44.14]) by kanga.kvack.org (Postfix) with ESMTP id 770126B009B for ; Mon, 14 Oct 2024 10:47:25 -0400 (EDT) Received: from smtpin06.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay03.hostedemail.com (Postfix) with ESMTP id C7BE0A0F48 for ; Mon, 14 Oct 2024 14:47:10 +0000 (UTC) X-FDA: 82672485840.06.07FD29E Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by imf16.hostedemail.com (Postfix) with ESMTP id 57CFC180015 for ; Mon, 14 Oct 2024 14:47:17 +0000 (UTC) Authentication-Results: imf16.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=D4+emzVa; dmarc=pass (policy=none) header.from=redhat.com; spf=pass (imf16.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=1728917128; a=rsa-sha256; cv=none; b=NQSMt2laRR+C63sJUAw1PQFll8eDK5mmUSSOhSSmg+C/H1MN/DLP8rYEUmG/KLKVwGhL5b ymGloW4xOhnHiNYj3GXYKqRZmZmmhFKj1Jwbw0QjtZIelImdGFs4zPu3x7fr0RSax7KmDY GrJIB8+kp8EEQ/MXoCQ7jT+XR+5QlIs= ARC-Authentication-Results: i=1; imf16.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=D4+emzVa; dmarc=pass (policy=none) header.from=redhat.com; spf=pass (imf16.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=1728917128; 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=TEhGx1JLq9dSKRa67DDmtCgVp6iAA+J1mNausVPzC38=; b=YHEb8CpnlYwoZnL2IdTzzhyYqc/auJKX5N1TrzmED4fxqAyAjHIuTDhOeRF+/hYEERbokn PpeS/tVJUes5Ar6YAiRhtJrD64sSnxCIA9I8GRzPrLYnERrAy2DD4CsknLaAiMAePm+VHh s+oS5HjNcPLlnqzMfYyuMYoOP6RLSTs= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1728917242; 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=TEhGx1JLq9dSKRa67DDmtCgVp6iAA+J1mNausVPzC38=; b=D4+emzVa8gi5WcZj8DVqlo+9NUF6aOZ34opGUilY1VmyjeqAES9tmRCh2LDB2GZZt5zBYj KFAkZF26rFl5aGPVYS1jimziCjcYC79KaQZ1peMvRch97eQphu2GP8Ro/LqsmUQb8lj39A ayb80iwxTOwDic6KIuGtyYNfAgDXtKw= Received: from mx-prod-mc-04.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-643-EvDDUXnzPSm_Vd_naOQgNw-1; Mon, 14 Oct 2024 10:47:19 -0400 X-MC-Unique: EvDDUXnzPSm_Vd_naOQgNw-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-04.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 6078819560B5; Mon, 14 Oct 2024 14:47:17 +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 7C87E1955E8F; Mon, 14 Oct 2024 14:47: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?= , Andrew Morton , Jonathan Corbet , Mario Casquero Subject: [PATCH v2 6/7] lib/Kconfig.debug: default STRICT_DEVMEM to "y" on s390 Date: Mon, 14 Oct 2024 16:46:18 +0200 Message-ID: <20241014144622.876731-7-david@redhat.com> In-Reply-To: <20241014144622.876731-1-david@redhat.com> References: <20241014144622.876731-1-david@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.0 on 10.30.177.17 X-Rspamd-Server: rspam12 X-Rspamd-Queue-Id: 57CFC180015 X-Stat-Signature: cjnwzt96nkk5re4b7uxsym5wa5xoceso X-Rspam-User: X-HE-Tag: 1728917237-849459 X-HE-Meta: U2FsdGVkX19xsGp4NcAVg48bDbCQE4l8wQNc+2jBQH88AMLFP2GEtIgTrSCbLZFCOv0Xr2Mdu7W4720F3+hCkcaH+VyHxvstcTBCMSVt0NuEru2Lr7NXQaskLxzKctM3WiqrzoxFw7GgNxhUCUvL3Rq4efBMm5QSNqU2m7uvi/nXBi4690850MFbIildhKNqZlvrCvAohixmD4bQEt6qL/j39wTEMVKPiqt1WcJ4lGHPmiq6d2y4CJJ6+XIvKOeePPkVvNxyE0fyspJjm6xMG6bWPzZpbIhI4CQ/5LI2jg7U4tDITlXwxERDSb+M46lMM6cc65Kyx4aAhKYfnC9djHlp85KMUsn1Mp1sYAxLjw9Vh8L8+JuAnqtAekU2qC1VvDrJtIkStb6j/Td/rjFlkntIn0vmPkQJN1M96ErzDvYYkjxWmpzSoODNP6WEfgHirKmK/4T6zSng6Dt7hAD/G6digxdLcl/OfuHY7RTbIf4FPrDpnQ91vfyX+2pPzIpvkBWeMwml8zjYUD3wHw0wTuEJJeo1vFJ/1BQl5FT8kbmFNngfSpJkJjppguUSTyD/lXVDERhBe/bHlFWgq171yTLQH7F4Ow90FLU3hvIkHcIAa00UzQvWM+eoiX+tA5vTfFebafsZJYy0u+yGJ+LAJmhaKqi9uO+FAiCjIXkGIEMdNEIKUGhKtUyn83ElQtjKBOry89F6EOp6ja7xu+Qgf8twDKc8x1qavrTh7XyatvbRomb11ORt2l+ckZAlS7E4TlGmJZd0kqO2SEK/eImBsfxckLMh+90J17fmszpSghUkGQkzKGZ/wtQsN4aPgc8FlzWjR4zSzauuMu+4HyYJ5VK8mi8nyBej6+o602OavfEfDdmQ56EkQWBL13DXbV1Jvo9J564n4eVDyeTqaruoLUHwOeizznsCCTkpZ1wPuaYKzitOh1jgzWNe89wLWWxyAh0JyGHPbqt9LTNWJyK YLY2kBol LZTJikiXGb3Xwrstw4IVPpqZuHRar0szbkBuvTfPv9v+QP50jXUEAGLyL02ve7yO/LYczK5NfmRVV0ST35p5CVXHrezqYL7NcESYcSoZIE5LNgAHyR4Dbl/tjFHYVRYKja53Q3C+wBv0hNWPwm/hgb7nBR1OhRLQ8btqbj1MDWn05TRlnaagAgvnGpLY9k4SpUcF6pvdUaA5p40gy+T9OXdhp1QQJrYaV1QD1/6kB4T7308t3uISsIW6kddfqcR1/YNwRcegL2W9toQoH1VW/OoQQ5K7AhtfaLF7bNPwqlZedh7nZ0J+1R7zGu7xOMxKb3c2vpFqvwiAZbZCxpVrjNFj28K5FaNRBcPYHG/iDLTqzmO8U+AFmvTqxgg== 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 Signed-off-by: David Hildenbrand Acked-by: Heiko Carstens --- lib/Kconfig.debug | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/Kconfig.debug b/lib/Kconfig.debug index 7315f643817a..e7a917540e2a 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 Mon Oct 14 14:46:19 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Hildenbrand X-Patchwork-Id: 13835162 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 0B264D16279 for ; Mon, 14 Oct 2024 14:47:34 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 989C06B009D; Mon, 14 Oct 2024 10:47:33 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 9129D6B009E; Mon, 14 Oct 2024 10:47:33 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 78CAC6B009F; Mon, 14 Oct 2024 10:47:33 -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 550B86B009D for ; Mon, 14 Oct 2024 10:47:33 -0400 (EDT) Received: from smtpin05.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay05.hostedemail.com (Postfix) with ESMTP id 3ADD841033 for ; Mon, 14 Oct 2024 14:47:28 +0000 (UTC) X-FDA: 82672486218.05.9C1BA64 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by imf18.hostedemail.com (Postfix) with ESMTP id C503B1C0005 for ; Mon, 14 Oct 2024 14:47:28 +0000 (UTC) Authentication-Results: imf18.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=Xcgtso2C; spf=pass (imf18.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=1728917110; 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=3vLbVvz73tLbmbnaPx4ieOXFlBDH6z0eEi0A+B6nUW0=; b=vf0h+5tggb2oCdYTTqzn42cLDEn5hToI4AnFyWzPKMQMgXMfH6W8p1Aw+4wMaFkiBc2QOF EHD+M1wKA81EGfyeHMA3BP+qBMgcGwJ3Gzeq5Mb1Gl0ndOSVuACKjGSSAC5APzkA17eLXG VrD2lN3n6F42MfrIJal6z9TwBdGgdgc= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1728917110; a=rsa-sha256; cv=none; b=iR2xokNT60USS71noYFlT7oxPkoykYjMwEfXyuQeSyJ0mhfHcQBpcJSuGnTXft5FkuSrJh hv82KyiWXAtJ0IMfc884/w7R/sXn1l/sPAb/3QoCRIBM8u6v98x4/HozNiYh5ndFiUJnL+ NvbwkzD8/WN8bJsTlclCoPUjfCD0VFM= ARC-Authentication-Results: i=1; imf18.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=Xcgtso2C; spf=pass (imf18.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 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1728917250; 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=3vLbVvz73tLbmbnaPx4ieOXFlBDH6z0eEi0A+B6nUW0=; b=Xcgtso2CPr3HpKcRZ0gM0ztTPXozzLlgCR3ZOYTfjVjcl/6gfmsj1ZTvsMDNCvSKMOQ5Mn FTq5TCRuB4FHMjBTZ8WG79tLodF+cZ4lAIRcrp9xlCcOgPnpNVGdtgcDypMd8TRBRpz625 taOPGWG/3TLuJC2bhKIm6Af4+Vrvq7o= 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-589-8KXKzAUyOoGjGD-HwYImmg-1; Mon, 14 Oct 2024 10:47:27 -0400 X-MC-Unique: 8KXKzAUyOoGjGD-HwYImmg-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-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 7F38F1955F07; Mon, 14 Oct 2024 14:47:25 +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 F09031955E8F; Mon, 14 Oct 2024 14:47:17 +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 , Mario Casquero Subject: [PATCH v2 7/7] s390/sparsemem: reduce section size to 128 MiB Date: Mon, 14 Oct 2024 16:46:19 +0200 Message-ID: <20241014144622.876731-8-david@redhat.com> In-Reply-To: <20241014144622.876731-1-david@redhat.com> References: <20241014144622.876731-1-david@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.0 on 10.30.177.17 X-Rspamd-Queue-Id: C503B1C0005 X-Stat-Signature: 3fq1cfhytw5yow4pxjrm7fx1efopda13 X-Rspamd-Server: rspam09 X-Rspam-User: X-HE-Tag: 1728917248-887320 X-HE-Meta: U2FsdGVkX19AIlCS09QEpbjHGURH1qc8AHOTDFEkNkJZALmUzO6hra5y1/wIK/o2jGgO/GIDmHMDDASb4zJUARAE8YpRGpNzfAALVboOjvsPYrnUluvGHqG/Cg1NgHXIAPjqXnkwVFSCEwu6M+GMwyZJiABZJRIM6EEONdHvw3LYhcIDQPugRLMtNylr/GKFHivK2Z4qN2hwEbJHK1T9Dl6y3Tv+Ma6MXRvvSmctiNVfpKFSdEwjUUjPxnHrg3Aek9lSxPVUBvXs5k/1vta8xGaNrW1XV31YKm+zMeB05iJPUb/od+IWqxTW1ZfcN02DuAakTSf0NHppeRNbtkgM1iPRUPRkqlBQE+CYrETRGSJPAYWtTLcgsVuMj4blsIvRNSiSkSbZm5lB5kaAijJMRogYLQRtzBrrqqwx62T1szLsuzjW+v3yRuv4s7tDCXamV5QfnhHJDeQDF5yxHR1e1jo6yEBbIurmI3AtZA3hmGhVr8KuZ9JR0KgVwEvAJ/LjyuJNeNZfhlIfdBz6A3+I8vdftwMa9rAk5Ul6/p8NBx0wcnJ5sfGfUBT3AQniWTsw4/T1flXg7kZlw/gau1ULDVBDcAF2mk93PLfAvjf7yPQwQkeWMx7azyx4W00nCgs+6802Px/TCq7TIMi59kb3YBACzHb+RodPfaEj/zlxXXyppSR/O2d52ZNDz5US1BBCJ3Ut+uw+N7yX/ratkVv1+k+qYs85ah0qpRUjgiWbOBHVcKjH/JSq8RyyGuNekpQjParCaVvD4Dm/XZSwzyLkMerauTEukzNAqfGZyauQ1oX7q9TdOcwMADM56LBjrr/150Idp+3SFYgaHtgB3K26YezkjMLDJr5dRZz7P9MBZuKLYyJHCQH4wV9yaE/P/0Ml4BSFzLHQFsNqsixBHTeC7ZPjLRPe9O7oSrXoMR/UxQsVTXJG0OFyNzadjahb983LdNrGLvj8GVmfO1N/uYt JhOt5Sne AbMmBzqgkESxFQSIxkM2O74gMiWn23t3PuorfMmEr1Y7OO8QlQxjQcHJVtwhHIbJp0/iEVhBpILHdvEw2yxzxcYC82M25SRYSnWUDXyYJP/Ee+LtvS1fMTG6rkxeBhDs5aHW5Bi2dwSePFhFX4rzzvpwoZ/5kSQb7rz6bYIWEvzlT4YDUP9cSk6OnLsHhu/dwlQJ3mPYo7MpBcTw9R7QsBXZuxk6bnzITrWLs7c0P828zSH1fH7rV2hOjY/DYSWzj8MlPqhU7FEgD6eN8MV6AS3Cce/wskxbKOncwg430nk2DSDZ5KpfZRckqd0N6IzVD0SIgyOpjxMOteFA= 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. Likely the reason was that we'd expect a storage increment size of 256 MiB under z/VM back then. As we didn't support memory blocks spanning multiple memory sections, we would have had to handle having multiple memory blocks for a single storage increment, which complicates things. Although that issue reappeared with even bigger storage increment sizes later, nowadays we have memory blocks that can span multiple memory sections and we avoid any such issue completely. 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 te 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 Signed-off-by: David Hildenbrand Acked-by: Heiko Carstens --- 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 */