From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 61A57C61DA4 for ; Sat, 28 Jan 2023 07:35:10 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233206AbjA1HfJ (ORCPT ); Sat, 28 Jan 2023 02:35:09 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36758 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234096AbjA1HfH (ORCPT ); Sat, 28 Jan 2023 02:35:07 -0500 Received: from mail-pj1-x1035.google.com (mail-pj1-x1035.google.com [IPv6:2607:f8b0:4864:20::1035]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 79C1A4B75C for ; Fri, 27 Jan 2023 23:34:48 -0800 (PST) Received: by mail-pj1-x1035.google.com with SMTP id e10-20020a17090a630a00b0022bedd66e6dso10778728pjj.1 for ; Fri, 27 Jan 2023 23:34:48 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=7LfU4NdFCY9mc96XzAftKL5sqMzYNYpuz0VuvSMcGko=; b=aOMpWODzMbhFL3U0nhkxf3JtSAEDLPoYqjDVsAiPDjmpzGOhoHNHzmJATT2eXZbmFT QhaNHRZiE0UXHnzwCAuJgyJHBBZB4sJRLsdKHLlCiTOTYwTx4S3CA3s+YiYTpTCbFHy/ Hp7Vhw4OpgMmE2PKnWTnxvPG5mLSurQjgiUWvv9PxtPSVqMTEh+zWMbpZiADnhmP4Wie CdeUNIUGGwzwf6D4pxWwzgYYB7EeHgRugrq/8Kcdxtl1Ifn4VjvnFsRT9d/x6DrHN52V LjsGBYLIlOOdfEc4rHTKV78v1buVq2Zs6KS92a4vsDyenvGrfrokDe7zk5qyS79UXHN7 CEBA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=7LfU4NdFCY9mc96XzAftKL5sqMzYNYpuz0VuvSMcGko=; b=ytNVugFhP/9BhVyz5BLAlf8P1b22hcfnNCxZDIiABerpCsmdfogUoj8VsL3xtKJ8sr 9UrHa6QJ3hQvznORLCS4PUvLN9HHVpPK9FrxULTCYxiKF+QMeqohkujhnZk9yPsKiC1M frxPOh+jZXvMfxauZwAJUWQX4VSbfLUnux0ulGl93cPIHuRpQWqTeUZU13vYt5gNko/Q e+hebKTK2lmXSlYxjOm2lht5gvDQWsVLYiEduvV+pBzK4tgwd0Wo45H99elzh/0pLKPd xzNfHjCgg9BBGgt8MssJS+El+1NsFsics12rPMxoo3XvPur/9dtnf6R26Z5qZ8MIWVTr cTMA== X-Gm-Message-State: AFqh2kqfdwZS5i3hQ4GZiRV6OgYz6YkzdKKlC2RU3whcIvoqhW+Ka5pF J+wNcI6GTVcNzMClNznMUC5Ie7zNGe8AOdNIFlL8Tg== X-Google-Smtp-Source: AMrXdXtm2ZrkaA0rw5RqDWYgPn1YG+GpZT4pmxbZ4JYnhM7L8m57SoxRptL9ssm4sTwpAl2zFa006VRnLiy4NJFPcco= X-Received: by 2002:a17:90a:7e8d:b0:225:d307:95ce with SMTP id j13-20020a17090a7e8d00b00225d30795cemr5435468pjl.136.1674891287679; Fri, 27 Jan 2023 23:34:47 -0800 (PST) MIME-Version: 1.0 References: <20230127001141.407071-1-saravanak@google.com> <20230127001141.407071-6-saravanak@google.com> In-Reply-To: From: Saravana Kannan Date: Fri, 27 Jan 2023 23:34:11 -0800 Message-ID: Subject: Re: [PATCH v2 05/11] driver core: fw_devlink: Add DL_FLAG_CYCLE support to device links To: Andy Shevchenko Cc: Greg Kroah-Hartman , "Rafael J. Wysocki" , Sudeep Holla , Cristian Marussi , Linus Walleij , Bartosz Golaszewski , Thomas Gleixner , Marc Zyngier , Shawn Guo , Sascha Hauer , Pengutronix Kernel Team , Fabio Estevam , NXP Linux Team , Rob Herring , Frank Rowand , Geert Uytterhoeven , Magnus Damm , Len Brown , Daniel Scally , Heikki Krogerus , Sakari Ailus , Tony Lindgren , Linux Kernel Functional Testing , Naresh Kamboju , Abel Vesa , Alexander Stein , Geert Uytterhoeven , John Stultz , Doug Anderson , Guenter Roeck , Dmitry Baryshkov , Maxim Kiselev , Maxim Kochetkov , Miquel Raynal , Luca Weiss , Colin Foster , Martin Kepplinger , Jean-Philippe Brucker , kernel-team@android.com, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-gpio@vger.kernel.org, devicetree@vger.kernel.org, linux-renesas-soc@vger.kernel.org, linux-acpi@vger.kernel.org Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-acpi@vger.kernel.org On Fri, Jan 27, 2023 at 1:30 AM Andy Shevchenko wrote: > > On Thu, Jan 26, 2023 at 04:11:32PM -0800, Saravana Kannan wrote: > > fw_devlink uses DL_FLAG_SYNC_STATE_ONLY device link flag for two > > purposes: > > > > 1. To allow a parent device to proxy its child device's dependency on a > > supplier so that the supplier doesn't get its sync_state() callback > > before the child device/consumer can be added and probed. In this > > usage scenario, we need to ignore cycles for ensure correctness of > > sync_state() callbacks. > > > > 2. When there are dependency cycles in firmware, we don't know which of > > those dependencies are valid. So, we have to ignore them all wrt > > probe ordering while still making sure the sync_state() callbacks > > come correctly. > > > > However, when detecting dependency cycles, there can be multiple > > dependency cycles between two devices that we need to detect. For > > example: > > > > A -> B -> A and A -> C -> B -> A. > > > > To detect multiple cycles correct, we need to be able to differentiate > > DL_FLAG_SYNC_STATE_ONLY device links used for (1) vs (2) above. > > > > To allow this differentiation, add a DL_FLAG_CYCLE that can be use to > > mark use case (2). We can then use the DL_FLAG_CYCLE to decide which > > DL_FLAG_SYNC_STATE_ONLY device links to follow when looking for > > dependency cycles. > > ... > > > +static inline bool device_link_flag_is_sync_state_only(u32 flags) > > +{ > > + return (flags & ~(DL_FLAG_INFERRED | DL_FLAG_CYCLE)) > > + == (DL_FLAG_SYNC_STATE_ONLY | DL_FLAG_MANAGED); > > Weird indentation, why not > > return (flags & ~(DL_FLAG_INFERRED | DL_FLAG_CYCLE)) == > (DL_FLAG_SYNC_STATE_ONLY | DL_FLAG_MANAGED); > > ? Ack. Will fix in v3. > > > +} > > ... > > > DL_FLAG_AUTOREMOVE_SUPPLIER | \ > > DL_FLAG_AUTOPROBE_CONSUMER | \ > > DL_FLAG_SYNC_STATE_ONLY | \ > > - DL_FLAG_INFERRED) > > + DL_FLAG_INFERRED | \ > > + DL_FLAG_CYCLE) > > You can make less churn by squeezing the new one above the last one. I feel like this part is getting bike shedded. I'm going to leave it as is. It's done in the order it's defined in the header and keeping it that way makes it way more easier to read than worry about a single line churn. -Saravana > > -- > With Best Regards, > Andy Shevchenko > > > -- > To unsubscribe from this group and stop receiving emails from it, send an email to kernel-team+unsubscribe@android.com. > From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 00134C27C76 for ; Sat, 28 Jan 2023 07:35:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:Cc:To:Subject:Message-ID:Date:From: In-Reply-To:References:MIME-Version:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=gqfeGtUoGBZPWesdocZLkHSvxjuXlxEJ9pNdpsGFhkU=; b=oqF2OoBzUJTKn0 T/pXYO0RwHpe4NIQGHq1KqZ3gUPBJAE/4Zj4ALpF5ujFcOe4nJrSeGUPvAxancQewVT+ftCyJhy1z yXTILJzssZNsKlnf4XqlXMbj4TDqLqsGFSEMXJUbJTXcHnpe4s3B+3xVfDX7CjueDHE5azzagZIdC Vl62ySVlZjt25QblPCaxoRX83O/X6ZucD8bQEZsbqs67fNpPb/C17oQEocNVvh2ePz1sgJObHmgvh tUaZDX88pf7Re1WSZoW/ug+/6FrArGHpCShhzlz+zcwWZdF8g/1o4KyEadmdLM7QH/uLKj08X7XHr mCuEooGcwO9iZKy6kpnQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1pLfjf-00HMra-Ep; Sat, 28 Jan 2023 07:34:51 +0000 Received: from mail-pj1-x1033.google.com ([2607:f8b0:4864:20::1033]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1pLfjc-00HMqh-Fw for linux-arm-kernel@lists.infradead.org; Sat, 28 Jan 2023 07:34:50 +0000 Received: by mail-pj1-x1033.google.com with SMTP id b10so6718061pjo.1 for ; Fri, 27 Jan 2023 23:34:48 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=7LfU4NdFCY9mc96XzAftKL5sqMzYNYpuz0VuvSMcGko=; b=aOMpWODzMbhFL3U0nhkxf3JtSAEDLPoYqjDVsAiPDjmpzGOhoHNHzmJATT2eXZbmFT QhaNHRZiE0UXHnzwCAuJgyJHBBZB4sJRLsdKHLlCiTOTYwTx4S3CA3s+YiYTpTCbFHy/ Hp7Vhw4OpgMmE2PKnWTnxvPG5mLSurQjgiUWvv9PxtPSVqMTEh+zWMbpZiADnhmP4Wie CdeUNIUGGwzwf6D4pxWwzgYYB7EeHgRugrq/8Kcdxtl1Ifn4VjvnFsRT9d/x6DrHN52V LjsGBYLIlOOdfEc4rHTKV78v1buVq2Zs6KS92a4vsDyenvGrfrokDe7zk5qyS79UXHN7 CEBA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=7LfU4NdFCY9mc96XzAftKL5sqMzYNYpuz0VuvSMcGko=; b=CULjsMyrFDnTCbO5sHHra49Fezu8DFWA1l65nlx2VMvRGUhLnmP10daqifZ6H0kVQP F+TWFQUQwJBTexbN/NkkNoB1527+jsBPyEdA5GXCuDl0UKQEcpBAJwsIkXNB+unzS3v3 kS1xkFLShQgDv2v+7idq8aV9RaQmvUe9wPZpNjg/3qLJqFTDFI0kgxYNq+iWaffOxGV/ l8r3Al07WRuiq/oooajZKAdjoX0AyDOH4fEqgZNuf/zqPe92dmygLHbNqPQXlmNkif4G iOzMnsAeELGdGyhCEPROid46yc3+DqoUFaVAuBTk+fTv3rx4MiszGVNBo+nGI8k2OkTj RJzg== X-Gm-Message-State: AFqh2kpkHsfXcM9CVdBzK8GYCCuHBZpJ2ou3ogDqQgelCvVzQ6jz8Jqv dtWNfeZjU/2o0O3Nk+uffUy+IrcmzASQGVuIwsGZAQ== X-Google-Smtp-Source: AMrXdXtm2ZrkaA0rw5RqDWYgPn1YG+GpZT4pmxbZ4JYnhM7L8m57SoxRptL9ssm4sTwpAl2zFa006VRnLiy4NJFPcco= X-Received: by 2002:a17:90a:7e8d:b0:225:d307:95ce with SMTP id j13-20020a17090a7e8d00b00225d30795cemr5435468pjl.136.1674891287679; Fri, 27 Jan 2023 23:34:47 -0800 (PST) MIME-Version: 1.0 References: <20230127001141.407071-1-saravanak@google.com> <20230127001141.407071-6-saravanak@google.com> In-Reply-To: From: Saravana Kannan Date: Fri, 27 Jan 2023 23:34:11 -0800 Message-ID: Subject: Re: [PATCH v2 05/11] driver core: fw_devlink: Add DL_FLAG_CYCLE support to device links To: Andy Shevchenko Cc: Greg Kroah-Hartman , "Rafael J. Wysocki" , Sudeep Holla , Cristian Marussi , Linus Walleij , Bartosz Golaszewski , Thomas Gleixner , Marc Zyngier , Shawn Guo , Sascha Hauer , Pengutronix Kernel Team , Fabio Estevam , NXP Linux Team , Rob Herring , Frank Rowand , Geert Uytterhoeven , Magnus Damm , Len Brown , Daniel Scally , Heikki Krogerus , Sakari Ailus , Tony Lindgren , Linux Kernel Functional Testing , Naresh Kamboju , Abel Vesa , Alexander Stein , Geert Uytterhoeven , John Stultz , Doug Anderson , Guenter Roeck , Dmitry Baryshkov , Maxim Kiselev , Maxim Kochetkov , Miquel Raynal , Luca Weiss , Colin Foster , Martin Kepplinger , Jean-Philippe Brucker , kernel-team@android.com, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-gpio@vger.kernel.org, devicetree@vger.kernel.org, linux-renesas-soc@vger.kernel.org, linux-acpi@vger.kernel.org X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230127_233448_561636_10335A17 X-CRM114-Status: GOOD ( 31.62 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Fri, Jan 27, 2023 at 1:30 AM Andy Shevchenko wrote: > > On Thu, Jan 26, 2023 at 04:11:32PM -0800, Saravana Kannan wrote: > > fw_devlink uses DL_FLAG_SYNC_STATE_ONLY device link flag for two > > purposes: > > > > 1. To allow a parent device to proxy its child device's dependency on a > > supplier so that the supplier doesn't get its sync_state() callback > > before the child device/consumer can be added and probed. In this > > usage scenario, we need to ignore cycles for ensure correctness of > > sync_state() callbacks. > > > > 2. When there are dependency cycles in firmware, we don't know which of > > those dependencies are valid. So, we have to ignore them all wrt > > probe ordering while still making sure the sync_state() callbacks > > come correctly. > > > > However, when detecting dependency cycles, there can be multiple > > dependency cycles between two devices that we need to detect. For > > example: > > > > A -> B -> A and A -> C -> B -> A. > > > > To detect multiple cycles correct, we need to be able to differentiate > > DL_FLAG_SYNC_STATE_ONLY device links used for (1) vs (2) above. > > > > To allow this differentiation, add a DL_FLAG_CYCLE that can be use to > > mark use case (2). We can then use the DL_FLAG_CYCLE to decide which > > DL_FLAG_SYNC_STATE_ONLY device links to follow when looking for > > dependency cycles. > > ... > > > +static inline bool device_link_flag_is_sync_state_only(u32 flags) > > +{ > > + return (flags & ~(DL_FLAG_INFERRED | DL_FLAG_CYCLE)) > > + == (DL_FLAG_SYNC_STATE_ONLY | DL_FLAG_MANAGED); > > Weird indentation, why not > > return (flags & ~(DL_FLAG_INFERRED | DL_FLAG_CYCLE)) == > (DL_FLAG_SYNC_STATE_ONLY | DL_FLAG_MANAGED); > > ? Ack. Will fix in v3. > > > +} > > ... > > > DL_FLAG_AUTOREMOVE_SUPPLIER | \ > > DL_FLAG_AUTOPROBE_CONSUMER | \ > > DL_FLAG_SYNC_STATE_ONLY | \ > > - DL_FLAG_INFERRED) > > + DL_FLAG_INFERRED | \ > > + DL_FLAG_CYCLE) > > You can make less churn by squeezing the new one above the last one. I feel like this part is getting bike shedded. I'm going to leave it as is. It's done in the order it's defined in the header and keeping it that way makes it way more easier to read than worry about a single line churn. -Saravana > > -- > With Best Regards, > Andy Shevchenko > > > -- > To unsubscribe from this group and stop receiving emails from it, send an email to kernel-team+unsubscribe@android.com. > _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel