From: y00318929 <yeyunfeng@huawei.com>
To: <catalin.marinas@arm.com>, <will@kernel.org>,
<wangkefeng.wang@huawei.com>,
<linux-arm-kernel@lists.infradead.org>,
<linux-kernel@vger.kernel.org>, <yeyunfeng@huawei.com>
Subject: [PATCH 5/5] arm64: mm: Add TLB flush trace on context switch
Date: Mon, 17 Oct 2022 16:12:58 +0800 [thread overview]
Message-ID: <20221017081258.3678830-6-yeyunfeng@huawei.com> (raw)
In-Reply-To: <20221017081258.3678830-1-yeyunfeng@huawei.com>
From: Yunfeng Ye <yeyunfeng@huawei.com>
We do not know how many times the TLB is flushed on context switch.
Adding trace_tlb_flush() in check_and_switch_context() may be useful.
Signed-off-by: Yunfeng Ye <yeyunfeng@huawei.com>
---
arch/arm64/mm/context.c | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/arch/arm64/mm/context.c b/arch/arm64/mm/context.c
index 0ea3e7485ae7..eab470a97620 100644
--- a/arch/arm64/mm/context.c
+++ b/arch/arm64/mm/context.c
@@ -19,6 +19,8 @@
#include <asm/smp.h>
#include <asm/tlbflush.h>
+#include <trace/events/tlb.h>
+
struct asid_bitmap {
unsigned long *map;
unsigned long nr;
@@ -60,6 +62,8 @@ static DEFINE_STATIC_KEY_FALSE(asid_isolation_enable);
#define ctxid2asid(asid) ((asid) & ~ASID_MASK)
#define asid2ctxid(asid, genid) ((asid) | (genid))
+#define TLB_FLUSH_ALL (-1)
+
/* Get the ASIDBits supported by the current CPU */
static u32 get_cpu_asid_bits(void)
{
@@ -416,8 +420,10 @@ void check_and_switch_context(struct mm_struct *mm)
atomic64_set(&mm->context.id, asid);
}
- if (cpumask_test_and_clear_cpu(cpu, &tlb_flush_pending))
+ if (cpumask_test_and_clear_cpu(cpu, &tlb_flush_pending)) {
local_flush_tlb_all();
+ trace_tlb_flush(TLB_FLUSH_ON_TASK_SWITCH, TLB_FLUSH_ALL);
+ }
atomic64_set(this_cpu_ptr(&active_asids), asid);
raw_spin_unlock_irqrestore(&cpu_asid_lock, flags);
--
2.27.0
next prev parent reply other threads:[~2022-10-17 8:14 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-10-17 8:12 [PATCH 0/5] Support ASID Isolation mechanism y00318929
2022-10-17 8:12 ` [PATCH 1/5] arm64: mm: Define asid_bitmap structure for pinned_asid y00318929
2022-10-17 8:12 ` [PATCH 2/5] arm64: mm: Extract the processing of asid_generation y00318929
2022-10-17 8:12 ` [PATCH 3/5] arm64: mm: Use cpumask in flush_context() y00318929
2022-10-17 8:12 ` [PATCH 4/5] arm64: mm: Support ASID isolation feature y00318929
2022-10-17 8:12 ` y00318929 [this message]
2022-10-17 8:31 [PATCH 0/5] Support ASID Isolation mechanism Yunfeng Ye
2022-10-17 8:32 ` [PATCH 5/5] arm64: mm: Add TLB flush trace on context switch Yunfeng Ye
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=20221017081258.3678830-6-yeyunfeng@huawei.com \
--to=yeyunfeng@huawei.com \
--cc=catalin.marinas@arm.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=wangkefeng.wang@huawei.com \
--cc=will@kernel.org \
/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®