Message ID | 20231016224736.2575718-1-alex.williamson@redhat.com |
---|---|
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:612c:2908:b0:403:3b70:6f57 with SMTP id ib8csp3767880vqb; Mon, 16 Oct 2023 15:49:22 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFC9I6q7nQCSqjgVWncTLX/oA617oGKdyKtoHnAuc3MyQz7PP9QCEcaKiPlxpYQjl5ZZKln X-Received: by 2002:a17:902:e746:b0:1bb:9e6e:a9f3 with SMTP id p6-20020a170902e74600b001bb9e6ea9f3mr660486plf.4.1697496561949; Mon, 16 Oct 2023 15:49:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697496561; cv=none; d=google.com; s=arc-20160816; b=v1467fGb6iUn+MMt0YfFfYT7JWQQ1RTOtlbfru6MnIfkrHL4CPmX+T9ieajkRP5y3w GJtamhMzRJotI00Mt2MxDL6GPf7ozLQX/5bndd03oyaQztgqnktDq/1RoU+377g0YFeQ 2GE+M3UmnNAvcIDriSYnlhe7IB5uzJXybEOd98tatsnaVtvQ6cV6soEpE0VZlartk7IA btX1PjA1LTn4OTOBTrbbls76V75BIuwjqh9+OKrY7p2G9hzWyzCaDnq8Oo+P9gd6oISv dNlaOnf3haURTjWQWqXIHggFam8/CpQQxbAP/s4VAO1sKuTDV8NggfByJCP1r2KX3x0W SGMA== 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 :message-id:date:subject:cc:to:from:dkim-signature; bh=Y5N64g2qnbcVxmrUMZtOSoLgR2kLXvRWoQ4hTvxyx6Y=; fh=+Cb2XQ2PA67VLAGJa+jxW1LjaBXcHfLinB2fMRnx8lg=; b=FYqktaXepNVX7RTv4vtMYBtRM287czxswz3lKeEOGY+At3GxE06NJTZq6A2UBhIsCk 93XKcwhjQUfkObTq+nIDD0/FagQwd20wfJI4G3zBAHEvlHPNipL6zMQak2FiRyN2E9go XwKC7XTpbyTDmmV1p5ZP35/o09xdF1ofloe5qs6qxp1ghjI/2a84eaWvCOg98zOBz5a5 zGxcImaLp23tNg4CaN1XPwhjQnDjxEF4nRv3Sn6PB2Q3Prr6BFS7PuZiOwRiidWRnMUC 2h7UQroh4i/sGs3SG/SjdPlcEFfcT7brxA6T/v9HlsaeVZLdVHYazUXtKdzWFYd0uclT yDaA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=BKU5e4OO; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from snail.vger.email (snail.vger.email. [23.128.96.37]) by mx.google.com with ESMTPS id u11-20020a17090282cb00b001c60de17b5esi344377plz.118.2023.10.16.15.49.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 16 Oct 2023 15:49:21 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) client-ip=23.128.96.37; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=BKU5e4OO; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by snail.vger.email (Postfix) with ESMTP id 534DD80267C4; Mon, 16 Oct 2023 15:49:21 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233399AbjJPWso (ORCPT <rfc822;hjfbswb@gmail.com> + 18 others); Mon, 16 Oct 2023 18:48:44 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47810 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233854AbjJPWsh (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Mon, 16 Oct 2023 18:48:37 -0400 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EC832B4 for <linux-kernel@vger.kernel.org>; Mon, 16 Oct 2023 15:47:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1697496470; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=Y5N64g2qnbcVxmrUMZtOSoLgR2kLXvRWoQ4hTvxyx6Y=; b=BKU5e4OO4gZLFfJn3bP+kMhOF5tVUYMNdsNiJPU7vzB39UV4gFvYZhhmn5UDUXMqTYODWN 7QICor1jsB7oAGm/ModgAXcoWZZg1RQO8XCNr9y9db+EQP2HoNtx50bKbmM8x9knsm5ywA shzhGUBdS7TTvDc9kHD+VuM/GAOH4H4= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-437-gcxiGaN3PWW9JERgctSV5g-1; Mon, 16 Oct 2023 18:47:41 -0400 X-MC-Unique: gcxiGaN3PWW9JERgctSV5g-1 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.rdu2.redhat.com [10.11.54.1]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 0599A805BC3; Mon, 16 Oct 2023 22:47:41 +0000 (UTC) Received: from omen.home.shazbot.org (unknown [10.22.10.53]) by smtp.corp.redhat.com (Postfix) with ESMTP id A821225C9; Mon, 16 Oct 2023 22:47:40 +0000 (UTC) From: Alex Williamson <alex.williamson@redhat.com> To: alex.williamson@redhat.com Cc: kvm@vger.kernel.org, linux-kernel@vger.kernel.org, clg@redhat.com Subject: [PATCH v2 0/2] vfio/mtty: Add migration support Date: Mon, 16 Oct 2023 16:47:34 -0600 Message-Id: <20231016224736.2575718-1-alex.williamson@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.1 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF, RCVD_IN_DNSWL_BLOCKED,RCVD_IN_MSPIKE_H4,RCVD_IN_MSPIKE_WL, SPF_HELO_NONE,SPF_NONE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (snail.vger.email [0.0.0.0]); Mon, 16 Oct 2023 15:49:21 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1779954154958779851 X-GMAIL-MSGID: 1779954154958779851 |
Series |
vfio/mtty: Add migration support
|
|
Message
Alex Williamson
Oct. 16, 2023, 10:47 p.m. UTC
We've seen a request for CI and development to have access to migratable vfio devices without any specific hardware requirements. One way to do that is to enable migration support on the mtty mdev sample driver, as done here. This device is particularly easy to migrate because it doesn't actually do DMA, or in fact much of anything. Therefore we can claim P2P and dirty logging as well. PRE_COPY support is also included in a similar fashion to hisi_acc. This provides early compatibility testing, which is probably over-done, but perhaps illustrates good practice with matching data stream magic, versioning, and feature flags. These might later be used for backwards compatibility, particularly since I'm not positive that copying the struct serial_port between source and destination is sufficient. Along the way, testing migration where the source and target are incompatible revealed an eventfd leak, where peeling back the onion of mtty handling of SET_IRQS proved to require a substantial overhaul. v2: Incorporate comments from Cédric - Fixing eventfd leak turned into SET_IRQS overhaul - Factored out mtty_data_size() - Factored mtty_save_state() and paired with mtty_load_state() Alex Williamson (2): vfio/mtty: Overhaul mtty interrupt handling vfio/mtty: Enable migration support samples/vfio-mdev/mtty.c | 829 +++++++++++++++++++++++++++++++++++---- 1 file changed, 756 insertions(+), 73 deletions(-)