--- zzzz-none-000/linux-4.9.279/arch/x86/mm/fault.c 2021-08-08 06:38:54.000000000 +0000 +++ puma7-atom-6591-750/linux-4.9.279/arch/x86/mm/fault.c 2023-02-08 11:43:42.000000000 +0000 @@ -28,6 +28,13 @@ #define CREATE_TRACE_POINTS #include +#if defined(CONFIG_AVM_SIMPLE_PROFILING) +#include +#endif /*--- #if defined(CONFIG_AVM_SIMPLE_PROFILING) ---*/ +#if defined(CONFIG_AVM_POWER) +#include +#endif/*--- #if defined(CONFIG_AVM_POWER) ---*/ + /* * Page fault error code bits: * @@ -687,15 +694,9 @@ printk(smep_warning, from_kuid(&init_user_ns, current_uid())); } - printk(KERN_ALERT "BUG: unable to handle kernel "); - if (address < PAGE_SIZE) - printk(KERN_CONT "NULL pointer dereference"); - else - printk(KERN_CONT "paging request"); - - printk(KERN_CONT " at %p\n", (void *) address); - printk(KERN_ALERT "IP:"); - printk_address(regs->ip); + pr_alert("BUG: unable to handle kernel %s at %p\n", + address < PAGE_SIZE ? "NULL pointer dereference" : "paging request", + (void *)address); dump_pagetable(address); } @@ -1420,10 +1421,24 @@ * Thus we have to be careful about not touching vma after handling the * fault, so we read the pkey beforehand. */ +#if defined(CONFIG_AVM_SIMPLE_PROFILING) + avm_simple_profiling_log(avm_profile_data_type_hw_irq_begin, (unsigned int)instruction_pointer(regs), AVM_PROFILE_PAGE_FAULT_ID); +#endif +#if defined(CONFIG_AVM_POWER) + avm_page_statistic_fault_get(); +#endif + pkey = vma_pkey(vma); fault = handle_mm_fault(vma, address, flags); major |= fault & VM_FAULT_MAJOR; +#if defined(CONFIG_AVM_POWER) + avm_page_statistic_fault_put(); +#endif +#if defined(CONFIG_AVM_SIMPLE_PROFILING) + avm_simple_profiling_log(avm_profile_data_type_hw_irq_end, (unsigned int)instruction_pointer(regs), AVM_PROFILE_PAGE_FAULT_ID); +#endif + /* * If we need to retry the mmap_sem has already been released, * and if there is a fatal signal pending there is no guarantee