From: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
To: Tetsuo Handa <penguin-kernel@i-love.sakura.ne.jp>
Cc: linux-mm@kvack.org,
"Luis Claudio R. Goncalves" <lgoncalv@redhat.com>,
Andrew Morton <akpm@linux-foundation.org>,
Mel Gorman <mgorman@techsingularity.net>,
Michal Hocko <mhocko@suse.com>,
Thomas Gleixner <tglx@linutronix.de>,
Petr Mladek <pmladek@suse.com>
Subject: Re: [PATCH] mm/page_alloc: Use write_seqlock_irqsave() instead write_seqlock() + local_irq_save().
Date: Wed, 21 Jun 2023 15:06:41 +0200 [thread overview]
Message-ID: <20230621130641.-5iueY1I@linutronix.de> (raw)
In-Reply-To: <0e9fc992-8e05-2e63-b3b1-d8d3ce89fc16@I-love.SAKURA.ne.jp>
On 2023-06-21 20:33:35 [+0900], Tetsuo Handa wrote:
> On 2023/06/21 19:40, Sebastian Andrzej Siewior wrote:
> > printk_deferred_enter() has to be invoked in non-migrate-able context to
> > ensure that deferred printing is enabled and disabled on the same CPU.
>
> I can't catch. local_irq_save(flags); makes non-migrate-able context
> because sleeping is not allowed while IRQ is disabled, doesn't it?
That is correct. The problem is the local_irq_save() which remains on
PREEMPT_RT and this is problematic during write_seqlock() which acquires
spinlock_t which becomes a sleeping lock. write_seqlock_irqsave()
substitutes everything properly so on RT there is no local_irq_save().
> > This is the case after zonelist_update_seq has been acquired.
> >
> > Acquire zonelist_update_seq with write_seqlock_irqsave() and then defer
> > printk output.
>
> What guarantees that write_seqlock_irqsave() never calls printk()
> (e.g. lockdep warning) before printk_deferred_enter() takes effect?
Actually nothing but this could fixed by making the lockdep annotation
first followed by the actual increment in
do_write_seqcount_begin_nested(). I don't know this is the other way
around since we do annotation followed by locking in order to see the
splat before it happens.
Let me do a patch for that since it looks like the right thing to do.
If this "rare" issue is a blocker I don't see a sane way around it. Be
aware that tty_insert_flip_string_and_push_buffer() has atomic/ KASAN
annotation which _could_ detect something which then leads to pr_err()
invocations while tty_port::lock is acquired. Looking over
tty_port_close_start() there are pr_warn() invocation with the lock held
so again, possibilities.
Petr, is printing via print threads and direct printing via explicit
driver callback (which would avoid this problem) on the agenda?
Sebastian
next prev parent reply other threads:[~2023-06-21 13:08 UTC|newest]
Thread overview: 48+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-06-21 10:40 [PATCH] mm/page_alloc: Use write_seqlock_irqsave() instead write_seqlock() + local_irq_save() Sebastian Andrzej Siewior
2023-06-21 10:59 ` Michal Hocko
2023-06-21 11:16 ` Sebastian Andrzej Siewior
2023-06-21 11:49 ` Michal Hocko
2023-06-21 13:11 ` Sebastian Andrzej Siewior
2023-06-21 13:22 ` Michal Hocko
2023-06-21 13:25 ` Sebastian Andrzej Siewior
2023-06-21 11:14 ` David Hildenbrand
2023-06-21 11:33 ` Tetsuo Handa
2023-06-21 12:40 ` Petr Mladek
2023-06-21 13:08 ` Sebastian Andrzej Siewior
2023-06-21 13:06 ` Sebastian Andrzej Siewior [this message]
2023-06-21 13:32 ` Tetsuo Handa
2023-06-21 14:34 ` Sebastian Andrzej Siewior
2023-06-21 14:50 ` Tetsuo Handa
2023-06-21 23:24 ` Tetsuo Handa
2023-06-22 7:18 ` Michal Hocko
2023-06-22 10:58 ` Tetsuo Handa
2023-06-22 12:09 ` Michal Hocko
2023-06-22 13:36 ` Tetsuo Handa
2023-06-22 14:11 ` Petr Mladek
2023-06-22 14:28 ` Tetsuo Handa
2023-06-23 9:35 ` Sebastian Andrzej Siewior
2023-06-22 15:04 ` Petr Mladek
2023-06-22 15:43 ` Tetsuo Handa
2023-06-23 9:45 ` Sebastian Andrzej Siewior
2023-06-23 9:51 ` Tetsuo Handa
2023-06-23 10:11 ` Sebastian Andrzej Siewior
2023-06-23 10:36 ` Tetsuo Handa
2023-06-23 12:44 ` Sebastian Andrzej Siewior
2023-06-23 12:57 ` Michal Hocko
2023-06-23 10:53 ` Petr Mladek
2023-06-23 11:16 ` Tetsuo Handa
2023-06-23 13:31 ` Sebastian Andrzej Siewior
2023-06-23 15:38 ` Petr Mladek
2023-06-23 16:04 ` Sebastian Andrzej Siewior
2023-06-23 9:31 ` Sebastian Andrzej Siewior
2023-06-23 7:27 ` Sebastian Andrzej Siewior
2023-06-21 15:38 ` Petr Mladek
2023-06-23 8:12 ` Sebastian Andrzej Siewior
2023-06-23 9:21 ` Michal Hocko
2023-06-23 9:58 ` Sebastian Andrzej Siewior
2023-06-23 10:43 ` Michal Hocko
2023-06-23 10:45 ` Sebastian Andrzej Siewior
2023-06-23 10:50 ` Sebastian Andrzej Siewior
2023-06-23 11:32 ` Michal Hocko
2023-06-23 10:40 ` Petr Mladek
2023-06-23 13:24 ` Sebastian Andrzej Siewior
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=20230621130641.-5iueY1I@linutronix.de \
--to=bigeasy@linutronix.de \
--cc=akpm@linux-foundation.org \
--cc=lgoncalv@redhat.com \
--cc=linux-mm@kvack.org \
--cc=mgorman@techsingularity.net \
--cc=mhocko@suse.com \
--cc=penguin-kernel@i-love.sakura.ne.jp \
--cc=pmladek@suse.com \
--cc=tglx@linutronix.de \
/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;
as well as URLs for NNTP newsgroup(s).