Hi, Slightly less mad this time :-) The primary purpose of all this is to get the WARN() printk() and __warn() calls into the same context. Notably the current state is that WARN() ends up doing printk() in-place, then takes an exception and has the exception do the __warn(). The problem with all this is the ONCE logic. Normal WARN_ON_ONCE() (without the printk) has the ONCE logic in the exception (__report_bug()). But because WARN() essentially results in two distinct actions (printk + trap) this cannot work. With the result that additional ONCE logic is sprinkled around for each such site. Current proposals look to make this worse by adding KUnit checks for all this, including regular WARN. Making the per-instance code overhead even worse. As such, by moving the printk() into the exception, and having the exception (__report_bug() in fact) do everything, we get rid of the external ONCE logic and provide a cental place for additional conditions without need to litter all the instances.
Hi, On Sat, Jun 07, 2025 at 11:42:24AM +0200, Peter Zijlstra wrote: > Slightly less mad this time :-) > > The primary purpose of all this is to get the WARN() printk() and > __warn() calls into the same context. Notably the current state is that > WARN() ends up doing printk() in-place, then takes an exception and has > the exception do the __warn(). > > The problem with all this is the ONCE logic. Normal WARN_ON_ONCE() > (without the printk) has the ONCE logic in the exception > (__report_bug()). But because WARN() essentially results in two distinct > actions (printk + trap) this cannot work. With the result that > additional ONCE logic is sprinkled around for each such site. > > Current proposals look to make this worse by adding KUnit checks for all > this, including regular WARN. Making the per-instance code overhead even > worse. > > As such, by moving the printk() into the exception, and having the > exception (__report_bug() in fact) do everything, we get rid of the > external ONCE logic and provide a cental place for additional conditions > without need to litter all the instances. Thanks a lot for working on that. What is the status of this patch? It looks like Linus was happy with it, and I understood that you felt it was a blocker for the kunit warning work we'd really like to get merged at some point. Thanks again, Maxime
On Thu, Jul 03, 2025 at 03:40:01PM +0200, Maxime Ripard wrote: > Hi, > > On Sat, Jun 07, 2025 at 11:42:24AM +0200, Peter Zijlstra wrote: > > Slightly less mad this time :-) > > > > The primary purpose of all this is to get the WARN() printk() and > > __warn() calls into the same context. Notably the current state is that > > WARN() ends up doing printk() in-place, then takes an exception and has > > the exception do the __warn(). > > > > The problem with all this is the ONCE logic. Normal WARN_ON_ONCE() > > (without the printk) has the ONCE logic in the exception > > (__report_bug()). But because WARN() essentially results in two distinct > > actions (printk + trap) this cannot work. With the result that > > additional ONCE logic is sprinkled around for each such site. > > > > Current proposals look to make this worse by adding KUnit checks for all > > this, including regular WARN. Making the per-instance code overhead even > > worse. > > > > As such, by moving the printk() into the exception, and having the > > exception (__report_bug() in fact) do everything, we get rid of the > > external ONCE logic and provide a cental place for additional conditions > > without need to litter all the instances. > > Thanks a lot for working on that. What is the status of this patch? It > looks like Linus was happy with it, and I understood that you felt it > was a blocker for the kunit warning work we'd really like to get merged > at some point. I talked to Mark Rutland about arm64 support, to see if the things I did are generic enough for other architectures to support, or if there's anything I need to change. He said he was going to have a poke, but it appears he's not had time yet. Once he's happy, I think we can move this forward. Obviously I have to rebase on top of the things Ingo stuck in meanwhile, but that shouldn't be too hard.
On Thu, Jul 03, 2025 at 03:47:12PM +0200, Peter Zijlstra wrote: > On Thu, Jul 03, 2025 at 03:40:01PM +0200, Maxime Ripard wrote: > > Hi, > > > > On Sat, Jun 07, 2025 at 11:42:24AM +0200, Peter Zijlstra wrote: > > > Slightly less mad this time :-) > > > > > > The primary purpose of all this is to get the WARN() printk() and > > > __warn() calls into the same context. Notably the current state is that > > > WARN() ends up doing printk() in-place, then takes an exception and has > > > the exception do the __warn(). > > > > > > The problem with all this is the ONCE logic. Normal WARN_ON_ONCE() > > > (without the printk) has the ONCE logic in the exception > > > (__report_bug()). But because WARN() essentially results in two distinct > > > actions (printk + trap) this cannot work. With the result that > > > additional ONCE logic is sprinkled around for each such site. > > > > > > Current proposals look to make this worse by adding KUnit checks for all > > > this, including regular WARN. Making the per-instance code overhead even > > > worse. > > > > > > As such, by moving the printk() into the exception, and having the > > > exception (__report_bug() in fact) do everything, we get rid of the > > > external ONCE logic and provide a cental place for additional conditions > > > without need to litter all the instances. > > > > Thanks a lot for working on that. What is the status of this patch? It > > looks like Linus was happy with it, and I understood that you felt it > > was a blocker for the kunit warning work we'd really like to get merged > > at some point. > > I talked to Mark Rutland about arm64 support, to see if the things I did > are generic enough for other architectures to support, or if there's > anything I need to change. > > He said he was going to have a poke, but it appears he's not had time > yet. > > Once he's happy, I think we can move this forward. Obviously I have to > rebase on top of the things Ingo stuck in meanwhile, but that shouldn't > be too hard. Ack, thanks for the update :) Maxime
On Sat, 7 Jun 2025 at 03:05, Peter Zijlstra <peterz@infradead.org> wrote:
>
> Slightly less mad this time :-)
Looks a lot better to me - at least by looking at the patches.
So I didn't actually apply the series to test out what the end result
looks like, but from just the patches this looks much nicer. Thanks,
Linus
© 2016 - 2025 Red Hat, Inc.