netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Mark Rutland <mark.rutland@arm.com>
To: Joel Fernandes <joel@joelfernandes.org>,
	paulmck@kernel.org, Steven Rostedt <rostedt@goodmis.org>
Cc: Network Development <netdev@vger.kernel.org>,
	LKML <linux-kernel@vger.kernel.org>,
	rcu@vger.kernel.org, kernel-team <kernel-team@cloudflare.com>
Subject: Re: [PATCH] net: raise RCU qs after each threaded NAPI poll
Date: Thu, 7 Mar 2024 18:34:11 +0000	[thread overview]
Message-ID: <ZeoIo1dOW11STQHb@FVFF77S0Q05N> (raw)
In-Reply-To: <Zenx_Q0UiwMbSAdP@FVFF77S0Q05N>

On Thu, Mar 07, 2024 at 04:57:33PM +0000, Mark Rutland wrote:
> On Mon, Mar 04, 2024 at 04:16:01AM -0500, Joel Fernandes wrote:
> > On 3/2/2024 8:01 PM, Joel Fernandes wrote:
> > Case 1: For !CONFIG_DYNAMIC_FTRACE update of ftrace_trace_function
> > 
> > This config is itself expected to be slow. However seeing what it does, it is
> > trying to make sure the global function pointer "ftrace_trace_function" is
> > updated and any readers of that pointers would have finished reading it. I don't
> > personally think preemption has to be disabled across the entirety of the
> > section that calls into this function. So sensitivity to preempt disabling
> > should not be relevant for this case IMO, but lets see if ftrace folks disagree
> > (on CC). It has more to do with, any callers of this function pointer are no
> > longer calling into the old function.
> 
> I've been looking into this case for the last couple of days, and the short
> story is that the existing code is broken today for PREEMPT_FULL, and the code
> for CONFIG_DYNAMIC_FTRACE=y is similarly broken. A number of architectures have
> also implemented the entry assembly incorrectly...

> I believe our options are:
> 
> * Avoid the mismatch by construction:
> 
>   - On architectures with trampolines, we could ensure that the list_ops gets
>     its own trampoline and that we *always* use a trampoline, never using a
>     common ftrace_caller. When we switch callers from one trampoline to another
>     they'd atomically get the new func+ops.
> 
>     I reckon that might be a good option for x86-64?
> 
>   - On architectures without trampolines we could 
>     require that that the ftrace_caller 
>     loads ops->func from the ops pointer.
>     
>     That'd mean removing the 'ftrace_trace_function' pointer and removing
>     patching of the call to the trace function (but the actual tracee callsites
>     would still be patched).
> 
>     I'd be in favour of this for arm64 since that matches the way CALL_OPS
>     works; the only difference is we'd load a global ops pointer rather than a
>     per-callsite ops pointer.
> 
> * Use rcu_tasks_trace to synchronize updates?

Having acquainted myself with the RCU flavours, I think the RCU Tasks Trace
suggestion wouldn't help, but *some* flavour of RCU might give us what we need.

That said, my preference is the "avoid the mismatch by construction" camp, as
even if we need to wait for uses of the old func+ops to finish, we'd have fewer
transitions (and consequently less patching) if we have:

	switch_to_new_ops();
	wait_for_old_ops_usage_to_finish();

... rather than:

	switch_to_list_func();
	wait_for_old_ops_usage_to_finish();
	switch_to_new_ops();
	ensure_new_ops_are_visible();
	switch_to_new_func();

Mark.

  reply	other threads:[~2024-03-07 18:34 UTC|newest]

Thread overview: 47+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-02-27 15:44 [PATCH] net: raise RCU qs after each threaded NAPI poll Yan Zhai
2024-02-27 16:44 ` Eric Dumazet
2024-02-27 18:32   ` Paul E. McKenney
2024-02-27 21:22     ` Yan Zhai
2024-02-27 22:58       ` Paul E. McKenney
2024-02-28  3:10     ` Jakub Kicinski
2024-02-28  4:42       ` Paul E. McKenney
2024-02-28 14:43         ` Jakub Kicinski
2024-02-28 15:15           ` Paul E. McKenney
2024-02-28 15:35             ` Jakub Kicinski
2024-02-28 15:57               ` Yan Zhai
2024-02-28 11:50     ` Toke Høiland-Jørgensen
2024-02-28 15:10       ` Paul E. McKenney
2024-02-28 15:48         ` Yan Zhai
2024-02-28 17:47           ` Paul E. McKenney
2024-02-28 15:37     ` Joel Fernandes
2024-02-28 16:37       ` Yan Zhai
2024-02-28 17:18         ` Paul E. McKenney
2024-02-28 20:14           ` Joel Fernandes
2024-02-28 21:13             ` Paul E. McKenney
2024-02-28 21:27               ` Joel Fernandes
2024-02-28 21:52                 ` Paul E. McKenney
2024-02-28 22:10                   ` Joel Fernandes
2024-02-28 22:19                     ` Paul E. McKenney
2024-02-28 22:33                       ` Steven Rostedt
2024-02-28 22:48                         ` Alexei Starovoitov
2024-02-28 22:58                           ` Paul E. McKenney
2024-02-29 14:21                             ` Joel Fernandes
2024-02-29 16:57                               ` Paul E. McKenney
2024-02-29 17:41                                 ` Joel Fernandes
2024-02-29 18:29                                   ` Paul E. McKenney
2024-03-02  2:24                                     ` Joel Fernandes
2024-03-03  0:25                                       ` Paul E. McKenney
2024-03-03  1:01                                         ` Joel Fernandes
2024-03-04  9:16                                           ` Joel Fernandes
2024-03-05 17:53                                             ` Paul E. McKenney
2024-03-05 19:57                                               ` Mark Rutland
2024-03-05 21:52                                                 ` Paul E. McKenney
2024-03-06 16:56                                               ` Steven Rostedt
2024-03-07 16:57                                             ` Mark Rutland
2024-03-07 18:34                                               ` Mark Rutland [this message]
2024-03-07 18:52                                               ` Steven Rostedt
2024-03-07 18:58                                                 ` Paul E. McKenney
2024-03-04  9:16                                           ` Joel Fernandes
2024-02-28 22:49                         ` Paul E. McKenney
2024-02-27 21:17   ` Yan Zhai
2024-02-28 23:53   ` Yan Zhai

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=ZeoIo1dOW11STQHb@FVFF77S0Q05N \
    --to=mark.rutland@arm.com \
    --cc=joel@joelfernandes.org \
    --cc=kernel-team@cloudflare.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=paulmck@kernel.org \
    --cc=rcu@vger.kernel.org \
    --cc=rostedt@goodmis.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;
as well as URLs for NNTP newsgroup(s).