All of lore.kernel.org
 help / color / mirror / Atom feed
From: Michal Hocko <mhocko@suse.com>
To: David Hildenbrand <david@redhat.com>
Cc: Lorenzo Stoakes <lorenzo.stoakes@oracle.com>,
	linux-kernel@vger.kernel.org, linux-mm@kvack.org,
	Andrew Morton <akpm@linux-foundation.org>,
	"Liam R. Howlett" <Liam.Howlett@oracle.com>,
	Vlastimil Babka <vbabka@suse.cz>, Mike Rapoport <rppt@kernel.org>,
	Suren Baghdasaryan <surenb@google.com>,
	Jason Gunthorpe <jgg@ziepe.ca>,
	John Hubbard <jhubbard@nvidia.com>, Peter Xu <peterx@redhat.com>
Subject: Re: [PATCH v1] mm/gup: remove (VM_)BUG_ONs
Date: Fri, 6 Jun 2025 13:56:05 +0200	[thread overview]
Message-ID: <aELXVYKyampfvul0@tiehlicka> (raw)
In-Reply-To: <fe31e754-159d-49fd-aac7-64af5e313884@redhat.com>

On Fri 06-06-25 13:44:12, David Hildenbrand wrote:
> On 06.06.25 13:04, Lorenzo Stoakes wrote:
> > On Fri, Jun 06, 2025 at 12:28:28PM +0200, David Hildenbrand wrote:
> > > On 06.06.25 12:19, Lorenzo Stoakes wrote:
> > > > On Fri, Jun 06, 2025 at 12:13:27PM +0200, Michal Hocko wrote:
> > > > > On Fri 06-06-25 11:01:18, David Hildenbrand wrote:
> > > > > > On 06.06.25 10:31, Michal Hocko wrote:
> > > > > [...]
> > > > > > > Turning them into VM_WARN_ON
> > > > > > > should be reasonably safe as they are not enabled in production
> > > > > > > environment anyway so we cannot really rely on those. Having them in
> > > > > > > WARN form would be still useful for debugging and those that really need
> > > > > > > a crash dump while debugging can achieve the same result.
> > > > > > 
> > > > > > One question is if we should be VM_WARN_ON vs. VM_WARN_ON_ONCE ...
> > > > > 
> > > > > *WARN_ONCE ha a very limited use from code paths which are generally
> > > > > shared by many callers. You just see one and then nothing. Some time ago
> > > > > we have discussed an option to have _ONCE per call trace but I haven't
> > > > > see any follow up.
> > > > > 
> > > > > Anyway starting without _ONCE seems like safer option because we are not
> > > > > losing potentially useful debugging information. Afterall this is
> > > > > debugging only thing. But no strong position on my side.
> > > > > 
> > > > > > VM_BUG_ON is essentially a "once" thing so far, but then, we don't continue
> > > > > > ... so probably most should be _ONCE.
> > > > > > 
> > > > > > > 
> > > > > > > So while I agree that many of them could be dropped or made more clear
> > > > > > > those could be dealt with after a mass move. An advantage of this would
> > > > > > > be that we can drop VM_BUG_ON* and stop new instances from being added.
> > > > > > 
> > > > > > As a first step we could probably just #define them to go to the
> > > > > > VM_WARN_ON_* variants and see what happens.
> > > > > 
> > > > > You meand VM_BUG_ON expand to VM_WARN_ON by default?
> > > > 
> > > > Sorry to interject in the conversation, but to boldly throw my two English pence
> > > > into the mix:
> > > > 
> > > > As the "king of churn" (TM) you'll not be surprised to hear that I'm in favour
> > > > of us just doing a big patch and convert all VM_BUG_ON() -> VM_WARN_ON_ONCE()
> > > > and remove VM_BUG_ON*().
> > > > 
> > > > Pull the band-aid off... I think better than a #define if this indeed what you
> > > > meant David.
> > > > 
> > > > But of course, you'd expect me to have this opinion ;)
> > > 
> > > See my reply to Michal regarding keeping VM_BUG_ON() until we actually
> > > decided what the right cleanup is.
> > 
> > Sure, but to me the concept of VM_BUG_ON() is surely fundamentally broken - if
> > BUG_ON() means 'stop everything we're going to corrupt' then it makes no sense
> > to add a '...but only if CONFIG_DEBUG_VM is set' in there.
> > 
> > So to me the only assessment needed is 'do we want to warn on this or not?'.
> 
> Well, when done carefully, it would be when reworking a VM_BUG_ON:
> 
> (a) Should this really only be checked with DEBUG_VM or should this
>     actually be a WARN_ON_ONCE() + recovery
> (b) Does this check even still make sense in current code, or were we
>     just extra careful initially.
> (c) Do we even understand why it is checked or should we add a comment.
> (d) Should we use one of the _PAGE / _FOLIO / _VMA etc. variants instead
>     or even add new ones.

This is surelly a very responsible approach and I salute to that. But
then the reality hits...
 
> One could argue that the same is true for any other VM_WARN_ON ... but my
> point from the beginning was that if we're already touching them, why not
> spend some extra time and do it properly ..
> 
> ... but yeah, 600 instances are a bit much.

... exactly this. And I believe that the same could be achieved post
factum while having the ugly VM_BUG on gone.

> So agreed, let's move forward with a simple conversion.

Good call IMHO.

[...]
> > Am happy to come up with the churn-meister version of this patch and take the
> > heat :P
> 
> I assume with "this patch" you mean "a patch that gets rid of VM_BUG_ON
> completely", because I want this patch here (that started the discussion) to
> go in first.

Yes this makes sense.

> Fascinating how you are always looking for work :P

Thanks to both of you!
-- 
Michal Hocko
SUSE Labs


  reply	other threads:[~2025-06-06 11:56 UTC|newest]

Thread overview: 55+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-06-04 14:05 [PATCH v1] mm/gup: remove (VM_)BUG_ONs David Hildenbrand
2025-06-04 14:22 ` Vlastimil Babka
2025-06-04 14:26   ` Suren Baghdasaryan
2025-06-04 14:48 ` Lorenzo Stoakes
2025-06-04 14:58   ` David Hildenbrand
2025-06-04 15:44     ` Lorenzo Stoakes
2025-06-04 15:42   ` Linus Torvalds
2025-06-04 16:05     ` Lorenzo Stoakes
2025-06-04 15:14 ` Jason Gunthorpe
2025-06-04 16:01   ` David Hildenbrand
2025-06-04 17:25 ` SeongJae Park
2025-06-04 19:12 ` Liam R. Howlett
2025-06-04 19:16   ` David Hildenbrand
2025-06-05  1:07 ` John Hubbard
2025-06-05  5:37   ` Vlastimil Babka
2025-06-05  6:08     ` David Hildenbrand
2025-06-05  8:48       ` Vlastimil Babka
2025-06-05 12:29         ` David Hildenbrand
2025-06-05  7:10 ` Michal Hocko
2025-06-06  8:10   ` David Hildenbrand
2025-06-06  8:31     ` Michal Hocko
2025-06-06  9:01       ` David Hildenbrand
2025-06-06 10:13         ` Michal Hocko
2025-06-06 10:19           ` Lorenzo Stoakes
2025-06-06 10:28             ` David Hildenbrand
2025-06-06 11:04               ` Lorenzo Stoakes
2025-06-06 11:44                 ` David Hildenbrand
2025-06-06 11:56                   ` Michal Hocko [this message]
2025-06-06 12:12                   ` Lorenzo Stoakes
2025-06-06 12:17                     ` David Hildenbrand
2025-06-06 17:57                 ` John Hubbard
2025-06-06 18:06                   ` Lorenzo Stoakes
2025-06-06 18:15                     ` David Hildenbrand
2025-06-06 18:21                       ` John Hubbard
2025-06-06 18:23                         ` David Hildenbrand
2025-06-06 18:31                           ` John Hubbard
2025-06-06 18:36                             ` David Hildenbrand
2025-06-06 18:39                               ` John Hubbard
2025-06-06 18:34                           ` Lorenzo Stoakes
2025-06-06 18:42                           ` Jason Gunthorpe
2025-06-06 18:46                             ` Lorenzo Stoakes
2025-06-06 19:03                               ` Lorenzo Stoakes
2025-06-07 13:42                                 ` Jason Gunthorpe
2025-06-07 13:53                                   ` Lorenzo Stoakes
2025-06-07 18:00                                     ` John Hubbard
2025-06-09  9:57                                       ` Vlastimil Babka
2025-07-24 10:54                                         ` Vlastimil Babka
2025-07-24 10:56                                           ` Lorenzo Stoakes
2025-07-24 17:27                                             ` John Hubbard
2025-06-11  9:32                                       ` David Hildenbrand
2025-06-11 12:03                                         ` Jason Gunthorpe
2025-06-11 12:06                                           ` Lorenzo Stoakes
2025-06-06 10:28             ` Michal Hocko
2025-06-06 10:27           ` David Hildenbrand
2025-06-06  8:12 ` David Hildenbrand

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=aELXVYKyampfvul0@tiehlicka \
    --to=mhocko@suse.com \
    --cc=Liam.Howlett@oracle.com \
    --cc=akpm@linux-foundation.org \
    --cc=david@redhat.com \
    --cc=jgg@ziepe.ca \
    --cc=jhubbard@nvidia.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=lorenzo.stoakes@oracle.com \
    --cc=peterx@redhat.com \
    --cc=rppt@kernel.org \
    --cc=surenb@google.com \
    --cc=vbabka@suse.cz \
    /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.