All of lore.kernel.org
 help / color / mirror / Atom feed
From: Al Viro <viro@ZenIV.linux.org.uk>
To: Jerome Glisse <jglisse@redhat.com>
Cc: Jeff Layton <jlayton@kernel.org>,
	Dave Chinner <david@fromorbit.com>,
	Matthew Wilcox <willy@infradead.org>,
	Michal Hocko <mhocko@kernel.org>,
	linux-block@vger.kernel.org, linux-mm@kvack.org,
	Johannes Weiner <hannes@cmpxchg.org>,
	linux-fsdevel <linux-fsdevel@vger.kernel.org>,
	lsf-pc@lists.linux-foundation.org
Subject: Re: [Lsf-pc] [LSF/MM] schedule suggestion
Date: Thu, 19 Apr 2018 22:21:37 +0100	[thread overview]
Message-ID: <20180419212137.GM30522@ZenIV.linux.org.uk> (raw)
In-Reply-To: <20180419205820.GB4981@redhat.com>

On Thu, Apr 19, 2018 at 04:58:20PM -0400, Jerome Glisse wrote:

> I need a struct to link part of device context with mm struct for a
> process. Most of device context is link to the struct file of the
> device file (ie process open has a file descriptor for the device
> file).

Er...  You do realize that
	fd = open(...)
	mmap(fd, ...)
	close(fd)
is absolutely legitimate, right?  IOW, existence/stability/etc. of
a file descriptor is absolutely *not* guaranteed - in fact, there might
be not a single file descriptor referring to a given openen and mmaped
file.

> Device driver for GPU have some part of their process context tied to
> the process mm (accessing process address space directly from the GPU).
> However we can not store this context information in the struct file
> private data because of clone (same struct file accross different mm).
> 
> So today driver have an hashtable in their global device structure to
> lookup context information for a given mm. This is sub-optimal and
> duplicate a lot of code among different drivers.

Umm...  Examples?

> Hence why i want something generic that allow a device driver to store
> context structure that is specific to a mm. I thought that adding a
> new array on the side of struct file array would be a good idea but it
> has too many kludges.
> 
> So i will do something inside mmu_notifier and there will be no tie to
> any fs aspect. I expect only a handful of driver to care about this and
> for a given platform you won't see that many devices hence you won't
> have that many pointer to deal with.

Let's step back for a second - lookups by _what_?  If you are associating
somethin with a mapping, vm_area_struct would be a natural candidate for
storing such data, wouldn't it?

What do you have and what do you want to find?
_______________________________________________
Lsf-pc mailing list
Lsf-pc@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/lsf-pc

WARNING: multiple messages have this Message-ID (diff)
From: Al Viro <viro@ZenIV.linux.org.uk>
To: Jerome Glisse <jglisse@redhat.com>
Cc: Jeff Layton <jlayton@kernel.org>,
	Matthew Wilcox <willy@infradead.org>,
	Dave Chinner <david@fromorbit.com>,
	linux-mm@kvack.org, lsf-pc@lists.linux-foundation.org,
	linux-fsdevel <linux-fsdevel@vger.kernel.org>,
	linux-block@vger.kernel.org, Johannes Weiner <hannes@cmpxchg.org>,
	Michal Hocko <mhocko@kernel.org>
Subject: Re: [LSF/MM] schedule suggestion
Date: Thu, 19 Apr 2018 22:21:37 +0100	[thread overview]
Message-ID: <20180419212137.GM30522@ZenIV.linux.org.uk> (raw)
In-Reply-To: <20180419205820.GB4981@redhat.com>

On Thu, Apr 19, 2018 at 04:58:20PM -0400, Jerome Glisse wrote:

> I need a struct to link part of device context with mm struct for a
> process. Most of device context is link to the struct file of the
> device file (ie process open has a file descriptor for the device
> file).

Er...  You do realize that
	fd = open(...)
	mmap(fd, ...)
	close(fd)
is absolutely legitimate, right?  IOW, existence/stability/etc. of
a file descriptor is absolutely *not* guaranteed - in fact, there might
be not a single file descriptor referring to a given openen and mmaped
file.

> Device driver for GPU have some part of their process context tied to
> the process mm (accessing process address space directly from the GPU).
> However we can not store this context information in the struct file
> private data because of clone (same struct file accross different mm).
> 
> So today driver have an hashtable in their global device structure to
> lookup context information for a given mm. This is sub-optimal and
> duplicate a lot of code among different drivers.

