All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Uwe Kleine-König" <u.kleine-koenig@pengutronix.de>
To: William Breathitt Gray <vilhelm.gray@gmail.com>
Cc: linux-iio@vger.kernel.org,
	Jarkko Nikula <jarkko.nikula@linux.intel.com>,
	linux-kernel@vger.kernel.org, kernel@pengutronix.de
Subject: Re: [PATCH v3 00/23] counter: cleanups and device lifetime fixes
Date: Thu, 6 Jan 2022 16:13:55 +0100	[thread overview]
Message-ID: <20220106151355.d4ogjpo3y5qnkrgs@pengutronix.de> (raw)
In-Reply-To: <YdWOkn2Gtd7FSYmR@shinobu>

[-- Attachment #1: Type: text/plain, Size: 1526 bytes --]

On Wed, Jan 05, 2022 at 09:26:58PM +0900, William Breathitt Gray wrote:
> On Wed, Dec 29, 2021 at 04:44:18PM +0100, Uwe Kleine-König wrote:
> >  - I think intel-qep.c makes the counter unfunctional in
> >    intel_qep_remove before the counter is unregistered.
> 
> Hello Uwe,
> 
> Would you elaborate some more on this? I think intel_qep_remove() is
> only called after the counter is unregistered because the struct
> counter_device parent is set to &pci->dev in intel_qep_probe(). Am I
> misunderstanding the removal path?

If the counter device is unbound (e.g. via sysfs), the following calls
are made:

	intel_qep_remove() (stopping the hardware?)
	devm_counter_release (devm callback of devm_counter_register or ..._add)
	then the release callbacks of the earlier devm functions

My concern is, that in the timeslot between intel_qep_remove() and
devm_counter_release() the device looks like a functional device and
might be queried/reconfigured/... while the hardware is already dead.

It's probably not a big issue (unless for example reading the counter
this race window makes the hardware hang?), but it's at least ugly.
Maybe the worst effect is that a counter value is missed (which is OK at
unregister time). Still it would be nicer to first take down the counter
device and only then stop the hardware.

Best regards
Uwe

-- 
Pengutronix e.K.                           | Uwe Kleine-König            |
Industrial Linux Solutions                 | https://www.pengutronix.de/ |

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

  reply	other threads:[~2022-01-06 15:14 UTC|newest]

Thread overview: 48+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-12-29 15:44 [PATCH v3 00/23] counter: cleanups and device lifetime fixes Uwe Kleine-König
2021-12-29 15:44 ` Uwe Kleine-König
2021-12-29 15:44 ` [PATCH v3 01/23] counter: Use container_of instead of drvdata to track counter_device Uwe Kleine-König
2021-12-29 15:44 ` [PATCH v3 02/23] counter: ftm-quaddec: Drop unused platform_set_drvdata() Uwe Kleine-König
2021-12-29 15:44 ` [PATCH v3 03/23] counter: microchip-tcb-capture: " Uwe Kleine-König
2021-12-29 15:44 ` [PATCH v3 04/23] counter: Provide a wrapper to access device private data Uwe Kleine-König
2021-12-29 15:44 ` [PATCH v3 05/23] counter: 104-quad-8: Convert to counter_priv() wrapper Uwe Kleine-König
2021-12-30 13:19   ` Greg Kroah-Hartman
2021-12-29 15:44 ` [PATCH v3 06/23] counter: interrupt-cnt: " Uwe Kleine-König
2021-12-29 15:44 ` [PATCH v3 07/23] counter: microchip-tcb-capture: " Uwe Kleine-König
2021-12-29 15:44 ` [PATCH v3 08/23] counter: intel-qep: " Uwe Kleine-König
2021-12-30 10:26   ` Jarkko Nikula
2021-12-29 15:44 ` [PATCH v3 09/23] counter: ftm-quaddec: " Uwe Kleine-König
2021-12-29 15:44 ` [PATCH v3 10/23] counter: ti-eqep: " Uwe Kleine-König
2021-12-29 22:42   ` William Breathitt Gray
2021-12-29 22:56   ` David Lechner
2021-12-29 15:44 ` [PATCH v3 11/23] counter: stm32-lptimer-cnt: " Uwe Kleine-König
2021-12-29 15:44   ` Uwe Kleine-König
2021-12-29 15:44 ` [PATCH v3 12/23] counter: stm32-timer-cnt: " Uwe Kleine-König
2021-12-29 15:44   ` Uwe Kleine-König
2021-12-29 15:44 ` [PATCH v3 13/23] counter: Provide alternative counter registration functions Uwe Kleine-König
2021-12-29 17:06   ` Jonathan Cameron
2021-12-30  8:38     ` Uwe Kleine-König
2021-12-29 15:44 ` [PATCH v3 14/23] counter: Update documentation for new " Uwe Kleine-König
2021-12-29 15:44 ` [PATCH v3 15/23] counter: 104-quad-8: Convert to new counter registration Uwe Kleine-König
2021-12-29 15:44 ` [PATCH v3 16/23] counter: interrupt-cnt: " Uwe Kleine-König
2021-12-29 15:44 ` [PATCH v3 17/23] counter: intel-qep: " Uwe Kleine-König
2021-12-30 10:26   ` Jarkko Nikula
2021-12-29 15:44 ` [PATCH v3 18/23] counter: ftm-quaddec: " Uwe Kleine-König
2021-12-29 15:44 ` [PATCH v3 19/23] counter: microchip-tcb-capture: " Uwe Kleine-König
2021-12-29 15:44 ` [PATCH v3 20/23] counter: stm32-timer-cnt: " Uwe Kleine-König
2021-12-29 15:44   ` Uwe Kleine-König
2021-12-29 15:44 ` [PATCH v3 21/23] counter: stm32-lptimer-cnt: " Uwe Kleine-König
2021-12-29 15:44   ` Uwe Kleine-König
2021-12-29 15:44 ` [PATCH v3 22/23] counter: ti-eqep: " Uwe Kleine-König
2021-12-29 22:56   ` David Lechner
2021-12-29 15:44 ` [PATCH v3 23/23] counter: remove old and now unused registration API Uwe Kleine-König
2021-12-30  8:53 ` [PATCH v3 00/23] counter: cleanups and device lifetime fixes Uwe Kleine-König
2021-12-30  8:53   ` Uwe Kleine-König
2021-12-30 12:31   ` Greg Kroah-Hartman
2021-12-30 12:31     ` Greg Kroah-Hartman
2021-12-30 14:58   ` Jonathan Cameron
2021-12-30 14:58     ` Jonathan Cameron
2021-12-30 15:08     ` Uwe Kleine-König
2021-12-30 15:08       ` Uwe Kleine-König
2022-01-05 12:26 ` William Breathitt Gray
2022-01-06 15:13   ` Uwe Kleine-König [this message]
2022-01-11  9:56     ` Jarkko Nikula

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220106151355.d4ogjpo3y5qnkrgs@pengutronix.de \
    --to=u.kleine-koenig@pengutronix.de \
    --cc=jarkko.nikula@linux.intel.com \
    --cc=kernel@pengutronix.de \
    --cc=linux-iio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=vilhelm.gray@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.