mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Gou Hao <gouhao@uniontech.com>
To: Srikar Dronamraju <srikar@linux.ibm.com>
Cc: maddy@linux.ibm.com, mpe@ellerman.id.au, npiggin@gmail.com,
	chleroy@kernel.org, namcao@linutronix.de, peterz@infradead.org,
	sshegde@linux.ibm.com, kees@kernel.org,
	lgs201920130244@gmail.com, ynorov@nvidia.com,
	nilay@linux.ibm.com, clg@kaod.org, benh@kernel.crashing.org,
	miltonm@bga.com, mkchauras@gmail.com, akpm@linux-foundation.org,
	linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org,
	gouhaojake@163.com, kernel@uniontech.com
Subject: Re: [PATCH v3 3/5] powerpc/xive: propagate IPI init errors to prevent use-after-free
Date: Tue, 28 Jul 2026 18:26:15 +0800	[thread overview]
Message-ID: <8227D7D48CF8EC74+17606f64-1639-49b1-8335-8dab2eba01e7@uniontech.com> (raw)
In-Reply-To: <amgYWAAGZ61VTXDc@linux.ibm.com>

On 7/28/26 10:47, Srikar Dronamraju wrote:
> * Gou Hao <gouhao@uniontech.com> [2026-07-27 18:42:13]:
> 
>>   
>>   static void __init pnv_smp_probe(void)
>>   {
>> -	if (xive_enabled())
>> -		xive_smp_probe();
>> -	else
>> +	if (xive_enabled()) {
>> +		if (xive_smp_probe() < 0)
>> +			return;
>> +	} else {
> 
> If xive_smp_probe() fails and we return from here, what is the IPI mechanism
> that is going to be used?
> 
> Before the patch, we were not configured for IPI and we would fail.
> Now we have not configured IPI mechanism, so what are the consequences?
> 
Thank you for your review.

current approach: If xive_smp_probe() fails, smp_ops->cause_ipi remains 
NULL (patch 0004 defers the assignment). The IPI path 
(smp_muxed_ipi_message_pass) has a NULL check that silently drops the 
IPI. This means SMP won't function, but that's preferable to the current 
use-after-free crash.

> Should we try disable xive_enabled() and try xics_smp_probe() instead?
> 

When xive_enabled() is true, the entire interrupt subsystem has already 
been committed to XIVE in xive_init_host(). XICS fallback may need more 
than just disabling xive_enabled() and calling xics_smp_probe().

Full XIVE → XICS fallback is theoretically possible — the kexec path 
already demonstrates this (e.g., xive_shutdown() on PowerNV calls 
opal_xive_reset(OPAL_XIVE_MODE_EMU), and pSeries has H_INT_RESET). After 
reverting XIVE, one could call xics_init() + xics_smp_probe() to set up 
XICS completely.

Implementing a safe, complete fallback would require careful sequencing 
and likely an xive_exit() counterpart — this is a significantly larger 
change that is beyond the scope of this series, which focuses on 
removing __GFP_NOFAIL and fixing the use-after-free.

-- 
Thanks,
Gou Hao



  reply	other threads:[~2026-07-28 10:27 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-27 10:42 [PATCH v3 0/5] powerpc/xive: remove __GFP_NOFAIL and fix IPI error handling Gou Hao
2026-07-27 10:42 ` [PATCH v3 1/5] powerpc/xive: make xive IPI allocation NULL-safe Gou Hao
2026-07-30 13:53   ` Shrikanth Hegde
2026-07-30 14:06     ` Cédric Le Goater
2026-07-30 17:50       ` Shrikanth Hegde
2026-07-27 10:42 ` [PATCH v3 2/5] powerpc/xive: add error return value to xive_smp_probe() Gou Hao
2026-07-29 17:33   ` Cédric Le Goater
2026-07-27 10:42 ` [PATCH v3 3/5] powerpc/xive: propagate IPI init errors to prevent use-after-free Gou Hao
2026-07-28  2:47   ` Srikar Dronamraju
2026-07-28 10:26     ` Gou Hao [this message]
2026-07-29 17:37     ` Cédric Le Goater
2026-07-29 17:34   ` Cédric Le Goater
2026-07-27 10:42 ` [PATCH v3 4/5] powerpc/xive: defer setting cause_ipi until IPI init succeeds Gou Hao
2026-07-29 17:34   ` Cédric Le Goater
2026-07-27 10:42 ` [PATCH v3 5/5] powerpc/smp: add NULL guard for cause_ipi in smp_muxed_ipi_message_pass Gou Hao
2026-08-06  4:16 ` [PATCH v3 0/5] powerpc/xive: remove __GFP_NOFAIL and fix IPI error handling Madhavan Srinivasan

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=8227D7D48CF8EC74+17606f64-1639-49b1-8335-8dab2eba01e7@uniontech.com \
    --to=gouhao@uniontech.com \
    --cc=akpm@linux-foundation.org \
    --cc=amgYWAAGZ61VTXDc@linux.ibm.com \
    --cc=benh@kernel.crashing.org \
    --cc=chleroy@kernel.org \
    --cc=clg@kaod.org \
    --cc=gouhaojake@163.com \
    --cc=kees@kernel.org \
    --cc=kernel@uniontech.com \
    --cc=lgs201920130244@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linuxppc-dev@lists.ozlabs.org \
    --cc=maddy@linux.ibm.com \
    --cc=miltonm@bga.com \
    --cc=mkchauras@gmail.com \
    --cc=mpe@ellerman.id.au \
    --cc=namcao@linutronix.de \
    --cc=nilay@linux.ibm.com \
    --cc=npiggin@gmail.com \
    --cc=peterz@infradead.org \
    --cc=srikar@linux.ibm.com \
    --cc=sshegde@linux.ibm.com \
    --cc=ynorov@nvidia.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

all inboxes | Powered by JetHome®