All of lore.kernel.org
 help / color / mirror / Atom feed
From: Minchan Kim <minchan@kernel.org>
To: Suren Baghdasaryan <surenb@google.com>
Cc: linaro-mm-sig@lists.linaro.org, orjan.eide@arm.com,
	sspatil@google.com, christian.koenig@amd.com,
	kernel-team@android.com, jajones@nvidia.com,
	linux-kernel@vger.kernel.org, lmark@codeaurora.org,
	hch@infradead.org, linux-mm@kvack.org,
	dri-devel@lists.freedesktop.org, cgoldswo@codeaurora.org,
	hridya@google.com, akpm@linux-foundation.org, labbott@redhat.com,
	robin.murphy@arm.com, linux-media@vger.kernel.org
Subject: Re: [PATCH 1/2] mm: replace BUG_ON in vm_insert_page with a return of an error
Date: Tue, 2 Feb 2021 17:31:03 -0800	[thread overview]
Message-ID: <YBn81xAeCqHgudYb@google.com> (raw)
In-Reply-To: <20210203003134.2422308-1-surenb@google.com>

On Tue, Feb 02, 2021 at 04:31:33PM -0800, Suren Baghdasaryan wrote:
> Replace BUG_ON(vma->vm_flags & VM_PFNMAP) in vm_insert_page with
> WARN_ON_ONCE and returning an error. This is to ensure users of the
> vm_insert_page that set VM_PFNMAP are notified of the wrong flag usage
> and get an indication of an error without panicing the kernel.
> This will help identifying drivers that need to clear VM_PFNMAP before
> using dmabuf system heap which is moving to use vm_insert_page.
> 
> Suggested-by: Christoph Hellwig <hch@infradead.org>
> Signed-off-by: Suren Baghdasaryan <surenb@google.com>
> ---
>  mm/memory.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/mm/memory.c b/mm/memory.c
> index feff48e1465a..e503c9801cd9 100644
> --- a/mm/memory.c
> +++ b/mm/memory.c
> @@ -1827,7 +1827,8 @@ int vm_insert_page(struct vm_area_struct *vma, unsigned long addr,
>  		return -EINVAL;
>  	if (!(vma->vm_flags & VM_MIXEDMAP)) {
>  		BUG_ON(mmap_read_trylock(vma->vm_mm));

Better to replace above BUG_ON with WARN_ON_ONCE, too?
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

WARNING: multiple messages have this Message-ID (diff)
From: Minchan Kim <minchan@kernel.org>
To: Suren Baghdasaryan <surenb@google.com>
Cc: sumit.semwal@linaro.org, akpm@linux-foundation.org,
	hch@infradead.org, lmark@codeaurora.org, labbott@redhat.com,
	Brian.Starkey@arm.com, john.stultz@linaro.org,
	christian.koenig@amd.com, cgoldswo@codeaurora.org,
	orjan.eide@arm.com, robin.murphy@arm.com, jajones@nvidia.com,
	hridya@google.com, sspatil@google.com,
	linux-media@vger.kernel.org, dri-devel@lists.freedesktop.org,
	linaro-mm-sig@lists.linaro.org, linux-mm@kvack.org,
	linux-kernel@vger.kernel.org, kernel-team@android.com
Subject: Re: [PATCH 1/2] mm: replace BUG_ON in vm_insert_page with a return of an error
Date: Tue, 2 Feb 2021 17:31:03 -0800	[thread overview]
Message-ID: <YBn81xAeCqHgudYb@google.com> (raw)
In-Reply-To: <20210203003134.2422308-1-surenb@google.com>

On Tue, Feb 02, 2021 at 04:31:33PM -0800, Suren Baghdasaryan wrote:
> Replace BUG_ON(vma->vm_flags & VM_PFNMAP) in vm_insert_page with
> WARN_ON_ONCE and returning an error. This is to ensure users of the
> vm_insert_page that set VM_PFNMAP are notified of the wrong flag usage
> and get an indication of an error without panicing the kernel.
> This will help identifying drivers that need to clear VM_PFNMAP before
> using dmabuf system heap which is moving to use vm_insert_page.
> 
> Suggested-by: Christoph Hellwig <hch@infradead.org>
> Signed-off-by: Suren Baghdasaryan <surenb@google.com>
> ---
>  mm/memory.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/mm/memory.c b/mm/memory.c
> index feff48e1465a..e503c9801cd9 100644
> --- a/mm/memory.c
> +++ b/mm/memory.c
> @@ -1827,7 +1827,8 @@ int vm_insert_page(struct vm_area_struct *vma, unsigned long addr,
>  		return -EINVAL;
>  	if (!(vma->vm_flags & VM_MIXEDMAP)) {
>  		BUG_ON(mmap_read_trylock(vma->vm_mm));

Better to replace above BUG_ON with WARN_ON_ONCE, too?

  parent reply	other threads:[~2021-02-03  1:31 UTC|newest]

Thread overview: 46+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-02-03  0:31 [PATCH 1/2] mm: replace BUG_ON in vm_insert_page with a return of an error Suren Baghdasaryan
2021-02-03  0:31 ` Suren Baghdasaryan
2021-02-03  0:31 ` [PATCH v2 2/2] dma-buf: heaps: Map system heap pages as managed by linux vm Suren Baghdasaryan
2021-02-03  0:31   ` Suren Baghdasaryan
2021-02-03  1:39   ` Minchan Kim
2021-02-03  1:39     ` Minchan Kim
2021-02-03  2:02     ` Suren Baghdasaryan
2021-02-03  2:02       ` Suren Baghdasaryan
2021-02-03  8:05       ` Christian König
2021-02-03  8:05         ` Christian König
2021-02-03 19:53         ` Suren Baghdasaryan
2021-02-03 19:53           ` Suren Baghdasaryan
2021-02-03  2:07   ` John Stultz
2021-02-03  2:07     ` John Stultz
2021-02-03  2:13     ` Suren Baghdasaryan
2021-02-03  2:13       ` Suren Baghdasaryan
2021-02-03  1:27 ` [PATCH 1/2] mm: replace BUG_ON in vm_insert_page with a return of an error Miaohe Lin
2021-02-03  1:27   ` Miaohe Lin
2021-02-03  1:31 ` Minchan Kim [this message]
2021-02-03  1:31   ` Minchan Kim
2021-02-03  1:55   ` Suren Baghdasaryan
2021-02-03  1:55     ` Suren Baghdasaryan
2021-02-03  1:55 ` Matthew Wilcox
2021-02-03  1:55   ` Matthew Wilcox
2021-02-03  2:26   ` Suren Baghdasaryan
2021-02-03  2:26     ` Suren Baghdasaryan
2021-02-03  8:52   ` [Linaro-mm-sig] " Daniel Vetter
2021-02-03  8:52     ` Daniel Vetter
2021-02-03 20:20     ` Suren Baghdasaryan
2021-02-03 20:20       ` Suren Baghdasaryan
2021-02-03 20:29       ` Daniel Vetter
2021-02-03 20:29         ` Daniel Vetter
2021-02-03 21:25         ` Daniel Vetter
2021-02-03 21:25           ` Daniel Vetter
2021-02-03 21:41           ` Suren Baghdasaryan
2021-02-03 21:41             ` Suren Baghdasaryan
2021-02-04  8:16             ` Christian König
2021-02-04  8:16               ` Christian König
2021-02-04 15:22               ` Daniel Vetter
2021-02-04 15:22                 ` Daniel Vetter
2021-02-04 15:54               ` Alex Deucher
2021-02-04 15:54                 ` Alex Deucher
2021-02-05  3:39                 ` Suren Baghdasaryan
2021-02-05  3:39                   ` Suren Baghdasaryan
2021-02-04  7:53       ` Christian König
2021-02-04  7:53         ` Christian König

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=YBn81xAeCqHgudYb@google.com \
    --to=minchan@kernel.org \
    --cc=akpm@linux-foundation.org \
    --cc=cgoldswo@codeaurora.org \
    --cc=christian.koenig@amd.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=hch@infradead.org \
    --cc=hridya@google.com \
    --cc=jajones@nvidia.com \
    --cc=kernel-team@android.com \
    --cc=labbott@redhat.com \
    --cc=linaro-mm-sig@lists.linaro.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-media@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=lmark@codeaurora.org \
    --cc=orjan.eide@arm.com \
    --cc=robin.murphy@arm.com \
    --cc=sspatil@google.com \
    --cc=surenb@google.com \
    /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.