From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mx0a-0031df01.pphosted.com (mx0a-0031df01.pphosted.com [205.220.168.131]) (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 AC681846A for ; Tue, 18 Aug 2026 05:35:02 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=205.220.168.131 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1787031303; cv=none; b=eD0/4oueWbdFVDO5wEGwYd02kpuhNOxTmWTABm13O3Cb9QVYxmRUHK/EsuuqO2yvqNYe5Uo/jBsasnQfoxtqqYgiukWFG111pfryUCTFsMC3+d4pNV+vS0CalXm0XrNIvph3FUghmz1LlqRAVLsFIsLObKxLaJ3RsdT7zn0erSw= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1787031303; c=relaxed/simple; bh=937cBjiDkSVjUvXYFLJRnSxbQ1op4kLnG/ZQ4cZKCIw=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=lTzbG/4F7nqyJdQfDZ2BhEPNmxhp9ihjsQna3PZBRzo5i0vQ3MvC5vXChsrtnmrC0KQQIIpYhlJ1uKZivzaL/BoDOOCTkeLcT3qVRE3uXobFrGg/zqXc+RnwhRptX4haLWE7zzsEMF2ZzH0SACwgJPtVF8IgSSg/b6YIxfH9T/s= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=oss.qualcomm.com; spf=pass smtp.mailfrom=oss.qualcomm.com; dkim=pass (2048-bit key) header.d=qualcomm.com header.i=@qualcomm.com header.b=mke5dGlc; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b=JEnwii5v; arc=none smtp.client-ip=205.220.168.131 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=oss.qualcomm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=oss.qualcomm.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=qualcomm.com header.i=@qualcomm.com header.b="mke5dGlc"; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b="JEnwii5v" Received: from pps.filterd (m0279866.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 67I252Lr3602875 for ; Tue, 18 Aug 2026 05:35:02 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=qualcomm.com; h= cc:content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to; s=qcppdkim1; bh= y0SIHNHEr1GKYCbBglF4YzbkpCW6i3Jo/GjHjnWOyG8=; b=mke5dGlcJesHo5UO n1tomtdA4100WkAc9vaWTtfb/+lMrLFAYlCPl0bNhXrN3cZnBi9IBk5tG4z2OOKt +KJxWxn5TPwBo3miAsCX6xSFao/SMjdkD2cUDgeJvZcTgKEG/OnheED9X7uggTuU jrF7TG9jv75/50jfOnBJqnNgxwCZ0WGYhwHgJo4FGHZf2fvko15Yr7nk4//KLr9+ k6YkcLfkuipXX+uwBfTaG3i7veO+SPzGZ0xlv8SNV/NcyTZssY05KLiQ3qLtH62n UVGnRsIc7wO1JNTTalBT9XLeZR+9iH0g1G7nr7Kx5WQbR5kE4YLYbQFr/+hTmx7Y g8LU/Q== Received: from mail-pg1-f198.google.com (mail-pg1-f198.google.com [209.85.215.198]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 4g4ea2gtgy-1 (version=TLSv1.3 cipher=TLS_AES_128_GCM_SHA256 bits=128 verify=NOT) for ; Tue, 18 Aug 2026 05:35:01 +0000 (GMT) Received: by mail-pg1-f198.google.com with SMTP id 41be03b00d2f7-cb7d6ba548eso5402820a12.1 for ; Mon, 17 Aug 2026 22:35:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oss.qualcomm.com; s=google; t=1787031301; x=1787636101; darn=vger.kernel.org; h=content-transfer-encoding:content-type:in-reply-to:from :content-language:references:cc:to:subject:user-agent:mime-version :date:message-id:from:to:cc:subject:date:message-id:reply-to :content-type; bh=y0SIHNHEr1GKYCbBglF4YzbkpCW6i3Jo/GjHjnWOyG8=; b=JEnwii5vBv3dBSIzKrcRjawLBjOeX3gWHr+KOC3gWcsyjs7fyYGZ5ohx7+PhTP4Lza ZJTyNmIyh60ZPNDSa8bkJQmXOXyMerJgEIX/3zlBzdTRppieKbVngWkfkpqoDEE2PM8R p5Qoh9GnV72KWZuDQjCGj2V/r4ly9fgkxpVY33dLe69GuLS1MoQfctPPfZggODTIy0mr V1uzIwvpe9WsuxUdj2aFrN+WGeICTt09WV3JKCbfVoYPdTtZogiaahRwVET2SlqcJ1L1 wDgePUGqYNuXzlXoN0wyI9TMALK0nFqZ9FtO4Icoy42ssDwtia97/1MaAE9FK6JSu4Mo IBtg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1787031301; x=1787636101; h=content-transfer-encoding:content-type:in-reply-to:from :content-language:references:cc:to:subject:user-agent:mime-version :date:message-id:x-gm-gg:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to:content-type; bh=y0SIHNHEr1GKYCbBglF4YzbkpCW6i3Jo/GjHjnWOyG8=; b=nSrh7u1jjoXdV53PrGCx4aCkhvb8ykZpiFjSR850K/1ExftidDXclB2upGIu2kfiyI F5Id59i2R1wQq0pBANuxt9dieYDAJfwma38MhWtJoNJp1KaXxkszaIqWTK51QZU5HZOF n04N3EhD01QfN/61hejY4dzd0XIvOnqtGPdcns7OunHeq8sCpniFsnn4JOzKeBZ91IvR gJ9F/skGKoO407SBRV1Hwdq2LIc1PeJuU5VShchbM6hMP/QqBRoSGOrShybXeoZUAXUw rxOo6QqOotjWcKkDCAVRuhJ8+KTYE/s9MPsqa3uaiHe4KBTJ0Y3tJ5cqDyvohoHZznFj hqlg== X-Forwarded-Encrypted: i=1; AHgh+RrJwCwRewCeIcMgxiBgTpLYtC/gbOlm4Q+cQq9MuXH1GmhBEkBeW8uF/6xOWFXiDSlfQ8g/Wzu7zewElNc=@vger.kernel.org X-Gm-Message-State: AOJu0YzQI0nVkHu5hLO9THPaLW2G+MbqKN1tQuD5DwZ6KrxhOxEdWJrE ijMYhwqzKH5XeAuWZzZ/+K/HukXffz8dF+5CLsF0L7v43xnUmo/BT3lB1oC4sZqaI5t3hcQBR4W FGqxqV+bxJRpBy2zTJJhX/nTrahiNc12gebDgg4UDDIpI96kzb9TuTwp4XtnJGlHiU/k= X-Gm-Gg: AR+sD10ONH+LJBDRDe83kc26MkO0++Alqr3pRvBRpS8poQ5rALaYIrP0aWa8E1uHB2r iuHnoCYogAY+4fKMSHd+1RS14Gdzn7LqidgD60CA+tNExIKEvS2JNK3Wl/PWOtBmaqQ0VtfJF3L A0+F+CR47jClSaWr6BtbFr2Bke0EsJkO6L1s58Ui/+JoDjYZXgusotFr3Qk+lfXm+soz7+D+PiR gf1AWxm+0V5OaDVVY1LjYj1BempxWa1MinooXQT9/DLXfb5p4qeZP10G8xFa7WQLvQGxxEnpc2G S+b7FSBWEAtI/lDJZGdhiJ+c6EG4FS7wKgM0q+AsyaX7FPSxZAA76tiEFzecvX5IwaiRxqORbCO waJGXjrBHo1p7pISa5xak8UAcj4JyOvI= X-Received: by 2002:a05:6a21:6d8a:b0:3cb:8810:631d with SMTP id adf61e73a8af0-3ccda918cfcmr7367980637.1.1787031301395; Mon, 17 Aug 2026 22:35:01 -0700 (PDT) X-Received: by 2002:a05:6a21:6d8a:b0:3cb:8810:631d with SMTP id adf61e73a8af0-3ccda918cfcmr7367883637.1.1787031300761; Mon, 17 Aug 2026 22:35:00 -0700 (PDT) Received: from [10.218.14.97] ([202.46.22.19]) by smtp.gmail.com with ESMTPSA id 41be03b00d2f7-cc13c03320esm1572687a12.25.2026.08.17.22.34.57 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 17 Aug 2026 22:35:00 -0700 (PDT) Message-ID: Date: Tue, 18 Aug 2026 11:04:56 +0530 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH 2/2] spi: qcom-geni: Add panic notifier to suspend controller during panic To: Mark Brown Cc: konrad.dybcio@oss.qualcomm.com, mukesh.savaliya@oss.qualcomm.com, linux-arm-msm@vger.kernel.org, linux-spi@vger.kernel.org, linux-kernel@vger.kernel.org, chandana.chiluveru@oss.qualcomm.com References: <20260805-add-shutdown-and-panic-notifier-for-spi-v1-0-b5db170d491e@oss.qualcomm.com> <20260805-add-shutdown-and-panic-notifier-for-spi-v1-2-b5db170d491e@oss.qualcomm.com> <92fc6c7b-ea87-4577-b200-2bb36388f387@sirena.org.uk> Content-Language: en-US From: Praveen Talari In-Reply-To: <92fc6c7b-ea87-4577-b200-2bb36388f387@sirena.org.uk> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwODE4MDAzOSBTYWx0ZWRfXzKJhBC2pGLLB XmIlEZ62Yx36W3rvsGSVpTjuieFa7nlmPX1sNxFdwXFfTd1MoQ7rMINKn6he3jB0+H5PkaiSlD3 1p4EmFYJQ7/VX4SL+ubWobxVdo4XdxdEFvNp2sl3ZwZuQd5VkyUqxCYNHj5MsvcwYdgF0n3NDpi IlPgJ5iDYB4anJFa1rX2NuTU8M3L/Ll/jiMi9QKLYZkiMz/Mv6iuUB46Ck7/esn7iQyhr3v0NJG RHpY3EyuvDpeWkxbwD5Y3QP0GER+D+5i45m1qZ8wngx/+h7sUc09oql84jj8+a56DFE9SgOpCNH w2wUVoeuP2zcNYp/cVw2aUxvjV79pdjuh/lQYh8FMX/Tb1G/7MWMG+XlnUhxtUMZZqAIjWpqPA9 GkQAjHVf1Bw/Tt9E1KoOTEQpTwpLQF0p6IfsfW7WbvhZgffIIiJxwsGK/x4SUCcDsWh6bCNdoZf Ni6a5EY32JYtyyHFfrg== X-Proofpoint-Spam-Info: AW1haW4tMjYwODE4MDAzOSBTYWx0ZWRfX+xkzgQPE9KF0 CHL0D8WJ4k7T4+Qf9bGyUMh5MzYvhSLXVp6N2bnknH96E+/wnc7GgVV+33Og4rjEgljcgiAGgB/ YhXkQpJWNTdD4cXUSJFLN/i+CEz2dV8= X-Authority-Analysis: v=2.4 cv=XtfK/1F9 c=1 sm=1 tr=0 ts=6a83ef05 cx=c_pps a=Qgeoaf8Lrialg5Z894R3/Q==:117 a=fChuTYTh2wq5r3m49p7fHw==:17 a=IkcTkHD0fZMA:10 a=Sv0fKeRqtYgA:10 a=s4-Qcg_JpJYA:10 a=VkNPw1HP01LnGYTKEx00:22 a=u7WPNUs3qKkmUXheDGA7:22 a=YMgV9FUhrdKAYTUUvYB2:22 a=EIQud5khxiMJNvOwFl8A:9 a=QEXdDO2ut3YA:10 a=x9snwWr2DeNwDh03kgHS:22 X-Proofpoint-ORIG-GUID: ao9rKVG1s3MexqMBUilPEPz-KbSPor27 X-Proofpoint-GUID: ao9rKVG1s3MexqMBUilPEPz-KbSPor27 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1176,Hydra:6.1.134,FMLib:17.12.100.49 definitions=2026-08-17_04,2026-08-12_01,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 bulkscore=0 impostorscore=0 spamscore=0 lowpriorityscore=0 phishscore=0 clxscore=1015 suspectscore=0 malwarescore=0 adultscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2606150000 definitions=main-2608180039 Hi Mark, On 11-08-2026 20:06, Mark Brown wrote: > On Wed, Aug 05, 2026 at 04:12:10PM +0530, Praveen Talari wrote: >> When a VM crashes with an active SPI DMA transfer in progress, the >> SMMU raises context faults as the DMA engine continues to access >> IOVAs that are invalidated when the VM's memory context is torn down. >> These faults can affect other VMs sharing the same SMMU instance and >> obscure the root cause of the crash. >> +static int spi_geni_panic_notifier(struct notifier_block *nb, >> + unsigned long action, void *data) >> +{ >> + struct spi_geni_master *mas = container_of(nb, struct spi_geni_master, panic_nb); >> + struct spi_controller *spi = dev_get_drvdata(mas->dev); >> + >> + spi_controller_suspend(spi); > This will take locks - are you sure that's OK in a panic handler? Good point. I hadn't considered the locking requirements of spi_controller_suspend(). Looking at the implementation, it can take locks and is therefore not suitable for panic context. I'll rework this to avoid invoking the SPI core suspend path from the panic notifier and instead use a panic-safe mechanism that directly quiesces the controller without taking sleeping locks. > >> - return devm_spi_register_controller(dev, spi); >> + ret = devm_spi_register_controller(dev, spi); >> + if (ret) >> + return ret; >> + >> + mas->panic_nb.notifier_call = spi_geni_panic_notifier; >> + ret = atomic_notifier_chain_register(&panic_notifier_list, &mas->panic_nb); >> + if (ret) >> + return ret; >> + >> + return devm_add_action_or_reset(dev, spi_geni_unregister_notifiers, mas); > Should we have the notifier in place before registation, what happens if > we panic while probing a SPI device which is probing as a result of > registering the controller? You're right. There is a window between devm_spi_register_controller() and notifier registration where a panic could occur while a child SPI device is probing and issuing transfers. I'll move the notifier registration before controller registration so that panic handling is active before any client device can start using the controller. Thanks, Praveen Talari