Received: by 2002:a05:6a11:4021:0:0:0:0 with SMTP id ky33csp5144053pxb; Tue, 28 Sep 2021 11:26:34 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzcJWk9aho2mXqQHHUmknob05m5r/SrDfOdqkm7cJJVDp3YMIxgYjpWpPccbAShal4ivLCZ X-Received: by 2002:a62:7e55:0:b0:441:c7a6:fcd2 with SMTP id z82-20020a627e55000000b00441c7a6fcd2mr6853700pfc.6.1632853594018; Tue, 28 Sep 2021 11:26:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1632853594; cv=none; d=google.com; s=arc-20160816; b=bH3wjd3JHSwlv/YYqBHCOv0RptK+S77N8TNnKpdaE0Z65uniBaGBBm1BQcK2O2gpYW RqprK5srKrhM7kbdoy/4iJVZF78J2d3QPtnZSHpzaRd4zTOh0hNE9Q4qIqRUEZWoL57f ERDNGL4d3cRLUzpkCTjnu8MtbSBVt7BXlDt8hhIhYlT30VPPEHwg6Kb+Hp+dulH4f6jM JLQjGwo1qnkDm++EjjOxL8P2CIMJqXB8idBxK+0F3qD77YGHZPOtz/gohQtu66W+0Ux0 o+akN1aALf8HNb2HwQWqDBabcEbRn5q6/ke3DqjUB0y0TgavvAaVkq5h6eLvVomZINBb ZPvw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=R7+JUDG91uhwuwaeltTRSiOKiaWOQXIYAMDdQ0A5p1w=; b=sP5c7seit+qZvBDTWgUDJ54+oiJ0s2cMXyMxHv6uHb6jqBkcAs5nMj6zRBdmOwLgM6 MDOsDx6KGxobDayf6Jz94MQm0v7QFWUgcXRRcx+EN9OqmaKfbJgohBPITBymE4wvCyy1 T6bOaQu5EnHDzQOItVB9eZfYrg+Cw9Dp8P10C0gegAo90/G2zZlaTX4MGhcCb7oMi231 YcmCuxfLKpcSa53Rcn5Usg1bHjVdDwWjXH1ODPVV1tRQ8ECQJ7DK5n6A+MFodWjQ3KY2 NItWkn1fEragOVdfoylg/YJ9VVZMs85XTZEustOmvv2bVy7m3/6oBwtOAkkyBWCI4o+K yMJg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=Kj43dMu7; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id m24si2361546pjr.83.2021.09.28.11.26.21; Tue, 28 Sep 2021 11:26:34 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=Kj43dMu7; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242161AbhI1S1T (ORCPT + 99 others); Tue, 28 Sep 2021 14:27:19 -0400 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:25971 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242079AbhI1S1T (ORCPT ); Tue, 28 Sep 2021 14:27:19 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1632853539; 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=R7+JUDG91uhwuwaeltTRSiOKiaWOQXIYAMDdQ0A5p1w=; b=Kj43dMu7139d57FIT7+X6axopiYK5m05wonndObsxwzICcp6IEp3+sqfdgZC3FLtwrTSOA 7disbkCL6Vx4DwfSU5b6hcyMUMDdWw+F+aRiFVX13hwludVeQt+PC4IYrVzS9quNqacMtP 5erP7fWiFNp7Jb3ehKr3SZQ/ZIZ59iA= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-97-b_LGb36yMIiFspS9xQbtiA-1; Tue, 28 Sep 2021 14:25:37 -0400 X-MC-Unique: b_LGb36yMIiFspS9xQbtiA-1 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 507C01018721; Tue, 28 Sep 2021 18:25:35 +0000 (UTC) Received: from t480s.redhat.com (unknown [10.39.194.120]) by smtp.corp.redhat.com (Postfix) with ESMTP id B481560854; Tue, 28 Sep 2021 18:25:04 +0000 (UTC) From: David Hildenbrand To: linux-kernel@vger.kernel.org Cc: David Hildenbrand , Andrew Morton , Thomas Gleixner , Ingo Molnar , Borislav Petkov , "H. Peter Anvin" , Boris Ostrovsky , Juergen Gross , Stefano Stabellini , "Michael S. Tsirkin" , Jason Wang , Dave Young , Baoquan He , Vivek Goyal , Michal Hocko , Oscar Salvador , Mike Rapoport , "Rafael J. Wysocki" , x86@kernel.org, xen-devel@lists.xenproject.org, virtualization@lists.linux-foundation.org, kexec@lists.infradead.org, linux-fsdevel@vger.kernel.org, linux-mm@kvack.org Subject: [PATCH v1 7/8] virtio-mem: factor out hotplug specifics from virtio_mem_remove() into virtio_mem_deinit_hotplug() Date: Tue, 28 Sep 2021 20:22:57 +0200 Message-Id: <20210928182258.12451-8-david@redhat.com> In-Reply-To: <20210928182258.12451-1-david@redhat.com> References: <20210928182258.12451-1-david@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Let's prepare for a new virtio-mem kdump mode in which we don't actually hot(un)plug any memory but only observe the state of device blocks. Signed-off-by: David Hildenbrand --- drivers/virtio/virtio_mem.c | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/drivers/virtio/virtio_mem.c b/drivers/virtio/virtio_mem.c index 1be3ee7f684d..76d8aef3cfd2 100644 --- a/drivers/virtio/virtio_mem.c +++ b/drivers/virtio/virtio_mem.c @@ -2667,9 +2667,8 @@ static int virtio_mem_probe(struct virtio_device *vdev) return rc; } -static void virtio_mem_remove(struct virtio_device *vdev) +static void virtio_mem_deinit_hotplug(struct virtio_mem *vm) { - struct virtio_mem *vm = vdev->priv; unsigned long mb_id; int rc; @@ -2716,7 +2715,8 @@ static void virtio_mem_remove(struct virtio_device *vdev) * away. Warn at least. */ if (virtio_mem_has_memory_added(vm)) { - dev_warn(&vdev->dev, "device still has system memory added\n"); + dev_warn(&vm->vdev->dev, + "device still has system memory added\n"); } else { virtio_mem_delete_resource(vm); kfree_const(vm->resource_name); @@ -2730,6 +2730,13 @@ static void virtio_mem_remove(struct virtio_device *vdev) } else { vfree(vm->bbm.bb_states); } +} + +static void virtio_mem_remove(struct virtio_device *vdev) +{ + struct virtio_mem *vm = vdev->priv; + + virtio_mem_deinit_hotplug(vm); /* reset the device and cleanup the queues */ vdev->config->reset(vdev); -- 2.31.1