Skip to content

powerpc/xive: remove __GFP_NOFAIL and fix IPI error handling

Gou Hao linuxppc-dev lkml 1 version Applied

Status from this message: Applied to powerpc/next.

Get series with b4
b4 am [email protected]

Versions newest first

  1. v3 Latest5 patches 10 repliesApplied

Changes in v3 from the cover letter

- Split into a separate xive-only series; the drm, test_hmm
and cxgb4 patches are unchanged since v1 and will no longer be updated here.
- Rework the first patch: instead of simply removing the unreachable NULL check, remove __GFP_NOFAIL from the IPI allocation and make all xive_ipis access paths NULL-safe (suggested by Andrew Morton [1] and Cédric Le Goater).
- Add a patch to defer setting cause_ipi until IPI init succeeds, so that smp_muxed_ipi_message_pass() does not call into a half-initialized IPI path.
- Add a defensive NULL guard for cause_ipi in smp_muxed_ipi_message_pass() as a safety net.

[1] https://lore.kernel.org/all/[email protected]/

Patches in v3 Applied

#Subject and filesSizeRepliesApplied
1/5powerpc/xive: make xive IPI allocation NULL-safearch/powerpc/sysdev/xive/common.c+10 -23 replies
2/5powerpc/xive: add error return value to xive_smp_probe()arch/powerpc/include/asm/xive.h arch/powerpc/sysdev/xive/common.c+5 -31 reply
3/5powerpc/xive: propagate IPI init errors to prevent use-after-freearch/powerpc/platforms/powernv/smp.c arch/powerpc/platforms/pseries/smp.c arch/powerpc/sysdev/xive/common.c+16 -104 replies
4/5powerpc/xive: defer setting cause_ipi until IPI init succeedsarch/powerpc/sysdev/xive/common.c+7 -31 reply
5/5powerpc/smp: add NULL guard for cause_ipi in smp_muxed_ipi_message_passarch/powerpc/kernel/smp.c+3 -00 replies

Reviews trailers per patch

All 5 patches have a Reviewed-by or Acked-by.

PatchWentao GuanjiazhenyuanMukesh Kumar Chaurasiya (IBM)Cédric Le GoaterAndrew Morton
1/5R-b R-b R-b R-b R-b
2/5R-b R-b R-b
3/5R-b R-b R-b
4/5R-b R-b
5/5R-b

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes. Scroll the table sideways for all 5 reviewers.

Read the v3 thread

Cover letter [PATCH v3 0/5] powerpc/xive: remove __GFP_NOFAIL and fix IPI error handling

Changes in v3:
- Split into a separate xive-only series; the drm, test_hmm
and cxgb4 patches are unchanged since v1 and will no longer be updated here.
- Rework the first patch: instead of simply removing the unreachable NULL check, remove __GFP_NOFAIL from the IPI allocation and make all xive_ipis access paths NULL-safe (suggested by Andrew Morton [1] and Cédric Le Goater).
- Add a patch to defer setting cause_ipi until IPI init succeeds, so that smp_muxed_ipi_message_pass() does not call into a half-initialized IPI path.
- Add a defensive NULL guard for cause_ipi in smp_muxed_ipi_message_pass() as a safety net.

[1] https://lore.kernel.org/all/[email protected]/

Changes in v2:
- Remove the now-unused out_free_domain error label in the xive patch after deleting the unreachable NULL check goto.
- Fix a use-after-free of xive_ipis: when xive_init_ipis() fails, the error path frees xive_ipis but xive_smp_probe() ignores the error and proceeds to dereference it in xive_setup_cpu_ipi(). Propagate the error return through xive_smp_probe() and check it in both pnv_smp_probe() and pSeries_smp_probe().

This is a code cleanup series that removes unreachable NULL checks (and associated error handling) that follow allocations using __GFP_NOFAIL, which guarantees non-NULL return.

v2: https://lore.kernel.org/all/[email protected]/
v1: https://lore.kernel.org/all/[email protected]/

Gou Hao (5):
powerpc/xive: make xive IPI allocation NULL-safe powerpc/xive: add error return value to xive_smp_probe() powerpc/xive: propagate IPI init errors to prevent use-after-free powerpc/xive: defer setting cause_ipi until IPI init succeeds powerpc/smp: add NULL guard for cause_ipi in
smp_muxed_ipi_message_pass

 arch/powerpc/include/asm/xive.h      |  4 ++--
 arch/powerpc/kernel/smp.c            |  3 +++
 arch/powerpc/platforms/powernv/smp.c |  8 +++++---
 arch/powerpc/platforms/pseries/smp.c |  8 +++++---
 arch/powerpc/sysdev/xive/common.c    | 28 ++++++++++++++++----------
 5 files changed, 37 insertions(+), 14 deletions(-)
Signature · 1 line
2.20.1