* [PATCH] spi: trigger trace event for message-done before mesg->complete @ 2015-03-18 10:27 Uwe Kleine-König [not found] ` <1426674448-8246-1-git-send-email-u.kleine-koenig-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org> 0 siblings, 1 reply; 8+ messages in thread From: Uwe Kleine-König @ 2015-03-18 10:27 UTC (permalink / raw) To: Mark Brown Cc: linux-spi-u79uwXL29TY76Z2rM5mHXA, linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r, kernel-bIcnvbaLZ9MEGnE8C9+IrQ With spidev the mesg->complete callback points to spidev_complete. Calling this unblocks spidev_sync and so spidev_sync_write finishes. As the struct spi_message just read is a local variable in spidev_sync_write and recording the trace event accesses this message the recording is better done first. The same can happen for spidev_sync_read. This fixes an oops observed on a 3.14-rt system with spidev activity after echo 1 > /sys/kernel/debug/tracing/events/spi/enable . Signed-off-by: Uwe Kleine-König <u.kleine-koenig-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org> --- drivers/spi/spi.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/drivers/spi/spi.c b/drivers/spi/spi.c index 6d3b9b76c80b..df577518b770 100644 --- a/drivers/spi/spi.c +++ b/drivers/spi/spi.c @@ -994,13 +994,14 @@ void spi_finalize_current_message(struct spi_master *master) "failed to unprepare message: %d\n", ret); } } + + trace_spi_message_done(mesg); + master->cur_msg_prepared = false; mesg->state = NULL; if (mesg->complete) mesg->complete(mesg->context); - - trace_spi_message_done(mesg); } EXPORT_SYMBOL_GPL(spi_finalize_current_message); -- 2.1.4 -- To unsubscribe from this list: send the line "unsubscribe linux-spi" in the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org More majordomo info at http://vger.kernel.org/majordomo-info.html ^ permalink raw reply related [flat|nested] 8+ messages in thread
[parent not found: <1426674448-8246-1-git-send-email-u.kleine-koenig-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>]
* Re: [PATCH] spi: trigger trace event for message-done before mesg->complete [not found] ` <1426674448-8246-1-git-send-email-u.kleine-koenig-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org> @ 2015-03-18 11:36 ` Mark Brown [not found] ` <20150318113635.GB2869-GFdadSzt00ze9xe1eoZjHA@public.gmane.org> 0 siblings, 1 reply; 8+ messages in thread From: Mark Brown @ 2015-03-18 11:36 UTC (permalink / raw) To: Uwe Kleine-König Cc: linux-spi-u79uwXL29TY76Z2rM5mHXA, linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r, kernel-bIcnvbaLZ9MEGnE8C9+IrQ [-- Attachment #1: Type: text/plain, Size: 524 bytes --] On Wed, Mar 18, 2015 at 11:27:28AM +0100, Uwe Kleine-König wrote: > With spidev the mesg->complete callback points to spidev_complete. > Calling this unblocks spidev_sync and so spidev_sync_write finishes. As > the struct spi_message just read is a local variable in > spidev_sync_write and recording the trace event accesses this message > the recording is better done first. The same can happen for > spidev_sync_read. Applied, thanks. I'm a bit suspicious that the changelog talks only about spidev though... [-- Attachment #2: Digital signature --] [-- Type: application/pgp-signature, Size: 473 bytes --] ^ permalink raw reply [flat|nested] 8+ messages in thread
[parent not found: <20150318113635.GB2869-GFdadSzt00ze9xe1eoZjHA@public.gmane.org>]
* Re: [PATCH] spi: trigger trace event for message-done before mesg->complete [not found] ` <20150318113635.GB2869-GFdadSzt00ze9xe1eoZjHA@public.gmane.org> @ 2015-03-18 13:32 ` Uwe Kleine-König [not found] ` <20150318133226.GR10068-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org> 0 siblings, 1 reply; 8+ messages in thread From: Uwe Kleine-König @ 2015-03-18 13:32 UTC (permalink / raw) To: Mark Brown Cc: linux-spi-u79uwXL29TY76Z2rM5mHXA, linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r, kernel-bIcnvbaLZ9MEGnE8C9+IrQ On Wed, Mar 18, 2015 at 11:36:35AM +0000, Mark Brown wrote: > On Wed, Mar 18, 2015 at 11:27:28AM +0100, Uwe Kleine-König wrote: > > With spidev the mesg->complete callback points to spidev_complete. > > Calling this unblocks spidev_sync and so spidev_sync_write finishes. As > > the struct spi_message just read is a local variable in > > spidev_sync_write and recording the trace event accesses this message > > the recording is better done first. The same can happen for > > spidev_sync_read. > > Applied, thanks. I'm a bit suspicious that the changelog talks only > about spidev though... That's my workflow. Maybe the important thing here is also that I use -rt?! Best regards Uwe -- Pengutronix e.K. | Uwe Kleine-König | Industrial Linux Solutions | http://www.pengutronix.de/ | -- To unsubscribe from this list: send the line "unsubscribe linux-spi" in the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org More majordomo info at http://vger.kernel.org/majordomo-info.html ^ permalink raw reply [flat|nested] 8+ messages in thread
[parent not found: <20150318133226.GR10068-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>]
* Re: [PATCH] spi: trigger trace event for message-done before mesg->complete [not found] ` <20150318133226.GR10068-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org> @ 2015-03-18 13:58 ` Mark Brown [not found] ` <20150318135854.GI2869-GFdadSzt00ze9xe1eoZjHA@public.gmane.org> 0 siblings, 1 reply; 8+ messages in thread From: Mark Brown @ 2015-03-18 13:58 UTC (permalink / raw) To: Uwe Kleine-König Cc: linux-spi-u79uwXL29TY76Z2rM5mHXA, linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r, kernel-bIcnvbaLZ9MEGnE8C9+IrQ [-- Attachment #1: Type: text/plain, Size: 575 bytes --] On Wed, Mar 18, 2015 at 02:32:26PM +0100, Uwe Kleine-König wrote: > On Wed, Mar 18, 2015 at 11:36:35AM +0000, Mark Brown wrote: > > Applied, thanks. I'm a bit suspicious that the changelog talks only > > about spidev though... > That's my workflow. Maybe the important thing here is also that I use > -rt?! My point here is that the analysis of the issue shouldn't depend on spidev in particular, if you need to call out the specific driver you're working with that's an alarm sign that it's doing something weird and perhaps the problem is with the driver. [-- Attachment #2: Digital signature --] [-- Type: application/pgp-signature, Size: 473 bytes --] ^ permalink raw reply [flat|nested] 8+ messages in thread
[parent not found: <20150318135854.GI2869-GFdadSzt00ze9xe1eoZjHA@public.gmane.org>]
* Re: [PATCH] spi: trigger trace event for message-done before mesg->complete [not found] ` <20150318135854.GI2869-GFdadSzt00ze9xe1eoZjHA@public.gmane.org> @ 2015-03-18 14:48 ` Uwe Kleine-König [not found] ` <20150318144854.GS10068-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org> 0 siblings, 1 reply; 8+ messages in thread From: Uwe Kleine-König @ 2015-03-18 14:48 UTC (permalink / raw) To: Mark Brown Cc: kernel-bIcnvbaLZ9MEGnE8C9+IrQ, linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r, linux-spi-u79uwXL29TY76Z2rM5mHXA On Wed, Mar 18, 2015 at 01:58:54PM +0000, Mark Brown wrote: > On Wed, Mar 18, 2015 at 02:32:26PM +0100, Uwe Kleine-König wrote: > > On Wed, Mar 18, 2015 at 11:36:35AM +0000, Mark Brown wrote: > > > > Applied, thanks. I'm a bit suspicious that the changelog talks only > > > about spidev though... > > > That's my workflow. Maybe the important thing here is also that I use > > -rt?! > > My point here is that the analysis of the issue shouldn't depend on > spidev in particular, if you need to call out the specific driver you're > working with that's an alarm sign that it's doing something weird and > perhaps the problem is with the driver. This just happens to be the driver I saw the problem with. Don't have another spi device on that bus to cross check with other drivers. I wouldn't be too concerned here. Best regards Uwe -- Pengutronix e.K. | Uwe Kleine-König | Industrial Linux Solutions | http://www.pengutronix.de/ | -- To unsubscribe from this list: send the line "unsubscribe linux-spi" in the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org More majordomo info at http://vger.kernel.org/majordomo-info.html ^ permalink raw reply [flat|nested] 8+ messages in thread
[parent not found: <20150318144854.GS10068-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>]
* Re: [PATCH] spi: trigger trace event for message-done before mesg->complete [not found] ` <20150318144854.GS10068-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org> @ 2015-03-19 11:24 ` Mark Brown [not found] ` <20150319112430.GP2869-GFdadSzt00ze9xe1eoZjHA@public.gmane.org> 0 siblings, 1 reply; 8+ messages in thread From: Mark Brown @ 2015-03-19 11:24 UTC (permalink / raw) To: Uwe Kleine-König Cc: kernel-bIcnvbaLZ9MEGnE8C9+IrQ, linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r, linux-spi-u79uwXL29TY76Z2rM5mHXA [-- Attachment #1: Type: text/plain, Size: 778 bytes --] On Wed, Mar 18, 2015 at 03:48:54PM +0100, Uwe Kleine-König wrote: > On Wed, Mar 18, 2015 at 01:58:54PM +0000, Mark Brown wrote: > > My point here is that the analysis of the issue shouldn't depend on > > spidev in particular, if you need to call out the specific driver you're > > working with that's an alarm sign that it's doing something weird and > > perhaps the problem is with the driver. > This just happens to be the driver I saw the problem with. Don't have > another spi device on that bus to cross check with other drivers. I > wouldn't be too concerned here. Sure, but it's better to write it up in terms of a generic driver - it's the difference between "let's work around this driver" and "the core isn't doing the right thing for drivers here". [-- Attachment #2: Digital signature --] [-- Type: application/pgp-signature, Size: 473 bytes --] ^ permalink raw reply [flat|nested] 8+ messages in thread
[parent not found: <20150319112430.GP2869-GFdadSzt00ze9xe1eoZjHA@public.gmane.org>]
* Re: [PATCH] spi: trigger trace event for message-done before mesg->complete [not found] ` <20150319112430.GP2869-GFdadSzt00ze9xe1eoZjHA@public.gmane.org> @ 2015-03-19 11:48 ` Uwe Kleine-König [not found] ` <20150319114842.GU10068-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org> 0 siblings, 1 reply; 8+ messages in thread From: Uwe Kleine-König @ 2015-03-19 11:48 UTC (permalink / raw) To: Mark Brown Cc: linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r, kernel-bIcnvbaLZ9MEGnE8C9+IrQ, linux-spi-u79uwXL29TY76Z2rM5mHXA Hello Mark, On Thu, Mar 19, 2015 at 11:24:30AM +0000, Mark Brown wrote: > On Wed, Mar 18, 2015 at 03:48:54PM +0100, Uwe Kleine-König wrote: > > On Wed, Mar 18, 2015 at 01:58:54PM +0000, Mark Brown wrote: > > > > My point here is that the analysis of the issue shouldn't depend on > > > spidev in particular, if you need to call out the specific driver you're > > > working with that's an alarm sign that it's doing something weird and > > > perhaps the problem is with the driver. > > > This just happens to be the driver I saw the problem with. Don't have > > another spi device on that bus to cross check with other drivers. I > > wouldn't be too concerned here. > > Sure, but it's better to write it up in terms of a generic driver - it's > the difference between "let's work around this driver" and "the core > isn't doing the right thing for drivers here". OK, so something like: ------------>8------------ spi: trigger trace event for message-done before mesg->complete The message's complete callback might (permissibly) free the memory that holds the message. As recording the trace event for the end of a transfer accesses this message the recording is better done first. This fixes an oops observed on a 3.14-rt system with bus activity using spidev after echo 1 > /sys/kernel/debug/tracing/events/spi/enable . (For spidev mesg->complete points to spidev_complete. Calling that unblocks spidev_sync and so spidev_sync_write (or spidev_sync_read). This in turn leaves the scope of the local variable that holds the message.) ------------>8------------ Best regards Uwe -- Pengutronix e.K. | Uwe Kleine-König | Industrial Linux Solutions | http://www.pengutronix.de/ | -- To unsubscribe from this list: send the line "unsubscribe linux-spi" in the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org More majordomo info at http://vger.kernel.org/majordomo-info.html ^ permalink raw reply [flat|nested] 8+ messages in thread
[parent not found: <20150319114842.GU10068-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>]
* Re: [PATCH] spi: trigger trace event for message-done before mesg->complete [not found] ` <20150319114842.GU10068-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org> @ 2015-03-19 11:51 ` Mark Brown 0 siblings, 0 replies; 8+ messages in thread From: Mark Brown @ 2015-03-19 11:51 UTC (permalink / raw) To: Uwe Kleine-König Cc: linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r, kernel-bIcnvbaLZ9MEGnE8C9+IrQ, linux-spi-u79uwXL29TY76Z2rM5mHXA [-- Attachment #1: Type: text/plain, Size: 744 bytes --] On Thu, Mar 19, 2015 at 12:48:42PM +0100, Uwe Kleine-König wrote: > On Thu, Mar 19, 2015 at 11:24:30AM +0000, Mark Brown wrote: > > Sure, but it's better to write it up in terms of a generic driver - it's > > the difference between "let's work around this driver" and "the core > > isn't doing the right thing for drivers here". > OK, so something like: > spi: trigger trace event for message-done before mesg->complete > > The message's complete callback might (permissibly) free the memory that > holds the message. As recording the trace event for the end of a > transfer accesses this message the recording is better done first. Yes, that's the sort of thing I was looking for - it just makes the review a bit easier. [-- Attachment #2: Digital signature --] [-- Type: application/pgp-signature, Size: 473 bytes --] ^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2015-03-19 11:51 UTC | newest] Thread overview: 8+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2015-03-18 10:27 [PATCH] spi: trigger trace event for message-done before mesg->complete Uwe Kleine-König [not found] ` <1426674448-8246-1-git-send-email-u.kleine-koenig-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org> 2015-03-18 11:36 ` Mark Brown [not found] ` <20150318113635.GB2869-GFdadSzt00ze9xe1eoZjHA@public.gmane.org> 2015-03-18 13:32 ` Uwe Kleine-König [not found] ` <20150318133226.GR10068-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org> 2015-03-18 13:58 ` Mark Brown [not found] ` <20150318135854.GI2869-GFdadSzt00ze9xe1eoZjHA@public.gmane.org> 2015-03-18 14:48 ` Uwe Kleine-König [not found] ` <20150318144854.GS10068-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org> 2015-03-19 11:24 ` Mark Brown [not found] ` <20150319112430.GP2869-GFdadSzt00ze9xe1eoZjHA@public.gmane.org> 2015-03-19 11:48 ` Uwe Kleine-König [not found] ` <20150319114842.GU10068-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org> 2015-03-19 11:51 ` Mark Brown
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).