From nobody Tue Nov 26 04:46:55 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1710194751; cv=none; d=zohomail.com; s=zohoarc; b=Fz7gUrQIeub2C8dqBckK3Dzt9i+iXBX9S8BqbdVR9dpJnh8LeyJf9S+yZKR0cHOgbyGOm78h5JbZs9ucsezJWg0PpA7IIxgVjXieoXqjtPtC1HDQdHsPxGONcZ0QcCekw61lYPEiFTGzaFESHqdbRn5dwixgkSRgcTr9ZQIfKAE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1710194751; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=kYBBBuT1r3W8EJmKlTmpyZe13YIEZba26k1f9sq+pH8=; b=kLeJPCH2T4z491GRer2JHBcMqu0eNFQdc9EIY+X1tOh+EWOKwlMoBOkSuAI0jTXEEpmuGQTlxBGw1qeNj+asg18fhDLOQK3Esvw0KGquQNfV/nOxjAcB8X1qHZuBmjowxnmZpS7h+ohWwzyF4dTU7GNadiEpnVQ0NuGst3UxKjM= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1710194751073841.8727740341914; Mon, 11 Mar 2024 15:05:51 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rjnhy-0001yD-QF; Mon, 11 Mar 2024 18:01:23 -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 1rjngl-0000hB-IW for qemu-devel@nongnu.org; Mon, 11 Mar 2024 18:00:09 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rjngj-0004FA-M8 for qemu-devel@nongnu.org; Mon, 11 Mar 2024 18:00:07 -0400 Received: from mail-qv1-f71.google.com (mail-qv1-f71.google.com [209.85.219.71]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-534-ro7FiHiSPNKtyrYm8xcSig-1; Mon, 11 Mar 2024 18:00:02 -0400 Received: by mail-qv1-f71.google.com with SMTP id 6a1803df08f44-690c19ee50bso1968766d6.0 for ; Mon, 11 Mar 2024 15:00:02 -0700 (PDT) Received: from x1n.. (cpe688f2e2cb7c3-cm688f2e2cb7c0.cpe.net.cable.rogers.com. [99.254.121.117]) by smtp.gmail.com with ESMTPSA id d6-20020a0ce446000000b00690cec16254sm1541932qvm.68.2024.03.11.15.00.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 11 Mar 2024 15:00:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1710194405; 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=kYBBBuT1r3W8EJmKlTmpyZe13YIEZba26k1f9sq+pH8=; b=CDtfZe1W4a5H6UHQY77+lgE8EFuF6E5G4MQVHqbFwyo8owc7gbflqCGgRpyuHKT3iT653U lHg7cqCmsMlEBSzfylZTTPb7i/Z2QmRk3pqfoZmCTvhltoy5dKwXs5XeWYIh4OB0yHiIlV aGdlrfiuGdRluo5vBAFw/+8n08Opy/I= X-MC-Unique: ro7FiHiSPNKtyrYm8xcSig-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1710194402; x=1710799202; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=kYBBBuT1r3W8EJmKlTmpyZe13YIEZba26k1f9sq+pH8=; b=jvS4CB3QRnlvTfEd3g30kbIStL0AZTEXKrQlXTUJKO/pmplaqW6+A7OafqXkWREIvG V/Co0VebG77P3FZgWyrypI1BjgO34lBFdVc4GPWV9I6wsIYDElnau3NYlhsBgw3/U0lw LrKV5ERCkcA2J21PtI+T5OaH2vSFDtwRZ4VNg/lZUe8ndDp7F87MPhs87x5IFS557dWM ujAB5z0RlaVboPyohy5qHmiqWb+mcwmfLuS4C9JAxJ/h35Q6RLKGhwf8k1Qw4L6sxD+v z4k4ovDI1WfSTQvmvX+dwqkYe2104UERtA5DXPClLm0/X6yiGFewtopyWzyBzusBvaz2 5qkQ== X-Gm-Message-State: AOJu0YyWGsocFGkC/3HBf0UlVYM9lTf70o/AslyjFtyYcZpMc5KnXg+6 FK9jaSIMgAJ6Kj75wq/xzN4uFoYSY6w/8kBfEP4IfQU4+J2mby/HALyXPfTnVjCuj5UOdpXUA0/ moIF/An+NU9ioggTHrQ7U5dGbQW5PJDmhN9h3zm9BZ2lqhXodnJY8uv/8QZRn/ZR5GPQj+TmvfD aSoosJAtHRfgyVs5KnCM/NuEdZtMXDN9i73w== X-Received: by 2002:ad4:58c5:0:b0:68f:1c80:d78e with SMTP id dh5-20020ad458c5000000b0068f1c80d78emr7453794qvb.0.1710194402037; Mon, 11 Mar 2024 15:00:02 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHYMhtwNVbDITCwQRxVxFOrIlsV9jOD0yvJEQCL8Ij1gQ3Z9x/IJbFwL8oup7zt3dtUynxCYw== X-Received: by 2002:ad4:58c5:0:b0:68f:1c80:d78e with SMTP id dh5-20020ad458c5000000b0068f1c80d78emr7453758qvb.0.1710194401588; Mon, 11 Mar 2024 15:00:01 -0700 (PDT) From: peterx@redhat.com To: qemu-devel@nongnu.org, Peter Maydell Cc: Paolo Bonzini , peterx@redhat.com, Fabiano Rosas , David Hildenbrand , Prasad Pandit , Steve Sistare Subject: [PULL 23/34] migration: migration_is_device Date: Mon, 11 Mar 2024 17:59:14 -0400 Message-ID: <20240311215925.40618-24-peterx@redhat.com> X-Mailer: git-send-email 2.44.0 In-Reply-To: <20240311215925.40618-1-peterx@redhat.com> References: <20240311215925.40618-1-peterx@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.133.124; envelope-from=peterx@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -15 X-Spam_score: -1.6 X-Spam_bar: - X-Spam_report: (-1.6 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-1.029, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_SORBS_WEB=1.5, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=no 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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1710194751457100001 Content-Type: text/plain; charset="utf-8" From: Steve Sistare Define and export migration_is_device to eliminate a dependency on MigrationState. Signed-off-by: Steve Sistare Link: https://lore.kernel.org/r/1710179338-294359-8-git-send-email-steven.s= istare@oracle.com Signed-off-by: Peter Xu --- include/migration/misc.h | 1 + hw/vfio/common.c | 4 +--- migration/migration.c | 7 +++++++ 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/include/migration/misc.h b/include/migration/misc.h index c4b5416357..28cfaed2c7 100644 --- a/include/migration/misc.h +++ b/include/migration/misc.h @@ -61,6 +61,7 @@ void migration_object_init(void); void migration_shutdown(void); bool migration_is_idle(void); bool migration_is_active(void); +bool migration_is_device(void); bool migration_thread_is_self(void); bool migration_is_setup_or_active(void); bool migrate_mode_is_cpr(MigrationState *); diff --git a/hw/vfio/common.c b/hw/vfio/common.c index 2dbbf62e15..de010680ff 100644 --- a/hw/vfio/common.c +++ b/hw/vfio/common.c @@ -180,10 +180,8 @@ bool vfio_device_state_is_precopy(VFIODevice *vbasedev) static bool vfio_devices_all_dirty_tracking(VFIOContainerBase *bcontainer) { VFIODevice *vbasedev; - MigrationState *ms =3D migrate_get_current(); =20 - if (!migration_is_active() && - ms->state !=3D MIGRATION_STATUS_DEVICE) { + if (!migration_is_active() && !migration_is_device()) { return false; } =20 diff --git a/migration/migration.c b/migration/migration.c index afe72af0b1..db1e627848 100644 --- a/migration/migration.c +++ b/migration/migration.c @@ -1647,6 +1647,13 @@ bool migration_is_active(void) s->state =3D=3D MIGRATION_STATUS_POSTCOPY_ACTIVE); } =20 +bool migration_is_device(void) +{ + MigrationState *s =3D current_migration; + + return s->state =3D=3D MIGRATION_STATUS_DEVICE; +} + bool migration_thread_is_self(void) { MigrationState *s =3D current_migration; --=20 2.44.0