Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp2225972pxb; Fri, 5 Mar 2021 10:07:42 -0800 (PST) X-Google-Smtp-Source: ABdhPJwT9K7a5OXQa4hKSLTXLZoRRdeHI+ocWX4sLfktHdWUVDXMEvAoAq0frkJwCtqJzVh9n60m X-Received: by 2002:a17:906:2a8b:: with SMTP id l11mr3425547eje.1.1614967661879; Fri, 05 Mar 2021 10:07:41 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1614967661; cv=none; d=google.com; s=arc-20160816; b=evwAHFl5fxkvIMepy9nEwrjYUdUL+TtcPS5eYIioMfJU/W1Cr/svIUoI82dMKwybUc BJOYpGcI4xJTwArAb8fnjwUMnqzRAsvVRint4bod8xVDESMjR4y+x7nYs2RRRy8yqkBp rgLsE64XETQNe/4pJNxZ/7VB5lb8GpfDhIlTBiIfypiiM3mx6Va8vPFHjkuB9neSv+S3 MoUpN8mhJ75GaxH83UaSJvNZdabeAA+RdxfsP8GoGMK8WY6qn7n2WAcS7pmmr/D8/RbS 5hwLpTN9Wo5xjiS4CpD+mot50jefSqfwgN4KU3urTAzT79MFbtJT5JvtZ7w+3k8t289D Y+uw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=djl9vEdDtCECHGkkot2m0e+U91r4xg0cdS4xkGZwStE=; b=NgFeJNzJ3bhRvGWJbGBt47L6uFPKLJ9knUiHHEcKJ29YaC+4BliQKg32AXYjmJZh9v 9v1CU4IDsBtgCyesoyLOCRQ1OQpR2LTTgE6CfCWvfHUR3/IphehzH3jr/60TFzcyGPow 8NVY+E7taTgZJ54AnAR7H3MJGQCL+IlMdX5d/01HbbFCX9TB0tC2heJlRSQyq+JU/ETv Mpiv2Th5imxa8LAdJmT8rK6SCY6VqOm8QugoJ2uTi4995kUhon0WpcUijG6+G9KhbAi3 r9p18XorzgGbtofdr7Hcm4n9Oy+7vKRVp2eWlhsbl4Aso7WZte1jfRtUE8TRvOIf2tVR mW3Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=jutvhuQu; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id q27si2437494edi.328.2021.03.05.10.07.18; Fri, 05 Mar 2021 10:07:41 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=jutvhuQu; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229563AbhCESDz (ORCPT + 99 others); Fri, 5 Mar 2021 13:03:55 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52234 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229493AbhCESD0 (ORCPT ); Fri, 5 Mar 2021 13:03:26 -0500 Received: from mail-yb1-xb34.google.com (mail-yb1-xb34.google.com [IPv6:2607:f8b0:4864:20::b34]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0DBBAC061574 for ; Fri, 5 Mar 2021 10:03:26 -0800 (PST) Received: by mail-yb1-xb34.google.com with SMTP id p186so2874604ybg.2 for ; Fri, 05 Mar 2021 10:03:26 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=djl9vEdDtCECHGkkot2m0e+U91r4xg0cdS4xkGZwStE=; b=jutvhuQuZAGRZfaHNBelrYZZYMaWa8pHyKIdYZpe8tw2JMdjFN6PmAPPYw1nKt8ogm jfkg1okzS9DRtxQ+SLQk6IJKEzOVQmnRXgT0bNlSNBGJCB0xdinbvliRgul69b34ZQIQ JHDol7I+bkeA7wA1GoElotFHHuzyzUuGMOdwapEmQIuuxPH6huvYfcHYg9ILx62ChXTm QOeR6k0HjFp7U+xy63m1z33bO9SQv8IL1mr5YuRYUaOlK/OLcYDXp/7TY9uVhCmsUX3V ZQ1Cu1/RMi/PovRRLf/ZoWv1ji5ci06jiBE4+WFbytQVbF/01PPMp4kUsdUlW610pPxU NYEA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=djl9vEdDtCECHGkkot2m0e+U91r4xg0cdS4xkGZwStE=; b=pJ8CX74EsbDDB2gquokaMccOhwjr5vunN/WWaegkFviySQs7MW/I1ZROginW3BiaIm FAy8+MghaG3mOtabtpgrjZ7fEcwLLGp9re/trMHJcqJHQaF2JtWCwwKNIj0Q2ax3FYXs x6FdC0PNEZGbMMbaaIiZivcEJs3QNUbsAm8dNYvQyWLCa+CBB4hhhUlRQV+qzKFVyj3v rR27eHdZVDvaZLAKJe/qgRX4oE8WcymrOLnKa2Jev3GX7/YgwuTJWcozVYmbyCfScXjC sziUKke8juofR5t5Q9/sMgDmbpRBbG+1fVI74IS7wLZhW7LtbDGNGVIve+29SQGXkIxW th5g== X-Gm-Message-State: AOAM533IdD5o+Dd/ANfszuWGnI89vhC5ynR4d6rwwNt/N4rVe1RpFuAC gzDmolCn61Nu0BgCAEezSjMsKY4Qd2AVKnrddfLkHg== X-Received: by 2002:a25:c283:: with SMTP id s125mr14443325ybf.310.1614967405029; Fri, 05 Mar 2021 10:03:25 -0800 (PST) MIME-Version: 1.0 References: <20210304195101.3843496-1-saravanak@google.com> <30b4141e-11bd-45a2-b890-fddf444548ea@samsung.com> In-Reply-To: <30b4141e-11bd-45a2-b890-fddf444548ea@samsung.com> From: Saravana Kannan Date: Fri, 5 Mar 2021 10:02:48 -0800 Message-ID: Subject: Re: [PATCH v3] amba: Remove deferred device addition To: Marek Szyprowski Cc: Russell King , Philipp Zabel , Rob Herring , Ulf Hansson , John Stultz , Linus Walleij , Sudeep Holla , Nicolas Saenz Julienne , Geert Uytterhoeven , Android Kernel Team , LKML Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Mar 5, 2021 at 3:45 AM Marek Szyprowski wrote: > > Hi Saravana, > > On 04.03.2021 20:51, Saravana Kannan wrote: > > The uevents generated for an amba device need PID and CID information > > that's available only when the amba device is powered on, clocked and > > out of reset. So, if those resources aren't available, the information > > can't be read to generate the uevents. To workaround this requirement, > > if the resources weren't available, the device addition was deferred and > > retried periodically. > > > > However, this deferred addition retry isn't based on resources becoming > > available. Instead, it's retried every 5 seconds and causes arbitrary > > probe delays for amba devices and their consumers. > > > > Also, maintaining a separate deferred-probe like mechanism is > > maintenance headache. > > > > With this commit, instead of deferring the device addition, we simply > > defer the generation of uevents for the device and probing of the device > > (because drivers needs PID and CID to match) until the PID and CID > > information can be read. This allows us to delete all the amba specific > > deferring code and also avoid the arbitrary probing delays. > > > > Cc: Rob Herring > > Cc: Ulf Hansson > > Cc: John Stultz > > Cc: Saravana Kannan > > Cc: Linus Walleij > > Cc: Sudeep Holla > > Cc: Nicolas Saenz Julienne > > Cc: Geert Uytterhoeven > > Cc: Marek Szyprowski > > Cc: Russell King > > Signed-off-by: Saravana Kannan > > --- > > > > v1 -> v2: > > - Dropped RFC tag > > - Complete rewrite to not use stub devices. > > v2 -> v3: > > - Flipped the if() condition for hard-coded periphids. > > - Added a stub driver to handle the case where all amba drivers are > > modules loaded by uevents. > > - Cc Marek after I realized I forgot to add him. > > > > Marek, > > > > Would you mind testing this? It looks okay with my limited testing. > > It looks it works fine on my test systems. I've checked current > linux-next and this patch. You can add: > > Tested-by: Marek Szyprowski Hi Marek, Thanks! Does your test set up have amda drivers that are loaded based on uevents? That's the one I couldn't test. > I've briefly scanned the code and I'm curious how does it work. Does it > depend on the recently introduced "fw_devlink=on" feature? I don't see > other mechanism, which would trigger matching amba device if pm domains, > clocks or resets were not available on time to read pid/cid while adding > a device... No, it does not depend on fw_devlink or device links in any way. When a device is attempted to be probed (when it's added or during deferred probe), it's matched with all the drivers on the bus. When a new driver is registered to a bus, all devices in that bus are matched with the driver to see if they'll work together. That's how match is called. And match() can return -EPROBE_DEFER and that'll cause the device to be put in the deferred probe list by driver core. The tricky part in this patch was the uevent handling and the chicken-and-egg issue I talk about in the comments. Russell, Does this look good now? Plan to pick it up some time? Thanks, Saravana > > Best regards > -- > Marek Szyprowski, PhD > Samsung R&D Institute Poland >