Linux-mm Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Alexander Gordeev <agordeev@linux.ibm.com>
To: Heiko Carstens <hca@linux.ibm.com>
Cc: Gerald Schaefer <gerald.schaefer@linux.ibm.com>,
	Christian Borntraeger <borntraeger@linux.ibm.com>,
	Vasily Gorbik <gor@linux.ibm.com>,
	Claudio Imbrenda <imbrenda@linux.ibm.com>,
	Andrey Ryabinin <ryabinin.a.a@gmail.com>,
	linux-s390@vger.kernel.org, linux-mm@kvack.org,
	linux-kernel@vger.kernel.org, kasan-dev@googlegroups.com
Subject: Re: [PATCH v7 2/4] s390/mm: Batch PTE updates in lazy MMU mode
Date: Thu, 27 Aug 2026 13:39:59 +0200	[thread overview]
Message-ID: <b0d59b27-8d15-499a-aced-e5b247ed40c1-agordeev@linux.ibm.com> (raw)
In-Reply-To: <20260827081156.3869103Abc-hca@linux.ibm.com>

On Thu, Aug 27, 2026 at 10:11:56AM +0200, Heiko Carstens wrote:
> On Wed, Aug 26, 2026 at 04:34:25PM +0200, Alexander Gordeev wrote:
> > On Wed, Aug 26, 2026 at 03:02:57PM +0200, Heiko Carstens wrote:
> > > Would be nice if we could avoid the not so obvious local_bh_disable()
> > > and local_bh_enable() pairs.
> > 
> > Calling ptep_get() from BH context was certainly unexpected, but the way
> > local_bh_enable|disable() pairs are used is actually straightforward.
> > This is a slow path anyway, so I would think the simplicity prevails in
> > this case.
> > 
> > But again, I will try to avoid that.
> 
> I do agree that ptep_get() being called from BH context is not what I
> would have expected too. But then again, nothing prevents people from
> doing that from irq context too, no matter if that is sane or not.

I am currently looking if any interrupt handler does such a crazy thing.
If not, I hope it would be possible to nail this requirement with the
maintainers and e.g. add VM_BUG_ON(in_hardirq()) to ptep_get()/set_pte()
implementations.

But even with BHs we have an interesting situation: calling ptep_get()
from a BH while in the lazy MMU mode is actually a read hazard. IOW what
I hit looks to me as a bug in generic code, and one that looks very
difficult to fix. So staying with local_bh_enable|disable() would be
still a good tradeoff.

> Imho the "final" version should either be implemented that it can go
> without disabling bottom halves, or, if that is not worth the effort,
> even disable interrupts, just to avoid other surprises.

Yes, that would be the last resort.

> Plus a comment why it is needed, please.

Sure.


  reply	other threads:[~2026-08-27 11:40 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-17 11:32 [PATCH v7 0/4] s390/mm: Batch PTE updates in lazy MMU mode Alexander Gordeev
2026-08-17 11:32 ` [PATCH v7 1/4] mm: Make lazy MMU mode context-aware Alexander Gordeev
2026-08-17 11:33 ` [PATCH v7 2/4] s390/mm: Batch PTE updates in lazy MMU mode Alexander Gordeev
2026-08-24 10:40   ` Heiko Carstens
2026-08-26 12:00     ` Alexander Gordeev
2026-08-26 13:02       ` Heiko Carstens
2026-08-26 14:34         ` Alexander Gordeev
2026-08-27  8:11           ` Heiko Carstens
2026-08-27 11:39             ` Alexander Gordeev [this message]
2026-08-17 11:33 ` [PATCH v7 3/4] mm/kasan: Introduce helpers for lazy MMU mode sanitizer Alexander Gordeev
2026-08-17 22:11   ` Andrey Konovalov
2026-08-18 12:01     ` Alexander Gordeev
2026-08-24  9:56       ` Heiko Carstens
2026-08-25  7:50         ` Alexander Gordeev
2026-08-25 10:08           ` Heiko Carstens
2026-08-17 11:33 ` [PATCH v7 4/4] s390/mm: Lazy " Alexander Gordeev

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=b0d59b27-8d15-499a-aced-e5b247ed40c1-agordeev@linux.ibm.com \
    --to=agordeev@linux.ibm.com \
    --cc=borntraeger@linux.ibm.com \
    --cc=gerald.schaefer@linux.ibm.com \
    --cc=gor@linux.ibm.com \
    --cc=hca@linux.ibm.com \
    --cc=imbrenda@linux.ibm.com \
    --cc=kasan-dev@googlegroups.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=linux-s390@vger.kernel.org \
    --cc=ryabinin.a.a@gmail.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox