Received: by 2002:a05:6a10:a852:0:0:0:0 with SMTP id d18csp387035pxy; Fri, 30 Apr 2021 07:32:04 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxhebGn8pLa5jOq2xYk5P/ut4mP5k085Xci7vV8p8dyXg5SXOX1kluKUa5hiy1qZeRZeK98 X-Received: by 2002:a62:7642:0:b029:25c:7cdd:3cf4 with SMTP id r63-20020a6276420000b029025c7cdd3cf4mr5342897pfc.9.1619793124077; Fri, 30 Apr 2021 07:32:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1619793124; cv=none; d=google.com; s=arc-20160816; b=WlhvvTfGK+FWLTQjzMFhtp230Rr4kRPqH0+AGGj6FKBnbxNbWA1aaF4Z1oqYgidYZl fEamRE8Pk77kI+ygBotZ14yEn7v5ODAW7uF1e5zSfUeSuPciJ02IQIFOq7drd10VaPi7 OsZ/rfZVRGUdL12qiUKMc8GZRBm9WvCjPCe+vhfS0s85Q800ZljGzO1vLEf3OlAg3hp5 mQGg6bx9QkoNoDm3TFpmhLw+o0TYpLGJvvbgAZcrHrdNiXM6e4ttycPPJKpH37n0b9/q XyuiVauHN9UOn1eFkQ6MxwNEHIpys7iVfUzyNORV5K4jPpOeAvJ9DV6bGTgOe59mon19 LROA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:subject:cc:to:from:date :dkim-signature; bh=FPEELsSGx4cLbmxHKF7dTq3mC1Xpq1F0QvtZc08MVK4=; b=ypMkNlQ9Z4UYlKPd88A3XH35epwps3wtXsJMLd8TQw3dtRzx+3jevaZAWMRoPnHQfB IDFZPZHxzVTv9kfT4a1k5ra6kVam3God1F/9yt4zkO7Mo7Fwi3gD9SyxEIbsdGhBHbKC 7tR0RrfV+DG4PS6N7Vesm7SS28yepZFl7n3KfV/y3HrswpitcC8Mqpx1NnwJTQjkZAbK R+wjk7vOspyGJWoyfTDgB9kCDuuRsEM0NdBiM2bSAXF9TY2Pj3JoCULHvJFEKV47jcE8 j6hLxrlgf2UM5k6x4JoWdl41O0+LrIjPH7N/2c/mXjvYrxGuLiknHCFZ4WTxB7rcoufc 3gHg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=eU8pU6YW; 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=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id r14si3729896pga.138.2021.04.30.07.31.49; Fri, 30 Apr 2021 07:32:04 -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; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=eU8pU6YW; 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=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232793AbhD3Oag (ORCPT + 99 others); Fri, 30 Apr 2021 10:30:36 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:51401 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230351AbhD3Oae (ORCPT ); Fri, 30 Apr 2021 10:30:34 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1619792985; 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=FPEELsSGx4cLbmxHKF7dTq3mC1Xpq1F0QvtZc08MVK4=; b=eU8pU6YWtyzMvQAJmcdsD0F9MT9F9kK/xE4oQbrGs8xo/Q3WNsTrDVxQL/xInzXzPyDECB gOVRt2LSD2/eoU1H8ZpqyY+vzcaDwErtDwj8GRAjftBIO8+zyKTyATouftUEe7RuvuP/p3 qUY1vHeqNpcOvasAgAzNDYhWaiMt+d8= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-390-y0KmsgpjO0yM5DYo73n47Q-1; Fri, 30 Apr 2021 10:29:43 -0400 X-MC-Unique: y0KmsgpjO0yM5DYo73n47Q-1 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 146AC107ACCD; Fri, 30 Apr 2021 14:29:42 +0000 (UTC) Received: from redhat.com (ovpn-113-225.phx2.redhat.com [10.3.113.225]) by smtp.corp.redhat.com (Postfix) with ESMTP id 86B66100763C; Fri, 30 Apr 2021 14:29:41 +0000 (UTC) Date: Fri, 30 Apr 2021 08:29:40 -0600 From: Alex Williamson To: Yicong Yang Cc: , , Linux Kernel Mailing List , "Zengtao (B)" , Linuxarm Subject: Re: [Question] Indefinitely block in the host when remove the PF driver Message-ID: <20210430082940.4b0e0397@redhat.com> In-Reply-To: References: MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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. > 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, Alex