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 gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (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 24856CD6E56 for ; Mon, 1 Jun 2026 00:13:51 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 28A7B112CA8; Mon, 1 Jun 2026 00:13:50 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (2048-bit key; secure) header.d=posteo.de header.i=@posteo.de header.b="rGX3uobs"; dkim-atps=neutral Received: from mout01.posteo.de (mout01.posteo.de [185.67.36.65]) by gabe.freedesktop.org (Postfix) with ESMTPS id 9385C112CA8 for ; Mon, 1 Jun 2026 00:13:48 +0000 (UTC) Received: from submission (posteo.de [185.67.36.169]) by mout01.posteo.de (Postfix) with ESMTPS id 99895240028 for ; Mon, 1 Jun 2026 02:13:46 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=posteo.de; s=2017; t=1780272826; bh=58DM2kFGXRR5SmndG7V65q0M9IaBZ64o8CgjV+M6VW4=; h=Message-ID:Subject:From:To:Cc:Date:Autocrypt:Content-Type: MIME-Version:OpenPGP:From; b=rGX3uobsJNPgjuOz2UMw14IrjFLfcBVZ5BqPQqTYw7daSKrrOx4cNGsZfO/Ip7yjq VbNtvt4wXslom4Rw9FmdGt6xvXOhqAFtnxZk4YcPvoHBRGhm/r3d6V1MhyWtc+rGlO oDOblvKAlza/5J2vLNJxQ6CeV6XhPHuvH7jGG5PwqBWzO9ZixEb4zVC3RDiKJcxz9b j0+P1m2patrY2OtMmwLWo7YDMSXlrc3J/BtYRaI1fzBnNeqq3wZVIS/QbDyXFRHMp9 L7X2wAiIWGQV1nz4a99ORAF347NJCsF05d6BDdEyLU5N/3yc0doy3vtGMqk1LQtn8J 273iMW/a4l+SA== Received: from customer (localhost [127.0.0.1]) by submission (posteo.de) with ESMTPSA id 4gTDvq6Y2sz6trs; Mon, 1 Jun 2026 02:13:43 +0200 (CEST) Message-ID: Subject: Re: [PATCH v11 1/3] rust: add basic serial device bus abstractions From: Markus Probst To: Danilo Krummrich Cc: Markus Probst via B4 Relay , Rob Herring , Greg Kroah-Hartman , Jiri Slaby , Miguel Ojeda , Gary Guo , =?ISO-8859-1?Q?Bj=F6rn?= Roy Baron , Benno Lossin , Andreas Hindborg , Alice Ryhl , Trevor Gross , Kari Argillander , "Rafael J. Wysocki" , Viresh Kumar , Boqun Feng , David Airlie , Simona Vetter , linux-serial@vger.kernel.org, linux-kernel@vger.kernel.org, rust-for-linux@vger.kernel.org, linux-pm@vger.kernel.org, driver-core@lists.linux.dev, dri-devel@lists.freedesktop.org Date: Mon, 01 Jun 2026 00:13:45 +0000 In-Reply-To: References: <20260531-rust_serdev-v11-0-dee8e0d830f1@posteo.de> <20260531-rust_serdev-v11-1-dee8e0d830f1@posteo.de> <12fa6237168ecf6dc65ebf46118beeb5c51f3d1c.camel@posteo.de> <7c30276759aaba8127275e602cb78783ec33bbe9.camel@posteo.de> Autocrypt: addr=markus.probst@posteo.de; prefer-encrypt=mutual; keydata=mQINBGiDvXgBEADAXUceKafpl46S35UmDh2wRvvx+UfZbcTjeQOlSwKP7YVJ4JOZrVs93 qReNLkOWguIqPBxR9blQ4nyYrqSCV+MMw/3ifyXIm6Pw2YRUDg+WTEOjTixRCoWDgUj1nOsvJ9tVA m76Ww+/pAnepVRafMID0rqEfD9oGv1YrfpeFJhyE2zUw3SyyNLIKWD6QeLRhKQRbSnsXhGLFBXCqt 9k5JARhgQof9zvztcCVlT5KVvuyfC4H+HzeGmu9201BVyihJwKdcKPq+n/aY5FUVxNTgtI9f8wIbm fAjaoT1pjXSp+dszakA98fhONM98pOq723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SAAAAAAAQADm1hbnUyLDIuNSsxLjExLDIsMgIbAwULCQgHAgIiAgYVCgkIC wIEFgIDAQIeBwIXgAAKCRA0dh/4561D0gKJD/9uOQKYlsDoQX65Gd0LiMT0C+5vXgr3VI0PHDOwcv 51fJ3A1vNyPZRFPGrz8+mDEXUQOF/INfnz5Tu1QHwf+iYcWcTGAN/FHgVR6ET6VBNU2hJaKhu+Ggo kjYyJTOvyX+3yNRUfSny0GjTjIPuPTErjqmHF+BtjXslpgwqnNMznf3lRIuUjRORupos6p3k1DndE 5vzUTmXSvMyXyOD2KhBl/kL76k0bHYyAQytZPag12pltrtFbA/r2phDGN2si8PooDT99bSTJjaM45 MTAAHbHKJfvgfK41bNFD5mMtpWpL195XRtS0Nrxdg3PaYBxN5gtTG0RyZfpYRlkdEhm+jj/8RxuSG i/qdhRdbiI7K2IELWeQVHSNDi9JabR/UzlR4NSnhfAjRIVlRM+eFbUl8XwxwVrAkojF5IraH2qRvg VCmuFsHUW07FUlrDrzpjXsD73cKppoFGDCdDR0BHJepXbFLS9+AqkT+guRJlnCTg2p+TQtnbwPgKp Vj98JixovCl99zRYTsL2bRNU5+q8iET65VMJ1ydyNanvLd5vI/NqDkXhlXLsGmdaDTtu4R21PkToX dQNGrZ91M9nlIBKw8Y7c7xZ4098qX2b8JX/CxD+gC1r4C8vuA3GkhFLx+KlkON7LyiJPkrePp6Qky jfGillcaQOqFZ3WwVqyzG1BUfTow== Content-Type: multipart/signed; micalg="pgp-sha256"; protocol="application/pgp-signature"; boundary="=-bug7M99IW+HdQKCtqoS/" MIME-Version: 1.0 OpenPGP: url=https://posteo.de/keys/markus.probst@posteo.de.asc; preference=encrypt X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" --=-bug7M99IW+HdQKCtqoS/ Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Mon, 2026-06-01 at 00:32 +0200, Danilo Krummrich wrote: > On Mon Jun 1, 2026 at 12:00 AM CEST, Markus Probst wrote: > > On Sun, 2026-05-31 at 23:49 +0200, Danilo Krummrich wrote: > > > On Sun May 31, 2026 at 9:42 PM CEST, Markus Probst wrote: > > > > I just noticed, is it even possible to use SRCU here? Currently the= mutex not > > > > only ensures that no drvdata access happens after drvdata drop, but= also that > > > > the receive_buf waits for the probe to complete, as the drvdata has= n't been > > > > initialized yet. > > >=20 > > > Yeah, if you drop the completion, you need the mutex. > > Is the performance impact on an mutex or on srcu + completion higher? >=20 > Weighing in the completion, the mutex probably wins as it will always be > uncontested under normal operation. >=20 > > >=20 > > > (In case it wasn't discussed in previous versions already, there is a= lso the > > > option to just attach separate private data to the receive callback, = which would > > > avoid this synchonization problem in the first place. > > >=20 > > > You could have serdev::Device::open(), which takes its own priv= ate data > > > and a corresponding close(), this way you'd allow drivers to control = whether > > > they want the serial line "open" or not. You just need to make sure i= t is closed > > > eventually.) > > This would add complexity with types, as we need to ensure that write, > > set_baudrate, set_parity etc. does not run when closed. >=20 > Right, but looking at a few serdev drivers, there seem to be a few cases = where > drivers need to close and re-open. That is something we could consider once there is a user. I am certain it would make it more complex, not less. >=20 > > > That said, I don't know what turns out to be the better approach. And= maybe it > > > simply isn't something this initial series has to tackle? I think you= r driver > > > does not implement the receive callback? > > The initial driver with only leds: no. > >=20 > > That changes once the driver also takes care of hwmon (ADC sensor and > > fan failure) and input (power button and possibly other buttons). >=20 > Maybe drop it from this initial series then and revisit with the first us= er? I would prefer it with this series. Except for probe and remove there should be no overhead if receive_buf is not implemented. As it will be needed eventually and it is basic serdev functionality, I don't see a reason to not include it now. Thanks - Markus Probst --=-bug7M99IW+HdQKCtqoS/ Content-Type: application/pgp-signature; name="signature.asc" Content-Description: This is a digitally signed message part -----BEGIN PGP SIGNATURE----- iQJPBAABCAA5FiEEgnQYxPSsWOdyMMRzNHYf+OetQ9IFAmoczq8bFIAAAAAABAAO bWFudTIsMi41KzEuMTIsMiwyAAoJEDR2H/jnrUPSZ+0P/2ylwrHvfHKKiTVBl/XF UL+HU/pmQkc3qwxSFyW3P7DLtY10V0r8kzPH2o35AC24avXePqjgo8hW2A5zAGqO u2gh9IV2XNBUKsF1CpV6bGaw/xCd3iUdmS8R8sIJfoNQJFj/EjDpL0SecHKz0iVd ARYzYY+xPCHLPGz8dxtGLgHq1pU4kIafkJ0K2+TYmSDVA9PRPlqhKgxDsWtFWVMb MnK6e+4HAqJaVNpITF7YmojKKIObqCmv8RnQWon6MaSQp1QK7F9b7Szyz1jN6435 iXMUcatC+McjLHNTvnRJgn0G50CNFX+/ETmnGHH6VVt/Mf4M+55B6HV9ziq72RD0 jnczWTHHTZwDgNjPgqQgRjeOOWHuKu4T9QKpJclOlcg6F3dmP7SYNTKX6iYYk1QQ 1cjwkUShY8HfcdcyWBf2ME3+D2fj73z/f59y/gFgIfKcMZGNuUHdbMTgGpUm9tcj GDgupxz7qS+CKzEBHzySTp9gKg6xzvA4gTcvzjoAk+3RrLhtFL/kFa8jvB5pvwlh CO1GwHsgiR6pPzqj4pAFI/JDF2/gcIMeOERTNAuAz1In8LpLCRzJuMFkmXXJ/XRy NYZyHMUT0PzUmfA1869YY2zN+FIRV0ykMAp0aKV4HhWm5qQpb3HYmGRMOhOJriVI sTK0zERHauHUMCm8i58Nnlf1 =TScp -----END PGP SIGNATURE----- --=-bug7M99IW+HdQKCtqoS/--