From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from CWXP265CU009.outbound.protection.outlook.com (mail-ukwestazon11021137.outbound.protection.outlook.com [52.101.100.137]) (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 B1291436351; Tue, 16 Jun 2026 10:57:07 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=52.101.100.137 ARC-Seal:i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1781607430; cv=fail; b=MW66MeTsd3/7zgW5AtR/UEzFORN7o0/WVvDlP/wBSzwn5/cJOlv7O7sPfdYLI4PEI9PbfPnWFZoldOa6gsA90ilcibMPZHpbOeTKYa6XLKS6dxzkiRTs8a9hhVYqB42MkjDogJm16wGcfxCBX5p+aSECVA/RSRdZ3BkzgdabkRQ= ARC-Message-Signature:i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1781607430; c=relaxed/simple; bh=leX/JBsAxDWnxf/YtboSlDx8uEVsrjxqm206Cmht8GM=; h=Content-Type:Date:Message-Id:Cc:Subject:From:To:References: In-Reply-To:MIME-Version; b=nmHp0x+p+NZ2E6sXFXTKjUIGRP7snWNlgpRY3lNB3ulJxjx43I8FVSS+0xO2qMcsbHhTjpo0b/OSs/aMtXc/DYRItTsDxBPX87ITz96Dlm9f7fVcyPYeIEkmhUfIU3yfEAtdyFFmkS41MaxbKPr39GNOoLNFApFS8sxzl5oNhW4= ARC-Authentication-Results:i=2; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=garyguo.net; spf=pass smtp.mailfrom=garyguo.net; dkim=pass (1024-bit key) header.d=garyguo.net header.i=@garyguo.net header.b=aUJi/HMD; arc=fail smtp.client-ip=52.101.100.137 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=garyguo.net Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=garyguo.net Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=garyguo.net header.i=@garyguo.net header.b="aUJi/HMD" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=Mph81yW6pgwb4LmmEjA2cE+97BIn4IOcQipXFjvjfG8ZrT99n0GSlI8/lXSmAAokjYlMQtGC9+lvSmaejjcW3J3pWxiTv3veFoJDirpGP3g77vbUtQgNdX5GvXErACDd9sqagLvvP0aA31hRRzrJF95spc6qKYVSmI92h4PDbWbryfQ/wYgne2hAc7ilHLJcQOngAMdkzhPWzQkPIf99MsQ+SfupOtxbDwGwChgjNsPkenUaZWlBaTp/8qf8PBUE8CNdQzGjBDESmOr3E6tVF8VI9Or1jXgEKMXwz4l/i/4KYtI76CHr1BazexeQN2zEuuJ8P/UgL3jYRQyqqa3+jg== 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=CwkCDzs/2lwsDwnr9e1IaDRn+tv6H0VSQnT0bdMlQUk=; b=DaKWA3ga+9+N0Ml5TkVxs64gb+qs5+aRNfLpcy4HtFB7J/0xuxTxj1k5iniBGEpCT4La4+TTfEuoksdCe4HyxEYmlJaP6NBowJcdiIfRP7jz+TROhzwcK32aO6BOLCwxn8TMb8wqEuX56VRhNTrrRWqcF00F9C+pezUS+ZZdzpLn5SvaGD91WB+AEPeJKfOI2XyTkIg36w/EeSLAPX8o+ksSceQA+Zaj9cXVDptWRhSHMbtijT4wIwktjtK5yW2GVK6wbTxnml81ZxmU/oF8L09NiJjCZNfJ8egTqbdrpfKA8Xqd3b0iOOlt0v7k7zHIHesUS7IBDIN+ISu2JHTLmw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=garyguo.net; dmarc=pass action=none header.from=garyguo.net; dkim=pass header.d=garyguo.net; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=garyguo.net; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=CwkCDzs/2lwsDwnr9e1IaDRn+tv6H0VSQnT0bdMlQUk=; b=aUJi/HMDM6w28yvYpLSOcIU6bkm2tLdRdLfKTyUGG/sDhTO6o9JNxNGY/d4TwYIPiefspCEPrbKqb1E9KAIzk17ntmRCOO9HuBty8XkZ2MC+NQnSZqQOHNq0banLylBIEIYq8ApApGSJI1xjRCYDRqK99dXmw3+Tu+rNsJ1Xv+s= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=garyguo.net; Received: from LOVP265MB8871.GBRP265.PROD.OUTLOOK.COM (2603:10a6:600:488::16) by LO4P265MB6965.GBRP265.PROD.OUTLOOK.COM (2603:10a6:600:34e::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.21.113.18; Tue, 16 Jun 2026 10:57:04 +0000 Received: from LOVP265MB8871.GBRP265.PROD.OUTLOOK.COM ([fe80::1c3:ceba:21b4:9986]) by LOVP265MB8871.GBRP265.PROD.OUTLOOK.COM ([fe80::1c3:ceba:21b4:9986%4]) with mapi id 15.21.0113.015; Tue, 16 Jun 2026 10:57:03 +0000 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=UTF-8 Date: Tue, 16 Jun 2026 11:57:03 +0100 Message-Id: Cc: "Eliot Courtney" , "Danilo Krummrich" , "Alexandre Courbot" , "Alice Ryhl" , "David Airlie" , "Simona Vetter" , "Benno Lossin" , "John Hubbard" , "Timur Tabi" , , , , Subject: Re: [PATCH 02/13] gpu: nova-core: fsp: catch bogus queue pointer issues From: "Gary Guo" To: "Alistair Popple" , "Gary Guo" X-Mailer: aerc 0.21.0 References: <20260615-blackwell-fixes-v1-0-f2853e49ff7d@nvidia.com> <20260615-blackwell-fixes-v1-2-f2853e49ff7d@nvidia.com> In-Reply-To: X-ClientProxiedBy: LO4P123CA0389.GBRP123.PROD.OUTLOOK.COM (2603:10a6:600:18f::16) To LOVP265MB8871.GBRP265.PROD.OUTLOOK.COM (2603:10a6:600:488::16) 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: LOVP265MB8871:EE_|LO4P265MB6965:EE_ X-MS-Office365-Filtering-Correlation-Id: 1ddaccdf-e5cf-419a-18ff-08decb95ffd6 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|23010399003|376014|7416014|10070799003|1800799024|366016|6133799003|56012099006|4143699003|22082099003|18002099003; X-Microsoft-Antispam-Message-Info: erZOqNH6EMcwq9GJOFkzUHVgmGwntmZZeKyc3TpfASJcvolaypG//21dHkhfOL3gHFzr36ZxhRJX+mOVUPx+gdzPNyiHpVUwM5vIvD7hJzMoQsaW5OPlTpFsDH1gpdyWZCTfMnPB4EBIQPCDZ07e1iEu2t9HyL+y7fa1YRrdPyTJuHam7rhI9+VKpjHanAzRlAzjxCGrF4FHst18jN9wUohuqVUoSqq7f/VaWo27sf8CpmFnmTPZ5mWuFnBh4GSLOmAFdW2LsH85gNvZ6wsG+JoK/w6UmhFPuPm+j5w5fZlRvPayz/lk/Zb64Ij5OaaQERcg9oPnNtu4cWGTQrlxHTl/C4yv9NsaqFbTRDrmdNPbWcRI8IeBL6H8u7L+Syk+SPln82vyxkxKYt0TZfgA5MALmIfnbpc9ubHHPUcOEr364FZFh0aHeBBmHr0mJD+LRrtun8c7xqIrcCrSKgxkLF/iXv4kB0f0Np6mRijpsaVlG8RNzLupy8xT90sWyHB3rvq76YI++Bpmv6Gz34NanBUsl9jlXRScvIY8BvwObNCNcyneXSmqyOXo8VpmEs/+znZRLTDGRc9cWKPg+mu7ya8fkZLZ65DcmpE7vettmD5bB3ggyQ0X5tfrEOk6/we1IwAAblBrjdFiOb238Y2w1qmPjby2ZAenzpC5Am7rF0juWhiaPBwjltx4RJ1N9f3q X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:LOVP265MB8871.GBRP265.PROD.OUTLOOK.COM;PTR:;CAT:NONE;SFS:(13230040)(23010399003)(376014)(7416014)(10070799003)(1800799024)(366016)(6133799003)(56012099006)(4143699003)(22082099003)(18002099003);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?B?MU9yNHVLTEQrVmJIRVZsRmxyb2s1VklSK2lOMUtEN2QzcXVCQzlyMmE4ZEF3?= =?utf-8?B?V2N2Y2x0RHczb1YxU1RBWWJiNGlPOEx0TU5EcVVKZkJ5WnhDblVXMkV4dkVB?= =?utf-8?B?T2dpdnhuSUw2ZzZVbHVXS2NPRngrK3k1OHJMOHhpdFp0MkJiaXlDVGxCSEpm?= =?utf-8?B?UEcrdTVoM0F1R2o3aW9SRE9Pa2V2TGRuZGVYRnFmV3dEUzFxN01DK1h4LzI2?= =?utf-8?B?K1ZheTRFcHNTYmpwZmt5QXd5VXBuOVFFSHdNSk1md2NmcnYyM2swcWRZUElI?= =?utf-8?B?RXZ2a1F6S3loRVVTaXVaQ1Zyb04yVXpsb24zOHdPdHJHTnZydTFJQTdLQ1RY?= =?utf-8?B?TE9zWE9jK0hlSVVrT3BlaXlkVHZORStFUnJyZENlLzdaaUJMbU9UUjJ5UHlP?= =?utf-8?B?SDJIN29RS2xvMTRBSVZPRnk2Um9ScWtWV0dNZFRQa004czF2cHVzblhuMmpw?= =?utf-8?B?Zk1jNVdRRWg3U3J4RTNxSWZBYXF0WmUwMTBGYnVhY0FGUE5IYVFTTlltVHBU?= =?ut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aUhuWmtYaXB4dUNGbWVoQT09?= X-OriginatorOrg: garyguo.net X-MS-Exchange-CrossTenant-Network-Message-Id: 1ddaccdf-e5cf-419a-18ff-08decb95ffd6 X-MS-Exchange-CrossTenant-AuthSource: LOVP265MB8871.GBRP265.PROD.OUTLOOK.COM X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 16 Jun 2026 10:57:03.7061 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: bbc898ad-b10f-4e10-8552-d9377b823d45 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: hWpOCqG22rijmYNAKzb166mtS30Ob/MIqMcbtOOtwJKtVQ5Mz/CiJzWQ6NOQkJ2i13X3g3+9WNz9hrEM3xpong== X-MS-Exchange-Transport-CrossTenantHeadersStamped: LO4P265MB6965 On Tue Jun 16, 2026 at 8:57 AM BST, Alistair Popple wrote: > On 2026-06-16 at 03:15 +1000, Gary Guo wrote... >> On Mon Jun 15, 2026 at 3:40 PM BST, Eliot Courtney wrote: >> > Currently, `poll_msgq` will report a message of size 4 if the queue >> > pointers are broken. It's easy to catch this if it occurs, so have >> > `poll_msgq` return an error in this case. >> > >> > Signed-off-by: Eliot Courtney >> > --- >> > drivers/gpu/nova-core/falcon/fsp.rs | 15 +++++++++------ >> > 1 file changed, 9 insertions(+), 6 deletions(-) >> > >> > diff --git a/drivers/gpu/nova-core/falcon/fsp.rs b/drivers/gpu/nova-co= re/falcon/fsp.rs >> > index e7419a6e71e2..21eaa8e261ce 100644 >> > --- a/drivers/gpu/nova-core/falcon/fsp.rs >> > +++ b/drivers/gpu/nova-core/falcon/fsp.rs >> > @@ -107,19 +107,22 @@ fn read_emem(&mut self, bar: Bar0<'_>, data: &mu= t [u8]) -> Result { >> > /// Poll FSP for incoming data. >> > /// >> > /// Returns the size of available data in bytes, or 0 if no data = is available. >> > + /// Returns an error if the queue pointers are bogus (`tail < hea= d`). >> > /// >> > /// The FSP message queue is not circular. Pointers are reset to = 0 after each >> > /// message exchange, so `tail >=3D head` is always true when dat= a is present. >> > - fn poll_msgq(&self, bar: Bar0<'_>) -> u32 { >> > + fn poll_msgq(&self, bar: Bar0<'_>) -> Result { >> > let head =3D bar.read(regs::NV_PFSP_MSGQ_HEAD::at(0)).val(); >> > let tail =3D bar.read(regs::NV_PFSP_MSGQ_TAIL::at(0)).val(); >> > =20 >> > if head =3D=3D tail { >> > - return 0; >> > + Ok(0) >> > + } else { >> > + // TAIL points at the last DWORD written, so the size is = `tail - head + 4`. >> > + tail.checked_sub(head) >> > + .and_then(|delta| delta.checked_add(4)) >> > + .ok_or(EIO) >>=20 >> Whenever we fail with this, we should print a message (actually, the sam= e thing >> probably should be done for patch 1 as well). >>=20 >> A plain EIO is going be very difficult to troubleshoot if this is ever h= it. > > I don't disagree with the sentiment - this is a problem through out the k= ernel > and I have spent way too long tracing where exactly error codes have come= from > both in C and Rust. > > But it seems odd to worry about these particular instances - they _should= _ > never happen or at least be extremely rare and very unlikely by an end-us= er. I think we should either consider it possible and add prints, or consider i= t a bug (hardware or driver) and add a `WARN_ON`, or consider it impossible and= not add failure path at all. > More to the point though there are many other places in nova-core (and I'= m > sure other drivers) where this pattern of just returning a fairly generic > error code exists. So it feels like it would be nicer to deal with this a= t some > other layer, eg. some kind of debug option to tag error codes with locati= on > or something. This should happen whenever the information is lost. Creating a generic err= or code would be such occasion. Handling it at upper layers is okay if the information is kept for longer. For example: enum NovaError { ... } impl From for Error { fn from(err: NovaError) -> Self { // Print here EIO } } Would be fine to me because the information is emitted to user when it is l= ost by the concrete error -> error code conversion. Best, Gary > > So I'm not opposed to the comment, but maybe it would be better addressed= as a > separate question/patch series to figure out how to do this error reporti= ng in a > more generic or consistent way across all of Nova at least? > > - Alistair