From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from sender4-pp-f112.zoho.com (sender4-pp-f112.zoho.com [136.143.188.112]) (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 8A6DA30F532 for ; Wed, 21 Jan 2026 01:37:45 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=pass smtp.client-ip=136.143.188.112 ARC-Seal:i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1768959469; cv=pass; b=kohUAbPqKgjPuTqCH76HJgCwVxq+A6e3dolTDGWB98K73UnlGfsXfsgZ0/QmNilcw6K2RBOrzv22UX9ocI4mjAl65ZJ5bkDXwXatwwMVJ9/X9A4+MD/IeA2UOIytEI3xvqyf2fxm5dusErsXZ1imXnj0Bn7Gj+sw1E9KoEJiGys= ARC-Message-Signature:i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1768959469; c=relaxed/simple; bh=r7x6NAdz3lNN5T5Wgsemek1gQCRwo2d9ynmhsJsJLRI=; h=Date:From:To:Cc:Message-ID:In-Reply-To:References:Subject: MIME-Version:Content-Type; b=A//leuQkoGR/z6syHKMrObbpNSUTudfxhrfaKAKYgQfRT401gQMffv+E6YP/ogEPlcBt78izP5i1FvLyfkeNsp7Dj1trsDVujka01Pub3uLUtc2qvUT5I19uz3SY4cAU+M7kg0yXBjC8uYOGPwBEc4/W0N5z66cnAOujYqnfo6Y= ARC-Authentication-Results:i=2; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=linux.beauty; spf=pass smtp.mailfrom=linux.beauty; dkim=pass (1024-bit key) header.d=linux.beauty header.i=me@linux.beauty header.b=FTEGwngV; arc=pass smtp.client-ip=136.143.188.112 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=linux.beauty Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.beauty Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.beauty header.i=me@linux.beauty header.b="FTEGwngV" ARC-Seal: i=1; a=rsa-sha256; t=1768959452; cv=none; d=zohomail.com; s=zohoarc; b=liIeJTKXCCTCr5TmSEz7NNqhik/u8Lgoyl6wqMLoKAznnAIjdnWADV2hmFD7Lcl4TfZx7cjaT36PCVYQANmxQeq0vzBLg7VNsuPrP4wrLut5ZqUGrqwF24a/t+2GALw44P+uHy5N/+oLEKnekij5fJREsa7nXRwNjXhirWzM1HE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1768959452; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:MIME-Version:Message-ID:References:Subject:Subject:To:To:Message-Id:Reply-To; bh=289Atm7oPq1l3r6V8vm4GQYEXnTPwmsMGTT3QqYWfFE=; b=JrBf5NRjWzqzI3poX5JkkT4XxekzYgY/nmxTsMoh5TkJJZyrL/z6lAb/tJ2/oTWivoNKCUopt7P/roX/47EXU4lV8nqbLx3JO+hbYi1uOlo3YGri5ASkaclmbh1V6zmX4DrITJpovTfLhcXjZ8NyCME9vKo+KBL8OFg4f/RjAyI= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass header.i=linux.beauty; spf=pass smtp.mailfrom=me@linux.beauty; dmarc=pass header.from= DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; t=1768959452; s=zmail; d=linux.beauty; i=me@linux.beauty; h=Date:Date:From:From:To:To:Cc:Cc:Message-ID:In-Reply-To:References:Subject:Subject:MIME-Version:Content-Type:Content-Transfer-Encoding:Message-Id:Reply-To; bh=289Atm7oPq1l3r6V8vm4GQYEXnTPwmsMGTT3QqYWfFE=; b=FTEGwngVgxHZJC4CHqNeP06r2l8R0UEhOPrtbhJEB07L7h9qBkNqnN2gr5dQYnQq 9K52QKybxPDioAj7ibU7qNxnCuumgPDMG5S2HqpFFATWCkCGd3WfoqxwzPHiDds9tKU GB+eGSRY7qH6bPFE7pw9DhfhgN4DIrq6fGC4PYRA= Received: from mail.zoho.com by mx.zohomail.com with SMTP id 1768959451085884.078207294641; Tue, 20 Jan 2026 17:37:31 -0800 (PST) Date: Wed, 21 Jan 2026 09:37:31 +0800 From: Li Chen To: "Danilo Krummrich" Cc: "Dave Airlie" , "Lyude Paul" , "Maarten Lankhorst" , "Maxime Ripard" , "Thomas Zimmermann" , "Simona Vetter" , "dri-devel" , "nouveau" , "linux-kernel" Message-ID: <19bde331fbd.dd44bec734977.5910036498943757747@linux.beauty> In-Reply-To: References: <20260120121455.142960-1-me@linux.beauty> <19bde085588.1b451560725069.154128025837198067@linux.beauty> Subject: Re: [PATCH] nouveau: pci: quiesce GPU on shutdown Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Importance: Medium User-Agent: Zoho Mail X-Mailer: Zoho Mail Hi Danilo > On Wed Jan 21, 2026 at 1:50 AM CET, Li Chen wrote: > > > > + usleep_range(200, 400);\ > > >=20 > > > Why is this needed? it at least needs a comment. > > > > This patch is needed for kexec/KHO/LUO reboot: firmware reset is skipp= ed, so the GPU may remain in an active/DMA=20 > > state and the next kernel can fail to re-init nouveau. We can=E2=80=99= t call the full DRM/TTM teardown from ->shutdown() because > > userspace may still hold DRM fds during shutdown, which triggers WARNs= . > > > > So the shutdown hook reuses the suspend/quiesce path (safe with open f= ds) and then powers down the PCI function (D3hot) > > to leave the device in a consistent state for the next kernel. >=20 > I think the question was about the usleep_range() specifically. :) > Thanks for the hint.=20 That usleep_range(200, 400) is just to give the PCI power transition time t= o settle before an immediate kexec jump. It=E2=80=99s mirroring the existing nouveau_pmops_suspend() behavior, whic= h already does udelay(200) right after pci_set_power_state(..., PCI_D3hot).= In ->shutdown() we=E2=80=99re allowed to sleep, so I used usleep_range() instead of a busy-wait udelay(). =20 Regards, Li=E2=80=8B