Received: by 2002:a05:7412:251c:b0:e2:908c:2ebd with SMTP id w28csp2470270rda; Wed, 25 Oct 2023 03:54:21 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHsA7BrCB63IUGloNPeUUBQhMxEKnwFMW9WbTYWQU2E3BFhDdLs7Ub+loN+XUVOxX24AjIT X-Received: by 2002:a05:620a:2d82:b0:76f:93e:4b30 with SMTP id tr2-20020a05620a2d8200b0076f093e4b30mr12551467qkn.67.1698231261439; Wed, 25 Oct 2023 03:54:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698231261; cv=none; d=google.com; s=arc-20160816; b=EfKCvM9D2Bf/CwHfJo4Hl78UUAC93m2DaIPf/h8jkhnjKXPJvm7/Tcm8M9DzKNJ2XL HA4j9YqHNjz8Jf0U0lwquC5BB3qFuzaLn14BfhTJzWvSdNHhmE/kHbAoUWpltk61opaa MTPDevI/v5eIri6Ls9Os6fCrvmeWAjKzDxLgikjV9je2OEKA3i6wPNdpuYIcLu/vHArW ghjAtJ5QeRIumQDyOxvwKjlg0SaneDUcSOubDmiz18aYWnnfZci5ehVxrL3SF8VoQqhj QltnGHQD314usAJiWg3oMuK8bNblJBrs+NSR8ewFeLsFiprwwgy7mbi4pIQShIgtVrHL ik6w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date; bh=45dRBJpFJAWkyYK/hEXDJhFkx/qNOPTynNHz5nYaDpo=; fh=m4xtPAS+Ix+U9tUqVDN+18J3mPLgcz62/03gGM94THc=; b=EZxAdaUXTLeojvSCh0RpXDGjSGO0vjU4gQdH58puK5aDXGn/bAKH2Axvdd9bfL7grd upV050mEHne0ylIR9CpSTzKAN7JzuBEY8SgjHJSFfudcARAgHsnWbd72ZAgZQBJ6DjiN dcznzUfPBQZCVq7aTtBcijT3nWaqo/BlKQqONMz4S/Y9ojaf/f4TgFMVdQlTrvQsGmv7 /u8iMAsPwlJj2e1C9Fnp+5fhGIbL0v5/2dcKsDYaFr0sWn9EazkXqKgug4CqYIAvSTuJ PM4OY0Fr8IGzyteO+PPK814KJYOqv7IVkNCgk5vNkpx7exUxVbcguEylc7yxZqFGeZ48 o7FQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:1 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from morse.vger.email (morse.vger.email. [2620:137:e000::3:1]) by mx.google.com with ESMTPS id a1-20020a0df101000000b005a7bab49336si11016163ywf.158.2023.10.25.03.54.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 25 Oct 2023 03:54:21 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:1 as permitted sender) client-ip=2620:137:e000::3:1; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:1 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by morse.vger.email (Postfix) with ESMTP id 91CFE801DB13; Wed, 25 Oct 2023 03:54:17 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at morse.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234618AbjJYKyG (ORCPT + 99 others); Wed, 25 Oct 2023 06:54:06 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35896 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234893AbjJYKsy (ORCPT ); Wed, 25 Oct 2023 06:48:54 -0400 Received: from metis.whiteo.stw.pengutronix.de (metis.whiteo.stw.pengutronix.de [IPv6:2a0a:edc0:2:b01:1d::104]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A9FED12D for ; Wed, 25 Oct 2023 03:48:47 -0700 (PDT) Received: from drehscheibe.grey.stw.pengutronix.de ([2a0a:edc0:0:c01:1d::a2]) by metis.whiteo.stw.pengutronix.de with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1qvbQQ-0001DN-Q8; Wed, 25 Oct 2023 12:47:46 +0200 Received: from [2a0a:edc0:0:900:1d::77] (helo=ptz.office.stw.pengutronix.de) by drehscheibe.grey.stw.pengutronix.de with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1qvbQO-0049gV-FC; Wed, 25 Oct 2023 12:47:44 +0200 Received: from ukl by ptz.office.stw.pengutronix.de with local (Exim 4.94.2) (envelope-from ) id 1qvbQO-005ubj-4j; Wed, 25 Oct 2023 12:47:44 +0200 Date: Wed, 25 Oct 2023 12:47:43 +0200 From: Uwe =?utf-8?Q?Kleine-K=C3=B6nig?= To: Sean Young Cc: Daniel Thompson , Hans de Goede , linux-media@vger.kernel.org, linux-pwm@vger.kernel.org, Ivaylo Dimitrov , Thierry Reding , Jonathan Corbet , Jani Nikula , Joonas Lahtinen , Rodrigo Vivi , Tvrtko Ursulin , David Airlie , Daniel Vetter , Javier Martinez Canillas , Jean Delvare , Guenter Roeck , Support Opensource , Dmitry Torokhov , Pavel Machek , Lee Jones , Mauro Carvalho Chehab , Ilpo =?utf-8?B?SsOkcnZpbmVu?= , Mark Gross , Liam Girdwood , Mark Brown , Jingoo Han , Helge Deller , linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, intel-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org, linux-hwmon@vger.kernel.org, linux-input@vger.kernel.org, linux-leds@vger.kernel.org, platform-driver-x86@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-fbdev@vger.kernel.org Subject: Re: [PATCH v3 1/3] pwm: make it possible to apply pwm changes in atomic context Message-ID: <20231025104743.56elaloj3jmojz2v@pengutronix.de> References: <90728c06-4c6c-b3d2-4723-c24711be2fa5@redhat.com> <20231019105118.64gdzzixwqrztjir@pengutronix.de> <01a505ac-320f-3819-a58d-2b82c1bf2a86@redhat.com> <20231023133417.GE49511@aspen.lan> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="kdxw67dv7iobkbz2" Content-Disposition: inline In-Reply-To: X-SA-Exim-Connect-IP: 2a0a:edc0:0:c01:1d::a2 X-SA-Exim-Mail-From: ukl@pengutronix.de X-SA-Exim-Scanned: No (on metis.whiteo.stw.pengutronix.de); SAEximRunCond expanded to false X-PTX-Original-Recipient: linux-kernel@vger.kernel.org X-Spam-Status: No, score=-0.8 required=5.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on morse.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 (morse.vger.email [0.0.0.0]); Wed, 25 Oct 2023 03:54:17 -0700 (PDT) --kdxw67dv7iobkbz2 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Hello, On Wed, Oct 25, 2023 at 10:53:27AM +0100, Sean Young wrote: > On Mon, Oct 23, 2023 at 02:34:17PM +0100, Daniel Thompson wrote: > > On Sun, Oct 22, 2023 at 11:46:22AM +0100, Sean Young wrote: > > > On Sat, Oct 21, 2023 at 11:08:22AM +0200, Hans de Goede wrote: > > > > On 10/19/23 12:51, Uwe Kleine-K=F6nig wrote: > > > > > On Wed, Oct 18, 2023 at 03:57:48PM +0200, Hans de Goede wrote: > > > > >> On 10/17/23 11:17, Sean Young wrote: > > > > > I think it's very subjective if you consider this > > > > > churn or not. > > > > > > > > I consider it churn because I don't think adding a postfix > > > > for what is the default/expected behavior is a good idea > > > > (with GPIOs not sleeping is the expected behavior). > > > > > > > > I agree that this is very subjective and very much goes > > > > into the territory of bikeshedding. So please consider > > > > the above my 2 cents on this and lets leave it at that. > > > > > > You have a valid point. Let's focus on having descriptive function na= mes. > >=20 > > For a couple of days I've been trying to resist the bikeshedding (esp. > > given the changes to backlight are tiny) so I'll try to keep it as > > brief as I can: > >=20 > > 1. I dislike the do_it() and do_it_cansleep() pairing. It is > > difficult to detect when a client driver calls do_it() by mistake. > > In fact a latent bug of this nature can only be detected by runtime > > testing with the small number of PWMs that do not support > > configuration from an atomic context. > >=20 > > In contrast do_it() and do_it_atomic()[*] means that although > > incorrectly calling do_it() from an atomic context can be pretty > > catastrophic it is also trivially detected (with any PWM driver) > > simply by running with CONFIG_DEBUG_ATOMIC_SLEEP. Wrongly calling the atomic variant (no matter how it's named) in a context where sleeping is possible is only a minor issue. Being faster than necessary is hardly a problem, so it only hurts by not being an preemption point with PREEMPT_VOLUNTARY which might not even be relevant because we're near to a system call anyhow. For me the naming is only very loosely related to the possible bugs. I think calling the wrong function happens mainly because the driver author isn't aware in which context the call happens and not because of wrong assumptions about the sleepiness of a certain function call. If you consider this an argument however, do_it + do_it_cansleep is better than do_it_atomic + do_it as wrongly assuming do_it would sleep is less bad than wrongly assuming do_it wouldn't sleep. (The latter is catched by CONFIG_DEBUG_ATOMIC_SLEEP, but only if it's enabled.) Having said that while my subjective preference ordering is (with first =3D best): do_it + do_it_cansleep do_it_atomic + do_it_cansleep do_it_atomic + do_it wi(th a _might_sleep or _mightsleep suffix ranging below _cansleep) I wouldn't get sleepless nights when I get overruled here (uwe_cansleep :-). > > No objections (beyond churn) to fully spelt out pairings such as > > do_it_cansleep() and do_it_atomic()[*]! >=20 > I must say I do like the look of this. Uwe, how do you feel about: > pwm_apply_cansleep() and pwm_apply_atomic()? I know we've talked about > pwm_apply_atomic in the past, however I think this this the best=20 > option I've seen so far. >=20 > > 2. If there is an API rename can we make sure the patch contains no > > other changes (e.g. don't introduce any new API in the same patch). > > Seperating renames makes the patches easier to review! > > It makes each one smaller and easier to review! >=20 > Yes, this should have been separated out. Will fix for next version. +1 Best regards Uwe --=20 Pengutronix e.K. | Uwe Kleine-K=F6nig | Industrial Linux Solutions | https://www.pengutronix.de/ | --kdxw67dv7iobkbz2 Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQEzBAABCgAdFiEEP4GsaTp6HlmJrf7Tj4D7WH0S/k4FAmU48k8ACgkQj4D7WH0S /k6W3AgAk4aFQs6woLctFKPwObedmFaF4LVusjnyP2JYEuwOcWzfmL/W31PFxuWP KEm7kc/16r0LD6qbwwgpOGUucBHmXKkmJa+0tdj/pRKkbkBfbA/RDaly9ZNh9Aql dZEuZ4CyAE7Pw6ea3ZQhQL1W4x37ZZwVPMvNmQaydtP5VBP1cBrml1SBcrT+6r0j j6N5LZR1Jb1+8XuisgUnufJAbBpykKTDJSdqwsREGb93kuDzhiTB7/YDFXe9P8fs NOvV78af278xkuohhXrWRRdqJSd+/PDGii+WImHHQpWcJPmcgwsXMCnjnK7DruZR Ket6emGp+CLdMp+GKhD7b53atfLNjQ== =7sp5 -----END PGP SIGNATURE----- --kdxw67dv7iobkbz2--