[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <YvH9X5puer4jpzMX@kroah.com>
Date: Tue, 9 Aug 2022 08:23:27 +0200
From: Greg Kroah-Hartman <gregkh@...uxfoundation.org>
To: Jason Gunthorpe <jgg@...dia.com>
Cc: Oded Gabbay <oded.gabbay@...il.com>,
Dave Airlie <airlied@...il.com>,
dri-devel <dri-devel@...ts.freedesktop.org>,
Yuji Ishikawa <yuji2.ishikawa@...hiba.co.jp>,
Jiho Chu <jiho.chu@...sung.com>, Arnd Bergmann <arnd@...db.de>,
"Linux-Kernel@...r. Kernel. Org" <linux-kernel@...r.kernel.org>
Subject: Re: New subsystem for acceleration devices
On Mon, Aug 08, 2022 at 02:55:28PM -0300, Jason Gunthorpe wrote:
> On Mon, Aug 08, 2022 at 08:10:22AM +0200, Greg Kroah-Hartman wrote:
> > On Sun, Aug 07, 2022 at 02:25:33PM +0300, Oded Gabbay wrote:
> > > 2. Common code to handle drivers that want to allow a single user at a
> > > time to run open the device char file.
> >
> > Note, that's an impossible request, and one that the kernel should never
> > worry about, so don't even try it. Think about userspace doing an call
> > to dup() on an open char file descriptor and then passing that off
> > somewhere else.
>
> Oded is talking about a model like VFIO has where the HW has a limited
> number of concurrent state registers - lets say in this case the ASID
> translation mapping the accelerator into DMA.
Based on the number of drivers that I see submitted weekly that try to
restrict their open call to just one user by using atomic variables or
other tricks, I think my interpretation of this stands :)
> Each 'struct file' that is created owns one of those HW state
> registers, and each struct file is completely isolated from all
> others. eg someone controlling the accelerator through struct file A
> cannot access memory mapped into the accelerator through struct file
> B.
>
> So, the number of struct files that can be created is capped at the
> number of HW state registers the device can support (eg one for
> Habana).
>
> This is different from the number of FDs pointing at the struct file.
> Userpsace can open a HW state and point a lot of FDs at it, that is
> userspace's problem. From a kernel view they all share one struct file
> and thus one HW state.
Yes, that's fine, if that is what is happening here, I have no
objection.
greg k-h
Powered by blists - more mailing lists