linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Suren Baghdasaryan <surenb@google.com>
To: David Hildenbrand <david@redhat.com>
Cc: Matthew Wilcox <willy@infradead.org>,
	Dan Carpenter <dan.carpenter@linaro.org>,
	linux-mm@kvack.org,  Andrew Morton <akpm@linux-foundation.org>,
	"Liam R. Howlett" <liam.howlett@oracle.com>,
	 Laurent Dufour <ldufour@linux.ibm.com>,
	Michel Lespinasse <michel@lespinasse.org>,
	 Jerome Glisse <jglisse@google.com>,
	Michal Hocko <mhocko@suse.com>, Vlastimil Babka <vbabka@suse.cz>,
	 Johannes Weiner <hannes@cmpxchg.org>,
	Peter Xu <peterx@redhat.com>,
	 Dimitri Sivanich <dimitri.sivanich@hpe.com>,
	Mike Travis <mike.travis@hpe.com>,
	 Steve Wahl <steve.wahl@hpe.com>
Subject: Re: [bug report] mm: replace vma->vm_flags direct modifications with modifier calls
Date: Wed, 12 Jul 2023 09:03:02 -0700	[thread overview]
Message-ID: <CAJuCfpFr-SZ-DLrKSP1AnwwmbKiRAeJ20+WU=FdVnG0CFzwcNQ@mail.gmail.com> (raw)
In-Reply-To: <331201b2-5f13-8e81-b5d4-b17f8784d498@redhat.com>

On Wed, Jul 12, 2023 at 8:55 AM David Hildenbrand <david@redhat.com> wrote:
>
> On 12.07.23 17:52, Matthew Wilcox wrote:
> > On Wed, Jul 12, 2023 at 08:01:18AM -0700, Suren Baghdasaryan wrote:
> >> Are you suggesting to break remap_pfn_range() into two stages
> >> (remap_pfn_range_prepare() then remap_pfn_range())?
> >> If so, there are many places remap_pfn_range() is called and IIUC all
> >> of them would need to use that 2-stage approach (lots of code churn).
> >> In addition, this is an exported function, so many more drivers might
> >> expect the current behavior.
> >
> > You do not understand correctly.
> >
> > When somebody calls mmap, there are two reasonable implementations.
> > Here's one:
> >
> >          .mmap = snd_dma_iram_mmap,
> >
> > static int snd_dma_iram_mmap(struct snd_dma_buffer *dmab,
> >                               struct vm_area_struct *area)
> > {
> >          area->vm_page_prot = pgprot_writecombine(area->vm_page_prot);
> >          return remap_pfn_range(area, area->vm_start,
> >                                 dmab->addr >> PAGE_SHIFT,
> >                                 area->vm_end - area->vm_start,
> >                                 area->vm_page_prot);
> > }
> >
> > This is _fine_.  It is not called from the fault path, it is called in
> > process context.  Few locks are held (which ones aren't even
> > documented!)
> >
> > The other way is to set vma->vm_ops.  The fault handler in vm_ops
> > should not be calling remap_pfn_range().  It should be calling
> > set_ptes().  I almost have this driver fixed up, but I have another
> > meeting to go to now.
>
> Just a note that we still have to make sure that the VMA flags will be
> set properly -- I guess at mmap time is the right time as I suggested above.

Ah, ok, now I understand what you meant. Ok, let's wait for Matthew to
send the fix for the driver. Sounds like he has it almost ready.

>
> --
> Cheers,
>
> David / dhildenb
>


  reply	other threads:[~2023-07-12 16:05 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-07-11  7:21 Dan Carpenter
2023-07-11 21:55 ` Suren Baghdasaryan
2023-07-11 22:21   ` Matthew Wilcox
2023-07-11 23:45     ` Suren Baghdasaryan
2023-07-12  7:35       ` David Hildenbrand
2023-07-12 15:01         ` Suren Baghdasaryan
2023-07-12 15:52           ` Matthew Wilcox
2023-07-12 15:55             ` David Hildenbrand
2023-07-12 16:03               ` Suren Baghdasaryan [this message]
2023-07-12 18:49               ` Matthew Wilcox
2023-07-12 18:52                 ` David Hildenbrand
2023-07-12 19:48                   ` Suren Baghdasaryan
2023-07-17  6:13                     ` Yan Zhao
2023-07-17 16:18                       ` Suren Baghdasaryan
2023-07-18  0:27                         ` Yan Zhao
2023-07-18 16:27                           ` Suren Baghdasaryan
2023-07-12 19:34                 ` Matthew Wilcox
2023-07-17 19:54                   ` Dimitri Sivanich

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='CAJuCfpFr-SZ-DLrKSP1AnwwmbKiRAeJ20+WU=FdVnG0CFzwcNQ@mail.gmail.com' \
    --to=surenb@google.com \
    --cc=akpm@linux-foundation.org \
    --cc=dan.carpenter@linaro.org \
    --cc=david@redhat.com \
    --cc=dimitri.sivanich@hpe.com \
    --cc=hannes@cmpxchg.org \
    --cc=jglisse@google.com \
    --cc=ldufour@linux.ibm.com \
    --cc=liam.howlett@oracle.com \
    --cc=linux-mm@kvack.org \
    --cc=mhocko@suse.com \
    --cc=michel@lespinasse.org \
    --cc=mike.travis@hpe.com \
    --cc=peterx@redhat.com \
    --cc=steve.wahl@hpe.com \
    --cc=vbabka@suse.cz \
    --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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox