All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/2] Make sure .device_run is always called in non-atomic context
@ 2018-07-12 15:43 Ezequiel Garcia
  2018-07-12 15:43 ` [PATCH 1/2] v4l2-core: Simplify v4l2_m2m_try_{schedule,run} Ezequiel Garcia
  2018-07-12 15:43 ` [PATCH 2/2] v4l2-mem2mem: Avoid calling .device_run in v4l2_m2m_job_finish Ezequiel Garcia
  0 siblings, 2 replies; 7+ messages in thread
From: Ezequiel Garcia @ 2018-07-12 15:43 UTC (permalink / raw)
  To: linux-media
  Cc: Hans Verkuil, kernel, paul.kocialkowski, maxime.ripard,
	Hans Verkuil, Ezequiel Garcia

This series goal is avoiding drivers from having ad-hoc code
to call .device_run in non-atomic context. Currently, .device_run
can be called via v4l2_m2m_job_finish(), potentially running
in interrupt context.

This is needed for the upcoming Request API, where drivers typically
require .device_run to be called in non-atomic context for
v4l2_ctrl_request_setup() calls.

The solution is quite simple, instead of drivers having a threaded interrupt
or similar, the mem2mem core has a per-context worker that is scheduled
by v4l2_m2m_job_finish.

This change allows v4l2_m2m_job_finish() to be called in interrupt
context, separating .device_run and v4l2_m2m_job_finish() contexts.

It's worth mentioning that v4l2_m2m_cancel_job() doesn't need
to flush or cancel the new worker, because the job_spinlock
synchronizes both and also because the core prevents simultaneous
jobs. Either v4l2_m2m_cancel_job() will wait for the worker, or the
worker will be unable to run a new job.

Paul, Maxime: This should avoid the threaded interrupt in the Cedrus
driver. Please, take a look and let me know how it goes.

Patches are based on v4.18-rc4 plus:

c1dbb540e35e "v4l2-mem2mem: Simplify exiting the function in v4l2_m2m_try_schedule"
be3d3b78573b "media: mem2mem: Remove excessive try_run call"

Ezequiel Garcia (2):
  v4l2-core: Simplify v4l2_m2m_try_{schedule,run}
  v4l2-mem2mem: Avoid calling .device_run in v4l2_m2m_job_finish

 drivers/media/v4l2-core/v4l2-mem2mem.c | 58 ++++++++++----------------
 include/media/v4l2-mem2mem.h           |  2 +
 2 files changed, 25 insertions(+), 35 deletions(-)

-- 
2.18.0.rc2

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2018-07-19 23:57 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-07-12 15:43 [PATCH 0/2] Make sure .device_run is always called in non-atomic context Ezequiel Garcia
2018-07-12 15:43 ` [PATCH 1/2] v4l2-core: Simplify v4l2_m2m_try_{schedule,run} Ezequiel Garcia
2018-07-18 10:23   ` Hans Verkuil
2018-07-19 23:12     ` Ezequiel Garcia
2018-07-12 15:43 ` [PATCH 2/2] v4l2-mem2mem: Avoid calling .device_run in v4l2_m2m_job_finish Ezequiel Garcia
2018-07-18 10:21   ` Hans Verkuil
2018-07-19 23:06     ` Ezequiel Garcia

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.