]> Git Repo - J-linux.git/blobdiff - arch/powerpc/lib/code-patching.c
scsi: zfcp: Trace when request remove fails after qdio send fails
[J-linux.git] / arch / powerpc / lib / code-patching.c
index a6a5047f8ba2324abfc28d6f4aea49475a006a36..b00112d7ad467d30712d168538a418bac4d5c60c 100644 (file)
@@ -178,7 +178,6 @@ static int text_area_cpu_up_mm(unsigned int cpu)
 
        this_cpu_write(cpu_patching_context.mm, mm);
        this_cpu_write(cpu_patching_context.addr, addr);
-       this_cpu_write(cpu_patching_context.pte, pte);
 
        return 0;
 
@@ -195,7 +194,6 @@ static int text_area_cpu_down_mm(unsigned int cpu)
 
        this_cpu_write(cpu_patching_context.mm, NULL);
        this_cpu_write(cpu_patching_context.addr, 0);
-       this_cpu_write(cpu_patching_context.pte, NULL);
 
        return 0;
 }
@@ -289,12 +287,16 @@ static int __do_patch_instruction_mm(u32 *addr, ppc_inst_t instr)
        unsigned long pfn = get_patch_pfn(addr);
        struct mm_struct *patching_mm;
        struct mm_struct *orig_mm;
+       spinlock_t *ptl;
 
        patching_mm = __this_cpu_read(cpu_patching_context.mm);
-       pte = __this_cpu_read(cpu_patching_context.pte);
        text_poke_addr = __this_cpu_read(cpu_patching_context.addr);
        patch_addr = (u32 *)(text_poke_addr + offset_in_page(addr));
 
+       pte = get_locked_pte(patching_mm, text_poke_addr, &ptl);
+       if (!pte)
+               return -ENOMEM;
+
        __set_pte_at(patching_mm, text_poke_addr, pte, pfn_pte(pfn, PAGE_KERNEL), 0);
 
        /* order PTE update before use, also serves as the hwsync */
@@ -321,6 +323,8 @@ static int __do_patch_instruction_mm(u32 *addr, ppc_inst_t instr)
         */
        local_flush_tlb_page_psize(patching_mm, text_poke_addr, mmu_virtual_psize);
 
+       pte_unmap_unlock(pte, ptl);
+
        return err;
 }
 
@@ -349,7 +353,7 @@ static int __do_patch_instruction(u32 *addr, ppc_inst_t instr)
        return err;
 }
 
-static int do_patch_instruction(u32 *addr, ppc_inst_t instr)
+int patch_instruction(u32 *addr, ppc_inst_t instr)
 {
        int err;
        unsigned long flags;
@@ -372,17 +376,6 @@ static int do_patch_instruction(u32 *addr, ppc_inst_t instr)
 
        return err;
 }
-
-__ro_after_init DEFINE_STATIC_KEY_FALSE(init_mem_is_free);
-
-int patch_instruction(u32 *addr, ppc_inst_t instr)
-{
-       /* Make sure we aren't patching a freed init section */
-       if (static_branch_likely(&init_mem_is_free) && init_section_contains(addr, 4))
-               return 0;
-
-       return do_patch_instruction(addr, instr);
-}
 NOKPROBE_SYMBOL(patch_instruction);
 
 int patch_branch(u32 *addr, unsigned long target, int flags)
This page took 0.028032 seconds and 4 git commands to generate.