public inbox for linuxppc-dev@ozlabs.org 
 help / color / mirror / Atom feed
From: Nicholas Piggin <npiggin@gmail•com>
To: linuxppc-dev@lists•ozlabs.org
Cc: Nicholas Piggin <npiggin@gmail•com>
Subject: [RFC PATCH 00/19] Remove STACK_FRAME_OVERHEAD
Date: Mon, 31 Oct 2022 15:54:21 +1000	[thread overview]
Message-ID: <20221031055440.3594315-1-npiggin@gmail.com> (raw)

This is some quick hacking, hardly tested but might have potential.

I think we're not validating the perf kernel stack walker bounds
quite correctly, and not setting up decent stack frames for the child
in copy_thread. So at least those two things we could do. Maybe
patch 1 should go upstream as a fix.

Thanks,
Nick

Nicholas Piggin (19):
  powerpc/perf: callchain validate kernel stack pointer bounds
  powerpc: Rearrange copy_thread child stack creation
  powerpc/64: Remove asm interrupt tracing call helpers
  powerpc/pseries: hvcall stack frame overhead
  powerpc/32: Use load and store multiple in GPR save/restore macros
  powerpc: simplify ppc_save_regs
  powerpc: add definition for pt_regs offset within an interrupt frame
  powerpc: add a definition for the marker offset within the interrupt
    frame
  powerpc: Rename STACK_FRAME_MARKER and derive it from frame offset
  powerpc: add a define for the user interrupt frame size
  powerpc: add a define for the switch frame size and regs offset
  powerpc: copy_thread fill in interrupt frame marker and back chain
  powerpc: copy_thread add a back chain to the switch stack frame
  powerpc: split validate_sp into two functions
  powerpc: allow minimum sized kernel stack frames
  powerpc/64: ELFv2 use minimal stack frames in int and switch frame
    sizes
  powerpc: remove STACK_FRAME_OVERHEAD
  powerpc: change stack marker memory operations to 32-bit
  powerpc/64: ELFv2 use reserved word in the stack frame for the regs
    marker

 arch/powerpc/include/asm/irqflags.h           | 29 -------
 arch/powerpc/include/asm/ppc_asm.h            | 18 +++-
 arch/powerpc/include/asm/processor.h          | 15 +++-
 arch/powerpc/include/asm/ptrace.h             | 41 +++++++---
 arch/powerpc/kernel/asm-offsets.c             |  9 +-
 arch/powerpc/kernel/entry_32.S                | 14 ++--
 arch/powerpc/kernel/exceptions-64e.S          | 44 +++++-----
 arch/powerpc/kernel/exceptions-64s.S          | 82 +++++++++----------
 arch/powerpc/kernel/head_32.h                 |  4 +-
 arch/powerpc/kernel/head_40x.S                |  2 +-
 arch/powerpc/kernel/head_44x.S                |  6 +-
 arch/powerpc/kernel/head_64.S                 |  6 +-
 arch/powerpc/kernel/head_85xx.S               |  8 +-
 arch/powerpc/kernel/head_8xx.S                |  2 +-
 arch/powerpc/kernel/head_book3s_32.S          |  4 +-
 arch/powerpc/kernel/head_booke.h              |  4 +-
 arch/powerpc/kernel/interrupt_64.S            | 32 ++++----
 arch/powerpc/kernel/irq.c                     |  4 +-
 arch/powerpc/kernel/kgdb.c                    |  2 +-
 arch/powerpc/kernel/misc_32.S                 |  2 +-
 arch/powerpc/kernel/misc_64.S                 |  4 +-
 arch/powerpc/kernel/optprobes_head.S          |  4 +-
 arch/powerpc/kernel/ppc_save_regs.S           | 58 ++++---------
 arch/powerpc/kernel/process.c                 | 54 +++++++-----
 arch/powerpc/kernel/smp.c                     |  2 +-
 arch/powerpc/kernel/stacktrace.c              | 10 +--
 arch/powerpc/kernel/tm.S                      |  8 +-
 arch/powerpc/kernel/trace/ftrace_mprofile.S   |  2 +-
 arch/powerpc/kvm/book3s_hv_rmhandlers.S       |  2 +-
 .../lib/test_emulate_step_exec_instr.S        |  2 +-
 arch/powerpc/perf/callchain.c                 |  9 +-
 arch/powerpc/platforms/pseries/hvCall.S       | 38 +++++----
 arch/powerpc/xmon/xmon.c                      | 10 +--
 33 files changed, 263 insertions(+), 268 deletions(-)

