The Linux Kernel Mailing List
 help / color / mirror / Atom feed
From: Ritesh Harjani (IBM) <ritesh.list@gmail.com>
To: Mike Rapoport <rppt@kernel.org>,
	"Christophe Leroy (CS GROUP)" <chleroy@kernel.org>
Cc: linuxppc-dev@lists.ozlabs.org,
	Madhavan Srinivasan <maddy@linux.ibm.com>,
	Venkat Rao Bagalkote <venkat88@linux.ibm.com>,
	linux-kernel@vger.kernel.org,
	Michael Ellerman <mpe@ellerman.id.au>,
	Nicholas Piggin <npiggin@gmail.com>,
	Shrikanth Hegde <sshegde@linux.ibm.com>,
	Hari Bathini <hbathini@linux.ibm.com>
Subject: Re: [PATCHv2 2/3] powerpc/execmem: Allocate kprobes insn pages from the modules area on book3s/32
Date: Tue, 17 Nov 2026 23:03:41 +0530	[thread overview]
Message-ID: <tslf747e.ritesh.list@gmail.com> (raw)
In-Reply-To: <avxhmaXa7lsQ86EA@kernel.org>

Mike Rapoport <rppt@kernel.org> writes:

> On Tue, Nov 17, 2026 at 03:04:49PM +0100, Christophe Leroy (CS GROUP) wrote:
>> Le 17/11/2026 à 13:33, Ritesh Harjani a écrit :
>> > Mike Rapoport <rppt@kernel.org> writes:
>> > 
>> > > > > > Hence, use the modules area for EXECMEM_KPROBES on book3s/32.
>> > > > > Right, I missed that on book3s/32 does vmalloc is not executable and its
>> > > > > protection can't be changed.
>> > > > > 
>> > > > > Could it be that 8xx also need a special treatment for kprobes?
>> > > > 
>> > > > Yes indeed, not for the same reasons but because 8xx ITLB-miss handler
>> > > > doesn't expect any instruction TLB miss on kernel addresses other than the
>> > > > ones from the module area:
>> > > > 
>> > > > Commit 4afb0be7ccda ("powerpc/8xx: Avoid testing for kernel space in ITLB
>> > > > Miss.")
>> > > > Commit 16a71c045186 ("powerpc/8xx: Preallocate execmem page tables")
>> > > > Commit 33c527522f39 ("powerpc/8xx: Inconditionally use task PGDIR in ITLB
>> > > > misses")
>> > 
>> > Right. I looked at the above series which added all of this support [1].
>> > So looks like 603 might also have this related problem (other than the
>> > per segment N bit issue), since it's iTLB miss handler only walks the
>> > task's PGDIR, unlike it's dTLB handler which falls back to reloading the
>> > missing kernel PGD entry from swapper_pg_dir. So what I meant to say is
>> > that, similar to 8xx, a new PGD entry created in the kernel's vmalloc
>> > area for an insn page does not get copied over after the task is
>> > created (/PGDIR allocated), on 603 as well.
>> > But since MODLUES_VADDR is defined for both BOOK3S/32 and 8xx, so I guess it
>> > gets covered by the same change anyways.
>> > 
>> > > > So at the end as MODULES_VADDR/MODULES_END only exist on book3s/32 and 8xx I
>> > > > think when they exist they should be used as follows:
>> > > > 
>> > > > diff --git a/arch/powerpc/mm/mem.c b/arch/powerpc/mm/mem.c
>> > > > index b617b69452cd..856f4609c488 100644
>> > > > --- a/arch/powerpc/mm/mem.c
>> > > > +++ b/arch/powerpc/mm/mem.c
>> > > > @@ -428,8 +428,13 @@ struct execmem_info __init *execmem_arch_setup(void)
>> > > >   				.fallback_end	= fallback_end,
>> > > >   			},
>> > > >   			[EXECMEM_KPROBES] = {
>> > > > +#ifdef MODULES_VADDR
>> > > > +				.start	= MODULES_VADDR,
>> > > > +				.end	= MODULES_END,
>> > > > +#else
>> > > >   				.start	= VMALLOC_START,
>> > > >   				.end	= VMALLOC_END,
>> > > > +#endif
>> > > 
>> > > We already have #ifdef MODULES_VADDR a few lines above, I think the
>> > > assignment of kprobes_start and kprobes_end could go there instead of if
>> > > (IS_ENABLED(CONFIG_PPC_BOOK3S_32)).
>> > > 
>> > 
>> > Right. So let me use the following diff then?
>> > 
>> > Please let me know if this diff looks good to you? If yes, then I can
>> > send a v3.
>> 
>> My preference would go to something similar to 'start' and 'end', no init at
>> declaration, kprobes_start and kprobes_end set to VMALLOC_START/VMALLOC_END
>> inside the #else

Sure.

>
> I agree, it's more consistent this way.
>  

Ok, then will go with the other approach.

>> > Also - it will be good to know if patch-1 and patch-3 looks ok too,
>> > before I spin a next revision?
>
> Both make sense to me, feel free to add my
>
> Acked-by: Mike Rapoport (Microsoft) <rppt@kernel.org>
>

Thanks Mike and Christophe. Will make the changes in v3 as discussed.

-ritesh

  reply	other threads:[~2026-11-17 17:36 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-13 12:31 [PATCHv2 0/3] powerpc: kprobes insn page fixes Ritesh Harjani (IBM)
2026-11-13 12:31 ` [PATCHv2 1/3] powerpc/execmem: Don't leave kprobes insn pages W+X when CONFIG_MODULES=n Ritesh Harjani (IBM)
2026-11-17 14:08   ` Christophe Leroy (CS GROUP)
2026-11-17 17:15     ` Ritesh Harjani
2026-11-13 12:31 ` [PATCHv2 2/3] powerpc/execmem: Allocate kprobes insn pages from the modules area on book3s/32 Ritesh Harjani (IBM)
2026-11-15  8:29   ` Mike Rapoport
2026-11-16 15:11     ` Christophe Leroy (CS GROUP)
2026-11-16 15:57       ` Mike Rapoport
2026-11-17 12:33         ` Ritesh Harjani
2026-11-17 14:04           ` Christophe Leroy (CS GROUP)
2026-11-17 14:15             ` Mike Rapoport
2026-11-17 17:33               ` Ritesh Harjani [this message]
2026-11-13 12:31 ` [PATCHv2 3/3] powerpc/ptdump: Show the exec flag of kernel mappings on e500 Ritesh Harjani (IBM)
2026-11-17 14:09   ` Christophe Leroy (CS GROUP)

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=tslf747e.ritesh.list@gmail.com \
    --to=ritesh.list@gmail.com \
    --cc=chleroy@kernel.org \
    --cc=hbathini@linux.ibm.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linuxppc-dev@lists.ozlabs.org \
    --cc=maddy@linux.ibm.com \
    --cc=mpe@ellerman.id.au \
    --cc=npiggin@gmail.com \
    --cc=rppt@kernel.org \
    --cc=sshegde@linux.ibm.com \
    --cc=venkat88@linux.ibm.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