On 10/1/19 11:39 AM, Leonardo Bras wrote: > On Mon, 2019-09-30 at 14:47 -0700, John Hubbard wrote: >> On 9/30/19 11:42 AM, Leonardo Bras wrote: >>> On Mon, 2019-09-30 at 10:57 -0700, John Hubbard wrote: ... > > I am failing to understand the issue. > I mean, smp_call_function_many() will issue a IPI to each CPU in > CPUmask and wait it to run before returning. > If interrupts are disabled (either by MSR_EE=0 or local_irq_disable), > the IPI will not run on that CPU, and the wait part will make sure to > lock the thread until the interrupts are enabled again. > > Could you please point the issue there? The biggest problem here is evidently my not knowing much about ppc. :) So if that's how it behaves, then all is well, sorry it took me a while to understand the MSR_EE=0 behavior. > >>>> Simply skipping that means that an additional mechanism is required...which >>>> btw might involve a new, ppc-specific routine, so maybe this is going to end >>>> up pretty close to what I pasted in after all... >>>>> Of course, if we really need that, we can add a bool parameter to the >>>>> function to choose about disabling/enabling irqs. >>>>>> * This is really a core mm function, so don't hide it away in arch layers. >>>>>> (If you're changing mm/ files, that's a big hint.) >>>>> >>>>> My idea here is to let the arch decide on how this 'register' is going >>>>> to work, as archs may have different needs (in powerpc for example, we >>>>> can't always disable irqs, since we may be in realmode). >> >> Yes, the tension there is that a) some things are per-arch, and b) it's easy >> to get it wrong. The commit below (d9101bfa6adc) is IMHO a perfect example of >> that. >> >> So, I would like core mm/ functions that guide the way, but the interrupt >> behavior complicates it. I think your original passing of just struct_mm >> is probably the right balance, assuming that I'm wrong about interrupts. >> > > I think, for the generic function, that including {en,dis}abling the > interrupt is fine. I mean, if disabling the interrupt is the generic > behavior, it's ok. > I will just make sure to explain that the interrupt {en,dis}abling is > part of the sync process. If an arch don't like it, it can write a > specific function that does the sync in a better way. (and defining > __HAVE_ARCH_LOCKLESS_PGTBL_WALK_COUNTER to ignore the generic function) > Tentatively, that sounds good. We still end up with the counter variable directly in struct mm_struct, and the generic function in mm/gup.c (or mm/somewhere), where it's easy to find and see what's going on. sure. thanks, -- John Hubbard NVIDIA