From mboxrd@z Thu Jan 1 00:00:00 1970 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=-17.9 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER,INCLUDES_PATCH,MAILING_LIST_MULTI,NICE_REPLY_A, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,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 0773CC48BE8 for ; Mon, 14 Jun 2021 08:18:25 +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 B898F61380 for ; Mon, 14 Jun 2021 08:18:24 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org B898F61380 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]:50372 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lshnb-0004fa-Qi for qemu-devel@archiver.kernel.org; Mon, 14 Jun 2021 04:18:23 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:41390) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lshks-0007pN-DB for qemu-devel@nongnu.org; Mon, 14 Jun 2021 04:15:34 -0400 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:53458) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lshko-0003Cb-RZ for qemu-devel@nongnu.org; Mon, 14 Jun 2021 04:15:34 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1623658529; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=OuPg5FG4sN+TnX8szTUkLzVV1sMvKaisS6C4WrzTb8w=; b=DWwnPDi4W9FsYO8CI9sCoxGewHih49EgkCMWGIicgT4Rw0sQxvWIJ1xwncWcxAkXO5r4Tk q7ywVqg3QJNMFvSbKhLmhQH2x4lE1qHk7R/soZm1Zskis9TUcDS3GCxsEx3aZaEjBffXaM GDNwAzFbIMDjlSNd5JoJ1i2Tr2VTVG4= Received: from mail-ej1-f70.google.com (mail-ej1-f70.google.com [209.85.218.70]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-479-bIXRjfnlPjOTTAeF-upMkg-1; Mon, 14 Jun 2021 04:15:25 -0400 X-MC-Unique: bIXRjfnlPjOTTAeF-upMkg-1 Received: by mail-ej1-f70.google.com with SMTP id k1-20020a17090666c1b029041c273a883dso2742362ejp.3 for ; Mon, 14 Jun 2021 01:15:25 -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:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=OuPg5FG4sN+TnX8szTUkLzVV1sMvKaisS6C4WrzTb8w=; b=Whq29WuHgCdMDVpyQcTI71eXhuM1Kbe9G1UyB2Zfq2NBoVVhAm0qfAl+3GMO/ZMnbi F+66vgzp7HZD6giQvIgw0W16DZdpeXyW5QWjIPNv5ywXZbH38joY9sdCvsg/LeJH4U7v nKEtOdDbUVkcWPUkSTB9QGBOIFeZmrdxmcL+/FE54365Bi+EUhODqGXYDRNYLmEJby5A K3oclaQJ1C/Y3EOJoWDtwJ3no5ptAfmFfrXkISkCa44I12eSj9U64HeRl74T4GsGZJeC nm9wDRzba2FSINwUdnhsWnPZaxUbfMcnG1+bnsnGTuZmKSx+uKvIsU/rO+nXOPM1PJqj ac5w== X-Gm-Message-State: AOAM531yocFU1L1jn3GyL7TcGUJXLxafMDZNTeBzV6TJyCXuM25NWEdN Mz+Ae1jBvMADQ7NB5vw9ZSIR4IfZt5OhsHW8rT/hLi0fAevFExwgSAvpp/dSr4q1N9o9AoHuY5o eRvGNCoYgemQ6VPU= X-Received: by 2002:a17:906:35cd:: with SMTP id p13mr14439436ejb.24.1623658524579; Mon, 14 Jun 2021 01:15:24 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw3fWfL5uu1yW8eko9L9AGGDUkWpaeAEuwLL1uyu4lkn1bsScG4NhIdD5Xf/2O6+vWpNS8zwQ== X-Received: by 2002:a17:906:35cd:: with SMTP id p13mr14439423ejb.24.1623658524370; Mon, 14 Jun 2021 01:15:24 -0700 (PDT) Received: from ?IPv6:2001:b07:6468:f312:c8dd:75d4:99ab:290a? ([2001:b07:6468:f312:c8dd:75d4:99ab:290a]) by smtp.gmail.com with ESMTPSA id cd4sm6668630ejb.104.2021.06.14.01.15.23 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 14 Jun 2021 01:15:23 -0700 (PDT) Subject: Re: [PATCH] esp: fix migration version check in esp_is_version_5() To: Mark Cave-Ayland , qemu-devel@nongnu.org, laurent@vivier.eu, hpoussin@reactos.org References: <20210613102614.5438-1-mark.cave-ayland@ilande.co.uk> From: Paolo Bonzini Message-ID: <7c83e6b3-4230-b700-15fc-5462c84df3f9@redhat.com> Date: Mon, 14 Jun 2021 10:15:22 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.10.1 MIME-Version: 1.0 In-Reply-To: <20210613102614.5438-1-mark.cave-ayland@ilande.co.uk> Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=pbonzini@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit Received-SPF: pass client-ip=216.205.24.124; envelope-from=pbonzini@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.199, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, NICE_REPLY_A=-0.144, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H4=-0.01, RCVD_IN_MSPIKE_WL=-0.01, 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: , Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" On 13/06/21 12:26, Mark Cave-Ayland wrote: > Commit 4e78f3bf35 "esp: defer command completion interrupt on incoming data > transfers" added a version check for use with VMSTATE_*_TEST macros to allow > migration from older QEMU versions. Unfortunately the version check fails to > work in its current form since if the VMStateDescription version_id is > incremented, the test returns false and so the fields are not included in the > outgoing migration stream. > > Change the version check to use >= rather == to ensure that migration works > correctly when the ESPState VMStateDescription has version_id > 5. > > Signed-off-by: Mark Cave-Ayland > Fixes: 4e78f3bf35 ("esp: defer command completion interrupt on incoming data transfers") > --- > hw/scsi/esp.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/hw/scsi/esp.c b/hw/scsi/esp.c > index bfdb94292b..39756ddd99 100644 > --- a/hw/scsi/esp.c > +++ b/hw/scsi/esp.c > @@ -1120,7 +1120,7 @@ static bool esp_is_version_5(void *opaque, int version_id) > ESPState *s = ESP(opaque); > > version_id = MIN(version_id, s->mig_version_id); > - return version_id == 5; > + return version_id >= 5; > } > > int esp_pre_save(void *opaque) > You can use the _V version of the macros and get rid of this function altogether. VMSTATE_FIFO8_TEST is not used outside esp.c so it can also be replaced with VMSTATE_FIFO8_V, just initializing .version_id in place of .field_exists. Paolo