From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 50109363083; Fri, 13 Mar 2026 17:37:02 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=217.140.110.172 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773423424; cv=none; b=PQRwBySlx+PkL86voMfKlqat5wIwBUjPZ5wu8GawvvsxR+JVYSx34/uaVEOSjxi7OUKZLvv8EIM095myUmj1ZzWGYjQTrbIC0LUcSW/B1Ol064fBnI0rkmhWYtf5MBMC39m+Wo4Yp7EtjUUvKmcAEMmM1VMo3OyPIK7Y3Mp/tw8= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773423424; c=relaxed/simple; bh=hZeTLwStoZmvizMYnkC+7A2WwPp7RBp/jC0CRCby5jM=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=o6RQ3mGG/u22xzxRkFSTAEDapVsB9LBTb18anx3SXvh/McCGmnlnGUdfPQZvBy6TPM2GFDTBIrKTSLhy38Y1QAZ/Hh5ObLqJV3aB/MQPgRCSOtqJZaKruH/arTnM9FCrMOJwjpOVK6hXrvdrOOM0lm/YfKKLj5DMKEfikMYieqA= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arm.com; spf=pass smtp.mailfrom=arm.com; arc=none smtp.client-ip=217.140.110.172 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=arm.com Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 82FC4176A; Fri, 13 Mar 2026 10:36:55 -0700 (PDT) Received: from [10.57.59.200] (unknown [10.57.59.200]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 8E8C03F73B; Fri, 13 Mar 2026 10:36:58 -0700 (PDT) Message-ID: <4f9fdfc9-f2ad-49b1-a6b9-ae64aaa47cfd@arm.com> Date: Fri, 13 Mar 2026 17:36:56 +0000 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 v3] PCI: dw-rockchip: Enable async probe by default To: Danilo Krummrich Cc: Manivannan Sadhasivam , Manivannan Sadhasivam , Lorenzo Pieralisi , =?UTF-8?Q?Krzysztof_Wilczy=C5=84ski?= , Rob Herring , Bjorn Helgaas , Heiko Stuebner , Niklas Cassel , Shawn Lin , Hans Zhang <18255117159@163.com>, Nicolas Frattaroli , Wilfred Mallawa , linux-pci@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-rockchip@lists.infradead.org, linux-kernel@vger.kernel.org, Anand Moon , Grimmauld , Greg Kroah-Hartman , "Rafael J. Wysocki" , driver-core@lists.linux.dev, Lukas Wunner References: <20260226101032.1042-1-linux.amoon@gmail.com> <177260693908.10259.13055467642416391434.b4-ty@kernel.org> <87bc37ee-234c-4568-b72e-955c130a6838@arm.com> <5d88fb5b-e771-4ea6-8d2c-c5cfd21e5860@arm.com> <55c28218-1638-4b90-a9cd-a177fb5abcb6@arm.com> <6cfe4bda-036f-4bb9-8a08-ed75f61cae24@arm.com> From: Robin Murphy Content-Language: en-GB In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit On 2026-03-13 2:39 pm, Danilo Krummrich wrote: > On Fri Mar 13, 2026 at 2:15 PM CET, Robin Murphy wrote: >> On 2026-03-12 12:59 pm, Danilo Krummrich wrote: >>> On Thu Mar 12, 2026 at 1:48 PM CET, Robin Murphy wrote: >>>> On 2026-03-11 9:09 pm, Danilo Krummrich wrote: >>>>> From a driver-core perspective I think we're rather limited on what we can do; >>>>> we are already in async context at this point and can't magically go back to >>>>> initcall context. >>>>> >>>>> So, the only thing I can think of is to kick off work on a workqueue, which in >>>>> the end would be the same as the deferred probe handling. >>>> >>>> Hmm, in fact, isn't the deferred probe mechanism itself actually quite >>>> appropriate? >>> >>> Yes, I've also mentioned this in [1], including the fact that it technically >>> even complies with the guarantees given by PROBE_FORCE_SYNCHRONOUS. I.e. the >>> documentation says: >>> >>> Use this to annotate drivers that need their probe routines to run >>> synchronously with driver and device registration (with the exception of >>> -EPROBE_DEFER handling - re-probing always ends up being done >>> asynchronously). >>> >>> However, I'm still not sure how I feel about this, since I consider this to be >>> more like a workaround that just moves things to a "more approprite" async >>> context. >> >> I guess the underlying problem there is that there are at least 3 >> different significant aspects to what "synchronous" can mean: >> >> - literally in the context or device/driver registration as documented. >> Off-hand I'm not really sure what useful property may be *specific* to >> those conditions that a driver might rely on, other than for >> super-special cases like platform_driver_probe(). > > I'm not worried about this one, as it is already special by not being compatible > with deferred probe. I.e. the caller already has to promise that the > corresponding probe() call will never return -EPROBE_DEFER. > > This is a much more error prone requirement than just "don't call this from > async" already. > >> - serialised, i.e. probes of multiple devices won't happen concurrently >> on multiple threads. This is probably the one hiding the most driver >> bugs, e.g. internal shared/global state without sufficient >> synchronisation. I guess this falls out as a side-effect of the first >> condition, but AFAICS it *can* also still provided by deferred probe >> (given that it's a single work item iterating a list one-by-one) >> >> - in some regular thread context that isn't liable to have issues >> synchronising against other async_func workers (i.e. the request_module >> case). Again, deferred can't have a problem here, or it wouldn't have >> worked properly in general for the last decade. >> >> So it's not that we'd be relying on some dubious "deferred is always >> synchronous" assumption - AFAICS deferred *can* launch async if the >> driver permits it - more just ratifying that deferred is still able to >> effectively honour all the useful properties of PROBE_FORCE_SYNCHRONOUS >> other than "during registration of the thing". > > Yes, and as mentioned above, EPROBE_DEFER has always been a valid path for > PROBE_FORCE_SYNCHRONOUS, which is why I brought it up as a a workaround in the > first place. > > (The reason why I still say "workaround" is because nothing actually needs to be > deferred.) > > Anyways, as I mentioned... > >>> On the other hand, eventually we want everything to work with >>> PROBE_PREFER_ASYNCHRONOUS, so maybe it's also good enough for the time being. > > ...plus there are not a lot of PROBE_FORCE_SYNCHRONOUS left anyways. > > Do you want to send a patch? Sure, I just wanted to check that you didn't see anything obviously wrong with my reasoning-by-inspection - if you're sufficiently happy then I'll write this up as a proper commit message and post the patch (likely on Monday now) so we can all nit-pick the details :) Cheers, Robin.