From patchwork Tue Jun 27 11:22:17 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Hildenbrand X-Patchwork-Id: 13294365 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 34A6DEB64DC for ; Tue, 27 Jun 2023 11:22:42 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 3B1A18D0006; Tue, 27 Jun 2023 07:22:41 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 29FC08D0003; Tue, 27 Jun 2023 07:22:41 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id EF8AC8D0006; Tue, 27 Jun 2023 07:22:40 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0010.hostedemail.com [216.40.44.10]) by kanga.kvack.org (Postfix) with ESMTP id DA76C8D0003 for ; Tue, 27 Jun 2023 07:22:40 -0400 (EDT) Received: from smtpin08.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay05.hostedemail.com (Postfix) with ESMTP id A40C84097E for ; Tue, 27 Jun 2023 11:22:40 +0000 (UTC) X-FDA: 80948290080.08.235690B Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by imf18.hostedemail.com (Postfix) with ESMTP id 8DE1C1C0019 for ; Tue, 27 Jun 2023 11:22:38 +0000 (UTC) Authentication-Results: imf18.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=X0aJpT8D; dmarc=pass (policy=none) header.from=redhat.com; spf=pass (imf18.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=1687864958; 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=4aSs18Pv+ZzmA9Rj2C8nVvP+WDMPcyKRh1O4HH29Hbc=; b=fQs85jFQOBEFIcG6RgIruLmC6epCCkkUIWCxnYt1xCZ2FEJfRDC7gvmkb1nSi0qIlI81H6 +MQWX6r7rVFsao+iZRl1W51hOumzTzOrdzjzeXOJv+N4vfrMfXCtAth0RtAEP7PTWM7UOg QHVmyHRyoj5RMUNPE4PPzXJZifpyuz0= ARC-Authentication-Results: i=1; imf18.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=X0aJpT8D; dmarc=pass (policy=none) header.from=redhat.com; spf=pass (imf18.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=1687864958; a=rsa-sha256; cv=none; b=sc91VSoYHxC92Kt8nkB4J835ELYW2/NjqcIwNSTGbxpcJNEfIHheSFDSgzWhiAY48lLsoL 0l8IzgdOet+VrFStKVSC4VxeZxNbea4Ib6CR+nYAhS6gRVh4yciJvSxoFK/zQtDdn8pM4c KDRbN6cBcZmkKGd/3NRyGDz/KhIOVIU= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1687864957; 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=4aSs18Pv+ZzmA9Rj2C8nVvP+WDMPcyKRh1O4HH29Hbc=; b=X0aJpT8DcdBXbEIJH7x/ucE8oKFRerQwSotFEHYsUFu/wOgPp9YlhPOAWP91TprPjo7LZh VG7dhqZ8qyn6ZE9pHwOSgZwnc6uPwdXVSPV+vJdSey1D2GN39cl7mDeK+DyqUPiwUyS7a8 dNgezmrpoLPwOqsaU3yNmkzf1pc+/Pk= Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [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-266-y_sQWVhBPMapPH_5wxp9qg-1; Tue, 27 Jun 2023 07:22:32 -0400 X-MC-Unique: y_sQWVhBPMapPH_5wxp9qg-1 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id CA5553814947; Tue, 27 Jun 2023 11:22:31 +0000 (UTC) Received: from t480s.redhat.com (unknown [10.39.192.116]) by smtp.corp.redhat.com (Postfix) with ESMTP id 30867200A3AD; Tue, 27 Jun 2023 11:22:30 +0000 (UTC) From: David Hildenbrand To: linux-kernel@vger.kernel.org Cc: linux-mm@kvack.org, virtualization@lists.linux-foundation.org, David Hildenbrand , Andrew Morton , "Michael S. Tsirkin" , John Hubbard , Oscar Salvador , Michal Hocko , Jason Wang , Xuan Zhuo Subject: [PATCH v1 2/5] virtio-mem: convert most offline_and_remove_memory() errors to -EBUSY Date: Tue, 27 Jun 2023 13:22:17 +0200 Message-Id: <20230627112220.229240-3-david@redhat.com> In-Reply-To: <20230627112220.229240-1-david@redhat.com> References: <20230627112220.229240-1-david@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.4 X-Rspamd-Server: rspam09 X-Rspamd-Queue-Id: 8DE1C1C0019 X-Stat-Signature: 51ongstw6ae758jsx9k3zood3mmn3r6n X-Rspam-User: X-HE-Tag: 1687864958-584169 X-HE-Meta: U2FsdGVkX1+t4RN3I1Tj/2VYvLDI7PpxMYuVsFSTAsgQDlA6a3JD/hSUBs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zZIAvQf512elOawHb+yQv1JFS8syIQ08LZo7simJWtaksIEhRZLWeR4AzcRJCgpaR3ohlbHfT3blUWVIc/Q== 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: Let's prepare for offline_and_remove_memory() to return other error codes that effectively translate to -EBUSY, such as -ETIMEDOUT. Signed-off-by: David Hildenbrand --- drivers/virtio/virtio_mem.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/drivers/virtio/virtio_mem.c b/drivers/virtio/virtio_mem.c index 835f6cc2fb66..cb8bc6f6aa90 100644 --- a/drivers/virtio/virtio_mem.c +++ b/drivers/virtio/virtio_mem.c @@ -750,7 +750,15 @@ static int virtio_mem_offline_and_remove_memory(struct virtio_mem *vm, dev_dbg(&vm->vdev->dev, "offlining and removing memory failed: %d\n", rc); } - return rc; + + switch (rc) { + case 0: + case -ENOMEM: + case -EINVAL: + return rc; + default: + return -EBUSY; + } } /*