Re: [PATCH] x86/alternatives: free smp_alt_modules when enable smp

From: zhouchengming
Date: Fri Oct 27 2017 - 04:12:02 EST


On 2017/10/27 15:49, Borislav Petkov wrote:
On Fri, Oct 27, 2017 at 03:18:12PM +0800, Zhou Chengming wrote:
In the current code, we don't free smp_alt_modules when enable smp,
so have to wait module unload to call alternatives_smp_module_del()
to free its smp_alt_module. This strategy has shortcomings.
I love it when the commit message states there is allegedly some problem
but it doesn't explain what that problem is.

Well, I should explain it although it's small shortcomings. First, maybe
some modules don't unload after smp enabled, so these smp_alt_modules won't
be freed even they are useless anymore. Second, every module has to call
alternatives_smp_module_del() when unload to see if it's in the list even
after smp enabled, it's complete useless work. So why not take the quick
way like we do in alternatives_smp_module_add() ?

Thanks.

> From the looks of the patch, though, I'd prefer what we do now and not
touch the code.