From: "Alexei Starovoitov" <alexei.starovoitov@gmail.com>
To: "Mathieu Desnoyers" <mathieu.desnoyers@efficios.com>,
"Peter Zijlstra" <peterz@infradead.org>,
"Ingo Molnar" <mingo@redhat.com>
Cc: "Shuah Khan" <shuah@kernel.org>,
"Aniket Gattani" <aniketgattani@google.com>,
<linux-kernel@vger.kernel.org>, <linux-kselftest@vger.kernel.org>,
"Paul E. McKenney" <paulmck@kernel.org>, <bpf@vger.kernel.org>,
"Naveen N Rao" <naveen@kernel.org>,
"David S. Miller" <davem@davemloft.net>,
"Masami Hiramatsu" <mhiramat@kernel.org>,
<linux-trace-kernel@vger.kernel.org>
Subject: Re: [PATCH v2 15/16] selftests/membarrier: Check the memory barriers of each thread
Date: Fri, 04 Dec 2026 04:13:17 +0000 [thread overview]
Message-ID: <DNBNMFYXZ875.S209ZT3GLW1J@gmail.com> (raw)
In-Reply-To: <c2c22a4d-c254-4247-9822-0773d03270dd@efficios.com>
On Thu, Dec 03, 2026 at 08:44 AM Mathieu Desnoyers <mathieu.desnoyers@efficios.com> wrote:
> Is this split acceptable to you? Or do you see a way to observe the
> scheduler barrier without kprobes on instructions?
Split is fine. I don't insist, but try get rid of kprobes...
sched_switch sets OWES_BARRIER in two cases. On x86-64:
prev->mm barrier after the store to rq->curr hook
---------- ------------------------------------- ----------------
another mm write_cr3() in switch_mm_irqs_off() tp_btf/tlb_flush
NULL mmdrop_lazy_tlb_sched() in none
finish_task_switch()
Another mm: loaded_mm != next.
NULL: I don't see a hook, but it's one branch.
Then read_kernel(), scan_function(), probe_sites(), sites[], the
cookies and the "probe hits were lost" warning can go away.
What is lost is the sync_core() check of patch 16 after a kernel thread.
tlb_flush is defined on x86 only. Hence the "?" in SEC(). Turn autoload
on for x86.
/* switch_mm_irqs_off() wrote CR3. */
SEC("?tp_btf/tlb_flush")
int BPF_PROG(tlb_flush, int reason)
{
struct cpu_state *state;
__u32 zero = 0;
if (reason != TLB_FLUSH_ON_TASK_SWITCH)
return 0;
state = bpf_map_lookup_elem(&cpu_state, &zero);
if (state)
state->owed = 0;
return 0;
}
next prev parent reply other threads:[~2026-12-04 4:13 UTC|newest]
Thread overview: 29+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-27 18:58 [PATCH v2 00/16] membarrier: fixes, selftests and documentation Mathieu Desnoyers
2026-11-27 18:58 ` Mathieu Desnoyers
2026-11-27 18:58 ` [PATCH v2 01/16] sched/membarrier: Fix stale runqueue state after a lazy mm switch Mathieu Desnoyers
2026-11-27 18:58 ` [PATCH v2 02/16] sched/membarrier: Report only completed registrations Mathieu Desnoyers
2026-11-27 18:58 ` [PATCH v2 03/16] selftests/membarrier: Rebuild the tests when their header changes Mathieu Desnoyers
2026-11-27 18:58 ` [PATCH v2 04/16] selftests/membarrier: Issue the sync core command in its test Mathieu Desnoyers
2026-11-27 18:58 ` [PATCH v2 05/16] selftests/membarrier: Run the tests on nohz_full kernels Mathieu Desnoyers
2026-11-27 18:58 ` [PATCH v2 06/16] selftests/membarrier: Test which CPUs the expedited commands interrupt Mathieu Desnoyers
2026-11-27 18:58 ` [PATCH v2 07/16] selftests/membarrier: Test command arguments and registration lifetime Mathieu Desnoyers
2026-11-27 18:58 ` [PATCH v2 08/16] LoongArch: membarrier: Add full memory barrier in switch_mm() Mathieu Desnoyers
2026-11-29 4:00 ` Huacai Chen
2026-12-03 16:41 ` Mathieu Desnoyers
2026-12-04 5:03 ` Huacai Chen
2026-12-04 14:35 ` Mathieu Desnoyers
2026-11-27 18:58 ` [PATCH v2 09/16] parisc: " Mathieu Desnoyers
2026-11-27 18:58 ` [PATCH v2 10/16] Documentation/membarrier: Update the per-architecture barrier list Mathieu Desnoyers
2026-11-27 18:58 ` Mathieu Desnoyers
2026-11-27 18:58 ` [PATCH v2 11/16] Documentation/features: Update the membarrier sync core requirements Mathieu Desnoyers
2026-11-27 18:58 ` [PATCH v2 12/16] x86/entry: Remove stale membarrier sync core comments Mathieu Desnoyers
2026-11-27 18:58 ` [PATCH v2 13/16] selftests/membarrier: Add litmus tests of the memory ordering Mathieu Desnoyers
2026-11-27 18:58 ` [PATCH v2 14/16] MAINTAINERS: Add the membarrier selftests to MEMBARRIER SUPPORT Mathieu Desnoyers
2026-11-27 18:58 ` [PATCH v2 15/16] selftests/membarrier: Check the memory barriers of each thread Mathieu Desnoyers
2026-11-27 19:15 ` sashiko-bot
2026-11-27 19:27 ` Mathieu Desnoyers
2026-11-27 23:45 ` Alexei Starovoitov
2026-12-03 16:44 ` Mathieu Desnoyers
2026-12-04 4:13 ` Alexei Starovoitov [this message]
2026-12-04 14:33 ` Mathieu Desnoyers
2026-11-27 18:58 ` [PATCH v2 16/16] selftests/membarrier: Check the core serialization of the sync core command Mathieu Desnoyers
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=DNBNMFYXZ875.S209ZT3GLW1J@gmail.com \
--to=alexei.starovoitov@gmail.com \
--cc=aniketgattani@google.com \
--cc=bpf@vger.kernel.org \
--cc=davem@davemloft.net \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-kselftest@vger.kernel.org \
--cc=linux-trace-kernel@vger.kernel.org \
--cc=mathieu.desnoyers@efficios.com \
--cc=mhiramat@kernel.org \
--cc=mingo@redhat.com \
--cc=naveen@kernel.org \
--cc=paulmck@kernel.org \
--cc=peterz@infradead.org \
--cc=shuah@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.