From nobody Tue Nov 26 04:46:00 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=1710194641; cv=none; d=zohomail.com; s=zohoarc; b=JF22YihxRSPffQFXoEMHLI6UiVOzklFJRh7pFWVaR9sg0ztAwQNdJ8ynUMkSSDOFcSg75AbF/MRccf7mqkQ+vjNEfK8SjK6eZNuIrflDdJusyeWmzuZ5t3e7YmkrbREuJAlagAk3sB/qOe0kW8Du4R8MzbkNz4Mkm8AcyOm73xo= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1710194641; 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=L9tqjm6MQlYl8InOWvUGruPRPvJCqkW54MwUESfEeMw=; b=nTYAVHB2VuOniw6HIuJnRVM5jOYO+DmLhERySuLtey1kWgEvdM2JgOpHYMNQ6sUk7Eur0RL9M3vpwdArsxoBrmCK+SDron7i4Ob0DiTV+Zfm/bDnfKzwGZyTFCYFROJ2yvYVwACBbrJKt3Vpjd6DuXVZhlFnkhAZeWliHWYoiBc= 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 1710194641088990.9399621429709; Mon, 11 Mar 2024 15:04:01 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rjnh3-00010R-4x; Mon, 11 Mar 2024 18:00:29 -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 1rjnge-0000Yy-LN for qemu-devel@nongnu.org; Mon, 11 Mar 2024 18:00:01 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rjngc-00043N-Ue for qemu-devel@nongnu.org; Mon, 11 Mar 2024 18:00:00 -0400 Received: from mail-qv1-f69.google.com (mail-qv1-f69.google.com [209.85.219.69]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-255-yMOVwB8UNxeCBfzcSb0YLw-1; Mon, 11 Mar 2024 17:59:56 -0400 Received: by mail-qv1-f69.google.com with SMTP id 6a1803df08f44-690b5ad0e61so15723876d6.0 for ; Mon, 11 Mar 2024 14:59:56 -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.14.59.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 11 Mar 2024 14:59:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1710194398; 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=L9tqjm6MQlYl8InOWvUGruPRPvJCqkW54MwUESfEeMw=; b=K9CgTU25Q2wdlJSYYNPC8BmVA0QEFDfLI/4TXPPtaXux2DhCMQDAfjtWWgfpct6w21BRcU zfkd3CP74EkulcaWIkpOj5hWH26OW963ZEelaL9jHtehuM2IPdIo4yLO0c8DzAGBgvjh30 3AdVfZpgaYnXBLnYz+KnIiIVPIqulZU= X-MC-Unique: yMOVwB8UNxeCBfzcSb0YLw-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1710194396; x=1710799196; 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=L9tqjm6MQlYl8InOWvUGruPRPvJCqkW54MwUESfEeMw=; b=MkboWhdhsM1+2RxR+JOOhkfLigEmBxBozLRTpiY+/qBRQTHQ6AsmonOF0A5iqXl9/J M90iSHvxB+OVT50Kn4QyWerRldNRU+bKyzv58fMcfQdVuUxWjo2liv79hcVk9MB2Hsza LvMYU0Casc09K2RadXlv0J5MXgajdFLyo5M2x75ZOVIW3Bshqi3QBWBL84JRWH8ayBlw mqC9r/sDhYpAstvcJHgI/Ml/3ETF1fRizW2bXTg9VACRdUL23931DAFTR4Fmjh2RxWZO 6dnNIHD+5ZuDpkfcR8949ixbDBaJZ2q5gD0Q/Ains9iNqLpOvdP5bOXRfYtE6b9XQPui 3CLg== X-Gm-Message-State: AOJu0YxCQRWw/TUrptLSioKPvb80iIsP5pyY06LR1SRMt9oZliQtWBz1 BNvfWHUyKE2ASpSHaqVys8YoywO2MBEJpe8RWh99/F6P+/EdmsWPNB4PQSi1eaIshfPPClNwpDj 84zuBXYMacXKmIEiuUZVwDHhlVLcTaF6S1zSphRANpgfxi9BMlR7ibXqUWt8EHcpKgg9q42mvLR tpWFnOx3YsNvdadfkv0VDBB0QL3W7YenRB0A== X-Received: by 2002:a05:6214:1903:b0:68f:5d43:5e94 with SMTP id er3-20020a056214190300b0068f5d435e94mr7642141qvb.6.1710194396081; Mon, 11 Mar 2024 14:59:56 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHdb58FTINcFo/TyBnyBN4wza3Lw0FmwS44hJGnus24rZHw2UHWKIiW52EfVqFpw1ctBQBXyw== X-Received: by 2002:a05:6214:1903:b0:68f:5d43:5e94 with SMTP id er3-20020a056214190300b0068f5d435e94mr7642114qvb.6.1710194395554; Mon, 11 Mar 2024 14:59:55 -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 19/34] migration: export migration_is_active Date: Mon, 11 Mar 2024 17:59:10 -0400 Message-ID: <20240311215925.40618-20-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.129.124; envelope-from=peterx@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -30 X-Spam_score: -3.1 X-Spam_bar: --- X-Spam_report: (-3.1 / 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, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1710194643170100007 Content-Type: text/plain; charset="utf-8" From: Steve Sistare Delete the MigrationState parameter from migration_is_active so it can be exported and used without including migration.h. Signed-off-by: Steve Sistare Link: https://lore.kernel.org/r/1710179338-294359-4-git-send-email-steven.s= istare@oracle.com Signed-off-by: Peter Xu --- include/migration/misc.h | 2 +- hw/vfio/common.c | 4 ++-- migration/migration.c | 10 ++++++---- system/dirtylimit.c | 2 +- 4 files changed, 10 insertions(+), 8 deletions(-) diff --git a/include/migration/misc.h b/include/migration/misc.h index 79cff6224e..e1f1bf853e 100644 --- a/include/migration/misc.h +++ b/include/migration/misc.h @@ -60,7 +60,7 @@ void dump_vmstate_json_to_file(FILE *out_fp); void migration_object_init(void); void migration_shutdown(void); bool migration_is_idle(void); -bool migration_is_active(MigrationState *); +bool migration_is_active(void); bool migration_is_setup_or_active(void); bool migrate_mode_is_cpr(MigrationState *); =20 diff --git a/hw/vfio/common.c b/hw/vfio/common.c index 896eab8103..2dbbf62e15 100644 --- a/hw/vfio/common.c +++ b/hw/vfio/common.c @@ -182,7 +182,7 @@ static bool vfio_devices_all_dirty_tracking(VFIOContain= erBase *bcontainer) VFIODevice *vbasedev; MigrationState *ms =3D migrate_get_current(); =20 - if (ms->state !=3D MIGRATION_STATUS_ACTIVE && + if (!migration_is_active() && ms->state !=3D MIGRATION_STATUS_DEVICE) { return false; } @@ -225,7 +225,7 @@ vfio_devices_all_running_and_mig_active(const VFIOConta= inerBase *bcontainer) { VFIODevice *vbasedev; =20 - if (!migration_is_active(migrate_get_current())) { + if (!migration_is_active()) { return false; } =20 diff --git a/migration/migration.c b/migration/migration.c index af21403bad..17859cbaee 100644 --- a/migration/migration.c +++ b/migration/migration.c @@ -1406,7 +1406,7 @@ static void migrate_fd_cleanup(MigrationState *s) qemu_fclose(tmp); } =20 - assert(!migration_is_active(s)); + assert(!migration_is_active()); =20 if (s->state =3D=3D MIGRATION_STATUS_CANCELLING) { migrate_set_state(&s->state, MIGRATION_STATUS_CANCELLING, @@ -1637,8 +1637,10 @@ bool migration_is_idle(void) return false; } =20 -bool migration_is_active(MigrationState *s) +bool migration_is_active(void) { + MigrationState *s =3D current_migration; + return (s->state =3D=3D MIGRATION_STATUS_ACTIVE || s->state =3D=3D MIGRATION_STATUS_POSTCOPY_ACTIVE); } @@ -3461,7 +3463,7 @@ static void *migration_thread(void *opaque) =20 trace_migration_thread_setup_complete(); =20 - while (migration_is_active(s)) { + while (migration_is_active()) { if (urgent || !migration_rate_exceeded(s->to_dst_file)) { MigIterateState iter_state =3D migration_iteration_run(s); if (iter_state =3D=3D MIG_ITERATE_SKIP) { @@ -3607,7 +3609,7 @@ static void *bg_migration_thread(void *opaque) migration_bh_schedule(bg_migration_vm_start_bh, s); bql_unlock(); =20 - while (migration_is_active(s)) { + while (migration_is_active()) { MigIterateState iter_state =3D bg_migration_iteration_run(s); if (iter_state =3D=3D MIG_ITERATE_SKIP) { continue; diff --git a/system/dirtylimit.c b/system/dirtylimit.c index 774ff44f79..051e0311c1 100644 --- a/system/dirtylimit.c +++ b/system/dirtylimit.c @@ -83,7 +83,7 @@ static void vcpu_dirty_rate_stat_collect(void) int64_t period =3D DIRTYLIMIT_CALC_TIME_MS; =20 if (migrate_dirty_limit() && - migration_is_active(s)) { + migration_is_active()) { period =3D s->parameters.x_vcpu_dirty_limit_period; } =20 --=20 2.44.0