From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-pl1-f176.google.com (mail-pl1-f176.google.com [209.85.214.176]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id DB0D83D4130 for ; Tue, 23 Jun 2026 12:38:16 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.176 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1782218298; cv=none; b=iGnDiZs5Jm3l83Y9P+J7/4Lg1gu6joXjzKbVFmox3oofYMX92Zowl4iBf0HjjF+Rrd7vyp8XKm/RzvZUPgOi9Flk6JH6U5/RDQQMgkkrrdlZKlRGylHSjdcoWN9ou53VUN/tXA60rKvpYVmFTzJUInGamnNqn6zgnONKsQDtHa0= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1782218298; c=relaxed/simple; bh=0r+J+xSFPVTDu03hM9HofRSVjf4b9CkdYvs63DmWm7s=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=DC3UxAQfxbkEjLNaXqHUu13o1bruwNx4VvtYgMJK26ZADSIae3cyAUTDCoGoAjW70jsCUbmShRGQTHfTIQH4q+7DiDKeWiD2Jp/Gqt5pUU3C9UQhA6tEdAiOpuyyqoiIz1vXCAAsinTe5UgAdb4aWGGdA1XNRckpdfY50l3eyD4= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=Yg3sRbg4; arc=none smtp.client-ip=209.85.214.176 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=google.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="Yg3sRbg4" Received: by mail-pl1-f176.google.com with SMTP id d9443c01a7336-2c6a4eccab1so40775ad.1 for ; Tue, 23 Jun 2026 05:38:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20251104; t=1782218296; x=1782823096; darn=vger.kernel.org; h=in-reply-to:content-disposition:content-type:mime-version :references:message-id:subject:cc:to:from:date:from:to:cc:subject :date:message-id:reply-to:content-type; bh=kRyC6uc9PiBbjK9ZqA0DFvnVffsSMfHhakITg77vSEE=; b=Yg3sRbg4JcgakwmVfurdoXfjSEBxkvQUvrGes5NXfUKDFWt+W+dLi61pcHGBIzlJ/f eKvld8j2snhn0VdxWAGJWsZJxkTde3rC9QvL4/P5Yrsic0c3LHmetJNsr3fjxsBi+0GH 4bnUr/NIcg5FFT0fhdMdngy9o3gL4jozOs3FLKvNbfyOOh9NSwjkPKT++hwaFdvY9AKv JBSzZXvkPB2sSrkhBQjCq+fEPjLlubZh/B41aNOIpxnEZkjzWuazxkuU3AW5lZbpmQqv 0wu5Q9OUGn6pMz9lINaWM9nBDbZ+S3OJBtPebRTgLzLLMkQ9vLRfEKlRqfAW8ISqwdTH VFkA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1782218296; x=1782823096; h=in-reply-to:content-disposition:content-type:mime-version :references:message-id:subject:cc:to:from:date:x-gm-gg :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to :content-type; bh=kRyC6uc9PiBbjK9ZqA0DFvnVffsSMfHhakITg77vSEE=; b=F9sMD4EtRy8KRvyfr8OVHisgTpwa4LKd0PW/v1I9739cxQSIxJ5Od3gdeL7BB2nTP2 JBB/9Nkl/iL8R9GnIU6xYTIwC34bTkUpiFp/BWZP+RWo+DuTHXYMVhuFrE44rjztF4Vt 7S9eJGgUHfatICXD345/BSC1zMI+0hhvQ3/WVZysVYOXI/25lj3JZ0CryqcXYeU3PEdf 1fr2U+UY53jbLbLwAGWI+Vfm0NbCHJ+9lm0g6ftDKLccOR+UwMR2cB1SJr1tBTjPDFck uEP5lBdirvR7NUKCWaB/F0TtkjLAuYC5ElMCyt1T/JiUtes8Mh796qRNABRlywugrcyd b43A== X-Forwarded-Encrypted: i=1; AHgh+RqVMbuArTJhw1O/ZrWPPFGbOQ+jN9psUZwaJzOxmeQWhi5+1jay1Ghwht43PfLI69qWyitg4M1khJFJVk4=@vger.kernel.org X-Gm-Message-State: AOJu0Yxbc/Y3zC8dLxhh0EzephkDR7I08YacrWPCymMBBcBIU72pJTFS nYvY6u/wUGcHjKcc9HjeprwddOnAzvVQ8839V/qxROvJMnpP7jr4igkZi8oTHxZkrg== X-Gm-Gg: AfdE7cnsukiocgAeyzHMNwNGVq6838EPqTl3cg+qoOyRhp+Zj4S74Z/lBv2SO2m7igz 9X/wChUXChYSurrCr2g0hv4rCZvm3CiSVZcSt0auzpL/rxR0oBTzpClO6aw/hrBC8cg0zBKsDgl EKMTvoTu9773MhjRjaFiWvrzEvg4/0Bc3Agu8YM/ffak8tEmvyPPt5pgLch8FjXQ/RCQEBZv3XS vu8/3eEKZsP2Avci3GU9PGk9gJmblf5CBG0kuvOZmoMl60PA2pu320e6pAbBcsmcZUOHv8vbybW wJIn8CaK5xVOz3WhTTlcEnjRCTrfEHX4TVQysYdyR65ghVc8+B9QEZPjwxtFnmIkM6f9uObSk2D 2Fg9Lbkamf5CVe/rSWXNKNZJRgCXav+nmGCTe57k74IAad7MWBGMcmE6eGduPz2OkIL28r5l6es 7AXa2sFCNxf74nAKJQi6EtH78cut3rv7QWglQ7Gaq/M6m28ft4Ue8d4JAgAubg X-Received: by 2002:a17:902:e5c2:b0:2c1:4a67:5f31 with SMTP id d9443c01a7336-2c7c70efd4emr1597435ad.9.1782218295641; Tue, 23 Jun 2026 05:38:15 -0700 (PDT) Received: from google.com (199.255.142.34.bc.googleusercontent.com. [34.142.255.199]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-84564d6c2cesm13106102b3a.2.2026.06.23.05.38.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 23 Jun 2026 05:38:15 -0700 (PDT) Date: Tue, 23 Jun 2026 12:38:07 +0000 From: Pranjal Shrivastava To: Matt Evans Cc: Alex Williamson , Leon Romanovsky , Jason Gunthorpe , Alex Mastro , Christian =?iso-8859-1?Q?K=F6nig?= , Bjorn Helgaas , Logan Gunthorpe , Mahmoud Adam , David Matlack , =?iso-8859-1?Q?Bj=F6rn_T=F6pel?= , Sumit Semwal , Kevin Tian , Ankit Agrawal , Alistair Popple , Vivek Kasireddy , linux-kernel@vger.kernel.org, linux-media@vger.kernel.org, dri-devel@lists.freedesktop.org, linaro-mm-sig@lists.linaro.org, kvm@vger.kernel.org, linux-pci@vger.kernel.org Subject: Re: [PATCH v3 6/9] vfio/pci: Clean up BAR zap and revocation Message-ID: References: <20260610154327.37758-1-matt@ozlabs.org> <20260610154327.37758-7-matt@ozlabs.org> <62970f4b-e624-403f-9cdc-02438c820d23@ozlabs.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <62970f4b-e624-403f-9cdc-02438c820d23@ozlabs.org> On Thu, Jun 18, 2026 at 05:06:27PM +0100, Matt Evans wrote: > Hi Praan, > > On 12/06/2026 20:39, Pranjal Shrivastava wrote: > >> [...] > >> diff --git a/drivers/vfio/pci/hisilicon/hisi_acc_vfio_pci.c b/drivers/vfio/pci/hisilicon/hisi_acc_vfio_pci.c > >> index 86362ec424a5..51990f6d66d5 100644 > >> --- a/drivers/vfio/pci/hisilicon/hisi_acc_vfio_pci.c > >> +++ b/drivers/vfio/pci/hisilicon/hisi_acc_vfio_pci.c > >> @@ -1692,6 +1692,14 @@ static int hisi_acc_vfio_pci_probe(struct pci_dev *pdev, const struct pci_device > >> if (ret) > >> goto out_put_vdev; > >> > >> + /* > >> + * hisi_acc_vfio_pci_mmap() calls down to > >> + * vfio_pci_core_mmap(), so BAR mappings are still > >> + * DMABUF-backed. They don't require a zap on revoke, so opt > >> + * out: > >> + */ > >> + hisi_acc_vdev->core_device.zap_bars_on_revoke = false; > >> + > > > > This seems to be happening after we vfio_pci_core_register_device, which > > could be slightly problematic if another device in the same group races > > to trigger a hot reset before we can set this to false. Could we > > initialize this flag before registration instead? > > Remember it is a safe default, so in the event of a driver not managing > to opt-out before it's required then all that happens is a redundant > unmap_mapping_range(). The default-safe was a nice suggestion from Alex > on v2. > Ack. I see. That makes sense. Thanks, Praan