Messages in this thread | | | Date | Fri, 14 Dec 2018 11:02:32 +0100 | From | Petr Mladek <> | Subject | Re: [PATCH v14 05/11] livepatch: Simplify API by removing registration step |
| |
On Thu 2018-12-13 16:46:25, Josh Poimboeuf wrote: > Now that we can't re-enable a patch, I wonder if we really need both the > 'patch->enabled' and 'klp_target_state' variables? > > A patch is now always enabled, unless it's in transition, in which case > its 'enabled' state is the same as 'klp_target_state'. > > For example I wonder if we could get rid of 'klp_target_state', since it > should be the same as 'klp_transition_patch->enabled'.
There are some catches:
1. klp_update_patch_state() can be called anywhere and anytime. We would add yet another race-sensitive code if we access the flag via a pointer.
2. patch->enabled is bool while klp_target_state is triple state. The argument is that KLP_UNDEFINED helps to catch bugs.
> Or alternatively we could get rid of 'patch->enabled', since it should > be the same as > > patch == klp_transition_patch ? klp_target_state : true
This might solve the first catch but not the 2nd one. Not to say that it is much harder to read.
> Of course this could be a follow-on cleanup patch, which could be done > in the future, so as not to hold up the merging of these patches > anymore.
Yes, please. This is controversial, non-trivial, and can wait.
Best Regards, Petr
| |