-- 
2.37.2


             reply	other threads:[~2022-10-31  5:56 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-10-31  5:54 Nicholas Piggin [this message]
2022-10-31  5:54 ` [RFC PATCH 01/19] powerpc/perf: callchain validate kernel stack pointer bounds Nicholas Piggin
2022-11-04 13:10   ` Segher Boessenkool
2022-10-31  5:54 ` [RFC PATCH 02/19] powerpc: Rearrange copy_thread child stack creation Nicholas Piggin
2022-10-31  5:54 ` [RFC PATCH 03/19] powerpc/64: Remove asm interrupt tracing call helpers Nicholas Piggin
2022-10-31  5:54 ` [RFC PATCH 04/19] powerpc/pseries: hvcall stack frame overhead Nicholas Piggin
2022-10-31  5:54 ` [RFC PATCH 05/19] powerpc/32: Use load and store multiple in GPR save/restore macros Nicholas Piggin
2022-11-03  8:26   ` Christophe Leroy
2022-11-07 12:45     ` Nicholas Piggin
2022-11-07 12:51       ` Christophe Leroy
2022-10-31  5:54 ` [RFC PATCH 06/19] powerpc: simplify ppc_save_regs Nicholas Piggin
2022-10-31  5:54 ` [RFC PATCH 07/19] powerpc: add definition for pt_regs offset within an interrupt frame Nicholas Piggin
2022-10-31  5:54 ` [RFC PATCH 08/19] powerpc: add a definition for the marker offset within the " Nicholas Piggin
2022-10-31  5:54 ` [RFC PATCH 09/19] powerpc: Rename STACK_FRAME_MARKER and derive it from frame offset Nicholas Piggin
2022-10-31  5:54 ` [RFC PATCH 10/19] powerpc: add a define for the user interrupt frame size Nicholas Piggin
2022-10-31  5:54 ` [RFC PATCH 11/19] powerpc: add a define for the switch frame size and regs offset Nicholas Piggin
2022-10-31  5:54 ` [RFC PATCH 12/19] powerpc: copy_thread fill in interrupt frame marker and back chain Nicholas Piggin
2022-10-31  5:54 ` [RFC PATCH 13/19] powerpc: copy_thread add a back chain to the switch stack frame Nicholas Piggin
2022-10-31  5:54 ` [RFC PATCH 14/19] powerpc: split validate_sp into two functions Nicholas Piggin
2022-11-07  0:58   ` Russell Currey
2022-11-07 12:29     ` Nicholas Piggin
2022-10-31  5:54 ` [RFC PATCH 15/19] powerpc: allow minimum sized kernel stack frames Nicholas Piggin
2022-10-31  5:54 ` [RFC PATCH 16/19] powerpc/64: ELFv2 use minimal stack frames in int and switch frame sizes Nicholas Piggin
2022-10-31  5:54 ` [RFC PATCH 17/19] powerpc: remove STACK_FRAME_OVERHEAD Nicholas Piggin
2022-10-31  5:54 ` [RFC PATCH 18/19] powerpc: change stack marker memory operations to 32-bit Nicholas Piggin
2022-10-31  5:54 ` [RFC PATCH 19/19] powerpc/64: ELFv2 use reserved word in the stack frame for the regs marker Nicholas Piggin

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=20221031055440.3594315-1-npiggin@gmail.com \
    --to=npiggin@gmail$(echo .)com \
    --cc=linuxppc-dev@lists$(echo .)ozlabs.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html
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