From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from MM0P280CU009.outbound.protection.outlook.com (mail-swedensouthazon11021093.outbound.protection.outlook.com [52.101.76.93]) (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 A22A45226B6; Thu, 15 Oct 2026 12:20:49 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=52.101.76.93 ARC-Seal:i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1792066853; cv=fail; b=VXCJFRNZcMInFwqND4p5lfHJkDwabHvUP0hu2gjDlFayK8T0Hz+qddFEeM77F+FSOayTN0LIDhCbeRYu0PG985dNr5/uitRgpZwQZbEhIrpG5PHf1lG/pwYXOh2UYap3ae/9/O60DyBHGB/NvNKt8+4Pz5QZtWMim4cBeH6DkJQ= ARC-Message-Signature:i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1792066853; c=relaxed/simple; bh=zJoajeNB/coEmKZpndXcc+WhEPhfz6meY1rpYD/F4QQ=; h=Message-ID:Date:Subject:To:Cc:References:From:In-Reply-To: Content-Type:MIME-Version; b=F93+7MfFfdutPRM96LQmG9vSX/8Gs5KMJgO7lTLxkTl+6AUukGsAR4D3TrHhcTScI7XfZ8t/lVqF0MKKJtD4Esel28hWAhBa4Pb+cSvCR0K27ttGY75RFlFZp+5Wk6Ubs2GjOqh2c8bjZNzAn4zBrLah5nA1K31gx5Coped2mBA= ARC-Authentication-Results:i=2; smtp.subspace.kernel.org; dmarc=permerror header.from=gaisler.com; spf=pass smtp.mailfrom=gaisler.com; dkim=pass (2048-bit key) header.d=gaisler.com header.i=@gaisler.com header.b=nHITlwiB; arc=fail smtp.client-ip=52.101.76.93 Authentication-Results: smtp.subspace.kernel.org; dmarc=permerror header.from=gaisler.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gaisler.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gaisler.com header.i=@gaisler.com header.b="nHITlwiB" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=b4W71kwppGfw0mcovE6OCSr76rCKFyWhOlCvydc/azT6358CHxcYS11/97ByHjVzglqpx/hTmJuBuuJAsBCwY276L83qrPoYMo64uowyQJgsI/mjE4+h+6/Tj2s3g4WdivdsvRMTgnynNejWdW2W+klQwU6NBvviYuepq0I92NkfmrKR6xh96HrlAfnJUARX2XifDMmBt5ZHED70Uem+KzANfHH7+bjx8nHKia46PxO/7gEB5Kenp4zEVgTstoB89zYzI1G2NPEjejSI5ffRxekE0TrIVvai2Bq5ku2RqchtEktjLZWsuJhptV3S/tFM+oE1GfOwhnOa96vzoqIAeg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=Tr6ODLC/fKRCh5KAtjjUbH2uAr1w/Pi+HPtKB7UnI98=; b=uxBKu+P3RkxRwApoYECMAFluE5XyoRia6hseIGpJ9JKoS6ogbUe3ZuhFO/9p7gc6aQVO7Nx6C8tJBfKnZt0Ok2DVA/SOPX1XytAFj4A+JVspvybGizbnT4Z3Fkc8nOgpzqJ6WvmQjVUB4Vr9rkNXVJ+StXOYJLPp54OBkP9SKVXyI8MybA6D26V1i8/wkULcb7i55Yrmpr04cuv9assh55Q+dnUQP8uV8RdsYfDyden0ljyiAfRvrwc/H1iN7xptgzXC9Ht97h8x99y9/2S2A62BrnXN2CUkfzC4rZZHNwHCaHggSsxB7dOUaPdhuLclD1Gbuypwqc89jeChBWkCqA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=gaisler.com; dmarc=pass action=none header.from=gaisler.com; dkim=pass header.d=gaisler.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gaisler.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=Tr6ODLC/fKRCh5KAtjjUbH2uAr1w/Pi+HPtKB7UnI98=; b=nHITlwiBIRueN48pRWN+nGJRZ3Kq7WDDp6jsW86r4r3gLNLQoV/fonRbDvyM03sXlizXZ3UKqZV+2AEKLXcfro+bNDzzC9KGzNydk3+Gs5M3rAaya7msu5e9YYZ27iHHRZt8agZ50/9rYQC83+ipjo5rUprYOqLsdselcpabvodXXNzfrSA5ID9jep3Qe+z5dq0FEbwyp6FfRYiUqhUIvNch/bbJtnWpvDlkQhCoqKTFHOl1D7BQLDaCx3kDuqahj+6mS0ogFK4ulB3TMQx56mJsGnv0EcUC+LMFVyXAWcrg1yA5vo77RiidD5t6n50MYH0+1KATUV9mEz2Zt2/uZg== Authentication-Results: mx.microsoft.com 1; dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=gaisler.com; Received: from MM0P280MB495062.SWEP280.PROD.OUTLOOK.COM (2603:10a6:190:2f::5) by GV3P280MB0129.SWEP280.PROD.OUTLOOK.COM (2603:10a6:150:14::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.21.522.14; Thu, 15 Oct 2026 12:20:44 +0000 Received: from MM0P280MB495062.SWEP280.PROD.OUTLOOK.COM ([fe80::1f13:f10:e16b:7939]) by MM0P280MB495062.SWEP280.PROD.OUTLOOK.COM ([fe80::1f13:f10:e16b:7939%4]) with mapi id 15.21.0472.016; Thu, 15 Oct 2026 12:20:44 +0000 Message-ID: Date: Thu, 15 Oct 2026 14:20:42 +0200 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH 1/4] sparc32: keep PIL raised until the IRQ frame is gone To: Ramin Moussavi , "David S. Miller" Cc: Thomas Gleixner , Peter Zijlstra , Arnd Bergmann , Guenter Roeck , sparclinux@vger.kernel.org, linux-kernel@vger.kernel.org References: <20261015085545.3246951-1-ramin.moussavi@yacoub.de> <20261015085545.3246951-2-ramin.moussavi@yacoub.de> Content-Language: en-US From: Andreas Larsson In-Reply-To: <20261015085545.3246951-2-ramin.moussavi@yacoub.de> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-ClientProxiedBy: BE1P281CA0181.DEUP281.PROD.OUTLOOK.COM (2603:10a6:b10:8d::16) To MM0P280MB495062.SWEP280.PROD.OUTLOOK.COM (2603:10a6:190:2f::5) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: MM0P280MB495062:EE_|GV3P280MB0129:EE_ X-MS-Office365-Filtering-Correlation-Id: 4f865288-4123-4e67-3006-08df2ab6bc6b X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|23010399003|366016|1800799024|376014|18002099003|10067099003|22082099003|3023799007|11063799006|261009223027099003|4143699003|56012099006; X-Microsoft-Antispam-Message-Info: LTPQe/k//KVDCScV2tN10PoBYyR2tRoeEsmgfs7DOXvmTeopBJbZh9xwmGOOiLP4R1NSLtSyDOLqlKn+EQdFZljHtN1QTrdvxVrdOFo/dUPCVhtdIxfXlDXswntNIrp5i0EgENRb7LJp+b4zSBXyDPl5tlGB1mX1qKJGLumsNGA7tJkR42OMJP4SzQWoFbj48HHBPr1oajCkOeLMhfGMIX4uopFE8kZoaDUU4MxHH+J24S6zkH6bn+JB37oRWbGuWW72fi+aFML/IdeXMumxmQKecRzA2iDN09UW/COWu7lQVQknudn+mDC5w8n6xv9rQtD7HLGHXQhZ+ZYt80Y4XguodLrLvCdEdwsyPMbdBDBoWDrPBv2zZPJdCgpUcY0l73X0rELItlP1NhF0VW1QcjdJsDS21qH7VYqnLkVlwUP/QFKT7ALwvVLMceG2xhwTZGWqM0GzqxaLHkMvvPtX+pksz32TlWrfC4OSuryr8ylfgs5jSL16T5XfklcQ8yISg71nt1bBAwvWz9ZUMN+pB2PKAyJsj7QIzrPpsj1opcy0qItVWKjEGL/FjWG8UKHOXFtJ/KNAVdiOtKeLWZhI2BnEpqu9TtRzqS89bnIqGMJc7ei2JNLZx/NNcXBs/5/j X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:MM0P280MB495062.SWEP280.PROD.OUTLOOK.COM;PTR:;CAT:NONE;SFS:(13230040)(23010399003)(366016)(1800799024)(376014)(18002099003)(10067099003)(22082099003)(3023799007)(11063799006)(261009223027099003)(4143699003)(56012099006);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?B?cG9ucjFJNXgxeXQ5TmNsNW1McEVrclJnb3hrVzRrbHJ1WUVKanhuRlNRVXVn?= =?utf-8?B?Vml1eEM1eER0Zk1zd2RMY0ZhMlpNTFRpNUZ4bUxHblh4T0YydTBSWmZyOHRO?= =?utf-8?B?SmFGdGgyMVlOaEZPd3JrbDM2amsrVTJMR0lIeHd2Sk9TZ3pnMDlwdjlTdjRJ?= =?utf-8?B?V2dLUWpYV0owTC9zQ2lmMWFJT2R1d28rbUtvWmlaanBUSG5ncHYrdWt4bVBH?= =?utf-8?B?REQybVpSb1J2cm82RVN5d1MwTkx2NndQSlMxSTE2QzFSODJWOUQwWTQxVFZr?= =?utf-8?B?RnZoRUJYMys4YlBMNUdVSUtOOS81V0tOdnRsVzBpdFZFSmVIN2RuRzYrTFcr?= =?utf-8?B?dnlLMVJhS1ZoaXY4RzlqUDUvWGZQREc4NHVHRUF0cjljQTVjZEJrU2pnT2dX?= =?utf-8?B?bm0rQnJ5Snk4U0FpNUh4SUFrdXVvcEVpZUJPSDNLanU3WUs0Z3hWTVEy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vZ25hUzN0R0J1WUhxM2wrRy8zNG1aTHRGVDBZS1N2SkdrOUpQVHFQRndX?= =?utf-8?B?NHpLMDZYOGpyWjlzNjdVbm1pRWRTbVF1M2kzdDFlZThzUSswMjNVOE1vWVp1?= =?utf-8?Q?M/hZMmFeq+2oT/ys=3D?= X-OriginatorOrg: gaisler.com X-MS-Exchange-CrossTenant-Network-Message-Id: 4f865288-4123-4e67-3006-08df2ab6bc6b X-MS-Exchange-CrossTenant-AuthSource: MM0P280MB495062.SWEP280.PROD.OUTLOOK.COM X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 15 Oct 2026 12:20:44.4655 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 91fa4a59-2167-458a-8318-e45d80469d7e X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: or/dewZk5Y8WwRMkCsWjVkUnlHyIoct2q4DNZf3gbd5SShXvwjIxhvJXamOx8lP6rhNYp2CgbvF3G7us9vcl0ABEI1fyIvHMCfdYC2qBuIM= X-MS-Exchange-Transport-CrossTenantHeadersStamped: GV3P280MB0129 On 2026-10-15 10:55, Ramin Moussavi wrote: > The per-cpu timer interrupts on sun4m and sun4d SMP, and the LEON SMP > IPI, leave their handler with > > wr %l0, PSR_ET, %psr > WRITE_PAUSE > RESTORE_ALL > > %l0 is the PSR at trap time, so this turns traps back on at the PIL of > the interrupted code, usually 0, while the trap frame is still on the > stack. Any interrupt that is pending at that point is taken on top of > the frame, and if it leaves through the same path it opens the same > window one level deeper. A source that keeps firing makes the nesting > unbounded: the kernel stack runs into its thread_info, w_saved and the > task pointer get overwritten, and the next window trap stores through > them with traps disabled. The CPU goes to error state. > > The generic path does not have this problem. real_irq_continue keeps > PIL at 15 after handler_irq and lets ret_trap_entry restore the old PIL > together with the rett. It was fixed that way in Linux 2.1.129 > (entry.S 1.153, November 1998): > > - wr %l0, PSR_ET, %psr > + or %l0, PSR_PIL, %g2 ! restore PIL after handler_irq > + wr %g2, PSR_ET, %psr ! keep ET up > > smp_ticker had been added in 2.1.36 with a copy of the old exit, and > kept it through the rename to smp4m_ticker and the addition of > smp4d_ticker in 2.1.97. smpleon_ipi copied the pattern in 2011. Do the > same as real_irq_continue in all three. > > On hardware the window is a few instructions long and no interrupt > source refills it that fast. qemu does: its ESCC finishes a transmit > instantly, and since 8.2 it takes a pending interrupt right after rett > (930f1865cc65 "target/sparc: Clear may_lookup for npc == DYNAMIC_PC"). > A burst of console output on an SS-20 with -smp 4 is enough. A trap > ring buffer in trap_setup showed the level 12 serial interrupt taken > over and over at smp4m_ticker+0x34, timer ticks nesting further down, > and the frames sinking below the thread_info. > > Tested on qemu 11.1.0, SS-20, -smp 4, with a test that writes a few > hundred lines to the serial console from a multithreaded process: the > kernel went to error state in 4 of 4 boots before, and booted cleanly > 8 of 8 times after. Two full runs of the uClibc-ng test suite on top > then completed without a crash. LEON SMP was tested on qemu's > leon3_generic with -smp 4, where a full run of the suite completed > without a crash as well. sun4d gets the same one line change but was > not run; qemu has no sun4d machine. > > Cc: stable@vger.kernel.org > Assisted-by: Claude:claude-opus-5-5 > Signed-off-by: Ramin Moussavi > --- > arch/sparc/kernel/entry.S | 9 ++++++--- > 1 file changed, 6 insertions(+), 3 deletions(-) > > diff --git a/arch/sparc/kernel/entry.S b/arch/sparc/kernel/entry.S > index ea51ef52c952..87d03a58446e 100644 > --- a/arch/sparc/kernel/entry.S > +++ b/arch/sparc/kernel/entry.S > @@ -252,7 +252,8 @@ smp4m_ticker: > WRITE_PAUSE > call smp4m_percpu_timer_interrupt > add %sp, STACKFRAME_SZ, %o0 > - wr %l0, PSR_ET, %psr > + or %l0, PSR_PIL, %g2 ! keep PIL up until the frame is gone > + wr %g2, PSR_ET, %psr > WRITE_PAUSE > RESTORE_ALL > > @@ -353,7 +354,8 @@ smp4d_ticker: > WRITE_PAUSE > call smp4d_percpu_timer_interrupt > add %sp, STACKFRAME_SZ, %o0 > - wr %l0, PSR_ET, %psr > + or %l0, PSR_PIL, %g2 ! keep PIL up until the frame is gone > + wr %g2, PSR_ET, %psr > WRITE_PAUSE > RESTORE_ALL > > @@ -407,7 +409,8 @@ smpleon_ipi: > WRITE_PAUSE > call leonsmp_ipi_interrupt > add %sp, STACKFRAME_SZ, %o1 ! pt_regs > - wr %l0, PSR_ET, %psr > + or %l0, PSR_PIL, %g2 ! keep PIL up until the frame is gone > + wr %g2, PSR_ET, %psr > WRITE_PAUSE > RESTORE_ALL > > > base-commit: d419d682257d813f6cb7a28e42b35d0edf4ad038 Hi Ramin, Thanks for the patch! This patch however has the exact same change as https://lore.kernel.org/sparclinux/20260927005658.8242-1-kaloz@kernel.org/#r that is not yet picked up but not forgotten. Could you add a Tested-by: in that thread instead and describe on what you have tested there. Feel free to link to this thread as a lore link in your answer as your two writeups complement each other nicely. Thanks, Andreas