Received: by 2002:a05:7412:e79e:b0:f3:1519:9f41 with SMTP id o30csp57710rdd; Wed, 22 Nov 2023 09:17:25 -0800 (PST) X-Google-Smtp-Source: AGHT+IG0BwayKc1FYQShspYH88nZMn5xruJ3t8bl2bk61btCCQ+JKmLiwgkwldcDw0nZwJNvAVOI X-Received: by 2002:a5e:9e4d:0:b0:7a9:44af:ca5c with SMTP id j13-20020a5e9e4d000000b007a944afca5cmr2675627ioq.12.1700673444808; Wed, 22 Nov 2023 09:17:24 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1700673444; cv=none; d=google.com; s=arc-20160816; b=VbU3gyEKqlU23Ecn+GzYqsxtLWxo1A6n1jeA4JaRymBrW/sAqZKky9dCVKg3fH2Z2F o8RZpBSqKKk3M6Ij+1FT2G5duFcd6wsFCRtvW05euA1+AWE73sR50iegHRECzcmdd2H7 Mg9bge3gJc2WvzXwCz+kPcQHykqQV2u4W5iuut1bsU3c3/xTKvVBXTCRF1tMshbV7RXC TKrpFLBfVQSqU/JqCL+xB5UHl/BSPOe6Of8wysHJ7cW6SCD9Y+yRqCotzsGqvD6rYBnI PQoRmpIGNZRIzyGJc1967y8IlSWwtSDoenQvwScsM5BjydHRlMzYy1hK0xyhzC9upuUC jqGg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :organization:references:in-reply-to:message-id:subject:cc:to:from :date:dkim-signature; bh=96QYHoZIDIT+pxG6t2aqCRbFyqHy2hKopbA6OtGC0ug=; fh=pm6lM3UqDIPs/aAq/43PUxPgrPpH+VJpTzRQZpNfirI=; b=xGFlsLVFFRnK3HCKWpcxwJNN3izPq4kQpyp+OeP9qWWbyjJ4eNMxeUVg6cZJILMmrS u4LwEajOzU543m7iT5arHKt3KDF8CxU5Sanw+rbgQVOTuARVvdAUEjAEBZBRqSjeYnHK iFfEIayiNk0KNuaang1vq5mhMMMbp6AcIsD5Xer6CY6qEY6s3zDTUGAUI5xGnta7Kgbr v2/zEtcCM5YW7Ed56+D6dOcu8jlPMJCtn31QE8sh18tbXtwJQmWGO+x57TEnj9cORmlN eHFBih6FAO+lHBdSJ0vkLslQOcenOsKHqszuRPtrA3wMDVXndCdvnjh4692QgO4Ozwi5 BKmA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@bootlin.com header.s=gm1 header.b=KUA08b5U; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:8 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=bootlin.com Return-Path: Received: from fry.vger.email (fry.vger.email. [2620:137:e000::3:8]) by mx.google.com with ESMTPS id bx15-20020a056a02050f00b005b91536981csi14751196pgb.11.2023.11.22.09.17.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 22 Nov 2023 09:17:24 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:8 as permitted sender) client-ip=2620:137:e000::3:8; Authentication-Results: mx.google.com; dkim=pass header.i=@bootlin.com header.s=gm1 header.b=KUA08b5U; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:8 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=bootlin.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by fry.vger.email (Postfix) with ESMTP id DB93E8336C57; Wed, 22 Nov 2023 09:17:19 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at fry.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344000AbjKVRQ6 (ORCPT + 99 others); Wed, 22 Nov 2023 12:16:58 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59188 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233978AbjKVRQ4 (ORCPT ); Wed, 22 Nov 2023 12:16:56 -0500 Received: from relay3-d.mail.gandi.net (relay3-d.mail.gandi.net [217.70.183.195]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8CA73191; Wed, 22 Nov 2023 09:16:50 -0800 (PST) Received: by mail.gandi.net (Postfix) with ESMTPSA id D9EEC60005; Wed, 22 Nov 2023 17:16:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=gm1; t=1700673409; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=96QYHoZIDIT+pxG6t2aqCRbFyqHy2hKopbA6OtGC0ug=; b=KUA08b5UpgDVT1Kju2OmlHYuYPXgqPrvOrFBHuw1abLqkrs5cPxtdYXHtnbwYAM8lelA88 jm1PutjS30gkjtNygopDI5oZa0aJYFHh7SRzlVxIaoMc7obiW98oKo9db1aOdIPGCW+A+C Ash1xYvo6E/RUmxVsIOS+G3F2KZajj+gPzSNz2utAQUa+X+rnPhvWsIVFLRCs4mq64rsBG 8B7O9KyJl52TiZ+/MIssxF4mxVn1/f9NlVuCbIJ2wlGym9utHkXm9tApy4zUQC6HIOOp86 x8o7ABaAu2TcLEwT2lNVvP6XDl3FtfSjSIZQbG8r9V97Vf2j85MUjhDjUTDdDQ== Date: Wed, 22 Nov 2023 18:16:47 +0100 From: =?UTF-8?B?S8O2cnk=?= Maincent To: Andrew Lunn Cc: "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Jonathan Corbet , Luis Chamberlain , Russ Weight , Greg Kroah-Hartman , "Rafael J. Wysocki" , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Thomas Petazzoni , netdev@vger.kernel.org, linux-kernel@vger.kernel.org, linux-doc@vger.kernel.org, devicetree@vger.kernel.org Subject: Re: [PATCH net-next 9/9] net: pse-pd: Add PD692x0 PSE controller driver Message-ID: <20231122181647.06d9c3c9@kmaincent-XPS-13-7390> In-Reply-To: <04f59e77-134b-45b2-8759-84b8e22c30d5@lunn.ch> References: <20231116-feature_poe-v1-0-be48044bf249@bootlin.com> <20231116-feature_poe-v1-9-be48044bf249@bootlin.com> <2ff8bea5-5972-4d1a-a692-34ad27b05446@lunn.ch> <20231122171112.59370d21@kmaincent-XPS-13-7390> <04f59e77-134b-45b2-8759-84b8e22c30d5@lunn.ch> Organization: bootlin X-Mailer: Claws Mail 3.17.5 (GTK+ 2.24.32; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-GND-Sasl: kory.maincent@bootlin.com X-Spam-Status: No, score=-0.9 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on fry.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (fry.vger.email [0.0.0.0]); Wed, 22 Nov 2023 09:17:20 -0800 (PST) On Wed, 22 Nov 2023 17:54:53 +0100 Andrew Lunn wrote: > > > > +static int pd692x0_sendrecv_msg(struct pd692x0_priv *priv, > > > > + struct pd692x0_msg *msg, > > > > + struct pd692x0_msg_content *buf) > > > > +{ > > > > + struct device *dev =3D &priv->client->dev; > > > > + int ret; > > > > + > > > > + ret =3D pd692x0_send_msg(priv, msg); > > > > + if (ret) > > > > + return ret; > > > > + > > > > + ret =3D pd692x0_recv_msg(priv, msg, buf); =20 > > >=20 > > > So this function takes at least 10 seconds? =20 > >=20 > > No, on normal communication it takes a bit more than 30ms. =20 >=20 > So i think the first step is to refactor this code to make it clear > what the normal path is, and what the exception path is, and the > timing of each. Ok I will try to refactor it to makes it more readable. > > > > + msg.content.sub[2] =3D id; > > > > + ret =3D pd692x0_sendrecv_msg(priv, &msg, &buf); =20 > > >=20 > > > So this is also 10 seconds?=20 > > >=20 > > > Given its name, it looks like this is called via ethtool? Is the > > > ethtool core holding RTNL? It is generally considered bad to hold RTN= L for > > > that long. =20 > >=20 > > Yes it is holding RTNL lock. Should I consider another behavior in case= of > > communication loss to not holding RTNL lock so long? =20 >=20 > How often does it happen? On the scale of its a theoretical > possibility, through to it happens every N calls? Also, does it happen > on cold boot and reboot? >=20 > If its never supposed to happen, i would keep holding RTNL, and add a > pr_warn() that the PSE has crashed and burned, waiting for it to > reboot. If this is likely to happen on the first communication with > the device, we might want to do a dummy transfer during probe to get > is synchronized before we start using it with the RTNL held. I would say it never supposed to happen. I never faced the issue playing with the controller. The first communicatio= n is a simple i2c_master_recv of the controller status without entering the pd692x0_sendrecv_msg function, therefore it won't be an issue. Another solution could be to raise a flag if I enter in communication loss = and release the rtnlock. We would lock again the rtnl when the flags got disabl= ed. The controler won't be accessible until the flag is disabled. Regards, --=20 K=C3=B6ry Maincent, Bootlin Embedded Linux and kernel engineering https://bootlin.com