Hi Andi, > > This makes it impossible to use current->mm in selftests which currently > > creates null pointer exception. > > This patch allows selftest to use current->mm by using active_mm. > > What is the failure you are getting? I'm not sure this might be > the right solution, but it might make sense, though... if there > is a valid reason. current->mm is both used by the test and by functions it uses. It is used as argument of vm_lookup() and inside of vm_mmap(), hence we cannot use any other pointer. > I would first ask myself why are we getting a NULL pointer > dereference? It's an expected behaviour when the system has multiple NUMA nodes. The probe is called via work_on_cpu (pci_call_probe()) which makes it run in separate workqueue on another cpu. The workqueue is run in kthread and therefore we get NULL pointer. > Why do we need to use current->mm? Which memory's > should current->mm point to? Is it a kernel thread or a user > thread? Why are we peaking inside current->mm? This test is supposed to simulate user controling the graphics card - get and set values in mapped /dev/dri/card0 file as a user. It needs a mapping that the simulated user has access to. I don't know how to let the user access the memory other way than creating a mapping via vm_mmap() which uses current->mm. > If we are hiding a bug with another bug then this patch is not > OK, even if the second bug is less serious. So, please, don't do > it. Ok, I'll work on another solution. Mikołaj