Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-15.1 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,NICE_REPLY_A,SPF_HELO_NONE,SPF_PASS,USER_AGENT_SANE_1 autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id E0ACAC11F65 for ; Wed, 30 Jun 2021 09:05:46 +0000 (UTC) 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 mail.kernel.org (Postfix) with ESMTPS id 647F061C4D for ; Wed, 30 Jun 2021 09:05:46 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 647F061C4D Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Received: from localhost ([::1]:44674 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lyWAD-0004tj-Ep for qemu-devel@archiver.kernel.org; Wed, 30 Jun 2021 05:05:45 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:58882) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lyW9G-000471-HL for qemu-devel@nongnu.org; Wed, 30 Jun 2021 05:04:46 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:30146) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lyW9E-0005iw-Fk for qemu-devel@nongnu.org; Wed, 30 Jun 2021 05:04:46 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1625043883; 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: in-reply-to:in-reply-to:references:references; bh=R7VADrFGWD0ohf4UNwNwkWETXfUiBXZEDzrQIOUidS0=; b=RAh2P0+hFInRzLcTZohY3sy3Dd2hYa84PsCR5++68qs7TYb6ZxW5qeann7LEs6OiLPIdD+ XAD9xhGRvz4gBaxp26OKmaAH9vuAuIG80gYikPn5IutVFhNS5Pb7X9louUMD0UepMv4dLL 0Fj/W+wgXNkQbE0Aic+TahZK6O/olcQ= Received: from mail-wm1-f70.google.com (mail-wm1-f70.google.com [209.85.128.70]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-278-t1ac1jGEMkmVDH53Ly8oTw-1; Wed, 30 Jun 2021 05:04:42 -0400 X-MC-Unique: t1ac1jGEMkmVDH53Ly8oTw-1 Received: by mail-wm1-f70.google.com with SMTP id m40-20020a05600c3b28b02901f42375a73fso182254wms.5 for ; Wed, 30 Jun 2021 02:04:41 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-transfer-encoding :content-language; bh=R7VADrFGWD0ohf4UNwNwkWETXfUiBXZEDzrQIOUidS0=; b=nTO+UzYF6ptq7NTIynPso1ZysPJo6sicFczN5KGaUcd2wbMb2/ZOaMuL/uzV+zWx6D LbBCNjw9y+t3sVoSgkJFMr9Y6waDUVu5St/9B+0zb9kKmGggqu7qaURMNa53wm5MNdhG p8oVTeVQ9esUZ7koZoOSEjQpSCEhipyhBKS6sjtGRezvV+YFxLfeiMe+/BF0pFmPeggW ODmtBB9Q8S0jDRAihT3lZa/2dHO9Ybk+e9GrSakjWL1J94LXLRclAMf4tj8WkoMbcP9W 4gxcpXRLA+ouTH4hATu/R3XA9Bboe/C/td8KCnXDah73EgeHQvj7mvdBYpOKKHaEmVdr QAOA== X-Gm-Message-State: AOAM53305QiBwGsDJoA3zQQ4Ay1KCnV28RStnfiUDKeS4yxjEmjxE1mI YwAsz/10nTwY5eIi18ASoswI3W65vhypRlj4G+TvGK9Pe+m8yF3Woprrt93Kwe78Iu3zCuYTfPw x7DIcSLsh9IuId7A= X-Received: by 2002:a5d:64ca:: with SMTP id f10mr22828819wri.178.1625043881073; Wed, 30 Jun 2021 02:04:41 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyMK8wubcRWBgwOWjocZyp16NHPkLhQyUMt3L24lz72EfJ9f1ibs8uI1UfquQTYxyXSw8R13w== X-Received: by 2002:a5d:64ca:: with SMTP id f10mr22828796wri.178.1625043880787; Wed, 30 Jun 2021 02:04:40 -0700 (PDT) Received: from [192.168.100.43] ([82.142.0.246]) by smtp.gmail.com with ESMTPSA id i11sm5592890wmg.18.2021.06.30.02.04.39 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 30 Jun 2021 02:04:40 -0700 (PDT) Subject: Re: [PATCH 2/2] migration: failover: continue to wait card unplug on error To: quintela@redhat.com References: <20210629155007.629086-1-lvivier@redhat.com> <20210629155007.629086-3-lvivier@redhat.com> <87im1wk1ap.fsf@secure.mitica> From: Laurent Vivier Message-ID: Date: Wed, 30 Jun 2021 11:04:38 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.11.0 MIME-Version: 1.0 In-Reply-To: <87im1wk1ap.fsf@secure.mitica> Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=lvivier@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit Content-Language: en-US Received-SPF: pass client-ip=170.10.133.124; envelope-from=lvivier@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -31 X-Spam_score: -3.2 X-Spam_bar: --- X-Spam_report: (-3.2 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.435, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, NICE_REPLY_A=-0.001, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, 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.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Jens Freimann , qemu-devel@nongnu.org, "Dr. David Alan Gilbert" Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" On 29/06/2021 19:50, Juan Quintela wrote: > Laurent Vivier wrote: >> If the user cancels the migration in the unplug-wait state, >> QEMU will try to plug back the card and this fails because the card >> is partially unplugged. >> To avoid the problem, continue to wait the card unplug, but to >> allow the migration to be canceled if the card never finishes to unplug >> use a timeout. >> >> Bug: https://bugzilla.redhat.com/show_bug.cgi?id=1976852 >> Signed-off-by: Laurent Vivier >> --- >> migration/migration.c | 11 +++++++++++ >> 1 file changed, 11 insertions(+) >> >> diff --git a/migration/migration.c b/migration/migration.c >> index 3e92c405a2b6..3b06d43a7f42 100644 >> --- a/migration/migration.c >> +++ b/migration/migration.c >> @@ -3679,6 +3679,17 @@ static void qemu_savevm_wait_unplug(MigrationState *s, int old_state, >> qemu_savevm_state_guest_unplug_pending()) { >> qemu_sem_timedwait(&s->wait_unplug_sem, 250); >> } >> + if (s->state != MIGRATION_STATUS_WAIT_UNPLUG) { >> + int timeout = 120; /* 30 seconds */ >> + /* >> + * migration has been canceled >> + * but as we have started an unplug we must wait the end >> + * to be able to plug back the card >> + */ >> + while (timeout-- && qemu_savevm_state_guest_unplug_pending()) { >> + qemu_sem_timedwait(&s->wait_unplug_sem, 250); >> + } >> + } >> >> migrate_set_state(&s->state, MIGRATION_STATUS_WAIT_UNPLUG, new_state); >> } else { > I agree with the idea. But if we are getting out due to timeout == 0, > shouldn't we return some error, warning, whatever? In that case, we keep the current behaviour: guest kernel will report an error when it will try to plug back the card that has not been unplugged. This is a corner case: if it happens we have something really wrong with the machine. Perhaps we can remove the timeout, but I don't like to block the user, or increase it to be sure. Thanks, Laurent