From patchwork Thu Sep 19 13:46:20 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Dr. David Alan Gilbert" X-Patchwork-Id: 13807769 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 lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 1E664CF3941 for ; Thu, 19 Sep 2024 13:48:14 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1srHUj-00081G-1f; Thu, 19 Sep 2024 09:46:53 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1srHUW-0007CV-0H for qemu-devel@nongnu.org; Thu, 19 Sep 2024 09:46:45 -0400 Received: from mx.treblig.org ([2a00:1098:5b::1]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1srHUQ-0005zn-UP for qemu-devel@nongnu.org; Thu, 19 Sep 2024 09:46:39 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=treblig.org ; s=bytemarkmx; h=MIME-Version:Message-ID:Date:Subject:From:Content-Type:From :Subject; bh=iIi4XYDAIN0x4iyYQPhfWqN51Z2+zfNdJj4hCZEgqfc=; b=CHOnsEnZlnN+ASYZ l9UGUbxCQvTBQ9Isib7/6RxLwxpvQQWB+Y3kSZRZ5uaBfgLZ6e9r0wDzB8uq+hbyJTBZToexVvmIH ahqf3UcWVZ++l4neARVgfijLXErvtgB7+zEtbFrVUf6WZO+iHcbWZRjnWEKJsjvtXNmqZl5f7Q1wO g76x+DYKQKUR8VVSfK/CzWGEKJ5QDWac4fxsS4L0xNruUzKYaXsCbzyO+Zb2lfoCseEhheG6yhsMe b2CLom8BFSd0eIQH43pn3OSb7iAoDJY8hcrYVkFYrYM76QQMimUAGV7Rkfevx8gmW7c5VZUu9RAhC frWgqGobQk1Dzloy3Q==; Received: from localhost ([127.0.0.1] helo=dalek.home.treblig.org) by mx.treblig.org with esmtp (Exim 4.96) (envelope-from ) id 1srHUK-006QOJ-2B; Thu, 19 Sep 2024 13:46:28 +0000 From: dave@treblig.org To: peterx@redhat.com, farosas@suse.de, eblake@redhat.com, armbru@redhat.com Cc: qemu-devel@nongnu.org, "Dr. David Alan Gilbert" Subject: [PATCH v2 1/7] migration: Remove migrate_cap_set Date: Thu, 19 Sep 2024 14:46:20 +0100 Message-ID: <20240919134626.166183-2-dave@treblig.org> X-Mailer: git-send-email 2.46.1 In-Reply-To: <20240919134626.166183-1-dave@treblig.org> References: <20240919134626.166183-1-dave@treblig.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1098:5b::1; envelope-from=dave@treblig.org; helo=mx.treblig.org X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org From: "Dr. David Alan Gilbert" migrate_cap_set has been unused since 18d154f575 ("migration: Remove 'blk/-b' option from migrate commands") Remove it. Signed-off-by: Dr. David Alan Gilbert Reviewed-by: Fabiano Rosas --- migration/options.c | 20 -------------------- migration/options.h | 1 - 2 files changed, 21 deletions(-) diff --git a/migration/options.c b/migration/options.c index 147cd2b8fd..9460c5dee9 100644 --- a/migration/options.c +++ b/migration/options.c @@ -605,26 +605,6 @@ bool migrate_caps_check(bool *old_caps, bool *new_caps, Error **errp) return true; } -bool migrate_cap_set(int cap, bool value, Error **errp) -{ - MigrationState *s = migrate_get_current(); - bool new_caps[MIGRATION_CAPABILITY__MAX]; - - if (migration_is_running()) { - error_setg(errp, "There's a migration process in progress"); - return false; - } - - memcpy(new_caps, s->capabilities, sizeof(new_caps)); - new_caps[cap] = value; - - if (!migrate_caps_check(s->capabilities, new_caps, errp)) { - return false; - } - s->capabilities[cap] = value; - return true; -} - MigrationCapabilityStatusList *qmp_query_migrate_capabilities(Error **errp) { MigrationCapabilityStatusList *head = NULL, **tail = &head; diff --git a/migration/options.h b/migration/options.h index a0bd6edc06..36e7b3723f 100644 --- a/migration/options.h +++ b/migration/options.h @@ -58,7 +58,6 @@ bool migrate_tls(void); /* capabilities helpers */ bool migrate_caps_check(bool *old_caps, bool *new_caps, Error **errp); -bool migrate_cap_set(int cap, bool value, Error **errp); /* parameters */ From patchwork Thu Sep 19 13:46:21 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Dr. David Alan Gilbert" X-Patchwork-Id: 13807770 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 lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id CC4A5CF3941 for ; Thu, 19 Sep 2024 13:48:16 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1srHUg-0007rw-Vs; Thu, 19 Sep 2024 09:46:51 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1srHUW-0007ES-Ip for qemu-devel@nongnu.org; Thu, 19 Sep 2024 09:46:45 -0400 Received: from mx.treblig.org ([2a00:1098:5b::1]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1srHUQ-0005zp-UN for qemu-devel@nongnu.org; Thu, 19 Sep 2024 09:46:39 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=treblig.org ; s=bytemarkmx; h=MIME-Version:Message-ID:Date:Subject:From:Content-Type:From :Subject; bh=yth4XXP3doal8mi5kLWYXcmT+5/Krh3E/otCxVnGH08=; b=rCkMbo81Gy7YknXH 2fWsXnJ9xiZVShtbTLOUGNdnuTmd6LuQb1h7rLCVvIKU5HRUkxrL01LacqvVZuBFIYkVi3JarstW1 mkwESKSHv7LlNxbtdxQ0MujAUPMmfifU2J6kQINKqJYBZDiWC1UJUm0ptqenGZpBd2Hg2bDcP2ZID jx6dx0NEGhHN2JLP9CCLK2jPyR29eSvYarLFDqAJoK460d2oAAJcJKMpUz/+0Y2BFYjY02Y0xQQM3 K685qClXh1YV8Z+ghDlxF9wfzZ7bdFNnDr1/kmUFRuVFw0dcyCyK9AfLmiIdj/sgHb1BOTIVu7wSz DnDvI+V+ZwdLkehGPg==; Received: from localhost ([127.0.0.1] helo=dalek.home.treblig.org) by mx.treblig.org with esmtp (Exim 4.96) (envelope-from ) id 1srHUL-006QOJ-0x; Thu, 19 Sep 2024 13:46:29 +0000 From: dave@treblig.org To: peterx@redhat.com, farosas@suse.de, eblake@redhat.com, armbru@redhat.com Cc: qemu-devel@nongnu.org, "Dr. David Alan Gilbert" Subject: [PATCH v2 2/7] migration: Remove unused migrate_zero_blocks Date: Thu, 19 Sep 2024 14:46:21 +0100 Message-ID: <20240919134626.166183-3-dave@treblig.org> X-Mailer: git-send-email 2.46.1 In-Reply-To: <20240919134626.166183-1-dave@treblig.org> References: <20240919134626.166183-1-dave@treblig.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1098:5b::1; envelope-from=dave@treblig.org; helo=mx.treblig.org X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org From: "Dr. David Alan Gilbert" migrate_zero_blocks is unused since eef0bae3a7 ("migration: Remove block migration") Remove it. Signed-off-by: Dr. David Alan Gilbert Reviewed-by: Peter Xu --- migration/options.c | 7 ------- migration/options.h | 1 - 2 files changed, 8 deletions(-) diff --git a/migration/options.c b/migration/options.c index 9460c5dee9..6f549984cb 100644 --- a/migration/options.c +++ b/migration/options.c @@ -339,13 +339,6 @@ bool migrate_xbzrle(void) return s->capabilities[MIGRATION_CAPABILITY_XBZRLE]; } -bool migrate_zero_blocks(void) -{ - MigrationState *s = migrate_get_current(); - - return s->capabilities[MIGRATION_CAPABILITY_ZERO_BLOCKS]; -} - bool migrate_zero_copy_send(void) { MigrationState *s = migrate_get_current(); diff --git a/migration/options.h b/migration/options.h index 36e7b3723f..79084eed0d 100644 --- a/migration/options.h +++ b/migration/options.h @@ -40,7 +40,6 @@ bool migrate_release_ram(void); bool migrate_return_path(void); bool migrate_validate_uuid(void); bool migrate_xbzrle(void); -bool migrate_zero_blocks(void); bool migrate_zero_copy_send(void); /* From patchwork Thu Sep 19 13:46:22 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Dr. David Alan Gilbert" X-Patchwork-Id: 13807765 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 lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id EE472CF3941 for ; Thu, 19 Sep 2024 13:47:18 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1srHUk-00086I-6c; Thu, 19 Sep 2024 09:46:54 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1srHUg-0007qG-Bw for qemu-devel@nongnu.org; Thu, 19 Sep 2024 09:46:50 -0400 Received: from mx.treblig.org ([2a00:1098:5b::1]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1srHUQ-0005zr-UV for qemu-devel@nongnu.org; Thu, 19 Sep 2024 09:46:41 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=treblig.org ; s=bytemarkmx; h=MIME-Version:Message-ID:Date:Subject:From:Content-Type:From :Subject; bh=l4UyVNwJ4yMa4BuDM6CsK36HOowHp3U5Yt7uEmfutOk=; b=rNny+XlTXCax2NqA gfjwzh442GvmLcUjFCtnnDmU8KU/rCFg1dddE07Q2OZB55/mJeQbL6ePWKR0RB8wetjJjHkqvYbFW TU16MJvJtAhsOHHEQEKl2MPeM8q2TnY+9McRCB2DwDsGmM6dakPp46aO2zMMDIDpAhKs6b/Pc8nG8 6wxOfYwL1w8xTjUlbQ+JyFvpB9O7a/h4wiKu+oPkC3Va+vSpD818xhA5CtsExa6Y8ngiWlPLQ0JMG hWJutBqOI8u0uAtrIgH6iy8C34weoARaQJUd7StEzqTp8VT/EofDUbNTEGHbJz0iFBwdP17dPPfr/ OMIv0JG10UVAWD9Frw==; Received: from localhost ([127.0.0.1] helo=dalek.home.treblig.org) by mx.treblig.org with esmtp (Exim 4.96) (envelope-from ) id 1srHUM-006QOJ-0B; Thu, 19 Sep 2024 13:46:30 +0000 From: dave@treblig.org To: peterx@redhat.com, farosas@suse.de, eblake@redhat.com, armbru@redhat.com Cc: qemu-devel@nongnu.org Subject: [PATCH v2 3/7] migration: Deprecate zero-blocks capability Date: Thu, 19 Sep 2024 14:46:22 +0100 Message-ID: <20240919134626.166183-4-dave@treblig.org> X-Mailer: git-send-email 2.46.1 In-Reply-To: <20240919134626.166183-1-dave@treblig.org> References: <20240919134626.166183-1-dave@treblig.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1098:5b::1; envelope-from=dave@treblig.org; helo=mx.treblig.org X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org From: Fabiano Rosas The zero-blocks capability was meant to be used along with the block migration, which has been removed already in commit eef0bae3a7 ("migration: Remove block migration"). Setting zero-blocks is currently a noop, but the outright removal of the capability would cause and error in case some users are still setting it. Put the capability through the deprecation process. Signed-off-by: Fabiano Rosas Reviewed-by: Peter Xu --- docs/about/deprecated.rst | 6 ++++++ migration/options.c | 4 ++++ qapi/migration.json | 5 ++++- 3 files changed, 14 insertions(+), 1 deletion(-) diff --git a/docs/about/deprecated.rst b/docs/about/deprecated.rst index ed31d4b0b2..47cabb6fcc 100644 --- a/docs/about/deprecated.rst +++ b/docs/about/deprecated.rst @@ -476,3 +476,9 @@ usage of providing a file descriptor to a plain file has been deprecated in favor of explicitly using the ``file:`` URI with the file descriptor being passed as an ``fdset``. Refer to the ``add-fd`` command documentation for details on the ``fdset`` usage. + +``zero-blocks`` capability (since 9.2) +'''''''''''''''''''''''''''''''''''''' + +The ``zero-blocks`` capability was part of the block migration which +doesn't exist anymore since it was removed in QEMU v9.1. diff --git a/migration/options.c b/migration/options.c index 6f549984cb..ad8d6989a8 100644 --- a/migration/options.c +++ b/migration/options.c @@ -450,6 +450,10 @@ bool migrate_caps_check(bool *old_caps, bool *new_caps, Error **errp) ERRP_GUARD(); MigrationIncomingState *mis = migration_incoming_get_current(); + if (new_caps[MIGRATION_CAPABILITY_ZERO_BLOCKS]) { + warn_report("zero-blocks capability is deprecated"); + } + #ifndef CONFIG_REPLICATION if (new_caps[MIGRATION_CAPABILITY_X_COLO]) { error_setg(errp, "QEMU compiled without replication module" diff --git a/qapi/migration.json b/qapi/migration.json index b66cccf107..3af6aa1740 100644 --- a/qapi/migration.json +++ b/qapi/migration.json @@ -479,11 +479,14 @@ # Features: # # @unstable: Members @x-colo and @x-ignore-shared are experimental. +# @deprecated: Member @zero-blocks is deprecated as being part of +# block migration which was already removed. # # Since: 1.2 ## { 'enum': 'MigrationCapability', - 'data': ['xbzrle', 'rdma-pin-all', 'auto-converge', 'zero-blocks', + 'data': ['xbzrle', 'rdma-pin-all', 'auto-converge', + { 'name': 'zero-blocks', 'features': [ 'deprecated' ] }, 'events', 'postcopy-ram', { 'name': 'x-colo', 'features': [ 'unstable' ] }, 'release-ram', From patchwork Thu Sep 19 13:46:23 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Dr. David Alan Gilbert" X-Patchwork-Id: 13807766 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 lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id EA0F1CF3941 for ; Thu, 19 Sep 2024 13:47:27 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1srHUi-0007yW-UL; Thu, 19 Sep 2024 09:46:52 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1srHUg-0007qI-Bu for qemu-devel@nongnu.org; Thu, 19 Sep 2024 09:46:50 -0400 Received: from mx.treblig.org ([2a00:1098:5b::1]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1srHUQ-0005zx-UR for qemu-devel@nongnu.org; Thu, 19 Sep 2024 09:46:41 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=treblig.org ; s=bytemarkmx; h=MIME-Version:Message-ID:Date:Subject:From:Content-Type:From :Subject; bh=6vNa82WphtB1is9lgrKpqh6cZbhNlLMUwM6YrQbpBXs=; b=h+Fy/18hZSQWnxkI cF1soIFGxmL4f+WRJZzgcY2y5z1fXstdXPMfi5xzatT64qXLveqtF0kk/TkI1ANJ7DMkzKm0yV5bQ gfVx+is6u337HH568vRVrzejyhUMHP3D5QTP3dSgKUQsCFtbMt0yMHLG+tDK8ReXVgxicucxA1EJl +bh8FHp7b+kAsfYgNSz1xHhEMAKXxe7jyL6zer+q4JvbqjG3fzfYpQa1Q3WB+3ePlQLpUpTPHmz5B mK5x/vUL2Oxg+qRF0GixSX3YfQqDQ+UbWzG/y5kzqS70l1SjNovhPK5QYV8JJuuRDDlDQ9M6wUmwh 0rlgiK9fvrSxYSmEGA==; Received: from localhost ([127.0.0.1] helo=dalek.home.treblig.org) by mx.treblig.org with esmtp (Exim 4.96) (envelope-from ) id 1srHUM-006QOJ-2F; Thu, 19 Sep 2024 13:46:30 +0000 From: dave@treblig.org To: peterx@redhat.com, farosas@suse.de, eblake@redhat.com, armbru@redhat.com Cc: qemu-devel@nongnu.org, "Dr. David Alan Gilbert" Subject: [PATCH v2 4/7] migration: Remove unused socket_send_channel_create_sync Date: Thu, 19 Sep 2024 14:46:23 +0100 Message-ID: <20240919134626.166183-5-dave@treblig.org> X-Mailer: git-send-email 2.46.1 In-Reply-To: <20240919134626.166183-1-dave@treblig.org> References: <20240919134626.166183-1-dave@treblig.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1098:5b::1; envelope-from=dave@treblig.org; helo=mx.treblig.org X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org From: "Dr. David Alan Gilbert" socket_send_channel_create_sync only use was removed by d0edb8a173 ("migration: Create the postcopy preempt channel asynchronously") Remove it. Signed-off-by: Dr. David Alan Gilbert Reviewed-by: Fabiano Rosas --- migration/socket.c | 18 ------------------ migration/socket.h | 1 - 2 files changed, 19 deletions(-) diff --git a/migration/socket.c b/migration/socket.c index 9ab89b1e08..5ec65b8c03 100644 --- a/migration/socket.c +++ b/migration/socket.c @@ -42,24 +42,6 @@ void socket_send_channel_create(QIOTaskFunc f, void *data) f, data, NULL, NULL); } -QIOChannel *socket_send_channel_create_sync(Error **errp) -{ - QIOChannelSocket *sioc = qio_channel_socket_new(); - - if (!outgoing_args.saddr) { - object_unref(OBJECT(sioc)); - error_setg(errp, "Initial sock address not set!"); - return NULL; - } - - if (qio_channel_socket_connect_sync(sioc, outgoing_args.saddr, errp) < 0) { - object_unref(OBJECT(sioc)); - return NULL; - } - - return QIO_CHANNEL(sioc); -} - struct SocketConnectData { MigrationState *s; char *hostname; diff --git a/migration/socket.h b/migration/socket.h index 46c233ecd2..04ebbe95a1 100644 --- a/migration/socket.h +++ b/migration/socket.h @@ -22,7 +22,6 @@ #include "qemu/sockets.h" void socket_send_channel_create(QIOTaskFunc f, void *data); -QIOChannel *socket_send_channel_create_sync(Error **errp); void socket_start_incoming_migration(SocketAddress *saddr, Error **errp); From patchwork Thu Sep 19 13:46:24 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Dr. David Alan Gilbert" X-Patchwork-Id: 13807768 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 lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id CABA2CF3942 for ; Thu, 19 Sep 2024 13:48:04 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1srHUf-0007kN-0H; Thu, 19 Sep 2024 09:46:49 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1srHUU-00078J-TI for qemu-devel@nongnu.org; Thu, 19 Sep 2024 09:46:39 -0400 Received: from mx.treblig.org ([2a00:1098:5b::1]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1srHUQ-000609-UN for qemu-devel@nongnu.org; Thu, 19 Sep 2024 09:46:38 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=treblig.org ; s=bytemarkmx; h=MIME-Version:Message-ID:Date:Subject:From:Content-Type:From :Subject; bh=+ITeZviAUjdU79Lh7KnozJBelk/8symZBSM8bBXNmh8=; b=hTDDoJfmTCNi14vv 2lkRR0W9oAS61ad+vNLQYnVT/ZBeE7aOct/u4ZB1qvUNirQ1FGSSPXgl85gnGse/y6vetv0u6SDEi zcTkWb0AegkR44sjgko7In5ZEKj9RqpYwY0tPyFhKbMxLbI/xkE8I/3xkvK4lXUf9SfaoaV/iN/DJ bDalJNs+YVSlBfj7HPPvUTUOBR1VPa+prD5i2OqjPqKuNQsRqQ837y5+9IB91B0HG5ag1Ci7bZ7On 7K/4q/9wQTHpozhv+zhZYtTNq9YYXbjhdS/2RJARnFqPxi8JflDU3ZDeezUkMWFaJZ4yUTdk8kLtq kC5JhoYLQ8s+c4bs3Q==; Received: from localhost ([127.0.0.1] helo=dalek.home.treblig.org) by mx.treblig.org with esmtp (Exim 4.96) (envelope-from ) id 1srHUN-006QOJ-0s; Thu, 19 Sep 2024 13:46:31 +0000 From: dave@treblig.org To: peterx@redhat.com, farosas@suse.de, eblake@redhat.com, armbru@redhat.com Cc: qemu-devel@nongnu.org, "Dr. David Alan Gilbert" Subject: [PATCH v2 5/7] util/userfaultfd: Return -errno on error Date: Thu, 19 Sep 2024 14:46:24 +0100 Message-ID: <20240919134626.166183-6-dave@treblig.org> X-Mailer: git-send-email 2.46.1 In-Reply-To: <20240919134626.166183-1-dave@treblig.org> References: <20240919134626.166183-1-dave@treblig.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1098:5b::1; envelope-from=dave@treblig.org; helo=mx.treblig.org X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org From: "Dr. David Alan Gilbert" Convert (the currently unused) uffd_wakeup, uffd_copy_page and uffd_zero_page to return -errno on error rather than -1. That will make it easier to reuse in postcopy. Signed-off-by: Dr. David Alan Gilbert Reviewed-by: Peter Xu --- util/userfaultfd.c | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/util/userfaultfd.c b/util/userfaultfd.c index 1b2fa949d4..518d5c3586 100644 --- a/util/userfaultfd.c +++ b/util/userfaultfd.c @@ -240,7 +240,7 @@ int uffd_change_protection(int uffd_fd, void *addr, uint64_t length, * Copy range of source pages to the destination to resolve * missing page fault somewhere in the destination range. * - * Returns 0 on success, negative value in case of an error + * Returns 0 on success, -errno in case of an error * * @uffd_fd: UFFD file descriptor * @dst_addr: destination base address @@ -259,10 +259,11 @@ int uffd_copy_page(int uffd_fd, void *dst_addr, void *src_addr, uffd_copy.mode = dont_wake ? UFFDIO_COPY_MODE_DONTWAKE : 0; if (ioctl(uffd_fd, UFFDIO_COPY, &uffd_copy)) { + int e = errno; error_report("uffd_copy_page() failed: dst_addr=%p src_addr=%p length=%" PRIu64 " mode=%" PRIx64 " errno=%i", dst_addr, src_addr, - length, (uint64_t) uffd_copy.mode, errno); - return -1; + length, (uint64_t) uffd_copy.mode, e); + return -e; } return 0; @@ -273,7 +274,7 @@ int uffd_copy_page(int uffd_fd, void *dst_addr, void *src_addr, * * Fill range pages with zeroes to resolve missing page fault within the range. * - * Returns 0 on success, negative value in case of an error + * Returns 0 on success, -errno in case of an error * * @uffd_fd: UFFD file descriptor * @addr: base address @@ -289,10 +290,11 @@ int uffd_zero_page(int uffd_fd, void *addr, uint64_t length, bool dont_wake) uffd_zeropage.mode = dont_wake ? UFFDIO_ZEROPAGE_MODE_DONTWAKE : 0; if (ioctl(uffd_fd, UFFDIO_ZEROPAGE, &uffd_zeropage)) { + int e = errno; error_report("uffd_zero_page() failed: addr=%p length=%" PRIu64 " mode=%" PRIx64 " errno=%i", addr, length, - (uint64_t) uffd_zeropage.mode, errno); - return -1; + (uint64_t) uffd_zeropage.mode, e); + return -e; } return 0; @@ -306,7 +308,7 @@ int uffd_zero_page(int uffd_fd, void *addr, uint64_t length, bool dont_wake) * via UFFD-IO IOCTLs with MODE_DONTWAKE flag set, then after that all waits * for the whole memory range are satisfied in a single call to uffd_wakeup(). * - * Returns 0 on success, negative value in case of an error + * Returns 0 on success, -errno in case of an error * * @uffd_fd: UFFD file descriptor * @addr: base address @@ -320,9 +322,10 @@ int uffd_wakeup(int uffd_fd, void *addr, uint64_t length) uffd_range.len = length; if (ioctl(uffd_fd, UFFDIO_WAKE, &uffd_range)) { + int e = errno; error_report("uffd_wakeup() failed: addr=%p length=%" PRIu64 " errno=%i", - addr, length, errno); - return -1; + addr, length, e); + return -e; } return 0; From patchwork Thu Sep 19 13:46:25 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Dr. David Alan Gilbert" X-Patchwork-Id: 13807767 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 lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id D1C21CF3943 for ; Thu, 19 Sep 2024 13:48:04 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1srHUd-0007ec-Uy; Thu, 19 Sep 2024 09:46:48 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1srHUU-00078G-Sc for qemu-devel@nongnu.org; Thu, 19 Sep 2024 09:46:39 -0400 Received: from mx.treblig.org ([2a00:1098:5b::1]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1srHUQ-00060C-UT for qemu-devel@nongnu.org; Thu, 19 Sep 2024 09:46:38 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=treblig.org ; s=bytemarkmx; h=MIME-Version:Message-ID:Date:Subject:From:Content-Type:From :Subject; bh=Ms2aBAQ13vf0pUFCc2B0msBVzqbN2IXx+OGBi5iEVWk=; b=sCaWngQK1cv1KaXT nYVu+vgsWJLvBnHFQ0IcHWRnY7x7FJ1EPo6La4sFs7S1zyCILWW8OFUYVK8c66neS7qJP5wdHc1/w ss+jqlZWJhQnbiEuk8bFvYI51X0Rvfgudy4nIa7/5Y8Cw9CoOV+ZCsAN6g1qUvSQaoO8YMYQCpBNF /T8vI0SKfIiU5y4X1mL0Dw1VbFD3SIoJ6Qz9zLjjbcrvrbChW63hM5nLqJVO+LUPh9YDl0/jlQJSY r48jfUR2fv/6OKpVThE2jys1lWLtu8ccohqMKIQmEVPsKEoMcEwU03onLBGXNkmwdw4SmmVjXlRGN G7GjPonexS0qK4GhdQ==; Received: from localhost ([127.0.0.1] helo=dalek.home.treblig.org) by mx.treblig.org with esmtp (Exim 4.96) (envelope-from ) id 1srHUN-006QOJ-2y; Thu, 19 Sep 2024 13:46:31 +0000 From: dave@treblig.org To: peterx@redhat.com, farosas@suse.de, eblake@redhat.com, armbru@redhat.com Cc: qemu-devel@nongnu.org, "Dr. David Alan Gilbert" Subject: [PATCH v2 6/7] migration/postcopy: Use uffd helpers Date: Thu, 19 Sep 2024 14:46:25 +0100 Message-ID: <20240919134626.166183-7-dave@treblig.org> X-Mailer: git-send-email 2.46.1 In-Reply-To: <20240919134626.166183-1-dave@treblig.org> References: <20240919134626.166183-1-dave@treblig.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1098:5b::1; envelope-from=dave@treblig.org; helo=mx.treblig.org X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org From: "Dr. David Alan Gilbert" Use the uffd_copy_page, uffd_zero_page and uffd_wakeup helpers rather than calling ioctl ourselves. They return -errno on error, and print an error_report themselves. I think this actually makes postcopy_place_page actually more consistent in it's callers. Signed-off-by: Dr. David Alan Gilbert Reviewed-by: Peter Xu --- migration/postcopy-ram.c | 47 +++++++++++----------------------------- 1 file changed, 13 insertions(+), 34 deletions(-) diff --git a/migration/postcopy-ram.c b/migration/postcopy-ram.c index 1c374b7ea1..e2b318d3da 100644 --- a/migration/postcopy-ram.c +++ b/migration/postcopy-ram.c @@ -746,18 +746,9 @@ int postcopy_wake_shared(struct PostCopyFD *pcfd, RAMBlock *rb) { size_t pagesize = qemu_ram_pagesize(rb); - struct uffdio_range range; - int ret; trace_postcopy_wake_shared(client_addr, qemu_ram_get_idstr(rb)); - range.start = ROUND_DOWN(client_addr, pagesize); - range.len = pagesize; - ret = ioctl(pcfd->fd, UFFDIO_WAKE, &range); - if (ret) { - error_report("%s: Failed to wake: %zx in %s (%s)", - __func__, (size_t)client_addr, qemu_ram_get_idstr(rb), - strerror(errno)); - } - return ret; + return uffd_wakeup(pcfd->fd, (void *)ROUND_DOWN(client_addr, pagesize), + pagesize); } static int postcopy_request_page(MigrationIncomingState *mis, RAMBlock *rb, @@ -1275,18 +1266,10 @@ static int qemu_ufd_copy_ioctl(MigrationIncomingState *mis, void *host_addr, int ret; if (from_addr) { - struct uffdio_copy copy_struct; - copy_struct.dst = (uint64_t)(uintptr_t)host_addr; - copy_struct.src = (uint64_t)(uintptr_t)from_addr; - copy_struct.len = pagesize; - copy_struct.mode = 0; - ret = ioctl(userfault_fd, UFFDIO_COPY, ©_struct); + ret = uffd_copy_page(userfault_fd, host_addr, from_addr, pagesize, + false); } else { - struct uffdio_zeropage zero_struct; - zero_struct.range.start = (uint64_t)(uintptr_t)host_addr; - zero_struct.range.len = pagesize; - zero_struct.mode = 0; - ret = ioctl(userfault_fd, UFFDIO_ZEROPAGE, &zero_struct); + ret = uffd_zero_page(userfault_fd, host_addr, pagesize, false); } if (!ret) { qemu_mutex_lock(&mis->page_request_mutex); @@ -1343,18 +1326,16 @@ int postcopy_place_page(MigrationIncomingState *mis, void *host, void *from, RAMBlock *rb) { size_t pagesize = qemu_ram_pagesize(rb); + int e; /* copy also acks to the kernel waking the stalled thread up * TODO: We can inhibit that ack and only do it if it was requested * which would be slightly cheaper, but we'd have to be careful * of the order of updating our page state. */ - if (qemu_ufd_copy_ioctl(mis, host, from, pagesize, rb)) { - int e = errno; - error_report("%s: %s copy host: %p from: %p (size: %zd)", - __func__, strerror(e), host, from, pagesize); - - return -e; + e = qemu_ufd_copy_ioctl(mis, host, from, pagesize, rb); + if (e) { + return e; } trace_postcopy_place_page(host); @@ -1376,12 +1357,10 @@ int postcopy_place_page_zero(MigrationIncomingState *mis, void *host, * but it's not available for everything (e.g. hugetlbpages) */ if (qemu_ram_is_uf_zeroable(rb)) { - if (qemu_ufd_copy_ioctl(mis, host, NULL, pagesize, rb)) { - int e = errno; - error_report("%s: %s zero host: %p", - __func__, strerror(e), host); - - return -e; + int e; + e = qemu_ufd_copy_ioctl(mis, host, NULL, pagesize, rb); + if (e) { + return e; } return postcopy_notify_shared_wake(rb, qemu_ram_block_host_offset(rb, From patchwork Thu Sep 19 13:46:26 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Dr. David Alan Gilbert" X-Patchwork-Id: 13807773 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 lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 7FFFECF3941 for ; Thu, 19 Sep 2024 13:50:00 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1srHXc-0006gm-13; Thu, 19 Sep 2024 09:49:52 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1srHXU-0006JE-97 for qemu-devel@nongnu.org; Thu, 19 Sep 2024 09:49:45 -0400 Received: from mx.treblig.org ([2a00:1098:5b::1]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1srHXR-0006Mq-P3 for qemu-devel@nongnu.org; Thu, 19 Sep 2024 09:49:44 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=treblig.org ; s=bytemarkmx; h=MIME-Version:Message-ID:Date:Subject:From:Content-Type:From :Subject; bh=WpHNe7TXr6HaQLeHukME84FM+iJR/rwtrGszqmqqelg=; b=D/FvDNOIihSCBkgc 24gXXwSu23d7IUR7FeSAiKLEPrrfSeogTd4CiyfhurCkKcZ2+D3+HmbosO8BXrKtzfJH9ulNY2O/Z d026odqINELDLDh0wl2J1Rt6pnWs5/tmTXwcqEWHCLE+46PrpjvrZP7i4JGlEdKWJzkhML1VqekUq UmeP6gkbrq8Hmkfku910AtSDRnMam0XkGpFd+p9DRPqh+WC73X7qRgG9oTK49T615Tt65/AjQlGAi yYRXr9UxW23GJrZrhXi1DXLUmf1J0LC7yiG5rM3wrSe4ojaACFrGzM+9k2SK6DbW9hsFgCw82kr2i A+CFMNqAkxvvFuO0bg==; Received: from localhost ([127.0.0.1] helo=dalek.home.treblig.org) by mx.treblig.org with esmtp (Exim 4.96) (envelope-from ) id 1srHXM-006QOJ-03; Thu, 19 Sep 2024 13:49:36 +0000 From: dave@treblig.org To: peterx@redhat.com, farosas@suse.de, eblake@redhat.com, armbru@redhat.com Cc: qemu-devel@nongnu.org, "Dr. David Alan Gilbert" Subject: [PATCH v2 7/7] util/userfaultfd: Remove unused uffd_poll_events Date: Thu, 19 Sep 2024 14:46:26 +0100 Message-ID: <20240919134626.166183-8-dave@treblig.org> X-Mailer: git-send-email 2.46.1 In-Reply-To: <20240919134626.166183-1-dave@treblig.org> References: <20240919134626.166183-1-dave@treblig.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1098:5b::1; envelope-from=dave@treblig.org; helo=mx.treblig.org X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org From: "Dr. David Alan Gilbert" uffd_poll_events has been unused since it was added; it's also just a wrapper around a plain old poll call, so doesn't add anything. Signed-off-by: Dr. David Alan Gilbert Reviewed-by: Peter Xu --- include/qemu/userfaultfd.h | 1 - util/userfaultfd.c | 28 ---------------------------- 2 files changed, 29 deletions(-) diff --git a/include/qemu/userfaultfd.h b/include/qemu/userfaultfd.h index 18a4314212..a1979308d7 100644 --- a/include/qemu/userfaultfd.h +++ b/include/qemu/userfaultfd.h @@ -39,7 +39,6 @@ int uffd_copy_page(int uffd_fd, void *dst_addr, void *src_addr, int uffd_zero_page(int uffd_fd, void *addr, uint64_t length, bool dont_wake); int uffd_wakeup(int uffd_fd, void *addr, uint64_t length); int uffd_read_events(int uffd_fd, struct uffd_msg *msgs, int count); -bool uffd_poll_events(int uffd_fd, int tmo); #endif /* CONFIG_LINUX */ diff --git a/util/userfaultfd.c b/util/userfaultfd.c index 518d5c3586..2396104f23 100644 --- a/util/userfaultfd.c +++ b/util/userfaultfd.c @@ -358,31 +358,3 @@ int uffd_read_events(int uffd_fd, struct uffd_msg *msgs, int count) return (int) (res / sizeof(struct uffd_msg)); } - -/** - * uffd_poll_events: poll UFFD file descriptor for read - * - * Returns true if events are available for read, false otherwise - * - * @uffd_fd: UFFD file descriptor - * @tmo: timeout value - */ -bool uffd_poll_events(int uffd_fd, int tmo) -{ - int res; - struct pollfd poll_fd = { .fd = uffd_fd, .events = POLLIN, .revents = 0 }; - - do { - res = poll(&poll_fd, 1, tmo); - } while (res < 0 && errno == EINTR); - - if (res == 0) { - return false; - } - if (res < 0) { - error_report("uffd_poll_events() failed: errno=%i", errno); - return false; - } - - return (poll_fd.revents & POLLIN) != 0; -}