From patchwork Thu Jul 13 14:55:47 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Hildenbrand X-Patchwork-Id: 13312324 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 5E8AFC0015E for ; Thu, 13 Jul 2023 14:56:02 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id D697D6B0072; Thu, 13 Jul 2023 10:56:01 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id D1A0E900035; Thu, 13 Jul 2023 10:56:01 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id BE1E290001C; Thu, 13 Jul 2023 10:56:01 -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 AF2596B0072 for ; Thu, 13 Jul 2023 10:56:01 -0400 (EDT) Received: from smtpin02.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay08.hostedemail.com (Postfix) with ESMTP id 89666140298 for ; Thu, 13 Jul 2023 14:55:59 +0000 (UTC) X-FDA: 81006888438.02.F6B6B24 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 C3830A001A for ; Thu, 13 Jul 2023 14:55:57 +0000 (UTC) Authentication-Results: imf25.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=EHkKqSCq; 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=1689260157; 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:references:dkim-signature; bh=LptuTpvFDZBRRZm7T2FbpKgVlUR80XdDNd96fLSIzt8=; b=mT6fGlRvmmlTVAa/p+Um8Ttq5ZJxHwpAEUqpR3RVNBwqs8lTY6aYIbWvj7sDMHvxG4ooTc jHRqtp5WvkD5gwNMF4sK2+14LknoN1FATTBgEIWYJzwouMYefKEWvAXh5S/SMe5ubhdyYc lKYH4iNlUzlJtNQhO1TwRprDNlB7ic4= ARC-Authentication-Results: i=1; imf25.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=EHkKqSCq; 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=1689260157; a=rsa-sha256; cv=none; b=Pywx1zINyUXJIkz7rjMTwygh1pq9ZL61aJOdJ0n/GYRgFzMkJIpKS6p7egywHZZec500xK F2FLTiQARLFlDGFXpUZV8843JXqjoY4p7gOO4b7dnq9E9Xt82tsMUFh11KFH+28VhUmLAr Rd3iA1PehGyNPwGPdUqI5YbDZ8RJ/Dc= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1689260157; 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; bh=LptuTpvFDZBRRZm7T2FbpKgVlUR80XdDNd96fLSIzt8=; b=EHkKqSCqyuJKkhl5C68xw691mKhVXVuEgZ2MUEwWRfpTxXm0O5TUb5/qrvAJ7PbM0nNVaS T0jhCi6x+xS1hpvlQk6uMO+RedbSpmC4o0ZrWFVwbgB/vw3RsxSKgYCe5vxvJEPrSKYX/n B1URlDSltmXBq3sY850bISD8JFS96cQ= Received: from mimecast-mx02.redhat.com (66.187.233.73 [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-327-UuHX7QVrOaKiCwlKvKf5PA-1; Thu, 13 Jul 2023 10:55:55 -0400 X-MC-Unique: UuHX7QVrOaKiCwlKvKf5PA-1 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 45E9E3C0F67B; Thu, 13 Jul 2023 14:55:55 +0000 (UTC) Received: from t14s.redhat.com (unknown [10.39.192.245]) by smtp.corp.redhat.com (Postfix) with ESMTP id 20A28F66CB; Thu, 13 Jul 2023 14:55:53 +0000 (UTC) From: David Hildenbrand To: linux-kernel@vger.kernel.org Cc: linux-mm@kvack.org, virtualization@lists.linux-foundation.org, David Hildenbrand , "Michael S. Tsirkin" , Jason Wang , Xuan Zhuo Subject: [PATCH v1 0/4] virtio-mem: memory unplug/offlining related cleanups Date: Thu, 13 Jul 2023 16:55:47 +0200 Message-ID: <20230713145551.2824980-1-david@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.5 X-Rspamd-Queue-Id: C3830A001A X-Rspam-User: X-Rspamd-Server: rspam02 X-Stat-Signature: 3tsc7c5t66r31tzpqmbcxmwhbzqr1eiz X-HE-Tag: 1689260157-994884 X-HE-Meta: U2FsdGVkX19sIM9CY3lTFQ+8j7bPyb94oasCs2zNJOPBtI0FjgMeG6pT5lXRTBZ/kVXiGqPlBo7SWHKzr6+IARlaQua9kU0+YjqFsDxpR8oTPufKPdW9BRvAz8T3SaIPKfQD+EPbo26oi/Ejo4nYn6xEL2V+EnENL4ggNhbP1T8TCI9PTp0ov7c6hTGVuzZJWz65nqndJ0Eolgb5YEyFMhnpWLBM4gV9P9MeHeI4T9tkPzUL5MTeVGjWcBRSIFoM4c6MwbAhNMl9DpK2Q/zZp9BVVZxGr8cvjYUPfcwHRr8IZWJ1Ztfsgt0EFOcmPZ0uuWXzcGeoDfgpB2LEmyDhVCk0pjxTGooOR4hOO2MB2KvT2m4lYrTRum70VGNwo8COcLTKifnN8FTqEidyPNAXCIN0D7tHgvasV5dSK5m1TXO3UuybQNVf4cvu8FfNrQjIbW3kTo/ND0+7wfRNlvKySgDXP+4Kz+IDTqW2Pg4WO2ygCX4Mx7naqUMcshdS0WoYBUQrPr0c3IidHrGVA4qcz+iATdiOCxA/we/xRj94mrT98K0xpybQ7kRSZfLF71SPj9xvYCKNvennK1Itpy+1RKGC0WPcqzjoPEPFqUxk8p9pHb1pWlfluIGwDEIIHmH3nyFSL5p2TVy88P4e/wpvDxwr2wB/AyhYcD3KZ5fRGJaVwY+k14zuZL0wY3PKOKcRGwz+vcUUuS861XqXChK7AqlxjCBLv1lKUcQz87mxYV9B7lIhgIf6a2ErvrRAZHZ5eK4n+rL7/5YoED/2uqbUt3IGhI+QKNRbrJwptP0PFqiEeTqZBgatbTlQadOY+pafF/gd4Ccb9as6g9gRdInQG1pzKLxWmKFFEBULhmEwzgcN8I0gfoFEi1oMcY6x2ER1tnaGrUMeIXHRgwVH8c6AxGIiX0mpnCQwtpLVp4DhaSq5Pr+YOwdYpa7+VWrzW8APT+aubY1/3tUCg3xZAOq o9RazQRR wY5ddPgJHkjLGg6T2a9XgwZ3byagQ+7IWC1uf/rdGfY2EjR6lMidGwkBtp4oBGdGtxCjCCCny/BN7Dz6SuCeJt2dBCxwjjESh6rFDtBF+bplM62PN+hhGud62WiPonndLrhfidR/ShwRt/fSNHyUr03FE0FbCjDsIPt+z47Glo8mNXSX/RAsy/dVAwMujl7q38ok7 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: Some cleanups+optimizations primarily around offline_and_remove_memory(). Patch #1 drops the "unsafe unplug" feature where we might get stuck in offline_and_remove_memory() forever. Patch #2 handles unexpected errors from offline_and_remove_memory() a bit nicer. Patch #3 handles the case where offline_and_remove_memory() failed and we want to retry later to remove a completely unplugged Linux memory block, to not have them waste memory forever. Patch #4 something I had lying around for longer, which reacts faster on config changes when unplugging memory. Cc: "Michael S. Tsirkin" Cc: Jason Wang Cc: Xuan Zhuo David Hildenbrand (4): virtio-mem: remove unsafe unplug in Big Block Mode (BBM) virtio-mem: convert most offline_and_remove_memory() errors to -EBUSY virtio-mem: keep retrying on offline_and_remove_memory() errors in Sub Block Mode (SBM) virtio-mem: check if the config changed before fake offlining memory drivers/virtio/virtio_mem.c | 168 ++++++++++++++++++++++++------------ 1 file changed, 112 insertions(+), 56 deletions(-) base-commit: 3f01e9fed8454dcd89727016c3e5b2fbb8f8e50c