linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
From: Benjamin Gray <bgray@linux.ibm.com>
To: linuxppc-dev@lists.ozlabs.org
Cc: ajd@linux.ibm.com, jniethe5@gmail.com,
	Benjamin Gray <bgray@linux.ibm.com>,
	npiggin@gmail.com, cmr@bluescreens.de
Subject: [PATCH v8 6/6] powerpc/code-patching: Use CPU local patch address directly
Date: Fri, 21 Oct 2022 16:22:38 +1100	[thread overview]
Message-ID: <20221021052238.580986-7-bgray@linux.ibm.com> (raw)
In-Reply-To: <20221021052238.580986-1-bgray@linux.ibm.com>

With the isolated mm context support, there is a CPU local variable that
can hold the patch address. Use it instead of adding a level of
indirection through the text_poke_area vm_struct.

Signed-off-by: Benjamin Gray <bgray@linux.ibm.com>
---
 arch/powerpc/lib/code-patching.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/arch/powerpc/lib/code-patching.c b/arch/powerpc/lib/code-patching.c
index eabdd74a26c0..ce58c1b3fcf1 100644
--- a/arch/powerpc/lib/code-patching.c
+++ b/arch/powerpc/lib/code-patching.c
@@ -122,6 +122,7 @@ static int text_area_cpu_up(unsigned int cpu)
 	unmap_patch_area(addr);
 
 	this_cpu_write(text_poke_area, area);
+	this_cpu_write(cpu_patching_addr, addr);
 
 	return 0;
 }
@@ -365,7 +366,7 @@ static int __do_patch_instruction(u32 *addr, ppc_inst_t instr)
 	pte_t *pte;
 	unsigned long pfn = get_patch_pfn(addr);
 
-	text_poke_addr = (unsigned long)__this_cpu_read(text_poke_area)->addr & PAGE_MASK;
+	text_poke_addr = (unsigned long)__this_cpu_read(cpu_patching_addr) & PAGE_MASK;
 	patch_addr = (u32 *)(text_poke_addr + offset_in_page(addr));
 
 	pte = virt_to_kpte(text_poke_addr);
-- 
2.37.3


      parent reply	other threads:[~2022-10-21  5:30 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-10-21  5:22 [PATCH v8 0/6] Use per-CPU temporary mappings for patching Benjamin Gray
2022-10-21  5:22 ` [PATCH v8 1/6] powerpc: Allow clearing and restoring registers independent of saved breakpoint state Benjamin Gray
2022-10-24  3:06   ` Russell Currey
2022-10-21  5:22 ` [PATCH v8 2/6] powerpc/code-patching: Use WARN_ON and fix check in poking_init Benjamin Gray
2022-10-24  3:08   ` Russell Currey
2022-10-21  5:22 ` [PATCH v8 3/6] powerpc/code-patching: Verify instruction patch succeeded Benjamin Gray
2022-10-24  3:20   ` Russell Currey
2022-10-25  3:30     ` Benjamin Gray
2022-10-21  5:22 ` [PATCH v8 4/6] powerpc/tlb: Add local flush for page given mm_struct and psize Benjamin Gray
2022-10-24  3:30   ` Russell Currey
2022-10-24  5:22     ` Benjamin Gray
2022-10-24  4:22   ` Russell Currey
2022-10-21  5:22 ` [PATCH v8 5/6] powerpc/code-patching: Use temporary mm for Radix MMU Benjamin Gray
2022-10-24  3:45   ` Russell Currey
2022-10-24  5:17     ` Benjamin Gray
2022-10-24 15:39       ` Christopher M. Riedl
2022-10-24  8:46   ` kernel test robot
2022-10-21  5:22 ` Benjamin Gray [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20221021052238.580986-7-bgray@linux.ibm.com \
    --to=bgray@linux.ibm.com \
    --cc=ajd@linux.ibm.com \
    --cc=cmr@bluescreens.de \
    --cc=jniethe5@gmail.com \
    --cc=linuxppc-dev@lists.ozlabs.org \
    --cc=npiggin@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).