On Nov 21, 2018, at 8:34 AM, Igor Stoppa <igor.stoppa@xxxxxxxxx> wrote:
There might be other reasons for replicating the mm_struct.
If I understand correctly how the text patching works, it happens sequentially, because of the text_mutex used by arch_jump_label_transform
Which might be fine for this specific case, but I think I shouldn't introduce a global mutex, when it comes to data.
Most likely, if two or more cores want to perform a write rare operation, there is no correlation between them, they could proceed in parallel. And if there really is, then the user of the API should introduce own locking, for that specific case.
I think that if you create per-CPU temporary mms as you proposed, you do not
need a global lock. You would need to protect against module unloading,
and
maybe refactor the code. Specifically, Iâm not sure whether protection
against IRQs is something that you need.
Iâm also not familiar with this
patch-set so Iâm not sure what atomicity guarantees do you need.
A bit unrelated question, related to text patching: I see that each patching operation is validated, but wouldn't it be more robust to first validate all of then, and only after they are all found to be compliant, to proceed with the actual modifications?
And about the actual implementation of the write rare for the statically allocated variables, is it expected that I use Nadav's function?
Itâs not âmyâ function. ;-)
IMHO the code is in relatively good and stable state. The last couple of
versions were due to me being afraid to add BUG_ONs as Peter asked me to.
The code is rather simple, but there are a couple of pitfalls that hopefully
I avoided correctly.