mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Hongyan Xia <hongyan.xia@transsion.com>
To: Karl Mehltretter <kmehltretter@gmail.com>,
	Peter Zijlstra <peterz@infradead.org>,
	Ingo Molnar <mingo@redhat.com>,
	Catalin Marinas <catalin.marinas@arm.com>,
	Will Deacon <will@kernel.org>
Cc: Mark Rutland <mark.rutland@arm.com>, Song Liu <song@kernel.org>,
	Steven Rostedt <rostedt@goodmis.org>,
	Juri Lelli <juri.lelli@redhat.com>,
	Vincent Guittot <vincent.guittot@linaro.org>,
	Dietmar Eggemann <dietmar.eggemann@arm.com>,
	Valentin Schneider <vschneid@redhat.com>,
	"linux-arm-kernel@lists.infradead.org"
	<linux-arm-kernel@lists.infradead.org>,
	"linux-trace-kernel@vger.kernel.org"
	<linux-trace-kernel@vger.kernel.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH 2/3] arm64: Always inline preempt count and reschedule checks
Date: Wed, 25 Nov 2026 12:00:29 +0000	[thread overview]
Message-ID: <d3556c8e-75b2-4c4d-85a9-f79e0cb58819@transsion.com> (raw)
In-Reply-To: <80d8bdd8995a4b31a44e65bb9347b41c5be5226c.1794814699.git.kmehltretter@gmail.com>

On 11/16/2026 3:54 PM, Karl Mehltretter wrote:
> The preempt count and reschedule checks are plain inline functions,
> which permits out-of-line copies in instrumentable text. The checked
> notrace helpers added by the following patch use preempt_count(), while
> preempt_enable_notrace() uses should_resched() with
> CONFIG_DEBUG_PREEMPT and __preempt_count_dec_and_test() without it.
> 
> Force all three operations inline so noinstr callers keep them in their
> own section.
> 
> Signed-off-by: Karl Mehltretter <kmehltretter@gmail.com>
> ---
>   arch/arm64/include/asm/preempt.h | 6 +++---
>   1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/arch/arm64/include/asm/preempt.h b/arch/arm64/include/asm/preempt.h
> index f3a5c2cd1936d..805f7b33baf09 100644
> --- a/arch/arm64/include/asm/preempt.h
> +++ b/arch/arm64/include/asm/preempt.h
> @@ -7,7 +7,7 @@
>   #define PREEMPT_NEED_RESCHED	BIT(32)
>   #define PREEMPT_ENABLED	(PREEMPT_NEED_RESCHED)
>   
> -static inline int preempt_count(void)
> +static __always_inline int preempt_count(void)
>   {
>   	return READ_ONCE(current_thread_info()->preempt.count);
>   }
> @@ -75,13 +75,13 @@ static inline int __preempt_count_sub_return(int val)
>   	return pc;
>   }
>   
> -static inline bool should_resched(int preempt_offset)
> +static __always_inline bool should_resched(int preempt_offset)
>   {
>   	u64 pc = READ_ONCE(current_thread_info()->preempt_count);
>   	return unlikely(pc == preempt_offset);
>   }
>   
> -static inline bool __preempt_count_dec_and_test(void)
> +static __always_inline bool __preempt_count_dec_and_test(void)
>   {
>   	/*
>   	 * We must load the combined 'preempt_count' after decrementing

Reviewed-by: Hongyan Xia <hongyan.xia@transsion.com>

  reply	other threads:[~2026-11-25 12:00 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-16  7:54 [PATCH 0/3] sched/preempt: Check notrace preempt-count updates Karl Mehltretter
2026-11-16  7:54 ` [PATCH 1/3] arm64: Always inline raw preempt count updates Karl Mehltretter
2026-11-25 11:59   ` Hongyan Xia
2026-11-16  7:54 ` [PATCH 2/3] arm64: Always inline preempt count and reschedule checks Karl Mehltretter
2026-11-25 12:00   ` Hongyan Xia [this message]
2026-11-16  7:54 ` [PATCH 3/3] sched/preempt: Check preempt counts in notrace helpers Karl Mehltretter
2026-11-24 16:08   ` Steven Rostedt
2026-11-25 13:26   ` Hongyan Xia

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=d3556c8e-75b2-4c4d-85a9-f79e0cb58819@transsion.com \
    --to=hongyan.xia@transsion.com \
    --cc=catalin.marinas@arm.com \
    --cc=dietmar.eggemann@arm.com \
    --cc=juri.lelli@redhat.com \
    --cc=kmehltretter@gmail.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-trace-kernel@vger.kernel.org \
    --cc=mark.rutland@arm.com \
    --cc=mingo@redhat.com \
    --cc=peterz@infradead.org \
    --cc=rostedt@goodmis.org \
    --cc=song@kernel.org \
    --cc=vincent.guittot@linaro.org \
    --cc=vschneid@redhat.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®