Umm...  Examples?

> Hence why i want something generic that allow a device driver to store
> context structure that is specific to a mm. I thought that adding a
> new array on the side of struct file array would be a good idea but it
> has too many kludges.
> 
> So i will do something inside mmu_notifier and there will be no tie to
> any fs aspect. I expect only a handful of driver to care about this and
> for a given platform you won't see that many devices hence you won't
> have that many pointer to deal with.

Let's step back for a second - lookups by _what_?  If you are associating
somethin with a mapping, vm_area_struct would be a natural candidate for
storing such data, wouldn't it?

What do you have and what do you want to find?

  reply	other threads:[~2018-04-19 21:21 UTC|newest]

Thread overview: 48+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-04-18 21:19 [LSF/MM] schedule suggestion Jerome Glisse
2018-04-18 21:19 ` Jerome Glisse
2018-04-19  0:48 ` Dave Chinner
2018-04-19  1:55 ` [Lsf-pc] " Dave Chinner
2018-04-19  1:55   ` Dave Chinner
2018-04-19 14:38   ` [Lsf-pc] " Jerome Glisse
2018-04-19 14:38     ` Jerome Glisse
2018-04-19 14:38     ` Jerome Glisse
2018-04-19 14:43     ` [Lsf-pc] " Matthew Wilcox
2018-04-19 14:43       ` Matthew Wilcox
2018-04-19 16:30       ` Jerome Glisse
2018-04-19 16:30         ` Jerome Glisse
2018-04-19 16:58         ` [Lsf-pc] " Jeff Layton
2018-04-19 16:58           ` Jeff Layton
2018-04-19 17:26           ` Jerome Glisse
2018-04-19 17:26             ` Jerome Glisse
2018-04-19 18:31             ` [Lsf-pc] " Jeff Layton
2018-04-19 18:31               ` Jeff Layton
2018-04-19 19:31               ` Jerome Glisse
2018-04-19 19:31                 ` Jerome Glisse
2018-04-19 19:56                 ` [Lsf-pc] " Matthew Wilcox
2018-04-19 19:56                   ` Matthew Wilcox
2018-04-19 20:15                   ` Jerome Glisse
2018-04-19 20:15                     ` Jerome Glisse
2018-04-19 20:25                     ` [Lsf-pc] " Matthew Wilcox
2018-04-19 20:25                       ` Matthew Wilcox
2018-04-19 20:39                       ` [Lsf-pc] " Al Viro
2018-04-19 20:39                         ` Al Viro
2018-04-19 21:08                         ` Jerome Glisse
2018-04-19 21:08                           ` Jerome Glisse
2018-04-19 20:51                     ` [Lsf-pc] " Al Viro
2018-04-19 20:51                       ` Al Viro
2018-04-19 20:33             ` [Lsf-pc] " Al Viro
2018-04-19 20:33               ` Al Viro
2018-04-19 20:58               ` Jerome Glisse
2018-04-19 20:58                 ` Jerome Glisse
2018-04-19 21:21                 ` Al Viro [this message]
2018-04-19 21:21                   ` Al Viro
2018-04-19 21:47                   ` Jerome Glisse
2018-04-19 21:47                     ` Jerome Glisse
2018-04-19 22:13                     ` [Lsf-pc] " Al Viro
2018-04-19 22:13                       ` Al Viro
2018-04-19 14:51   ` [Lsf-pc] " Chris Mason
2018-04-19 14:51     ` Chris Mason
2018-04-19 14:51     ` Chris Mason
2018-04-19 15:07     ` [Lsf-pc] " Martin K. Petersen
2018-04-19 15:07       ` Martin K. Petersen
2018-04-19 15:07       ` Martin K. Petersen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20180419212137.GM30522@ZenIV.linux.org.uk \
    --to=viro@zeniv.linux.org.uk \
    --cc=david@fromorbit.com \
    --cc=hannes@cmpxchg.org \
    --cc=jglisse@redhat.com \
    --cc=jlayton@kernel.org \
    --cc=linux-block@vger.kernel.org \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=lsf-pc@lists.linux-foundation.org \
    --cc=mhocko@kernel.org \
    --cc=willy@infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.