From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtpbgjp3.qq.com (smtpbgjp3.qq.com [54.92.39.34]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 42898224AF9 for ; Tue, 28 Jul 2026 10:27:32 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=54.92.39.34 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1785234458; cv=none; b=Xo2S5cy0MqBKBCEVzGERb3BRhLWNYi2AmV7nMldLcMB8sJ7DkIvMA/bg8WbuCl2aBzCJqTbo9PlXGCQ+gxEAKaNb1eyMa8vfSQudUIRfiiLZ2UMuOkCW6d78U+vi03FaQ7OH37h79EW4ZkZ83vNW3SNY7A3aBbs7ioeebTxsskQ= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1785234458; c=relaxed/simple; bh=jCseH3OxT/xVWDeXuqLM7MSZvsN7LNN2MEZdem9vtkc=; h=Message-ID:Date:MIME-Version:From:Subject:To:Cc:References: In-Reply-To:Content-Type; b=AYhNxMJlntIqOdGVLVs+YU/YMQghYAFk3AQVyhJM2TpAxRdw6x1kEgKBaIM4dD5Ofhwv+Y2+KpgT2NO93uUUMWpHO7BAPT5CEc2tO7fSm149xPEQx5uUbKisto4oAn2FWe/0F+EN6tX9MY2IbyOgbaauIcQIUV3uCsd+pi9NnCI= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=uniontech.com; spf=pass smtp.mailfrom=uniontech.com; dkim=pass (1024-bit key) header.d=uniontech.com header.i=@uniontech.com header.b=Skt06Vcy; arc=none smtp.client-ip=54.92.39.34 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=uniontech.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=uniontech.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=uniontech.com header.i=@uniontech.com header.b="Skt06Vcy" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=uniontech.com; s=onoh2408; t=1785234391; bh=Nn5iXoDHWX0JycAQsqyniXS6ZiZ/OL8fjnqaXvlqjt0=; h=Message-ID:Date:MIME-Version:From:Subject:To; b=Skt06VcySkyBaEF9OkJj+s5kweOM6///wL3vZBD8CWwLEsIdDEgw9mZEk02yM2oSa 1CYgkOh23VeCiNf9UTqQx6Ec3kxT1gOKDY/PqFfqkHdb3syGOS6xvOX8abps5mvCSn hJSUwAVdctg7S2Wb2ayBgMeP58/b7WdcPHpHqve8= X-QQ-mid: zesmtpip3t1785234378tca297b40 X-QQ-Originating-IP: g4bzO+VJYaDrFblWxIDwwXHmdZRxgSRd54k3FCR/s9A= Received: from [IPV6:240e:659:1b0:640::113:101 ( [localhost]) by bizesmtp.qq.com (ESMTP) with id ; Tue, 28 Jul 2026 18:26:15 +0800 (CST) X-QQ-SSF: 0000000000000000000000000000000 X-QQ-GoodBg: 1 X-BIZMAIL-ID: 8346751080323943646 EX-QQ-RecipientCnt: 21 Message-ID: <8227D7D48CF8EC74+17606f64-1639-49b1-8335-8dab2eba01e7@uniontech.com> Date: Tue, 28 Jul 2026 18:26:15 +0800 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird From: Gou Hao Subject: Re: [PATCH v3 3/5] powerpc/xive: propagate IPI init errors to prevent use-after-free Reply-To: amgYWAAGZ61VTXDc@linux.ibm.com To: Srikar Dronamraju 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 References: <20260727104215.184786-1-gouhao@uniontech.com> <20260727104215.184786-4-gouhao@uniontech.com> In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-QQ-SENDSIZE: 520 Feedback-ID: zesmtpip:uniontech.com:qybglogicsvrgz:qybglogicsvrgz5b-2 X-QQ-XMAILINFO: NSEFX6u+4l+Kia/+DCTIcAJpA3Ax5uz7JLP0ArzXdoECNhvKyu4Qh68W WiDfngJqN1dtjA7zHlvUcNjIinXoBf+yOTOjEO0HBg/DlyjuMjcbXAV2G+WXvMjcXBY+Bjw IcggKvaAMoUJb3Pl3bHtkwAiqHoa7nEVrbtNC/nnuI6YnvlYE+nquODY7dEE5fwZ4eH32K8 9LrU0wipjHVTn6oZBaPsbMbPHDBfbaBCsLw8boF6GW4t5uYXZE12CbAazURRUCCpWOedtYe xacr+dwfwZo+W8NnMdHbDSm+uc+J2l127NT1RHNgvyshs0mMoN0tASlpiYM3iEg1NKbnsjv 8OO9s+P5A8sUipzZ4iU3LMfkFa/aN1th9Dvn3s8m7JHbRb+Qe6U6pzmEyyfCWRp9qcXyr4A D7sZrOq3pkGMpInYwASR2/53GKdPDCshX1LBdzOz8qHm0Us+9/ci+mKHYmKZiPaO/2tuUNG OCJ57JBmxeJACnYz6YaAovGGHhZpjO9T9+Dfre1uxuAY/uYc7uFIw+MEEzFEtjmXUvp+lx+ 2fdUbiqB8uO/kdXS+zhpNEsM81zk0+0acqGgELcPHZJHN1oXXSD+amBotbDr3sGHnOKOSKe H8FzKLol7tjhUCT7VdmixKWktl/W42Ecgmp5PAp610G9s6E6cGfaj4zroWjIhKa42nwu/TJ jSS+b26WCad3qylY49LdACU1p4lYBWywpBE77wviPYztQv26cnV41SDukfZUw179BuhRcl1 DAMv+BIO7ItnjmkL7SrvlTXbLraUMzOpCgKsYbzqF3i/tk44VMd9ocvCyvqMTKwQfrU3954 EXVanM4e3mE1N36O8ZUwcR6hyf+mQbxV/sqENm6hpccfiGAPoTezaYHKoDiyTeAGeCklFPx iKsNtIrDujKpl0MHjZ/FYc7j4UJB7qT2pdicC6ukC+4dA1GRIqqHS/TFnKTSLSzk1UaqkRa +Fy1uLxwoF+8qxMM9L/QCa1j2eneAKHrBKbnhzyYyF35pLt1Q3lWiqHfPBOLWAEXIoKrioM 92EOMr6FvKlmGhLaJT4Bx4CHGjKrM= X-QQ-XMRINFO: M/715EihBoGS47X28/vv4NpnfpeBLnr4Qg== X-QQ-RECHKSPAM: 0 On 7/28/26 10:47, Srikar Dronamraju wrote: > * Gou Hao [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