From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 57AA6261B91 for ; Thu, 25 Sep 2025 22:31:38 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.133.124 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1758839500; cv=none; b=jVfV+nrGXJ5RGH7cob+4zOMnzsyJUliaRJRy8nEQa+am4etaM2sOGf94QO9uA0N95LRZmm4BcbYvnA3SmKrBVh7sCbeY05OoMBUv6mSYju80tq/hAQY3XZfuXAoGZAbOqaZxhojQ0loRpLeBMbGE+Op1Xgf1xTus/omX3zddqXc= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1758839500; c=relaxed/simple; bh=0Alswmfe1zq7N80PnOB6XtFxyNuFoZwrMxHbgdTZfVk=; h=Date:From:To:Cc:Subject:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=rE2MQIIoy8/+VYjRVhK1BMrJTBX+/PyQXL2WQZfpx9XMJ4h4rBGoIxqRsKRi2pRhCe5QaPqo5Q/mjFyW2ydn3xzv/ksS8D/XpQ4mZXlW2Z4mN7478gEBY7EuGw2uDVyDlB8447BYDCh1ZBVdU9cOamXA/Cbp7FHyFj+cSoRiqPU= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=C+yZubRg; arc=none smtp.client-ip=170.10.133.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="C+yZubRg" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1758839497; 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=pPGBYTkBK6lmMsctQg86rFzc+ubUYRnHqSeaFKAdA0w=; b=C+yZubRgK7Xuwq8ZYbAwrcRYC9QJmxmKZYhbFEgZZzGy0wcSpRtZdmQIn5cJi+4/kE7I0b H7LRxQ7lvfwPszHznmJsqnXlq31xtlX1UeKVoTth1DoVwhxeCom1E1069qr7z2twjZ/ElL OZg7vgVrWNEhfNV/vmzboGSLcCUVDtI= Received: from mail-il1-f199.google.com (mail-il1-f199.google.com [209.85.166.199]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-342-uVaRTt5XMBOOlZLY0-YMJA-1; Thu, 25 Sep 2025 18:31:36 -0400 X-MC-Unique: uVaRTt5XMBOOlZLY0-YMJA-1 X-Mimecast-MFC-AGG-ID: uVaRTt5XMBOOlZLY0-YMJA_1758839495 Received: by mail-il1-f199.google.com with SMTP id e9e14a558f8ab-4248b4d6609so3761265ab.3 for ; Thu, 25 Sep 2025 15:31:36 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1758839495; x=1759444295; h=content-transfer-encoding:mime-version:organization:references :in-reply-to:message-id:subject:cc:to:from:date:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=pPGBYTkBK6lmMsctQg86rFzc+ubUYRnHqSeaFKAdA0w=; b=ijRTqL9xxOeAoexWb/bA57gtjF9zC2yFs61X4/2DTWKtGE4AxC9+pUXVvukg+TT+73 S84rVIw9MdPiZLfhUgiL6Oed7FVUnO6jlWtDAVwQXcDPK/euB5bB2lQBRUl0dfabQUGk c+sGX6EtE7Y/u18fa7TU3UbzicJbkG/ILYIzdFrcVXn57PecqSwdNdXr8UPnF+BXA4ya z5eKMobdjD7DWVPJJi+VO6NgF3wA4Ceej4NtAByCrACielshyYWq4yN2WyASDp0GJ+Ar 7FEwDXYW+nYGMsWI9hlaZ19PE2lx6ZvdS7FwHf5qZmUa+Ya+R5JSKxgueVtbh0DnyYqe kIZA== X-Forwarded-Encrypted: i=1; AJvYcCUUH4G420yRpy+fE7AOIIqSnjhoIzNIYVeRetPMzlbVof5H06J+sxCIAQjpTgerpphnmpuZghL/gdlpXMo=@vger.kernel.org X-Gm-Message-State: AOJu0YymhVmirpLgW7ApaaD0aF6V9x65R6zZTGhFuT1OvbhlMCV/BfIa sLILL1Yca7ZrVzdt7r97yYME9WaQIJ8eb8VD0m2hEr82BuMvIm11Zo8FzNhGODpj56Hs9AyDxQ/ 3F3l9JeEzIHcP1fZ0Eeyri0ZAf9x09VWu577R0wiEl9d5bT/93B87odvOkxGD4uC7Ew== X-Gm-Gg: ASbGncuac/+mmav0hRCvX69Xf8Xemfa1hvuqSClW1x+RUY3bI0W1vqH6vZabRAja8b7 skuX4s7ZxmH1CVuqeBcfCQrxh+KoghqiCE86CCo+pPBM/2P8cIdPIi2hUDRr9fazWcyVg8TQChp dUGHaWLt3vF7Vwtasc57PUgVVm3nzarJEe3Fv9PK3xvn/ypz7BFmKfRXR41xl1HSWIDWNuR8EcE qmjhbQnvimtYbccVx/sEXuaUQECS09K0qvgRpbcJ1ZcOTxbJEFCvMY7OidwbWKGV0/qbelrt05r pxO/IjVdYo/f12hSOw6uxQcF6KkK7Nu1xs0hE6UXPQc= X-Received: by 2002:a92:d987:0:b0:424:80e6:9e8b with SMTP id e9e14a558f8ab-42595661562mr24720145ab.7.1758839495370; Thu, 25 Sep 2025 15:31:35 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGBjWzVlsd5kVvaGcIPZVt9Dy5vtGZ7X7lNybnyhnS6f36pgd3Q/xbJFuK0zszjvTKZaW8Iag== X-Received: by 2002:a92:d987:0:b0:424:80e6:9e8b with SMTP id e9e14a558f8ab-42595661562mr24719995ab.7.1758839494991; Thu, 25 Sep 2025 15:31:34 -0700 (PDT) Received: from redhat.com ([38.15.36.11]) by smtp.gmail.com with ESMTPSA id 8926c6da1cb9f-56a69a1c574sm1211405173.40.2025.09.25.15.31.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 25 Sep 2025 15:31:34 -0700 (PDT) Date: Thu, 25 Sep 2025 16:31:31 -0600 From: Alex Williamson To: Jason Gunthorpe Cc: Leon Romanovsky , Andrew Morton , Bjorn Helgaas , Christian =?UTF-8?B?S8O2bmln?= , dri-devel@lists.freedesktop.org, iommu@lists.linux.dev, Jens Axboe , Joerg Roedel , kvm@vger.kernel.org, linaro-mm-sig@lists.linaro.org, linux-block@vger.kernel.org, linux-kernel@vger.kernel.org, linux-media@vger.kernel.org, linux-mm@kvack.org, linux-pci@vger.kernel.org, Logan Gunthorpe , Marek Szyprowski , Robin Murphy , Sumit Semwal , Vivek Kasireddy , Will Deacon Subject: Re: [PATCH v2 03/10] PCI/P2PDMA: Refactor to separate core P2P functionality from memory allocation Message-ID: <20250925163131.22a2c09b.alex.williamson@redhat.com> In-Reply-To: <20250925115308.GT2617119@nvidia.com> References: <1e2cb89ea76a92949d06a804e3ab97478e7cacbb.1757589589.git.leon@kernel.org> <20250922150032.3e3da410.alex.williamson@redhat.com> <20250923150414.GA2608121@nvidia.com> <20250923113041.38bee711.alex.williamson@redhat.com> <20250923174333.GE2608121@nvidia.com> <20250923120932.47df57b2.alex.williamson@redhat.com> <20250925070314.GA12165@unreal> <20250925115308.GT2617119@nvidia.com> Organization: Red Hat 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-Transfer-Encoding: 7bit On Thu, 25 Sep 2025 08:53:08 -0300 Jason Gunthorpe wrote: > On Thu, Sep 25, 2025 at 10:03:14AM +0300, Leon Romanovsky wrote: > > > > It would at least make sense to me then to store the provider on the > > > vfio_pci_dma_buf object at the time of the get feature call rather than > > > vfio_pci_core_init_dev() though. That would eliminate patch 08/ and > > > the inline #ifdefs. > > > > I'll change it now. If "enable" function goes to be "get" function, we > > won't need to store anything in vfio_pci_dma_buf too. At the end, we > > have exactly two lines "provider = priv->vdev->provider[priv->bar];", > > which can easily be changed to be "provider = pcim_p2pdma_provider(priv->vdev->pdev, priv->bar)" > > Not without some kind of locking change. I'd keep the > priv->vdev->provider[priv->bar] because setup during probe doesn't > need special locking. Why do we need to store the provider on the vfio_pci_core_device at probe though, we can get it later via pcim_p2pdma_provider(). Ideally we'd take the opportunity to pull out the setup part of the _provider function to give us an initialization interface to use at probe time without an unnecessary BAR# arg. Thanks, Alex