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 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 18713C433F5 for ; Fri, 1 Oct 2021 11:03:39 +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 738C661507 for ; Fri, 1 Oct 2021 11:03:38 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 738C661507 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=nongnu.org Received: from localhost ([::1]:37114 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mWGKH-0007uW-90 for qemu-devel@archiver.kernel.org; Fri, 01 Oct 2021 07:03:37 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:53808) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mWGIe-00064Z-Ac for qemu-devel@nongnu.org; Fri, 01 Oct 2021 07:01:56 -0400 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:52711) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mWGIT-0005aN-Ip for qemu-devel@nongnu.org; Fri, 01 Oct 2021 07:01:54 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1633086101; 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=HXYf5CmfDbUcmrXM3YY5m0hpwRh30a8hWHdzZt/s+w0=; b=PP/an1LlJ4XIkPAThkLuyakaEZY8Aefapyg2hBEiL6BZxZECPLnPJTlLgDVy964Uds8Zyj m5+2yMb0VVh3Cf13CYDITG2u9EzIywhZUn1IdFBn2m6ivHJqfX/4cjphDj6IZKJfBuOT4h eZkBPM3YaVYyuOatc7wmaMyhBjoi9lA= Received: from mail-wm1-f71.google.com (mail-wm1-f71.google.com [209.85.128.71]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-525-j99HlEPEOPiF9Vm2rNEZ1w-1; Fri, 01 Oct 2021 07:01:40 -0400 X-MC-Unique: j99HlEPEOPiF9Vm2rNEZ1w-1 Received: by mail-wm1-f71.google.com with SMTP id o11-20020a05600c378b00b0030d4f47013aso737939wmr.7 for ; Fri, 01 Oct 2021 04:01:40 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:message-id:date:mime-version:user-agent:subject :content-language:to:cc:references:from:in-reply-to :content-transfer-encoding; bh=HXYf5CmfDbUcmrXM3YY5m0hpwRh30a8hWHdzZt/s+w0=; b=NED+guWQTKKq0b/Qish11T5xV8WtQOhFmA3pD/KSW4rU3jLDQCT3bBoSq+LzhI5Bqh 64PKYDI5BKBUgF1LqUx3WySH9Sp9bu6mRFG4Q1Mz/oabPh/Afh0U1oB4rY6Z2+IH61MD YmMu8vzvlJrUnn1YUloAYMAFGp9rV/O+YgCLjYZ+VT6lEfGSGHYFOuCR/ETYMB1cvziD upogIaMWC5PHNgZA+sG3MoU0WZRoyeDxK6ZkOZNgbfJY1prwhojtSFqPr7Lwb0i2ZamI +MHiRSqZ3tK5K6GrtcrTlUBzpcM5SU4GZ6llslHrcJ2USutx0FaaK9bFElvxZt5dFsDE 9asA== X-Gm-Message-State: AOAM533MFpOg98ol4D3sZ0zCm1nmI2PRmDOL6iH9gCH9jsB/mP0ap+u0 Th/Ev5DnB+IMmSW6n8hhFltWd1sE/mLyKx4DvHLkEvK43oxQ9MUxIcLUyLC30+eO8PWUx2Y4s9a AIeexIIEcuf0W9Sw= X-Received: by 2002:adf:ab06:: with SMTP id q6mr3009134wrc.433.1633086099498; Fri, 01 Oct 2021 04:01:39 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwotPMliT1TzWiKEsRho0rdPW+PxxhBLFvSmu7VaXDbJ7lWYYw4VrXJs47ClN6dfshvjJrNng== X-Received: by 2002:adf:ab06:: with SMTP id q6mr3009107wrc.433.1633086099204; Fri, 01 Oct 2021 04:01:39 -0700 (PDT) Received: from [192.168.100.42] ([82.142.21.142]) by smtp.gmail.com with ESMTPSA id y11sm6605594wrg.18.2021.10.01.04.01.38 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 01 Oct 2021 04:01:38 -0700 (PDT) Message-ID: <0eeefb15-1b41-076c-7dd4-ca5fc78eefa9@redhat.com> Date: Fri, 1 Oct 2021 13:01:37 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.1.0 Subject: Re: [PATCH v3] failover: fix unplug pending detection To: Gerd Hoffmann References: <20211001082502.1342878-1-lvivier@redhat.com> <20211001104514.46bhlpenx4rz2qnm@sirius.home.kraxel.org> From: Laurent Vivier In-Reply-To: <20211001104514.46bhlpenx4rz2qnm@sirius.home.kraxel.org> 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-Language: en-US Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Received-SPF: pass client-ip=216.205.24.124; envelope-from=lvivier@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -38 X-Spam_score: -3.9 X-Spam_bar: --- X-Spam_report: (-3.9 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, NICE_REPLY_A=-1.127, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H2=-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: "Daniel P. Berrange" , "Michael S. Tsirkin" , Juan Quintela , Julia Suvorova , qemu-devel@nongnu.org, Ani Sinha , Igor Mammedov , Jens Freimann Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" On 01/10/2021 12:45, Gerd Hoffmann wrote: > On Fri, Oct 01, 2021 at 10:25:02AM +0200, Laurent Vivier wrote: >> Failover needs to detect the end of the PCI unplug to start migration >> after the VFIO card has been unplugged. >> >> To do that, a flag is set in pcie_cap_slot_unplug_request_cb() and reset in >> pcie_unplug_device(). > >> + /* >> + * pending_deleted_event is used by virtio-net failover to detect the >> + * end of the unplug operation, the flag is set to false in >> + * acpi_pcihp_eject_slot() when the operation is completed. >> + */ >> + pdev->qdev.pending_deleted_event = true; > > This has the side effect of blocking a second 'device_del' command. This problem is not introduced by this patch as it only adds the code we already have in PCIe Native hotplug to ACPI hotplug (but see below). > So, in case the first time didn't work (for example due to the guest not > listening because grub just doesn't do that), you can try a second time > once the linux kernel is up'n'running. > > I suspect this patch will break that (didn't actually test though). I think the solution to this problem is to not check for pending_deleted_event value in qmp_device_del(). But this has been explicitly added by: commit cce8944cc9efab47d4bf29cfffb3470371c3541b Author: Julia Suvorova Date: Thu Feb 20 17:55:56 2020 +0100 qdev-monitor: Forbid repeated device_del Device unplug can be done asynchronously. Thus, sending the second device_del before the previous unplug is complete may lead to unexpected results. On PCIe devices, this cancels the hot-unplug process. Signed-off-by: Julia Suvorova Reviewed-by: Stefan Hajnoczi Message-Id: <20200220165556.39388-1-jusual@redhat.com> Signed-off-by: Paolo Bonzini So do you mean ACPI differs from PCIe Native hotplug in this case? Thanks, Laurent