Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp3157313pxj; Mon, 10 May 2021 20:45:46 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxElWRcC0d+vAKdSxB49dS/TRnErIsOiQdl5K9APGh7Ec5RjpZ5dnd+NStcAR9ybsmmG7j1 X-Received: by 2002:a92:c569:: with SMTP id b9mr10842845ilj.117.1620704746518; Mon, 10 May 2021 20:45:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1620704746; cv=none; d=google.com; s=arc-20160816; b=mVvhCpOLMMMVMMdCL+z+kCjfNyfeU+rrmn8fXt56DBtwr6Noo13HD37YM3oyEy3k89 jAai1acsSx8bgmOahsdMTfKMCupI8nZMbJSNJSjNeOhTSpC+8Ai26eqedoYLG4EFKhSq oN5SKMd+B8B/UFpeuFyuR8JEsui8lvaCgNpSGC++u/qCaIIKPZAm2qd6SkEUHy6Ulmws nL9cPaLJqmosDMYPFXUHbV1id0rF1rm/qksORZNlbPXMzQ9aGqSF7BiP+2otO7/r7kbU sILpS7h5W3GZiEtM5AwNNG8N9WEHUyBo6nW5U86q3iQfLTpeysC42ej50lO+1dwN8Vsi ok5Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to :mime-version:user-agent:date:message-id:from:references:cc:to :subject; bh=MuXYDXLVN3+UzjTLWKAcWHMOSg/x2OaFSPH+HEYYUfY=; b=CFduH0Z3dFeElxirzUXLnBUbqp/j5ZiR1LPDARaVWDs19vHneYxj4WcqQwxHM9HHGJ hu/BQHraBVP5qgTXjCSdH3VdcjnX2O1GcDtZb8aHMcrtMKI43vhkQeRYxGpr8U4W1+kD q6AknhkWLPTB0wCueSmVIXe0K3Tuk+0UekOgDkPJ/8ayMoLinIC91Cs6SxqEymVepRcv Nk/WY+j4jfMgjdidQiX+d6B0rePBEgocTK5QKVWrH/9puwgsX52XE68+R4JHmW7fdaWi iJKNtbYxsvFOXYX5s7wnJ0caGmHCzfE7vr8gHIHr4GnHFqSk3TzYpLcItcW9F4yjlwrW Ng7Q== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=hisilicon.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id s19si51139iow.52.2021.05.10.20.45.33; Mon, 10 May 2021 20:45:46 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=hisilicon.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229932AbhEKDqF (ORCPT + 99 others); Mon, 10 May 2021 23:46:05 -0400 Received: from szxga04-in.huawei.com ([45.249.212.190]:2768 "EHLO szxga04-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229465AbhEKDqD (ORCPT ); Mon, 10 May 2021 23:46:03 -0400 Received: from DGGEMS412-HUB.china.huawei.com (unknown [172.30.72.58]) by szxga04-in.huawei.com (SkyGuard) with ESMTP id 4FfNy762Z9zmg73; Tue, 11 May 2021 11:41:35 +0800 (CST) Received: from [127.0.0.1] (10.69.38.196) by DGGEMS412-HUB.china.huawei.com (10.3.19.212) with Microsoft SMTP Server id 14.3.498.0; Tue, 11 May 2021 11:44:49 +0800 Subject: Re: [Question] Indefinitely block in the host when remove the PF driver To: Alex Williamson , CC: , , Linux Kernel Mailing List , "Zengtao (B)" , Linuxarm References: <20210430082940.4b0e0397@redhat.com> From: Yicong Yang Message-ID: Date: Tue, 11 May 2021 11:44:49 +0800 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.5.1 MIME-Version: 1.0 In-Reply-To: <20210430082940.4b0e0397@redhat.com> Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit X-Originating-IP: [10.69.38.196] X-CFilter-Loop: Reflected Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org [ +qemu-devel ] On 2021/4/30 22:29, Alex Williamson wrote: > On Fri, 30 Apr 2021 15:57:47 +0800 > Yicong Yang wrote: > >> When I try to remove the PF driver in the host, the process will be blocked >> if the related VF of the device is added in the Qemu as an iEP. >> >> here's what I got in the host: >> >> [root@localhost 0000:75:00.0]# rmmod hisi_zip >> [99760.571352] vfio-pci 0000:75:00.1: Relaying device request to user (#0) >> [99862.992099] vfio-pci 0000:75:00.1: Relaying device request to user (#10) >> [...] >> >> and in the Qemu: >> >> estuary:/$ lspci -tv >> -[0000:00]-+-00.0 Device 1b36:0008 >> +-01.0 Device 1af4:1000 >> +-02.0 Device 1af4:1009 >> \-03.0 Device 19e5:a251 <----- the related VF device >> estuary:/$ qemu-system-aarch64: warning: vfio 0000:75:00.1: Bus 'pcie.0' does not support hotplugging >> qemu-system-aarch64: warning: vfio 0000:75:00.1: Bus 'pcie.0' does not support hotplugging >> qemu-system-aarch64: warning: vfio 0000:75:00.1: Bus 'pcie.0' does not support hotplugging >> qemu-system-aarch64: warning: vfio 0000:75:00.1: Bus 'pcie.0' does not support hotplugging >> [...] >> >> The rmmod process will be blocked until I kill the Qemu process. That's the only way if I >> want to end the rmmod. >> >> So my question is: is such block reasonable? If the VF devcie is occupied or doesn't >> support hotplug in the Qemu, shouldn't we fail the rmmod and return something like -EBUSY >> rather than make the host blocked indefinitely? > > Where would we return -EBUSY? pci_driver.remove() returns void. > Without blocking, I think our only option would be to kill the user > process. > yes. the remove() callback of pci_driver doesn't provide a way to abort the process. >> Add the VF under a pcie root port will avoid this. Is it encouraged to always >> add the VF under a pcie root port rather than directly add it as an iEP? > > Releasing a device via the vfio request interrupt is always a > cooperative process currently, the VM needs to be configured such that > the device is capable of being unplugged and the guest needs to respond > to the ejection request. Thanks, > Does it make sense to abort the VM creation and give some warnings if user try to pass a vfio pci device to the Qemu and doesn't attach it to a hotpluggable bridge? Currently I think there isn't such a mechanism in Qemu. Thanks, Yicong