From: shaohaojize@126.com
To: akpm@linux-foundation.org
Cc: linux-kernel@vger.kernel.org, jiaoxupo@h3c.com, berlin@h3c.com,
zhang.zhansheng@h3c.com, wang.yul@h3c.com, linux-mm@kvack.org,
"zhang.chun" <zhang.chuna@h3c.com>
Subject: [PATCH] mm: fix kmap_high deadlock
Date: Sun, 30 Jun 2024 16:02:55 +0800 [thread overview]
Message-ID: <20240630080255.1901-1-shaohaojize@126.com> (raw)
From: "zhang.chun" <zhang.chuna@h3c.com>
I work with zhangzhansheng(from h3c) find that some situation may casue
deadlock when we use kmap_highand kmap_XXX or kumap_xxx between
differt cores at the same time.kmap_high->map_new_virtual->
flush_all_zero_pkmaps->flush_tlb_kernel_range->on_each_cpu,
On this condition, kmap_high
hold the kmap_lock, wait the other cores ack. But the others
may disable irq and wait kmap_lock, this is some deadlock condition.
I think it's necessary to give kmap_lock before call
flush_tlb_kernel_range.
Like this:
spin_unlock(&kmap_lock);
flush_tlb_kernel_range(xxx);
spin_lock(&kmap_lock);
Signed-off-by: zhang.chun <zhang.chuna@h3c.com>
---
mm/highmem.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/mm/highmem.c b/mm/highmem.c
index bd48ba445dd4..12d20e551579 100644
--- a/mm/highmem.c
+++ b/mm/highmem.c
@@ -221,7 +221,9 @@ static void flush_all_zero_pkmaps(void)
need_flush = 1;
}
if (need_flush)
+ spin_unlock(&kmap_lock);
flush_tlb_kernel_range(PKMAP_ADDR(0), PKMAP_ADDR(LAST_PKMAP));
+ spin_lock(&kmap_lock);
}
void __kmap_flush_unused(void)
--
2.34.1
next reply other threads:[~2024-06-30 8:04 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-06-30 8:02 shaohaojize [this message]
2024-07-01 1:45 Zhangchun
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=20240630080255.1901-1-shaohaojize@126.com \
--to=shaohaojize@126.com \
--cc=akpm@linux-foundation.org \
--cc=berlin@h3c.com \
--cc=jiaoxupo@h3c.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=wang.yul@h3c.com \
--cc=zhang.chuna@h3c.com \
--cc=zhang.zhansheng@h3c.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
all inboxes | Powered by JetHome®