On Mon, 11 Jan 2021 at 21:56, Peter Zijlstra <peterz@xxxxxxxxxxxxx> wrote: > > On Mon, Jan 11, 2021 at 07:36:20PM +0100, Ard Biesheuvel wrote: > > On Mon, 11 Jan 2021 at 18:27, Ard Biesheuvel <ardb@xxxxxxxxxx> wrote: > > > On Mon, 11 Jan 2021 at 17:52, Ard Biesheuvel <ardb@xxxxxxxxxx> wrote: > > > > > Special request to Peter to take a look at patch #2, and in particular, > > > > whether synchronize_rcu_tasks() is sufficient to ensure that a module > > > > providing the target of a static call can be unloaded safely. > > > > > > It seems I may have managed to confuse myself slightly here: without > > > an upper bound on the size of the input of the crc_t10dif() routine, I > > > suppose we can never assume that all its callers have finished. > > > > > > > Replying to self again - apologies. > > > > I think this is actually correct after all: synchronize_rcu_tasks() > > guarantees that all tasks have passed through a 'safe state', i.e., > > voluntary schedule(), return to userland, etc, which guarantees that > > no task could be executing the old static call target after > > synchronize_rcu_tasks() returns. > > Right, I think it should work. > > My initial question was why you'd want to support the unreg at all. > AFAICT these implementations are tiny, why bother having them as a > module, or if you insist having them as a module, why allowing removal? Yeah, good question. Having the accelerated version as a module makes sense imo: it will only be loaded if it is supported on the system, and it can be blacklisted by the user if it does not want it for any reason. Unload is just for completeness/symmetry, but it is unlikely to be crucial to anyone in practice. In any case, thanks for confirming - if this looks sane to you then we may be able to use this pattern in other places as well.