[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <YqEW21rs+LkOHOWS@iweiny-desk3>
Date: Wed, 8 Jun 2022 14:38:35 -0700
From: Ira Weiny <ira.weiny@...el.com>
To: Ben Widawsky <bwidawsk@...nel.org>
CC: Dan Williams <dan.j.williams@...el.com>,
Bjorn Helgaas <bhelgaas@...gle.com>,
Jonathan Cameron <Jonathan.Cameron@...wei.com>,
"Alison Schofield" <alison.schofield@...el.com>,
Vishal Verma <vishal.l.verma@...el.com>,
Dave Jiang <dave.jiang@...el.com>,
<linux-kernel@...r.kernel.org>, <linux-cxl@...r.kernel.org>,
<linux-pci@...r.kernel.org>
Subject: Re: [PATCH V10 5/9] cxl/port: Find a DOE mailbox which supports CDAT
On Wed, Jun 08, 2022 at 12:39:49PM -0700, Ira wrote:
> On Mon, Jun 06, 2022 at 10:48:19AM -0700, Ben Widawsky wrote:
> > On 22-06-04 17:50:45, ira.weiny@...el.com wrote:
> > > From: Ira Weiny <ira.weiny@...el.com>
> > >
[snip]
> > > +
> > > +/**
> > > + * cxl_cache_cdat_mb() -- cache the DOE mailbox which suports the CDAT protocol
> > > + *
> > > + * @port: Port to containing DOE Mailboxes
> > > + *
> > > + * Cache a pointer to the doe mailbox which supports CDAT.
> > > + */
> > > +void cxl_cache_cdat_mb(struct cxl_port *port)
> > > +{
> > > + struct device *dev = port->uport;
> > > + struct cxl_memdev *cxlmd;
> > > + struct cxl_dev_state *cxlds;
> > > + int i;
> > > +
> > > + if (!is_cxl_memdev(dev))
> > > + return;
> > > +
> > > + cxlmd = to_cxl_memdev(dev);
> > > + cxlds = cxlmd->cxlds;
> > > +
> > > + for (i = 0; i < cxlds->num_mbs; i++) {
> > > + struct pci_doe_mb *cur = cxlds->doe_mbs[i];
> > > +
> > > + if (pci_doe_supports_prot(cur, PCI_DVSEC_VENDOR_ID_CXL,
> > > + CXL_DOE_PROTOCOL_TABLE_ACCESS)) {
> > > + port->cdat_mb = cur;
> >
> > What happens if cxl_pci is unloaded after this? Would it be better to copy out
> > the CDAT info? Otherwise, I think you need to hold a ref on the PCI device
> > (though I only took a quick look).
>
> <sigh> I thought that could not happen but I see I was wrong.
>
> A reference will need to be taken for at least the duration of the query.
> Originally I had this set up to try and make it easier to query later. But I
> think that is a waste ATM.
>
> I'm going to rework this ownership.
BTW this means this patch is going away. I think just searching for the
mailbox with CDAT support on each query is the way to go at this time.
Ira
>
> Thanks for the review,
> Ira
>
Powered by blists - more mailing lists